diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 88d39177..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build -on: - push: - branches: - - master - pull_request: - types: [ opened, synchronize, reopened ] -jobs: - unit-tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm --prefix users/authservice ci - - run: npm --prefix users/userservice ci - - run: npm --prefix gatewayservice ci - - run: npm --prefix webapp ci - - run: npm --prefix users/authservice test -- --coverage - - run: npm --prefix users/userservice test -- --coverage - - run: npm --prefix gatewayservice test -- --coverage - - run: npm --prefix webapp test -- --coverage - - name: Analyze with SonarCloud - uses: sonarsource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 95f3dff6..32a3545e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,14 @@ target/ !**/src/main/**/target/ !**/src/test/**/target/ +### HSQLDB ### +database/hsqldb/build/ +database/hsqldb/data/ +database/hsqldb/doc/ +database/hsqldb/lib/ +database/hsqldb/src/ +database/hsqldb/testrun/ + ### STS ### .apt_generated .classpath diff --git a/database/hsqldb/data/test.lck b/database/hsqldb/data/test.lck deleted file mode 100644 index d08d2b77..00000000 Binary files a/database/hsqldb/data/test.lck and /dev/null differ diff --git a/database/hsqldb/data/test.log b/database/hsqldb/data/test.log deleted file mode 100644 index dd542e3b..00000000 --- a/database/hsqldb/data/test.log +++ /dev/null @@ -1,3 +0,0 @@ -/*C1*/SET SCHEMA SYSTEM_LOBS -INSERT INTO BLOCKS VALUES(0,2147483647,0) -COMMIT diff --git a/database/hsqldb/data/test.properties b/database/hsqldb/data/test.properties deleted file mode 100644 index 918179e2..00000000 --- a/database/hsqldb/data/test.properties +++ /dev/null @@ -1,5 +0,0 @@ -#HSQL Database Engine 2.7.2 -#Mon Feb 19 20:12:00 CET 2024 -tx_timestamp=1 -modified=yes -version=2.7.2 diff --git a/database/hsqldb/data/test.script b/database/hsqldb/data/test.script deleted file mode 100644 index d5ddda2c..00000000 --- a/database/hsqldb/data/test.script +++ /dev/null @@ -1,44 +0,0 @@ -SET DATABASE UNIQUE NAME HSQLDB8DC2C840C9 -SET DATABASE DEFAULT RESULT MEMORY ROWS 0 -SET DATABASE EVENT LOG LEVEL 0 -SET DATABASE TRANSACTION CONTROL LOCKS -SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED -SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE -SET DATABASE TEXT TABLE DEFAULTS '' -SET DATABASE SQL NAMES FALSE -SET DATABASE SQL RESTRICT EXEC FALSE -SET DATABASE SQL REFERENCES FALSE -SET DATABASE SQL SIZE TRUE -SET DATABASE SQL TYPES FALSE -SET DATABASE SQL TDC DELETE TRUE -SET DATABASE SQL TDC UPDATE TRUE -SET DATABASE SQL SYS INDEX NAMES TRUE -SET DATABASE SQL CONCAT NULLS TRUE -SET DATABASE SQL UNIQUE NULLS TRUE -SET DATABASE SQL CONVERT TRUNCATE TRUE -SET DATABASE SQL AVG SCALE 0 -SET DATABASE SQL DOUBLE NAN TRUE -SET FILES WRITE DELAY 500 MILLIS -SET FILES BACKUP INCREMENT TRUE -SET FILES CACHE SIZE 10000 -SET FILES CACHE ROWS 50000 -SET FILES SCALE 32 -SET FILES LOB SCALE 32 -SET FILES DEFRAG 0 -SET FILES NIO TRUE -SET FILES NIO SIZE 256 -SET FILES LOG TRUE -SET FILES LOG SIZE 50 -SET FILES CHECK 1 -SET DATABASE COLLATION SQL_TEXT PAD SPACE -CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e' -ALTER USER SA SET LOCAL TRUE -CREATE SCHEMA PUBLIC AUTHORIZATION DBA -ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 -SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC -GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC -GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC -GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC -GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC -GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC -GRANT DBA TO SA diff --git a/database/hsqldb/doc/apidocs/allclasses-index.html b/database/hsqldb/doc/apidocs/allclasses-index.html deleted file mode 100644 index 8c4b8335..00000000 --- a/database/hsqldb/doc/apidocs/allclasses-index.html +++ /dev/null @@ -1,1239 +0,0 @@ - - - - - -All Classes (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

All Classes

-
-
- -
-
- - - diff --git a/database/hsqldb/doc/apidocs/allclasses.html b/database/hsqldb/doc/apidocs/allclasses.html deleted file mode 100644 index 266a3a63..00000000 --- a/database/hsqldb/doc/apidocs/allclasses.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - -All Classes (HSQLDB 2.7.2 API) - - - - - - - - - - - - -

All Classes

-
- -
- - diff --git a/database/hsqldb/doc/apidocs/allpackages-index.html b/database/hsqldb/doc/apidocs/allpackages-index.html deleted file mode 100644 index e2996fce..00000000 --- a/database/hsqldb/doc/apidocs/allpackages-index.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - -All Packages (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

All Packages

-
-
- -
-
- - - diff --git a/database/hsqldb/doc/apidocs/constant-values.html b/database/hsqldb/doc/apidocs/constant-values.html deleted file mode 100644 index 5823e74f..00000000 --- a/database/hsqldb/doc/apidocs/constant-values.html +++ /dev/null @@ -1,1503 +0,0 @@ - - - - - -Constant Field Values (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Constant Field Values

-
-

Contents

- -
-
-
- - -
-

org.hsqldb.*

- - - - - -
    -
  • - - - - - - - - - - - - - - -
    org.hsqldb.util.RCData 
    Modifier and TypeConstant FieldValue
    - -public static final java.lang.StringDEFAULT_JDBC_DRIVER"org.hsqldb.jdbc.JDBCDriver"
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - -
    org.hsqldb.util.TableSorter 
    Modifier and TypeConstant FieldValue
    - -public static final intASCENDING1
    - -public static final intDESCENDING-1
    - -public static final intNOT_SORTED0
    -
  • -
-
-
-
- - - diff --git a/database/hsqldb/doc/apidocs/deprecated-list.html b/database/hsqldb/doc/apidocs/deprecated-list.html deleted file mode 100644 index 14ea52c0..00000000 --- a/database/hsqldb/doc/apidocs/deprecated-list.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - -Deprecated List (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Deprecated API

-

Contents

- -
-
- - - -
-
- - - diff --git a/database/hsqldb/doc/apidocs/element-list b/database/hsqldb/doc/apidocs/element-list deleted file mode 100644 index 1214218d..00000000 --- a/database/hsqldb/doc/apidocs/element-list +++ /dev/null @@ -1,9 +0,0 @@ -module:org.hsqldb -org.hsqldb.auth -org.hsqldb.jdbc -org.hsqldb.jdbc.pool -org.hsqldb.lib -org.hsqldb.lib.tar -org.hsqldb.server -org.hsqldb.trigger -org.hsqldb.util diff --git a/database/hsqldb/doc/apidocs/help-doc.html b/database/hsqldb/doc/apidocs/help-doc.html deleted file mode 100644 index d49f6300..00000000 --- a/database/hsqldb/doc/apidocs/help-doc.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - -API Help (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

How This API Document Is Organized

-
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
-
-
- -
-This help file applies to API documentation generated by the standard doclet.
-
- - - diff --git a/database/hsqldb/doc/apidocs/hsqldbs.png b/database/hsqldb/doc/apidocs/hsqldbs.png deleted file mode 100644 index 4512b84f..00000000 Binary files a/database/hsqldb/doc/apidocs/hsqldbs.png and /dev/null differ diff --git a/database/hsqldb/doc/apidocs/index-all.html b/database/hsqldb/doc/apidocs/index-all.html deleted file mode 100644 index 21542759..00000000 --- a/database/hsqldb/doc/apidocs/index-all.html +++ /dev/null @@ -1,10943 +0,0 @@ - - - - - -Index (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
A B C D E F G H I J K L M N O P Q R S T U V W Z 
All Classes All Packages - - -

A

-
-
abort(Executor) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Terminates an open connection.
-
-
absolute(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the given row number in - this ResultSet object.
-
-
absolutePath(String) - Method in class org.hsqldb.lib.FileUtil
-
-
Retrieves the absolute path, given some path specification.
-
-
acceptsURL(String) - Method in class org.hsqldb.jdbc.JDBCDriver
-
-
Returns true if the driver thinks that it can open a connection to - the given URL.
-
-
AclFormatException(String) - Constructor for exception org.hsqldb.server.ServerAcl.AclFormatException
-
 
-
actionPerformed(ActionEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
actionPerformed(ActionEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
actionPerformed(ActionEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
add(int) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
add(int) - Method in class org.hsqldb.lib.IntIndex
-
-
Adds a key, maintaining sort order on - current search target column.
-
-
add(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Adds a pair, maintaining sort order on - current search target column.
-
-
add(int, int) - Method in interface org.hsqldb.lib.IntLookup
-
 
-
add(int, E) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Inserts an element at the given index
-
-
add(int, E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
add(int, E) - Method in interface org.hsqldb.lib.List
-
 
-
add(int, E) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
add(long) - Method in class org.hsqldb.lib.LongDeque
-
 
-
add(long) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
add(long, long) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
add(long, long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
add(long, long) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
add(E) - Method in interface org.hsqldb.lib.Collection
-
 
-
add(E) - Method in class org.hsqldb.lib.HashSet
-
-
returns true if element is added
-
-
add(E) - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
add(E) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Appends an element to the end of the list
-
-
add(E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
add(E) - Method in interface org.hsqldb.lib.HsqlHeap
-
-
Adds the specified element to this Heap.
-
-
add(E) - Method in interface org.hsqldb.lib.List
-
 
-
add(Integer) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
add(K, V) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
add(OrderedHashSet<E>, E) - Static method in class org.hsqldb.lib.OrderedHashSet
-
 
-
addAll(int[]) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
addAll(int, Collection) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
addAll(E[]) - Method in class org.hsqldb.lib.HashSet
-
-
returns true if any element is added
-
-
addAll(E[], int, int) - Method in class org.hsqldb.lib.HashSet
-
-
returns true if any added
-
-
addAll(Collection<? extends E>) - Method in interface org.hsqldb.lib.Collection
-
 
-
addAll(Collection<? extends E>) - Method in class org.hsqldb.lib.HashSet
-
-
returns true if any element is added
-
-
addAll(Collection<? extends Integer>) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
addAll(IntHashSet) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
addAll(LongDeque) - Method in class org.hsqldb.lib.LongDeque
-
 
-
addAll(OrderedHashSet<E>, OrderedHashSet<E>) - Static method in class org.hsqldb.lib.OrderedHashSet
-
 
-
addAll(OrderedIntHashSet) - Method in class org.hsqldb.lib.OrderedIntHashSet
-
 
-
addAll(OrderedLongHashSet) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
addBatch() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Adds a set of parameters to this PreparedStatement - object's batch of commands.
-
-
addBatch(String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
This method should always throw if called for a PreparedStatement or - CallableStatement.
-
-
addBatch(String) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Adds the given SQL command to the current list of commands for this - Statement object.
-
-
addConnectionEventListener(ConnectionEventListener) - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
addCount(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
addCount(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Used for values as counters.
-
-
addFirst(long) - Method in class org.hsqldb.lib.LongDeque
-
 
-
addFirst(E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
addLast(long) - Method in class org.hsqldb.lib.LongDeque
-
 
-
addLast(E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
addOrReplaceUnique(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Updates the value if key is present, or adds the key/value paire.
-
-
addRecord(String, boolean) - Method in class org.hsqldb.lib.tar.PIFGenerator
-
-
Convenience wrapper for addRecord(String, String).
-
-
addRecord(String, int) - Method in class org.hsqldb.lib.tar.PIFGenerator
-
-
Convenience wrapper for addRecord(String, String).
-
-
addRecord(String, long) - Method in class org.hsqldb.lib.tar.PIFGenerator
-
-
Convenience wrapper for addRecord(String, String).
-
-
addRecord(String, String) - Method in class org.hsqldb.lib.tar.PIFGenerator
-
-
I guess the "initial length" field is supposed to be in units of - characters, not bytes?
-
-
addResource(Xid, JDBCXAResource) - Method in class org.hsqldb.jdbc.pool.JDBCXADataSource
-
 
-
addSorted(int) - Method in class org.hsqldb.lib.IntIndex
-
-
Adds a key into the table with the guarantee that the key - is equal or larger than the largest existing key.
-
-
addSorted(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Adds a key, value pair into the table with the guarantee that the key - is equal or larger than the largest existing key.
-
-
addStatementEventListener(StatementEventListener) - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
addUnique(int) - Method in class org.hsqldb.lib.IntIndex
-
-
Adds a key, ensuring no duplicate key already exists in the - current search target column.
-
-
addUnique(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Adds a pair, ensuring no duplicate key xor value already exists in the - current search target column.
-
-
addUnsorted(int) - Method in class org.hsqldb.lib.IntIndex
-
-
Adds a key into the table.
-
-
addUnsorted(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Adds a pair into the table.
-
-
addUnsorted(int, int) - Method in interface org.hsqldb.lib.IntLookup
-
 
-
addUnsorted(long, long) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
addUnsorted(long, long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
addUnsorted(long, long) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
addUnsorted(LongLookup) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
addUnsorted(LongLookup) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
addUnsorted(LongLookup) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
adjustArray(int, Object, int, int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Moves the contents of an array to allow both addition and removal of - elements.
-
-
afterLast() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the end of - this ResultSet object, just after the - last row.
-
-
allProceduresAreCallable() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether the current user can call all the procedures - returned by the method getProcedures.
-
-
allTablesAreSelectable() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether the current user can use all the tables returned - by the method getTables in a SELECT - statement.
-
-
AppendableException - Exception in org.hsqldb.lib
-
-
Allows additional messages to be appended.
-
-
AppendableException() - Constructor for exception org.hsqldb.lib.AppendableException
-
 
-
AppendableException(String) - Constructor for exception org.hsqldb.lib.AppendableException
-
 
-
AppendableException(String, Throwable) - Constructor for exception org.hsqldb.lib.AppendableException
-
 
-
AppendableException(Throwable) - Constructor for exception org.hsqldb.lib.AppendableException
-
 
-
appendages - Variable in exception org.hsqldb.lib.AppendableException
-
 
-
appendMessage(String) - Method in exception org.hsqldb.lib.AppendableException
-
 
-
archive(String, String, FileAccess, int) - Static method in class org.hsqldb.lib.FileArchiver
-
 
-
areAllIntIndexesAsBooleanArray(int[], boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if all indexes and no other positions are true in arrb.
-
-
areAllIntIndexesInBooleanArray(int[], boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
areEqualSets(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if arra and arrb contain the same set of integers, not - necessarily in the same order.
-
-
ArrayCounter - Class in org.hsqldb.lib
-
-
Collection of routines for counting the distribution of the values - in an int[] array.
-
-
ArrayCounter() - Constructor for class org.hsqldb.lib.ArrayCounter
-
 
-
ArrayListIdentity<E> - Class in org.hsqldb.lib
-
-
Extends HsqlArrayList.
-
-
ArrayListIdentity() - Constructor for class org.hsqldb.lib.ArrayListIdentity
-
 
-
arraySlice(int[], int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns a range of elements of source from start to end of the array.
-
-
ArraySort - Class in org.hsqldb.lib
-
-
FastQSorts the [l,r] partition (inclusive) of the specified array of - Rows, using the comparator.
-
-
ArraySort() - Constructor for class org.hsqldb.lib.ArraySort
-
 
-
arrayToString(Object) - Static method in class org.hsqldb.lib.StringUtil
-
-
Builds a bracketed CSV list from the array
-
-
ArrayUtil - Class in org.hsqldb.lib
-
-
Collection of static methods for operations on arrays
-
-
ArrayUtil() - Constructor for class org.hsqldb.lib.ArrayUtil
-
 
-
ASCENDING - Static variable in class org.hsqldb.util.TableSorter
-
 
-
ASCII_BITS - Static variable in class org.hsqldb.lib.AsciiInputStream
-
-
is 7;
-
-
ASCII_BITS - Static variable in class org.hsqldb.lib.AsciiOutputStream
-
-
is 7;
-
-
ASCII_MASK - Static variable in class org.hsqldb.lib.AsciiInputStream
-
-
is 0b01111111
-
-
ASCII_MASK - Static variable in class org.hsqldb.lib.AsciiOutputStream
-
-
is 0b01111111
-
-
ASCII_MAX - Static variable in class org.hsqldb.lib.AsciiInputStream
-
-
is 2^7 - 1 (127)
-
-
ASCII_MAX - Static variable in class org.hsqldb.lib.AsciiOutputStream
-
-
is 2^7 - 1 (127)
-
-
AsciiInputStream - Class in org.hsqldb.lib
-
-
An input stream that reads US-ASCII values from a Reader, in compliance - with the Java US_ASCII Charset encoder, including - - utf-16-surrogate-pairs.
-
-
AsciiInputStream(Reader) - Constructor for class org.hsqldb.lib.AsciiInputStream
-
-
Constructs a new instance for the given reader.
-
-
AsciiOutputStream - Class in org.hsqldb.lib
-
-
An OutputStream that writes 7-bit US-ASCII values to a Writer, in compliance - with the Java US_ASCII Charset decoder.
-
-
AsciiOutputStream(Writer) - Constructor for class org.hsqldb.lib.AsciiOutputStream
-
 
-
assertAtBlockBoundary() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
 
-
AuthBeanMultiplexer - Class in org.hsqldb.auth
-
-
This class provides a method which can be used directly as a HyperSQL static - Java function method.
-
-
authenticate(String, String) - Method in interface org.hsqldb.auth.AuthFunctionBean
-
-
Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not.
-
-
authenticate(String, String) - Method in class org.hsqldb.auth.HsqldbSlaveAuthBean
-
 
-
authenticate(String, String) - Method in class org.hsqldb.auth.JaasAuthBean
-
 
-
authenticate(String, String) - Method in class org.hsqldb.auth.LdapAuthBean
-
 
-
authenticate(String, String, String) - Static method in class org.hsqldb.auth.AuthBeanMultiplexer
-
-
HyperSQL Java Function Method.
-
-
AuthFunctionBean - Interface in org.hsqldb.auth
-
-
AuthFunctionBeans are NOT directly usable as HyperSQL Authentication - Function methods, they are POJO beans to be managed by AuthBeanMultiplexer - (which does have a real HyperSQL Authentication Function static method).
-
-
AuthUtils - Class in org.hsqldb.auth
-
-
Static external-auth-related utilities.
-
-
autoCommitFailureClosesAllResultSets() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a SQLException while autoCommit is true indicates - that all open ResultSets are closed, even ones that are holdable.
-
-
available() - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
available() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
available() - Method in interface org.hsqldb.lib.InputStreamInterface
-
 
-
available() - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
available() - Method in class org.hsqldb.lib.StringInputStream
-
 
-
await() - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Causes the current thread to wait until count reaches zero, - unless the thread is interrupted.
-
-
await(long, TimeUnit) - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Causes the current thread to wait until count reaches zero, - unless the thread is interrupted, or the - specified waiting time elapses.
-
-
- - - -

B

-
-
bad_block_write_len - org.hsqldb.lib.tar.RB
-
 
-
bad_header_value - org.hsqldb.lib.tar.RB
-
 
-
bad_numeric_header_value - org.hsqldb.lib.tar.RB
-
 
-
BasicTextJdkLogFormatter - Class in org.hsqldb.lib
-
-
An implementation of java.util.logging.Formatter very close to - SimpleFormatter.
-
-
BasicTextJdkLogFormatter() - Constructor for class org.hsqldb.lib.BasicTextJdkLogFormatter
-
 
-
BasicTextJdkLogFormatter(boolean) - Constructor for class org.hsqldb.lib.BasicTextJdkLogFormatter
-
 
-
beforeFirst() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the front of - this ResultSet object, just before the - first row.
-
-
booleanArrayToIntIndexes(boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Set elements of arrb true if their indexes appear in arrb.
-
-
bpr_write - org.hsqldb.lib.tar.RB
-
 
-
byteArrayToBitString(byte[], int) - Static method in class org.hsqldb.lib.StringConverter
-
-
Converts a byte array into a bit string
-
-
byteArrayToChars(byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
byteArrayToChars(byte[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
byteArrayToHexString(byte[]) - Static method in class org.hsqldb.lib.StringConverter
-
-
Converts a byte array into a hexadecimal string
-
-
byteArrayToSQLBitString(byte[], int) - Static method in class org.hsqldb.lib.StringConverter
-
-
Converts a byte array into an SQL binary string
-
-
byteArrayToSQLHexString(byte[]) - Static method in class org.hsqldb.lib.StringConverter
-
-
Converts a byte array into an SQL hexadecimal string
-
-
byteArrayToString(byte[], String) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
byteSequenceToLong(byte[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
bytesLeftInBlock() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
 
-
- - - -

C

-
-
cancel() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Cancels this Statement object if both the DBMS and - driver support aborting an SQL statement.
-
-
cancel() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Cancels this Statement object if both the DBMS and - driver support aborting an SQL statement.
-
-
cancel(Object) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Causes the task referenced by the supplied argument to be cancelled.
-
-
cancelRowUpdates() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Cancels the updates made to the current row in this - ResultSet object.
-
-
canonicalFile(File) - Method in class org.hsqldb.lib.FileUtil
-
-
Retrieves the canonical file for the given file, in a JDK 1.1 compliant - way.
-
-
canonicalFile(String) - Method in class org.hsqldb.lib.FileUtil
-
-
Retrieves the canonical file for the given path, in a JDK 1.1 compliant - way.
-
-
canonicalOrAbsolutePath(String) - Method in class org.hsqldb.lib.FileUtil
-
-
Retrieves the canonical path for the given path, or the absolute - path if attempting to retrieve the canonical path fails.
-
-
canonicalPath(File) - Method in class org.hsqldb.lib.FileUtil
-
-
Retrieves the canonical path for the given File, in a JDK 1.1 compliant - way.
-
-
canonicalPath(String) - Method in class org.hsqldb.lib.FileUtil
-
-
Retrieves the canonical path for the given path, in a JDK 1.1 compliant - way.
-
-
cant_overwrite - org.hsqldb.lib.tar.RB
-
 
-
cant_write_dir - org.hsqldb.lib.tar.RB
-
 
-
cant_write_parent - org.hsqldb.lib.tar.RB
-
 
-
capacity() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Returns the current capacity of this stream's data buffer.
-
-
capacity() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Returns the current capacity of this writer's data buffer.
-
-
capacity() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
capacity() - Method in class org.hsqldb.lib.IntIndex
-
 
-
catalogName - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's table's catalog name.
-
-
cdiv(int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
a and b must be both positive returns (a / b) or (a / b) + 1 if remainder - is larger than zero
-
-
cdiv(long, long) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
characters(char[], int, int) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of character data.
-
-
charArrayToBytes(char[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
charArrayToBytes(char[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
CharArrayWriter - Class in org.hsqldb.lib
-
-
A writer for char strings.
-
-
CharArrayWriter(char[]) - Constructor for class org.hsqldb.lib.CharArrayWriter
-
 
-
CharArrayWriter(int) - Constructor for class org.hsqldb.lib.CharArrayWriter
-
 
-
CharArrayWriter(Reader) - Constructor for class org.hsqldb.lib.CharArrayWriter
-
 
-
CharArrayWriter(Reader, int) - Constructor for class org.hsqldb.lib.CharArrayWriter
-
 
-
charset - Variable in class org.hsqldb.util.RCData
-
 
-
checkRunning(boolean) - Method in class org.hsqldb.server.Server
-
-
Checks if this Server object is or is not running and throws if the - current state does not match the specified value.
-
-
checksum - org.hsqldb.lib.tar.TarHeaderField
-
 
-
checksum_mismatch - org.hsqldb.lib.tar.RB
-
 
-
CLASS_CODE_BOOLEAN - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_BYTE - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_CHAR - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_DOUBLE - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_FLOAT - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_INT - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_LONG - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_OBJECT - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
CLASS_CODE_SHORT - Static variable in class org.hsqldb.lib.ArrayUtil
-
 
-
cleanup_rmfail - org.hsqldb.lib.tar.RB
-
 
-
clear() - Method in class org.hsqldb.auth.AuthBeanMultiplexer
-
-
Clear the set of AuthFunctionBeans
-
-
clear() - Method in interface org.hsqldb.lib.Collection
-
 
-
clear() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
clear() - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
clear() - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
clear() - Method in class org.hsqldb.lib.HsqlArrayList
-
 
-
clear() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
clear() - Method in interface org.hsqldb.lib.HsqlHeap
-
-
Removes all of the elements from this Heap.
-
-
clear() - Method in class org.hsqldb.lib.IntIndex
-
 
-
clear() - Method in interface org.hsqldb.lib.IntLookup
-
 
-
clear() - Method in class org.hsqldb.lib.LongDeque
-
 
-
clear() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
clear() - Method in interface org.hsqldb.lib.LongLookup
-
 
-
clear() - Method in interface org.hsqldb.lib.Map
-
 
-
clearArray(int, Object, int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Clears an area of the given array of the given type.
-
-
clearBatch() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Empties this Statement object's current list of - SQL commands.
-
-
clearBatch() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Empties this Statement object's current list of - SQL commands.
-
-
clearLoggers(String) - Static method in class org.hsqldb.lib.FrameworkLogger
-
-
Frees Logger(s), if any, with the specified category, or that begins with - the specified prefix + dot.
-
-
clearParameters() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Clears the current parameter values immediately.
-
-
clearUpdates() - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
 
-
clearUpdates() - Method in class org.hsqldb.jdbc.JDBCClobClient
-
 
-
clearWarnings() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Clears all warnings reported for this Connection object.
-
-
clearWarnings() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Clears all the warnings reported on this Statement - object.
-
-
clearWarnings() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Clears all warnings reported on this ResultSet object.
-
-
clearWarnings() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Clears all the warnings reported on this Statement - object.
-
-
ClosableByteArrayOutputStream - Class in org.hsqldb.lib
-
-
Provides true Closable semantics ordinarily missing in a - ByteArrayOutputStream.
-
-
ClosableByteArrayOutputStream() - Constructor for class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Creates a new output stream.
-
-
ClosableByteArrayOutputStream(int) - Constructor for class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Creates a new output stream with a buffer capacity of the specified - size, in bytes.
-
-
ClosableCharArrayWriter - Class in org.hsqldb.lib
-
-
Provides Closable semantics ordinarily missing in a - CharArrayWriter.
-
-
ClosableCharArrayWriter() - Constructor for class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Creates a new writer.
-
-
ClosableCharArrayWriter(int) - Constructor for class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Creates a new writer with a buffer capacity of the specified - size, in characters.
-
-
close() - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Does the specialized work required to free this object's resources and - that of its parent classes.
-
-
close() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Releases this Connection object's database and JDBC resources - immediately instead of waiting for them to be automatically released.
-
-
close() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Does the specialized work required to free this object's resources and - that of its parent class.
-
-
close() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Releases this ResultSet object's database and - JDBC resources immediately instead of waiting for - this to happen when it is automatically closed.
-
-
close() - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Closes this object.
-
-
close() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Releases this Statement object's database - and JDBC resources immediately instead of waiting for - this to happen when it is automatically closed.
-
-
close() - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
close() - Method in class org.hsqldb.jdbc.pool.JDBCXAConnection
-
 
-
close() - Method in class org.hsqldb.lib.AsciiInputStream
-
 
-
close() - Method in class org.hsqldb.lib.AsciiOutputStream
-
 
-
close() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Closes this object for further writing.
-
-
close() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Closes this object for further writing.
-
-
close() - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
close() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
close() - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
close() - Method in interface org.hsqldb.lib.InputStreamInterface
-
 
-
close() - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
close() - Method in class org.hsqldb.lib.LineGroupReader
-
 
-
close() - Method in class org.hsqldb.lib.LineReader
-
 
-
close() - Method in class org.hsqldb.lib.SimpleLog
-
 
-
close() - Method in class org.hsqldb.lib.tar.TarFileInputStream
-
-
Implements java.io.Closeable.
-
-
close() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Implements java.io.Closeable.
-
-
close(int) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Closes the pool immediately.
-
-
closeFully() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Completely closes a pooled connection
-
-
closeOnCompletion() - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
 
-
CodeSwitcher - Class in org.hsqldb.util
-
-
Modifies the source code to support different JDK or profile settings.
-
-
Collection<E> - Interface in org.hsqldb.lib
-
-
A basic collection of values.
-
-
colonNotation(byte[]) - Static method in class org.hsqldb.server.ServerAcl
-
 
-
columnClassName - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The fully-qualified name of the Java class whose instances are - manufactured if the method ResultSet.getObject is called to retrieve - a value from the column.
-
-
columnDisplaySize - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's normal max width in chars.
-
-
columnLabel - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The suggested column title for use in printouts and displays.
-
-
columnName - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's name.
-
-
columnType - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's SQL type.
-
-
comment(char[], int, int) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
 
-
commit() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Makes all changes made since the previous - commit/rollback permanent and releases any database locks - currently held by this Connection object.
-
-
commit() - Method in class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
Interceptor method, because this method is prohibited within - any global transaction.
-
-
commit(Xid, boolean) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
Per the JDBC 3.0 spec, this commits the transaction for the specified - Xid, not necessarily for the transaction associated with this XAResource - object.
-
-
commitThis(boolean) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
This commits the connection associated with this XAResource.
-
-
commonElements(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns an int[] containing elements shared between the two arrays - arra and arrb.
-
-
compactLookupAsIntervals() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
compactLookupAsIntervals() - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
compactLookupAsIntervals() - Method in interface org.hsqldb.lib.LongLookup
-
 
-
COMPARABLE_COMPARATOR - Static variable in class org.hsqldb.util.TableSorter
-
 
-
compare(byte[], byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Compares two arrays.
-
-
compare(byte[], int, int, byte[], int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
compare(Object, Object) - Method in class org.hsqldb.lib.HsqlTimer
-
-
Required to back the priority queue for scheduled tasks.
-
-
compare(String, String) - Method in class org.hsqldb.lib.StringComparator
-
 
-
COMPRESSION_GZIP - Static variable in class org.hsqldb.lib.FileArchiver
-
 
-
COMPRESSION_NONE - Static variable in class org.hsqldb.lib.FileArchiver
-
 
-
compression_unknown - org.hsqldb.lib.tar.RB
-
 
-
COMPRESSION_ZIP - Static variable in class org.hsqldb.lib.FileArchiver
-
 
-
computeTable(byte[]) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
computes the table used to optimize octet pattern search
-
-
computeTable(char[]) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
computes the table used to optimize octet pattern search
-
-
computeTable(String) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
computes the table used to optimize octet pattern search
-
-
concat(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns an array that contains all the elements of the two arrays.
-
-
configureSocket(Socket) - Method in class org.hsqldb.server.HsqlSocketFactory
-
 
-
configureSocket(Socket) - Method in class org.hsqldb.server.HsqlSocketFactorySecure
-
 
-
connect(String, Properties) - Method in class org.hsqldb.jdbc.JDBCDriver
-
-
Attempts to make a database connection to the given URL.
-
-
connect(Connection) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
connect(Connection) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
-
This stuff is all quick, except for the refreshTree().
-
-
connectionClosed() - Method in interface org.hsqldb.jdbc.JDBCConnectionEventListener
-
 
-
connectionClosed() - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
connectionClosed(ConnectionEvent) - Method in class org.hsqldb.jdbc.JDBCPool
-
 
-
connectionClosedException() - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
connectionErrorOccurred(SQLException) - Method in interface org.hsqldb.jdbc.JDBCConnectionEventListener
-
 
-
connectionErrorOccurred(SQLException) - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
connectionErrorOccurred(ConnectionEvent) - Method in class org.hsqldb.jdbc.JDBCPool
-
 
-
ConnectionSetting - Class in org.hsqldb.util
-
-
ConnectionSetting represents the various parameters of a data source - connection.
-
-
contains(int) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
contains(long) - Method in class org.hsqldb.lib.LongDeque
-
 
-
contains(long) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
contains(Object) - Method in interface org.hsqldb.lib.Collection
-
 
-
contains(Object) - Method in class org.hsqldb.lib.HashSet
-
 
-
contains(Object) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
containsAll(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns true if arra contains all elements of arrb
-
-
containsAll(Object[], Object[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns true if arra contains all elements of arrb
-
-
containsAll(Collection) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
containsAll(Collection<?>) - Method in class org.hsqldb.lib.HashSet
-
 
-
containsAll(Collection<?>) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
containsAllAtStart(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns true if arra contains all elements of arrb at its start
-
-
containsAllTrueElements(boolean[], boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Return true if for each true element in arrb, the corresponding element - in arra is true
-
-
containsAny(Object[], Object[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns true if arra contains any element of arrb
-
-
containsAt(byte[], int, byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if arra from position start contains all elements of arrb in - sequential order.
-
-
containsAt(char[], int, char[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if arra from position start contains all elements of arrb in - sequential order.
-
-
containsKey(int) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
containsKey(int) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
containsKey(int) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
containsKey(int) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
containsKey(long) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
containsKey(long) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
containsKey(long) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
containsKey(long) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.HashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
containsKey(Object) - Method in interface org.hsqldb.lib.Map
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
containsKey(Object) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
containsValue(int) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
containsValue(int) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
containsValue(int) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
containsValue(int) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
containsValue(long) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.HashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
containsValue(Object) - Method in interface org.hsqldb.lib.Map
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
containsValue(Object) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
convertToString(HsqlArrayList, int) - Static method in class org.hsqldb.lib.LineGroupReader
-
 
-
copy(InputStream, OutputStream) - Static method in class org.hsqldb.lib.InOutUtil
-
 
-
copy(InputStream, OutputStream, long) - Static method in class org.hsqldb.lib.InOutUtil
-
 
-
copy(InputStream, OutputStream, long, int) - Static method in class org.hsqldb.lib.InOutUtil
-
-
the specified amount from the given input stream to the - given output stream, using a buffer of the given size.
-
-
copy(Reader, Writer) - Static method in class org.hsqldb.lib.InOutUtil
-
 
-
copy(Reader, Writer, long) - Static method in class org.hsqldb.lib.InOutUtil
-
 
-
copy(Reader, Writer, long, int) - Static method in class org.hsqldb.lib.InOutUtil
-
-
the specified amount from the given input stream to the - given output stream, using a buffer of the given size.
-
-
copyAdjustArray(Object[], Object[], int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Similar to single slot adjusted copy, with multiple slots added or - removed.
-
-
copyAdjustArray(Object, Object, Object, int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Copies elements of source to dest.
-
-
copyArray(Object, Object, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Convenience wrapper for System.arraycopy().
-
-
copyBytes(byte[], byte[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Copy the source to dest, returning dest or an enlarged array of result is - larger than dest.
-
-
copyBytes(long, byte[], int, int, long, byte[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Byte arrays source and dest each begin at an offset in the common space.
-
-
copyFile(String, String, FileAccess) - Static method in class org.hsqldb.lib.FileArchiver
-
 
-
copyMoveSegment(Object, Object, int, int, int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
copyTo(DoubleIntIndex) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
copyTo(DoubleLongIndex) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
countCommonElements(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the number of elements shared between the two arrays containing - sets.
-
-
countCommonElements(Object[], int, Object[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
countDown() - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Decrements the count of the latch, releasing all waiting threads if the - count transitions to zero.
-
-
countDown(int) - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Decrements the count of the latch by the given amount, - releasing all waiting threads if count transitions to zero.
-
-
CountdownInputStream - Class in org.hsqldb.lib
-
-
Counts down from a specified value the number of bytes actually read - from the wrapped InputStream.
-
-
CountdownInputStream(InputStream) - Constructor for class org.hsqldb.lib.CountdownInputStream
-
 
-
countNonStartElementsAt(byte[], int, byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the count of elements in arra from position start that are not - among the elements of arrb.
-
-
countSameElements(byte[], int, byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
-
-
countSameElements(char[], int, char[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
-
-
countSameElements(int[], int, int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
-
-
countSegments(int[], int, int, int, int, int) - Static method in class org.hsqldb.lib.ArrayCounter
-
-
Returns an int[] array of length segments containing the distribution - count of the elements in unsorted int[] array with values between min - and max (range).
-
-
countSmallerElements(int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the count of elements in arra that are smaller than the value.
-
-
countSmallerEqualElements(int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the count of elements in arra that are smaller/equal than the - value.
-
-
countStartElementsAt(byte[], int, byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the count of elements in arra from position start that are among - the elements of arrb.
-
-
countStartIntIndexesInBooleanArray(int[], boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Return array of indexes of boolean elements that are true.
-
-
countTrueElements(boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Return count of true elements in array
-
-
countUp() - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Increments the count of the latch.
-
-
countUp(int) - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Increments the count of the latch by the given amount.
-
-
CountUpDownLatch - Class in org.hsqldb.lib
-
-
A variation on CountDownLatch to allow counting up as well - as down.
-
-
CountUpDownLatch() - Constructor for class org.hsqldb.lib.CountUpDownLatch
-
-
Default constructor.
-
-
CountUpDownLatch(int) - Constructor for class org.hsqldb.lib.CountUpDownLatch
-
-
Constructs a new CountUpDownLatch initialized with the given - initialCount.
-
-
create_only_normal - org.hsqldb.lib.tar.RB
-
 
-
createArrayOf(String, Object[]) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Factory method for creating Array objects.
-
-
createBlob() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Constructs an object that implements the Blob interface.
-
-
createClob() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Constructs an object that implements the Clob interface.
-
-
createDataSource(Properties) - Static method in class org.hsqldb.jdbc.JDBCDataSourceFactory
-
-
Static method to create a JDBCDataSource instance using the - given properties for url, user, password, etc.
-
-
createHsqlServer(String, boolean, boolean) - Static method in class org.hsqldb.server.HsqlServerFactory
-
 
-
createNClob() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Constructs an object that implements the NClob interface.
-
-
createParentDirs(String) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
createParentDirs(String) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
createParentDirs(String) - Method in class org.hsqldb.lib.FileUtil
-
 
-
createServerSocket(int) - Method in class org.hsqldb.server.HsqlSocketFactory
-
-
Returns a server socket bound to the specified port.
-
-
createServerSocket(int) - Method in class org.hsqldb.server.HsqlSocketFactorySecure
-
-
Creates a secure server socket bound to the specified port.
-
-
createServerSocket(int, String) - Method in class org.hsqldb.server.HsqlSocketFactory
-
-
Returns a server socket bound to the specified port.
-
-
createServerSocket(int, String) - Method in class org.hsqldb.server.HsqlSocketFactorySecure
-
-
Creates a secure server socket bound to the specified port.
-
-
createSocket(String, int) - Method in class org.hsqldb.server.HsqlSocketFactory
-
-
Creates a socket and connects it to the specified remote host at the - specified remote port.
-
-
createSocket(String, int) - Method in class org.hsqldb.server.HsqlSocketFactorySecure
-
-
Creates a secure Socket and connects it to the specified remote host - at the specified remote port.
-
-
createSocket(Socket, String, int) - Method in class org.hsqldb.server.HsqlSocketFactory
-
-
If socket argument is not null, returns it.
-
-
createSocket(Socket, String, int) - Method in class org.hsqldb.server.HsqlSocketFactorySecure
-
-
if socket argument is not null, creates a secure Socket as a wrapper for - the normal, non-SSL socket.
-
-
createSQLXML() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Constructs an object that implements the SQLXML interface.
-
-
createStatement() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a Statement object for sending - SQL statements to the database.
-
-
createStatement(int, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a Statement object that will generate - ResultSet objects with the given type and concurrency.
-
-
createStatement(int, int, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a Statement object that will generate - ResultSet objects with the given type, concurrency, - and holdability.
-
-
createStruct(String, Object[]) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Factory method for creating Struct objects.
-
-
currentElapsedNanos() - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves the accumulated nanoseconds this object has spent running since - it was last started.
-
-
currentElapsedNanosToMessage(String) - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves prefix + " in " + elapsedTime() + " ns."
-
-
currentElapsedTime() - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves the accumulated milliseconds this object has spent running since - it was last started.
-
-
currentElapsedTimeToMessage(String) - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves prefix + " in " + elapsedTime() + " ms."
-
-
- - - -

D

-
-
data_changed - org.hsqldb.lib.tar.RB
-
 
-
data_size_unknown - org.hsqldb.lib.tar.RB
-
 
-
DatabaseManager - Class in org.hsqldb.util
-
-
AWT Tool for manageing a JDBC database.
-
-
DatabaseManager() - Constructor for class org.hsqldb.util.DatabaseManager
-
 
-
DatabaseManagerSwing - Class in org.hsqldb.util
-
-
Swing Tool for managing a JDBC database.
-
-
DatabaseManagerSwing() - Constructor for class org.hsqldb.util.DatabaseManagerSwing
-
 
-
DatabaseManagerSwing(JFrame) - Constructor for class org.hsqldb.util.DatabaseManagerSwing
-
 
-
DatabaseManagerSwing.DBMPrefs - Class in org.hsqldb.util
-
-
Persisted User Preferences for DatabaseManagerSwing.
-
-
dataDefinitionCausesTransactionCommit() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a data definition statement within a transaction forces - the transaction to commit.
-
-
dataDefinitionIgnoredInTransactions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database ignores a data definition statement - within a transaction.
-
-
DataOutputStream - Class in org.hsqldb.lib
-
-
A wrapper for OutputStream
-
-
DataOutputStream(OutputStream) - Constructor for class org.hsqldb.lib.DataOutputStream
-
 
-
DbBackup - Class in org.hsqldb.lib.tar
-
-
Works with tar archives containing HyperSQL database instance backups.
-
-
DbBackup(File, String) - Constructor for class org.hsqldb.lib.tar.DbBackup
-
-
Instantiate a DbBackup instance for creating a Database Instance backup.
-
-
DbBackup(File, String, boolean) - Constructor for class org.hsqldb.lib.tar.DbBackup
-
-
Used for SCRIPT backup
-
-
DbBackup_syntax - org.hsqldb.lib.tar.RB
-
 
-
DbBackup_syntaxerr - org.hsqldb.lib.tar.RB
-
 
-
DbBackupMain - Class in org.hsqldb.lib.tar
-
-
This class is used for offline backup of HyperSQL databases.
-
-
DbBackupMain() - Constructor for class org.hsqldb.lib.tar.DbBackupMain
-
 
-
DBMPrefs(boolean) - Constructor for class org.hsqldb.util.DatabaseManagerSwing.DBMPrefs
-
 
-
debug - Static variable in class org.hsqldb.lib.tar.TarFileOutputStream
-
 
-
decompression_ranout - org.hsqldb.lib.tar.RB
-
 
-
deDuplicate(Object[], int, Comparator) - Static method in class org.hsqldb.lib.ArraySort
-
 
-
DEFAULT_BLOCKS_PER_RECORD - Static variable in interface org.hsqldb.lib.tar.TarFileOutputStream.Compression
-
 
-
DEFAULT_COMPRESSION - Static variable in interface org.hsqldb.lib.tar.TarFileOutputStream.Compression
-
 
-
DEFAULT_COPY_AMOUNT - Static variable in class org.hsqldb.lib.InOutUtil
-
 
-
DEFAULT_COPY_BUFFER_SIZE - Static variable in class org.hsqldb.lib.InOutUtil
-
 
-
DEFAULT_JDBC_DRIVER - Static variable in class org.hsqldb.util.RCData
-
 
-
defaultComparator - Static variable in interface org.hsqldb.lib.ObjectComparator
-
 
-
DefaultComparator() - Constructor for class org.hsqldb.lib.ObjectComparator.DefaultComparator
-
 
-
delete(String) - Method in class org.hsqldb.lib.FileUtil
-
-
Delete the named file
-
-
DELETE_AFTER - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
DELETE_AFTER_ROW - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
DELETE_BEFORE_ROW - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
deleteOnExit(File) - Method in class org.hsqldb.lib.FileUtil
-
-
Requests, in a JDK 1.1 compliant way, that the file or directory denoted - by the given abstract pathname be deleted when the virtual machine - terminates.
-
-
deleteOrRenameDatabaseFiles(String) - Static method in class org.hsqldb.lib.FileUtil
-
-
Utility method for user applications.
-
-
deleteRow() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Deletes the current row from this ResultSet object - and from the underlying database.
-
-
deletesAreDetected(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether or not a visible row delete can be detected by - calling the method ResultSet.rowDeleted.
-
-
DenyException - Exception in org.hsqldb.auth
-
 
-
DenyException() - Constructor for exception org.hsqldb.auth.DenyException
-
 
-
DESCENDING - Static variable in class org.hsqldb.util.TableSorter
-
 
-
descendingIterator() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
deserialize(byte[]) - Static method in class org.hsqldb.lib.InOutUtil
-
-
Deserializes the specified byte array to an - Object instance.
-
-
dest_exists - org.hsqldb.lib.tar.RB
-
 
-
dir_x_conflict - org.hsqldb.lib.tar.RB
-
 
-
doesMaxRowSizeIncludeBlobs() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether the return value for the method - getMaxRowSize includes the SQL data types - LONGVARCHAR and LONGVARBINARY.
-
-
dottedNotation(byte[]) - Static method in class org.hsqldb.server.ServerAcl
-
 
-
DoubleIntIndex - Class in org.hsqldb.lib
-
-
Maintains an ordered integer->integer lookup table, consisting of two - columns, one for keys, the other for values.
-
-
DoubleIntIndex(int) - Constructor for class org.hsqldb.lib.DoubleIntIndex
-
 
-
DoubleIntIndex(int, boolean) - Constructor for class org.hsqldb.lib.DoubleIntIndex
-
 
-
DoubleLongIndex - Class in org.hsqldb.lib
-
-
Maintains an ordered long->long lookup table, consisting of two - columns, one for keys, the other for values.
-
-
DoubleLongIndex(int) - Constructor for class org.hsqldb.lib.DoubleLongIndex
-
 
-
driver - Variable in class org.hsqldb.util.RCData
-
 
-
driverInstance - Static variable in class org.hsqldb.jdbc.JDBCDriver
-
 
-
duplicate() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
duplicate() - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
duplicate() - Method in interface org.hsqldb.lib.LongLookup
-
 
-
duplicateArray(Object) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns a duplicates of an array.
-
-
- - - -

E

-
-
elapsedNanos() - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves the accumulated nanoseconds this object has spent running since - it was last zeroed.
-
-
elapsedNanosToMessage(String) - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves prefix + " in " + elapsedNanos() + " ns."
-
-
elapsedTime() - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves the accumulated milliseconds this object has spent running since - it was last zeroed.
-
-
elapsedTimeToMessage(String) - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves prefix + " in " + elapsedTime() + " ms."
-
-
element() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
ELEMENT_READ - Static variable in interface org.hsqldb.lib.FileAccess
-
 
-
ELEMENT_READWRITE - Static variable in interface org.hsqldb.lib.FileAccess
-
 
-
ELEMENT_SEEKABLEREAD - Static variable in interface org.hsqldb.lib.FileAccess
-
 
-
ELEMENT_TRUNCATE - Static variable in interface org.hsqldb.lib.FileAccess
-
 
-
ELEMENT_WRITE - Static variable in interface org.hsqldb.lib.FileAccess
-
 
-
EMPTYSTRING_BEHAVIOR - Static variable in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
EMPTYSTRING_BEHAVIOR - Static variable in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
end(Xid, int) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
 
-
endDocument() - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of the end of a document.
-
-
endElement(String, String, String) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of the end of an element.
-
-
endPrefixMapping(String) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
End the scope of a prefix-URI mapping.
-
-
enduserlog(Level, String) - Method in class org.hsqldb.lib.FrameworkLogger
-
 
-
ensureRoom(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
entrySet() - Method in class org.hsqldb.lib.HashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
entrySet() - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
entrySet() - Method in interface org.hsqldb.lib.Map
-
 
-
entrySet() - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
entrySet() - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
equals(Object) - Method in class org.hsqldb.jdbc.JDBCRowId
-
-
Compares this RowId to the specified object.
-
-
equals(Object) - Method in class org.hsqldb.jdbc.pool.JDBCXID
-
 
-
equals(Object) - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Returns true if and only if this and obj refer to the - same object (this == obj has the value true).
-
-
equals(Object) - Method in class org.hsqldb.lib.MapEntry
-
 
-
equals(Object) - Method in class org.hsqldb.util.ConnectionSetting
-
 
-
equals(Object, Object) - Method in class org.hsqldb.lib.ObjectComparator.DefaultComparator
-
 
-
equals(Object, Object) - Method in class org.hsqldb.lib.ObjectComparator.IdentityComparator
-
 
-
equals(CountUpDownLatch) - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Returns true if and only if this and obj refer to the - same object (this == obj has the value true).
-
-
equals(T, T) - Method in interface org.hsqldb.lib.ObjectComparator
-
 
-
error(String) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
This is just a wrapper for FrameworkLogger.warning(), because - java.util.logging lacks a method for this critical purpose.
-
-
error(String, Throwable) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
Just like FrameworkLogger.error(String), but also logs a stack trace.
-
-
EventLogInterface - Interface in org.hsqldb.lib
-
 
-
execute() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Executes the SQL statement in this PreparedStatement object, - which may be any kind of SQL statement.
-
-
execute(Runnable) - Method in class org.hsqldb.lib.HsqlTaskQueue
-
 
-
execute(String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
This method should always throw if called for a PreparedStatement or - CallableStatement.
-
-
execute(String) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement, which may return multiple results.
-
-
execute(String, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
execute(String, int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement, which may return multiple results, - and signals the driver that any - auto-generated keys should be made available - for retrieval.
-
-
execute(String, int[]) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
execute(String, int[]) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement, which may return multiple results, - and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
-
-
execute(String, String[]) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
execute(String, String[]) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement, which may return multiple results, - and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
-
-
executeBatch() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
-
-
executeBatch() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
-
-
executeLargeBatch() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
-
-
executeLargeBatch() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
-
-
executeLargeUpdate() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Executes the SQL statement in this PreparedStatement object, - which must be an SQL Data Manipulation Language (DML) statement, - such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
-
-
executeLargeUpdate(String) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement, which may be an INSERT, - UPDATE, or DELETE statement or an - SQL statement that returns nothing, such as an SQL DDL statement.
-
-
executeLargeUpdate(String, int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement and signals the driver with the - given flag about whether the - auto-generated keys produced by this Statement object - should be made available for retrieval.
-
-
executeLargeUpdate(String, int[]) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
-
-
executeLargeUpdate(String, String[]) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
-
-
executeQuery() - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Executes the SQL query in this PreparedStatement object - and returns the ResultSet object generated by the query.
-
-
executeQuery() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Executes the SQL query in this PreparedStatement object - and returns the ResultSet object generated by the query.
-
-
executeQuery(String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
This method should always throw if called for a PreparedStatement or - CallableStatement.
-
-
executeQuery(String) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement, which returns a single - ResultSet object.
-
-
executeUpdate() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Executes the SQL statement in this PreparedStatement object, - (JDBC4 clarification:) - which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
-
-
executeUpdate(String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
This method should always throw if called for a PreparedStatement or - CallableStatement.
-
-
executeUpdate(String) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement, which may be an INSERT, - UPDATE, or DELETE statement or an - SQL statement that returns nothing, such as an SQL DDL statement.
-
-
executeUpdate(String, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Statement methods that must be overridden in this class and throw - an exception.
-
-
executeUpdate(String, int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement and signals the driver with the - given flag about whether the - auto-generated keys produced by this Statement object - should be made available for retrieval.
-
-
executeUpdate(String, int[]) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
executeUpdate(String, int[]) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
-
-
executeUpdate(String, String[]) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
executeUpdate(String, String[]) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
-
-
exists(String) - Method in class org.hsqldb.lib.FileUtil
-
-
Return true or false based on whether the named file exists.
-
-
exists(String, boolean, Class) - Method in class org.hsqldb.lib.FileUtil
-
 
-
expandSysPropVars(String) - Static method in class org.hsqldb.util.RCData
-
-
Returns a copy of the given String with System property names in the - format ${system.property} replaced by the corresponding Java - System Properties.
-
-
EXTRACT_MODE - Static variable in class org.hsqldb.lib.tar.TarReader
-
-
EXTRACT_MODE refuses to overwrite existing files.
-
-
extraction_exists - org.hsqldb.lib.tar.RB
-
 
-
extraction_exists_notfile - org.hsqldb.lib.tar.RB
-
 
-
extraction_parent_mkfail - org.hsqldb.lib.tar.RB
-
 
-
extraction_parent_not_dir - org.hsqldb.lib.tar.RB
-
 
-
extraction_parent_not_writable - org.hsqldb.lib.tar.RB
-
 
-
- - - -

F

-
-
file_appeared - org.hsqldb.lib.tar.RB
-
 
-
file_changed - org.hsqldb.lib.tar.RB
-
 
-
file_disappeared - org.hsqldb.lib.tar.RB
-
 
-
file_missing - org.hsqldb.lib.tar.RB
-
 
-
FileAccess - Interface in org.hsqldb.lib
-
-
Interface for abstraction of file access.
-
-
FileAccess.FileSync - Interface in org.hsqldb.lib
-
 
-
FileAccessRes - Class in org.hsqldb.lib
-
 
-
FileAccessRes() - Constructor for class org.hsqldb.lib.FileAccessRes
-
 
-
FileArchiver - Class in org.hsqldb.lib
-
-
Creates a direct, compressed or decompressed copy of a file.
-
-
FileArchiver() - Constructor for class org.hsqldb.lib.FileArchiver
-
 
-
FileUtil - Class in org.hsqldb.lib
-
-
A collection of file management methods.
-
-
FileUtil.FileSync - Class in org.hsqldb.lib
-
 
-
fill(int, int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
fillArray(boolean[], boolean) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Fills the int array with a value
-
-
fillArray(byte[], int, byte) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Fills part of the array with a value.
-
-
fillArray(char[], int, char) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Fills part of the array with a value.
-
-
fillArray(double[], double) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Fills the double array with a value
-
-
fillArray(int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Fills the int array with a value
-
-
fillArray(Object[], Object) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Fills the array with a value.
-
-
fillSequence(int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
FilteredIterator<E> - Class in org.hsqldb.lib
-
-
An iterator with an added filter.
-
-
FilteredIterator(Iterator<E>, FilteredIterator.Filter<E>) - Constructor for class org.hsqldb.lib.FilteredIterator
-
 
-
FilteredIterator.Filter<E> - Interface in org.hsqldb.lib
-
 
-
find(byte[], int, int, byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the index of the first occurrence of arrb in arra.
-
-
find(byte[], int, int, int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the index of b or c in arra.
-
-
find(char[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
find(int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Finds index of value in small array.
-
-
find(int[], int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Finds index of value in the first count elements of small array.
-
-
find(short[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
find(short[], int, int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
find(Object[], Object) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Basic find for small arrays of Object.
-
-
findColumn(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Maps the given ResultSet column label to its - ResultSet column index.
-
-
findFirstConsecutiveKeys(int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
findFirstEqualKeyIndex(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
findFirstEqualKeyIndex(int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
findFirstEqualKeyIndex(long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
findFirstGreaterEqualKeyIndex(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
findFirstGreaterEqualKeyIndex(int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
findFirstGreaterEqualKeyIndex(long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
findFirstGreaterEqualSlotIndex(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
-
-
findFirstGreaterEqualSlotIndex(int) - Method in class org.hsqldb.lib.IntIndex
-
-
This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
-
-
findFirstGreaterEqualSlotIndex(long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
-
This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
-
-
findFirstIndexUnsorted(int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
findIn(byte[], int, int, byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns an index into arra (or -1) where the character is in the byteSet - byte array.
-
-
findNot(int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Finds the first element of the array that is not equal to the given value.
-
-
findNotIn(byte[], int, int, byte[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns an index into arra (or -1) where the character is not in the - charset byte array.
-
-
finer(String) - Method in class org.hsqldb.lib.FrameworkLogger
-
 
-
finer(String, Throwable) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
Just like FrameworkLogger.finer(String), but also logs a stack trace.
-
-
finest(String) - Method in class org.hsqldb.lib.FrameworkLogger
-
 
-
finest(String, Throwable) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
Just like FrameworkLogger.finest(String), but also logs a stack trace.
-
-
finish() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
(Only) when this method returns successfully, the generated file will be - a valid tar file.
-
-
fire(int, String, String, Object[], Object[]) - Method in interface org.hsqldb.trigger.Trigger
-
-
The method invoked upon each triggered action.
-
-
first() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the first row in - this ResultSet object.
-
-
flush() - Method in class org.hsqldb.lib.AsciiOutputStream
-
 
-
flush() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
By default, does nothing.
-
-
flush() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
By default, does nothing.
-
-
flush() - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
-
does nothing
-
-
flush() - Method in class org.hsqldb.lib.SimpleLog
-
 
-
flush() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Implements java.io.Flushable.
-
-
forget(Xid) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
The XAResource API spec indicates implies that this is only for 2-phase - transactions.
-
-
format(LogRecord) - Method in class org.hsqldb.lib.BasicTextJdkLogFormatter
-
 
-
FrameworkLogger - Class in org.hsqldb.lib
-
-
A logging framework wrapper that supports java.util.logging and log4j.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCArray
-
-
This method frees the Array object and releases the resources that - it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
This method frees the Array object and releases the resources that - it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
This method frees the Blob object and releases the resources that - it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
This method frees the Blob object and releases the resources that - it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
This method frees the Blob object and releases the resources that - it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCClob
-
-
This method frees the Clob object and releases the resources - that it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
This method frees the Clob object and releases the resources - that it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
This method frees the Clob object and releases the resources - that it holds.
-
-
free() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
This method closes this object and releases the resources that it held.
-
-
free() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Closes this object and releases the underlying buffer for - garbage collection.
-
-
free() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Closes this object and releases the underlying buffer for - garbage collection.
-
-
fsIsIgnoreCase - Variable in class org.hsqldb.lib.FileUtil
-
 
-
fsNormalizesPosixSeparator - Variable in class org.hsqldb.lib.FileUtil
-
 
-
- - - -

G

-
-
generatedKeyAlwaysReturned() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a generated key will always be returned if the column - name(s) or index(es) specified for the auto generated key column(s) - are valid and the statement succeeds.
-
-
get(int) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Gets the element at given position
-
-
get(int) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
get(int) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
get(int) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
get(int) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
get(int) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
get(int) - Method in interface org.hsqldb.lib.List
-
 
-
get(int) - Method in class org.hsqldb.lib.LongDeque
-
 
-
get(int) - Method in class org.hsqldb.lib.OrderedHashMap
-
-
Same as getValueAt(index).
-
-
get(int) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
get(int) - Method in class org.hsqldb.lib.OrderedIntHashSet
-
 
-
get(int) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
get(int, int) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
get(int, int[]) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
get(int, long) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
get(int, long[]) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
get(long) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
get(long) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
get(long) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
get(long) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
get(long, int) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
get(long, int[]) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
get(long, long) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
get(long, long[]) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
get(E) - Method in class org.hsqldb.lib.HashSet
-
 
-
get(Object) - Method in class org.hsqldb.lib.HashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
get(Object) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
get(Object) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
get(Object) - Method in interface org.hsqldb.lib.Map
-
 
-
get(Object) - Method in class org.hsqldb.lib.MultiValueHashMap
-
-
Returns one of the values associated with the given key.
-
-
get(Object) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
get(Object, int) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
get(Object, int) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
get(Object, int[]) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
get(Object, long[]) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
getAbortUponModify() - Method in class org.hsqldb.lib.tar.DbBackup
-
 
-
getAddress() - Method in class org.hsqldb.server.Server
-
-
Retrieves, in string form, this server's host address.
-
-
getArray() - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves the contents of the SQL ARRAY value designated - by this - Array object in the form of an array in the Java - programming language.
-
-
getArray() - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves the contents of the SQL ARRAY value designated - by this - Array object in the form of an array in the Java - programming language.
-
-
getArray() - Method in class org.hsqldb.lib.HsqlArrayList
-
 
-
getArray(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC ARRAY parameter as an - Array object in the Java programming language.
-
-
getArray(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as an Array object - in the Java programming language.
-
-
getArray(long, int) - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves a slice of the SQL ARRAY - value designated by this Array object, beginning with the - specified index and containing up to count - successive elements of the SQL array.
-
-
getArray(long, int) - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves a slice of the SQL ARRAY - value designated by this Array object, beginning with the - specified index and containing up to count - successive elements of the SQL array.
-
-
getArray(long, int, Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves a slice of the SQL ARRAY value - designated by this Array object, beginning with the specified - index and containing up to count - successive elements of the SQL array.
-
-
getArray(long, int, Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves a slice of the SQL ARRAY value - designated by this Array object, beginning with the specified - index and containing up to count - successive elements of the SQL array.
-
-
getArray(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC ARRAY parameter as an - Array object in the Java programming language.
-
-
getArray(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as an Array object - in the Java programming language.
-
-
getArray(Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves the contents of the SQL ARRAY value designated by this - Array object.
-
-
getArray(Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves the contents of the SQL ARRAY value designated by this - Array object.
-
-
getArrayInternal() - Method in class org.hsqldb.jdbc.JDBCArray
-
 
-
getAsciiStream() - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves the CLOB value designated by this Clob - object as an ASCII stream.
-
-
getAsciiStream() - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves the CLOB value designated by this - Clob object as an ascii stream.
-
-
getAsciiStream() - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves the CLOB value designated by this Clob - object as an ASCII stream.
-
-
getAsciiStream(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a stream of ASCII characters.
-
-
getAsciiStream(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of - ASCII characters.
-
-
getAsMap() - Method in class org.hsqldb.lib.LineGroupReader
-
-
Returns a map/list which contains the first line of each line group as - key and the rest of the lines as a String value.
-
-
getAttributes(String, String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the given attribute of the given type - for a user-defined type (UDT) that is available in the given schema - and catalog.
-
-
getAutoCommit() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves the current auto-commit mode for this Connection - object.
-
-
getBaseType() - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves the JDBC type of the elements in the array designated - by this Array object.
-
-
getBaseType() - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves the JDBC type of the elements in the array designated - by this Array object.
-
-
getBaseTypeName() - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves the SQL type name of the elements in - the array designated by this Array object.
-
-
getBaseTypeName() - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves the SQL type name of the elements in - the array designated by this Array object.
-
-
getBestRowIdentifier(String, String, String, int, boolean) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of a table's optimal set of columns that - uniquely identifies a row.
-
-
getBigDecimal(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC NUMERIC parameter as a - java.math.BigDecimal object with as many digits to the - right of the decimal point as the value contains.
-
-
getBigDecimal(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.math.BigDecimal with full precision.
-
-
getBigDecimal(int, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Deprecated. -
use getBigDecimal(int parameterIndex) - or getBigDecimal(String parameterName)
-
-
-
getBigDecimal(int, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Deprecated. -
by java.sun.com as of JDK 1.2
-
-
-
getBigDecimal(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC NUMERIC parameter as a - java.math.BigDecimal object with as many digits to the - right of the decimal point as the value contains.
-
-
getBigDecimal(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.math.BigDecimal with full precision.
-
-
getBigDecimal(String, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Deprecated. -
by java.sun.com as of JDK 1.2
-
-
-
getBinaryMultipleCeiling(long, long) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
uses 2**scale form and returns a multiple of unit that is larger or equal - to value
-
-
getBinaryNormalisedCeiling(long) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns the smallest value that is a power of 2 and larger or equal to - value
-
-
getBinaryNormalisedCeiling(long, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
uses 2**scale form and returns a multiple of this that is larger or equal - to value
-
-
getBinaryStream() - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Retrieves the BLOB value designated by this - Blob instance as a stream.
-
-
getBinaryStream() - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Retrieves the BLOB value designated by this - Blob instance as a stream.
-
-
getBinaryStream() - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Retrieves the BLOB value designated by this - Blob instance as a stream.
-
-
getBinaryStream() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Retrieves the XML value designated by this SQLXML instance as a stream.
-
-
getBinaryStream(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of - uninterpreted bytes.
-
-
getBinaryStream(long, long) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
-
-
getBinaryStream(long, long) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
-
-
getBinaryStream(long, long) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
-
-
getBinaryStream(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of uninterpreted - bytes.
-
-
getBlob() - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
 
-
getBlob(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC BLOB parameter as a - Blob object in the Java programming language.
-
-
getBlob(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a Blob object - in the Java programming language.
-
-
getBlob(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC BLOB parameter as a - Blob object in the Java programming language.
-
-
getBlob(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a Blob object - in the Java programming language.
-
-
getBoolean(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
(JDBC4 modified:) - Retrieves the value of the designated JDBC BIT - or BOOLEAN parameter as a - boolean in the Java programming language.
-
-
getBoolean(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a boolean in the Java programming language.
-
-
getBoolean(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
(JDBC4 modified:)
-
-
getBoolean(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a boolean in the Java programming language.
-
-
getBranchQualifier() - Method in class org.hsqldb.jdbc.pool.JDBCXID
-
 
-
getBuffer() - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
getBuffer() - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
getBundle(String, ClassLoader, Class<? extends Enum<?>>) - Static method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
-
Use like java.util.ResourceBundle.getBundle(String).
-
-
getBundle(String, Locale, ClassLoader, Class<? extends Enum<?>>) - Static method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
-
Use exactly like java.util.ResourceBundle.get(String, Locale, - ClassLoader).
-
-
getByte(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC TINYINT parameter - as a byte in the Java programming language.
-
-
getByte(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte in the Java programming language.
-
-
getByte(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC TINYINT parameter as a byte - in the Java programming language.
-
-
getByte(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte in the Java programming language.
-
-
getBytes() - Method in class org.hsqldb.jdbc.JDBCRowId
-
-
Returns an array of bytes representing the value of the SQL ROWID - designated by this java.sql.RowId object.
-
-
getBytes(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC BINARY or - VARBINARY parameter as an array of byte - values in the Java programming language.
-
-
getBytes(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte array in the Java programming language.
-
-
getBytes(long, int) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Retrieves all or part of the BLOB - value that this Blob object represents, as an array of - bytes.
-
-
getBytes(long, int) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Retrieves all or part of the BLOB value that this - Blob object represents, as an array of bytes.
-
-
getBytes(long, int) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Retrieves all or part of the BLOB - value that this Blob object represents, as an array of - bytes.
-
-
getBytes(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC BINARY or VARBINARY - parameter as an array of byte values in the Java - programming language.
-
-
getBytes(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte array in the Java programming language.
-
-
getBytesWritten() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
 
-
getCatalog() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves this Connection object's current catalog name.
-
-
getCatalogName(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Gets the designated column's table's catalog name.
-
-
getCatalogs() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the catalog names available in this database.
-
-
getCatalogSeparator() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the String that this database uses as the - separator between a catalog and table name.
-
-
getCatalogTerm() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the database vendor's preferred term for "catalog".
-
-
getCharacterStream() - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves the CLOB value designated by this Clob - object as a java.io.Reader object (or as a stream of - characters).
-
-
getCharacterStream() - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves the CLOB value designated by this - Clob object as a java.io.Reader object (or - as a stream of characters).
-
-
getCharacterStream() - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves the CLOB value designated by this Clob - object as a java.io.Reader object (or as a stream of - characters).
-
-
getCharacterStream() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object.
-
-
getCharacterStream(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
-
-
getCharacterStream(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
-
-
getCharacterStream(long, long) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
-
-
getCharacterStream(long, long) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
-
-
getCharacterStream(long, long) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
-
-
getCharacterStream(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
-
-
getCharacterStream(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
-
-
getClientInfo() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Returns a list containing the name and current value of each client info - property supported by the driver.
-
-
getClientInfo(String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Returns the value of the client info property specified by name.
-
-
getClientInfoProperties() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a list of the client info properties - that the driver supports.
-
-
getClob() - Method in class org.hsqldb.jdbc.JDBCClobClient
-
 
-
getClob(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC CLOB parameter as a - java.sql.Clob object in the Java programming language.
-
-
getClob(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a Clob object - in the Java programming language.
-
-
getClob(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC CLOB parameter as a - Clob object in the Java programming language.
-
-
getClob(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a Clob object - in the Java programming language.
-
-
getColumnClass(int) - Method in class org.hsqldb.util.TableSorter
-
 
-
getColumnClassName(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
getColumnCount() - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Returns the number of columns in this ResultSet object.
-
-
getColumnCount() - Method in class org.hsqldb.util.TableSorter
-
 
-
getColumnDisplaySize(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates the designated column's normal maximum width in characters.
-
-
getColumnLabel(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Gets the designated column's suggested title for use in printouts and - displays.
-
-
getColumnName(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Get the designated column's name.
-
-
getColumnName(int) - Method in class org.hsqldb.util.TableSorter
-
 
-
getColumnPrivileges(String, String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the access rights for a table's columns.
-
-
getColumns(String, String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of table columns available in - the specified catalog.
-
-
getColumnType(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Retrieves the designated column's SQL type.
-
-
getColumnTypeName(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Retrieves the designated column's database-specific type name.
-
-
getCommonElementCount(Set<E>) - Method in class org.hsqldb.lib.HashSet
-
 
-
getCommonElementCount(Set<E>) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
getConcurrency() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the concurrency mode of this ResultSet object.
-
-
getConnection() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the connection that produced this metadata object.
-
-
getConnection() - Method in class org.hsqldb.jdbc.JDBCDataSource
-
-
Retrieves a new connection using the properties that have already been - set.
-
-
getConnection() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves a new connection using the properties that have already been - set.
-
-
getConnection() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the Connection object - that produced this Statement object.
-
-
getConnection() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the Connection object - that produced this Statement object.
-
-
getConnection() - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
getConnection() - Method in class org.hsqldb.jdbc.pool.JDBCXAConnection
-
-
Returns a connection that can be used by the user application.
-
-
getConnection() - Method in class org.hsqldb.util.RCData
-
-
Gets a JDBC Connection using the data of this RCData object.
-
-
getConnection(String, String) - Method in class org.hsqldb.jdbc.JDBCDataSource
-
-
Retrieves a new connection using the given username and password, - and the database url that has been set.
-
-
getConnection(String, String) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves a new connection using the given username and password, - and the database url that has been set.
-
-
getConnection(String, String) - Method in class org.hsqldb.util.RCData
-
-
Gets a JDBC Connection using the data of this RCData object with - specified override elements
-
-
getConnection(String, Properties) - Static method in class org.hsqldb.jdbc.JDBCDriver
-
-
The static equivalent of the connect(String,Properties) - method.
-
-
getConnProperties() - Method in class org.hsqldb.jdbc.JDBCConnection
-
 
-
getCount() - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
getCount() - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Returns the current count.
-
-
getCrossReference(String, String, String, String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
(JDBC4 clarification:) - Retrieves a description of the foreign key columns in the given foreign key - table that reference the primary key or the columns representing a unique constraint of the parent table (could be the same or a different table).
-
-
getCursorName() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the name of the SQL cursor used by this ResultSet - object.
-
-
getDatabase() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Synonym for getUrl().
-
-
getDatabase() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Synonym for getUrl().
-
-
getDatabaseDefaultCollation() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Returns the name of the default collation for database.
-
-
getDatabaseFileList(String) - Static method in class org.hsqldb.lib.FileUtil
-
-
Utility method for user applications.
-
-
getDatabaseMainFileList(String) - Static method in class org.hsqldb.lib.FileUtil
-
-
Returns a list of existing main files for a database.
-
-
getDatabaseMajorVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the major version number of the underlying database.
-
-
getDatabaseMinorVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the minor version number of the underlying database.
-
-
getDatabaseName() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Synonym for getUrl().
-
-
getDatabaseName() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Synonym for getUrl().
-
-
getDatabaseName(int, boolean) - Method in class org.hsqldb.server.Server
-
-
Retrieves the url alias (network name) of the i'th database - that this Server hosts.
-
-
getDatabasePath(int, boolean) - Method in class org.hsqldb.server.Server
-
-
Retrieves the HSQLDB path descriptor (uri) of the i'th - Database that this Server hosts.
-
-
getDatabaseProductName() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the name of this database product.
-
-
getDatabaseProductVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the version number of this database product.
-
-
getDatabaseType(int) - Method in class org.hsqldb.server.Server
-
 
-
getDataSourceName() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the name of the data source.
-
-
getDataSourceName() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves the name of the data source.
-
-
getDate(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC DATE parameter as a - java.sql.Date object.
-
-
getDate(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Date object in the Java programming language.
-
-
getDate(int, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC DATE parameter as a - java.sql.Date object, using - the given Calendar object - to construct the date.
-
-
getDate(int, Calendar) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Date object - in the Java programming language.
-
-
getDate(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC DATE parameter as a - java.sql.Date object.
-
-
getDate(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Date object in the Java programming language.
-
-
getDate(String, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC DATE parameter as a - java.sql.Date object, using - the given Calendar object - to construct the date.
-
-
getDate(String, Calendar) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Date object - in the Java programming language.
-
-
getDefaultJdbcDriverName() - Method in class org.hsqldb.util.RCData
-
 
-
getDefaultPort(int, boolean) - Static method in class org.hsqldb.server.ServerConfiguration
-
-
Retrieves the default port that a Server will try to use in the - absence of an explicitly specified one, given the specified - value for whether or not to use secure sockets.
-
-
getDefaultTransactionIsolation() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves this database's default transaction isolation level.
-
-
getDefaultWebPage() - Method in class org.hsqldb.server.Server
-
-
Retrieves the name of the web page served when no page is specified.
-
-
getDefaultWebPage() - Method in class org.hsqldb.server.WebServer
-
-
Retrieves the name of the web page served when no page is specified.
-
-
getDescription() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the description of the data source.
-
-
getDescription() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves the description of the data source.
-
-
getDocumentLocator() - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Retrieves the Locator.
-
-
getDouble(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC DOUBLE parameter as a double - in the Java programming language.
-
-
getDouble(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a double in the Java programming language.
-
-
getDouble(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC DOUBLE parameter as a double - in the Java programming language.
-
-
getDouble(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a double in the Java programming language.
-
-
getDriverMajorVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves this JDBC driver's major version number.
-
-
getDriverMinorVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves this JDBC driver's minor version number.
-
-
getDriverName() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the name of this JDBC driver.
-
-
getDriverVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the version number of this JDBC driver as a String.
-
-
getEncoding() - Method in class org.hsqldb.jdbc.JDBCClobFile
-
 
-
getErrWriter() - Method in class org.hsqldb.server.Server
-
-
Retrieves the PrintWriter to which server errors are printed.
-
-
getExpandedString() - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getExpandedString() - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getExpandedString(Enum<?>) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getExpandedString(Enum<?>, String...) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getExpandedString(String...) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getExpandedString(String...) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getExpandedString(String, int) - Method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
-
Same as getString(), but expands System Variables specified in property - values like ${sysvarname}.
-
-
getExpandedString(String, String[], int, int) - Method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
getExportedKeys(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the foreign key columns that reference the - given table's primary key columns (the foreign keys exported by a - table).
-
-
getExtraNameCharacters() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves all the "extra" characters that can be used in unquoted - identifier names (those beyond a-z, A-Z, 0-9 and _).
-
-
getFetchDirection() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the direction for fetching rows from - database tables that is the default for result sets - generated from this Statement object.
-
-
getFetchDirection() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the fetch direction for this - ResultSet object.
-
-
getFetchDirection() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the direction for fetching rows from - database tables that is the default for result sets - generated from this Statement object.
-
-
getFetchSize() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the number of result set rows that is the default - fetch size for ResultSet objects - generated from this Statement object.
-
-
getFetchSize() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the fetch size for this - ResultSet object.
-
-
getFetchSize() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the number of result set rows that is the default - fetch size for ResultSet objects - generated from this Statement object.
-
-
getFile() - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Retrieves the canonical File object denoting the file that - backs this BLOB.
-
-
getFile() - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves the canonical File object denoting the file that - backs this CLOB.
-
-
getFileAccess(boolean) - Static method in class org.hsqldb.lib.FileUtil
-
 
-
getFileSync(OutputStream) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
getFileSync(OutputStream) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
getFileSync(OutputStream) - Method in class org.hsqldb.lib.FileUtil
-
 
-
getFileUtil() - Static method in class org.hsqldb.lib.FileUtil
-
 
-
getFirst() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
getFirst() - Method in class org.hsqldb.lib.LongDeque
-
 
-
getFloat(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC FLOAT parameter - as a float in the Java programming language.
-
-
getFloat(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a float in the Java programming language.
-
-
getFloat(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC FLOAT parameter as a float - in the Java programming language.
-
-
getFloat(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a float in the Java programming language.
-
-
getFormatId() - Method in class org.hsqldb.jdbc.pool.JDBCXID
-
 
-
getFunctionColumns(String, String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the given catalog's system or user - function parameters and return type.
-
-
getFunctions(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the JDBC 4.1[ system and ]user functions available - in the given catalog.
-
-
getGeneratedKeys() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves any auto-generated keys created as a result of executing this - Statement object.
-
-
getGeneratedKeys() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves any auto-generated keys created as a result of executing this - Statement object.
-
-
getGlobalTransactionId() - Method in class org.hsqldb.jdbc.pool.JDBCXID
-
 
-
getGroupReader(String) - Static method in class org.hsqldb.lib.LineGroupReader
-
 
-
getGroupReader(String, String[]) - Static method in class org.hsqldb.lib.LineGroupReader
-
 
-
getHelpString() - Method in class org.hsqldb.server.Server
-
-
Retrieves a String object describing the command line and - properties options for this Server.
-
-
getHelpString() - Method in class org.hsqldb.server.WebServer
-
-
Retrieves a String object describing the command line and - properties options for this Server.
-
-
getHoldability() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves the current holdability of ResultSet objects - created using this Connection object.
-
-
getHoldability() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the holdability of this ResultSet object
-
-
getIdentifierQuoteString() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the string used to quote SQL identifiers.
-
-
getIdForColumn(int, ResultMetaData) - Static method in class org.hsqldb.server.OdbcUtil
-
-
Temporary hack.
-
-
getImportedKeys(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the primary key columns that are - referenced by the given table's foreign key columns (the primary keys - imported by a table).
-
-
getIndex(int) - Method in class org.hsqldb.lib.OrderedIntHashSet
-
 
-
getIndex(int) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
getIndex(long) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
getIndex(long) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
getIndex(Object) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
getIndex(K) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
getIndexInfo(String, String, String, boolean, boolean) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the given table's indices and statistics.
-
-
getInstance(boolean) - Static method in class org.hsqldb.server.HsqlSocketFactory
-
-
Retrieves an HsqlSocketFactory whose subclass and attributes are - determined by the specified argument, tls.
-
-
getInt(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC INTEGER parameter - as an int in the Java programming language.
-
-
getInt(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - an int in the Java programming language.
-
-
getInt(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC INTEGER parameter as an int - in the Java programming language.
-
-
getInt(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - an int in the Java programming language.
-
-
getJDBCMajorVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the major JDBC version number for this - driver.
-
-
getJDBCMinorVersion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the minor JDBC version number for this - driver.
-
-
getKey() - Method in interface org.hsqldb.lib.Map.Entry
-
 
-
getKey() - Method in class org.hsqldb.lib.MapEntry
-
 
-
getKey(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
getKey(int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
getKey(int) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
getKey(long) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
getKeyAt(int) - Method in class org.hsqldb.lib.OrderedHashMap
-
-
Returns the key stored in the entry at index position.
-
-
getKeyAt(int) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
getKeyAt(int, int) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
getKeys() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
getKeys() - Method in class org.hsqldb.lib.IntIndex
-
 
-
getKeys() - Method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
getLargeMaxRows() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
-
-
getLargeMaxRows() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
-
-
getLargestIndex(OrderedHashSet<E>) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
getLargeUpdateCount() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the current result as an update count; if the result - is a ResultSet object or there are no more results, -1 - is returned.
-
-
getLargeUpdateCount() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the current result as an update count; if the result - is a ResultSet object or there are no more results, -1 - is returned.
-
-
getLast() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
getLast() - Method in class org.hsqldb.lib.LongDeque
-
 
-
getLastScheduled(Object) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Retrieves the last time the referenced task was executed, as a - Date object.
-
-
getLevel() - Method in class org.hsqldb.lib.SimpleLog
-
 
-
getList(int[], String, String) - Static method in class org.hsqldb.lib.StringUtil
-
-
Builds a CSV list from the specified int[], separator - String and quote String.
-
-
getList(long[], String, String) - Static method in class org.hsqldb.lib.StringUtil
-
 
-
getList(String[][], String, String) - Static method in class org.hsqldb.lib.StringUtil
-
-
Builds a CSV list from the specified String[][], separator string and - quote string.
-
-
getList(String[], String, String) - Static method in class org.hsqldb.lib.StringUtil
-
-
Builds a CSV list from the specified String[], separator string and - quote string.
-
-
getLocalPort() - Method in class org.hsqldb.server.Server
-
-
Retrieves this server socket's actual host port.
-
-
getLog(Class) - Static method in class org.hsqldb.lib.FrameworkLogger
-
-
User's entry-point into this logging system.
-
-
getLog(Class, String) - Static method in class org.hsqldb.lib.FrameworkLogger
-
-
This method just defers to the getLog(Class) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
-
-
getLog(String) - Static method in class org.hsqldb.lib.FrameworkLogger
-
-
Alternative entry-point into this logging system, for cases where you - want to share a single logger instance among multiple classes, or you - want to use multiple logger instances from a single class.
-
-
getLog(String, String) - Static method in class org.hsqldb.lib.FrameworkLogger
-
-
This method just defers to the getLog(String) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
-
-
getLoginTimeout() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Gets the maximum time in seconds that this data source can wait - while attempting to connect to a database.
-
-
getLoginTimeout() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Gets the maximum time in seconds that this data source can wait - while attempting to connect to a database.
-
-
getLogWriter() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the log writer for this DataSource - object.
-
-
getLogWriter() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves the log writer for this DataSource - object.
-
-
getLogWriter() - Method in class org.hsqldb.server.Server
-
-
Retrieves the PrintWriter to which server messages are printed.
-
-
getLong(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC BIGINT parameter - as a long in the Java programming language.
-
-
getLong(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a long in the Java programming language.
-
-
getLong(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC BIGINT parameter as a long - in the Java programming language.
-
-
getLong(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a long in the Java programming language.
-
-
getLongKey(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
getLongKey(int) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
getLongKey(int) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
getLongValue(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
getLongValue(int) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
getLongValue(int) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
getLookup(long) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
getLookup(long) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
getLPConstraint() - Method in class org.hsqldb.server.PgType
-
 
-
getMajorVersion() - Method in class org.hsqldb.jdbc.JDBCDriver
-
-
Gets the driver's major version number.
-
-
getMaxBinaryLiteralLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of hex characters this database allows in an - inline binary literal.
-
-
getMaxCatalogNameLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters that this database allows in a - catalog name.
-
-
getMaxCharLiteralLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters this database allows - for a character literal.
-
-
getMaxColumnNameLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters this database allows - for a column name.
-
-
getMaxColumnsInGroupBy() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of columns this database allows in a - GROUP BY clause.
-
-
getMaxColumnsInIndex() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of columns this database allows in an index.
-
-
getMaxColumnsInOrderBy() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of columns this database allows in an - ORDER BY clause.
-
-
getMaxColumnsInSelect() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of columns this database allows in a - SELECT list.
-
-
getMaxColumnsInTable() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of columns this database allows in a table.
-
-
getMaxConnections() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of concurrent connections to this - database that are possible.
-
-
getMaxCursorNameLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters that this database allows in a - cursor name.
-
-
getMaxFieldSize() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the maximum number of bytes that can be - returned for character and binary column values in a ResultSet - object produced by this Statement object.
-
-
getMaxFieldSize() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the maximum number of bytes that can be - returned for character and binary column values in a ResultSet - object produced by this Statement object.
-
-
getMaxIndexLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of bytes this database allows for an - index, including all of the parts of the index.
-
-
getMaxLogicalLobSize() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of bytes this database allows for - the logical size for a LOB.
-
-
getMaxProcedureNameLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters that this database allows in a - procedure name.
-
-
getMaxRows() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
-
-
getMaxRows() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
-
-
getMaxRowSize() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of bytes this database allows in - a single row.
-
-
getMaxSchemaNameLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters that this database allows in a - schema name.
-
-
getMaxStatementLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters this database allows in - an SQL statement.
-
-
getMaxStatements() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of active statements to this database - that can be open at the same time.
-
-
getMaxTableNameLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters this database allows in - a table name.
-
-
getMaxTablesInSelect() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of tables this database allows in a - SELECT statement.
-
-
getMaxUserNameLength() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the maximum number of characters this database allows in - a user name.
-
-
getMessage() - Method in exception org.hsqldb.lib.AppendableException
-
 
-
getMetaData() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves a DatabaseMetaData object that contains - metadata about the database to which this - Connection object represents a connection.
-
-
getMetaData() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves a ResultSetMetaData object that contains - information about the columns of the ResultSet object - that will be returned when this PreparedStatement object - is executed.
-
-
getMetaData() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the number, types and properties of - this ResultSet object's columns.
-
-
getMinorVersion() - Method in class org.hsqldb.jdbc.JDBCDriver
-
-
Gets the driver's minor version number.
-
-
getMissingPosValueBehavior() - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getMissingPropertyBehavior() - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getMoreResults() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Moves to this Statement object's next result, returns - true if it is a ResultSet object, and - implicitly closes any current ResultSet - object(s) obtained with the method getResultSet.
-
-
getMoreResults() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Moves to this Statement object's next result, returns - true if it is a ResultSet object, and - implicitly closes any current ResultSet - object(s) obtained with the method getResultSet.
-
-
getMoreResults(int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Moves to this Statement object's next result, deals with - any current ResultSet object(s) according to the instructions - specified by the given flag, and returns - true if the next result is a ResultSet object.
-
-
getMoreResults(int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Moves to this Statement object's next result, deals with - any current ResultSet object(s) according to the instructions - specified by the given flag, and returns - true if the next result is a ResultSet object.
-
-
getName() - Method in class org.hsqldb.lib.tar.PIFGenerator
-
 
-
getNCharacterStream(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
-
-
getNCharacterStream(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
-
-
getNCharacterStream(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
-
-
getNCharacterStream(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
-
-
getNClob(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC NCLOB parameter as a - java.sql.NClob object in the Java programming language.
-
-
getNClob(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a NClob object - in the Java programming language.
-
-
getNClob(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC NCLOB parameter as a - java.sql.NClob object in the Java programming language.
-
-
getNClob(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a NClob object - in the Java programming language.
-
-
getNetworkProtocol() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the network protocol of the data source.
-
-
getNetworkTimeout() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves the number of milliseconds the driver will - wait for a database request to complete.
-
-
getNextScheduled(Object) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Retrieves the next time the referenced task is due to be executed, as a - Date object.
-
-
getNextSection() - Method in class org.hsqldb.lib.LineGroupReader
-
 
-
getNString(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated NCHAR, - NVARCHAR - or LONGNVARCHAR parameter as - a String in the Java programming language.
-
-
getNString(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
-
-
getNString(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated NCHAR, - NVARCHAR - or LONGNVARCHAR parameter as - a String in the Java programming language.
-
-
getNString(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
-
-
getNumericFunctions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a comma-separated list of math functions available with - this database.
-
-
getObject(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated parameter as an Object - in the Java programming language.
-
-
getObject(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
getObject(int, Class<T>) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Returns an object representing the value of OUT parameter - parameterIndex and will convert from the - SQL type of the parameter to the requested Java data type, if the - conversion is supported.
-
-
getObject(int, Class<T>) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object and will convert from the - SQL type of the column to the requested Java data type, if the - conversion is supported.
-
-
getObject(int, Map) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as an Object - in the Java programming language.
-
-
getObject(int, Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Returns an object representing the value of OUT parameter - parameterIndex and uses map for the custom - mapping of the parameter value.
-
-
getObject(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a parameter as an Object in the Java - programming language.
-
-
getObject(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
getObject(String, Class<T>) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Returns an object representing the value of OUT parameter - parameterName and will convert from the - SQL type of the parameter to the requested Java data type, if the - conversion is supported.
-
-
getObject(String, Class<T>) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object and will convert from the - SQL type of the column to the requested Java data type, if the - conversion is supported.
-
-
getObject(String, Map) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as an Object - in the Java programming language.
-
-
getObject(String, Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Returns an object representing the value of OUT parameter - parameterName and uses map for the custom - mapping of the parameter value.
-
-
getObjectInstance(Object, Name, Context, Hashtable) - Method in class org.hsqldb.jdbc.JDBCDataSourceFactory
-
-
Creates a DataSource object using the javax.naming.Reference object - specified.
-
-
getOid() - Method in class org.hsqldb.server.PgType
-
 
-
getOrAdd(E) - Method in class org.hsqldb.lib.HashSet
-
 
-
getOrderedKeyMatchCount(int[]) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
getOrderedStartMatchCount(int[]) - Method in class org.hsqldb.lib.OrderedIntHashSet
-
 
-
getOrderedStartMatchCount(long[]) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
getOverWrite() - Method in class org.hsqldb.lib.tar.DbBackup
-
 
-
getParameter(String, Session) - Method in class org.hsqldb.server.PgType
-
-
This method copied from JDBCPreparedStatement.java.
-
-
getParameterClassName(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves the fully-qualified name of the Java class whose instances - should be passed to the method PreparedStatement.setObject.
-
-
getParameterCount() - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves the number of parameters in the PreparedStatement - object for which this ParameterMetaData object contains - information.
-
-
getParameterMetaData() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the number, types and properties of this - PreparedStatement object's parameters.
-
-
getParameterMetaDataDirect() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
getParameterMode(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves the designated parameter's mode.
-
-
getParameterType(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves the designated parameter's SQL type.
-
-
getParameterTypeName(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves the designated parameter's database-specific type name.
-
-
getParentLogger() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Return the parent Logger of all the Loggers used by this data source.
-
-
getParentLogger() - Method in class org.hsqldb.jdbc.JDBCDriver
-
-
Return the parent Logger of all the Loggers used by this driver.
-
-
getParentLogger() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Return the parent Logger of all the Loggers used by this data source.
-
-
getPaxThreshold() - Method in class org.hsqldb.lib.tar.TarGenerator
-
 
-
getPgType(Type) - Static method in class org.hsqldb.server.PgType
-
 
-
getPooledConnection() - Method in class org.hsqldb.jdbc.pool.JDBCPooledDataSource
-
 
-
getPooledConnection(String, String) - Method in class org.hsqldb.jdbc.pool.JDBCPooledDataSource
-
 
-
getPort() - Method in class org.hsqldb.server.Server
-
-
Retrieves this server's host port as configured.
-
-
getPos() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
getPrecision(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves the designated parameter's specified column size.
-
-
getPrecision(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
(JDBC4 clarification:) - Get the designated column's specified column size.
-
-
getPrimaryKeys(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the given table's primary key columns.
-
-
getPrintWriter() - Method in class org.hsqldb.lib.SimpleLog
-
 
-
getProcedureColumns(String, String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the given catalog's stored procedure parameter - and result columns.
-
-
getProcedures(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the stored procedures available in the given - catalog.
-
-
getProcedureTerm() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the database vendor's preferred term for "procedure".
-
-
getProductName() - Method in class org.hsqldb.server.Server
-
-
Retrieves this server's product name.
-
-
getProductName() - Method in class org.hsqldb.server.WebServer
-
-
Retrieves this server's product name.
-
-
getProductVersion() - Method in class org.hsqldb.server.Server
-
-
Retrieves the server's product version, as a String.
-
-
getPropertiesFromFile(int, String, String) - Static method in class org.hsqldb.server.ServerConfiguration
-
-
Retrieves a new HsqlProperties object, if possible, loaded from the - specified file.
-
-
getPropertyInfo(String, Properties) - Method in class org.hsqldb.jdbc.JDBCDriver
-
-
Gets information about the possible properties for this driver.
-
-
getProtocol() - Method in class org.hsqldb.server.Server
-
-
Retrieves a string resresentaion of the network protocol - this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.
-
-
getProtocol() - Method in class org.hsqldb.server.WebServer
-
-
Retrieves a string representation of the network protocol - this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.
-
-
getPseudoColumns(String, String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the pseudo or hidden columns available - in a given table within the specified catalog and schema.
-
-
getQueryTimeout() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the number of seconds the driver will - wait for a Statement object to execute.
-
-
getQueryTimeout() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the number of seconds the driver will - wait for a Statement object to execute.
-
-
getReadBufferBlocks() - Method in class org.hsqldb.lib.tar.TarFileInputStream
-
 
-
getReadLock() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
getRef(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC REF(<structured-type>) - parameter as a Ref object in the Java programming language.
-
-
getRef(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a Ref object - in the Java programming language.
-
-
getRef(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC REF(<structured-type>) - parameter as a Ref object in the Java programming language.
-
-
getRef(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a Ref object - in the Java programming language.
-
-
getReference() - Method in class org.hsqldb.jdbc.JDBCDataSource
-
-
Retrieves the Reference of this object.
-
-
getReference() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves the Reference of this object.
-
-
getReference() - Method in class org.hsqldb.jdbc.pool.JDBCPooledDataSource
-
-
Retrieves the Reference of this object.
-
-
getReference() - Method in class org.hsqldb.jdbc.pool.JDBCXADataSource
-
-
Retrieves the Reference of this object.
-
-
getResultSet() - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves a result set that contains the elements of the SQL - ARRAY value - designated by this Array object.
-
-
getResultSet() - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves a result set that contains the elements of the SQL - ARRAY value - designated by this Array object.
-
-
getResultSet() - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
 
-
getResultSet() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the current result as a ResultSet object.
-
-
getResultSet() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the current result as a ResultSet object.
-
-
getResultSet(long, int) - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
-
-
getResultSet(long, int) - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
-
-
getResultSet(long, int, Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
-
-
getResultSet(long, int, Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
-
-
getResultSet(Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Retrieves a result set that contains the elements of the SQL - ARRAY value designated by this Array object.
-
-
getResultSet(Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Retrieves a result set that contains the elements of the SQL - ARRAY value designated by this Array object.
-
-
getResultSetConcurrency() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the result set concurrency for ResultSet objects - generated by this Statement object.
-
-
getResultSetConcurrency() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the result set concurrency for ResultSet objects - generated by this Statement object.
-
-
getResultSetHoldability() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
(JDBC4 clarification:) - Retrieves this database's default holdability for ResultSet - objects.
-
-
getResultSetHoldability() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the result set holdability for ResultSet objects - generated by this Statement object.
-
-
getResultSetHoldability() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the result set holdability for ResultSet objects - generated by this Statement object.
-
-
getResultSetMetaData() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
getResultSetScrollability() - Method in class org.hsqldb.jdbc.JDBCStatement
-
 
-
getResultSetType() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the result set type for ResultSet objects - generated by this Statement object.
-
-
getResultSetType() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the result set type for ResultSet objects - generated by this Statement object.
-
-
getRow() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the current row number.
-
-
getRowCount() - Method in class org.hsqldb.util.TableSorter
-
 
-
getRowId(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC ROWID parameter as a - java.sql.RowId object.
-
-
getRowId(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row of this - ResultSet object as a java.sql.RowId object in the Java - programming language.
-
-
getRowId(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC ROWID parameter as a - java.sql.RowId object.
-
-
getRowId(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row of this - ResultSet object as a java.sql.RowId object in the Java - programming language.
-
-
getRowIdLifetime() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Indicates whether or not this data source supports the SQL ROWID type, - and if so the lifetime for which a RowId object remains valid.
-
-
getSavepointId() - Method in class org.hsqldb.jdbc.JDBCSavepoint
-
-
Retrieves the generated ID for the savepoint that this - Savepoint object represents.
-
-
getSavepointName() - Method in class org.hsqldb.jdbc.JDBCSavepoint
-
-
Retrieves the name of the savepoint that this Savepoint - object represents.
-
-
getScale(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves the designated parameter's number of digits to right of the decimal point.
-
-
getScale(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Gets the designated column's number of digits to right of the decimal point.
-
-
getSchema() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves this Connection object's current schema name.
-
-
getSchemaName(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Get the designated column's table's schema.
-
-
getSchemas() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the schema names available in this database.
-
-
getSchemas(String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the schema names available in this database.
-
-
getSchemaTerm() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the database vendor's preferred term for "schema".
-
-
getSearchStringEscape() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the string that can be used to escape wildcard characters.
-
-
getSecondValueAt(int) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
getSectionAsString() - Method in class org.hsqldb.lib.LineGroupReader
-
 
-
getServerError() - Method in class org.hsqldb.server.Server
-
-
Retrieves a Throwable indicating the last server error, if any.
-
-
getServerId() - Method in class org.hsqldb.server.Server
-
-
Retrieves a String identifying this Server object.
-
-
getServerName() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the server name attribute.
-
-
getServerThread() - Method in class org.hsqldb.server.Server
-
-
Returns thread object for "HSQLDB Server" thread
-
-
getSession() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
provides cross-package access to the proprietary (i.e.
-
-
getShort(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC SMALLINT parameter - as a short in the Java programming language.
-
-
getShort(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a short in the Java programming language.
-
-
getShort(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC SMALLINT parameter as a short - in the Java programming language.
-
-
getShort(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a short in the Java programming language.
-
-
getSingleton() - Static method in class org.hsqldb.auth.AuthBeanMultiplexer
-
 
-
getSize() - Method in class org.hsqldb.lib.tar.PIFData
-
-
N.b.
-
-
getSizeLimit() - Method in interface org.hsqldb.lib.InputStreamInterface
-
-
Invariant.
-
-
getSizeLimit() - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
getSmallestIndex(OrderedHashSet<E>) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
getSortingStatus(int) - Method in class org.hsqldb.util.TableSorter
-
 
-
getSource(Class<T>) - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Returns a Source for reading the XML value designated by this SQLXML instance.
-
-
getSQL() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
getSQLKeywords() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a comma-separated list of all of this database's SQL keywords - that are NOT also SQL:2003 keywords.
-
-
getSQLStateType() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
(JDBC4 modified:) - Indicates whether the SQLSTATE returned by SQLException.getSQLState - is X/Open (now known as Open Group) SQL CLI or SQL:2003.
-
-
getSQLXML(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated SQL XML parameter as a - java.sql.SQLXML object in the Java programming language.
-
-
getSQLXML(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row of - this ResultSet as a - java.sql.SQLXML object in the Java programming language.
-
-
getSQLXML(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated SQL XML parameter as a - java.sql.SQLXML object in the Java programming language.
-
-
getSQLXML(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row of - this ResultSet as a - java.sql.SQLXML object in the Java programming language.
-
-
getStart() - Method in enum org.hsqldb.lib.tar.TarHeaderField
-
 
-
getStartLineNumber() - Method in class org.hsqldb.lib.LineGroupReader
-
 
-
getStartMatchCount(int[]) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
getStartMatchCount(long[]) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
getState() - Method in class org.hsqldb.server.Server
-
-
Retrieves current state of this server in numerically coded form.
-
-
getStateDescriptor() - Method in class org.hsqldb.server.Server
-
-
Retrieves a character sequence describing this server's current state, - including the message of the last exception, if there is one and it - is still in context.
-
-
getStatement() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the Statement object that produced this - ResultSet object.
-
-
getStatementID() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
getStatementMap(String) - Static method in class org.hsqldb.lib.LineGroupReader
-
 
-
getStop() - Method in enum org.hsqldb.lib.tar.TarHeaderField
-
 
-
getString() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Returns a string representation of the XML value designated by this SQLXML instance.
-
-
getString() - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString() - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC CHAR, - VARCHAR, or LONGVARCHAR parameter as a - String in the Java programming language.
-
-
getString(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
-
-
getString(int) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(int) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(int, int) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(int, int) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(int, int, int) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(int, int, int) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(int, int, String) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(int, int, String) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(int, String) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(int, String) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(int, String, int) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(int, String, int) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(int, String, String) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(int, String, String) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(Enum<?>) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, int, int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, int, int, int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, int, int, String) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, int, String) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, int, String, int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, int, String, String) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, String...) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, String, int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, String, int, int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, String, int, String) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(Enum<?>, String, String, int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
getString(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC CHAR, VARCHAR, - or LONGVARCHAR parameter as a String in - the Java programming language.
-
-
getString(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
-
-
getString(String) - Method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
-
Returns value defined in this RefCapablePropertyResourceBundle's - .properties file, unless that value is empty.
-
-
getString(String...) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(String...) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(String, int) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(String, int) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(String, int, int) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(String, int, int) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(String, int, String) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(String, int, String) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getString(String, String[], int) - Method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
getString(String, String, int) - Method in interface org.hsqldb.lib.RefCapableRBInterface
-
 
-
getString(String, String, int) - Method in enum org.hsqldb.lib.tar.RB
-
 
-
getStringFunctions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a comma-separated list of string functions available with - this database.
-
-
getSubString(long, int) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves a copy of the specified substring - in the CLOB value - designated by this Clob object.
-
-
getSubString(long, int) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves a copy of the specified substring in the CLOB - value designated by this Clob object.
-
-
getSubString(long, int) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves a copy of the specified substring - in the CLOB value - designated by this Clob object.
-
-
getSuperTables(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the table hierarchies defined in a particular - schema in this database.
-
-
getSuperTypes(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the user-defined type (UDT) hierarchies defined in a - particular schema in this database.
-
-
getSystemFunctions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a comma-separated list of system functions available with - this database.
-
-
getTableHeader() - Method in class org.hsqldb.util.TableSorter
-
 
-
getTableModel() - Method in class org.hsqldb.util.TableSorter
-
 
-
getTableName(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Gets the designated column's table name.
-
-
getTableOidForColumn(int, ResultMetaData) - Static method in class org.hsqldb.server.OdbcUtil
-
 
-
getTablePrivileges(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the access rights for each table available - in a catalog.
-
-
getTables(String, String, String, String[]) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the tables available in the given catalog.
-
-
getTableTypes() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the table types available in this database.
-
-
getTaskRunnerThread() - Method in class org.hsqldb.lib.HsqlTaskQueue
-
 
-
getThirdValueAt(int) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
getThread() - Method in class org.hsqldb.lib.HsqlTimer
-
-
Retrieves the background execution thread.
-
-
getTime(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC TIME parameter as a - java.sql.Time object.
-
-
getTime(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Time object in the Java programming language.
-
-
getTime(int, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC TIME parameter as a - java.sql.Time object, using - the given Calendar object - to construct the time.
-
-
getTime(int, Calendar) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Time - object in the Java programming language.
-
-
getTime(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC TIME parameter as a - java.sql.Time object.
-
-
getTime(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Time object in the Java programming language.
-
-
getTime(String, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC TIME parameter as a - java.sql.Time object, using - the given Calendar object - to construct the time.
-
-
getTime(String, Calendar) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Time object - in the Java programming language.
-
-
getTimeDateFunctions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a comma-separated list of the time and date functions available - with this database.
-
-
getTimestamp(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC TIMESTAMP - parameter as a java.sql.Timestamp object.
-
-
getTimestamp(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Timestamp object in the Java programming language.
-
-
getTimestamp(int, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC TIMESTAMP parameter as a - java.sql.Timestamp object, using - the given Calendar object to construct - the Timestamp object.
-
-
getTimestamp(int, Calendar) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Timestamp object - in the Java programming language.
-
-
getTimestamp(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC TIMESTAMP parameter as a - java.sql.Timestamp object.
-
-
getTimestamp(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Timestamp object in the Java programming language.
-
-
getTimestamp(String, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC TIMESTAMP parameter as a - java.sql.Timestamp object, using - the given Calendar object to construct - the Timestamp object.
-
-
getTimestamp(String, Calendar) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Timestamp object - in the Java programming language.
-
-
getTotalValues() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
getTotalValues() - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
getTotalValues() - Method in class org.hsqldb.lib.IntIndex
-
 
-
getTotalValues() - Method in interface org.hsqldb.lib.LongLookup
-
 
-
getTransactionIsolation() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves this Connection object's current - transaction isolation level.
-
-
getTransactionTimeout() - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
 
-
getTwoPowerFloor(int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns the largest value that is 0 or a power of 2 and is smaller or - equal to n
-
-
getTwoPowerScale(int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns the log2 of largest value that is 0 or a power of 2 and is - smaller or equal to n
-
-
getType() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the type of this ResultSet object.
-
-
getTypeInfo() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of all the (JDBC4 clarification:) data types supported by - this database.
-
-
getTypeMap() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves the Map object associated with this - Connection object.
-
-
getTypeWidth() - Method in class org.hsqldb.server.PgType
-
 
-
getUDTs(String, String, String, int[]) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of the user-defined types (UDTs) defined - in a particular schema.
-
-
getUnicodeStream(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Deprecated. -
use getCharacterStream in place of - getUnicodeStream
-
-
-
getUnicodeStream(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Deprecated. -
use getCharacterStream instead
-
-
-
getUniqueXid(int) - Static method in class org.hsqldb.jdbc.pool.JDBCXID
-
-
Retrieves a randomly generated JDBCXID.
-
-
getUpdateCount() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the current result as an update count; - if the result is a ResultSet object or there are no more results, -1 - is returned.
-
-
getUpdateCount() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the current result as an update count; - if the result is a ResultSet object or there are no more results, -1 - is returned.
-
-
getUrl() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the jdbc database connection url attribute.
-
-
getUrl() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves the jdbc database connection url attribute.
-
-
getURL() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the jdbc database connection url attribute.
-
-
getURL() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves this connection's JDBC url.
-
-
getURL() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the URL for this DBMS.
-
-
getURL() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves the jdbc database connection url attribute.
-
-
getURL(int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of the designated JDBC DATALINK parameter as a - java.net.URL object.
-
-
getURL(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.net.URL - object in the Java programming language.
-
-
getURL(String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves the value of a JDBC DATALINK parameter as a - java.net.URL object.
-
-
getURL(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the value of the designated column in the current row - of this ResultSet object as a java.net.URL - object in the Java programming language.
-
-
getUser() - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Retrieves the user name for the connection.
-
-
getUser() - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Retrieves the user name for the connection.
-
-
getUserName() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves the user name as known to this database.
-
-
getUTFSize(String) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
getValue() - Method in interface org.hsqldb.lib.Map.Entry
-
 
-
getValue() - Method in class org.hsqldb.lib.MapEntry
-
 
-
getValue(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
getValueAt(int) - Method in class org.hsqldb.lib.OrderedHashMap
-
-
Returns the value stored in the entry at index position.
-
-
getValueAt(int) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
getValueAt(int) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
getValueAt(int, int) - Method in class org.hsqldb.util.TableSorter
-
 
-
getValues() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
getValuesIterator(Object) - Method in class org.hsqldb.lib.MultiValueHashMap
-
-
Returns an iterator on all values associated with the key.
-
-
getVersionColumns(String, String, String) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves a description of a table's columns that are automatically - updated when any value in a row is updated.
-
-
getWarnings() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves the first warning reported by calls on this - Connection object.
-
-
getWarnings() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves the first warning reported by calls on this Statement object.
-
-
getWarnings() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves the first warning reported by calls on this - ResultSet object.
-
-
getWarnings() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves the first warning reported by calls on this Statement object.
-
-
getWebRoot() - Method in class org.hsqldb.server.Server
-
-
Retrieves the root context (directory) from which web content - is served.
-
-
getWebRoot() - Method in class org.hsqldb.server.WebServer
-
-
Retrieves the root context (directory) from which web content - is served.
-
-
getWriteLock() - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
getWriteLock() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
getWriter() - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
 
-
getXAConnection() - Method in class org.hsqldb.jdbc.pool.JDBCXADataSource
-
-
Get new XAConnection connection, to be managed by a connection manager.
-
-
getXAConnection(String, String) - Method in class org.hsqldb.jdbc.pool.JDBCXADataSource
-
-
Gets a new XAConnection after validating the given username - and password.
-
-
getXAResource() - Method in class org.hsqldb.jdbc.pool.JDBCXAConnection
-
 
-
gid - org.hsqldb.lib.tar.TarHeaderField
-
 
-
gname - org.hsqldb.lib.tar.TarHeaderField
-
 
-
GZIP_COMPRESSION - Static variable in interface org.hsqldb.lib.tar.TarFileOutputStream.Compression
-
 
-
- - - -

H

-
-
handle(Callback[]) - Method in class org.hsqldb.auth.JaasAuthBean.UPCallbackHandler
-
 
-
handleConnection(Socket) - Method in interface org.hsqldb.server.HsqlSocketRequestHandler
-
 
-
handleConnection(Socket) - Method in class org.hsqldb.server.Server
-
-
Assigns the specified socket to a new connection handler and - starts the handler in a new Thread.
-
-
handlePopup(MouseEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
handshakeCompleted(HandshakeCompletedEvent) - Method in class org.hsqldb.server.HsqlSocketFactorySecure
-
 
-
hasAllNull(Object[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
hashCode() - Method in class org.hsqldb.jdbc.JDBCRowId
-
-
Returns a hash code value of this RowId object.
-
-
hashCode() - Method in class org.hsqldb.jdbc.pool.JDBCXID
-
 
-
hashCode() - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
As much as is reasonably practical, returns distinct integers for - distinct objects.
-
-
hashCode() - Method in class org.hsqldb.lib.MapEntry
-
 
-
hashCode() - Method in class org.hsqldb.util.ConnectionSetting
-
 
-
hashCode(Object) - Method in class org.hsqldb.lib.ObjectComparator.DefaultComparator
-
 
-
hashCode(Object) - Method in class org.hsqldb.lib.ObjectComparator.IdentityComparator
-
 
-
hashCode(T) - Method in interface org.hsqldb.lib.ObjectComparator
-
 
-
HashMap<K,​V> - Class in org.hsqldb.lib
-
-
This class does not store null keys.
-
-
HashMap() - Constructor for class org.hsqldb.lib.HashMap
-
 
-
HashMap(int) - Constructor for class org.hsqldb.lib.HashMap
-
 
-
HashMap(int, ObjectComparator) - Constructor for class org.hsqldb.lib.HashMap
-
 
-
HashSet<E> - Class in org.hsqldb.lib
-
-
This class does not store null keys.
-
-
HashSet() - Constructor for class org.hsqldb.lib.HashSet
-
 
-
HashSet(int) - Constructor for class org.hsqldb.lib.HashSet
-
 
-
HashSet(int, ObjectComparator) - Constructor for class org.hsqldb.lib.HashSet
-
 
-
HashSet(Object[]) - Constructor for class org.hsqldb.lib.HashSet
-
 
-
hasNext() - Method in class org.hsqldb.lib.FilteredIterator
-
 
-
hasNext() - Method in interface org.hsqldb.lib.Iterator
-
 
-
hasNext() - Method in class org.hsqldb.lib.WrapperIterator
-
-
Tests if this iterator contains more elements.
-
-
hasNull(Object[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Determines if the array has a null column for any of the positions given - in the rowColMap array.
-
-
haveCommonElement(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if arra and arrb share any element.
-
-
haveEqualArrays(int[], int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if the first count elements of arra and arrb are identical - subarrays of integers
-
-
haveEqualArrays(Object[], Object[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if the first count elements of arra and arrb are identical - subarrays of Objects
-
-
haveEqualSets(int[], int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if the first count elements of arra and arrb are identical - sets of integers (not necessarily in the same order).
-
-
header_field_missing - org.hsqldb.lib.tar.RB
-
 
-
hexCharsToOctalOctets(String) - Static method in class org.hsqldb.server.OdbcUtil
-
 
-
hexStringToByteArray(String) - Static method in class org.hsqldb.lib.StringConverter
-
-
Converts a hexadecimal string into a byte array
-
-
HsqlArrayHeap<E> - Class in org.hsqldb.lib
-
-
An HsqlHeap implementation backed by an array of objects and an - ObjectComparator.
-
-
HsqlArrayHeap(int, Comparator<E>) - Constructor for class org.hsqldb.lib.HsqlArrayHeap
-
-
Creates a new HsqlArrayHeap with the given initial capacity, using the - specified ObjectComparator to maintain the heap invariant.
-
-
HsqlArrayList<E> - Class in org.hsqldb.lib
-
-
Intended as an asynchronous alternative to Vector.
-
-
HsqlArrayList() - Constructor for class org.hsqldb.lib.HsqlArrayList
-
-
Creates a new instance of HsqlArrayList
-
-
HsqlArrayList(int) - Constructor for class org.hsqldb.lib.HsqlArrayList
-
-
Creates a new instance with the given initial capacity
-
-
HsqlArrayList(int, boolean) - Constructor for class org.hsqldb.lib.HsqlArrayList
-
-
Creates a new instance of HsqlArrayList that minimizes the size when empty
-
-
HsqlArrayList(E[], int) - Constructor for class org.hsqldb.lib.HsqlArrayList
-
 
-
HsqlByteArrayInputStream - Class in org.hsqldb.lib
-
-
This class is a replacement for both java.io.ByteArrayInputStream - (without synchronization) and java.io.DataInputStream
-
-
HsqlByteArrayInputStream(byte[]) - Constructor for class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
HsqlByteArrayInputStream(byte[], int, int) - Constructor for class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
HsqlByteArrayOutputStream - Class in org.hsqldb.lib
-
-
This class is a replacement for both java.io.ByteArrayOuputStream - (without synchronization) and java.io.DataOutputStream
-
-
HsqlByteArrayOutputStream() - Constructor for class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
HsqlByteArrayOutputStream(byte[]) - Constructor for class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
HsqlByteArrayOutputStream(int) - Constructor for class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
HsqlByteArrayOutputStream(InputStream) - Constructor for class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
HsqlByteArrayOutputStream(InputStream, int) - Constructor for class org.hsqldb.lib.HsqlByteArrayOutputStream
-
-
Constructor from an InputStream limits size to the length argument.
-
-
HsqlConsoleHandler - Class in org.hsqldb.lib
-
 
-
HsqlConsoleHandler() - Constructor for class org.hsqldb.lib.HsqlConsoleHandler
-
 
-
HsqldbSlaveAuthBean - Class in org.hsqldb.auth
-
-
Delegates authentication decisions, and optionally determination of user - roles and schema, to a different HyperSQL catalog, which may be in the same - JVM or remote.
-
-
HsqldbSlaveAuthBean() - Constructor for class org.hsqldb.auth.HsqldbSlaveAuthBean
-
 
-
HsqlDeque<E> - Class in org.hsqldb.lib
-
-
A List<E> that also implements Deque<E> and Queue<E> - and methods for usage as stack.
-
-
HsqlDeque() - Constructor for class org.hsqldb.lib.HsqlDeque
-
 
-
HsqlHeap<E> - Interface in org.hsqldb.lib
-
-
Provides the HyperSQL interface for Heap ADT implementations.
-
-
HsqlServerFactory - Class in org.hsqldb.server
-
-
HsqlServerFactory
-
-
HsqlSocketFactory - Class in org.hsqldb.server
-
-
Base class for producing the Socket objects used by HSQLDB.
-
-
HsqlSocketFactorySecure - Class in org.hsqldb.server
-
-
The default secure socket factory implementation.
-
-
HsqlSocketRequestHandler - Interface in org.hsqldb.server
-
-
Interface HsqlSocketRequestHandler
-
-
HsqlTaskQueue - Class in org.hsqldb.lib
-
-
Provides very simple queued execution of Runnable objects in a background - thread.
-
-
HsqlTaskQueue() - Constructor for class org.hsqldb.lib.HsqlTaskQueue
-
 
-
HsqlTimer - Class in org.hsqldb.lib
-
-
Facility to schedule tasks for future execution in a background thread.
-
-
HsqlTimer() - Constructor for class org.hsqldb.lib.HsqlTimer
-
-
Constructs a new HsqlTimer using the default thread factory - implementation.
-
-
HsqlTimer(ThreadFactory) - Constructor for class org.hsqldb.lib.HsqlTimer
-
-
Constructs a new HsqlTimer.
-
-
- - - -

I

-
-
id - Variable in class org.hsqldb.util.RCData
-
 
-
identityComparator - Static variable in interface org.hsqldb.lib.ObjectComparator
-
 
-
IdentityComparator() - Constructor for class org.hsqldb.lib.ObjectComparator.IdentityComparator
-
 
-
ignorableWhitespace(char[], int, int) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of ignorable whitespace in element content.
-
-
illegal_block_boundary - org.hsqldb.lib.tar.RB
-
 
-
indexOf(long) - Method in class org.hsqldb.lib.LongDeque
-
 
-
indexOf(Object) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
returns the index of given object or -1 if not found
-
-
indexOf(Object) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
indexOf(Object) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
info(String) - Method in class org.hsqldb.lib.FrameworkLogger
-
 
-
info(String, Throwable) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
Just like FrameworkLogger.info(String), but also logs a stack trace.
-
-
init() - Method in class org.hsqldb.auth.HsqldbSlaveAuthBean
-
 
-
init() - Method in class org.hsqldb.auth.JaasAuthBean
-
 
-
init() - Method in class org.hsqldb.auth.LdapAuthBean
-
 
-
init() - Method in class org.hsqldb.util.DatabaseManager
-
 
-
init() - Method in class org.hsqldb.util.Transfer
-
 
-
InOutUtil - Class in org.hsqldb.lib
-
-
Input / Output utility
-
-
InputStreamInterface - Interface in org.hsqldb.lib
-
 
-
inputStreamToString(InputStream, String) - Static method in class org.hsqldb.lib.StringConverter
-
-
Using an output stream, returns a String from an InputStream.
-
-
InputStreamWrapper - Class in org.hsqldb.lib
-
 
-
InputStreamWrapper(InputStream) - Constructor for class org.hsqldb.lib.InputStreamWrapper
-
 
-
insert(int, int) - Method in class org.hsqldb.lib.OrderedIntHashSet
-
 
-
insert(int, int, V) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
insert(int, long) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
insert(int, long, V) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
insert(int, E) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
insert(int, K, V) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
INSERT_AFTER - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
INSERT_AFTER_ROW - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
INSERT_BEFORE_ROW - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
insertionSort(Object[], Comparator, int, int) - Static method in class org.hsqldb.lib.ArraySort
-
 
-
insertRow() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Inserts the contents of the insert row into this - ResultSet object and into the database.
-
-
insertsAreDetected(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether or not a visible row insert can be detected - by calling the method ResultSet.rowInserted.
-
-
insufficient_read - org.hsqldb.lib.tar.RB
-
 
-
IntHashSet - Class in org.hsqldb.lib
-
-
A set of int primitives.
-
-
IntHashSet() - Constructor for class org.hsqldb.lib.IntHashSet
-
 
-
IntHashSet(int) - Constructor for class org.hsqldb.lib.IntHashSet
-
 
-
IntHashSet(int[]) - Constructor for class org.hsqldb.lib.IntHashSet
-
 
-
IntHashSet(int[], int[]) - Constructor for class org.hsqldb.lib.IntHashSet
-
 
-
IntIndex - Class in org.hsqldb.lib
-
-
Maintains an ordered integer index.
-
-
IntIndex(int, boolean) - Constructor for class org.hsqldb.lib.IntIndex
-
 
-
intIndexesToBooleanArray(int[], boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Set elements of arrb true if their indexes appear in arrb.
-
-
IntKeyHashMap<V> - Class in org.hsqldb.lib
-
-
A Map of int primitives to Object values.
-
-
IntKeyHashMap() - Constructor for class org.hsqldb.lib.IntKeyHashMap
-
 
-
IntKeyHashMap(int) - Constructor for class org.hsqldb.lib.IntKeyHashMap
-
 
-
IntKeyHashMapConcurrent<V> - Class in org.hsqldb.lib
-
-
A Map of int primitives to Object values, suitable for thread-safe access.
-
-
IntKeyHashMapConcurrent() - Constructor for class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
IntKeyHashMapConcurrent(int) - Constructor for class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
IntKeyIntValueHashMap - Class in org.hsqldb.lib
-
-
A Map of int primitive keys to int primitive values.
-
-
IntKeyIntValueHashMap() - Constructor for class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
IntKeyIntValueHashMap(int) - Constructor for class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
IntKeyLongValueHashMap - Class in org.hsqldb.lib
-
-
A Map of int primitive keys to long primitive values.
-
-
IntKeyLongValueHashMap() - Constructor for class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
IntKeyLongValueHashMap(int) - Constructor for class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
IntLookup - Interface in org.hsqldb.lib
-
-
Interface for int to int lookup.
-
-
IntValueHashMap<K> - Class in org.hsqldb.lib
-
-
A Map of Object keys to int primitive values.
-
-
IntValueHashMap() - Constructor for class org.hsqldb.lib.IntValueHashMap
-
 
-
IntValueHashMap(int) - Constructor for class org.hsqldb.lib.IntValueHashMap
-
 
-
invalidArgument() - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
invalidArgument(int) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
invalidArgument(String) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
invoke(String, String[]) - Static method in class org.hsqldb.util.MainInvoker
-
-
Invokes the static main(String[]) method from each specified class.
-
-
isAfterLast() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether the cursor is after the last row in - this ResultSet object.
-
-
isAnyIntIndexInBooleanArray(int[], boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
isAutoIncrement - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether the value of the column are automatically numbered.
-
-
isAutoIncrement(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether the designated column is automatically numbered.
-
-
isBeforeFirst() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether the cursor is before the first row in - this ResultSet object.
-
-
isCancelled(Object) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Retrieves whether the specified argument references a cancelled task.
-
-
isCaseSensitive - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether the column's value's case matters.
-
-
isCaseSensitive(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether a column's case matters.
-
-
isCatalogAtStart() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a catalog appears at the start of a fully qualified - table name.
-
-
isCellEditable(int, int) - Method in class org.hsqldb.util.TableSorter
-
 
-
isClosed() - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
 
-
isClosed() - Method in class org.hsqldb.jdbc.JDBCClobClient
-
 
-
isClosed() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves whether this Connection object has been - closed.
-
-
isClosed() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves whether this Statement object has been closed.
-
-
isClosed() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether this ResultSet object has been closed.
-
-
isClosed() - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Retrieves whether this object is closed.
-
-
isClosed() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Retrieves whether this Statement object has been closed.
-
-
isClosed() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Retrieves whether this stream is closed.
-
-
isClosed() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
 
-
isCloseOnCompletion() - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
 
-
isCurrency - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether the values in the column are cash values.
-
-
isCurrency(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether the designated column is a cash value.
-
-
isDefinitelyWritable - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether a write on the column will definitely succeed.
-
-
isDefinitelyWritable(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether a write on the designated column will definitely succeed.
-
-
isDeleteOnFree() - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Retrieves whether an attempt to delete the backing file - is made in response to invocation of JDBCBlobFile.free().
-
-
isDeleteOnFree() - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves whether an attempt to delete the backing file - is made in response to invocation of JDBCClobFile.free().
-
-
isEmpty() - Method in interface org.hsqldb.lib.Collection
-
 
-
isEmpty() - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
isEmpty() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
isEmpty() - Method in interface org.hsqldb.lib.HsqlHeap
-
-
Retrieves whether this Heap is empty.
-
-
isEmpty() - Method in interface org.hsqldb.lib.List
-
 
-
isEmpty() - Method in class org.hsqldb.lib.LongDeque
-
 
-
isEmpty() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
isEmpty() - Method in interface org.hsqldb.lib.Map
-
 
-
isEmpty(String) - Static method in class org.hsqldb.lib.StringUtil
-
-
Checks if text is empty (characters <= space)
-
-
isFirst() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether the cursor is on the first row of - this ResultSet object.
-
-
isFixedDelay(Object) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Retrieves whether the specified argument references a task scheduled - periodically using fixed delay scheduling.
-
-
isFixedRate(Object) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Retrieves whether the specified argument references a task scheduled - periodically using fixed rate scheduling.
-
-
isFreed() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Retrieves whether this stream is freed.
-
-
isFreed() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
 
-
isFull() - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
isFull() - Method in interface org.hsqldb.lib.HsqlHeap
-
-
Retrieves whether this Heap is full.
-
-
isInSortedArray(char, char[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns true if char argument is in array.
-
-
isInternal() - Method in class org.hsqldb.jdbc.JDBCConnection
-
 
-
isInUse() - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
-
Returns true if getConnection() has been called and a leas has been - given.
-
-
isLast() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether the cursor is on the last row of - this ResultSet object.
-
-
isNetwork() - Method in class org.hsqldb.jdbc.JDBCConnection
-
 
-
isNoSystemExit() - Method in class org.hsqldb.server.Server
-
-
Retrieves whether this server calls System.exit() when shutdown.
-
-
isNotRunning() - Method in class org.hsqldb.server.Server
-
-
Returns true if this server is not running
-
-
isNullable - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The nullability of values in the column.
-
-
isNullable(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves whether null values are allowed in the designated parameter.
-
-
isNullable(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates the nullability of values in the designated column.
-
-
isPeriodic(Object) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Retrieves whether the specified argument references a task scheduled - for periodic execution.
-
-
isPoolable() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Returns a value indicating whether the Statement - is poolable or not.
-
-
isPoolable() - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Returns a value indicating whether the Statement - is poolable or not.
-
-
isReadable() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Retrieves the object's readability status.
-
-
isReadOnly - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether the column's values are definitely not writable.
-
-
isReadOnly() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Retrieves whether this Connection - object is in read-only mode.
-
-
isReadOnly() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database is in read-only mode.
-
-
isReadOnly(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether the designated column is definitely not writable.
-
-
isRestartOnShutdown() - Method in class org.hsqldb.server.Server
-
-
Retrieves whether this server restarts on shutdown.
-
-
isRowCount() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
 
-
isSameRM(XAResource) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
Stub.
-
-
isSearchable - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether the column's values can be used in a where clause.
-
-
isSearchable(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether the designated column can be used in a where clause.
-
-
isSecure() - Method in class org.hsqldb.server.HsqlSocketFactory
-
-
Retrieves whether this factory produces secure sockets.
-
-
isSecure() - Method in class org.hsqldb.server.HsqlSocketFactorySecure
-
-
Retrieves whether this factory produces secure sockets.
-
-
isShutdown() - Method in class org.hsqldb.lib.HsqlTaskQueue
-
 
-
isSigned - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether values in the column are signed numbers.
-
-
isSigned(int) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves whether values for the designated parameter can be signed numbers.
-
-
isSigned(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether values in the designated column are signed numbers.
-
-
isSilent() - Method in class org.hsqldb.server.Server
-
-
Retrieves whether silent mode operation was requested in - the server properties.
-
-
isSorting() - Method in class org.hsqldb.util.TableSorter
-
 
-
isStreamElement(String) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
isStreamElement(String) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
isStreamElement(String) - Method in class org.hsqldb.lib.FileUtil
-
 
-
isTls() - Method in class org.hsqldb.server.Server
-
-
Retrieves whether the use of secure sockets was requested in the - server properties.
-
-
isTrace() - Method in class org.hsqldb.server.Server
-
-
Retrieves whether JDBC trace messages are to go to System.out or the - DriverManger PrintStream/PrintWriter, if any.
-
-
isTwoPower(int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
returns true if log2 n is in the range (0, max)
-
-
isValid(int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Returns true if the connection has not been closed and is still valid.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCDataSource
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWrapperFor(Class<?>) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
-
-
isWritable - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Whether it is possible for a write on the column to succeed.
-
-
isWritable() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Retrieves the object's readability status.
-
-
isWritable(int) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Indicates whether it is possible for a write on the designated column to - succeed.
-
-
itemStateChanged(ItemEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
iterator() - Method in interface org.hsqldb.lib.Collection
-
 
-
iterator() - Method in class org.hsqldb.lib.HashSet
-
 
-
iterator() - Method in class org.hsqldb.lib.IntHashSet
-
 
-
iterator() - Method in interface org.hsqldb.lib.List
-
 
-
iterator() - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
Iterator<E> - Interface in org.hsqldb.lib
-
-
Interface for HyperSQL iterators.
-
-
- - - -

J

-
-
JaasAuthBean - Class in org.hsqldb.auth
-
-
Provides authentication and authorization (roles and initial schema) - according to JAAS modules configured by the runtime JAAS implementation.
-
-
JaasAuthBean() - Constructor for class org.hsqldb.auth.JaasAuthBean
-
 
-
JaasAuthBean.UPCallbackHandler - Class in org.hsqldb.auth
-
 
-
JDBC_MAJOR - Static variable in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
 
-
JDBC_MINOR - Static variable in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
 
-
JDBCArray - Class in org.hsqldb.jdbc
-
-
The mapping in the Java programming language for the SQL type - ARRAY.
-
-
JDBCArray(Object[], Type, Type, SessionInterface) - Constructor for class org.hsqldb.jdbc.JDBCArray
-
 
-
JDBCArrayBasic - Class in org.hsqldb.jdbc
-
-
The mapping in the Java programming language for the SQL type - ARRAY.
-
-
JDBCArrayBasic(Object[], Type) - Constructor for class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Public constructor to create an Array object from an Object[] and an - HSQLDB org.hsqldb.types.Type object.
-
-
JDBCBlob - Class in org.hsqldb.jdbc
-
-
The representation (mapping) in - the Java™ programming language of an SQL - BLOB value.
-
-
JDBCBlob(byte[]) - Constructor for class org.hsqldb.jdbc.JDBCBlob
-
-
Constructs a new JDBCBlob instance wrapping the given octet sequence.
-
-
JDBCBlobClient - Class in org.hsqldb.jdbc
-
-
A wrapper for HSQLDB BlobData objects.
-
-
JDBCBlobClient(SessionInterface, BlobDataID) - Constructor for class org.hsqldb.jdbc.JDBCBlobClient
-
 
-
JDBCBlobFile - Class in org.hsqldb.jdbc
-
-
A client-side file-based implementation of Blob.
-
-
JDBCBlobFile() - Constructor for class org.hsqldb.jdbc.JDBCBlobFile
-
-
Convenience constructor; equivalent to JDBCBlobFile(true);
-
-
JDBCBlobFile(boolean) - Constructor for class org.hsqldb.jdbc.JDBCBlobFile
-
-
Constructs a new instance backed by a File object created in response - to invoking File.createTempFile(TEMP_FILE_PREFIX,TEMP_FILE_SUFFIX)
-
-
JDBCBlobFile(File) - Constructor for class org.hsqldb.jdbc.JDBCBlobFile
-
-
Convenience constructor; equivalent to JDBCBlobFile(file, false);
-
-
JDBCBlobFile(File, boolean) - Constructor for class org.hsqldb.jdbc.JDBCBlobFile
-
-
Constructs a new instance backed by the given File object.
-
-
JDBCCallableStatement - Class in org.hsqldb.jdbc
-
-
The interface used to execute SQL stored procedures.
-
-
JDBCCallableStatement(JDBCConnection, String, int, int, int) - Constructor for class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Constructs a new JDBCCallableStatement with the specified connection and - result type.
-
-
JDBCClob - Class in org.hsqldb.jdbc
-
-
The mapping in the Java™ programming language for the SQL CLOB type.
-
-
JDBCClob(String) - Constructor for class org.hsqldb.jdbc.JDBCClob
-
-
Constructs a new, read-only JDBCClob object wrapping the given character - sequence.
-
-
JDBCClobClient - Class in org.hsqldb.jdbc
-
-
A wrapper for HSQLDB ClobData objects.
-
-
JDBCClobClient(SessionInterface, ClobDataID) - Constructor for class org.hsqldb.jdbc.JDBCClobClient
-
 
-
JDBCClobFile - Class in org.hsqldb.jdbc
-
-
A client-side file-based implementation of Clob.
-
-
JDBCClobFile() - Constructor for class org.hsqldb.jdbc.JDBCClobFile
-
-
Convenience constructor for JDBCClobFile((String)null).
-
-
JDBCClobFile(File) - Constructor for class org.hsqldb.jdbc.JDBCClobFile
-
-
Convenience constructor for JDBCClobFile(file,null).
-
-
JDBCClobFile(File, String) - Constructor for class org.hsqldb.jdbc.JDBCClobFile
-
-
Constructs a new JDBCClobFile instance backed by the given File object - using the given encoding to read and write file content.
-
-
JDBCClobFile(String) - Constructor for class org.hsqldb.jdbc.JDBCClobFile
-
-
Constructs a new JDBCClobFile instance backed by a File object - created by File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX), - using the given encoding to read and write file content.
-
-
JDBCColumnMetaData - Class in org.hsqldb.jdbc
-
-
Provides a site for holding the ResultSetMetaData for individual ResultSet - columns.
-
-
JDBCColumnMetaData() - Constructor for class org.hsqldb.jdbc.JDBCColumnMetaData
-
 
-
JDBCCommonDataSource - Class in org.hsqldb.jdbc
-
-
Common base for DataSource implementations.
-
-
JDBCCommonDataSource() - Constructor for class org.hsqldb.jdbc.JDBCCommonDataSource
-
 
-
jdbcCompliant() - Method in class org.hsqldb.jdbc.JDBCDriver
-
-
Reports whether this driver is a genuine JDBC Compliant™ driver.
-
-
JDBCConnection - Class in org.hsqldb.jdbc
-
-
A connection (session) with a specific - database.
-
-
JDBCConnection(JDBCConnection, JDBCConnectionEventListener) - Constructor for class org.hsqldb.jdbc.JDBCConnection
-
-
Constructor for use with connection pooling and XA.
-
-
JDBCConnection(HsqlProperties) - Constructor for class org.hsqldb.jdbc.JDBCConnection
-
-
Constructs a new external Connection to an HSQLDB - Database.
-
-
JDBCConnection(SessionInterface) - Constructor for class org.hsqldb.jdbc.JDBCConnection
-
-
Constructs an INTERNAL Connection, - using the specified SessionInterface.
-
-
JDBCConnectionEventListener - Interface in org.hsqldb.jdbc
-
 
-
JDBCDatabaseMetaData - Class in org.hsqldb.jdbc
-
-
Comprehensive information about the database as a whole.
-
-
JDBCDataSource - Class in org.hsqldb.jdbc
-
-
A factory for connections to the physical data source that this - DataSource object represents.
-
-
JDBCDataSource() - Constructor for class org.hsqldb.jdbc.JDBCDataSource
-
 
-
JDBCDataSourceFactory - Class in org.hsqldb.jdbc
-
-
A JNDI ObjectFactory for creating data sources supported by HyperSQL - JDBCDataSource for plain - connections for the end user.
-
-
JDBCDataSourceFactory() - Constructor for class org.hsqldb.jdbc.JDBCDataSourceFactory
-
 
-
JDBCDriver - Class in org.hsqldb.jdbc
-
-
Provides the java.sql.Driver interface implementation required by - the JDBC specification.
-
-
JDBCDriver() - Constructor for class org.hsqldb.jdbc.JDBCDriver
-
-
Default constructor
-
-
JDBCNClob - Class in org.hsqldb.jdbc
-
-
The mapping in the Java™ programming language - for the SQL NCLOB type.
-
-
JDBCNClob(String) - Constructor for class org.hsqldb.jdbc.JDBCNClob
-
 
-
JDBCParameterMetaData - Class in org.hsqldb.jdbc
-
-
An object that can be used to get information about the types - and properties for each parameter marker in a - PreparedStatement object.
-
-
JDBCPool - Class in org.hsqldb.jdbc
-
-
A fast connection pool.
-
-
JDBCPool() - Constructor for class org.hsqldb.jdbc.JDBCPool
-
-
Creates a connection pool with the maximum size of 8.
-
-
JDBCPool(int) - Constructor for class org.hsqldb.jdbc.JDBCPool
-
-
Creates a connection pool with the given maximum size.
-
-
JDBCPooledConnection - Class in org.hsqldb.jdbc.pool
-
-
An implementations of PooledConnection - for use by connection pooling software.
-
-
JDBCPooledConnection(JDBCConnection) - Constructor for class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
JDBCPooledDataSource - Class in org.hsqldb.jdbc.pool
-
-
A data source that implements ConnectionPoolDataSource.
-
-
JDBCPooledDataSource() - Constructor for class org.hsqldb.jdbc.pool.JDBCPooledDataSource
-
 
-
JDBCPreparedStatement - Class in org.hsqldb.jdbc
-
-
An object that represents a precompiled SQL statement.
-
-
JDBCResultSet - Class in org.hsqldb.jdbc
-
-
A table of data representing a database result set, which - is usually generated by executing a statement that queries the database.
-
-
JDBCResultSet(JDBCConnection, JDBCStatementBase, Result, ResultMetaData) - Constructor for class org.hsqldb.jdbc.JDBCResultSet
-
-
Constructs a new JDBCResultSet object using the specified - navigator and org.hsqldb.result.ResultMetaData.
-
-
JDBCResultSet(JDBCConnection, Result, ResultMetaData) - Constructor for class org.hsqldb.jdbc.JDBCResultSet
-
 
-
JDBCResultSetMetaData - Class in org.hsqldb.jdbc
-
-
An object that can be used to get information about the types - and properties of the columns in a ResultSet object.
-
-
JDBCRowId - Class in org.hsqldb.jdbc
-
-
The representation (mapping) in the Java programming language of an SQL ROWID - value.
-
-
JDBCRowId(byte[]) - Constructor for class org.hsqldb.jdbc.JDBCRowId
-
-
Constructs a new JDBCRowId instance wrapping the given octet sequence.
-
-
JDBCRowId(String) - Constructor for class org.hsqldb.jdbc.JDBCRowId
-
-
Constructs a new JDBCRowId instance whose internal octet sequence - is that represented by the given hexadecimal character sequence.
-
-
JDBCRowId(RowId) - Constructor for class org.hsqldb.jdbc.JDBCRowId
-
-
Constructs a new JDBCRowId instance whose internal octet sequence - is a copy of the octet sequence of the given RowId object.
-
-
JDBCSavepoint - Class in org.hsqldb.jdbc
-
-
The representation of a savepoint, which is a point within - the current transaction that can be referenced from the - Connection.rollback method.
-
-
JDBCSQLXML - Class in org.hsqldb.jdbc
-
-
The mapping in the JavaTM programming language for the SQL XML type.
-
-
JDBCSQLXML(Source) - Constructor for class org.hsqldb.jdbc.JDBCSQLXML
-
-
Constructs a new read-only JDBCSQLXML object from the given Source - object.
-
-
JDBCSQLXML.SAX2XMLStreamWriter - Class in org.hsqldb.jdbc
-
-
Writes to a XMLStreamWriter - from SAX events.
-
-
JDBCStatement - Class in org.hsqldb.jdbc
-
-
The object used for executing a static SQL statement - and returning the results it produces.
-
-
JDBCUtil - Class in org.hsqldb.jdbc
-
-
Provides driver constants and a gateway from internal HsqlExceptions to - external SQLExceptions.
-
-
JDBCUtil() - Constructor for class org.hsqldb.jdbc.JDBCUtil
-
 
-
JDBCXAConnection - Class in org.hsqldb.jdbc.pool
-
-
Subclass of JDBCPooledConnection implements the XAConnection interface.
-
-
JDBCXAConnection(JDBCXADataSource, JDBCConnection) - Constructor for class org.hsqldb.jdbc.pool.JDBCXAConnection
-
 
-
JDBCXAConnectionWrapper - Class in org.hsqldb.jdbc.pool
-
-
This is a wrapper class for JDBCConnection objects (not java.sql.XAConnection - objects).
-
-
JDBCXAConnectionWrapper(JDBCXAResource, JDBCXAConnection, JDBCConnection) - Constructor for class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
 
-
JDBCXADataSource - Class in org.hsqldb.jdbc.pool
-
-
Connection factory for JDBCXAConnections.
-
-
JDBCXADataSource() - Constructor for class org.hsqldb.jdbc.pool.JDBCXADataSource
-
 
-
JDBCXAResource - Class in org.hsqldb.jdbc.pool
-
-
Used by a global transaction service to control HSQLDB transactions.
-
-
JDBCXAResource(JDBCXADataSource, JDBCConnection) - Constructor for class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
Constructs a resource using the given data source and connection.
-
-
JDBCXID - Class in org.hsqldb.jdbc.pool
-
-
Implementation of Xid for tests.
-
-
JDBCXID(int, byte[], byte[]) - Constructor for class org.hsqldb.jdbc.pool.JDBCXID
-
 
-
- - - -

K

-
-
keyPressed(KeyEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
keyPressed(KeyEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
keyReleased(KeyEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
keyReleased(KeyEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
keySet() - Method in class org.hsqldb.lib.HashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
keySet() - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
keySet() - Method in interface org.hsqldb.lib.Map
-
 
-
keySet() - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
keySet() - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
keysToArray(int[]) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
keysToArray(int[]) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
keysToArray(int[]) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
keysToArray(int[]) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
keysToArray(long[]) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
keysToArray(long[]) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
keysToArray(long[]) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
keysToArray(long[]) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
keysToArray(T[]) - Method in class org.hsqldb.lib.HashMap
-
 
-
keysToArray(T[]) - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
keyTyped(KeyEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
keyTyped(KeyEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
KMPSearchAlgorithm - Class in org.hsqldb.lib
-
-
Implements the Knuth-Morris-Pratt string search algorithm for searching - streams or arrays of octets or characters.
-
-
- - - -

L

-
-
last() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the last row in - this ResultSet object.
-
-
lastIndexOf(Object) - Method in class org.hsqldb.lib.HsqlArrayList
-
 
-
lastIndexOf(Object) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
lastIndexOf(Object) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
LdapAuthBean - Class in org.hsqldb.auth
-
-
Authenticates to a HyperSQL catalog according to entries in a LDAP - database.
-
-
LdapAuthBean() - Constructor for class org.hsqldb.auth.LdapAuthBean
-
 
-
LdapAuthBeanTester - Class in org.hsqldb.auth
-
-
Tests the settings for LdapAuthBean.
-
-
LdapAuthBeanTester() - Constructor for class org.hsqldb.auth.LdapAuthBeanTester
-
 
-
length() - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Returns the number of bytes in the BLOB value - designated by this Blob object.
-
-
length() - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Returns the number of bytes in the BLOB value designated - by this Blob object.
-
-
length() - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Returns the number of bytes in the BLOB value - designated by this Blob object.
-
-
length() - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves the number of characters - in the CLOB value - designated by this Clob object.
-
-
length() - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves the number of characters in the CLOB value - designated by this Clob object.
-
-
length() - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves the number of characters - in the CLOB value - designated by this Clob object.
-
-
LEXICAL_COMPARATOR - Static variable in class org.hsqldb.util.TableSorter
-
 
-
libpath - Variable in class org.hsqldb.util.RCData
-
 
-
LineGroupReader - Class in org.hsqldb.lib
-
-
Uses a LineNumberReader and returns multiple consecutive lines which conform - to the specified group demarcation characteristics.
-
-
LineGroupReader(LineNumberReader) - Constructor for class org.hsqldb.lib.LineGroupReader
-
-
Default constructor for TestUtil usage.
-
-
LineGroupReader(LineNumberReader, String[]) - Constructor for class org.hsqldb.lib.LineGroupReader
-
-
Constructor for sections starting with specified strings.
-
-
LineReader - Class in org.hsqldb.lib
-
-
A converter for InputStream to return String objects using the given - charset for conversion.
-
-
LineReader(InputStream, Charset) - Constructor for class org.hsqldb.lib.LineReader
-
 
-
List<E> - Interface in org.hsqldb.lib
-
-
Interface for List collections.
-
-
LIST_MODE - Static variable in class org.hsqldb.lib.tar.TarReader
-
 
-
listing_format - org.hsqldb.lib.tar.RB
-
 
-
listLocalInetAddressNames() - Static method in class org.hsqldb.server.ServerConfiguration
-
-
Retrieves an array of Strings naming the distinct, known to be valid local - InetAddress names for this machine.
-
-
load() - Method in class org.hsqldb.util.DatabaseManagerSwing.DBMPrefs
-
 
-
locatorsUpdateCopy() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Indicates whether updates made to a LOB are made on a copy or directly - to the LOB.
-
-
lock() - Method in class org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
 
-
LockDummy() - Constructor for class org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
 
-
lockInterruptibly() - Method in class org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
 
-
log(Level, String) - Method in class org.hsqldb.lib.FrameworkLogger
-
 
-
log(Level, String, Throwable) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
Just like FrameworkLogger.log(Level, String), - but also logs a stack trace.
-
-
LOG_DETAIL - Static variable in class org.hsqldb.lib.SimpleLog
-
 
-
LOG_ERROR - Static variable in class org.hsqldb.lib.SimpleLog
-
 
-
LOG_NONE - Static variable in class org.hsqldb.lib.SimpleLog
-
 
-
LOG_NORMAL - Static variable in class org.hsqldb.lib.SimpleLog
-
 
-
LOG_RESULT - Static variable in class org.hsqldb.lib.SimpleLog
-
 
-
LOG_WARNING - Static variable in class org.hsqldb.lib.SimpleLog
-
 
-
logContext(int, String) - Method in class org.hsqldb.lib.SimpleLog
-
 
-
logContext(int, String, String, String) - Method in class org.hsqldb.lib.SimpleLog
-
 
-
logContext(Throwable, String, int) - Method in class org.hsqldb.lib.SimpleLog
-
 
-
logDetailEvent(String) - Method in interface org.hsqldb.lib.EventLogInterface
-
 
-
logInfoEvent(String) - Method in interface org.hsqldb.lib.EventLogInterface
-
 
-
logSevereEvent(String, Throwable) - Method in interface org.hsqldb.lib.EventLogInterface
-
 
-
logTypeNameEngine - Static variable in class org.hsqldb.lib.SimpleLog
-
 
-
logWarningEvent(String, Throwable) - Method in interface org.hsqldb.lib.EventLogInterface
-
 
-
LongDeque - Class in org.hsqldb.lib
-
-
A deque of long values.
-
-
LongDeque() - Constructor for class org.hsqldb.lib.LongDeque
-
 
-
LongDeque(int) - Constructor for class org.hsqldb.lib.LongDeque
-
 
-
longKey(Object) - Method in class org.hsqldb.lib.ObjectComparator.DefaultComparator
-
 
-
longKey(Object) - Method in class org.hsqldb.lib.ObjectComparator.IdentityComparator
-
 
-
longKey(T) - Method in interface org.hsqldb.lib.ObjectComparator
-
 
-
LongKeyHashMap<V> - Class in org.hsqldb.lib
-
-
A Map of long primitives to Object values.
-
-
LongKeyHashMap() - Constructor for class org.hsqldb.lib.LongKeyHashMap
-
 
-
LongKeyHashMap(int) - Constructor for class org.hsqldb.lib.LongKeyHashMap
-
 
-
LongKeyIntValueHashMap - Class in org.hsqldb.lib
-
-
A Map of long primitives to int primitives.
-
-
LongKeyIntValueHashMap() - Constructor for class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
LongKeyIntValueHashMap(boolean) - Constructor for class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
LongKeyIntValueHashMap(int) - Constructor for class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
LongKeyLongValueHashMap - Class in org.hsqldb.lib
-
-
A Map of long primitives to to long primitive.
-
-
LongKeyLongValueHashMap() - Constructor for class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
LongKeyLongValueHashMap(boolean) - Constructor for class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
LongKeyLongValueHashMap(int) - Constructor for class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
LongLookup - Interface in org.hsqldb.lib
-
-
Interface for long to long lookup.
-
-
LongValueHashMap<K> - Class in org.hsqldb.lib
-
-
A Map of Object keys to long primitives.
-
-
LongValueHashMap() - Constructor for class org.hsqldb.lib.LongValueHashMap
-
 
-
LongValueHashMap(int) - Constructor for class org.hsqldb.lib.LongValueHashMap
-
 
-
LongValueHashMap(int, ObjectComparator) - Constructor for class org.hsqldb.lib.LongValueHashMap
-
 
-
lookup(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
lookup(int) - Method in interface org.hsqldb.lib.IntLookup
-
 
-
lookup(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
lookup(int, int) - Method in interface org.hsqldb.lib.IntLookup
-
 
-
lookup(long) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
lookup(long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
lookup(long) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
lookup(long, long) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
lookup(long, long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
lookup(long, long) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
lookupFirstGreaterEqual(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
LS - Static variable in exception org.hsqldb.lib.AppendableException
-
 
-
LS - Static variable in class org.hsqldb.lib.BasicTextJdkLogFormatter
-
 
-
LS - Static variable in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
LS - Static variable in class org.hsqldb.util.MainInvoker
-
 
-
- - - -

M

-
-
magic - org.hsqldb.lib.tar.TarHeaderField
-
 
-
main() - Method in class org.hsqldb.util.DatabaseManager
-
 
-
main() - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
main(String[]) - Static method in class org.hsqldb.auth.LdapAuthBeanTester
-
-
Run this method to try and test configuration settings for LdapAuthBeans, - or to troubleshoot.
-
-
main(String[]) - Static method in class org.hsqldb.lib.tar.DbBackupMain
-
-
Command line invocation to create, examine, or extract HSQLDB database - backup tar archives.
-
-
main(String[]) - Static method in class org.hsqldb.lib.tar.TarGeneratorMain
-
-
Creates specified tar file to contain specified files, or stdin, using - default blocks-per-record and replacing tar file if it already exists.
-
-
main(String[]) - Static method in class org.hsqldb.lib.tar.TarReaderMain
-
-
Reads a specified tar file or stdin in order to either list or extract - the file tar entries, depending on the first argument being "t" or "x", - using default read buffer blocks.
-
-
main(String[]) - Static method in class org.hsqldb.server.OdbcUtil
-
 
-
main(String[]) - Static method in class org.hsqldb.server.Server
-
-
Creates and starts a new Server.
-
-
main(String[]) - Static method in class org.hsqldb.server.ServerAcl
-
-
Utility method that allows interactive testing of individual ACL records, - as well as the net effect of the ACL record list.
-
-
main(String[]) - Static method in class org.hsqldb.server.WebServer
-
-
Starts a new WebServer.
-
-
main(String[]) - Static method in class org.hsqldb.util.CodeSwitcher
-
 
-
main(String[]) - Static method in class org.hsqldb.util.DatabaseManager
-
-
Run with --help switch for usage instructions.
-
-
main(String[]) - Static method in class org.hsqldb.util.DatabaseManagerSwing
-
-
Run with --help switch for usage instructions.
-
-
main(String[]) - Static method in class org.hsqldb.util.MainInvoker
-
-
Invokes the static main(String[]) method from each specified class.
-
-
main(String[]) - Static method in class org.hsqldb.util.Transfer
-
 
-
MainInvoker - Class in org.hsqldb.util
-
-
Invokes the static main(String[]) method from each class specified.
-
-
MainInvoker() - Constructor for class org.hsqldb.util.MainInvoker
-
 
-
makeDirectories(String) - Static method in class org.hsqldb.lib.FileUtil
-
 
-
makeParentDirectories(File) - Method in class org.hsqldb.lib.FileUtil
-
 
-
Map<K,​V> - Interface in org.hsqldb.lib
-
-
Interface for collections of mapped key - value pairs.
-
-
Map.Entry<K,​V> - Interface in org.hsqldb.lib
-
-
Interface for a key - value pair.
-
-
MapEntry<K,​V> - Class in org.hsqldb.lib
-
-
A key - value pair.
-
-
mark() - Method in class org.hsqldb.lib.StopWatch
-
 
-
mark(int) - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
markSupported() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
missing_supp_path - org.hsqldb.lib.tar.RB
-
 
-
mode - org.hsqldb.lib.tar.TarHeaderField
-
 
-
modelIndex(int) - Method in class org.hsqldb.util.TableSorter
-
 
-
modified_property - org.hsqldb.lib.tar.RB
-
 
-
mouseClicked(MouseEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
mouseEntered(MouseEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
mouseExited(MouseEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
mousePressed(MouseEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
mouseReleased(MouseEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
move_work_file - org.hsqldb.lib.tar.RB
-
 
-
moveToCurrentRow() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the remembered cursor position, usually the - current row.
-
-
moveToInsertRow() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the insert row.
-
-
mtime - org.hsqldb.lib.tar.TarHeaderField
-
 
-
MultiValueHashMap<K,​V> - Class in org.hsqldb.lib
-
-
A Map of Object keys to Object values which stores multiple values per - key.
-
-
MultiValueHashMap() - Constructor for class org.hsqldb.lib.MultiValueHashMap
-
 
-
MultiValueHashMap(int) - Constructor for class org.hsqldb.lib.MultiValueHashMap
-
 
-
MultiValueHashMap(int, ObjectComparator) - Constructor for class org.hsqldb.lib.MultiValueHashMap
-
 
-
- - - -

N

-
-
name - org.hsqldb.lib.tar.TarHeaderField
-
 
-
nativeSQL(String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Converts the given SQL statement into the system's native SQL grammar.
-
-
newCondition() - Method in class org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
 
-
newDefaultProperties(int) - Static method in class org.hsqldb.server.ServerConfiguration
-
-
Retrieves a new default properties object for a server of the specified - protocol
-
-
newDiscardFileName(String) - Static method in class org.hsqldb.lib.FileUtil
-
 
-
newEmptyResultSet() - Static method in class org.hsqldb.jdbc.JDBCResultSet
-
 
-
newJDBCResultSet(Result, ResultMetaData) - Static method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Factory method returns a new JDBCResultSet object for - use with user defined functions that return a ResultSet object.
-
-
newThread(Runnable) - Method in class org.hsqldb.lib.HsqlTimer
-
-
Default ThreadFactory implementation.
-
-
newThread(Runnable) - Method in interface org.hsqldb.lib.ThreadFactory
-
 
-
next() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor froward one row from its current position.
-
-
next() - Method in class org.hsqldb.lib.FilteredIterator
-
 
-
next() - Method in interface org.hsqldb.lib.Iterator
-
 
-
next() - Method in class org.hsqldb.lib.WrapperIterator
-
-
Returns the next element.
-
-
nextInt() - Method in class org.hsqldb.lib.FilteredIterator
-
 
-
nextInt() - Method in interface org.hsqldb.lib.Iterator
-
 
-
nextInt() - Method in class org.hsqldb.lib.WrapperIterator
-
 
-
nextLong() - Method in class org.hsqldb.lib.FilteredIterator
-
 
-
nextLong() - Method in interface org.hsqldb.lib.Iterator
-
 
-
nextLong() - Method in class org.hsqldb.lib.WrapperIterator
-
 
-
NO_COMPRESSION - Static variable in interface org.hsqldb.lib.tar.TarFileOutputStream.Compression
-
 
-
no_parent_dir - org.hsqldb.lib.tar.RB
-
 
-
NON_ASCII_MIN - Static variable in class org.hsqldb.lib.AsciiInputStream
-
-
is 2^7 (128)
-
-
NON_ASCII_MIN - Static variable in class org.hsqldb.lib.AsciiOutputStream
-
-
is 2^7 (128)
-
-
NON_ASCII_REPLACEMENT - Static variable in class org.hsqldb.lib.AsciiInputStream
-
-
is '?'
-
-
NON_ASCII_REPLACEMENT - Static variable in class org.hsqldb.lib.AsciiOutputStream
-
-
is '�' (65533), the Unicode replacement character.
-
-
nonfile_entry - org.hsqldb.lib.tar.RB
-
 
-
NOOP_BEHAVIOR - Static variable in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
NOOP_BEHAVIOR - Static variable in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
NOT_SORTED - Static variable in class org.hsqldb.util.TableSorter
-
 
-
Notified - Interface in org.hsqldb.lib
-
 
-
notify(int) - Method in interface org.hsqldb.lib.Notified
-
 
-
notify(int) - Method in class org.hsqldb.server.Server
-
-
This is called from org.hsqldb.DatabaseManager when a database is - shutdown.
-
-
nullArgument() - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
nullPlusNonNullIsNull() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports concatenations between - NULL and non-NULL values being - NULL.
-
-
nullsAreSortedAtEnd() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether NULL values are sorted at the end regardless of - sort order.
-
-
nullsAreSortedAtStart() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether NULL values are sorted at the start regardless - of sort order.
-
-
nullsAreSortedHigh() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether NULL values are sorted high.
-
-
nullsAreSortedLow() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether NULL values are sorted low.
-
-
- - - -

O

-
-
ObjectComparator<T> - Interface in org.hsqldb.lib
-
-
Interface for equality comparison.
-
-
ObjectComparator.DefaultComparator - Class in org.hsqldb.lib
-
-
Comparator that uses the equals and hash code methods of Objects.
-
-
ObjectComparator.IdentityComparator - Class in org.hsqldb.lib
-
-
Comparator that uses identity for Object equality.
-
-
OdbcUtil - Class in org.hsqldb.server
-
-
Static values and methods to facilitate servicing ODBC clients.
-
-
OdbcUtil() - Constructor for class org.hsqldb.server.OdbcUtil
-
 
-
offer(E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
offerFirst(E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
offerLast(E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
openInputStreamElement(String) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
openInputStreamElement(String) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
openInputStreamElement(String) - Method in class org.hsqldb.lib.FileUtil
-
 
-
openOutputStreamElement(String) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
openOutputStreamElement(String) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
openOutputStreamElement(String) - Method in class org.hsqldb.lib.FileUtil
-
 
-
openOutputStreamElementAppend(String) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
openOutputStreamElementAppend(String) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
openOutputStreamElementAppend(String) - Method in class org.hsqldb.lib.FileUtil
-
 
-
orBooleanArray(boolean[], boolean[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
OrderedHashMap<K,​V> - Class in org.hsqldb.lib
-
-
A Map which maintains the insertion order of the key/value pairs and allows - access by index.
-
-
OrderedHashMap() - Constructor for class org.hsqldb.lib.OrderedHashMap
-
 
-
OrderedHashMap(int) - Constructor for class org.hsqldb.lib.OrderedHashMap
-
 
-
OrderedHashSet<E> - Class in org.hsqldb.lib
-
-
A list which is also a Set which maintains the inserted order of elements and - allows access by index.
-
-
OrderedHashSet() - Constructor for class org.hsqldb.lib.OrderedHashSet
-
 
-
OrderedHashSet(int) - Constructor for class org.hsqldb.lib.OrderedHashSet
-
 
-
OrderedHashSet(int, ObjectComparator<E>) - Constructor for class org.hsqldb.lib.OrderedHashSet
-
 
-
OrderedHashSet(Object[]) - Constructor for class org.hsqldb.lib.OrderedHashSet
-
 
-
OrderedIntHashSet - Class in org.hsqldb.lib
-
-
A list which is also a set of int primitives which maintains the insertion - order of the elements and allows access by index.
-
-
OrderedIntHashSet() - Constructor for class org.hsqldb.lib.OrderedIntHashSet
-
 
-
OrderedIntHashSet(int) - Constructor for class org.hsqldb.lib.OrderedIntHashSet
-
 
-
OrderedIntHashSet(int[]) - Constructor for class org.hsqldb.lib.OrderedIntHashSet
-
 
-
OrderedIntHashSet(int[], int[]) - Constructor for class org.hsqldb.lib.OrderedIntHashSet
-
 
-
OrderedIntKeyHashMap<V> - Class in org.hsqldb.lib
-
-
A Map of int primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index.
-
-
OrderedIntKeyHashMap() - Constructor for class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
OrderedIntKeyHashMap(int) - Constructor for class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
OrderedLongHashSet - Class in org.hsqldb.lib
-
-
A list which is also a set of long primitives which maintains the insertion - order of the elements and allows access by index.
-
-
OrderedLongHashSet() - Constructor for class org.hsqldb.lib.OrderedLongHashSet
-
 
-
OrderedLongHashSet(int) - Constructor for class org.hsqldb.lib.OrderedLongHashSet
-
 
-
OrderedLongKeyHashMap<V> - Class in org.hsqldb.lib
-
-
A Map of long primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index.
-
-
OrderedLongKeyHashMap() - Constructor for class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
OrderedLongKeyHashMap(int) - Constructor for class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
OrderedLongKeyHashMap(int, boolean) - Constructor for class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
org.hsqldb - module org.hsqldb
-
 
-
org.hsqldb.auth - package org.hsqldb.auth
-
-
Contains the HyperSQL utility classes for managing external user authentication.
-
-
org.hsqldb.jdbc - package org.hsqldb.jdbc
-
-
Contains the HyperSQL JDBC Driver, and other classes providing JDBC - functionality and support.
-
-
org.hsqldb.jdbc.pool - package org.hsqldb.jdbc.pool
-
-
Contains classes for connection pooling and distributed XA connections.
-
-
org.hsqldb.lib - package org.hsqldb.lib
-
-
Contains shared classes used by other HyperSQL classes.
-
-
org.hsqldb.lib.tar - package org.hsqldb.lib.tar
-
-
Contains the DbBackupMain class, for offline backing up HyperSQL databases.
-
-
org.hsqldb.server - package org.hsqldb.server
-
-
Contains the HyperSQL network listener classes.
-
-
org.hsqldb.trigger - package org.hsqldb.trigger
-
-
Contains the Trigger interface for Java language database triggers.
-
-
org.hsqldb.util - package org.hsqldb.util
-
-
Contains the HyperSQL utility classes.
-
-
othersDeletesAreVisible(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether deletes made by others are visible.
-
-
othersInsertsAreVisible(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether inserts made by others are visible.
-
-
othersUpdatesAreVisible(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether updates made by others are visible.
-
-
outOfRangeArgument() - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
outOfRangeArgument(String) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
OVERWRITE_MODE - Static variable in class org.hsqldb.lib.tar.TarReader
-
-
OVERWRITE_MODE is just EXTRACT_MODE where we will silently overwrite - existing files upon extraction.
-
-
ownDeletesAreVisible(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a result set's own deletes are visible.
-
-
ownInsertsAreVisible(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a result set's own inserts are visible.
-
-
ownUpdatesAreVisible(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether for the given type of ResultSet object, - the result set's own updates are visible.
-
-
- - - -

P

-
-
pad_block_write - org.hsqldb.lib.tar.RB
-
 
-
padCurrentBlock() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Rounds out the current block to the next block boundary.
-
-
parent_create_fail - org.hsqldb.lib.tar.RB
-
 
-
parent_not_dir - org.hsqldb.lib.tar.RB
-
 
-
password - Variable in class org.hsqldb.util.RCData
-
 
-
peek() - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
peek() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
peek() - Method in interface org.hsqldb.lib.HsqlHeap
-
-
Retrieves the least element from this Heap, without removing it.
-
-
peekFirst() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
peekLast() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
permitAccess(byte[]) - Method in class org.hsqldb.server.ServerAcl
-
 
-
permitAccess(String) - Method in class org.hsqldb.server.ServerAcl
-
-
Uses system network libraries to resolve the given String to an IP addr, - then determine whether this address is permitted or denied.
-
-
PgType - Class in org.hsqldb.server
-
-
Postgres types.
-
-
pif_data_toobig - org.hsqldb.lib.tar.RB
-
 
-
pif_malformat - org.hsqldb.lib.tar.RB
-
 
-
pif_malformat_size - org.hsqldb.lib.tar.RB
-
 
-
pif_toobig - org.hsqldb.lib.tar.RB
-
 
-
pif_unknown_datasize - org.hsqldb.lib.tar.RB
-
 
-
PIFData - Class in org.hsqldb.lib.tar
-
-
Pax Interchange Format object constituted from an Input Stream.
-
-
PIFData(InputStream) - Constructor for class org.hsqldb.lib.tar.PIFData
-
 
-
PIFGenerator - Class in org.hsqldb.lib.tar
-
-
Encapsulates Pax Interchange Format key-value pairs.
-
-
PIFGenerator(int) - Constructor for class org.hsqldb.lib.tar.PIFGenerator
-
-
Construct a PIFGenerator object for a 'g' record.
-
-
PIFGenerator(File) - Constructor for class org.hsqldb.lib.tar.PIFGenerator
-
-
Construct a PIFGenerator object for a 'x' record.
-
-
poll() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
pollFirst() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
pollLast() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
pop() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
position(byte[], long) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Retrieves the byte position at which the specified byte array - pattern begins within the BLOB - value that this Blob object represents.
-
-
position(byte[], long) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Retrieves the byte position at which the specified byte array - pattern begins within the BLOB value that - this Blob object represents.
-
-
position(byte[], long) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Retrieves the byte position at which the specified byte array - pattern begins within the BLOB - value that this Blob object represents.
-
-
position(char[], long) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves the character position at which the specified char[] - pattern appears in the CLOB value - represented by this Clob object.
-
-
position(String, long) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object.
-
-
position(String, long) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object.
-
-
position(String, long) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object.
-
-
position(Blob, long) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Retrieves the byte position in the BLOB value - designated by this Blob object at which - pattern begins.
-
-
position(Blob, long) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Retrieves the byte position in the BLOB value designated - by this Blob object at which pattern begins.
-
-
position(Blob, long) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Retrieves the byte position in the BLOB value - designated by this Blob object at which - pattern begins.
-
-
position(Clob, long) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object.
-
-
position(Clob, long) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object.
-
-
position(Clob, long) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object.
-
-
posSubst(String, String[], int) - Method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
-
Replaces positional substitution patterns of the form %{\d} with - corresponding element of the given subs array.
-
-
precision - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's value's number of decimal digits.
-
-
prefix - org.hsqldb.lib.tar.TarHeaderField
-
 
-
prefsFile - Variable in class org.hsqldb.util.DatabaseManagerSwing.DBMPrefs
-
 
-
prepare(Xid) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
Vote on whether to commit the global transaction.
-
-
prepareCall(String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a CallableStatement object for calling - database stored procedures.
-
-
prepareCall(String, int, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a CallableStatement object that will generate - ResultSet objects with the given type and concurrency.
-
-
prepareCall(String, int, int, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a CallableStatement object that will generate - ResultSet objects with the given type and concurrency.
-
-
prepareStatement(String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a PreparedStatement object for sending - parameterized SQL statements to the database.
-
-
prepareStatement(String, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a default PreparedStatement object that has - the capability to retrieve auto-generated keys.
-
-
prepareStatement(String, int[]) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a default PreparedStatement object capable - of returning the auto-generated keys designated by the given array.
-
-
prepareStatement(String, int, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a PreparedStatement object that will generate - ResultSet objects with the given type and concurrency.
-
-
prepareStatement(String, int, int, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a PreparedStatement object that will generate - ResultSet objects with the given type, concurrency, - and holdability.
-
-
prepareStatement(String, String[]) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a default PreparedStatement object capable - of returning the auto-generated keys designated by the given array.
-
-
prepareThis() - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
 
-
previous() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor to the previous row in this - ResultSet object.
-
-
PrimitiveIterator<E> - Interface in org.hsqldb.lib
-
-
Marker interface for iterators supporting nextInt or nextLong methods.
-
-
privlog(Level, String, Throwable, int, Class) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
The "priv" prefix is historical.
-
-
processingInstruction(String, String) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of a processing instruction.
-
-
projectMap(int[], int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
projectRow(int[], int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
projectRow(Object[], int[], Object[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Copies some elements of row into newRow by using columnMap as - the list of indexes into row.
-
-
projectRowReverse(Object[], int[], Object[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
As above but copies in reverse direction.
-
-
push(E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
put(int, int) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
put(int, long) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
put(int, V) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
put(int, V) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
put(long, int) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
put(long, long) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
put(long, V) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
put(long, V) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
put(Integer, Integer) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
put(Integer, Long) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
put(Integer, V) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
put(Integer, V) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
put(Long, Integer) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
put(Long, Long) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
put(Long, V) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
put(Long, V) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
put(Object, int) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
put(Object, long) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
put(K, V) - Method in class org.hsqldb.lib.HashMap
-
 
-
put(K, V) - Method in interface org.hsqldb.lib.Map
-
 
-
put(K, V) - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
putAll(IntKeyHashMap) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
putAll(IntKeyHashMap) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
putAll(IntKeyIntValueHashMap) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
putAll(IntKeyIntValueHashMap) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
putAll(IntKeyIntValueHashMap) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
putAll(IntValueHashMap) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
putAll(LongKeyHashMap) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
putAll(LongKeyHashMap) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
putAll(LongKeyIntValueHashMap) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
putAll(LongValueHashMap) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
putAll(Map<? extends Integer, ? extends Integer>) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
putAll(Map<? extends Integer, ? extends Long>) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
putAll(Map<? extends Integer, ? extends V>) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
putAll(Map<? extends Integer, ? extends V>) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
putAll(Map<? extends Long, ? extends Integer>) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
putAll(Map<? extends Long, ? extends Long>) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
putAll(Map<? extends Long, ? extends V>) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
putAll(Map<? extends Long, ? extends V>) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
putAll(Map<? extends K, ? extends Integer>) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
putAll(Map<? extends K, ? extends V>) - Method in class org.hsqldb.lib.HashMap
-
 
-
putAll(Map<? extends K, ? extends V>) - Method in interface org.hsqldb.lib.Map
-
 
-
putAll(Map<? extends K, ? extends V>) - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
putAll(MultiValueHashMap<K, V>) - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
putPropertiesFromFile(String) - Method in class org.hsqldb.server.Server
-
-
Attempts to put properties from the file - with the specified path.
-
-
putPropertiesFromFile(String, String) - Method in class org.hsqldb.server.Server
-
-
Attempts to put properties from the file with given extension.
-
-
putPropertiesFromString(String) - Method in class org.hsqldb.server.Server
-
-
Puts properties from the supplied string argument.
-
-
- - - -

Q

-
-
queueEntry(File) - Method in class org.hsqldb.lib.tar.TarGenerator
-
 
-
queueEntry(String, File) - Method in class org.hsqldb.lib.tar.TarGenerator
-
 
-
queueEntry(String, InputStream, int) - Method in class org.hsqldb.lib.tar.TarGenerator
-
-
This method does not support Pax Interchange Format, nor data sizes - greater than 2G.
-
-
queueEntry(String, InputStreamInterface) - Method in class org.hsqldb.lib.tar.TarGenerator
-
 
-
- - - -

R

-
-
rank(int[], int, int, int, int, int) - Static method in class org.hsqldb.lib.ArrayCounter
-
-
With an unsorted int[] array and with target a positive integer in the - range (1,array.length), finds the value in the range (start,limit) of the - largest element (rank) where the count of all smaller elements in that - range is less than or equals target.
-
-
RB - Enum in org.hsqldb.lib.tar
-
-
Resource Bundle for Tar classes
-
-
RCData - Class in org.hsqldb.util
-
-
Manages all the details we need to connect up to JDBC database(s), - in a declarative way.
-
-
RCData(File, String) - Constructor for class org.hsqldb.util.RCData
-
-
Creates a RCDataObject by looking up the given key in the - given authentication file.
-
-
RCData(String, String, String, String, String, String, String) - Constructor for class org.hsqldb.util.RCData
-
-
Convenience constructor for backward compatibility.
-
-
RCData(String, String, String, String, String, String, String, String) - Constructor for class org.hsqldb.util.RCData
-
-
Wrapper for unset Transaction Isolation.
-
-
RCData(String, String, String, String, String, String, String, String, String) - Constructor for class org.hsqldb.util.RCData
-
-
Creates a new RCData object.
-
-
read() - Method in class org.hsqldb.lib.AsciiInputStream
-
-
Reads the next byte of data from the input stream.
-
-
read() - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
read() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
read() - Method in interface org.hsqldb.lib.InputStreamInterface
-
 
-
read() - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
read() - Method in class org.hsqldb.lib.ReaderInputStream
-
 
-
read() - Method in class org.hsqldb.lib.StringInputStream
-
 
-
read() - Method in class org.hsqldb.lib.tar.TarReader
-
 
-
read(byte[]) - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
read(byte[]) - Method in interface org.hsqldb.lib.InputStreamInterface
-
 
-
read(byte[]) - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
read(byte[], int, int) - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
read(byte[], int, int) - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
read(byte[], int, int) - Method in interface org.hsqldb.lib.InputStreamInterface
-
 
-
read(byte[], int, int) - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
read_denied - org.hsqldb.lib.tar.RB
-
 
-
read_lt_1 - org.hsqldb.lib.tar.RB
-
 
-
readBlock() - Method in class org.hsqldb.lib.tar.TarFileInputStream
-
-
readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file.
-
-
readBlocks(int) - Method in class org.hsqldb.lib.tar.TarFileInputStream
-
-
readBlocks(int) is the method that USERS of this class should use to - read file data from the tar file.
-
-
readBoolean() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readByte() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readChar() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readDouble() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
ReaderInputStream - Class in org.hsqldb.lib
-
-
This class is an part implementation of DataInput.
-
-
ReaderInputStream(Reader) - Constructor for class org.hsqldb.lib.ReaderInputStream
-
 
-
readFloat() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readFully(byte[]) - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readFully(byte[], int, int) - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readInt() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readLine() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readLine() - Method in class org.hsqldb.lib.LineReader
-
 
-
readLine(InputStream, OutputStream) - Static method in class org.hsqldb.lib.InOutUtil
-
-
Implementation only supports unix line-end format and is suitable for - processing HTTP and other network protocol communications.
-
-
readLock() - Method in class org.hsqldb.lib.ReadWriteLockDummy
-
 
-
readLong() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readNextHeaderBlock() - Method in class org.hsqldb.lib.tar.TarFileInputStream
-
-
readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file.
-
-
readShort() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readUnsignedByte() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readUnsignedShort() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readUTF() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
readUTF(byte[], int, int) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
readUTF(byte[], int, int, char[]) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
ReadWriteLockDummy - Class in org.hsqldb.lib
-
 
-
ReadWriteLockDummy() - Constructor for class org.hsqldb.lib.ReadWriteLockDummy
-
 
-
ReadWriteLockDummy.LockDummy - Class in org.hsqldb.lib
-
 
-
recover(int) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
Obtain a list of Xids of the current resource manager for - XAResources currently in the 'prepared' * state.
-
-
RefCapablePropertyResourceBundle - Class in org.hsqldb.lib
-
-
Just like PropertyResourceBundle, except keys mapped to nothing in the - properties file will load the final String value from a text file.
-
-
RefCapableRBInterface - Interface in org.hsqldb.lib
-
 
-
refreshRow() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Refreshes the current row with its most recent value in - the database.
-
-
registerOutParameter(int, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the OUT parameter in ordinal position - parameterIndex to the JDBC type - sqlType.
-
-
registerOutParameter(int, int, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the parameter in ordinal position - parameterIndex to be of JDBC type - sqlType.
-
-
registerOutParameter(int, int, String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the designated output parameter.
-
-
registerOutParameter(int, SQLType) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the OUT parameter in ordinal position - parameterIndex to the JDBC type - sqlType.
-
-
registerOutParameter(int, SQLType, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the parameter in ordinal position - parameterIndex to be of JDBC type - sqlType.
-
-
registerOutParameter(int, SQLType, String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the designated output parameter.
-
-
registerOutParameter(String, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the OUT parameter named - parameterName to the JDBC type - sqlType.
-
-
registerOutParameter(String, int, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the parameter named - parameterName to be of JDBC type - sqlType.
-
-
registerOutParameter(String, int, String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the designated output parameter.
-
-
registerOutParameter(String, SQLType) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the OUT parameter named - parameterName to the JDBC type - sqlType.
-
-
registerOutParameter(String, SQLType, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the parameter named - parameterName to be of JDBC type - sqlType.
-
-
registerOutParameter(String, SQLType, String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Registers the designated output parameter.
-
-
relative(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Moves the cursor a relative number of rows, either positive or negative.
-
-
release() - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
-
Force close the userConnection, and connection, no close event is fired.
-
-
releaseSavepoint(Savepoint) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Removes the specified Savepoint (JDBC4 Clarification:) and subsequent Savepoint objects from the current - transaction.
-
-
remove() - Method in class org.hsqldb.lib.FilteredIterator
-
 
-
remove() - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
remove() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
remove() - Method in interface org.hsqldb.lib.HsqlHeap
-
-
Retrieves the least element from this Heap, removing it in the process.
-
-
remove() - Method in interface org.hsqldb.lib.Iterator
-
 
-
remove() - Method in class org.hsqldb.lib.WrapperIterator
-
 
-
remove(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
remove(int) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Removes and returns the element at given position
-
-
remove(int) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
remove(int) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
remove(int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
remove(int) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
remove(int) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
remove(int) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
remove(int) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
remove(int) - Method in interface org.hsqldb.lib.List
-
 
-
remove(int) - Method in class org.hsqldb.lib.LongDeque
-
 
-
remove(int) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
remove(int) - Method in class org.hsqldb.lib.OrderedIntHashSet
-
 
-
remove(int) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
remove(long) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
remove(long) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
remove(long) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
remove(long) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
remove(long) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
remove(Object) - Method in interface org.hsqldb.lib.Collection
-
 
-
remove(Object) - Method in class org.hsqldb.lib.HashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.HashSet
-
-
returns true if removed
-
-
remove(Object) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
remove(Object) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
remove(Object) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
remove(Object) - Method in interface org.hsqldb.lib.Map
-
 
-
remove(Object) - Method in class org.hsqldb.lib.MultiValueHashMap
-
-
Removes all values associated with the key.
-
-
remove(Object) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
remove(Object) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
remove(Object) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
remove(Object, Object) - Method in class org.hsqldb.lib.HashMap
-
-
Removes the spacific key, value pair.
-
-
remove(Object, Object) - Method in class org.hsqldb.lib.MultiValueHashMap
-
-
Removes the spacific value associated with the key.
-
-
removeAll() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
removeAll() - Method in class org.hsqldb.lib.IntIndex
-
 
-
removeAll(E[]) - Method in class org.hsqldb.lib.HashSet
-
-
returns true if all were removed
-
-
removeAll(Collection) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
removeAll(Collection<?>) - Method in class org.hsqldb.lib.HashSet
-
-
returns true if all were removed
-
-
removeAll(Collection<?>) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
removeConnectionEventListener(ConnectionEventListener) - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
removeElement(String) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
removeElement(String) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
removeElement(String) - Method in class org.hsqldb.lib.FileUtil
-
 
-
removeEntry(int) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
removeEntry(int) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
removeEntry(int) - Method in class org.hsqldb.lib.OrderedIntHashSet
-
 
-
removeEntry(int) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
removeEntry(int) - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
removeEntry(int) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
removeFirst() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
removeFirst() - Method in class org.hsqldb.lib.LongDeque
-
 
-
removeFirstConsecutiveKeys(int, int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
removeFirstOccurrence(Object) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
removeKey(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Removes the (unique) key and its value.
-
-
removeLast() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
removeLast() - Method in class org.hsqldb.lib.LongDeque
-
 
-
removeLastOccurrence(Object) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
removeRange(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
removeRange(int, int) - Method in class org.hsqldb.lib.IntIndex
-
 
-
removeResource(Xid) - Method in class org.hsqldb.jdbc.pool.JDBCXADataSource
-
 
-
removeStatementEventListener(StatementEventListener) - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
 
-
renameElement(String, String) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
renameElement(String, String) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
renameElement(String, String) - Method in class org.hsqldb.lib.FileUtil
-
 
-
renameElementOrCopy(String, String, EventLogInterface) - Method in interface org.hsqldb.lib.FileAccess
-
 
-
renameElementOrCopy(String, String, EventLogInterface) - Method in class org.hsqldb.lib.FileAccessRes
-
 
-
renameElementOrCopy(String, String, EventLogInterface) - Method in class org.hsqldb.lib.FileUtil
-
 
-
reorderMaps(int[], int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
 
-
report() - Static method in class org.hsqldb.lib.FrameworkLogger
-
-
Utility method for integrators.
-
-
reset() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Resets this connection so it can be used again.
-
-
reset() - Method in class org.hsqldb.jdbc.pool.JDBCPooledConnection
-
-
Force close the userConnection, no close event is fired.
-
-
reset() - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
reset() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Resets the count field of this output stream to zero, so that - all currently accumulated data is effectively discarded.
-
-
reset() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Resets the count field of this writer to zero, so that all - currently accumulated output is effectively discarded.
-
-
reset() - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
reset() - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
reset(byte[]) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
reset(char[]) - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
reset(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
resizeArray(Object, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns a new array of given size, containing as many elements of the - original array as it can hold.
-
-
resizeArrayIfDifferent(Object, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns the given array if newsize is the same as existing.
-
-
resourceKeyFor(Enum<?>) - Static method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
restart() - Method in class org.hsqldb.lib.HsqlTaskQueue
-
 
-
restart() - Method in class org.hsqldb.lib.HsqlTimer
-
-
(Re)starts background processing of the task queue.
-
-
result - Variable in class org.hsqldb.jdbc.JDBCResultSet
-
-
The underlying result.
-
-
retainAll(Collection) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
retainAll(Collection<?>) - Method in class org.hsqldb.lib.HashSet
-
 
-
retainAll(Collection<?>) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
RETURN_PRIMARY_KEYS - Static variable in class org.hsqldb.jdbc.JDBCStatement
-
 
-
rightTrimSize(String) - Static method in class org.hsqldb.lib.StringUtil
-
-
Returns the size of substring that does not contain any trailing spaces
-
-
rollback() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Undoes all changes made in the current transaction - and releases any database locks currently held - by this Connection object.
-
-
rollback() - Method in class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
Interceptor method, because this method is prohibited within - any global transaction.
-
-
rollback(Savepoint) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Undoes all changes made after the given Savepoint object - was set.
-
-
rollback(Savepoint) - Method in class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
Interceptor method, because this method is prohibited within - any global transaction.
-
-
rollback(Xid) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
Per the JDBC 3.0 spec, this rolls back the transaction for the specified - Xid, not necessarily for the transaction associated with this XAResource - object.
-
-
rollbackThis() - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
-
This rolls back the connection associated with this XAResource.
-
-
rowDeleted() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether a row has been deleted.
-
-
rowInserted() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether the current row has had an insertion.
-
-
rowUpdated() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Retrieves whether the current row has been updated.
-
-
- - - -

S

-
-
SAX2XMLStreamWriter(XMLStreamWriter) - Constructor for class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Constructs a new SAX2XMLStreamWriter that writes SAX events to the - designated XMLStreamWriter.
-
-
SC_DEFAULT_ADDRESS - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_BER_SERVER_PORT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_DATABASE - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_HSQL_SERVER_PORT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_HSQLS_SERVER_PORT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_HTTP_SERVER_PORT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_HTTPS_SERVER_PORT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_MAX_DATABASES - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_NO_SYSTEM_EXIT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_REMOTE_OPEN_DB - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_SERVER_AUTORESTART - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_SILENT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_TLS - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_TRACE - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_WEB_MIME - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_WEB_PAGE - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_DEFAULT_WEB_ROOT - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_PROTOCOL_BER - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_PROTOCOL_HSQL - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SC_PROTOCOL_HTTP - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
scale - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's value's number of digits to right of the decimal point.
-
-
ScannerSearchAlgorithm - Class in org.hsqldb.lib
-
-
Provides a string search facility using a Scanner.
-
-
scheduleAfter(long, Runnable) - Method in class org.hsqldb.lib.HsqlTimer
-
-
Causes the specified Runnable to be executed once in the background - after the specified delay.
-
-
scheduleAt(Date, Runnable) - Method in class org.hsqldb.lib.HsqlTimer
-
-
Causes the specified Runnable to be executed once in the background - at the specified time.
-
-
schedulePeriodicallyAfter(long, long, Runnable, boolean) - Method in class org.hsqldb.lib.HsqlTimer
-
-
Causes the specified Runnable to be executed periodically in the - background, starting after the specified delay.
-
-
schedulePeriodicallyAt(Date, long, Runnable, boolean) - Method in class org.hsqldb.lib.HsqlTimer
-
-
Causes the specified Runnable to be executed periodically in the - background, starting at the specified time.
-
-
schemaName - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's table's schema.
-
-
search(byte[], byte[], int[], int) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
Searches the given octet string for the given octet pattern - returning the zero-based offset from given start position - at which the first match is detected.
-
-
search(char[], char[], int[], int) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
Searches the given character array for the given character pattern - returning the zero-based offset from given start position - at which the first match is detected.
-
-
search(InputStream, byte[], int[]) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
Searches the given octet stream for the given octet pattern - returning the zero-based offset from the initial stream position - at which the first match is detected.
-
-
search(Reader, char[], boolean) - Static method in class org.hsqldb.lib.ScannerSearchAlgorithm
-
-
the given reader for the given searchstr.
-
-
search(Reader, char[], int[]) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
Searches the given character stream for the given character pattern - returning the zero-based offset from the initial stream position - at which the first match is detected.
-
-
search(Reader, String, boolean) - Static method in class org.hsqldb.lib.ScannerSearchAlgorithm
-
-
the given reader for the given searchstr.
-
-
search(Reader, String, int[]) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
Searches the given character stream for the given character pattern - returning the zero-based offset from the initial stream position - at which the first match is detected.
-
-
search(Reader, Pattern) - Static method in class org.hsqldb.lib.ScannerSearchAlgorithm
-
-
the given reader for the given pattern.
-
-
search(String, String, int[], int) - Static method in class org.hsqldb.lib.KMPSearchAlgorithm
-
-
Searches the given String object for the given character pattern - returning the zero-based offset from given start position - at which the first match is detected.
-
-
searchFirst(Object[], int, int, Object, Comparator) - Static method in class org.hsqldb.lib.ArraySort
-
-
Returns the index of the lowest element == the given search target, or - when not found, a negative value -(insert position + 1)
-
-
serialize(Serializable) - Static method in class org.hsqldb.lib.InOutUtil
-
-
Retrieves the serialized form of the specified Object as an - array of bytes.
-
-
Server - Class in org.hsqldb.server
-
-
The HyperSQL hsql: and hsqls: protocol network database server.
-
-
Server() - Constructor for class org.hsqldb.server.Server
-
-
Creates a new Server instance handling HSQL protocol connections.
-
-
SERVER_STATE_CLOSING - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SERVER_STATE_ONLINE - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SERVER_STATE_OPENING - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
SERVER_STATE_SHUTDOWN - Static variable in interface org.hsqldb.server.ServerConstants
-
 
-
ServerAcl - Class in org.hsqldb.server
-
-
A list of ACL permit and deny entries with a permitAccess method - which tells whether candidate addresses are permitted or denied - by this ACL list.
-
-
ServerAcl(File) - Constructor for class org.hsqldb.server.ServerAcl
-
 
-
ServerAcl.AclFormatException - Exception in org.hsqldb.server
-
 
-
ServerConfiguration - Class in org.hsqldb.server
-
-
Assists with Server and WebServer configuration tasks.
-
-
ServerConstants - Interface in org.hsqldb.server
-
-
An enumeration of the property keys and default property values used by - HSQLDB servers
-
-
ServerProperties - Class in org.hsqldb.server
-
-
A subclass HsqlProperties with functionality needed for the HSQLDB Server - implementations.
-
-
ServerProperties(int, File) - Constructor for class org.hsqldb.server.ServerProperties
-
 
-
set(int, int, V) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
set(int, long, V) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
set(int, E) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Replaces the element at given position
-
-
set(int, E) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
set(int, E) - Method in interface org.hsqldb.lib.List
-
 
-
set(int, E) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
set(int, K, V) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
Set<E> - Interface in org.hsqldb.lib
-
-
Marker interface for a Collection that is a Set of values.
-
-
setAbortUponModify(boolean) - Method in class org.hsqldb.lib.tar.DbBackup
-
-
Defaults to true.
-
-
setAccessAttribute(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Set the attribute name of the RDN + parentDn entries which will be - consulted to decide whether the user can access the HyperSQL database.
-
-
setAccessValuePattern(Pattern) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Assign a pattern to detect honored accessAttribute values.
-
-
setAccessValuePatternString(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
String wrapper for method setAccessValuePattern(Pattern) Use the (x?) - Pattern constructs to set options.
-
-
setAddress(String) - Method in class org.hsqldb.server.Server
-
-
Sets the InetAddress with which this server's ServerSocket will be - constructed.
-
-
setApplicationKey(String) - Method in class org.hsqldb.auth.JaasAuthBean
-
-
Set the key into the JAAS runtime configuration.
-
-
setArray(int, Array) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Array object.
-
-
setAsciiStream(int, InputStream) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given input stream.
-
-
setAsciiStream(int, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setAsciiStream(int, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setAsciiStream(long) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves a stream to be used to write ASCII characters to the - CLOB value that this Clob object represents, - starting at position pos.
-
-
setAsciiStream(long) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves a stream to be used to write Ascii characters to the - CLOB value that this Clob object represents, - starting at position pos.
-
-
setAsciiStream(long) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves a stream to be used to write Ascii characters to the - CLOB value that this Clob object represents, - starting at position pos.
-
-
setAsciiStream(String, InputStream) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given input stream.
-
-
setAsciiStream(String, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setAsciiStream(String, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setAuthFunctionBean(String, AuthFunctionBean) - Method in class org.hsqldb.auth.AuthBeanMultiplexer
-
-
This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign ths single given AuthFunctionBean as the - specified database's authenticator.
-
-
setAuthFunctionBean(Connection, AuthFunctionBean) - Method in class org.hsqldb.auth.AuthBeanMultiplexer
-
-
Exactly the same as setAuthFunctionBeans(String, List) other than taking - an open Connection to identify the database.
-
-
setAuthFunctionBeans(String, List<AuthFunctionBean>) - Method in class org.hsqldb.auth.AuthBeanMultiplexer
-
-
This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign the entire list for that database.
-
-
setAuthFunctionBeans(Connection, List<AuthFunctionBean>) - Method in class org.hsqldb.auth.AuthBeanMultiplexer
-
-
Wrapper for setAuthFunctionBeans(String, List<AuthFunctionBean>)
-
-
setAuthFunctionBeans(Map<String, List<AuthFunctionBean>>) - Method in class org.hsqldb.auth.AuthBeanMultiplexer
-
-
Primary purpose of this class is to manage this static map.
-
-
setAutoCommit(boolean) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Sets this connection's auto-commit mode to the given state.
-
-
setAutoCommit(boolean) - Method in class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
Interceptor method, because this method is prohibited within - any global transaction.
-
-
setBigDecimal(int, BigDecimal) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.math.BigDecimal value.
-
-
setBigDecimal(String, BigDecimal) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given - java.math.BigDecimal value.
-
-
setBinaryStream() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Retrieves a stream that can be used to write the XML value that this SQLXML instance represents.
-
-
setBinaryStream(int, InputStream) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given input stream.
-
-
setBinaryStream(int, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setBinaryStream(int, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setBinaryStream(long) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents.
-
-
setBinaryStream(long) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents.
-
-
setBinaryStream(long) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents.
-
-
setBinaryStream(String, InputStream) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given input stream.
-
-
setBinaryStream(String, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setBinaryStream(String, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
-
-
setBlob(int, InputStream) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a InputStream object.
-
-
setBlob(int, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a InputStream object.
-
-
setBlob(int, Blob) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Blob object.
-
-
setBlob(String, InputStream) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a InputStream object.
-
-
setBlob(String, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a InputStream object.
-
-
setBlob(String, Blob) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Blob object.
-
-
setBoolean(int, boolean) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java boolean value.
-
-
setBoolean(String, boolean) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java boolean value.
-
-
setByte(int, byte) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java byte value.
-
-
setByte(String, byte) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java byte value.
-
-
setBytes(int, byte[]) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java array of bytes.
-
-
setBytes(long, byte[]) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written.
-
-
setBytes(long, byte[]) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written.
-
-
setBytes(long, byte[]) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written.
-
-
setBytes(long, byte[], int, int) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written.
-
-
setBytes(long, byte[], int, int) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written.
-
-
setBytes(long, byte[], int, int) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written.
-
-
setBytes(String, byte[]) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java array of bytes.
-
-
setCatalog(String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Sets the given catalog name in order to select - a subspace of this Connection object's database - in which to work.
-
-
setCharacterStream() - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Retrieves a stream to be used to write the XML value that this SQLXML instance represents.
-
-
setCharacterStream(int, Reader) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Reader - object.
-
-
setCharacterStream(int, Reader, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Reader - object, which is the given number of characters long.
-
-
setCharacterStream(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Reader - object, which is the given number of characters long.
-
-
setCharacterStream(long) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos.
-
-
setCharacterStream(long) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos.
-
-
setCharacterStream(long) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos.
-
-
setCharacterStream(String, Reader) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Reader - object.
-
-
setCharacterStream(String, Reader, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Reader - object, which is the given number of characters long.
-
-
setCharacterStream(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Reader - object, which is the given number of characters long.
-
-
setClientInfo(String, String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Sets the value of the client info property specified by name to the - value specified by value.
-
-
setClientInfo(Properties) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Sets the value of the connection's client info properties.
-
-
setClob(int, Reader) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setClob(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setClob(int, Clob) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Clob object.
-
-
setClob(String, Reader) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setClob(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setClob(String, Clob) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Clob object.
-
-
setColumnComparator(Class, Comparator) - Method in class org.hsqldb.util.TableSorter
-
 
-
setCount(int) - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Updates count to the requested newCount, returning - true on transition to zero.
-
-
setCount(long) - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
setCursorName(String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the SQL cursor name to the given String, which - will be used by subsequent Statement object - execute methods.
-
-
setCursorName(String) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Sets the SQL cursor name to the given String, which - will be used by subsequent Statement object - execute methods.
-
-
setDaemon(boolean) - Method in class org.hsqldb.server.Server
-
-
No-op as deprecated.
-
-
setDatabase(String) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Synonym for setUrl(String).
-
-
setDatabase(String) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Synonym for setUrl(String).
-
-
setDatabaseName(int, String) - Method in class org.hsqldb.server.Server
-
-
Sets the external name (url alias) of the i'th hosted database.
-
-
setDatabaseName(String) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Synonym for setUrl(String).
-
-
setDatabaseName(String) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Synonym for setUrl(String).
-
-
setDatabasePath(int, String) - Method in class org.hsqldb.server.Server
-
-
Sets the path of the hosted database.
-
-
setDate(int, Date) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
(JDBC4 clarification:) - Sets the designated parameter to the given java.sql.Date value - using the default time zone of the virtual machine that is running - the application.
-
-
setDate(int, Date, Calendar) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Date value, - using the given Calendar object.
-
-
setDate(String, Date) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Date value - (JDBC4 clarification:)
-
-
setDate(String, Date, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Date value, - using the given Calendar object.
-
-
setDefaultJdbcDriver(String) - Method in class org.hsqldb.util.RCData
-
 
-
setDefaultWebPage(String) - Method in class org.hsqldb.server.Server
-
-
Sets the name of the web page served when no page is specified.
-
-
setDelegateRolesSchema(boolean) - Method in class org.hsqldb.auth.HsqldbSlaveAuthBean
-
-
Defaults to true.
-
-
setDeleteOnFree(boolean) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Assigns whether an attempt to delete the backing file - is made in response to invocation of JDBCBlobFile.free().
-
-
setDeleteOnFree(boolean) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Assigns whether an attempt to delete the backing file - is made in response to invocation of JDBCClobFile.free().
-
-
setDocumentLocator(Locator) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive an object for locating the origin of SAX document events.
-
-
setDouble(int, double) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java double value.
-
-
setDouble(String, double) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java double value.
-
-
setErrWriter(PrintWriter) - Method in class org.hsqldb.server.Server
-
-
Sets the PrintWriter to which server errors are logged.
-
-
setEscapeProcessing(boolean) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets escape processing on or off.
-
-
setEscapeProcessing(boolean) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Sets escape processing on or off.
-
-
setFetchDirection(int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Gives the driver a hint as to the direction in which - rows will be processed in ResultSet - objects created using this Statement object.
-
-
setFetchDirection(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Gives a hint as to the direction in which the rows in this - ResultSet object will be processed.
-
-
setFetchDirection(int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Gives the driver a hint as to the direction in which - rows will be processed in ResultSet - objects created using this Statement object.
-
-
setFetchSize(int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
(JDBC4 clarification:) - Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for - ResultSet objects generated by this Statement.
-
-
setFetchSize(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for this - ResultSet object.
-
-
setFetchSize(int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
(JDBC4 clarification:) - Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for - ResultSet objects generated by this Statement.
-
-
setFileIgnore(String) - Method in class org.hsqldb.lib.tar.DbBackup
-
 
-
setFloat(int, float) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java float value.
-
-
setFloat(String, float) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java float value.
-
-
setHoldability(int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
(JDBC4 Clarification:) - Changes the default holdability of ResultSet objects - created using this Connection object to the given - holdability.
-
-
setInitialContextFactory(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Most users should not call this, and will get the default of - "com.sun.jndi.ldap.LdapCtxFactory".
-
-
setInt(int, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java int value.
-
-
setInt(String, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java int value.
-
-
setKey(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Modifies an existing pair at the given index.
-
-
setKey(int, int) - Method in class org.hsqldb.lib.IntIndex
-
-
Modifies an existing pair.
-
-
setKeyAt(int, int) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
setKeyAt(int, long) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
setKeyAt(int, K) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
setKeysSearchTarget() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
setLargeMaxRows(long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
-
-
setLargeMaxRows(long) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
-
-
setLdapHost(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Do not specify URL scheme ("ldap:") because that is implied.
-
-
setLdapPort(int) - Method in class org.hsqldb.auth.LdapAuthBean
-
 
-
setLevel(int) - Method in class org.hsqldb.lib.SimpleLog
-
 
-
setLoginTimeout(int) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Sets the maximum time in seconds that this data source will wait - while attempting to connect to a database.
-
-
setLoginTimeout(int) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Sets the maximum time in seconds that this data source will wait - while attempting to connect to a database.
-
-
setLogWriter(PrintWriter) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Sets the log writer for this DataSource - object to the given java.io.PrintWriter object.
-
-
setLogWriter(PrintWriter) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Sets the log writer for this DataSource - object to the given java.io.PrintWriter object.
-
-
setLogWriter(PrintWriter) - Method in class org.hsqldb.server.Server
-
-
Sets the PrintWriter to which server messages are logged.
-
-
setLong(int, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java long value.
-
-
setLong(String, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java long value.
-
-
setLongValue(int, long) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Modifies an existing pair at the given index.
-
-
setLongValue(int, long) - Method in class org.hsqldb.lib.DoubleLongIndex
-
-
Modifies an existing pair.
-
-
setLongValue(int, long) - Method in interface org.hsqldb.lib.LongLookup
-
 
-
setMasterJdbcUrl(String) - Method in class org.hsqldb.auth.HsqldbSlaveAuthBean
-
 
-
setMaxFieldSize(int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
(JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - Sets the limit for the maximum number of bytes that can be returned for - character and binary column values in a ResultSet - object produced by this Statement object.
-
-
setMaxFieldSize(int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
(JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - Sets the limit for the maximum number of bytes that can be returned for - character and binary column values in a ResultSet - object produced by this Statement object.
-
-
setMaxRows(int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
(JDBC4 clarification:) - Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
-
-
setMaxRows(int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
(JDBC4 clarification:) - Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
-
-
setMissingPosValueBehavior(int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
-
Set behavior for get*String(String, String[]) method when a positional - index (like %{4}) is used but no subs value was given for that index.
-
-
setMissingPropertyBehavior(int) - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
-
Set behavior for get*String*() method when a referred-to System Property - is not set.
-
-
setNCharacterStream(int, Reader) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNCharacterStream(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNCharacterStream(String, Reader) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNCharacterStream(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNClob(int, Reader) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNClob(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNClob(int, NClob) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to a java.sql.NClob object.
-
-
setNClob(String, Reader) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNClob(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a Reader object.
-
-
setNClob(String, NClob) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to a java.sql.NClob object.
-
-
setNetworkTimeout(Executor, int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Sets the maximum period a Connection or - objects created from the Connection - will wait for the database to reply to any one request.
-
-
setNoSystemExit(boolean) - Method in class org.hsqldb.server.Server
-
-
Sets whether this server calls System.exit() when shutdown.
-
-
setNString(int, String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given String object.
-
-
setNString(String, String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given String object.
-
-
setNull(int, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to SQL NULL.
-
-
setNull(int, int, String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to SQL NULL.
-
-
setNull(String, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to SQL NULL.
-
-
setNull(String, int, String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to SQL NULL.
-
-
setObject(int, Object) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
setObject(int, Object, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(int, Object, int, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(int, Object, SQLType) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(int, Object, SQLType, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(String, Object) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(String, Object, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(String, Object, int, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(String, Object, SQLType) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setObject(String, Object, SQLType, int) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the value of the designated parameter with the given object.
-
-
setOverWrite(boolean) - Method in class org.hsqldb.lib.tar.DbBackup
-
-
Defaults to false.
-
-
setParentDn(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Set DN which is parent of the user DNs.
-
-
setPassword(String) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Sets the password for the user name.
-
-
setPassword(String) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Sets the password for the user name.
-
-
setPaxThreshold(long) - Method in class org.hsqldb.lib.tar.TarGenerator
-
-
When data file is this size or greater, in bytes, a - Pix Interchange Format 'x' record will be created and used for the file - entry.
-
-
setPeriod(Object, long) - Static method in class org.hsqldb.lib.HsqlTimer
-
-
Sets the periodicity of the designated task to a new value.
-
-
setPoolable(boolean) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Requests that a Statement be pooled or not pooled.
-
-
setPoolable(boolean) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Requests that a Statement be pooled or not pooled.
-
-
setPort(int) - Method in class org.hsqldb.server.Server
-
-
Sets the server listen port.
-
-
setPosition(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
setPrincipalTemplate(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
A template String containing place-holder token '${username}'.
-
-
setPrintWriter(PrintWriter) - Method in class org.hsqldb.server.ServerAcl
-
 
-
setProperties(Properties) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Sets connection properties.
-
-
setProperties(Properties) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Sets connection properties.
-
-
setProperties(Properties) - Method in class org.hsqldb.server.Server
-
-
Sets server properties using the specified properties object
-
-
setProperties(HsqlProperties) - Method in class org.hsqldb.server.Server
-
-
Sets server properties using the specified HsqlProperties object
-
-
setQueryTimeout(int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the number of seconds the driver will wait for a - Statement object to execute to the given number of seconds.
-
-
setQueryTimeout(int) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Sets the number of seconds the driver will wait for a - Statement object to execute to the given number of seconds.
-
-
setRdnAttribute(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
rdnAttribute must hold the user name exactly as the HyperSQL login will - be made with.
-
-
setReadOnly(boolean) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Puts this connection in read-only mode as a hint to the driver to enable - database optimizations.
-
-
setRef(int, Ref) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given - REF(<structured-type>) value.
-
-
setRestartOnShutdown(boolean) - Method in class org.hsqldb.server.Server
-
-
Sets whether this server restarts on shutdown.
-
-
setResult(Class<T>) - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Returns a Result for setting the XML value designated by this SQLXML instance.
-
-
setRoleSchemaValuePattern(Pattern) - Method in class org.hsqldb.auth.JaasAuthBean
-
-
Assign a pattern to both detect honored values, and optionally - to map from a single principal name or public credential string - to a single HyperSQL role or schema string.
-
-
setRoleSchemaValuePattern(Pattern) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Assign a pattern to both detect honored values, and to map from a single - value of "rolesSchemaAttribute"s to a HyperSQL role or schema string.
-
-
setRoleSchemaValuePatternString(String) - Method in class org.hsqldb.auth.JaasAuthBean
-
-
String wrapper for method setRoleSchemaValuePattern(Pattern) - - Use the (x?) Pattern constructs to set options.
-
-
setRoleSchemaValuePatternString(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
String wrapper for method setRoleSchemaValuePattern(Pattern) - - Use the (x?) Pattern constructs to set options.
-
-
setRoleSchemaViaCredential(boolean) - Method in class org.hsqldb.auth.JaasAuthBean
-
-
By default, If roleSchemaValuePattern is set, then role and schema - values are obtained from principle values; otherwise existing account - privileges are used (if any).
-
-
setRolesSchemaAttribute(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Set the attribute name of the RDN + parentDn entries in which is stored - the list of roles and optional schema for the authenticating user.
-
-
setRowId(int, RowId) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.RowId object.
-
-
setRowId(String, RowId) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.RowId object.
-
-
setSaslRealm(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Some LDAP servers using a SASL mechanism require a realm to be specified, - and some mechanisms allow a realm to be specified if you wish to use that - feature.
-
-
setSavepoint() - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates an unnamed savepoint in the current transaction and - returns the new Savepoint object that represents it.
-
-
setSavepoint() - Method in class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
Interceptor method, because this method is prohibited within - any global transaction.
-
-
setSavepoint(String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Creates a savepoint with the given name in the current transaction - and returns the new Savepoint object that represents it.
-
-
setSavepoint(String) - Method in class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
Interceptor method, because this method is prohibited within - any global transaction.
-
-
setSchema(String) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Sets the given schema name to access.
-
-
setSecondValueAt(int, Object) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
setSecurityMechanism(String) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
Defaults to "SIMPLE".
-
-
setShort(int, short) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java short value.
-
-
setShort(String, short) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java short value.
-
-
setSilent(boolean) - Method in class org.hsqldb.server.Server
-
-
Sets silent mode operation
-
-
setSize(int) - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
setSize(int) - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Sets the size of this stream's accumulated data.
-
-
setSize(int) - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Sets the size of this writer's accumulated character data.
-
-
setSize(int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
setSize(int) - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
setSize(int) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Increase or reduce the size, setting discarded or added elements to null.
-
-
setSize(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
-
size must fit in buffer
-
-
setSizeLimit(long) - Method in interface org.hsqldb.lib.InputStreamInterface
-
 
-
setSizeLimit(long) - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
setSortingStatus(int, int) - Method in class org.hsqldb.util.TableSorter
-
 
-
setSQLXML(int, SQLXML) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.SQLXML object.
-
-
setSQLXML(String, SQLXML) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.SQLXML object.
-
-
setStartTls(boolean) - Method in class org.hsqldb.auth.LdapAuthBean
-
-
If this is set, then the entire (brief) transaction with the LDAP server - will be encrypted.
-
-
setStream(String, InputStreamInterface) - Method in class org.hsqldb.lib.tar.DbBackup
-
-
Overrides file with stream.
-
-
setString(int, String) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given Java String value.
-
-
setString(long, String) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos.
-
-
setString(long, String) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos.
-
-
setString(long, String) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos.
-
-
setString(long, String, int, int) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Writes len characters of str, starting - at character offset, to the CLOB value - that this Clob represents.
-
-
setString(long, String, int, int) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Writes len characters of str, starting at - character offset, to the CLOB value that - this Clob represents.
-
-
setString(long, String, int, int) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Writes len characters of str, starting - at character offset, to the CLOB value - that this Clob represents.
-
-
setString(String) - Method in class org.hsqldb.jdbc.JDBCSQLXML
-
-
Sets the XML value designated by this SQLXML instance to the given String representation.
-
-
setString(String, String) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given Java String value.
-
-
setStringBuffer(long, StringBuffer, int, int) - Method in class org.hsqldb.jdbc.JDBCClob
-
- -
-
setTableHeader(JTableHeader) - Method in class org.hsqldb.util.TableSorter
-
 
-
setTableModel(TableModel) - Method in class org.hsqldb.util.TableSorter
-
 
-
setThirdValueAt(int, Object) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
setTI(Connection, String) - Static method in class org.hsqldb.util.RCData
-
-
Set Transaction Isolation level on the specified JDBC Connection
-
-
setTime(int, Time) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Time value.
-
-
setTime(int, Time, Calendar) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Time value, - using the given Calendar object.
-
-
setTime(String, Time) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Time value.
-
-
setTime(String, Time, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Time value, - using the given Calendar object.
-
-
setTimestamp(int, Timestamp) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Timestamp value.
-
-
setTimestamp(int, Timestamp, Calendar) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.sql.Timestamp value, - using the given Calendar object.
-
-
setTimestamp(String, Timestamp) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Timestamp value.
-
-
setTimestamp(String, Timestamp, Calendar) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.sql.Timestamp value, - using the given Calendar object.
-
-
setTls(boolean) - Method in class org.hsqldb.server.Server
-
-
Sets whether to use secure sockets
-
-
setTrace(boolean) - Method in class org.hsqldb.server.Server
-
-
Sets whether trace messages go to System.out or the - DriverManger PrintStream/PrintWriter, if any.
-
-
setTransactionIsolation(int) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Attempts to change the transaction isolation level for this - Connection object to the one given.
-
-
setTransactionIsolation(int) - Method in class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
Interceptor method, because there may be XA implications to - calling the method within a global transaction.
-
-
setTransactionTimeout(int) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
 
-
setTypeMap(Map<String, Class<?>>) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Installs the given TypeMap object as the type map for - this Connection object.
-
-
setUnicodeStream(int, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Deprecated. -
Sun does not include a reason, but presumably - this is because setCharacterStream is now preferred
-
-
-
setUrl(String) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Sets the jdbc database URL.
-
-
setUrl(String) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Sets the jdbc database URL.
-
-
setURL(int, URL) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Sets the designated parameter to the given java.net.URL value.
-
-
setURL(String) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Sets the jdbc database URL.
-
-
setURL(String) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Sets the jdbc database URL.
-
-
setURL(String, URL) - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Sets the designated parameter to the given java.net.URL object.
-
-
setUser(String) - Method in class org.hsqldb.jdbc.JDBCCommonDataSource
-
-
Sets the user name.
-
-
setUser(String) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Sets the user name.
-
-
setValidationPassword(String) - Method in class org.hsqldb.auth.HsqldbSlaveAuthBean
-
-
Use this method and setValidationUser if you want access to the master - database to be verified upon instance initialization.
-
-
setValidationUser(String) - Method in class org.hsqldb.auth.HsqldbSlaveAuthBean
-
-
Use this method and setValidationPassword if you want access to the - master database to be verified upon instance initialization.
-
-
setValue(int, int) - Method in class org.hsqldb.lib.DoubleIntIndex
-
-
Modifies an existing pair at the given index.
-
-
setValueAt(int, Object) - Method in class org.hsqldb.lib.OrderedIntKeyHashMap
-
 
-
setValueAt(int, Object) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
setValueAt(int, V) - Method in class org.hsqldb.lib.OrderedHashMap
-
 
-
setValueAt(Object, int, int) - Method in class org.hsqldb.util.TableSorter
-
 
-
setValuesSearchTarget() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
setWaiting(String) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
setWebRoot(String) - Method in class org.hsqldb.server.Server
-
-
Sets the path of the root directory from which web content is served.
-
-
setWritable(JDBCResultSet, int) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
 
-
setWritable(JDBCResultSet, int) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
 
-
severe(String) - Method in class org.hsqldb.lib.FrameworkLogger
-
 
-
severe(String, Throwable) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
Just like FrameworkLogger.severe(String), but also logs a stack trace.
-
-
shutdown() - Method in class org.hsqldb.lib.HsqlTimer
-
-
Shuts down this timer after the current task (if any) completes.
-
-
shutdown() - Method in class org.hsqldb.server.Server
-
-
External method to shut down this server.
-
-
shutDown() - Method in class org.hsqldb.lib.HsqlTimer
-
-
for compatibility with previous version
-
-
shutdownAfterCurrent() - Method in class org.hsqldb.lib.HsqlTaskQueue
-
 
-
shutdownAfterQueued() - Method in class org.hsqldb.lib.HsqlTaskQueue
-
 
-
shutdownCatalogs(int) - Method in class org.hsqldb.server.Server
-
-
Shuts down all the database served by this server.
-
-
shutdownImmediately() - Method in class org.hsqldb.lib.HsqlTaskQueue
-
 
-
shutdownImmediately() - Method in class org.hsqldb.lib.HsqlTimer
-
-
Shuts down this timer immediately, interrupting the wait state associated - with the current head of the task queue or the wait state internal to - the currently executing task, if any such state is currently in effect.
-
-
shutdownWithCatalogs(int) - Method in class org.hsqldb.server.Server
-
-
Shuts down this server and all the database served by this server.
-
-
signalCloseAllServerConnections() - Method in interface org.hsqldb.server.HsqlSocketRequestHandler
-
 
-
signalCloseAllServerConnections() - Method in class org.hsqldb.server.Server
-
-
Closes all connections to this Server.
-
-
SimpleLog - Class in org.hsqldb.lib
-
-
Simple log for recording abnormal events in persistence
-
-
SimpleLog(String, int, boolean) - Constructor for class org.hsqldb.lib.SimpleLog
-
 
-
size - org.hsqldb.lib.tar.TarHeaderField
-
 
-
size() - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
size() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Returns the current size of this stream's accumulated data.
-
-
size() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Returns the current size of this writer's accumulated character data.
-
-
size() - Method in interface org.hsqldb.lib.Collection
-
 
-
size() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
size() - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
size() - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
size() - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Returns the number of elements in the array list
-
-
size() - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
size() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
size() - Method in interface org.hsqldb.lib.HsqlHeap
-
-
Retrieves the number of elements currently in this Heap.
-
-
size() - Method in class org.hsqldb.lib.IntIndex
-
 
-
size() - Method in interface org.hsqldb.lib.IntLookup
-
 
-
size() - Method in interface org.hsqldb.lib.List
-
 
-
size() - Method in class org.hsqldb.lib.LongDeque
-
 
-
size() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
size() - Method in interface org.hsqldb.lib.LongLookup
-
 
-
size() - Method in interface org.hsqldb.lib.Map
-
 
-
size() - Method in class org.hsqldb.util.CodeSwitcher
-
 
-
skip(long) - Method in class org.hsqldb.lib.CountdownInputStream
-
 
-
skip(long) - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
skip(long) - Method in interface org.hsqldb.lib.InputStreamInterface
-
 
-
skip(long) - Method in class org.hsqldb.lib.InputStreamWrapper
-
 
-
skipBytes(int) - Method in class org.hsqldb.lib.HsqlByteArrayInputStream
-
 
-
skippedEntity(String) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of a skipped entity.
-
-
skipSpaces(String, int) - Static method in class org.hsqldb.lib.StringUtil
-
-
Skips any spaces at or after start and returns the index of first - non-space character;
-
-
sort() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
sort() - Method in class org.hsqldb.lib.DoubleLongIndex
-
 
-
sort() - Method in class org.hsqldb.lib.IntIndex
-
 
-
sort() - Method in interface org.hsqldb.lib.LongLookup
-
 
-
sort(Object[], int, Comparator) - Static method in class org.hsqldb.lib.ArraySort
-
 
-
sort(Comparator<? super E>) - Method in class org.hsqldb.lib.HsqlArrayList
-
 
-
sortArray(int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Basic sort for small arrays of int.
-
-
sortOnKeys() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
sortOnValues() - Method in class org.hsqldb.lib.DoubleIntIndex
-
 
-
split(String, String) - Static method in class org.hsqldb.lib.StringUtil
-
-
Splits the string into an array, using the separator.
-
-
sqlBitStringToBitMap(String) - Static method in class org.hsqldb.lib.StringConverter
-
-
Compacts a bit string into a BitMap
-
-
sqlException(int) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(int, int) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(int, String) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(int, String, Throwable) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(String, String, int, Throwable) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(Throwable) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(HsqlException) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(HsqlException, Throwable) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlException(Result) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlExceptionSQL(int) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
sqlWarning(Result) - Static method in class org.hsqldb.jdbc.JDBCUtil
-
 
-
start() - Method in class org.hsqldb.lib.StopWatch
-
-
Ensures that this object is in the running state.
-
-
start() - Method in class org.hsqldb.server.Server
-
-
Starts this server synchronously.
-
-
start() - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
start(Xid, int) - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
 
-
startDocument() - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of the beginning of a document.
-
-
startElement(String, String, String, Attributes) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Receive notification of the beginning of an element.
-
-
startPrefixMapping(String, String) - Method in class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
Begin the scope of a prefix-URI Namespace mapping.
-
-
statementClosed(StatementEvent) - Method in class org.hsqldb.jdbc.JDBCPool
-
 
-
statementErrorOccurred(StatementEvent) - Method in class org.hsqldb.jdbc.JDBCPool
-
 
-
stop() - Method in class org.hsqldb.lib.StopWatch
-
-
Ensures that this object is in the stopped state.
-
-
stop() - Method in class org.hsqldb.server.Server
-
-
Stops this server asynchronously.
-
-
stop() - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
StopWatch - Class in org.hsqldb.lib
-
-
Provides the programatic analog of a physical stop watch.
-
-
StopWatch() - Constructor for class org.hsqldb.lib.StopWatch
-
-
Creates, zeros, and starts a new StopWatch
-
-
StopWatch(boolean) - Constructor for class org.hsqldb.lib.StopWatch
-
-
Creates, zeros, and starts a new StopWatch
-
-
store() - Method in class org.hsqldb.util.DatabaseManagerSwing.DBMPrefs
-
 
-
storesLowerCaseIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in lower case.
-
-
storesLowerCaseQuotedIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in lower case.
-
-
storesMixedCaseIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in mixed case.
-
-
storesMixedCaseQuotedIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in mixed case.
-
-
storesUpperCaseIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in upper case.
-
-
storesUpperCaseQuotedIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in upper case.
-
-
stream_buffer_report - org.hsqldb.lib.tar.RB
-
 
-
StringComparator - Class in org.hsqldb.lib
-
 
-
StringComparator() - Constructor for class org.hsqldb.lib.StringComparator
-
 
-
StringConverter - Class in org.hsqldb.lib
-
-
Collection of static methods for converting strings between different - formats and to and from byte arrays.
-
-
StringConverter() - Constructor for class org.hsqldb.lib.StringConverter
-
 
-
StringInputStream - Class in org.hsqldb.lib
-
-
Minimal InputStream subclass to fetch bytes form a String.
-
-
StringInputStream(String) - Constructor for class org.hsqldb.lib.StringInputStream
-
 
-
stringToHtmlBytes(HsqlByteArrayOutputStream, String) - Static method in class org.hsqldb.lib.StringConverter
-
-
Converts the string to an HTML representation in the ASCII character set - and appends it to a byte array output stream.
-
-
stringToUnicodeBytes(HsqlByteArrayOutputStream, String, boolean) - Static method in class org.hsqldb.lib.StringConverter
-
-
Hsqldb specific encoding used only for log files.
-
-
stringToUnicodeEscaped(String) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
stringToUTFBytes(String, HsqlByteArrayOutputStream) - Static method in class org.hsqldb.lib.StringConverter
-
-
Writes a string to the specified DataOutput using UTF-8 encoding in a - machine-independent manner.
-
-
StringUtil - Class in org.hsqldb.lib
-
-
Provides a collection of convenience methods for processing and - creating objects with String value components.
-
-
StringUtil() - Constructor for class org.hsqldb.lib.StringUtil
-
 
-
subList(int, int) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
SUGGESTED_MAX_LITERAL_SIZE - Static variable in class org.hsqldb.lib.ScannerSearchAlgorithm
-
-
is 1024.
-
-
supportsAlterTableWithAddColumn() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports ALTER TABLE - with add column.
-
-
supportsAlterTableWithDropColumn() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports ALTER TABLE - with drop column.
-
-
supportsANSI92EntryLevelSQL() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the ANSI92 entry level SQL - grammar.
-
-
supportsANSI92FullSQL() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the ANSI92 full SQL grammar supported.
-
-
supportsANSI92IntermediateSQL() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported.
-
-
supportsBatchUpdates() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports batch updates.
-
-
supportsCatalogsInDataManipulation() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a catalog name can be used in a data manipulation statement.
-
-
supportsCatalogsInIndexDefinitions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a catalog name can be used in an index definition statement.
-
-
supportsCatalogsInPrivilegeDefinitions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a catalog name can be used in a privilege definition statement.
-
-
supportsCatalogsInProcedureCalls() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a catalog name can be used in a procedure call statement.
-
-
supportsCatalogsInTableDefinitions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a catalog name can be used in a table definition statement.
-
-
supportsColumnAliasing() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports column aliasing.
-
-
supportsConvert() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
(JDBC4 clarification:) - Retrieves whether this database supports the JDBC scalar function - CONVERT for the conversion of one JDBC type to another.
-
-
supportsConvert(int, int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
(JDBC4 clarification:) - Retrieves whether this database supports the JDBC scalar function - CONVERT for conversions between the JDBC types fromType - and toType.
-
-
supportsCoreSQLGrammar() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the ODBC Core SQL grammar.
-
-
supportsCorrelatedSubqueries() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports correlated subqueries.
-
-
supportsDataDefinitionAndDataManipulationTransactions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports both data definition and - data manipulation statements within a transaction.
-
-
supportsDataManipulationTransactionsOnly() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports only data manipulation - statements within a transaction.
-
-
supportsDifferentTableCorrelationNames() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether, when table correlation names are supported, they - are restricted to being different from the names of the tables.
-
-
supportsExpressionsInOrderBy() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports expressions in - ORDER BY lists.
-
-
supportsExtendedSQLGrammar() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the ODBC Extended SQL grammar.
-
-
supportsFullOuterJoins() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports full nested outer joins.
-
-
supportsGetGeneratedKeys() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether auto-generated keys can be retrieved after - a statement has been executed - - -
-
-
supportsGroupBy() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports some form of - GROUP BY clause.
-
-
supportsGroupByBeyondSelect() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports using columns not included in - the SELECT statement in a GROUP BY clause - provided that all of the columns in the SELECT statement - are included in the GROUP BY clause.
-
-
supportsGroupByUnrelated() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports using a column that is - not in the SELECT statement in a - GROUP BY clause.
-
-
supportsIntegrityEnhancementFacility() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the SQL Integrity - Enhancement Facility.
-
-
supportsLikeEscapeClause() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports specifying a - LIKE escape clause.
-
-
supportsLimitedOuterJoins() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database provides limited support for outer - joins.
-
-
supportsMinimumSQLGrammar() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the ODBC Minimum SQL grammar.
-
-
supportsMixedCaseIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case unquoted SQL identifiers as - case sensitive and as a result stores them in mixed case.
-
-
supportsMixedCaseQuotedIdentifiers() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database treats mixed case quoted SQL identifiers as - case sensitive and as a result stores them in mixed case.
-
-
supportsMultipleOpenResults() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether it is possible to have multiple ResultSet objects - returned from a CallableStatement object - simultaneously.
-
-
supportsMultipleResultSets() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports getting multiple - ResultSet objects from a single call to the - method execute.
-
-
supportsMultipleTransactions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database allows having multiple - transactions open at once (on different connections).
-
-
supportsNamedParameters() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports named parameters to callable - statements.
-
-
supportsNonNullableColumns() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether columns in this database may be defined as non-nullable.
-
-
supportsOpenCursorsAcrossCommit() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports keeping cursors open - across commits.
-
-
supportsOpenCursorsAcrossRollback() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports keeping cursors open - across rollbacks.
-
-
supportsOpenStatementsAcrossCommit() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports keeping statements open - across commits.
-
-
supportsOpenStatementsAcrossRollback() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports keeping statements open - across rollbacks.
-
-
supportsOrderByUnrelated() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports using a column that is - not in the SELECT statement in an - ORDER BY clause.
-
-
supportsOuterJoins() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports some form of outer join.
-
-
supportsPositionedDelete() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports positioned DELETE - statements.
-
-
supportsPositionedUpdate() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports positioned UPDATE - statements.
-
-
supportsRefCursors() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports REF CURSOR.
-
-
supportsResultSetConcurrency(int, int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the given concurrency type - in combination with the given result set type.
-
-
supportsResultSetHoldability(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the given result set holdability.
-
-
supportsResultSetType(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the given result set type.
-
-
supportsSavepoints() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports savepoints.
-
-
supportsSchemasInDataManipulation() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a schema name can be used in a data manipulation statement.
-
-
supportsSchemasInIndexDefinitions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a schema name can be used in an index definition statement.
-
-
supportsSchemasInPrivilegeDefinitions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a schema name can be used in a privilege definition statement.
-
-
supportsSchemasInProcedureCalls() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a schema name can be used in a procedure call statement.
-
-
supportsSchemasInTableDefinitions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether a schema name can be used in a table definition statement.
-
-
supportsSelectForUpdate() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports SELECT FOR UPDATE - statements.
-
-
supportsStatementPooling() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports statement pooling.
-
-
supportsStoredFunctionsUsingCallSyntax() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports invoking user-defined or vendor functions - using the stored procedure escape syntax.
-
-
supportsStoredProcedures() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports stored procedure calls - that use the stored procedure escape syntax.
-
-
supportsSubqueriesInComparisons() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports subqueries in comparison - expressions.
-
-
supportsSubqueriesInExists() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports subqueries in - EXISTS expressions.
-
-
supportsSubqueriesInIns() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
(JDBC4 correction:) - Retrieves whether this database supports subqueries in - IN expressions.
-
-
supportsSubqueriesInQuantifieds() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports subqueries in quantified - expressions.
-
-
supportsTableCorrelationNames() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports table correlation names.
-
-
supportsTransactionIsolationLevel(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports the given transaction isolation level.
-
-
supportsTransactions() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports transactions.
-
-
supportsUnion() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports SQL UNION.
-
-
supportsUnionAll() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database supports SQL UNION ALL.
-
-
sync() - Method in interface org.hsqldb.lib.FileAccess.FileSync
-
 
-
sync() - Method in class org.hsqldb.lib.FileUtil.FileSync
-
 
-
- - - -

T

-
-
tableName - Variable in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
The column's table's name.
-
-
TableSorter - Class in org.hsqldb.util
-
-
TableSorter is a decorator for TableModels; adding sorting - functionality to a supplied TableModel.
-
-
TableSorter() - Constructor for class org.hsqldb.util.TableSorter
-
 
-
TableSorter(TableModel) - Constructor for class org.hsqldb.util.TableSorter
-
 
-
TableSorter(TableModel, JTableHeader) - Constructor for class org.hsqldb.util.TableSorter
-
 
-
tar_field_toobig - org.hsqldb.lib.tar.RB
-
 
-
TarFileInputStream - Class in org.hsqldb.lib.tar
-
-
Note that this class is not a java.io.FileInputStream, - because our goal is to greatly restrict the public methods of - FileInputStream, yet we must use public methods of the underlying - FileInputStream internally.
-
-
TarFileInputStream(File) - Constructor for class org.hsqldb.lib.tar.TarFileInputStream
-
-
Convenience wrapper to use default readBufferBlocks and compressionType.
-
-
TarFileInputStream(File, int) - Constructor for class org.hsqldb.lib.tar.TarFileInputStream
-
-
Convenience wrapper to use default readBufferBlocks.
-
-
TarFileInputStream(File, int, int) - Constructor for class org.hsqldb.lib.tar.TarFileInputStream
-
-
This class does no validation or enforcement of file naming conventions.
-
-
TarFileOutputStream - Class in org.hsqldb.lib.tar
-
-
Note that this class is not a java.io.FileOutputStream, - because our goal is to greatly restrict the public methods of - FileOutputStream, yet we must use public methods of the underlying - FileOutputStream internally.
-
-
TarFileOutputStream(File) - Constructor for class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Convenience wrapper to use default blocksPerRecord and compressionType.
-
-
TarFileOutputStream(File, int) - Constructor for class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Convenience wrapper to use default blocksPerRecord.
-
-
TarFileOutputStream(File, int, int) - Constructor for class org.hsqldb.lib.tar.TarFileOutputStream
-
-
This class does no validation or enforcement of file naming conventions.
-
-
TarFileOutputStream.Compression - Interface in org.hsqldb.lib.tar
-
 
-
TarGenerator - Class in org.hsqldb.lib.tar
-
-
Generates a tar archive from specified Files and InputStreams.
-
-
TarGenerator(File, boolean, Integer) - Constructor for class org.hsqldb.lib.tar.TarGenerator
-
-
Compression is determined directly by the suffix of the file name in - the specified path.
-
-
TarGenerator_syntax - org.hsqldb.lib.tar.RB
-
 
-
TarGeneratorMain - Class in org.hsqldb.lib.tar
-
 
-
TarGeneratorMain() - Constructor for class org.hsqldb.lib.tar.TarGeneratorMain
-
 
-
TarHeaderField - Enum in org.hsqldb.lib.tar
-
-
Purely static structure defining our interface to the Tar Entry Header.
-
-
TarMalformatException - Exception in org.hsqldb.lib.tar
-
 
-
TarMalformatException(String) - Constructor for exception org.hsqldb.lib.tar.TarMalformatException
-
 
-
TarReader - Class in org.hsqldb.lib.tar
-
-
Reads a Tar file for reporting or extraction.
-
-
TarReader(File, int, String[], Integer, File) - Constructor for class org.hsqldb.lib.tar.TarReader
-
-
Compression is determined directly by the suffix of the file name in - the specified path.
-
-
TarReader_syntax - org.hsqldb.lib.tar.RB
-
 
-
tarreader_syntaxerr - org.hsqldb.lib.tar.RB
-
 
-
TarReaderMain - Class in org.hsqldb.lib.tar
-
 
-
TarReaderMain() - Constructor for class org.hsqldb.lib.tar.TarReaderMain
-
 
-
TEMP_FILE_PREFIX - Static variable in class org.hsqldb.jdbc.JDBCBlobFile
-
 
-
TEMP_FILE_PREFIX - Static variable in class org.hsqldb.jdbc.JDBCClobFile
-
 
-
TEMP_FILE_SUFFIX - Static variable in class org.hsqldb.jdbc.JDBCBlobFile
-
 
-
TEMP_FILE_SUFFIX - Static variable in class org.hsqldb.jdbc.JDBCClobFile
-
 
-
test(E) - Method in interface org.hsqldb.lib.FilteredIterator.Filter
-
 
-
THIS_VERSION - Static variable in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
 
-
threadConnection - Variable in class org.hsqldb.jdbc.JDBCDriver
-
-
As a separate instance of this class is registered with DriverManager - for each class loader, the threadConnection is not declared as static.
-
-
threadedDBM() - Static method in class org.hsqldb.util.DatabaseManager
-
 
-
ThreadFactory - Interface in org.hsqldb.lib
-
 
-
THROW_BEHAVIOR - Static variable in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
THROW_BEHAVIOR - Static variable in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
ti - Variable in class org.hsqldb.util.RCData
-
 
-
tiToString(int) - Static method in class org.hsqldb.util.RCData
-
-
Return a String representation for the given numerical - java.sql.Connection Transaction level.
-
-
toAdjustedArray(Object, Object, int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns an array containing the elements of parameter source, with one - element removed or added.
-
-
toAdjustedArray(T[], T) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns a new array containing the elements of parameter source with an - added element at the end.
-
-
toAdjustedColumnArray(int[], int[], int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
similar to the function with single colindex, but with multiple - adjustments.
-
-
toAdjustedColumnArray(int[], int, int) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns a new array with the elements in collar adjusted to reflect - changes at colindex.
-
-
toArray() - Method in class org.hsqldb.lib.HashSet
-
 
-
toArray() - Method in class org.hsqldb.lib.HsqlArrayList
-
 
-
toArray() - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
toArray() - Method in class org.hsqldb.lib.IntHashSet
-
 
-
toArray() - Method in class org.hsqldb.lib.LongDeque
-
 
-
toArray() - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
toArray() - Method in class org.hsqldb.lib.OrderedLongHashSet
-
 
-
toArray(int[]) - Method in class org.hsqldb.lib.IntHashSet
-
 
-
toArray(int[]) - Method in class org.hsqldb.lib.LongDeque
-
 
-
toArray(long[]) - Method in class org.hsqldb.lib.LongDeque
-
 
-
toArray(T[]) - Method in class org.hsqldb.lib.HashSet
-
 
-
toArray(T[]) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Copies all elements of the list to a[].
-
-
toArray(T[]) - Method in class org.hsqldb.lib.HsqlDeque
-
 
-
toArray(T[]) - Method in class org.hsqldb.lib.OrderedHashSet
-
 
-
toArraySlice(E[], int, int) - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Copies elements of the list from start to limit to array.
-
-
toBinaryUUID(String) - Static method in class org.hsqldb.lib.StringConverter
-
-
Returns a byte[] representation in UUID form from a UUID string.
-
-
toByteArray() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Retrieves a copy of this stream's accumulated data, as a byte array.
-
-
toByteArray() - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
toByteArray(long, long) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
converts two longs to a byte[]
-
-
toByteArrayInputStream() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Performs an efficient (zero-copy) conversion of the data accumulated in - this output stream to an input stream.
-
-
toCharArray() - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
toCharArray() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Creates a newly allocated character array.
-
-
toCharArrayReader() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Performs an efficient (zero-copy) conversion of the character data - accumulated in this writer to a reader.
-
-
toJSONString(String, StringBuilder) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
toLowerSubset(String, char) - Static method in class org.hsqldb.lib.StringUtil
-
-
Returns a string with non alphanumeric chars converted to the - substitute character.
-
-
toNativeLs(String) - Static method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
 
-
toPaddedString(String, int, char, boolean) - Static method in class org.hsqldb.lib.StringUtil
-
 
-
toPaddedString(String, int, String, boolean) - Static method in class org.hsqldb.lib.StringUtil
-
 
-
toQuotedString(String, char, boolean) - Static method in class org.hsqldb.lib.StringConverter
-
-
Returns the quoted version of the string using the quotechar argument.
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCArray
-
-
Returns a string representation in the form ARRAY[..., ...]
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCArrayBasic
-
-
Returns a string representation in the form ARRAY[..., ...]
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCColumnMetaData
-
-
Retrieves a String representation of this object.
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Retrieves a String representation of this object.
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Retrieves a String representation of this object.
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Returns a string representation of the object.
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCRowId
-
-
Returns a String representing the value of the SQL ROWID designated by this - java.sql.RowId object.
-
-
toString() - Method in class org.hsqldb.jdbc.JDBCSavepoint
-
 
-
toString() - Method in class org.hsqldb.jdbc.pool.JDBCXID
-
 
-
toString() - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
toString() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Converts this stream's accumulated data into a string, translating bytes - into characters according to the platform's default character encoding.
-
-
toString() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Converts this writer's accumulated data into a string.
-
-
toString() - Method in class org.hsqldb.lib.CountUpDownLatch
-
-
Returns a string representation of this object.
-
-
toString() - Method in class org.hsqldb.lib.HashSet
-
-
Returns a String like "[Drei, zwei, Eins]", exactly like - java.util.HashSet.
-
-
toString() - Method in class org.hsqldb.lib.HsqlArrayHeap
-
 
-
toString() - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
toString() - Method in class org.hsqldb.lib.MapEntry
-
 
-
toString() - Method in class org.hsqldb.lib.RefCapablePropertyResourceBundle
-
-
Just identifies this RefCapablePropertyResourceBundle instance.
-
-
toString() - Method in class org.hsqldb.lib.StopWatch
-
-
Retrieves the internal state of this object, as a String.
-
-
toString() - Method in enum org.hsqldb.lib.tar.RB
-
 
-
toString() - Method in class org.hsqldb.server.ServerAcl
-
 
-
toString() - Method in class org.hsqldb.util.RCData
-
-
DISABLED DUE TO SECURITY CONCERNS.
-
-
toString(String) - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Converts this stream's accumulated data into a string, translating bytes - into characters according to the specified character encoding.
-
-
toString(String) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
toStringUUID(byte[]) - Static method in class org.hsqldb.lib.StringConverter
-
-
Returns a string representation in UUID form from a binary string.
-
-
toZeroPaddedString(long, int, int) - Static method in class org.hsqldb.lib.StringUtil
-
-
If necessary, adds zeros to the beginning of a value so that the total - length matches the given precision, otherwise trims the right digits.
-
-
trace(String) - Method in class org.hsqldb.util.Transfer
-
 
-
Transfer - Class in org.hsqldb.util
-
-
Utility program (or applet) for transferring tables between different - databases via JDBC.
-
-
Transfer() - Constructor for class org.hsqldb.util.Transfer
-
 
-
translateAddressProperty(HsqlProperties) - Static method in class org.hsqldb.server.ServerConfiguration
-
-
Translates null or zero length value for address key to the - special value ServerConstants.SC_DEFAULT_ADDRESS which causes - ServerSockets to be constructed without specifying an InetAddress.
-
-
translateDefaultDatabaseProperty(HsqlProperties) - Static method in class org.hsqldb.server.ServerConfiguration
-
-
Translates the legacy default database form: database=...
-
-
translateDefaultNoSystemExitProperty(HsqlProperties) - Static method in class org.hsqldb.server.ServerConfiguration
-
-
Translates unspecified no_system_exit property to false, the default - typically required when a Server is started from the command line.
-
-
Trigger - Interface in org.hsqldb.trigger
-
-
The interface a HyperSQL TRIGGER must implement.
-
-
trim() - Method in class org.hsqldb.lib.HsqlArrayList
-
-
Trims the array to be the same size as the number of elements.
-
-
trimToSize() - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Attempts to reduce this stream's capacity to its current size.
-
-
trimToSize() - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Attempts to reduce this writer's buffer capacity to its current size.
-
-
truncate(long) - Method in class org.hsqldb.jdbc.JDBCBlob
-
-
Truncates the BLOB value that this Blob - object represents to be len bytes in length.
-
-
truncate(long) - Method in class org.hsqldb.jdbc.JDBCBlobClient
-
-
Truncates the BLOB value that this Blob - object represents to be len bytes in length.
-
-
truncate(long) - Method in class org.hsqldb.jdbc.JDBCBlobFile
-
-
Truncates the BLOB value that this Blob - object represents to be len bytes in length.
-
-
truncate(long) - Method in class org.hsqldb.jdbc.JDBCClob
-
-
Truncates the CLOB value that this Clob - designates to have a length of len - characters.
-
-
truncate(long) - Method in class org.hsqldb.jdbc.JDBCClobClient
-
-
Truncates the CLOB value that this Clob - designates to have a length of len characters.
-
-
truncate(long) - Method in class org.hsqldb.jdbc.JDBCClobFile
-
-
Truncates the CLOB value that this Clob - designates to have a length of len - characters.
-
-
truststore - Variable in class org.hsqldb.util.RCData
-
 
-
tryLock() - Method in class org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
 
-
tryLock(long, TimeUnit) - Method in class org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
 
-
TYPE_ABSTIME - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_BIT - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_BLOB - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_BOOL - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_BOX - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_BPCHAR - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_BPCHARARRAY - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_BYTEA - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_CHAR - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_CHAR2 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_CHAR4 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_CHAR8 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_CID - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_CIDR - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_DATE - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_DATETIME - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_FILENAME - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_FLOAT4 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_FLOAT8 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_INET - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_INT2 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_INT2VECTOR - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_INT4 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_INT8 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_LSEG - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_MACADDR - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_MONEY - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_NAME - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_NUMERIC - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_OID - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_OIDINT2 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_OIDINT4 - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_OIDNAME - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_OIDVECTOR - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_PATH - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_POINT - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_POLYGON - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_RECORD - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_REGPROC - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_RELTIME - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_SET - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TEXT - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TEXTARRAY - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TID - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TIME - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TIME_WITH_TMZONE - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TIMESTAMP - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TIMESTAMP_NO_TMZONE - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TINTERVAL - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_TINYINT - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_UNKNOWN - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_UUID - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_VARBIT - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_VARCHAR - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_VARCHARARRAY - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_VOID - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_XID - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_XML - Static variable in class org.hsqldb.server.PgType
-
 
-
TYPE_XMLARRAY - Static variable in class org.hsqldb.server.PgType
-
 
-
typeflag - org.hsqldb.lib.tar.TarHeaderField
-
 
-
- - - -

U

-
-
uid - org.hsqldb.lib.tar.TarHeaderField
-
 
-
uname - org.hsqldb.lib.tar.TarHeaderField
-
 
-
unarchive(String, String, FileAccess, int) - Static method in class org.hsqldb.lib.FileArchiver
-
 
-
unexpected_header_key - org.hsqldb.lib.tar.RB
-
 
-
unicodeEscapedToString(String) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
unicodeStringToString(String) - Static method in class org.hsqldb.lib.StringConverter
-
-
Hsqldb specific decoding used only for log files.
-
-
union(int[], int[]) - Static method in class org.hsqldb.lib.ArrayUtil
-
-
Returns an array that contains all the elements of the two arrays.
-
-
unlock() - Method in class org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
 
-
unsupported_entry_present - org.hsqldb.lib.tar.RB
-
 
-
unsupported_ext - org.hsqldb.lib.tar.RB
-
 
-
unsupported_mode - org.hsqldb.lib.tar.RB
-
 
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCConnection
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Returns an object that implements the given interface to allow access to non-standard methods, - or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCDataSource
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCParameterMetaData
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCPool
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCPreparedStatement
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCResultSetMetaData
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
unwrap(Class<T>) - Method in class org.hsqldb.jdbc.JDBCStatement
-
-
Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
-
-
UPCallbackHandler(String, String) - Constructor for class org.hsqldb.auth.JaasAuthBean.UPCallbackHandler
-
 
-
UPDATE_AFTER - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
UPDATE_AFTER_ROW - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
UPDATE_BEFORE_ROW - Static variable in interface org.hsqldb.trigger.Trigger
-
 
-
updateArray(int, Array) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Array value.
-
-
updateArray(String, Array) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Array value.
-
-
updateAsciiStream(int, InputStream) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an ascii stream value.
-
-
updateAsciiStream(int, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
(JDBC4 clarification:) - Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
-
-
updateAsciiStream(int, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
-
-
updateAsciiStream(String, InputStream) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an ascii stream value.
-
-
updateAsciiStream(String, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
(JDBC4 clarification:) - Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
-
-
updateAsciiStream(String, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
-
-
updateBigDecimal(int, BigDecimal) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.math.BigDecimal - value.
-
-
updateBigDecimal(String, BigDecimal) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.BigDecimal - value.
-
-
updateBinaryStream(int, InputStream) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a binary stream value.
-
-
updateBinaryStream(int, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
(JDBC4 clarification:) - Updates the designated column with a binary stream value, which will have - the specified number of bytes.
-
-
updateBinaryStream(int, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a binary stream value, which will have - the specified number of bytes.
-
-
updateBinaryStream(String, InputStream) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a binary stream value.
-
-
updateBinaryStream(String, InputStream, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
(JDBC4 clarification:) - Updates the designated column with a binary stream value, which will have - the specified number of bytes.
-
-
updateBinaryStream(String, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a binary stream value, which will have - the specified number of bytes.
-
-
updateBlob(int, InputStream) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given input stream.
-
-
updateBlob(int, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given input stream, which - will have the specified number of bytes.
-
-
updateBlob(int, Blob) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Blob value.
-
-
updateBlob(String, InputStream) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given input stream.
-
-
updateBlob(String, InputStream, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given input stream, which - will have the specified number of bytes.
-
-
updateBlob(String, Blob) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Blob value.
-
-
updateBoolean(int, boolean) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a boolean value.
-
-
updateBoolean(String, boolean) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a boolean value.
-
-
updateByte(int, byte) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a byte value.
-
-
updateByte(String, byte) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a byte value.
-
-
updateBytes(int, byte[]) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a byte array value.
-
-
updateBytes(String, byte[]) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a byte array value.
-
-
updateCharacterStream(int, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value.
-
-
updateCharacterStream(int, Reader, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
(JDBC4 clarification:) - Updates the designated column with a character stream value, which will have - the specified number of (CHECKME: characters?) bytes.
-
-
updateCharacterStream(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value, which will have - the specified number of bytes.
-
-
updateCharacterStream(String, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value.
-
-
updateCharacterStream(String, Reader, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
(JDBC4 clarification) - Updates the designated column with a character stream value, which will have - the specified number of (CHECKME: characters?) bytes.
-
-
updateCharacterStream(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value, which will have - the specified number of bytes.
-
-
updateClob(int, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - object.
-
-
updateClob(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - object, which is the given number of characters long.
-
-
updateClob(int, Clob) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Clob value.
-
-
updateClob(String, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - object.
-
-
updateClob(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - object, which is the given number of characters long.
-
-
updateClob(String, Clob) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Clob value.
-
-
updateDate(int, Date) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Date value.
-
-
updateDate(String, Date) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Date value.
-
-
updateDouble(int, double) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a double value.
-
-
updateDouble(String, double) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a double value.
-
-
updateFloat(int, float) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a float value.
-
-
updateFloat(String, float) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a float value.
-
-
updateInt(int, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an int value.
-
-
updateInt(String, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an int value.
-
-
updateLong(int, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a long value.
-
-
updateLong(String, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a long value.
-
-
updateNCharacterStream(int, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value.
-
-
updateNCharacterStream(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value, which will have - the specified number of bytes.
-
-
updateNCharacterStream(String, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value.
-
-
updateNCharacterStream(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a character stream value, which will have - the specified number of bytes.
-
-
updateNClob(int, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - - The data will be read from the stream - as needed until end-of-stream is reached.
-
-
updateNClob(int, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - object, which is the given number of characters long.
-
-
updateNClob(int, NClob) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.NClob value.
-
-
updateNClob(String, Reader) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - object.
-
-
updateNClob(String, Reader, long) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column using the given Reader - object, which is the given number of characters long.
-
-
updateNClob(String, NClob) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.NClob value.
-
-
updateNString(int, String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a String value.
-
-
updateNString(String, String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a String value.
-
-
updateNull(int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
(JDBC4 clarification:) - Updates the designated column with a null value.
-
-
updateNull(String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a null value.
-
-
updateObject(int, Object) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateObject(int, Object, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateObject(int, Object, SQLType) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateObject(int, Object, SQLType, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateObject(String, Object) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateObject(String, Object, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateObject(String, Object, SQLType) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateObject(String, Object, SQLType, int) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with an Object value.
-
-
updateRef(int, Ref) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Ref value.
-
-
updateRef(String, Ref) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Ref value.
-
-
updateRow() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the underlying database with the new contents of the - current row of this ResultSet object.
-
-
updateRowId(int, RowId) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a RowId value.
-
-
updateRowId(String, RowId) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a RowId value.
-
-
updatesAreDetected(int) - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether or not a visible row update can be detected by - calling the method ResultSet.rowUpdated.
-
-
updateShort(int, short) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a short value.
-
-
updateShort(String, short) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a short value.
-
-
updateSQLXML(int, SQLXML) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.SQLXML value.
-
-
updateSQLXML(String, SQLXML) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.SQLXML value.
-
-
updateString(int, String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a String value.
-
-
updateString(String, String) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a String value.
-
-
updateTime(int, Time) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Time value.
-
-
updateTime(String, Time) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Time value.
-
-
updateTimestamp(int, Timestamp) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Timestamp - value.
-
-
updateTimestamp(String, Timestamp) - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Updates the designated column with a java.sql.Timestamp - value.
-
-
url - Variable in class org.hsqldb.util.RCData
-
 
-
username - Variable in class org.hsqldb.util.RCData
-
 
-
usesLocalFilePerTable() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database uses a file for each table.
-
-
usesLocalFiles() - Method in class org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
Retrieves whether this database stores tables in a local file.
-
-
- - - -

V

-
-
validate() - Method in class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
validate() - Method in class org.hsqldb.server.ServerProperties
-
-
Validates according to Meta map, and sets System Properties for those - properties with names matching the requisite pattern.
-
-
ValidatingResourceBundle - Class in org.hsqldb.lib
-
-
Purpose of this class is to wrap a RefCapablePropertyResourceBundle to - reliably detect any possible use of a missing property key as soon as - this class is clinitted.
-
-
ValidatingResourceBundle(String, Class<? extends Enum<?>>) - Constructor for class org.hsqldb.lib.ValidatingResourceBundle
-
 
-
valueCount(Object) - Method in class org.hsqldb.lib.MultiValueHashMap
-
-
Counts the values associated with the key.
-
-
valueOf(String) - Static method in enum org.hsqldb.lib.tar.RB
-
-
Returns the enum constant of this type with the specified name.
-
-
valueOf(String) - Static method in enum org.hsqldb.lib.tar.TarHeaderField
-
-
Returns the enum constant of this type with the specified name.
-
-
values() - Method in class org.hsqldb.lib.HashMap
-
 
-
values() - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
values() - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
values() - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
values() - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
values() - Method in class org.hsqldb.lib.IntValueHashMap
-
 
-
values() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
values() - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
values() - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
values() - Method in class org.hsqldb.lib.LongValueHashMap
-
 
-
values() - Method in interface org.hsqldb.lib.Map
-
 
-
values() - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
values() - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
values() - Static method in enum org.hsqldb.lib.tar.RB
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
values() - Static method in enum org.hsqldb.lib.tar.TarHeaderField
-
-
Returns an array containing the constants of this enum type, in -the order they are declared.
-
-
valuesToArray() - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
valuesToArray() - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
valuesToArray() - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
valuesToArray(int[]) - Method in class org.hsqldb.lib.IntKeyIntValueHashMap
-
 
-
valuesToArray(int[]) - Method in class org.hsqldb.lib.LongKeyIntValueHashMap
-
 
-
valuesToArray(long[]) - Method in class org.hsqldb.lib.IntKeyLongValueHashMap
-
 
-
valuesToArray(long[]) - Method in class org.hsqldb.lib.LongKeyLongValueHashMap
-
 
-
valuesToArray(T[]) - Method in class org.hsqldb.lib.HashMap
-
 
-
valuesToArray(T[]) - Method in class org.hsqldb.lib.IntKeyHashMap
-
 
-
valuesToArray(T[]) - Method in class org.hsqldb.lib.IntKeyHashMapConcurrent
-
 
-
valuesToArray(T[]) - Method in class org.hsqldb.lib.LongKeyHashMap
-
 
-
valuesToArray(T[]) - Method in class org.hsqldb.lib.MultiValueHashMap
-
 
-
valuesToArray(T[]) - Method in class org.hsqldb.lib.OrderedLongKeyHashMap
-
 
-
valueString(Object) - Method in class org.hsqldb.server.PgType
-
 
-
- - - -

W

-
-
warning(String) - Method in class org.hsqldb.lib.FrameworkLogger
-
 
-
warning(String, Throwable) - Method in class org.hsqldb.lib.FrameworkLogger
-
-
Just like FrameworkLogger.warning(String), but also logs a stack trace.
-
-
wasNull() - Method in class org.hsqldb.jdbc.JDBCCallableStatement
-
-
Retrieves whether the last OUT parameter read had the value of - SQL NULL.
-
-
wasNull() - Method in class org.hsqldb.jdbc.JDBCResultSet
-
-
Reports whether - the last column read had a value of SQL NULL.
-
-
WebServer - Class in org.hsqldb.server
-
-
The HyperSQL http: and https: protocol network database server.
-
-
WebServer() - Constructor for class org.hsqldb.server.WebServer
-
 
-
windowActivated(WindowEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
windowActivated(WindowEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
windowActivated(WindowEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
windowClosed(WindowEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
windowClosed(WindowEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
windowClosed(WindowEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
windowClosing(WindowEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
windowClosing(WindowEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
windowClosing(WindowEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
windowDeactivated(WindowEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
windowDeactivated(WindowEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
windowDeactivated(WindowEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
windowDeiconified(WindowEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
windowDeiconified(WindowEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
windowDeiconified(WindowEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
windowIconified(WindowEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
windowIconified(WindowEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
windowIconified(WindowEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
windowOpened(WindowEvent) - Method in class org.hsqldb.util.DatabaseManager
-
 
-
windowOpened(WindowEvent) - Method in class org.hsqldb.util.DatabaseManagerSwing
-
 
-
windowOpened(WindowEvent) - Method in class org.hsqldb.util.Transfer
-
 
-
withinGlobalTransaction() - Method in class org.hsqldb.jdbc.pool.JDBCXAResource
-
 
-
work(String[]) - Static method in class org.hsqldb.util.Transfer
-
 
-
workfile_delete_fail - org.hsqldb.lib.tar.RB
-
 
-
WrapperIterator<E> - Class in org.hsqldb.lib
-
-
An Iterator that returns the elements of a specified array, or other - iterators etc.
-
-
WrapperIterator() - Constructor for class org.hsqldb.lib.WrapperIterator
-
-
Constructor for an empty iterator.
-
-
WrapperIterator(Object) - Constructor for class org.hsqldb.lib.WrapperIterator
-
-
Constructor for a singleton object iterator
-
-
WrapperIterator(Object[]) - Constructor for class org.hsqldb.lib.WrapperIterator
-
-
Constructor for all elements of the specified array.
-
-
WrapperIterator(Object[], boolean) - Constructor for class org.hsqldb.lib.WrapperIterator
-
-
Constructor for not-null elements of specified array.
-
-
WrapperIterator(Iterator<E>, Iterator<E>) - Constructor for class org.hsqldb.lib.WrapperIterator
-
-
Constructor for a chained iterator that returns the elements of the two - specified iterators.
-
-
write() - Method in class org.hsqldb.lib.tar.DbBackup
-
-
This method always backs up the .properties and .script files.
-
-
write() - Method in class org.hsqldb.lib.tar.TarGenerator
-
-
This method does release all of the streams, even if there is a failure.
-
-
write(byte[]) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
write(byte[], int) - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
This class and subclasses should write to the underlying writeStream - ONLY WITH THIS METHOD.
-
-
write(byte[], int, int) - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Writes the specified portion of the designated octet sequence.
-
-
write(byte[], int, int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
write(char[], int, int) - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Writes the designated portion of the designated character array
-
-
write(char[], int, int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
write(int) - Method in class org.hsqldb.lib.AsciiOutputStream
-
 
-
write(int) - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
write(int) - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Writes the specified single byte.
-
-
write(int) - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Writes the specified single character.
-
-
write(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
write(int) - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
The normal way to write file data (as opposed to header data or padding) - using this class.
-
-
write(InputStream, int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
write(InputStream, long) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
write(Reader, int) - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
write(Reader, int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
write(Reader, long) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
write(String, int, int) - Method in class org.hsqldb.lib.CharArrayWriter
-
 
-
write(String, int, int) - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Efficiently writes the designated portion of the designated string.
-
-
write_count_mismatch - org.hsqldb.lib.tar.RB
-
 
-
write_queue_report - org.hsqldb.lib.tar.RB
-
 
-
writeAsFiles() - Method in class org.hsqldb.lib.tar.DbBackup
-
 
-
writeBlock(byte[]) - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Write a user-specified 512-byte block.
-
-
writeBoolean(boolean) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeBoolean(boolean) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeBuffer - Variable in class org.hsqldb.lib.tar.TarFileOutputStream
-
 
-
writeByte(int) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeByte(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeBytes(String) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeBytes(String) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeChar(int) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeChar(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeChars(char[]) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeChars(char[]) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeChars(char[], int) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeChars(String) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeChars(String) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeDouble(double) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeDouble(double) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeFloat(float) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeFloat(float) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeHexBytes(byte[], int, byte[]) - Static method in class org.hsqldb.lib.StringConverter
-
-
Converts a byte array into hexadecimal characters which are written as - ASCII to the given output stream.
-
-
writeInt(int) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeInt(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeLock() - Method in class org.hsqldb.lib.ReadWriteLockDummy
-
 
-
writeLong(long) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeLong(long) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeNoCheck(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writePadBlock() - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Writes a single zero'd block.
-
-
writePadBlocks(int) - Method in class org.hsqldb.lib.tar.TarFileOutputStream
-
-
Writes the specified quantity of zero'd blocks.
-
-
writeShort(int) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeShort(int) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeTo(OutputStream) - Method in class org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
Writes the complete contents of this stream's accumulated data to the - specified output stream.
-
-
writeTo(OutputStream) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeTo(Writer) - Method in class org.hsqldb.lib.ClosableCharArrayWriter
-
-
Writes the complete contents of this writer's buffered data to the - specified writer.
-
-
writeUTF(String) - Method in class org.hsqldb.lib.DataOutputStream
-
 
-
writeUTF(String) - Method in class org.hsqldb.lib.HsqlByteArrayOutputStream
-
 
-
writeUUIDHexBytes(byte[], int, byte[]) - Static method in class org.hsqldb.lib.StringConverter
-
 
-
- - - -

Z

-
-
zero() - Method in class org.hsqldb.lib.StopWatch
-
-
Zeros accumulated running time and restarts this object.
-
-
zero_write - org.hsqldb.lib.tar.RB
-
 
-
zeroSize() - Method in class org.hsqldb.lib.LongDeque
-
 
-
-A B C D E F G H I J K L M N O P Q R S T U V W Z 
All Classes All Packages
-
- - - diff --git a/database/hsqldb/doc/apidocs/index.html b/database/hsqldb/doc/apidocs/index.html deleted file mode 100644 index 6c65de00..00000000 --- a/database/hsqldb/doc/apidocs/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -HSQLDB 2.7.2 API - - - - - - - -
- -

org.hsqldb/module-summary.html

-
- - diff --git a/database/hsqldb/doc/apidocs/javadoc.css b/database/hsqldb/doc/apidocs/javadoc.css deleted file mode 100644 index 7345ff2b..00000000 --- a/database/hsqldb/doc/apidocs/javadoc.css +++ /dev/null @@ -1,600 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ - -@import url('resources/fonts/dejavu.css'); - -body { - background-color:#ffffff; - color:#353833; - font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; - font-size:14px; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4A6782; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4A6782; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; -} -h1 { - font-size:16px; -} -h2 { - font-size:15px; -} -h3 { - font-size:14px; - font-style:italic; -} -h4 { - font-size:13px; -} -h5 { - font-size:12px; -} -h6 { - font-size:11px; -} -ul { - list-style-type:disc; -} -code, tt { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; - margin-top:8px; - line-height:1.4em; -} -dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; -} -table tr td dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - vertical-align:top; - padding-top:4px; -} -sup { - font-size:8px; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:11px; - z-index:200; - margin-top:-9px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-color:#4D7A97; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:11px; - margin:0; -} -.topNav { - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.bottomNav { - margin-top:10px; - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.subNav { - background-color:#dee3e9; - float:left; - width:100%; - overflow:hidden; - font-size:12px; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; - text-transform:uppercase; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding: 5px 6px; - text-transform:uppercase; -} -ul.subNavList li{ - list-style:none; - float:left; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; - text-transform:uppercase; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; - text-transform:uppercase; -} -.navBarCell1Rev { - background-color:#F8981D; - color:#253441; - margin: auto 5px; -} -.skipNav { - position:absolute; - top:auto; - left:-9999px; - overflow:hidden; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader span{ - margin-right:15px; -} -.indexHeader h1 { - font-size:13px; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 15px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:13px; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:12px; -} -.indexContainer h2 { - font-size:13px; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; - padding-top:2px; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:12px; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:5px 0 10px 0px; - font-size:14px; - font-family:'DejaVu Sans Mono',monospace; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:15px; - line-height:1.4; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #ededed; - background-color:#f8f8f8; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { - width:100%; - border-left:1px solid #EEE; - border-right:1px solid #EEE; - border-bottom:1px solid #EEE; -} -.overviewSummary, .memberSummary { - padding:0px; -} -.overviewSummary caption, .memberSummary caption, .typeSummary caption, -.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#253441; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - padding-top:10px; - padding-left:1px; - margin:0px; - white-space:pre; -} -.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, -.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, -.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, -.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, -.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, -.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, -.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, -.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, -.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - padding-bottom:7px; - display:inline-block; - float:left; - background-color:#F8981D; - border: none; - height:16px; -} -.memberSummary caption span.activeTableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#F8981D; - height:16px; -} -.memberSummary caption span.tableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#4D7A97; - height:16px; -} -.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { - padding-top:0px; - padding-left:0px; - padding-right:0px; - background-image:none; - float:none; - display:inline; -} -.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, -.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { - display:none; - width:5px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .activeTableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .tableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - background-color:#4D7A97; - float:left; - -} -.overviewSummary td, .memberSummary td, .typeSummary td, -.useSummary td, .constantsSummary td, .deprecatedSummary td { - text-align:left; - padding:0px 0px 12px 10px; -} -th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, -td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ - vertical-align:top; - padding-right:0px; - padding-top:8px; - padding-bottom:3px; -} -th.colFirst, th.colLast, th.colOne, .constantsSummary th { - background:#dee3e9; - text-align:left; - padding:8px 3px 3px 7px; -} -td.colFirst, th.colFirst { - white-space:nowrap; - font-size:13px; -} -td.colLast, th.colLast { - font-size:13px; -} -td.colOne, th.colOne { - font-size:13px; -} -.overviewSummary td.colFirst, .overviewSummary th.colFirst, -.useSummary td.colFirst, .useSummary th.colFirst, -.overviewSummary td.colOne, .overviewSummary th.colOne, -.memberSummary td.colFirst, .memberSummary th.colFirst, -.memberSummary td.colOne, .memberSummary th.colOne, -.typeSummary td.colFirst{ - width:25%; - vertical-align:top; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -.tableSubHeadingColor { - background-color:#EEEEFF; -} -.altColor { - background-color:#FFFFFF; -} -.rowColor { - background-color:#EEEEEF; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - font-style:normal; -} - -div.block { - font-size:14px; - font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; -} - -td.colLast div { - padding-top:0px; -} - - -td.colLast a { - padding-bottom:3px; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:10px; -} -.block { - display:block; - margin:3px 10px 2px 0px; - color:#474747; -} -.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, -.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, -.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { - font-weight:bold; -} -.deprecationComment, .emphasizedPhrase, .interfaceName { - font-style:italic; -} - -div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, -div.block div.block span.interfaceName { - font-style:normal; -} - -div.contentContainer ul.blockList li.blockList h2{ - padding-bottom:0px; -} - -/* HyperSQL Javadoc styles */ -DIV.ReleaseSpecificDocumentation { - color: #006A00; - background-color: #EEEEFF; - border: none; - padding-top: 5px; - padding-right: 10px; - padding-bottom: 5px; - padding-left: 10px; -} - -DIV.ReleaseSpecificDocumentation h1 { - margin-top: 0px; - margin-left: 0px; - margin-right: 0px; - padding-top: 14px; - padding-right: 0px; - padding-bottom: 15px; - padding-left: 50px; - background: url(hsqldbs.png) #E6E6FF no-repeat left center; - border: none; - font-size: 14px; - -} - diff --git a/database/hsqldb/doc/apidocs/jquery/external/jquery/jquery.js b/database/hsqldb/doc/apidocs/jquery/external/jquery/jquery.js deleted file mode 100644 index 50937333..00000000 --- a/database/hsqldb/doc/apidocs/jquery/external/jquery/jquery.js +++ /dev/null @@ -1,10872 +0,0 @@ -/*! - * jQuery JavaScript Library v3.5.1 - * https://jquery.com/ - * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2020-05-04T22:49Z - */ -( function( global, factory ) { - - "use strict"; - - if ( typeof module === "object" && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var flat = arr.flat ? function( array ) { - return arr.flat.call( array ); -} : function( array ) { - return arr.concat.apply( [], array ); -}; - - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - -var document = window.document; - - - - var preservedScriptAttributes = { - type: true, - src: true, - nonce: true, - noModule: true - }; - - function DOMEval( code, node, doc ) { - doc = doc || document; - - var i, val, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - - // Support: Firefox 64+, Edge 18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.5.1", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - even: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return ( i + 1 ) % 2; - } ) ); - }, - - odd: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return i % 2; - } ) ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - copy = options[ name ]; - - // Prevent Object.prototype pollution - // Prevent never-ending loop - if ( name === "__proto__" || target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - src = target[ name ]; - - // Ensure proper type for the source value - if ( copyIsArray && !Array.isArray( src ) ) { - clone = []; - } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { - clone = {}; - } else { - clone = src; - } - copyIsArray = false; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a provided context; falls back to the global one - // if not specified. - globalEval: function( code, options, doc ) { - DOMEval( code, { nonce: options && options.nonce }, doc ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return flat( ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.5 - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://js.foundation/ - * - * Date: 2020-03-14 - */ -( function( window ) { -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - nonnativeSelectorCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ( {} ).hasOwnProperty, - arr = [], - pop = arr.pop, - pushNative = arr.push, - push = arr.push, - slice = arr.slice, - - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[ i ] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + - "ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram - identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + - "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - - // "Attribute values must be CSS identifiers [capture 5] - // or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + - whitespace + "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + - whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + - "*" ), - rdescend = new RegExp( whitespace + "|>" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + - "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rhtml = /HTML$/i, - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), - funescape = function( escape, nonHex ) { - var high = "0x" + escape.slice( 1 ) - 0x10000; - - return nonHex ? - - // Strip the backslash prefix from a non-hex escape sequence - nonHex : - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + - ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - inDisabledFieldset = addCombinator( - function( elem ) { - return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - ( arr = slice.call( preferredDoc.childNodes ) ), - preferredDoc.childNodes - ); - - // Support: Android<4.0 - // Detect silently failing push.apply - // eslint-disable-next-line no-unused-expressions - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - pushNative.apply( target, slice.call( els ) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - - // Can't trust NodeList.length - while ( ( target[ j++ ] = els[ i++ ] ) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - setDocument( context ); - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { - - // ID selector - if ( ( m = match[ 1 ] ) ) { - - // Document context - if ( nodeType === 9 ) { - if ( ( elem = context.getElementById( m ) ) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && ( elem = newContext.getElementById( m ) ) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[ 2 ] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && - - // Support: IE 8 only - // Exclude object elements - ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { - - newSelector = selector; - newContext = context; - - // qSA considers elements outside a scoping root when evaluating child or - // descendant combinators, which is not what we want. - // In such cases, we work around the behavior by prefixing every selector in the - // list with an ID selector referencing the scope context. - // The technique has to be used as well when a leading combinator is used - // as such selectors are not recognized by querySelectorAll. - // Thanks to Andrew Dupont for this technique. - if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - - // We can use :scope instead of the ID hack if the browser - // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { - - // Capture the context ID, setting it first if necessary - if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", ( nid = expando ) ); - } - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + - toSelector( groups[ i ] ); - } - newSelector = groups.join( "," ); - } - - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - nonnativeSelectorCache( selector, true ); - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return ( cache[ key + " " ] = value ); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement( "fieldset" ); - - try { - return !!fn( el ); - } catch ( e ) { - return false; - } finally { - - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split( "|" ), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[ i ] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( ( cur = cur.nextSibling ) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return ( name === "input" || name === "button" ) && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction( function( argument ) { - argument = +argument; - return markFunction( function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ ( j = matchIndexes[ i ] ) ] ) { - seed[ j ] = !( matches[ j ] = seed[ j ] ); - } - } - } ); - } ); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var namespace = elem.namespaceURI, - docElem = ( elem.ownerDocument || elem ).documentElement; - - // Support: IE <=8 - // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes - // https://bugs.jquery.com/ticket/4833 - return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, - // Safari 4 - 5 only, Opera <=11.6 - 12.x only - // IE/Edge & older browsers don't support the :scope pseudo-class. - // Support: Safari 6.0 only - // Safari 6.0 supports :scope but it's an alias of :root there. - support.scope = assert( function( el ) { - docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); - return typeof el.querySelectorAll !== "undefined" && - !el.querySelectorAll( ":scope fieldset div" ).length; - } ); - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert( function( el ) { - el.className = "i"; - return !el.getAttribute( "className" ); - } ); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert( function( el ) { - el.appendChild( document.createComment( "" ) ); - return !el.getElementsByTagName( "*" ).length; - } ); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - } ); - - // ID filter and find - if ( support.getById ) { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute( "id" ) === attrId; - }; - }; - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode( "id" ); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( ( elem = elems[ i++ ] ) ) { - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find[ "TAG" ] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { - - var input; - - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Firefox <=3.6 - 5 only - // Old Firefox doesn't throw on a badly-escaped identifier. - el.querySelectorAll( "\\\f" ); - rbuggyQSA.push( "[\\r\\n\\f]" ); - } ); - - assert( function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll( "[name=d]" ).length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: Opera 10 - 11 only - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll( "*,:x" ); - rbuggyQSA.push( ",.*:" ); - } ); - } - - if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector ) ) ) ) { - - assert( function( el ) { - - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - } ); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); - } : - function( a, b ) { - if ( b ) { - while ( ( b = b.parentNode ) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { - - // Choose the first element that is related to our preferred document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( a == document || a.ownerDocument == preferredDoc && - contains( preferredDoc, a ) ) { - return -1; - } - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( b == document || b.ownerDocument == preferredDoc && - contains( preferredDoc, b ) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - return a == document ? -1 : - b == document ? 1 : - /* eslint-enable eqeqeq */ - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( ( cur = cur.parentNode ) ) { - ap.unshift( cur ); - } - cur = b; - while ( ( cur = cur.parentNode ) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[ i ] === bp[ i ] ) { - i++; - } - - return i ? - - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[ i ], bp[ i ] ) : - - // Otherwise nodes in our document sort first - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - ap[ i ] == preferredDoc ? -1 : - bp[ i ] == preferredDoc ? 1 : - /* eslint-enable eqeqeq */ - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - setDocument( elem ); - - if ( support.matchesSelector && documentIsHTML && - !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch ( e ) { - nonnativeSelectorCache( expr, true ); - } - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( context.ownerDocument || context ) != document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( elem.ownerDocument || elem ) != document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[ 1 ] = match[ 1 ].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || - match[ 5 ] || "" ).replace( runescape, funescape ); - - if ( match[ 2 ] === "~=" ) { - match[ 3 ] = " " + match[ 3 ] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[ 1 ] = match[ 1 ].toLowerCase(); - - if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { - - // nth-* requires argument - if ( !match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[ 4 ] = +( match[ 4 ] ? - match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); - match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - - // other types prohibit arguments - } else if ( match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[ 6 ] && match[ 2 ]; - - if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[ 3 ] ) { - match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - - // Get excess from tokenize (recursively) - ( excess = tokenize( unquoted, true ) ) && - - // advance to the next closing parenthesis - ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { - - // excess is a negative index - match[ 0 ] = match[ 0 ].slice( 0, excess ); - match[ 2 ] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { - return true; - } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - ( pattern = new RegExp( "(^|" + whitespace + - ")" + className + "(" + whitespace + "|$)" ) ) && classCache( - className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); - } ); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - /* eslint-disable max-len */ - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - /* eslint-enable max-len */ - - }; - }, - - "CHILD": function( type, what, _argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, _context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( ( node = node[ dir ] ) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( ( node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - - // Use previously-cached element index if available - if ( useCache ) { - - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - - // Use the same loop as above to seek `elem` from the start - while ( ( node = ++nodeIndex && node && node[ dir ] || - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || - ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction( function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[ i ] ); - seed[ idx ] = !( matches[ idx ] = matched[ i ] ); - } - } ) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - - // Potentially complex pseudos - "not": markFunction( function( selector ) { - - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction( function( seed, matches, _context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( ( elem = unmatched[ i ] ) ) { - seed[ i ] = !( matches[ i ] = elem ); - } - } - } ) : - function( elem, _context, xml ) { - input[ 0 ] = elem; - matcher( input, null, xml, results ); - - // Don't keep the element (issue #299) - input[ 0 ] = null; - return !results.pop(); - }; - } ), - - "has": markFunction( function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - } ), - - "contains": markFunction( function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; - }; - } ), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - - // lang value must be a valid identifier - if ( !ridentifier.test( lang || "" ) ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( ( elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); - return false; - }; - } ), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && - ( !document.hasFocus || document.hasFocus() ) && - !!( elem.type || elem.href || ~elem.tabIndex ); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return ( nodeName === "input" && !!elem.checked ) || - ( nodeName === "option" && !!elem.selected ); - }, - - "selected": function( elem ) { - - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - // eslint-disable-next-line no-unused-expressions - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos[ "empty" ]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( ( attr = elem.getAttribute( "type" ) ) == null || - attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo( function() { - return [ 0 ]; - } ), - - "last": createPositionalPseudo( function( _matchIndexes, length ) { - return [ length - 1 ]; - } ), - - "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - } ), - - "even": createPositionalPseudo( function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "odd": createPositionalPseudo( function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? - argument + length : - argument > length ? - length : - argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ) - } -}; - -Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || ( match = rcomma.exec( soFar ) ) ) { - if ( match ) { - - // Don't consume trailing commas as valid - soFar = soFar.slice( match[ 0 ].length ) || soFar; - } - groups.push( ( tokens = [] ) ); - } - - matched = false; - - // Combinators - if ( ( match = rcombinators.exec( soFar ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - - // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || - ( match = preFilters[ type ]( match ) ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[ i ].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || - ( outerCache[ elem.uniqueID ] = {} ); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( ( oldCache = uniqueCache[ key ] ) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return ( newCache[ 2 ] = oldCache[ 2 ] ); - } else { - - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[ i ]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[ 0 ]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[ i ], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( ( elem = unmatched[ i ] ) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( - selector || "*", - context.nodeType ? [ context ] : context, - [] - ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( ( elem = temp[ i ] ) ) { - matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) ) { - - // Restore matcherIn since elem is not yet a final match - temp.push( ( matcherIn[ i ] = elem ) ); - } - } - postFinder( null, ( matcherOut = [] ), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { - - seed[ temp ] = !( results[ temp ] = elem ); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - } ); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[ 0 ].type ], - implicitRelative = leadingRelative || Expr.relative[ " " ], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - ( checkContext = context ).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[ j ].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens - .slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), - - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), - len = elems.length; - - if ( outermost ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - outermostContext = context == document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( !context && elem.ownerDocument != document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( ( matcher = elementMatchers[ j++ ] ) ) { - if ( matcher( elem, context || document, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - - // They will have gone through all possible matchers - if ( ( elem = !matcher && elem ) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( ( matcher = setMatchers[ j++ ] ) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !( unmatched[ i ] || setMatched[ i ] ) ) { - setMatched[ i ] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[ i ] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( - selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) - ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( ( selector = compiled.selector || selector ) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[ 0 ] = match[ 0 ].slice( 0 ); - if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - - context = ( Expr.find[ "ID" ]( token.matches[ 0 ] - .replace( runescape, funescape ), context ) || [] )[ 0 ]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[ i ]; - - // Abort if we hit a combinator - if ( Expr.relative[ ( type = token.type ) ] ) { - break; - } - if ( ( find = Expr.find[ type ] ) ) { - - // Search, expanding context for leading sibling combinators - if ( ( seed = find( - token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || - context - ) ) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert( function( el ) { - - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; -} ); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert( function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute( "href" ) === "#"; -} ) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - } ); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert( function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -} ) ) { - addHandle( "value", function( elem, _name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - } ); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert( function( el ) { - return el.getAttribute( "disabled" ) == null; -} ) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; - } - } ); -} - -return Sizzle; - -} )( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -}; -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, _i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, _i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, _i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( elem.contentDocument != null && - - // Support: IE 11+ - // elements with no `data` attribute has an object - // `contentDocument` with a `null` prototype. - getProto( elem.contentDocument ) ) { - - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( _i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the master Deferred - master = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return master.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); - } - - return master.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, _key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( _all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var documentElement = document.documentElement; - - - - var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); - }, - composed = { composed: true }; - - // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only - // Check attachment across shadow DOM boundaries when possible (gh-3504) - // Support: iOS 10.0-10.2 only - // Early iOS 10 versions support `attachShadow` but not `getRootNode`, - // leading to errors. We need to check for `getRootNode`. - if ( documentElement.getRootNode ) { - isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; - }; - } -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - isAttached( elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = elem.nodeType && - ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // Support: IE <=9 only - // IE <=9 replaces "; - support.option = !!div.lastChild; -} )(); - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { - - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var notAsync, result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); - this[ type ](); - result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - return result.value; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { - - // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - delegateType: delegateType - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px"; - tr.style.height = "1px"; - trChild.style.height = "9px"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( - dataPriv.get( cur, "events" ) || Object.create( null ) - )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script - if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( "\r\n"; - -// inject VBScript -document.write(IEBinaryToArray_ByteStr_Script); - -global.JSZipUtils._getBinaryFromXHR = function (xhr) { - var binary = xhr.responseBody; - var byteMapping = {}; - for ( var i = 0; i < 256; i++ ) { - for ( var j = 0; j < 256; j++ ) { - byteMapping[ String.fromCharCode( i + (j << 8) ) ] = - String.fromCharCode(i) + String.fromCharCode(j); - } - } - var rawBytes = IEBinaryToArray_ByteStr(binary); - var lastChr = IEBinaryToArray_ByteStr_Last(binary); - return rawBytes.replace(/[\s\S]/g, function( match ) { - return byteMapping[match]; - }) + lastChr; -}; - -// enforcing Stuk's coding style -// vim: set shiftwidth=4 softtabstop=4: - -},{}]},{},[1]) -; diff --git a/database/hsqldb/doc/apidocs/jquery/jszip-utils/dist/jszip-utils-ie.min.js b/database/hsqldb/doc/apidocs/jquery/jszip-utils/dist/jszip-utils-ie.min.js deleted file mode 100644 index 93d8bc8e..00000000 --- a/database/hsqldb/doc/apidocs/jquery/jszip-utils/dist/jszip-utils-ie.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - -JSZipUtils - A collection of cross-browser utilities to go along with JSZip. - - -(c) 2014 Stuart Knightley, David Duponchel -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. - -*/ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n";document.write(b),a.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); diff --git a/database/hsqldb/doc/apidocs/jquery/jszip-utils/dist/jszip-utils.js b/database/hsqldb/doc/apidocs/jquery/jszip-utils/dist/jszip-utils.js deleted file mode 100644 index 775895ec..00000000 --- a/database/hsqldb/doc/apidocs/jquery/jszip-utils/dist/jszip-utils.js +++ /dev/null @@ -1,118 +0,0 @@ -/*! - -JSZipUtils - A collection of cross-browser utilities to go along with JSZip. - - -(c) 2014 Stuart Knightley, David Duponchel -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. - -*/ -!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSZipUtils=e():"undefined"!=typeof global?global.JSZipUtils=e():"undefined"!=typeof self&&(self.JSZipUtils=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o - -(c) 2014 Stuart Knightley, David Duponchel -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. - -*/ -!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZipUtils=a():"undefined"!=typeof global?global.JSZipUtils=a():"undefined"!=typeof self&&(self.JSZipUtils=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/master/LICENSE -*/ - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64; - enc4 = remainingBytes > 2 ? (chr3 & 63) : 64; - - output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4)); - - } - - return output.join(""); -}; - -// public method for decoding -exports.decode = function(input) { - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0, resultIndex = 0; - - var dataUrlPrefix = "data:"; - - if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) { - // This is a common error: people give a data url - // (data:image/png;base64,iVBOR...) with a {base64: true} and - // wonders why things don't work. - // We can detect that the string input looks like a data url but we - // *can't* be sure it is one: removing everything up to the comma would - // be too dangerous. - throw new Error("Invalid base64 input, it looks like a data url."); - } - - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - var totalLength = input.length * 3 / 4; - if(input.charAt(input.length - 1) === _keyStr.charAt(64)) { - totalLength--; - } - if(input.charAt(input.length - 2) === _keyStr.charAt(64)) { - totalLength--; - } - if (totalLength % 1 !== 0) { - // totalLength is not an integer, the length does not match a valid - // base64 content. That can happen if: - // - the input is not a base64 content - // - the input is *almost* a base64 content, with a extra chars at the - // beginning or at the end - // - the input uses a base64 variant (base64url for example) - throw new Error("Invalid base64 input, bad content length."); - } - var output; - if (support.uint8array) { - output = new Uint8Array(totalLength|0); - } else { - output = new Array(totalLength|0); - } - - while (i < input.length) { - - enc1 = _keyStr.indexOf(input.charAt(i++)); - enc2 = _keyStr.indexOf(input.charAt(i++)); - enc3 = _keyStr.indexOf(input.charAt(i++)); - enc4 = _keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output[resultIndex++] = chr1; - - if (enc3 !== 64) { - output[resultIndex++] = chr2; - } - if (enc4 !== 64) { - output[resultIndex++] = chr3; - } - - } - - return output; -}; - -},{"./support":30,"./utils":32}],2:[function(require,module,exports){ -'use strict'; - -var external = require("./external"); -var DataWorker = require('./stream/DataWorker'); -var Crc32Probe = require('./stream/Crc32Probe'); -var DataLengthProbe = require('./stream/DataLengthProbe'); - -/** - * Represent a compressed object, with everything needed to decompress it. - * @constructor - * @param {number} compressedSize the size of the data compressed. - * @param {number} uncompressedSize the size of the data after decompression. - * @param {number} crc32 the crc32 of the decompressed file. - * @param {object} compression the type of compression, see lib/compressions.js. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data. - */ -function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) { - this.compressedSize = compressedSize; - this.uncompressedSize = uncompressedSize; - this.crc32 = crc32; - this.compression = compression; - this.compressedContent = data; -} - -CompressedObject.prototype = { - /** - * Create a worker to get the uncompressed content. - * @return {GenericWorker} the worker. - */ - getContentWorker: function () { - var worker = new DataWorker(external.Promise.resolve(this.compressedContent)) - .pipe(this.compression.uncompressWorker()) - .pipe(new DataLengthProbe("data_length")); - - var that = this; - worker.on("end", function () { - if (this.streamInfo['data_length'] !== that.uncompressedSize) { - throw new Error("Bug : uncompressed data size mismatch"); - } - }); - return worker; - }, - /** - * Create a worker to get the compressed content. - * @return {GenericWorker} the worker. - */ - getCompressedWorker: function () { - return new DataWorker(external.Promise.resolve(this.compressedContent)) - .withStreamInfo("compressedSize", this.compressedSize) - .withStreamInfo("uncompressedSize", this.uncompressedSize) - .withStreamInfo("crc32", this.crc32) - .withStreamInfo("compression", this.compression) - ; - } -}; - -/** - * Chain the given worker with other workers to compress the content with the - * given compression. - * @param {GenericWorker} uncompressedWorker the worker to pipe. - * @param {Object} compression the compression object. - * @param {Object} compressionOptions the options to use when compressing. - * @return {GenericWorker} the new worker compressing the content. - */ -CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) { - return uncompressedWorker - .pipe(new Crc32Probe()) - .pipe(new DataLengthProbe("uncompressedSize")) - .pipe(compression.compressWorker(compressionOptions)) - .pipe(new DataLengthProbe("compressedSize")) - .withStreamInfo("compression", compression); -}; - -module.exports = CompressedObject; - -},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(require,module,exports){ -'use strict'; - -var GenericWorker = require("./stream/GenericWorker"); - -exports.STORE = { - magic: "\x00\x00", - compressWorker : function (compressionOptions) { - return new GenericWorker("STORE compression"); - }, - uncompressWorker : function () { - return new GenericWorker("STORE decompression"); - } -}; -exports.DEFLATE = require('./flate'); - -},{"./flate":7,"./stream/GenericWorker":28}],4:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); - -/** - * The following functions come from pako, from pako/lib/zlib/crc32.js - * released under the MIT license, see pako https://github.com/nodeca/pako/ - */ - -// Use ordinary array, since untyped makes no boost here -function makeTable() { - var c, table = []; - - for(var n =0; n < 256; n++){ - c = n; - for(var k =0; k < 8; k++){ - c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; -} - -// Create table on load. Just 255 signed longs. Not a problem. -var crcTable = makeTable(); - - -function crc32(crc, buf, len, pos) { - var t = crcTable, end = pos + len; - - crc = crc ^ (-1); - - for (var i = pos; i < end; i++ ) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - -// That's all for the pako functions. - -/** - * Compute the crc32 of a string. - * This is almost the same as the function crc32, but for strings. Using the - * same function for the two use cases leads to horrible performances. - * @param {Number} crc the starting value of the crc. - * @param {String} str the string to use. - * @param {Number} len the length of the string. - * @param {Number} pos the starting position for the crc32 computation. - * @return {Number} the computed crc32. - */ -function crc32str(crc, str, len, pos) { - var t = crcTable, end = pos + len; - - crc = crc ^ (-1); - - for (var i = pos; i < end; i++ ) { - crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - -module.exports = function crc32wrapper(input, crc) { - if (typeof input === "undefined" || !input.length) { - return 0; - } - - var isArray = utils.getTypeOf(input) !== "string"; - - if(isArray) { - return crc32(crc|0, input, input.length, 0); - } else { - return crc32str(crc|0, input, input.length, 0); - } -}; - -},{"./utils":32}],5:[function(require,module,exports){ -'use strict'; -exports.base64 = false; -exports.binary = false; -exports.dir = false; -exports.createFolders = true; -exports.date = null; -exports.compression = null; -exports.compressionOptions = null; -exports.comment = null; -exports.unixPermissions = null; -exports.dosPermissions = null; - -},{}],6:[function(require,module,exports){ -/* global Promise */ -'use strict'; - -// load the global object first: -// - it should be better integrated in the system (unhandledRejection in node) -// - the environment may have a custom Promise implementation (see zone.js) -var ES6Promise = null; -if (typeof Promise !== "undefined") { - ES6Promise = Promise; -} else { - ES6Promise = require("lie"); -} - -/** - * Let the user use/change some implementations. - */ -module.exports = { - Promise: ES6Promise -}; - -},{"lie":37}],7:[function(require,module,exports){ -'use strict'; -var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); - -var pako = require("pako"); -var utils = require("./utils"); -var GenericWorker = require("./stream/GenericWorker"); - -var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array"; - -exports.magic = "\x08\x00"; - -/** - * Create a worker that uses pako to inflate/deflate. - * @constructor - * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate". - * @param {Object} options the options to use when (de)compressing. - */ -function FlateWorker(action, options) { - GenericWorker.call(this, "FlateWorker/" + action); - - this._pako = null; - this._pakoAction = action; - this._pakoOptions = options; - // the `meta` object from the last chunk received - // this allow this worker to pass around metadata - this.meta = {}; -} - -utils.inherits(FlateWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -FlateWorker.prototype.processChunk = function (chunk) { - this.meta = chunk.meta; - if (this._pako === null) { - this._createPako(); - } - this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); -}; - -/** - * @see GenericWorker.flush - */ -FlateWorker.prototype.flush = function () { - GenericWorker.prototype.flush.call(this); - if (this._pako === null) { - this._createPako(); - } - this._pako.push([], true); -}; -/** - * @see GenericWorker.cleanUp - */ -FlateWorker.prototype.cleanUp = function () { - GenericWorker.prototype.cleanUp.call(this); - this._pako = null; -}; - -/** - * Create the _pako object. - * TODO: lazy-loading this object isn't the best solution but it's the - * quickest. The best solution is to lazy-load the worker list. See also the - * issue #446. - */ -FlateWorker.prototype._createPako = function () { - this._pako = new pako[this._pakoAction]({ - raw: true, - level: this._pakoOptions.level || -1 // default compression - }); - var self = this; - this._pako.onData = function(data) { - self.push({ - data : data, - meta : self.meta - }); - }; -}; - -exports.compressWorker = function (compressionOptions) { - return new FlateWorker("Deflate", compressionOptions); -}; -exports.uncompressWorker = function () { - return new FlateWorker("Inflate", {}); -}; - -},{"./stream/GenericWorker":28,"./utils":32,"pako":38}],8:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var GenericWorker = require('../stream/GenericWorker'); -var utf8 = require('../utf8'); -var crc32 = require('../crc32'); -var signature = require('../signature'); - -/** - * Transform an integer into a string in hexadecimal. - * @private - * @param {number} dec the number to convert. - * @param {number} bytes the number of bytes to generate. - * @returns {string} the result. - */ -var decToHex = function(dec, bytes) { - var hex = "", i; - for (i = 0; i < bytes; i++) { - hex += String.fromCharCode(dec & 0xff); - dec = dec >>> 8; - } - return hex; -}; - -/** - * Generate the UNIX part of the external file attributes. - * @param {Object} unixPermissions the unix permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute : - * - * TTTTsstrwxrwxrwx0000000000ADVSHR - * ^^^^____________________________ file type, see zipinfo.c (UNX_*) - * ^^^_________________________ setuid, setgid, sticky - * ^^^^^^^^^________________ permissions - * ^^^^^^^^^^______ not used ? - * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only - */ -var generateUnixExternalFileAttr = function (unixPermissions, isDir) { - - var result = unixPermissions; - if (!unixPermissions) { - // I can't use octal values in strict mode, hence the hexa. - // 040775 => 0x41fd - // 0100664 => 0x81b4 - result = isDir ? 0x41fd : 0x81b4; - } - return (result & 0xFFFF) << 16; -}; - -/** - * Generate the DOS part of the external file attributes. - * @param {Object} dosPermissions the dos permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * Bit 0 Read-Only - * Bit 1 Hidden - * Bit 2 System - * Bit 3 Volume Label - * Bit 4 Directory - * Bit 5 Archive - */ -var generateDosExternalFileAttr = function (dosPermissions, isDir) { - - // the dir flag is already set for compatibility - return (dosPermissions || 0) & 0x3F; -}; - -/** - * Generate the various parts used in the construction of the final zip file. - * @param {Object} streamInfo the hash with information about the compressed file. - * @param {Boolean} streamedContent is the content streamed ? - * @param {Boolean} streamingEnded is the stream finished ? - * @param {number} offset the current offset from the start of the zip file. - * @param {String} platform let's pretend we are this platform (change platform dependents fields) - * @param {Function} encodeFileName the function to encode the file name / comment. - * @return {Object} the zip parts. - */ -var generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) { - var file = streamInfo['file'], - compression = streamInfo['compression'], - useCustomEncoding = encodeFileName !== utf8.utf8encode, - encodedFileName = utils.transformTo("string", encodeFileName(file.name)), - utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), - comment = file.comment, - encodedComment = utils.transformTo("string", encodeFileName(comment)), - utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), - useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, - useUTF8ForComment = utfEncodedComment.length !== comment.length, - dosTime, - dosDate, - extraFields = "", - unicodePathExtraField = "", - unicodeCommentExtraField = "", - dir = file.dir, - date = file.date; - - - var dataInfo = { - crc32 : 0, - compressedSize : 0, - uncompressedSize : 0 - }; - - // if the content is streamed, the sizes/crc32 are only available AFTER - // the end of the stream. - if (!streamedContent || streamingEnded) { - dataInfo.crc32 = streamInfo['crc32']; - dataInfo.compressedSize = streamInfo['compressedSize']; - dataInfo.uncompressedSize = streamInfo['uncompressedSize']; - } - - var bitflag = 0; - if (streamedContent) { - // Bit 3: the sizes/crc32 are set to zero in the local header. - // The correct values are put in the data descriptor immediately - // following the compressed data. - bitflag |= 0x0008; - } - if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) { - // Bit 11: Language encoding flag (EFS). - bitflag |= 0x0800; - } - - - var extFileAttr = 0; - var versionMadeBy = 0; - if (dir) { - // dos or unix, we set the dos dir flag - extFileAttr |= 0x00010; - } - if(platform === "UNIX") { - versionMadeBy = 0x031E; // UNIX, version 3.0 - extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); - } else { // DOS or other, fallback to DOS - versionMadeBy = 0x0014; // DOS, version 2.0 - extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); - } - - // date - // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html - - dosTime = date.getUTCHours(); - dosTime = dosTime << 6; - dosTime = dosTime | date.getUTCMinutes(); - dosTime = dosTime << 5; - dosTime = dosTime | date.getUTCSeconds() / 2; - - dosDate = date.getUTCFullYear() - 1980; - dosDate = dosDate << 4; - dosDate = dosDate | (date.getUTCMonth() + 1); - dosDate = dosDate << 5; - dosDate = dosDate | date.getUTCDate(); - - if (useUTF8ForFileName) { - // set the unicode path extra field. unzip needs at least one extra - // field to correctly handle unicode path, so using the path is as good - // as any other information. This could improve the situation with - // other archive managers too. - // This field is usually used without the utf8 flag, with a non - // unicode path in the header (winrar, winzip). This helps (a bit) - // with the messy Windows' default compressed folders feature but - // breaks on p7zip which doesn't seek the unicode path extra field. - // So for now, UTF-8 everywhere ! - unicodePathExtraField = - // Version - decToHex(1, 1) + - // NameCRC32 - decToHex(crc32(encodedFileName), 4) + - // UnicodeName - utfEncodedFileName; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x70" + - // size - decToHex(unicodePathExtraField.length, 2) + - // content - unicodePathExtraField; - } - - if(useUTF8ForComment) { - - unicodeCommentExtraField = - // Version - decToHex(1, 1) + - // CommentCRC32 - decToHex(crc32(encodedComment), 4) + - // UnicodeName - utfEncodedComment; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x63" + - // size - decToHex(unicodeCommentExtraField.length, 2) + - // content - unicodeCommentExtraField; - } - - var header = ""; - - // version needed to extract - header += "\x0A\x00"; - // general purpose bit flag - header += decToHex(bitflag, 2); - // compression method - header += compression.magic; - // last mod file time - header += decToHex(dosTime, 2); - // last mod file date - header += decToHex(dosDate, 2); - // crc-32 - header += decToHex(dataInfo.crc32, 4); - // compressed size - header += decToHex(dataInfo.compressedSize, 4); - // uncompressed size - header += decToHex(dataInfo.uncompressedSize, 4); - // file name length - header += decToHex(encodedFileName.length, 2); - // extra field length - header += decToHex(extraFields.length, 2); - - - var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields; - - var dirRecord = signature.CENTRAL_FILE_HEADER + - // version made by (00: DOS) - decToHex(versionMadeBy, 2) + - // file header (common to file and central directory) - header + - // file comment length - decToHex(encodedComment.length, 2) + - // disk number start - "\x00\x00" + - // internal file attributes TODO - "\x00\x00" + - // external file attributes - decToHex(extFileAttr, 4) + - // relative offset of local header - decToHex(offset, 4) + - // file name - encodedFileName + - // extra field - extraFields + - // file comment - encodedComment; - - return { - fileRecord: fileRecord, - dirRecord: dirRecord - }; -}; - -/** - * Generate the EOCD record. - * @param {Number} entriesCount the number of entries in the zip file. - * @param {Number} centralDirLength the length (in bytes) of the central dir. - * @param {Number} localDirLength the length (in bytes) of the local dir. - * @param {String} comment the zip file comment as a binary string. - * @param {Function} encodeFileName the function to encode the comment. - * @return {String} the EOCD record. - */ -var generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) { - var dirEnd = ""; - var encodedComment = utils.transformTo("string", encodeFileName(comment)); - - // end of central dir signature - dirEnd = signature.CENTRAL_DIRECTORY_END + - // number of this disk - "\x00\x00" + - // number of the disk with the start of the central directory - "\x00\x00" + - // total number of entries in the central directory on this disk - decToHex(entriesCount, 2) + - // total number of entries in the central directory - decToHex(entriesCount, 2) + - // size of the central directory 4 bytes - decToHex(centralDirLength, 4) + - // offset of start of central directory with respect to the starting disk number - decToHex(localDirLength, 4) + - // .ZIP file comment length - decToHex(encodedComment.length, 2) + - // .ZIP file comment - encodedComment; - - return dirEnd; -}; - -/** - * Generate data descriptors for a file entry. - * @param {Object} streamInfo the hash generated by a worker, containing information - * on the file entry. - * @return {String} the data descriptors. - */ -var generateDataDescriptors = function (streamInfo) { - var descriptor = ""; - descriptor = signature.DATA_DESCRIPTOR + - // crc-32 4 bytes - decToHex(streamInfo['crc32'], 4) + - // compressed size 4 bytes - decToHex(streamInfo['compressedSize'], 4) + - // uncompressed size 4 bytes - decToHex(streamInfo['uncompressedSize'], 4); - - return descriptor; -}; - - -/** - * A worker to concatenate other workers to create a zip file. - * @param {Boolean} streamFiles `true` to stream the content of the files, - * `false` to accumulate it. - * @param {String} comment the comment to use. - * @param {String} platform the platform to use, "UNIX" or "DOS". - * @param {Function} encodeFileName the function to encode file names and comments. - */ -function ZipFileWorker(streamFiles, comment, platform, encodeFileName) { - GenericWorker.call(this, "ZipFileWorker"); - // The number of bytes written so far. This doesn't count accumulated chunks. - this.bytesWritten = 0; - // The comment of the zip file - this.zipComment = comment; - // The platform "generating" the zip file. - this.zipPlatform = platform; - // the function to encode file names and comments. - this.encodeFileName = encodeFileName; - // Should we stream the content of the files ? - this.streamFiles = streamFiles; - // If `streamFiles` is false, we will need to accumulate the content of the - // files to calculate sizes / crc32 (and write them *before* the content). - // This boolean indicates if we are accumulating chunks (it will change a lot - // during the lifetime of this worker). - this.accumulate = false; - // The buffer receiving chunks when accumulating content. - this.contentBuffer = []; - // The list of generated directory records. - this.dirRecords = []; - // The offset (in bytes) from the beginning of the zip file for the current source. - this.currentSourceOffset = 0; - // The total number of entries in this zip file. - this.entriesCount = 0; - // the name of the file currently being added, null when handling the end of the zip file. - // Used for the emitted metadata. - this.currentFile = null; - - - - this._sources = []; -} -utils.inherits(ZipFileWorker, GenericWorker); - -/** - * @see GenericWorker.push - */ -ZipFileWorker.prototype.push = function (chunk) { - - var currentFilePercent = chunk.meta.percent || 0; - var entriesCount = this.entriesCount; - var remainingFiles = this._sources.length; - - if(this.accumulate) { - this.contentBuffer.push(chunk); - } else { - this.bytesWritten += chunk.data.length; - - GenericWorker.prototype.push.call(this, { - data : chunk.data, - meta : { - currentFile : this.currentFile, - percent : entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100 - } - }); - } -}; - -/** - * The worker started a new source (an other worker). - * @param {Object} streamInfo the streamInfo object from the new source. - */ -ZipFileWorker.prototype.openedSource = function (streamInfo) { - this.currentSourceOffset = this.bytesWritten; - this.currentFile = streamInfo['file'].name; - - var streamedContent = this.streamFiles && !streamInfo['file'].dir; - - // don't stream folders (because they don't have any content) - if(streamedContent) { - var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - this.push({ - data : record.fileRecord, - meta : {percent:0} - }); - } else { - // we need to wait for the whole file before pushing anything - this.accumulate = true; - } -}; - -/** - * The worker finished a source (an other worker). - * @param {Object} streamInfo the streamInfo object from the finished source. - */ -ZipFileWorker.prototype.closedSource = function (streamInfo) { - this.accumulate = false; - var streamedContent = this.streamFiles && !streamInfo['file'].dir; - var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - - this.dirRecords.push(record.dirRecord); - if(streamedContent) { - // after the streamed file, we put data descriptors - this.push({ - data : generateDataDescriptors(streamInfo), - meta : {percent:100} - }); - } else { - // the content wasn't streamed, we need to push everything now - // first the file record, then the content - this.push({ - data : record.fileRecord, - meta : {percent:0} - }); - while(this.contentBuffer.length) { - this.push(this.contentBuffer.shift()); - } - } - this.currentFile = null; -}; - -/** - * @see GenericWorker.flush - */ -ZipFileWorker.prototype.flush = function () { - - var localDirLength = this.bytesWritten; - for(var i = 0; i < this.dirRecords.length; i++) { - this.push({ - data : this.dirRecords[i], - meta : {percent:100} - }); - } - var centralDirLength = this.bytesWritten - localDirLength; - - var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName); - - this.push({ - data : dirEnd, - meta : {percent:100} - }); -}; - -/** - * Prepare the next source to be read. - */ -ZipFileWorker.prototype.prepareNextSource = function () { - this.previous = this._sources.shift(); - this.openedSource(this.previous.streamInfo); - if (this.isPaused) { - this.previous.pause(); - } else { - this.previous.resume(); - } -}; - -/** - * @see GenericWorker.registerPrevious - */ -ZipFileWorker.prototype.registerPrevious = function (previous) { - this._sources.push(previous); - var self = this; - - previous.on('data', function (chunk) { - self.processChunk(chunk); - }); - previous.on('end', function () { - self.closedSource(self.previous.streamInfo); - if(self._sources.length) { - self.prepareNextSource(); - } else { - self.end(); - } - }); - previous.on('error', function (e) { - self.error(e); - }); - return this; -}; - -/** - * @see GenericWorker.resume - */ -ZipFileWorker.prototype.resume = function () { - if(!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if (!this.previous && this._sources.length) { - this.prepareNextSource(); - return true; - } - if (!this.previous && !this._sources.length && !this.generatedError) { - this.end(); - return true; - } -}; - -/** - * @see GenericWorker.error - */ -ZipFileWorker.prototype.error = function (e) { - var sources = this._sources; - if(!GenericWorker.prototype.error.call(this, e)) { - return false; - } - for(var i = 0; i < sources.length; i++) { - try { - sources[i].error(e); - } catch(e) { - // the `error` exploded, nothing to do - } - } - return true; -}; - -/** - * @see GenericWorker.lock - */ -ZipFileWorker.prototype.lock = function () { - GenericWorker.prototype.lock.call(this); - var sources = this._sources; - for(var i = 0; i < sources.length; i++) { - sources[i].lock(); - } -}; - -module.exports = ZipFileWorker; - -},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(require,module,exports){ -'use strict'; - -var compressions = require('../compressions'); -var ZipFileWorker = require('./ZipFileWorker'); - -/** - * Find the compression to use. - * @param {String} fileCompression the compression defined at the file level, if any. - * @param {String} zipCompression the compression defined at the load() level. - * @return {Object} the compression object to use. - */ -var getCompression = function (fileCompression, zipCompression) { - - var compressionName = fileCompression || zipCompression; - var compression = compressions[compressionName]; - if (!compression) { - throw new Error(compressionName + " is not a valid compression method !"); - } - return compression; -}; - -/** - * Create a worker to generate a zip file. - * @param {JSZip} zip the JSZip instance at the right root level. - * @param {Object} options to generate the zip file. - * @param {String} comment the comment to use. - */ -exports.generateWorker = function (zip, options, comment) { - - var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName); - var entriesCount = 0; - try { - - zip.forEach(function (relativePath, file) { - entriesCount++; - var compression = getCompression(file.options.compression, options.compression); - var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; - var dir = file.dir, date = file.date; - - file._compressWorker(compression, compressionOptions) - .withStreamInfo("file", { - name : relativePath, - dir : dir, - date : date, - comment : file.comment || "", - unixPermissions : file.unixPermissions, - dosPermissions : file.dosPermissions - }) - .pipe(zipFileWorker); - }); - zipFileWorker.entriesCount = entriesCount; - } catch (e) { - zipFileWorker.error(e); - } - - return zipFileWorker; -}; - -},{"../compressions":3,"./ZipFileWorker":8}],10:[function(require,module,exports){ -'use strict'; - -/** - * Representation a of zip file in js - * @constructor - */ -function JSZip() { - // if this constructor is used without `new`, it adds `new` before itself: - if(!(this instanceof JSZip)) { - return new JSZip(); - } - - if(arguments.length) { - throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); - } - - // object containing the files : - // { - // "folder/" : {...}, - // "folder/data.txt" : {...} - // } - // NOTE: we use a null prototype because we do not - // want filenames like "toString" coming from a zip file - // to overwrite methods and attributes in a normal Object. - this.files = Object.create(null); - - this.comment = null; - - // Where we are in the hierarchy - this.root = ""; - this.clone = function() { - var newObj = new JSZip(); - for (var i in this) { - if (typeof this[i] !== "function") { - newObj[i] = this[i]; - } - } - return newObj; - }; -} -JSZip.prototype = require('./object'); -JSZip.prototype.loadAsync = require('./load'); -JSZip.support = require('./support'); -JSZip.defaults = require('./defaults'); - -// TODO find a better way to handle this version, -// a require('package.json').version doesn't work with webpack, see #327 -JSZip.version = "3.7.1"; - -JSZip.loadAsync = function (content, options) { - return new JSZip().loadAsync(content, options); -}; - -JSZip.external = require("./external"); -module.exports = JSZip; - -},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(require,module,exports){ -'use strict'; -var utils = require('./utils'); -var external = require("./external"); -var utf8 = require('./utf8'); -var ZipEntries = require('./zipEntries'); -var Crc32Probe = require('./stream/Crc32Probe'); -var nodejsUtils = require("./nodejsUtils"); - -/** - * Check the CRC32 of an entry. - * @param {ZipEntry} zipEntry the zip entry to check. - * @return {Promise} the result. - */ -function checkEntryCRC32(zipEntry) { - return new external.Promise(function (resolve, reject) { - var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); - worker.on("error", function (e) { - reject(e); - }) - .on("end", function () { - if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { - reject(new Error("Corrupted zip : CRC32 mismatch")); - } else { - resolve(); - } - }) - .resume(); - }); -} - -module.exports = function (data, options) { - var zip = this; - options = utils.extend(options || {}, { - base64: false, - checkCRC32: false, - optimizedBinaryString: false, - createFolders: false, - decodeFileName: utf8.utf8decode - }); - - if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { - return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")); - } - - return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) - .then(function (data) { - var zipEntries = new ZipEntries(options); - zipEntries.load(data); - return zipEntries; - }).then(function checkCRC32(zipEntries) { - var promises = [external.Promise.resolve(zipEntries)]; - var files = zipEntries.files; - if (options.checkCRC32) { - for (var i = 0; i < files.length; i++) { - promises.push(checkEntryCRC32(files[i])); - } - } - return external.Promise.all(promises); - }).then(function addFiles(results) { - var zipEntries = results.shift(); - var files = zipEntries.files; - for (var i = 0; i < files.length; i++) { - var input = files[i]; - zip.file(input.fileNameStr, input.decompressed, { - binary: true, - optimizedBinaryString: true, - date: input.date, - dir: input.dir, - comment: input.fileCommentStr.length ? input.fileCommentStr : null, - unixPermissions: input.unixPermissions, - dosPermissions: input.dosPermissions, - createFolders: options.createFolders - }); - } - if (zipEntries.zipComment.length) { - zip.comment = zipEntries.zipComment; - } - - return zip; - }); -}; - -},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(require,module,exports){ -"use strict"; - -var utils = require('../utils'); -var GenericWorker = require('../stream/GenericWorker'); - -/** - * A worker that use a nodejs stream as source. - * @constructor - * @param {String} filename the name of the file entry for this stream. - * @param {Readable} stream the nodejs stream. - */ -function NodejsStreamInputAdapter(filename, stream) { - GenericWorker.call(this, "Nodejs stream input adapter for " + filename); - this._upstreamEnded = false; - this._bindStream(stream); -} - -utils.inherits(NodejsStreamInputAdapter, GenericWorker); - -/** - * Prepare the stream and bind the callbacks on it. - * Do this ASAP on node 0.10 ! A lazy binding doesn't always work. - * @param {Stream} stream the nodejs stream to use. - */ -NodejsStreamInputAdapter.prototype._bindStream = function (stream) { - var self = this; - this._stream = stream; - stream.pause(); - stream - .on("data", function (chunk) { - self.push({ - data: chunk, - meta : { - percent : 0 - } - }); - }) - .on("error", function (e) { - if(self.isPaused) { - this.generatedError = e; - } else { - self.error(e); - } - }) - .on("end", function () { - if(self.isPaused) { - self._upstreamEnded = true; - } else { - self.end(); - } - }); -}; -NodejsStreamInputAdapter.prototype.pause = function () { - if(!GenericWorker.prototype.pause.call(this)) { - return false; - } - this._stream.pause(); - return true; -}; -NodejsStreamInputAdapter.prototype.resume = function () { - if(!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if(this._upstreamEnded) { - this.end(); - } else { - this._stream.resume(); - } - - return true; -}; - -module.exports = NodejsStreamInputAdapter; - -},{"../stream/GenericWorker":28,"../utils":32}],13:[function(require,module,exports){ -'use strict'; - -var Readable = require('readable-stream').Readable; - -var utils = require('../utils'); -utils.inherits(NodejsStreamOutputAdapter, Readable); - -/** -* A nodejs stream using a worker as source. -* @see the SourceWrapper in http://nodejs.org/api/stream.html -* @constructor -* @param {StreamHelper} helper the helper wrapping the worker -* @param {Object} options the nodejs stream options -* @param {Function} updateCb the update callback. -*/ -function NodejsStreamOutputAdapter(helper, options, updateCb) { - Readable.call(this, options); - this._helper = helper; - - var self = this; - helper.on("data", function (data, meta) { - if (!self.push(data)) { - self._helper.pause(); - } - if(updateCb) { - updateCb(meta); - } - }) - .on("error", function(e) { - self.emit('error', e); - }) - .on("end", function () { - self.push(null); - }); -} - - -NodejsStreamOutputAdapter.prototype._read = function() { - this._helper.resume(); -}; - -module.exports = NodejsStreamOutputAdapter; - -},{"../utils":32,"readable-stream":16}],14:[function(require,module,exports){ -'use strict'; - -module.exports = { - /** - * True if this is running in Nodejs, will be undefined in a browser. - * In a browser, browserify won't include this file and the whole module - * will be resolved an empty object. - */ - isNode : typeof Buffer !== "undefined", - /** - * Create a new nodejs Buffer from an existing content. - * @param {Object} data the data to pass to the constructor. - * @param {String} encoding the encoding to use. - * @return {Buffer} a new Buffer. - */ - newBufferFrom: function(data, encoding) { - if (Buffer.from && Buffer.from !== Uint8Array.from) { - return Buffer.from(data, encoding); - } else { - if (typeof data === "number") { - // Safeguard for old Node.js versions. On newer versions, - // Buffer.from(number) / Buffer(number, encoding) already throw. - throw new Error("The \"data\" argument must not be a number"); - } - return new Buffer(data, encoding); - } - }, - /** - * Create a new nodejs Buffer with the specified size. - * @param {Integer} size the size of the buffer. - * @return {Buffer} a new Buffer. - */ - allocBuffer: function (size) { - if (Buffer.alloc) { - return Buffer.alloc(size); - } else { - var buf = new Buffer(size); - buf.fill(0); - return buf; - } - }, - /** - * Find out if an object is a Buffer. - * @param {Object} b the object to test. - * @return {Boolean} true if the object is a Buffer, false otherwise. - */ - isBuffer : function(b){ - return Buffer.isBuffer(b); - }, - - isStream : function (obj) { - return obj && - typeof obj.on === "function" && - typeof obj.pause === "function" && - typeof obj.resume === "function"; - } -}; - -},{}],15:[function(require,module,exports){ -'use strict'; -var utf8 = require('./utf8'); -var utils = require('./utils'); -var GenericWorker = require('./stream/GenericWorker'); -var StreamHelper = require('./stream/StreamHelper'); -var defaults = require('./defaults'); -var CompressedObject = require('./compressedObject'); -var ZipObject = require('./zipObject'); -var generate = require("./generate"); -var nodejsUtils = require("./nodejsUtils"); -var NodejsStreamInputAdapter = require("./nodejs/NodejsStreamInputAdapter"); - - -/** - * Add a file in the current folder. - * @private - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file - * @param {Object} originalOptions the options of the file - * @return {Object} the new file. - */ -var fileAdd = function(name, data, originalOptions) { - // be sure sub folders exist - var dataType = utils.getTypeOf(data), - parent; - - - /* - * Correct options. - */ - - var o = utils.extend(originalOptions || {}, defaults); - o.date = o.date || new Date(); - if (o.compression !== null) { - o.compression = o.compression.toUpperCase(); - } - - if (typeof o.unixPermissions === "string") { - o.unixPermissions = parseInt(o.unixPermissions, 8); - } - - // UNX_IFDIR 0040000 see zipinfo.c - if (o.unixPermissions && (o.unixPermissions & 0x4000)) { - o.dir = true; - } - // Bit 4 Directory - if (o.dosPermissions && (o.dosPermissions & 0x0010)) { - o.dir = true; - } - - if (o.dir) { - name = forceTrailingSlash(name); - } - if (o.createFolders && (parent = parentFolder(name))) { - folderAdd.call(this, parent, true); - } - - var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false; - if (!originalOptions || typeof originalOptions.binary === "undefined") { - o.binary = !isUnicodeString; - } - - - var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0; - - if (isCompressedEmpty || o.dir || !data || data.length === 0) { - o.base64 = false; - o.binary = true; - data = ""; - o.compression = "STORE"; - dataType = "string"; - } - - /* - * Convert content to fit. - */ - - var zipObjectContent = null; - if (data instanceof CompressedObject || data instanceof GenericWorker) { - zipObjectContent = data; - } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { - zipObjectContent = new NodejsStreamInputAdapter(name, data); - } else { - zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64); - } - - var object = new ZipObject(name, zipObjectContent, o); - this.files[name] = object; - /* - TODO: we can't throw an exception because we have async promises - (we can have a promise of a Date() for example) but returning a - promise is useless because file(name, data) returns the JSZip - object for chaining. Should we break that to allow the user - to catch the error ? - - return external.Promise.resolve(zipObjectContent) - .then(function () { - return object; - }); - */ -}; - -/** - * Find the parent folder of the path. - * @private - * @param {string} path the path to use - * @return {string} the parent folder, or "" - */ -var parentFolder = function (path) { - if (path.slice(-1) === '/') { - path = path.substring(0, path.length - 1); - } - var lastSlash = path.lastIndexOf('/'); - return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; -}; - -/** - * Returns the path with a slash at the end. - * @private - * @param {String} path the path to check. - * @return {String} the path with a trailing slash. - */ -var forceTrailingSlash = function(path) { - // Check the name ends with a / - if (path.slice(-1) !== "/") { - path += "/"; // IE doesn't like substr(-1) - } - return path; -}; - -/** - * Add a (sub) folder in the current folder. - * @private - * @param {string} name the folder's name - * @param {boolean=} [createFolders] If true, automatically create sub - * folders. Defaults to false. - * @return {Object} the new folder. - */ -var folderAdd = function(name, createFolders) { - createFolders = (typeof createFolders !== 'undefined') ? createFolders : defaults.createFolders; - - name = forceTrailingSlash(name); - - // Does this folder already exist? - if (!this.files[name]) { - fileAdd.call(this, name, null, { - dir: true, - createFolders: createFolders - }); - } - return this.files[name]; -}; - -/** -* Cross-window, cross-Node-context regular expression detection -* @param {Object} object Anything -* @return {Boolean} true if the object is a regular expression, -* false otherwise -*/ -function isRegExp(object) { - return Object.prototype.toString.call(object) === "[object RegExp]"; -} - -// return the actual prototype of JSZip -var out = { - /** - * @see loadAsync - */ - load: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, - - - /** - * Call a callback function for each entry at this folder level. - * @param {Function} cb the callback function: - * function (relativePath, file) {...} - * It takes 2 arguments : the relative path and the file. - */ - forEach: function(cb) { - var filename, relativePath, file; - /* jshint ignore:start */ - // ignore warning about unwanted properties because this.files is a null prototype object - for (filename in this.files) { - file = this.files[filename]; - relativePath = filename.slice(this.root.length, filename.length); - if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root - cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn... - } - } - /* jshint ignore:end */ - }, - - /** - * Filter nested files/folders with the specified function. - * @param {Function} search the predicate to use : - * function (relativePath, file) {...} - * It takes 2 arguments : the relative path and the file. - * @return {Array} An array of matching elements. - */ - filter: function(search) { - var result = []; - this.forEach(function (relativePath, entry) { - if (search(relativePath, entry)) { // the file matches the function - result.push(entry); - } - - }); - return result; - }, - - /** - * Add a file to the zip file, or search a file. - * @param {string|RegExp} name The name of the file to add (if data is defined), - * the name of the file to find (if no data) or a regex to match files. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded - * @param {Object} o File options - * @return {JSZip|Object|Array} this JSZip object (when adding a file), - * a file (when searching by string) or an array of files (when searching by regex). - */ - file: function(name, data, o) { - if (arguments.length === 1) { - if (isRegExp(name)) { - var regexp = name; - return this.filter(function(relativePath, file) { - return !file.dir && regexp.test(relativePath); - }); - } - else { // text - var obj = this.files[this.root + name]; - if (obj && !obj.dir) { - return obj; - } else { - return null; - } - } - } - else { // more than one argument : we have data ! - name = this.root + name; - fileAdd.call(this, name, data, o); - } - return this; - }, - - /** - * Add a directory to the zip file, or search. - * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. - * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. - */ - folder: function(arg) { - if (!arg) { - return this; - } - - if (isRegExp(arg)) { - return this.filter(function(relativePath, file) { - return file.dir && arg.test(relativePath); - }); - } - - // else, name is a new folder - var name = this.root + arg; - var newFolder = folderAdd.call(this, name); - - // Allow chaining by returning a new object with this folder as the root - var ret = this.clone(); - ret.root = newFolder.name; - return ret; - }, - - /** - * Delete a file, or a directory and all sub-files, from the zip - * @param {string} name the name of the file to delete - * @return {JSZip} this JSZip object - */ - remove: function(name) { - name = this.root + name; - var file = this.files[name]; - if (!file) { - // Look for any folders - if (name.slice(-1) !== "/") { - name += "/"; - } - file = this.files[name]; - } - - if (file && !file.dir) { - // file - delete this.files[name]; - } else { - // maybe a folder, delete recursively - var kids = this.filter(function(relativePath, file) { - return file.name.slice(0, name.length) === name; - }); - for (var i = 0; i < kids.length; i++) { - delete this.files[kids[i].name]; - } - } - - return this; - }, - - /** - * Generate the complete zip file - * @param {Object} options the options to generate the zip file : - * - compression, "STORE" by default. - * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. - * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file - */ - generate: function(options) { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, - - /** - * Generate the complete zip file as an internal stream. - * @param {Object} options the options to generate the zip file : - * - compression, "STORE" by default. - * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. - * @return {StreamHelper} the streamed zip file. - */ - generateInternalStream: function(options) { - var worker, opts = {}; - try { - opts = utils.extend(options || {}, { - streamFiles: false, - compression: "STORE", - compressionOptions : null, - type: "", - platform: "DOS", - comment: null, - mimeType: 'application/zip', - encodeFileName: utf8.utf8encode - }); - - opts.type = opts.type.toLowerCase(); - opts.compression = opts.compression.toUpperCase(); - - // "binarystring" is preferred but the internals use "string". - if(opts.type === "binarystring") { - opts.type = "string"; - } - - if (!opts.type) { - throw new Error("No output type specified."); - } - - utils.checkSupport(opts.type); - - // accept nodejs `process.platform` - if( - opts.platform === 'darwin' || - opts.platform === 'freebsd' || - opts.platform === 'linux' || - opts.platform === 'sunos' - ) { - opts.platform = "UNIX"; - } - if (opts.platform === 'win32') { - opts.platform = "DOS"; - } - - var comment = opts.comment || this.comment || ""; - worker = generate.generateWorker(this, opts, comment); - } catch (e) { - worker = new GenericWorker("error"); - worker.error(e); - } - return new StreamHelper(worker, opts.type || "string", opts.mimeType); - }, - /** - * Generate the complete zip file asynchronously. - * @see generateInternalStream - */ - generateAsync: function(options, onUpdate) { - return this.generateInternalStream(options).accumulate(onUpdate); - }, - /** - * Generate the complete zip file asynchronously. - * @see generateInternalStream - */ - generateNodeStream: function(options, onUpdate) { - options = options || {}; - if (!options.type) { - options.type = "nodebuffer"; - } - return this.generateInternalStream(options).toNodejsStream(onUpdate); - } -}; -module.exports = out; - -},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(require,module,exports){ -/* - * This file is used by module bundlers (browserify/webpack/etc) when - * including a stream implementation. We use "readable-stream" to get a - * consistent behavior between nodejs versions but bundlers often have a shim - * for "stream". Using this shim greatly improve the compatibility and greatly - * reduce the final size of the bundle (only one stream implementation, not - * two). - */ -module.exports = require("stream"); - -},{"stream":undefined}],17:[function(require,module,exports){ -'use strict'; -var DataReader = require('./DataReader'); -var utils = require('../utils'); - -function ArrayReader(data) { - DataReader.call(this, data); - for(var i = 0; i < this.data.length; i++) { - data[i] = data[i] & 0xFF; - } -} -utils.inherits(ArrayReader, DataReader); -/** - * @see DataReader.byteAt - */ -ArrayReader.prototype.byteAt = function(i) { - return this.data[this.zero + i]; -}; -/** - * @see DataReader.lastIndexOfSignature - */ -ArrayReader.prototype.lastIndexOfSignature = function(sig) { - var sig0 = sig.charCodeAt(0), - sig1 = sig.charCodeAt(1), - sig2 = sig.charCodeAt(2), - sig3 = sig.charCodeAt(3); - for (var i = this.length - 4; i >= 0; --i) { - if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { - return i - this.zero; - } - } - - return -1; -}; -/** - * @see DataReader.readAndCheckSignature - */ -ArrayReader.prototype.readAndCheckSignature = function (sig) { - var sig0 = sig.charCodeAt(0), - sig1 = sig.charCodeAt(1), - sig2 = sig.charCodeAt(2), - sig3 = sig.charCodeAt(3), - data = this.readData(4); - return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3]; -}; -/** - * @see DataReader.readData - */ -ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if(size === 0) { - return []; - } - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = ArrayReader; - -},{"../utils":32,"./DataReader":18}],18:[function(require,module,exports){ -'use strict'; -var utils = require('../utils'); - -function DataReader(data) { - this.data = data; // type : see implementation - this.length = data.length; - this.index = 0; - this.zero = 0; -} -DataReader.prototype = { - /** - * Check that the offset will not go too far. - * @param {string} offset the additional offset to check. - * @throws {Error} an Error if the offset is out of bounds. - */ - checkOffset: function(offset) { - this.checkIndex(this.index + offset); - }, - /** - * Check that the specified index will not be too far. - * @param {string} newIndex the index to check. - * @throws {Error} an Error if the index is out of bounds. - */ - checkIndex: function(newIndex) { - if (this.length < this.zero + newIndex || newIndex < 0) { - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); - } - }, - /** - * Change the index. - * @param {number} newIndex The new index. - * @throws {Error} if the new index is out of the data. - */ - setIndex: function(newIndex) { - this.checkIndex(newIndex); - this.index = newIndex; - }, - /** - * Skip the next n bytes. - * @param {number} n the number of bytes to skip. - * @throws {Error} if the new index is out of the data. - */ - skip: function(n) { - this.setIndex(this.index + n); - }, - /** - * Get the byte at the specified index. - * @param {number} i the index to use. - * @return {number} a byte. - */ - byteAt: function(i) { - // see implementations - }, - /** - * Get the next number with a given byte size. - * @param {number} size the number of bytes to read. - * @return {number} the corresponding number. - */ - readInt: function(size) { - var result = 0, - i; - this.checkOffset(size); - for (i = this.index + size - 1; i >= this.index; i--) { - result = (result << 8) + this.byteAt(i); - } - this.index += size; - return result; - }, - /** - * Get the next string with a given byte size. - * @param {number} size the number of bytes to read. - * @return {string} the corresponding string. - */ - readString: function(size) { - return utils.transformTo("string", this.readData(size)); - }, - /** - * Get raw data without conversion, bytes. - * @param {number} size the number of bytes to read. - * @return {Object} the raw data, implementation specific. - */ - readData: function(size) { - // see implementations - }, - /** - * Find the last occurrence of a zip signature (4 bytes). - * @param {string} sig the signature to find. - * @return {number} the index of the last occurrence, -1 if not found. - */ - lastIndexOfSignature: function(sig) { - // see implementations - }, - /** - * Read the signature (4 bytes) at the current position and compare it with sig. - * @param {string} sig the expected signature - * @return {boolean} true if the signature matches, false otherwise. - */ - readAndCheckSignature: function(sig) { - // see implementations - }, - /** - * Get the next date. - * @return {Date} the date. - */ - readDate: function() { - var dostime = this.readInt(4); - return new Date(Date.UTC( - ((dostime >> 25) & 0x7f) + 1980, // year - ((dostime >> 21) & 0x0f) - 1, // month - (dostime >> 16) & 0x1f, // day - (dostime >> 11) & 0x1f, // hour - (dostime >> 5) & 0x3f, // minute - (dostime & 0x1f) << 1)); // second - } -}; -module.exports = DataReader; - -},{"../utils":32}],19:[function(require,module,exports){ -'use strict'; -var Uint8ArrayReader = require('./Uint8ArrayReader'); -var utils = require('../utils'); - -function NodeBufferReader(data) { - Uint8ArrayReader.call(this, data); -} -utils.inherits(NodeBufferReader, Uint8ArrayReader); - -/** - * @see DataReader.readData - */ -NodeBufferReader.prototype.readData = function(size) { - this.checkOffset(size); - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = NodeBufferReader; - -},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(require,module,exports){ -'use strict'; -var DataReader = require('./DataReader'); -var utils = require('../utils'); - -function StringReader(data) { - DataReader.call(this, data); -} -utils.inherits(StringReader, DataReader); -/** - * @see DataReader.byteAt - */ -StringReader.prototype.byteAt = function(i) { - return this.data.charCodeAt(this.zero + i); -}; -/** - * @see DataReader.lastIndexOfSignature - */ -StringReader.prototype.lastIndexOfSignature = function(sig) { - return this.data.lastIndexOf(sig) - this.zero; -}; -/** - * @see DataReader.readAndCheckSignature - */ -StringReader.prototype.readAndCheckSignature = function (sig) { - var data = this.readData(4); - return sig === data; -}; -/** - * @see DataReader.readData - */ -StringReader.prototype.readData = function(size) { - this.checkOffset(size); - // this will work because the constructor applied the "& 0xff" mask. - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = StringReader; - -},{"../utils":32,"./DataReader":18}],21:[function(require,module,exports){ -'use strict'; -var ArrayReader = require('./ArrayReader'); -var utils = require('../utils'); - -function Uint8ArrayReader(data) { - ArrayReader.call(this, data); -} -utils.inherits(Uint8ArrayReader, ArrayReader); -/** - * @see DataReader.readData - */ -Uint8ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if(size === 0) { - // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. - return new Uint8Array(0); - } - var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = Uint8ArrayReader; - -},{"../utils":32,"./ArrayReader":17}],22:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var support = require('../support'); -var ArrayReader = require('./ArrayReader'); -var StringReader = require('./StringReader'); -var NodeBufferReader = require('./NodeBufferReader'); -var Uint8ArrayReader = require('./Uint8ArrayReader'); - -/** - * Create a reader adapted to the data. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read. - * @return {DataReader} the data reader. - */ -module.exports = function (data) { - var type = utils.getTypeOf(data); - utils.checkSupport(type); - if (type === "string" && !support.uint8array) { - return new StringReader(data); - } - if (type === "nodebuffer") { - return new NodeBufferReader(data); - } - if (support.uint8array) { - return new Uint8ArrayReader(utils.transformTo("uint8array", data)); - } - return new ArrayReader(utils.transformTo("array", data)); -}; - -},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(require,module,exports){ -'use strict'; -exports.LOCAL_FILE_HEADER = "PK\x03\x04"; -exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; -exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; -exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; -exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; -exports.DATA_DESCRIPTOR = "PK\x07\x08"; - -},{}],24:[function(require,module,exports){ -'use strict'; - -var GenericWorker = require('./GenericWorker'); -var utils = require('../utils'); - -/** - * A worker which convert chunks to a specified type. - * @constructor - * @param {String} destType the destination type. - */ -function ConvertWorker(destType) { - GenericWorker.call(this, "ConvertWorker to " + destType); - this.destType = destType; -} -utils.inherits(ConvertWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -ConvertWorker.prototype.processChunk = function (chunk) { - this.push({ - data : utils.transformTo(this.destType, chunk.data), - meta : chunk.meta - }); -}; -module.exports = ConvertWorker; - -},{"../utils":32,"./GenericWorker":28}],25:[function(require,module,exports){ -'use strict'; - -var GenericWorker = require('./GenericWorker'); -var crc32 = require('../crc32'); -var utils = require('../utils'); - -/** - * A worker which calculate the crc32 of the data flowing through. - * @constructor - */ -function Crc32Probe() { - GenericWorker.call(this, "Crc32Probe"); - this.withStreamInfo("crc32", 0); -} -utils.inherits(Crc32Probe, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -Crc32Probe.prototype.processChunk = function (chunk) { - this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0); - this.push(chunk); -}; -module.exports = Crc32Probe; - -},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var GenericWorker = require('./GenericWorker'); - -/** - * A worker which calculate the total length of the data flowing through. - * @constructor - * @param {String} propName the name used to expose the length - */ -function DataLengthProbe(propName) { - GenericWorker.call(this, "DataLengthProbe for " + propName); - this.propName = propName; - this.withStreamInfo(propName, 0); -} -utils.inherits(DataLengthProbe, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -DataLengthProbe.prototype.processChunk = function (chunk) { - if(chunk) { - var length = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = length + chunk.data.length; - } - GenericWorker.prototype.processChunk.call(this, chunk); -}; -module.exports = DataLengthProbe; - - -},{"../utils":32,"./GenericWorker":28}],27:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var GenericWorker = require('./GenericWorker'); - -// the size of the generated chunks -// TODO expose this as a public variable -var DEFAULT_BLOCK_SIZE = 16 * 1024; - -/** - * A worker that reads a content and emits chunks. - * @constructor - * @param {Promise} dataP the promise of the data to split - */ -function DataWorker(dataP) { - GenericWorker.call(this, "DataWorker"); - var self = this; - this.dataIsReady = false; - this.index = 0; - this.max = 0; - this.data = null; - this.type = ""; - - this._tickScheduled = false; - - dataP.then(function (data) { - self.dataIsReady = true; - self.data = data; - self.max = data && data.length || 0; - self.type = utils.getTypeOf(data); - if(!self.isPaused) { - self._tickAndRepeat(); - } - }, function (e) { - self.error(e); - }); -} - -utils.inherits(DataWorker, GenericWorker); - -/** - * @see GenericWorker.cleanUp - */ -DataWorker.prototype.cleanUp = function () { - GenericWorker.prototype.cleanUp.call(this); - this.data = null; -}; - -/** - * @see GenericWorker.resume - */ -DataWorker.prototype.resume = function () { - if(!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if (!this._tickScheduled && this.dataIsReady) { - this._tickScheduled = true; - utils.delay(this._tickAndRepeat, [], this); - } - return true; -}; - -/** - * Trigger a tick a schedule an other call to this function. - */ -DataWorker.prototype._tickAndRepeat = function() { - this._tickScheduled = false; - if(this.isPaused || this.isFinished) { - return; - } - this._tick(); - if(!this.isFinished) { - utils.delay(this._tickAndRepeat, [], this); - this._tickScheduled = true; - } -}; - -/** - * Read and push a chunk. - */ -DataWorker.prototype._tick = function() { - - if(this.isPaused || this.isFinished) { - return false; - } - - var size = DEFAULT_BLOCK_SIZE; - var data = null, nextIndex = Math.min(this.max, this.index + size); - if (this.index >= this.max) { - // EOF - return this.end(); - } else { - switch(this.type) { - case "string": - data = this.data.substring(this.index, nextIndex); - break; - case "uint8array": - data = this.data.subarray(this.index, nextIndex); - break; - case "array": - case "nodebuffer": - data = this.data.slice(this.index, nextIndex); - break; - } - this.index = nextIndex; - return this.push({ - data : data, - meta : { - percent : this.max ? this.index / this.max * 100 : 0 - } - }); - } -}; - -module.exports = DataWorker; - -},{"../utils":32,"./GenericWorker":28}],28:[function(require,module,exports){ -'use strict'; - -/** - * A worker that does nothing but passing chunks to the next one. This is like - * a nodejs stream but with some differences. On the good side : - * - it works on IE 6-9 without any issue / polyfill - * - it weights less than the full dependencies bundled with browserify - * - it forwards errors (no need to declare an error handler EVERYWHERE) - * - * A chunk is an object with 2 attributes : `meta` and `data`. The former is an - * object containing anything (`percent` for example), see each worker for more - * details. The latter is the real data (String, Uint8Array, etc). - * - * @constructor - * @param {String} name the name of the stream (mainly used for debugging purposes) - */ -function GenericWorker(name) { - // the name of the worker - this.name = name || "default"; - // an object containing metadata about the workers chain - this.streamInfo = {}; - // an error which happened when the worker was paused - this.generatedError = null; - // an object containing metadata to be merged by this worker into the general metadata - this.extraStreamInfo = {}; - // true if the stream is paused (and should not do anything), false otherwise - this.isPaused = true; - // true if the stream is finished (and should not do anything), false otherwise - this.isFinished = false; - // true if the stream is locked to prevent further structure updates (pipe), false otherwise - this.isLocked = false; - // the event listeners - this._listeners = { - 'data':[], - 'end':[], - 'error':[] - }; - // the previous worker, if any - this.previous = null; -} - -GenericWorker.prototype = { - /** - * Push a chunk to the next workers. - * @param {Object} chunk the chunk to push - */ - push : function (chunk) { - this.emit("data", chunk); - }, - /** - * End the stream. - * @return {Boolean} true if this call ended the worker, false otherwise. - */ - end : function () { - if (this.isFinished) { - return false; - } - - this.flush(); - try { - this.emit("end"); - this.cleanUp(); - this.isFinished = true; - } catch (e) { - this.emit("error", e); - } - return true; - }, - /** - * End the stream with an error. - * @param {Error} e the error which caused the premature end. - * @return {Boolean} true if this call ended the worker with an error, false otherwise. - */ - error : function (e) { - if (this.isFinished) { - return false; - } - - if(this.isPaused) { - this.generatedError = e; - } else { - this.isFinished = true; - - this.emit("error", e); - - // in the workers chain exploded in the middle of the chain, - // the error event will go downward but we also need to notify - // workers upward that there has been an error. - if(this.previous) { - this.previous.error(e); - } - - this.cleanUp(); - } - return true; - }, - /** - * Add a callback on an event. - * @param {String} name the name of the event (data, end, error) - * @param {Function} listener the function to call when the event is triggered - * @return {GenericWorker} the current object for chainability - */ - on : function (name, listener) { - this._listeners[name].push(listener); - return this; - }, - /** - * Clean any references when a worker is ending. - */ - cleanUp : function () { - this.streamInfo = this.generatedError = this.extraStreamInfo = null; - this._listeners = []; - }, - /** - * Trigger an event. This will call registered callback with the provided arg. - * @param {String} name the name of the event (data, end, error) - * @param {Object} arg the argument to call the callback with. - */ - emit : function (name, arg) { - if (this._listeners[name]) { - for(var i = 0; i < this._listeners[name].length; i++) { - this._listeners[name][i].call(this, arg); - } - } - }, - /** - * Chain a worker with an other. - * @param {Worker} next the worker receiving events from the current one. - * @return {worker} the next worker for chainability - */ - pipe : function (next) { - return next.registerPrevious(this); - }, - /** - * Same as `pipe` in the other direction. - * Using an API with `pipe(next)` is very easy. - * Implementing the API with the point of view of the next one registering - * a source is easier, see the ZipFileWorker. - * @param {Worker} previous the previous worker, sending events to this one - * @return {Worker} the current worker for chainability - */ - registerPrevious : function (previous) { - if (this.isLocked) { - throw new Error("The stream '" + this + "' has already been used."); - } - - // sharing the streamInfo... - this.streamInfo = previous.streamInfo; - // ... and adding our own bits - this.mergeStreamInfo(); - this.previous = previous; - var self = this; - previous.on('data', function (chunk) { - self.processChunk(chunk); - }); - previous.on('end', function () { - self.end(); - }); - previous.on('error', function (e) { - self.error(e); - }); - return this; - }, - /** - * Pause the stream so it doesn't send events anymore. - * @return {Boolean} true if this call paused the worker, false otherwise. - */ - pause : function () { - if(this.isPaused || this.isFinished) { - return false; - } - this.isPaused = true; - - if(this.previous) { - this.previous.pause(); - } - return true; - }, - /** - * Resume a paused stream. - * @return {Boolean} true if this call resumed the worker, false otherwise. - */ - resume : function () { - if(!this.isPaused || this.isFinished) { - return false; - } - this.isPaused = false; - - // if true, the worker tried to resume but failed - var withError = false; - if(this.generatedError) { - this.error(this.generatedError); - withError = true; - } - if(this.previous) { - this.previous.resume(); - } - - return !withError; - }, - /** - * Flush any remaining bytes as the stream is ending. - */ - flush : function () {}, - /** - * Process a chunk. This is usually the method overridden. - * @param {Object} chunk the chunk to process. - */ - processChunk : function(chunk) { - this.push(chunk); - }, - /** - * Add a key/value to be added in the workers chain streamInfo once activated. - * @param {String} key the key to use - * @param {Object} value the associated value - * @return {Worker} the current worker for chainability - */ - withStreamInfo : function (key, value) { - this.extraStreamInfo[key] = value; - this.mergeStreamInfo(); - return this; - }, - /** - * Merge this worker's streamInfo into the chain's streamInfo. - */ - mergeStreamInfo : function () { - for(var key in this.extraStreamInfo) { - if (!this.extraStreamInfo.hasOwnProperty(key)) { - continue; - } - this.streamInfo[key] = this.extraStreamInfo[key]; - } - }, - - /** - * Lock the stream to prevent further updates on the workers chain. - * After calling this method, all calls to pipe will fail. - */ - lock: function () { - if (this.isLocked) { - throw new Error("The stream '" + this + "' has already been used."); - } - this.isLocked = true; - if (this.previous) { - this.previous.lock(); - } - }, - - /** - * - * Pretty print the workers chain. - */ - toString : function () { - var me = "Worker " + this.name; - if (this.previous) { - return this.previous + " -> " + me; - } else { - return me; - } - } -}; - -module.exports = GenericWorker; - -},{}],29:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var ConvertWorker = require('./ConvertWorker'); -var GenericWorker = require('./GenericWorker'); -var base64 = require('../base64'); -var support = require("../support"); -var external = require("../external"); - -var NodejsStreamOutputAdapter = null; -if (support.nodestream) { - try { - NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter'); - } catch(e) {} -} - -/** - * Apply the final transformation of the data. If the user wants a Blob for - * example, it's easier to work with an U8intArray and finally do the - * ArrayBuffer/Blob conversion. - * @param {String} type the name of the final type - * @param {String|Uint8Array|Buffer} content the content to transform - * @param {String} mimeType the mime type of the content, if applicable. - * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format. - */ -function transformZipOutput(type, content, mimeType) { - switch(type) { - case "blob" : - return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType); - case "base64" : - return base64.encode(content); - default : - return utils.transformTo(type, content); - } -} - -/** - * Concatenate an array of data of the given type. - * @param {String} type the type of the data in the given array. - * @param {Array} dataArray the array containing the data chunks to concatenate - * @return {String|Uint8Array|Buffer} the concatenated data - * @throws Error if the asked type is unsupported - */ -function concat (type, dataArray) { - var i, index = 0, res = null, totalLength = 0; - for(i = 0; i < dataArray.length; i++) { - totalLength += dataArray[i].length; - } - switch(type) { - case "string": - return dataArray.join(""); - case "array": - return Array.prototype.concat.apply([], dataArray); - case "uint8array": - res = new Uint8Array(totalLength); - for(i = 0; i < dataArray.length; i++) { - res.set(dataArray[i], index); - index += dataArray[i].length; - } - return res; - case "nodebuffer": - return Buffer.concat(dataArray); - default: - throw new Error("concat : unsupported type '" + type + "'"); - } -} - -/** - * Listen a StreamHelper, accumulate its content and concatenate it into a - * complete block. - * @param {StreamHelper} helper the helper to use. - * @param {Function} updateCallback a callback called on each update. Called - * with one arg : - * - the metadata linked to the update received. - * @return Promise the promise for the accumulation. - */ -function accumulate(helper, updateCallback) { - return new external.Promise(function (resolve, reject){ - var dataArray = []; - var chunkType = helper._internalType, - resultType = helper._outputType, - mimeType = helper._mimeType; - helper - .on('data', function (data, meta) { - dataArray.push(data); - if(updateCallback) { - updateCallback(meta); - } - }) - .on('error', function(err) { - dataArray = []; - reject(err); - }) - .on('end', function (){ - try { - var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); - resolve(result); - } catch (e) { - reject(e); - } - dataArray = []; - }) - .resume(); - }); -} - -/** - * An helper to easily use workers outside of JSZip. - * @constructor - * @param {Worker} worker the worker to wrap - * @param {String} outputType the type of data expected by the use - * @param {String} mimeType the mime type of the content, if applicable. - */ -function StreamHelper(worker, outputType, mimeType) { - var internalType = outputType; - switch(outputType) { - case "blob": - case "arraybuffer": - internalType = "uint8array"; - break; - case "base64": - internalType = "string"; - break; - } - - try { - // the type used internally - this._internalType = internalType; - // the type used to output results - this._outputType = outputType; - // the mime type - this._mimeType = mimeType; - utils.checkSupport(internalType); - this._worker = worker.pipe(new ConvertWorker(internalType)); - // the last workers can be rewired without issues but we need to - // prevent any updates on previous workers. - worker.lock(); - } catch(e) { - this._worker = new GenericWorker("error"); - this._worker.error(e); - } -} - -StreamHelper.prototype = { - /** - * Listen a StreamHelper, accumulate its content and concatenate it into a - * complete block. - * @param {Function} updateCb the update callback. - * @return Promise the promise for the accumulation. - */ - accumulate : function (updateCb) { - return accumulate(this, updateCb); - }, - /** - * Add a listener on an event triggered on a stream. - * @param {String} evt the name of the event - * @param {Function} fn the listener - * @return {StreamHelper} the current helper. - */ - on : function (evt, fn) { - var self = this; - - if(evt === "data") { - this._worker.on(evt, function (chunk) { - fn.call(self, chunk.data, chunk.meta); - }); - } else { - this._worker.on(evt, function () { - utils.delay(fn, arguments, self); - }); - } - return this; - }, - /** - * Resume the flow of chunks. - * @return {StreamHelper} the current helper. - */ - resume : function () { - utils.delay(this._worker.resume, [], this._worker); - return this; - }, - /** - * Pause the flow of chunks. - * @return {StreamHelper} the current helper. - */ - pause : function () { - this._worker.pause(); - return this; - }, - /** - * Return a nodejs stream for this helper. - * @param {Function} updateCb the update callback. - * @return {NodejsStreamOutputAdapter} the nodejs stream. - */ - toNodejsStream : function (updateCb) { - utils.checkSupport("nodestream"); - if (this._outputType !== "nodebuffer") { - // an object stream containing blob/arraybuffer/uint8array/string - // is strange and I don't know if it would be useful. - // I you find this comment and have a good usecase, please open a - // bug report ! - throw new Error(this._outputType + " is not supported by this method"); - } - - return new NodejsStreamOutputAdapter(this, { - objectMode : this._outputType !== "nodebuffer" - }, updateCb); - } -}; - - -module.exports = StreamHelper; - -},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(require,module,exports){ -'use strict'; - -exports.base64 = true; -exports.array = true; -exports.string = true; -exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; -exports.nodebuffer = typeof Buffer !== "undefined"; -// contains true if JSZip can read/generate Uint8Array, false otherwise. -exports.uint8array = typeof Uint8Array !== "undefined"; - -if (typeof ArrayBuffer === "undefined") { - exports.blob = false; -} -else { - var buffer = new ArrayBuffer(0); - try { - exports.blob = new Blob([buffer], { - type: "application/zip" - }).size === 0; - } - catch (e) { - try { - var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; - var builder = new Builder(); - builder.append(buffer); - exports.blob = builder.getBlob('application/zip').size === 0; - } - catch (e) { - exports.blob = false; - } - } -} - -try { - exports.nodestream = !!require('readable-stream').Readable; -} catch(e) { - exports.nodestream = false; -} - -},{"readable-stream":16}],31:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); -var support = require('./support'); -var nodejsUtils = require('./nodejsUtils'); -var GenericWorker = require('./stream/GenericWorker'); - -/** - * The following functions come from pako, from pako/lib/utils/strings - * released under the MIT license, see pako https://github.com/nodeca/pako/ - */ - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new Array(256); -for (var i=0; i<256; i++) { - _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); -} -_utf8len[254]=_utf8len[254]=1; // Invalid sequence start - -// convert string to array (typed, when possible) -var string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { - c2 = str.charCodeAt(m_pos+1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - if (support.uint8array) { - buf = new Uint8Array(buf_len); - } else { - buf = new Array(buf_len); - } - - // convert - for (i=0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { - c2 = str.charCodeAt(m_pos+1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -var utf8border = function(buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max-1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Fuckup - very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means vuffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; - -// convert array to string -var buf2string = function (buf) { - var str, i, out, c, c_len; - var len = buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len*2); - - for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - // shrinkBuf(utf16buf, out) - if (utf16buf.length !== out) { - if(utf16buf.subarray) { - utf16buf = utf16buf.subarray(0, out); - } else { - utf16buf.length = out; - } - } - - // return String.fromCharCode.apply(null, utf16buf); - return utils.applyFromCharCode(utf16buf); -}; - - -// That's all for the pako functions. - - -/** - * Transform a javascript string into an array (typed if possible) of bytes, - * UTF-8 encoded. - * @param {String} str the string to encode - * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. - */ -exports.utf8encode = function utf8encode(str) { - if (support.nodebuffer) { - return nodejsUtils.newBufferFrom(str, "utf-8"); - } - - return string2buf(str); -}; - - -/** - * Transform a bytes array (or a representation) representing an UTF-8 encoded - * string into a javascript string. - * @param {Array|Uint8Array|Buffer} buf the data de decode - * @return {String} the decoded string. - */ -exports.utf8decode = function utf8decode(buf) { - if (support.nodebuffer) { - return utils.transformTo("nodebuffer", buf).toString("utf-8"); - } - - buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); - - return buf2string(buf); -}; - -/** - * A worker to decode utf8 encoded binary chunks into string chunks. - * @constructor - */ -function Utf8DecodeWorker() { - GenericWorker.call(this, "utf-8 decode"); - // the last bytes if a chunk didn't end with a complete codepoint. - this.leftOver = null; -} -utils.inherits(Utf8DecodeWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -Utf8DecodeWorker.prototype.processChunk = function (chunk) { - - var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data); - - // 1st step, re-use what's left of the previous chunk - if (this.leftOver && this.leftOver.length) { - if(support.uint8array) { - var previousData = data; - data = new Uint8Array(previousData.length + this.leftOver.length); - data.set(this.leftOver, 0); - data.set(previousData, this.leftOver.length); - } else { - data = this.leftOver.concat(data); - } - this.leftOver = null; - } - - var nextBoundary = utf8border(data); - var usableData = data; - if (nextBoundary !== data.length) { - if (support.uint8array) { - usableData = data.subarray(0, nextBoundary); - this.leftOver = data.subarray(nextBoundary, data.length); - } else { - usableData = data.slice(0, nextBoundary); - this.leftOver = data.slice(nextBoundary, data.length); - } - } - - this.push({ - data : exports.utf8decode(usableData), - meta : chunk.meta - }); -}; - -/** - * @see GenericWorker.flush - */ -Utf8DecodeWorker.prototype.flush = function () { - if(this.leftOver && this.leftOver.length) { - this.push({ - data : exports.utf8decode(this.leftOver), - meta : {} - }); - this.leftOver = null; - } -}; -exports.Utf8DecodeWorker = Utf8DecodeWorker; - -/** - * A worker to endcode string chunks into utf8 encoded binary chunks. - * @constructor - */ -function Utf8EncodeWorker() { - GenericWorker.call(this, "utf-8 encode"); -} -utils.inherits(Utf8EncodeWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -Utf8EncodeWorker.prototype.processChunk = function (chunk) { - this.push({ - data : exports.utf8encode(chunk.data), - meta : chunk.meta - }); -}; -exports.Utf8EncodeWorker = Utf8EncodeWorker; - -},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(require,module,exports){ -'use strict'; - -var support = require('./support'); -var base64 = require('./base64'); -var nodejsUtils = require('./nodejsUtils'); -var setImmediate = require('set-immediate-shim'); -var external = require("./external"); - - -/** - * Convert a string that pass as a "binary string": it should represent a byte - * array but may have > 255 char codes. Be sure to take only the first byte - * and returns the byte array. - * @param {String} str the string to transform. - * @return {Array|Uint8Array} the string in a binary format. - */ -function string2binary(str) { - var result = null; - if (support.uint8array) { - result = new Uint8Array(str.length); - } else { - result = new Array(str.length); - } - return stringToArrayLike(str, result); -} - -/** - * Create a new blob with the given content and the given type. - * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use - * an Uint8Array because the stock browser of android 4 won't accept it (it - * will be silently converted to a string, "[object Uint8Array]"). - * - * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge: - * when a large amount of Array is used to create the Blob, the amount of - * memory consumed is nearly 100 times the original data amount. - * - * @param {String} type the mime type of the blob. - * @return {Blob} the created blob. - */ -exports.newBlob = function(part, type) { - exports.checkSupport("blob"); - - try { - // Blob constructor - return new Blob([part], { - type: type - }); - } - catch (e) { - - try { - // deprecated, browser only, old way - var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; - var builder = new Builder(); - builder.append(part); - return builder.getBlob(type); - } - catch (e) { - - // well, fuck ?! - throw new Error("Bug : can't construct the Blob."); - } - } - - -}; -/** - * The identity function. - * @param {Object} input the input. - * @return {Object} the same input. - */ -function identity(input) { - return input; -} - -/** - * Fill in an array with a string. - * @param {String} str the string to use. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. - */ -function stringToArrayLike(str, array) { - for (var i = 0; i < str.length; ++i) { - array[i] = str.charCodeAt(i) & 0xFF; - } - return array; -} - -/** - * An helper for the function arrayLikeToString. - * This contains static information and functions that - * can be optimized by the browser JIT compiler. - */ -var arrayToStringHelper = { - /** - * Transform an array of int into a string, chunk by chunk. - * See the performances notes on arrayLikeToString. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @param {String} type the type of the array. - * @param {Integer} chunk the chunk size. - * @return {String} the resulting string. - * @throws Error if the chunk is too big for the stack. - */ - stringifyByChunk: function(array, type, chunk) { - var result = [], k = 0, len = array.length; - // shortcut - if (len <= chunk) { - return String.fromCharCode.apply(null, array); - } - while (k < len) { - if (type === "array" || type === "nodebuffer") { - result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); - } - else { - result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); - } - k += chunk; - } - return result.join(""); - }, - /** - * Call String.fromCharCode on every item in the array. - * This is the naive implementation, which generate A LOT of intermediate string. - * This should be used when everything else fail. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @return {String} the result. - */ - stringifyByChar: function(array){ - var resultStr = ""; - for(var i = 0; i < array.length; i++) { - resultStr += String.fromCharCode(array[i]); - } - return resultStr; - }, - applyCanBeUsed : { - /** - * true if the browser accepts to use String.fromCharCode on Uint8Array - */ - uint8array : (function () { - try { - return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1; - } catch (e) { - return false; - } - })(), - /** - * true if the browser accepts to use String.fromCharCode on nodejs Buffer. - */ - nodebuffer : (function () { - try { - return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1; - } catch (e) { - return false; - } - })() - } -}; - -/** - * Transform an array-like object to a string. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @return {String} the result. - */ -function arrayLikeToString(array) { - // Performances notes : - // -------------------- - // String.fromCharCode.apply(null, array) is the fastest, see - // see http://jsperf.com/converting-a-uint8array-to-a-string/2 - // but the stack is limited (and we can get huge arrays !). - // - // result += String.fromCharCode(array[i]); generate too many strings ! - // - // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 - // TODO : we now have workers that split the work. Do we still need that ? - var chunk = 65536, - type = exports.getTypeOf(array), - canUseApply = true; - if (type === "uint8array") { - canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array; - } else if (type === "nodebuffer") { - canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer; - } - - if (canUseApply) { - while (chunk > 1) { - try { - return arrayToStringHelper.stringifyByChunk(array, type, chunk); - } catch (e) { - chunk = Math.floor(chunk / 2); - } - } - } - - // no apply or chunk error : slow and painful algorithm - // default browser on android 4.* - return arrayToStringHelper.stringifyByChar(array); -} - -exports.applyFromCharCode = arrayLikeToString; - - -/** - * Copy the data from an array-like to an other array-like. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. - */ -function arrayLikeToArrayLike(arrayFrom, arrayTo) { - for (var i = 0; i < arrayFrom.length; i++) { - arrayTo[i] = arrayFrom[i]; - } - return arrayTo; -} - -// a matrix containing functions to transform everything into everything. -var transform = {}; - -// string to ? -transform["string"] = { - "string": identity, - "array": function(input) { - return stringToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return transform["string"]["uint8array"](input).buffer; - }, - "uint8array": function(input) { - return stringToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": function(input) { - return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length)); - } -}; - -// array to ? -transform["array"] = { - "string": arrayLikeToString, - "array": identity, - "arraybuffer": function(input) { - return (new Uint8Array(input)).buffer; - }, - "uint8array": function(input) { - return new Uint8Array(input); - }, - "nodebuffer": function(input) { - return nodejsUtils.newBufferFrom(input); - } -}; - -// arraybuffer to ? -transform["arraybuffer"] = { - "string": function(input) { - return arrayLikeToString(new Uint8Array(input)); - }, - "array": function(input) { - return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); - }, - "arraybuffer": identity, - "uint8array": function(input) { - return new Uint8Array(input); - }, - "nodebuffer": function(input) { - return nodejsUtils.newBufferFrom(new Uint8Array(input)); - } -}; - -// uint8array to ? -transform["uint8array"] = { - "string": arrayLikeToString, - "array": function(input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return input.buffer; - }, - "uint8array": identity, - "nodebuffer": function(input) { - return nodejsUtils.newBufferFrom(input); - } -}; - -// nodebuffer to ? -transform["nodebuffer"] = { - "string": arrayLikeToString, - "array": function(input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return transform["nodebuffer"]["uint8array"](input).buffer; - }, - "uint8array": function(input) { - return arrayLikeToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": identity -}; - -/** - * Transform an input into any type. - * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. - * If no output type is specified, the unmodified input will be returned. - * @param {String} outputType the output type. - * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. - * @throws {Error} an Error if the browser doesn't support the requested output type. - */ -exports.transformTo = function(outputType, input) { - if (!input) { - // undefined, null, etc - // an empty string won't harm. - input = ""; - } - if (!outputType) { - return input; - } - exports.checkSupport(outputType); - var inputType = exports.getTypeOf(input); - var result = transform[inputType][outputType](input); - return result; -}; - -/** - * Return the type of the input. - * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. - * @param {Object} input the input to identify. - * @return {String} the (lowercase) type of the input. - */ -exports.getTypeOf = function(input) { - if (typeof input === "string") { - return "string"; - } - if (Object.prototype.toString.call(input) === "[object Array]") { - return "array"; - } - if (support.nodebuffer && nodejsUtils.isBuffer(input)) { - return "nodebuffer"; - } - if (support.uint8array && input instanceof Uint8Array) { - return "uint8array"; - } - if (support.arraybuffer && input instanceof ArrayBuffer) { - return "arraybuffer"; - } -}; - -/** - * Throw an exception if the type is not supported. - * @param {String} type the type to check. - * @throws {Error} an Error if the browser doesn't support the requested type. - */ -exports.checkSupport = function(type) { - var supported = support[type.toLowerCase()]; - if (!supported) { - throw new Error(type + " is not supported by this platform"); - } -}; - -exports.MAX_VALUE_16BITS = 65535; -exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 - -/** - * Prettify a string read as binary. - * @param {string} str the string to prettify. - * @return {string} a pretty string. - */ -exports.pretty = function(str) { - var res = '', - code, i; - for (i = 0; i < (str || "").length; i++) { - code = str.charCodeAt(i); - res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); - } - return res; -}; - -/** - * Defer the call of a function. - * @param {Function} callback the function to call asynchronously. - * @param {Array} args the arguments to give to the callback. - */ -exports.delay = function(callback, args, self) { - setImmediate(function () { - callback.apply(self || null, args || []); - }); -}; - -/** - * Extends a prototype with an other, without calling a constructor with - * side effects. Inspired by nodejs' `utils.inherits` - * @param {Function} ctor the constructor to augment - * @param {Function} superCtor the parent constructor to use - */ -exports.inherits = function (ctor, superCtor) { - var Obj = function() {}; - Obj.prototype = superCtor.prototype; - ctor.prototype = new Obj(); -}; - -/** - * Merge the objects passed as parameters into a new one. - * @private - * @param {...Object} var_args All objects to merge. - * @return {Object} a new object with the data of the others. - */ -exports.extend = function() { - var result = {}, i, attr; - for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers - for (attr in arguments[i]) { - if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { - result[attr] = arguments[i][attr]; - } - } - } - return result; -}; - -/** - * Transform arbitrary content into a Promise. - * @param {String} name a name for the content being processed. - * @param {Object} inputData the content to process. - * @param {Boolean} isBinary true if the content is not an unicode string - * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character. - * @param {Boolean} isBase64 true if the string content is encoded with base64. - * @return {Promise} a promise in a format usable by JSZip. - */ -exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) { - - // if inputData is already a promise, this flatten it. - var promise = external.Promise.resolve(inputData).then(function(data) { - - - var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1); - - if (isBlob && typeof FileReader !== "undefined") { - return new external.Promise(function (resolve, reject) { - var reader = new FileReader(); - - reader.onload = function(e) { - resolve(e.target.result); - }; - reader.onerror = function(e) { - reject(e.target.error); - }; - reader.readAsArrayBuffer(data); - }); - } else { - return data; - } - }); - - return promise.then(function(data) { - var dataType = exports.getTypeOf(data); - - if (!dataType) { - return external.Promise.reject( - new Error("Can't read the data of '" + name + "'. Is it " + - "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?") - ); - } - // special case : it's way easier to work with Uint8Array than with ArrayBuffer - if (dataType === "arraybuffer") { - data = exports.transformTo("uint8array", data); - } else if (dataType === "string") { - if (isBase64) { - data = base64.decode(data); - } - else if (isBinary) { - // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask - if (isOptimizedBinaryString !== true) { - // this is a string, not in a base64 format. - // Be sure that this is a correct "binary string" - data = string2binary(data); - } - } - } - return data; - }); -}; - -},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(require,module,exports){ -'use strict'; -var readerFor = require('./reader/readerFor'); -var utils = require('./utils'); -var sig = require('./signature'); -var ZipEntry = require('./zipEntry'); -var utf8 = require('./utf8'); -var support = require('./support'); -// class ZipEntries {{{ -/** - * All the entries in the zip file. - * @constructor - * @param {Object} loadOptions Options for loading the stream. - */ -function ZipEntries(loadOptions) { - this.files = []; - this.loadOptions = loadOptions; -} -ZipEntries.prototype = { - /** - * Check that the reader is on the specified signature. - * @param {string} expectedSignature the expected signature. - * @throws {Error} if it is an other signature. - */ - checkSignature: function(expectedSignature) { - if (!this.reader.readAndCheckSignature(expectedSignature)) { - this.reader.index -= 4; - var signature = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); - } - }, - /** - * Check if the given signature is at the given index. - * @param {number} askedIndex the index to check. - * @param {string} expectedSignature the signature to expect. - * @return {boolean} true if the signature is here, false otherwise. - */ - isSignature: function(askedIndex, expectedSignature) { - var currentIndex = this.reader.index; - this.reader.setIndex(askedIndex); - var signature = this.reader.readString(4); - var result = signature === expectedSignature; - this.reader.setIndex(currentIndex); - return result; - }, - /** - * Read the end of the central directory. - */ - readBlockEndOfCentral: function() { - this.diskNumber = this.reader.readInt(2); - this.diskWithCentralDirStart = this.reader.readInt(2); - this.centralDirRecordsOnThisDisk = this.reader.readInt(2); - this.centralDirRecords = this.reader.readInt(2); - this.centralDirSize = this.reader.readInt(4); - this.centralDirOffset = this.reader.readInt(4); - - this.zipCommentLength = this.reader.readInt(2); - // warning : the encoding depends of the system locale - // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. - // On a windows machine, this field is encoded with the localized windows code page. - var zipComment = this.reader.readData(this.zipCommentLength); - var decodeParamType = support.uint8array ? "uint8array" : "array"; - // To get consistent behavior with the generation part, we will assume that - // this is utf8 encoded unless specified otherwise. - var decodeContent = utils.transformTo(decodeParamType, zipComment); - this.zipComment = this.loadOptions.decodeFileName(decodeContent); - }, - /** - * Read the end of the Zip 64 central directory. - * Not merged with the method readEndOfCentral : - * The end of central can coexist with its Zip64 brother, - * I don't want to read the wrong number of bytes ! - */ - readBlockZip64EndOfCentral: function() { - this.zip64EndOfCentralSize = this.reader.readInt(8); - this.reader.skip(4); - // this.versionMadeBy = this.reader.readString(2); - // this.versionNeeded = this.reader.readInt(2); - this.diskNumber = this.reader.readInt(4); - this.diskWithCentralDirStart = this.reader.readInt(4); - this.centralDirRecordsOnThisDisk = this.reader.readInt(8); - this.centralDirRecords = this.reader.readInt(8); - this.centralDirSize = this.reader.readInt(8); - this.centralDirOffset = this.reader.readInt(8); - - this.zip64ExtensibleData = {}; - var extraDataSize = this.zip64EndOfCentralSize - 44, - index = 0, - extraFieldId, - extraFieldLength, - extraFieldValue; - while (index < extraDataSize) { - extraFieldId = this.reader.readInt(2); - extraFieldLength = this.reader.readInt(4); - extraFieldValue = this.reader.readData(extraFieldLength); - this.zip64ExtensibleData[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - }, - /** - * Read the end of the Zip 64 central directory locator. - */ - readBlockZip64EndOfCentralLocator: function() { - this.diskWithZip64CentralDirStart = this.reader.readInt(4); - this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); - this.disksCount = this.reader.readInt(4); - if (this.disksCount > 1) { - throw new Error("Multi-volumes zip are not supported"); - } - }, - /** - * Read the local files, based on the offset read in the central part. - */ - readLocalFiles: function() { - var i, file; - for (i = 0; i < this.files.length; i++) { - file = this.files[i]; - this.reader.setIndex(file.localHeaderOffset); - this.checkSignature(sig.LOCAL_FILE_HEADER); - file.readLocalPart(this.reader); - file.handleUTF8(); - file.processAttributes(); - } - }, - /** - * Read the central directory. - */ - readCentralDir: function() { - var file; - - this.reader.setIndex(this.centralDirOffset); - while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)) { - file = new ZipEntry({ - zip64: this.zip64 - }, this.loadOptions); - file.readCentralPart(this.reader); - this.files.push(file); - } - - if (this.centralDirRecords !== this.files.length) { - if (this.centralDirRecords !== 0 && this.files.length === 0) { - // We expected some records but couldn't find ANY. - // This is really suspicious, as if something went wrong. - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - } else { - // We found some records but not all. - // Something is wrong but we got something for the user: no error here. - // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length); - } - } - }, - /** - * Read the end of central directory. - */ - readEndOfCentral: function() { - var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); - if (offset < 0) { - // Check if the content is a truncated zip or complete garbage. - // A "LOCAL_FILE_HEADER" is not required at the beginning (auto - // extractible zip for example) but it can give a good hint. - // If an ajax request was used without responseType, we will also - // get unreadable data. - var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER); - - if (isGarbage) { - throw new Error("Can't find end of central directory : is this a zip file ? " + - "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); - } else { - throw new Error("Corrupted zip: can't find end of central directory"); - } - - } - this.reader.setIndex(offset); - var endOfCentralDirOffset = offset; - this.checkSignature(sig.CENTRAL_DIRECTORY_END); - this.readBlockEndOfCentral(); - - - /* extract from the zip spec : - 4) If one of the fields in the end of central directory - record is too small to hold required data, the field - should be set to -1 (0xFFFF or 0xFFFFFFFF) and the - ZIP64 format record should be created. - 5) The end of central directory record and the - Zip64 end of central directory locator record must - reside on the same disk when splitting or spanning - an archive. - */ - if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { - this.zip64 = true; - - /* - Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from - the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents - all numbers as 64-bit double precision IEEE 754 floating point numbers. - So, we have 53bits for integers and bitwise operations treat everything as 32bits. - see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators - and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 - */ - - // should look for a zip64 EOCD locator - offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - if (offset < 0) { - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); - } - this.reader.setIndex(offset); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - this.readBlockZip64EndOfCentralLocator(); - - // now the zip64 EOCD record - if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) { - // console.warn("ZIP64 end of central directory not where expected."); - this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - if (this.relativeOffsetEndOfZip64CentralDir < 0) { - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); - } - } - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - this.readBlockZip64EndOfCentral(); - } - - var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize; - if (this.zip64) { - expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator - expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize; - } - - var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset; - - if (extraBytes > 0) { - // console.warn(extraBytes, "extra bytes at beginning or within zipfile"); - if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) { - // The offsets seem wrong, but we have something at the specified offset. - // So… we keep it. - } else { - // the offset is wrong, update the "zero" of the reader - // this happens if data has been prepended (crx files for example) - this.reader.zero = extraBytes; - } - } else if (extraBytes < 0) { - throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes."); - } - }, - prepareReader: function(data) { - this.reader = readerFor(data); - }, - /** - * Read a zip file and create ZipEntries. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. - */ - load: function(data) { - this.prepareReader(data); - this.readEndOfCentral(); - this.readCentralDir(); - this.readLocalFiles(); - } -}; -// }}} end of ZipEntries -module.exports = ZipEntries; - -},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(require,module,exports){ -'use strict'; -var readerFor = require('./reader/readerFor'); -var utils = require('./utils'); -var CompressedObject = require('./compressedObject'); -var crc32fn = require('./crc32'); -var utf8 = require('./utf8'); -var compressions = require('./compressions'); -var support = require('./support'); - -var MADE_BY_DOS = 0x00; -var MADE_BY_UNIX = 0x03; - -/** - * Find a compression registered in JSZip. - * @param {string} compressionMethod the method magic to find. - * @return {Object|null} the JSZip compression object, null if none found. - */ -var findCompression = function(compressionMethod) { - for (var method in compressions) { - if (!compressions.hasOwnProperty(method)) { - continue; - } - if (compressions[method].magic === compressionMethod) { - return compressions[method]; - } - } - return null; -}; - -// class ZipEntry {{{ -/** - * An entry in the zip file. - * @constructor - * @param {Object} options Options of the current file. - * @param {Object} loadOptions Options for loading the stream. - */ -function ZipEntry(options, loadOptions) { - this.options = options; - this.loadOptions = loadOptions; -} -ZipEntry.prototype = { - /** - * say if the file is encrypted. - * @return {boolean} true if the file is encrypted, false otherwise. - */ - isEncrypted: function() { - // bit 1 is set - return (this.bitFlag & 0x0001) === 0x0001; - }, - /** - * say if the file has utf-8 filename/comment. - * @return {boolean} true if the filename/comment is in utf-8, false otherwise. - */ - useUTF8: function() { - // bit 11 is set - return (this.bitFlag & 0x0800) === 0x0800; - }, - /** - * Read the local part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readLocalPart: function(reader) { - var compression, localExtraFieldsLength; - - // we already know everything from the central dir ! - // If the central dir data are false, we are doomed. - // On the bright side, the local part is scary : zip64, data descriptors, both, etc. - // The less data we get here, the more reliable this should be. - // Let's skip the whole header and dash to the data ! - reader.skip(22); - // in some zip created on windows, the filename stored in the central dir contains \ instead of /. - // Strangely, the filename here is OK. - // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes - // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... - // Search "unzip mismatching "local" filename continuing with "central" filename version" on - // the internet. - // - // I think I see the logic here : the central directory is used to display - // content and the local directory is used to extract the files. Mixing / and \ - // may be used to display \ to windows users and use / when extracting the files. - // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 - this.fileNameLength = reader.readInt(2); - localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir - // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding. - this.fileName = reader.readData(this.fileNameLength); - reader.skip(localExtraFieldsLength); - - if (this.compressedSize === -1 || this.uncompressedSize === -1) { - throw new Error("Bug or corrupted zip : didn't get enough information from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)"); - } - - compression = findCompression(this.compressionMethod); - if (compression === null) { // no compression found - throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")"); - } - this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize)); - }, - - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readCentralPart: function(reader) { - this.versionMadeBy = reader.readInt(2); - reader.skip(2); - // this.versionNeeded = reader.readInt(2); - this.bitFlag = reader.readInt(2); - this.compressionMethod = reader.readString(2); - this.date = reader.readDate(); - this.crc32 = reader.readInt(4); - this.compressedSize = reader.readInt(4); - this.uncompressedSize = reader.readInt(4); - var fileNameLength = reader.readInt(2); - this.extraFieldsLength = reader.readInt(2); - this.fileCommentLength = reader.readInt(2); - this.diskNumberStart = reader.readInt(2); - this.internalFileAttributes = reader.readInt(2); - this.externalFileAttributes = reader.readInt(4); - this.localHeaderOffset = reader.readInt(4); - - if (this.isEncrypted()) { - throw new Error("Encrypted zip are not supported"); - } - - // will be read in the local part, see the comments there - reader.skip(fileNameLength); - this.readExtraFields(reader); - this.parseZIP64ExtraField(reader); - this.fileComment = reader.readData(this.fileCommentLength); - }, - - /** - * Parse the external file attributes and get the unix/dos permissions. - */ - processAttributes: function () { - this.unixPermissions = null; - this.dosPermissions = null; - var madeBy = this.versionMadeBy >> 8; - - // Check if we have the DOS directory flag set. - // We look for it in the DOS and UNIX permissions - // but some unknown platform could set it as a compatibility flag. - this.dir = this.externalFileAttributes & 0x0010 ? true : false; - - if(madeBy === MADE_BY_DOS) { - // first 6 bits (0 to 5) - this.dosPermissions = this.externalFileAttributes & 0x3F; - } - - if(madeBy === MADE_BY_UNIX) { - this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF; - // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8); - } - - // fail safe : if the name ends with a / it probably means a folder - if (!this.dir && this.fileNameStr.slice(-1) === '/') { - this.dir = true; - } - }, - - /** - * Parse the ZIP64 extra field and merge the info in the current ZipEntry. - * @param {DataReader} reader the reader to use. - */ - parseZIP64ExtraField: function(reader) { - - if (!this.extraFields[0x0001]) { - return; - } - - // should be something, preparing the extra reader - var extraReader = readerFor(this.extraFields[0x0001].value); - - // I really hope that these 64bits integer can fit in 32 bits integer, because js - // won't let us have more. - if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { - this.uncompressedSize = extraReader.readInt(8); - } - if (this.compressedSize === utils.MAX_VALUE_32BITS) { - this.compressedSize = extraReader.readInt(8); - } - if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { - this.localHeaderOffset = extraReader.readInt(8); - } - if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { - this.diskNumberStart = extraReader.readInt(4); - } - }, - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readExtraFields: function(reader) { - var end = reader.index + this.extraFieldsLength, - extraFieldId, - extraFieldLength, - extraFieldValue; - - if (!this.extraFields) { - this.extraFields = {}; - } - - while (reader.index + 4 < end) { - extraFieldId = reader.readInt(2); - extraFieldLength = reader.readInt(2); - extraFieldValue = reader.readData(extraFieldLength); - - this.extraFields[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - - reader.setIndex(end); - }, - /** - * Apply an UTF8 transformation if needed. - */ - handleUTF8: function() { - var decodeParamType = support.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) { - this.fileNameStr = utf8.utf8decode(this.fileName); - this.fileCommentStr = utf8.utf8decode(this.fileComment); - } else { - var upath = this.findExtraFieldUnicodePath(); - if (upath !== null) { - this.fileNameStr = upath; - } else { - // ASCII text or unsupported code page - var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray); - } - - var ucomment = this.findExtraFieldUnicodeComment(); - if (ucomment !== null) { - this.fileCommentStr = ucomment; - } else { - // ASCII text or unsupported code page - var commentByteArray = utils.transformTo(decodeParamType, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray); - } - } - }, - - /** - * Find the unicode path declared in the extra field, if any. - * @return {String} the unicode path, null otherwise. - */ - findExtraFieldUnicodePath: function() { - var upathField = this.extraFields[0x7075]; - if (upathField) { - var extraReader = readerFor(upathField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the filename changed, this field is out of date. - if (crc32fn(this.fileName) !== extraReader.readInt(4)) { - return null; - } - - return utf8.utf8decode(extraReader.readData(upathField.length - 5)); - } - return null; - }, - - /** - * Find the unicode comment declared in the extra field, if any. - * @return {String} the unicode comment, null otherwise. - */ - findExtraFieldUnicodeComment: function() { - var ucommentField = this.extraFields[0x6375]; - if (ucommentField) { - var extraReader = readerFor(ucommentField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the comment changed, this field is out of date. - if (crc32fn(this.fileComment) !== extraReader.readInt(4)) { - return null; - } - - return utf8.utf8decode(extraReader.readData(ucommentField.length - 5)); - } - return null; - } -}; -module.exports = ZipEntry; - -},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(require,module,exports){ -'use strict'; - -var StreamHelper = require('./stream/StreamHelper'); -var DataWorker = require('./stream/DataWorker'); -var utf8 = require('./utf8'); -var CompressedObject = require('./compressedObject'); -var GenericWorker = require('./stream/GenericWorker'); - -/** - * A simple object representing a file in the zip file. - * @constructor - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data - * @param {Object} options the options of the file - */ -var ZipObject = function(name, data, options) { - this.name = name; - this.dir = options.dir; - this.date = options.date; - this.comment = options.comment; - this.unixPermissions = options.unixPermissions; - this.dosPermissions = options.dosPermissions; - - this._data = data; - this._dataBinary = options.binary; - // keep only the compression - this.options = { - compression : options.compression, - compressionOptions : options.compressionOptions - }; -}; - -ZipObject.prototype = { - /** - * Create an internal stream for the content of this object. - * @param {String} type the type of each chunk. - * @return StreamHelper the stream. - */ - internalStream: function (type) { - var result = null, outputType = "string"; - try { - if (!type) { - throw new Error("No output type specified."); - } - outputType = type.toLowerCase(); - var askUnicodeString = outputType === "string" || outputType === "text"; - if (outputType === "binarystring" || outputType === "text") { - outputType = "string"; - } - result = this._decompressWorker(); - - var isUnicodeString = !this._dataBinary; - - if (isUnicodeString && !askUnicodeString) { - result = result.pipe(new utf8.Utf8EncodeWorker()); - } - if (!isUnicodeString && askUnicodeString) { - result = result.pipe(new utf8.Utf8DecodeWorker()); - } - } catch (e) { - result = new GenericWorker("error"); - result.error(e); - } - - return new StreamHelper(result, outputType, ""); - }, - - /** - * Prepare the content in the asked type. - * @param {String} type the type of the result. - * @param {Function} onUpdate a function to call on each internal update. - * @return Promise the promise of the result. - */ - async: function (type, onUpdate) { - return this.internalStream(type).accumulate(onUpdate); - }, - - /** - * Prepare the content as a nodejs stream. - * @param {String} type the type of each chunk. - * @param {Function} onUpdate a function to call on each internal update. - * @return Stream the stream. - */ - nodeStream: function (type, onUpdate) { - return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate); - }, - - /** - * Return a worker for the compressed content. - * @private - * @param {Object} compression the compression object to use. - * @param {Object} compressionOptions the options to use when compressing. - * @return Worker the worker. - */ - _compressWorker: function (compression, compressionOptions) { - if ( - this._data instanceof CompressedObject && - this._data.compression.magic === compression.magic - ) { - return this._data.getCompressedWorker(); - } else { - var result = this._decompressWorker(); - if(!this._dataBinary) { - result = result.pipe(new utf8.Utf8EncodeWorker()); - } - return CompressedObject.createWorkerFrom(result, compression, compressionOptions); - } - }, - /** - * Return a worker for the decompressed content. - * @private - * @return Worker the worker. - */ - _decompressWorker : function () { - if (this._data instanceof CompressedObject) { - return this._data.getContentWorker(); - } else if (this._data instanceof GenericWorker) { - return this._data; - } else { - return new DataWorker(this._data); - } - } -}; - -var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"]; -var removedFn = function () { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); -}; - -for(var i = 0; i < removedMethods.length; i++) { - ZipObject.prototype[removedMethods[i]] = removedFn; -} -module.exports = ZipObject; - -},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(require,module,exports){ -(function (global){ -'use strict'; -var Mutation = global.MutationObserver || global.WebKitMutationObserver; - -var scheduleDrain; - -{ - if (Mutation) { - var called = 0; - var observer = new Mutation(nextTick); - var element = global.document.createTextNode(''); - observer.observe(element, { - characterData: true - }); - scheduleDrain = function () { - element.data = (called = ++called % 2); - }; - } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') { - var channel = new global.MessageChannel(); - channel.port1.onmessage = nextTick; - scheduleDrain = function () { - channel.port2.postMessage(0); - }; - } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) { - scheduleDrain = function () { - - // Create a - - - - - - - - - -
- -
-
-
-

Module org.hsqldb

-
-
-
    -
  • -
      -
    • - - - - -

      Packages

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Exports 
      PackageDescription
      org.hsqldb.auth -
      Contains the HyperSQL utility classes for managing external user authentication.
      -
      org.hsqldb.jdbc -
      Contains the HyperSQL JDBC Driver, and other classes providing JDBC - functionality and support.
      -
      org.hsqldb.jdbc.pool -
      Contains classes for connection pooling and distributed XA connections.
      -
      org.hsqldb.lib -
      Contains shared classes used by other HyperSQL classes.
      -
      org.hsqldb.lib.tar -
      Contains the DbBackupMain class, for offline backing up HyperSQL databases.
      -
      org.hsqldb.server -
      Contains the HyperSQL network listener classes.
      -
      org.hsqldb.trigger -
      Contains the Trigger interface for Java language database triggers.
      -
      org.hsqldb.util -
      Contains the HyperSQL utility classes.
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthBeanMultiplexer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthBeanMultiplexer.html deleted file mode 100644 index a4f30968..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthBeanMultiplexer.html +++ /dev/null @@ -1,518 +0,0 @@ - - - - - -AuthBeanMultiplexer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class AuthBeanMultiplexer

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.auth.AuthBeanMultiplexer
    • -
    -
  • -
-
-
    -
  • -
    -
    public class AuthBeanMultiplexer
    -extends java.lang.Object
    -
    This class provides a method which can be used directly as a HyperSQL static - Java function method. - Manages a set of AuthFunctionBean implementations
    -
    -
    Since:
    -
    2.0.1
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.sql.Arrayauthenticate​(java.lang.String database, - java.lang.String user, - java.lang.String password) -
      HyperSQL Java Function Method.
      -
      voidclear() -
      Clear the set of AuthFunctionBeans
      -
      static AuthBeanMultiplexergetSingleton() 
      voidsetAuthFunctionBean​(java.lang.String dbName, - AuthFunctionBean authFunctionBean) -
      This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign ths single given AuthFunctionBean as the - specified database's authenticator.
      -
      voidsetAuthFunctionBean​(java.sql.Connection c, - AuthFunctionBean authFunctionBean) -
      Exactly the same as setAuthFunctionBeans(String, List) other than taking - an open Connection to identify the database.
      -
      voidsetAuthFunctionBeans​(java.lang.String dbName, - java.util.List<AuthFunctionBean> authFunctionBeans) -
      This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign the entire list for that database.
      -
      voidsetAuthFunctionBeans​(java.sql.Connection c, - java.util.List<AuthFunctionBean> authFunctionBeans) -
      Wrapper for setAuthFunctionBeans(String, List<AuthFunctionBean>)
      -
      voidsetAuthFunctionBeans​(java.util.Map<java.lang.String,​java.util.List<AuthFunctionBean>> authFunctionBeanMap) -
      Primary purpose of this class is to manage this static map.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Clear the set of AuthFunctionBeans
        -
      • -
      - - - -
        -
      • -

        setAuthFunctionBeans

        -
        public void setAuthFunctionBeans​(java.util.Map<java.lang.String,​java.util.List<AuthFunctionBean>> authFunctionBeanMap)
        -
        Primary purpose of this class is to manage this static map. - From dbNames to ordered-lists-of-AuthFunctionBeans. - This is not an "adder" function, but a "setter" function, so do not use - this to add to a partial set, but to assign the entire set. -

        - The given entries are copied, to limit side-effects and concurrency - issues. -

        -
        -
        Parameters:
        -
        authFunctionBeanMap - Map
        -
        -
      • -
      - - - -
        -
      • -

        setAuthFunctionBeans

        -
        public void setAuthFunctionBeans​(java.sql.Connection c,
        -                                 java.util.List<AuthFunctionBean> authFunctionBeans)
        -                          throws java.sql.SQLException
        -
        Wrapper for setAuthFunctionBeans(String, List<AuthFunctionBean>)
        -
        -
        Parameters:
        -
        c - An open Connection to the desired database.
        -
        authFunctionBeans - List
        -
        Throws:
        -
        java.sql.SQLException - if failed to obtain unique name from given - Connection.
        -
        -
      • -
      - - - -
        -
      • -

        setAuthFunctionBeans

        -
        public void setAuthFunctionBeans​(java.lang.String dbName,
        -                                 java.util.List<AuthFunctionBean> authFunctionBeans)
        -
        This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign the entire list for that database. -

        - The given entries are copied, to limit side-effects and concurrency - issues. -

        - Use this method instead of setAuthFunctionBean(String, AuthFunctionBean) - in order to set up multiple authenticators for a single database for - redundancy purposes. -

        -
        -
        Parameters:
        -
        dbName - String
        -
        authFunctionBeans - List
        -
        See Also:
        -
        setAuthFunctionBeans(Map), -setAuthFunctionBean(String, AuthFunctionBean)
        -
        -
      • -
      - - - -
        -
      • -

        setAuthFunctionBean

        -
        public void setAuthFunctionBean​(java.sql.Connection c,
        -                                AuthFunctionBean authFunctionBean)
        -                         throws java.sql.SQLException
        -
        Exactly the same as setAuthFunctionBeans(String, List) other than taking - an open Connection to identify the database.
        -
        -
        Parameters:
        -
        c - Connection
        -
        authFunctionBean - AuthFunctionBean
        -
        Throws:
        -
        java.sql.SQLException - if failed to obtain unique name from given - Connection.
        -
        -
      • -
      - - - -
        -
      • -

        setAuthFunctionBean

        -
        public void setAuthFunctionBean​(java.lang.String dbName,
        -                                AuthFunctionBean authFunctionBean)
        -
        This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign ths single given AuthFunctionBean as the - specified database's authenticator. -

        - To set up multiple authenticators for a single database for redundancy - purposes, use the method setAuthFunctionBeans(String, List) instead. -

        -
        -
        Parameters:
        -
        dbName - String
        -
        authFunctionBean - AuthFunctionBean
        -
        See Also:
        -
        setAuthFunctionBeans(String, List)
        -
        -
      • -
      - - - -
        -
      • -

        authenticate

        -
        public static java.sql.Array authenticate​(java.lang.String database,
        -                                          java.lang.String user,
        -                                          java.lang.String password)
        -                                   throws java.lang.Exception
        -
        HyperSQL Java Function Method. -

        - Registered AuthFunctionBeans matching the specified database and password - will be tried in order. -

          -
        1. If the AuthFunctionBean being tried throws a non-runtime Exception, - then that RuntimeException is passed through (re-thrown), resulting - in a SQLException for the authenticating application. -
        2. If the AuthFunctionBean being tried doesn't throw anything, then - the return value is passed through (returned) and HyperSQL will - allow access and set roles according to HyperSQL's authentication - function contract. -
        3. If the AuthFunctionBean being tried throws a RuntimeException, then - the next AuthFunctionBean in turn will be tried. - If all matching AuthFunctionBeans throw RuntimeExceptions, then the - first RuntimeException that was thrown will be passed through - (re-thrown), resulting in a SQLException for the authenticating - application. -
        4. If there are no AuthFunctionBeans registered for the specified - dbName, then this method will throw an IllegalArgumentException, - resulting in a SQLException for the authenticating application. -
        -
        -
        Parameters:
        -
        database - String
        -
        user - String
        -
        password - String
        -
        Returns:
        -
        Null or java.sql.Array to indicate successful authentication - according to the contract for HyperSQL authentication functions.
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if no AuthFunctionBean has been set for - specified dbName.
        -
        java.lang.RuntimeException - if all matching AuthFunctionBeans threw - RuntimeExceptions. (This indicates that no matching - AuthFunctionBean functioned properly, not that authentication was - purposefully denied by any AuthFunctionBean).
        -
        java.lang.Exception - (non-runtime). A matching AuthFunctionBean threw this - Exception.
        -
        See Also:
        -
        "HyperSQL User Guide, System Management chapter, Authentication Settings subsection."
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthFunctionBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthFunctionBean.html deleted file mode 100644 index 04b8dda2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthFunctionBean.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - -AuthFunctionBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface AuthFunctionBean

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    HsqldbSlaveAuthBean, JaasAuthBean, LdapAuthBean
    -
    -
    -
    public interface AuthFunctionBean
    -
    AuthFunctionBeans are NOT directly usable as HyperSQL Authentication - Function methods, they are POJO beans to be managed by AuthBeanMultiplexer - (which does have a real HyperSQL Authentication Function static method).
    -
    -
    Since:
    -
    2.0.1
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    for how these beans are used.
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethodDescription
      java.lang.String[]authenticate​(java.lang.String userName, - java.lang.String password) -
      Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not.
      -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        authenticate

        -
        java.lang.String[] authenticate​(java.lang.String userName,
        -                                java.lang.String password)
        -                         throws java.lang.Exception
        -
        Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not. - A return value of String[0] is different from returning null, and means - that the user should not be granted any roles.
        -
        -
        Parameters:
        -
        userName - String
        -
        password - String
        -
        Returns:
        -
        null or String[] according to the contract of HyperSQL - authentication function contract, except that the role/schema - list is returned as a String[] instead of a java.sql.Array.
        -
        Throws:
        -
        java.lang.Exception - If user should not be allowed access to the specified - database. Other registered AuthFunctionBeans will not be attempted.
        -
        java.lang.RuntimeException - Upon system problem. The exception will be - logged to the HyperSQL application logger and other registered - AuthFunctionBeans (if any) will be attempted.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthUtils.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthUtils.html deleted file mode 100644 index f3bbdd68..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/AuthUtils.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - -AuthUtils (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class AuthUtils

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.auth.AuthUtils
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class AuthUtils
    -extends java.lang.Object
    -
    Static external-auth-related utilities.
    -
    -
    Since:
    -
    2.0.1
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/DenyException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/DenyException.html deleted file mode 100644 index 344aa707..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/DenyException.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - -DenyException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DenyException

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.lang.Throwable
    • -
    • -
        -
      • java.lang.Exception
      • -
      • -
          -
        • org.hsqldb.auth.DenyException
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable
    -
    -
    -
    public class DenyException
    -extends java.lang.Exception
    -
    -
    Since:
    -
    2.0.1
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      DenyException() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Throwable

        -addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DenyException

        -
        public DenyException()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/HsqldbSlaveAuthBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/HsqldbSlaveAuthBean.html deleted file mode 100644 index 930cb83f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/HsqldbSlaveAuthBean.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - -HsqldbSlaveAuthBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqldbSlaveAuthBean

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.auth.HsqldbSlaveAuthBean
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    AuthFunctionBean
    -
    -
    -
    public class HsqldbSlaveAuthBean
    -extends java.lang.Object
    -implements AuthFunctionBean
    -
    Delegates authentication decisions, and optionally determination of user - roles and schema, to a different HyperSQL catalog, which may be in the same - JVM or remote. - - For now, at least, this class uses DriverManager to make the ephemeral - database connections.
    -
    -
    Since:
    -
    2.0.1
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    AuthFunctionBean
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.String[]authenticate​(java.lang.String userName, - java.lang.String password) -
      Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not.
      -
      voidinit() 
      voidsetDelegateRolesSchema​(boolean doDelegateRolesSchema) -
      Defaults to true.
      -
      voidsetMasterJdbcUrl​(java.lang.String masterJdbcUrl) 
      voidsetValidationPassword​(java.lang.String validationPassword) -
      Use this method and setValidationUser if you want access to the master - database to be verified upon instance initialization.
      -
      voidsetValidationUser​(java.lang.String validationUser) -
      Use this method and setValidationPassword if you want access to the - master database to be verified upon instance initialization.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqldbSlaveAuthBean

        -
        public HsqldbSlaveAuthBean()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setValidationUser

        -
        public void setValidationUser​(java.lang.String validationUser)
        -
        Use this method and setValidationPassword if you want access to the - master database to be verified upon instance initialization.
        -
        -
        Parameters:
        -
        validationUser - String
        -
        -
      • -
      - - - -
        -
      • -

        setValidationPassword

        -
        public void setValidationPassword​(java.lang.String validationPassword)
        -
        Use this method and setValidationUser if you want access to the master - database to be verified upon instance initialization.
        -
        -
        Parameters:
        -
        validationPassword - String
        -
        -
      • -
      - - - -
        -
      • -

        setMasterJdbcUrl

        -
        public void setMasterJdbcUrl​(java.lang.String masterJdbcUrl)
        -
      • -
      - - - -
        -
      • -

        setDelegateRolesSchema

        -
        public void setDelegateRolesSchema​(boolean doDelegateRolesSchema)
        -
        Defaults to true. Whether roles and initial schema for the new session - will be determined by what they are for this user in the master database.
        -
        -
        Parameters:
        -
        doDelegateRolesSchema - boolean
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -          throws java.sql.SQLException
        -
        -
        Throws:
        -
        java.lang.IllegalStateException - if any required setting has not been set.
        -
        java.sql.SQLException - if properties 'validationUser' and - 'validationPassword' have been set, but we fail to connect to the - master database.
        -
        -
      • -
      - - - -
        -
      • -

        authenticate

        -
        public java.lang.String[] authenticate​(java.lang.String userName,
        -                                       java.lang.String password)
        -                                throws DenyException
        -
        Description copied from interface: AuthFunctionBean
        -
        Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not. - A return value of String[0] is different from returning null, and means - that the user should not be granted any roles.
        -
        -
        Specified by:
        -
        authenticate in interface AuthFunctionBean
        -
        Parameters:
        -
        userName - String
        -
        password - String
        -
        Returns:
        -
        null or String[] according to the contract of HyperSQL - authentication function contract, except that the role/schema - list is returned as a String[] instead of a java.sql.Array.
        -
        Throws:
        -
        DenyException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/JaasAuthBean.UPCallbackHandler.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/JaasAuthBean.UPCallbackHandler.html deleted file mode 100644 index 1b62c6a5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/JaasAuthBean.UPCallbackHandler.html +++ /dev/null @@ -1,326 +0,0 @@ - - - - - -JaasAuthBean.UPCallbackHandler (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JaasAuthBean.UPCallbackHandler

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.auth.JaasAuthBean.UPCallbackHandler
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    javax.security.auth.callback.CallbackHandler
    -
    -
    -
    Enclosing class:
    -
    JaasAuthBean
    -
    -
    -
    public static class JaasAuthBean.UPCallbackHandler
    -extends java.lang.Object
    -implements javax.security.auth.callback.CallbackHandler
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      UPCallbackHandler​(java.lang.String u, - java.lang.String pString) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidhandle​(javax.security.auth.callback.Callback[] callbacks) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        UPCallbackHandler

        -
        public UPCallbackHandler​(java.lang.String u,
        -                         java.lang.String pString)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        handle

        -
        public void handle​(javax.security.auth.callback.Callback[] callbacks)
        -            throws javax.security.auth.callback.UnsupportedCallbackException
        -
        -
        Specified by:
        -
        handle in interface javax.security.auth.callback.CallbackHandler
        -
        Throws:
        -
        javax.security.auth.callback.UnsupportedCallbackException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/JaasAuthBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/JaasAuthBean.html deleted file mode 100644 index c694d8ad..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/JaasAuthBean.html +++ /dev/null @@ -1,562 +0,0 @@ - - - - - -JaasAuthBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JaasAuthBean

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.auth.JaasAuthBean
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    AuthFunctionBean
    -
    -
    -
    public class JaasAuthBean
    -extends java.lang.Object
    -implements AuthFunctionBean
    -
    Provides authentication and authorization (roles and initial schema) - according to JAAS modules configured by the runtime JAAS implementation. -

    - JAAS modules used must have both a NameCallback and a PasswordCallback. - This is how we pass the JDBC-provided user name and password to the module. -

    - JAAS setup is Java-implementation-specific. - For Sun Java, you set up a JAAS configuration file which resides at - $HOME/.java.login.config or at the location that you set with - Java system property java.security.auth.login.config. -

    - You can use this bean to manage just access, or also to manage roles or - initial schemas. - To use for roles or initial schemas, you must set the roleSchemaValuePattern - property to distinguish which of the JAAS-module-provided values to use. - By default, all JAAS-module-provided Principles will be candidates. - If you set property roleSchemaViaCredential to true, then all - JAAS-module-provided public Credentials will be candidates instead.

    -
    -
    Since:
    -
    2.5.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    AuthFunctionBean, -NameCallback, -PasswordCallback
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JaasAuthBean() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.String[]authenticate​(java.lang.String userName, - java.lang.String password) -
      Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not.
      -
      voidinit() 
      voidsetApplicationKey​(java.lang.String applicationKey) -
      Set the key into the JAAS runtime configuration.
      -
      voidsetRoleSchemaValuePattern​(java.util.regex.Pattern roleSchemaValuePattern) -
      Assign a pattern to both detect honored values, and optionally - to map from a single principal name or public credential string - to a single HyperSQL role or schema string.
      -
      voidsetRoleSchemaValuePatternString​(java.lang.String patternString) -
      String wrapper for method setRoleSchemaValuePattern(Pattern) - - Use the (x?) Pattern constructs to set options.
      -
      voidsetRoleSchemaViaCredential​(boolean roleSchemaViaCredential) -
      By default, If roleSchemaValuePattern is set, then role and schema - values are obtained from principle values; otherwise existing account - privileges are used (if any).
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JaasAuthBean

        -
        public JaasAuthBean()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setRoleSchemaViaCredential

        -
        public void setRoleSchemaViaCredential​(boolean roleSchemaViaCredential)
        -
        By default, If roleSchemaValuePattern is set, then role and schema - values are obtained from principle values; otherwise existing account - privileges are used (if any). - If roleSchemaViaCredential is set to true and roleSchemaValuePattern is - set, then credential values will be used instead. -

        - Do not set roleSchemaViaCredential to true unless roleSchemaValuePattern - is set.

        -
        -
        Parameters:
        -
        roleSchemaViaCredential - boolean
        -
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
        -
        Throws:
        -
        java.lang.IllegalStateException - if any required setting has not been set.
        -
        -
      • -
      - - - -
        -
      • -

        setApplicationKey

        -
        public void setApplicationKey​(java.lang.String applicationKey)
        -
        Set the key into the JAAS runtime configuration. - - For Sun's JAAS implementation, this is the "application" identifier for - a stanza in the JAAS configuration file.
        -
        -
        Parameters:
        -
        applicationKey - key
        -
        -
      • -
      - - - -
        -
      • -

        setRoleSchemaValuePattern

        -
        public void setRoleSchemaValuePattern​(java.util.regex.Pattern roleSchemaValuePattern)
        -
        Assign a pattern to both detect honored values, and optionally - to map from a single principal name or public credential string - to a single HyperSQL role or schema string. - Do not use this method if you are using this JaasAuthBean only to - permit or reject access (with roles and schema being determined by - pre-existing local HyperSQL accounts). - On that case, simple success of the login() method method will allow - access as the specified user. -

        - If every principal name or public credentials holds only the String - values precisely as HyperSQL needs them, then set the pattern to ".+". - For example, if the JAAS module returns principals (or credentials) with - values "one", "two", "three", then if you set this pattern to ".+", - HyperSQL will attempt to assign initial schema and roles for the values - "one", "two", and "three". -

        - These are two distinct and important purposes for the specified Pattern. -

          -
        1. - Values that do not successfully match the pattern will be ignored. - If the pattern does match, then the entire principal or credential - value will be used to assign initial schema or role (as long as it - is a valid schema name or role name in the local database). -
        2. - Optionally uses parentheses to specify a single capture group - (if you use parentheses to specify more than one matching group, we - will only capture for the first). - What is captured by this group is exactly the role or schema that - HyperSQL will attempt to assign. - If no capture parens are given then the Pattern is only used for the - acceptance decision, and the JAAS-provided value will be returned - verbatim. -
        -

        - N.b. this Pattern will be used for the matches() operation, therefore it - must match the entire candidate value strings (this is different than - the find operation which does not need to satisfy the entire candidate - value). -

        Example1 :

        
        -     cn=([^,]+),ou=dbRole,dc=admc,dc=com
        - 
        - will extract the CN value from matching attribute values. -

        Example1 :

        
        -     cn=[^,]+,ou=dbRole,dc=admc,dc=com
        - 
        - will return the entire cn...com string for matching - attribute values.
        -
        -
        Parameters:
        -
        roleSchemaValuePattern - pattern
        -
        See Also:
        -
        Matcher.matches()
        -
        -
      • -
      - - - -
        -
      • -

        setRoleSchemaValuePatternString

        -
        public void setRoleSchemaValuePatternString​(java.lang.String patternString)
        -
        String wrapper for method setRoleSchemaValuePattern(Pattern) - - Use the (x?) Pattern constructs to set options.
        -
        -
        Parameters:
        -
        patternString - pattern
        -
        Throws:
        -
        java.util.regex.PatternSyntaxException - exception
        -
        See Also:
        -
        setRoleSchemaValuePattern(Pattern)
        -
        -
      • -
      - - - -
        -
      • -

        authenticate

        -
        public java.lang.String[] authenticate​(java.lang.String userName,
        -                                       java.lang.String password)
        -                                throws DenyException
        -
        Description copied from interface: AuthFunctionBean
        -
        Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not. - A return value of String[0] is different from returning null, and means - that the user should not be granted any roles.
        -
        -
        Specified by:
        -
        authenticate in interface AuthFunctionBean
        -
        Parameters:
        -
        userName - String
        -
        password - String
        -
        Returns:
        -
        null or String[] according to the contract of HyperSQL - authentication function contract, except that the role/schema - list is returned as a String[] instead of a java.sql.Array.
        -
        Throws:
        -
        DenyException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/LdapAuthBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/LdapAuthBean.html deleted file mode 100644 index 7987b02e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/LdapAuthBean.html +++ /dev/null @@ -1,891 +0,0 @@ - - - - - -LdapAuthBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LdapAuthBean

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.auth.LdapAuthBean
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    AuthFunctionBean
    -
    -
    -
    public class LdapAuthBean
    -extends java.lang.Object
    -implements AuthFunctionBean
    -
    Authenticates to a HyperSQL catalog according to entries in a LDAP - database. - If using LDAP StartTLS and your server has a certificate not trusted by - default by your JRE, then set system property 'javax.net.ssl.trustStore' to - the path to a trust store containing the cert (as well as any other certs - that your app needs for other purposes). -

    - This class with authenticate login attempts against LDAP entries with RDN of - the HyperSQL account name (the precise attribute name defaults to 'uid', but - you may change that). -

    - This class purposefully does not support LDAPS, because LDAPS is deprecated - in favor of StartTLS, which we do support. - If you need to support LDAPS and are using SE 1.6, use our JaasAuthBean with - Sun's LdapLoginModule. -

    - This class does not support SASL/External authentication, because the work - involved with securely obtaining user-specific certs would be more complex - than everything else here combined. - Another AuthFunctionBean would have to be written if SASL/External is needed. -

    - To use instances of this class, you must use at least the methods - setLdapHost, setParentDn, initialize, plus - rolesSchemaAttribute and/or accessAttribute. -

    - For a user to be given HyperSQL catalog access, that user must either have - a value for accessAttribute if that property is set (optionally requiring - a match with accessValuePattern); or, if the accessAttribute is not set then - must have some (any) value for rolesSchemaAttribute (optionally requiring a - match with roleSchemaValuePattern). - Consequently, if you have set both accessAttribute and rolesSchemaAttribute, - the latter attribute will only be consulted if the check of the former - attribute succeeds. -

    - If you want roles assigned according to the local HyperSQL database instead - of according to LDAP, then set accessAttribute but not rolesSchemaAttribute. -

    - If what is wanted is to grant access but with no roles (overriding local - roles if there are any), then set both accessAttribute and - rolesSchemaAttribute, but do not set any rolesSchemaAttribute attribute - values for these no-role users. - (I hesitate to mention it, but you could accomplish the same thing with only - a rolesSchemaAttribute attribute, by setting only a dummy role/schema value - for non-role users, because HyperSQL will ignore unknown roles or schemas - but still give access since a list was still supplied). -

    -
    -
    Since:
    -
    2.5.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    AuthFunctionBean, -setLdapHost(String), -setParentDn(String), -init()
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      LdapAuthBean() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.String[]authenticate​(java.lang.String userName, - java.lang.String password) -
      Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not.
      -
      voidinit() 
      voidsetAccessAttribute​(java.lang.String attribute) -
      Set the attribute name of the RDN + parentDn entries which will be - consulted to decide whether the user can access the HyperSQL database.
      -
      voidsetAccessValuePattern​(java.util.regex.Pattern accessValuePattern) -
      Assign a pattern to detect honored accessAttribute values.
      -
      voidsetAccessValuePatternString​(java.lang.String patternString) -
      String wrapper for method setAccessValuePattern(Pattern) Use the (x?) - Pattern constructs to set options.
      -
      voidsetInitialContextFactory​(java.lang.String initialContextFactory) -
      Most users should not call this, and will get the default of - "com.sun.jndi.ldap.LdapCtxFactory".
      -
      voidsetLdapHost​(java.lang.String ldapHost) -
      Do not specify URL scheme ("ldap:") because that is implied.
      -
      voidsetLdapPort​(int ldapPort) 
      voidsetParentDn​(java.lang.String parentDn) -
      Set DN which is parent of the user DNs.
      -
      voidsetPrincipalTemplate​(java.lang.String principalTemplate) -
      A template String containing place-holder token '${username}'.
      -
      voidsetRdnAttribute​(java.lang.String rdnAttribute) -
      rdnAttribute must hold the user name exactly as the HyperSQL login will - be made with.
      -
      voidsetRoleSchemaValuePattern​(java.util.regex.Pattern roleSchemaValuePattern) -
      Assign a pattern to both detect honored values, and to map from a single - value of "rolesSchemaAttribute"s to a HyperSQL role or schema string.
      -
      voidsetRoleSchemaValuePatternString​(java.lang.String patternString) -
      String wrapper for method setRoleSchemaValuePattern(Pattern) - - Use the (x?) Pattern constructs to set options.
      -
      voidsetRolesSchemaAttribute​(java.lang.String attribute) -
      Set the attribute name of the RDN + parentDn entries in which is stored - the list of roles and optional schema for the authenticating user.
      -
      voidsetSaslRealm​(java.lang.String saslRealm) -
      Some LDAP servers using a SASL mechanism require a realm to be specified, - and some mechanisms allow a realm to be specified if you wish to use that - feature.
      -
      voidsetSecurityMechanism​(java.lang.String mechanism) -
      Defaults to "SIMPLE".
      -
      voidsetStartTls​(boolean isTls) -
      If this is set, then the entire (brief) transaction with the LDAP server - will be encrypted.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LdapAuthBean

        -
        public LdapAuthBean()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setStartTls

        -
        public void setStartTls​(boolean isTls)
        -
        If this is set, then the entire (brief) transaction with the LDAP server - will be encrypted.
        -
        -
        Parameters:
        -
        isTls - boolean
        -
        -
      • -
      - - - -
        -
      • -

        setLdapPort

        -
        public void setLdapPort​(int ldapPort)
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
        -
        Throws:
        -
        java.lang.IllegalStateException - if any required setting has not been set.
        -
        -
      • -
      - - - -
        -
      • -

        setAccessValuePattern

        -
        public void setAccessValuePattern​(java.util.regex.Pattern accessValuePattern)
        -
        Assign a pattern to detect honored accessAttribute values. If you set - accessAttribute but not accessValuePattern, then all that will be checked - for access is if the RDN + parentDN entry has the accessAttribute - attribute. (I.e. the specific value will not matter whatsoever). - -

        You may only use this property if you have set property - accessAttribute. If you have set accessAttribute but not this property, - then access will be decided based solely upon existence of this - attribute. - -

        Capture groups in the pattern will be ignored and serve no purpose. - - -

        N.b. this Pattern will be used for the matches() operation, therefore - it must match the entire candidate value strings (this is different than - the find operation which does not need to satisfy the entire candidate - value). - -

        Example1 :

         TRUE 
        This will match true values - per OpenLDAP's boolean OID.
        -
        -
        Parameters:
        -
        accessValuePattern - Pattern
        -
        See Also:
        -
        Matcher.matches()
        -
        -
      • -
      - - - -
        -
      • -

        setAccessValuePatternString

        -
        public void setAccessValuePatternString​(java.lang.String patternString)
        -
        String wrapper for method setAccessValuePattern(Pattern) Use the (x?) - Pattern constructs to set options.
        -
        -
        Parameters:
        -
        patternString - String
        -
        See Also:
        -
        setAccessValuePattern(Pattern)
        -
        -
      • -
      - - - -
        -
      • -

        setRoleSchemaValuePattern

        -
        public void setRoleSchemaValuePattern​(java.util.regex.Pattern roleSchemaValuePattern)
        -
        Assign a pattern to both detect honored values, and to map from a single - value of "rolesSchemaAttribute"s to a HyperSQL role or schema string. - If your rolesSchemaAttribute holds only the String values precisely as - HyperSQL needs them, then don't use this method at all and all matching - attribute values will be passed directly. -

        - You may only use this property if you have set property - rolesSchemaAttribute. - If rolesSchemaAttribute is set but this property is not set, then - the value will directly determine the user's roles and schema. -

        - Unlike the rolesSchemaAttribute, the property at-hand uses the - singular for "role", because whereas rolesSchemaAttribute is the - attribute for listing multiple roles, roleSchemaValuePattern is used - to evaluate single role values. -

        - These are two distinct and important purposes for the specified Pattern. -

          -
        1. - Values that do not successfully match the pattern will be ignored. -
        2. - Optionally uses parentheses to specify a single capture group - (if you use parentheses to specify more than one matching group, we - will only capture for the first). - What is captured by this group is exactly the role or schema that - HyperSQL will attempt to assign. - If no capture parens are given then the Pattern is only used for the - acceptance decision, and the LDAP-provided value will be returned - verbatim. -
        - -

        - Together, these two features work great to extract just the needed role - and schema names from 'memberof' DNs, and will have no problem if you - also use 'memberof' for unrelated purposes. - -

        - N.b. this Pattern will be used for the matches() operation, therefore it - must match the entire candidate value strings (this is different than - the find operation which does not need to satisfy the entire candidate - value). - -

        Example1 :

        
        -     cn=([^,]+),ou=dbRole,dc=admc,dc=com
        - 
        - will extract the CN value from matching attribute values. - -

        Example1 :

        
        -     cn=[^,]+,ou=dbRole,dc=admc,dc=com
        - 
        - will return the entire cn...com string for matching - attribute values.
        -
        -
        Parameters:
        -
        roleSchemaValuePattern - pattern
        -
        See Also:
        -
        Matcher.matches()
        -
        -
      • -
      - - - -
        -
      • -

        setRoleSchemaValuePatternString

        -
        public void setRoleSchemaValuePatternString​(java.lang.String patternString)
        -
        String wrapper for method setRoleSchemaValuePattern(Pattern) - - Use the (x?) Pattern constructs to set options.
        -
        -
        Parameters:
        -
        patternString - pattern
        -
        Throws:
        -
        java.util.regex.PatternSyntaxException - exception
        -
        See Also:
        -
        setRoleSchemaValuePattern(Pattern)
        -
        -
      • -
      - - - -
        -
      • -

        setSecurityMechanism

        -
        public void setSecurityMechanism​(java.lang.String mechanism)
        -
        Defaults to "SIMPLE".
        -
        -
        Parameters:
        -
        mechanism - Either 'SIMPLE' (the default) for LDAP Simple, or - one of the LDAP SASL mechanisms, such as 'DIGEST-MD5'.
        -
        -
      • -
      - - - -
        -
      • -

        setLdapHost

        -
        public void setLdapHost​(java.lang.String ldapHost)
        -
        Do not specify URL scheme ("ldap:") because that is implied. - (Since we purposefully don't support LDAPS, there would be no reason to - change that). -

        - If using StartTLS, then this host name must match the cn of the LDAP - server's certificate. -

        - If you need to support LDAPS and are using SE 1.6, use our JaasAuthBean - with Sun's LdapLoginModule instead of this class. -

        -
        -
        Parameters:
        -
        ldapHost - host
        -
        See Also:
        -
        JaasAuthBean
        -
        -
      • -
      - - - -
        -
      • -

        setPrincipalTemplate

        -
        public void setPrincipalTemplate​(java.lang.String principalTemplate)
        -
        A template String containing place-holder token '${username}'. - All occurrences of '${username}' (without the quotes) will be translated - to the username that authentication is being attempted with. -

        - If you supply a principalTemplate that does not contain '${username}', - then authentication will be user-independent. -

        - It is common to authenticate to LDAP servers with the DN of the user's - LDAP entry. In this situation, set principalTemplate to - <RDN_ATTR=>${username},<PARENT_DN>. - For example if you use parentDn of - "ou=people,dc=admc,dc=com" and rdnAttribute of - uid, then you would set

        
        -     "uid=${username},ou=people,dc=admc,dc=com"
        - 
        -

        - By default the user name will be passed exactly as it is, so don't use - this setter if that is what you want. (This works great for OpenLDAP - with DIGEST-MD5 SASL, for example).

        -
        -
        Parameters:
        -
        principalTemplate - template
        -
        -
      • -
      - - - -
        -
      • -

        setInitialContextFactory

        -
        public void setInitialContextFactory​(java.lang.String initialContextFactory)
        -
        Most users should not call this, and will get the default of - "com.sun.jndi.ldap.LdapCtxFactory". - Use this method if you prefer to use a context factory provided by your - framework or container, for example, or if you are using a non-Sun JRE.
        -
        -
        Parameters:
        -
        initialContextFactory - factory
        -
        -
      • -
      - - - -
        -
      • -

        setSaslRealm

        -
        public void setSaslRealm​(java.lang.String saslRealm)
        -
        Some LDAP servers using a SASL mechanism require a realm to be specified, - and some mechanisms allow a realm to be specified if you wish to use that - feature. - By default no realm will be sent to the LDAP server. -

        - Don't use this setter if you are not setting a SASL mechanism. -

        -
        -
        Parameters:
        -
        saslRealm - realm
        -
        -
      • -
      - - - -
        -
      • -

        setParentDn

        -
        public void setParentDn​(java.lang.String parentDn)
        -
        Set DN which is parent of the user DNs. - E.g. "ou=people,dc=admc,dc=com"
        -
        -
        Parameters:
        -
        parentDn - parent DN
        -
        -
      • -
      - - - -
        -
      • -

        setRdnAttribute

        -
        public void setRdnAttribute​(java.lang.String rdnAttribute)
        -
        rdnAttribute must hold the user name exactly as the HyperSQL login will - be made with. -

        - This is the RDN relative to the Parent DN specified with setParentDN. - Defaults to 'uid'. -

        -
        -
        Parameters:
        -
        rdnAttribute - RDN attribute
        -
        See Also:
        -
        setParentDn(String)
        -
        -
      • -
      - - - -
        -
      • -

        setRolesSchemaAttribute

        -
        public void setRolesSchemaAttribute​(java.lang.String attribute)
        -
        Set the attribute name of the RDN + parentDn entries in which is stored - the list of roles and optional schema for the authenticating user. -

        - There is no default. You must set this attribute if you want LDAP - instead of the local HyperSQL database to determine the user's roles! - You must set the rolesSchemaAttribute property and/or the - accessAttribute property. - Consequently, if you do no tset this property, then you must set the - accessAttribute property, and this LdapAuthBean will only determine - access not roles. -

        - To use the nice reverse group membership feature of LDAP, set - this value to "memberof". -

        - If you have set both rolesSchemaAttribute and this value, then the - attribute set here will only be consulted if the accessAttribute check - succeeds. -

        -
        -
        Parameters:
        -
        attribute - attribute
        -
        -
      • -
      - - - -
        -
      • -

        setAccessAttribute

        -
        public void setAccessAttribute​(java.lang.String attribute)
        -
        Set the attribute name of the RDN + parentDn entries which will be - consulted to decide whether the user can access the HyperSQL database. -

        - There is no default. If you set this attribute, then the attribute will - determine whether the user can access the HyperSQL database, regardless - of whether the rolesSchemaAttribute attribute is set. -

        - If you set just this property, then the local HyperSQL database will - decide all roles for the user. If you set this property and property - rolesSchemaAttribute then this attribute will determine access, and if - this attribute grants access then the rolesSchemaAttribute value will - determine the user's roles. -

        -
        -
        Parameters:
        -
        attribute - attribute
        -
        -
      • -
      - - - -
        -
      • -

        authenticate

        -
        public java.lang.String[] authenticate​(java.lang.String userName,
        -                                       java.lang.String password)
        -                                throws DenyException
        -
        Description copied from interface: AuthFunctionBean
        -
        Return a list of authorized roles or null to indicate that the - implementation does not intend to produce a specific role list but only - to indicate whether to allow access or not. - A return value of String[0] is different from returning null, and means - that the user should not be granted any roles.
        -
        -
        Specified by:
        -
        authenticate in interface AuthFunctionBean
        -
        Parameters:
        -
        userName - String
        -
        password - String
        -
        Returns:
        -
        String[]
        -
        Throws:
        -
        DenyException - on access denial
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/LdapAuthBeanTester.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/LdapAuthBeanTester.html deleted file mode 100644 index 2d82f843..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/LdapAuthBeanTester.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - -LdapAuthBeanTester (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LdapAuthBeanTester

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.auth.LdapAuthBeanTester
    • -
    -
  • -
-
-
    -
  • -
    -
    public class LdapAuthBeanTester
    -extends java.lang.Object
    -
    Tests the settings for LdapAuthBean.
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      LdapAuthBeanTester() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidmain​(java.lang.String[] sa) -
      Run this method to try and test configuration settings for LdapAuthBeans, - or to troubleshoot.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LdapAuthBeanTester

        -
        public LdapAuthBeanTester()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] sa)
        -                 throws java.io.IOException
        -
        Run this method to try and test configuration settings for LdapAuthBeans, - or to troubleshoot. - It purposefully does not test the Java Function or the JDBC layer at all. - This program will attempt to retrieve and display the schema/roles list - for the specified user and with the specified password from the LDAP - server according to the specified properties. -

        - Passwords typed on the command line are inherently not secure, so only - use this program when the computer it is run on is secured and where - your command line may not be observed, directly or indirectly, by others. -

        - Set the properties in a properties file to match your LDAP security and - Directory Information Tree structure and use this program to check - everything between the LdapAuthBean and your LDAP server. - You then know the exact settings to use for an LdapAuthBean that you can - plug into AuthBeanMultiplexer. -

        - Run with no arguments to see required syntax. -

        - The property file may contain any of the following properties, which - exactly match the corresponding setter methods in this class. -

          -
        • trustStore. This is the only property without a corresponding - setter method. Setting this property has the same effect as - setting Java system property - 'javax.net.ssl.trustStore'. -
        • startTls. Takes a boolean value according to - method java.util.Boolean.parseBoolean. -
        • roleSchemaValuePattern. Corresponds to method - setRoleSchemaValuePatternString -
        • accessValuePattern. Corresponds to method - setAccessValuePatternString -
        • ldapPort -
        • securityMechanism -
        • ldapHost -
        • principalTemplate -
        • initialContextFactory -
        • saslRealm -
        • parentDn -
        • rdnAttribute -
        • rolesSchemaAttribute -
        • accessAttribute -
        -

        - Tokens like ${this} will not be expanded to system property values, - and your bean will get the values exactly as you type them in. -

        - The file sample/ldap-exerciser.properties in the HyperSQL distribution - may be used as a template or example.

        -
        -
        Parameters:
        -
        sa - arguments
        -
        Throws:
        -
        java.io.IOException - on io error
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthBeanMultiplexer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthBeanMultiplexer.html deleted file mode 100644 index ffcf8786..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthBeanMultiplexer.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.AuthBeanMultiplexer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.AuthBeanMultiplexer

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthFunctionBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthFunctionBean.html deleted file mode 100644 index 41a6f5f4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthFunctionBean.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.auth.AuthFunctionBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.auth.AuthFunctionBean

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use AuthFunctionBean 
    PackageDescription
    org.hsqldb.auth -
    Contains the HyperSQL utility classes for managing external user authentication.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of AuthFunctionBean in org.hsqldb.auth

      - - - - - - - - - - - - - - - - - - - - - - - - -
      Classes in org.hsqldb.auth that implement AuthFunctionBean 
      Modifier and TypeClassDescription
      class HsqldbSlaveAuthBean -
      Delegates authentication decisions, and optionally determination of user - roles and schema, to a different HyperSQL catalog, which may be in the same - JVM or remote.
      -
      class JaasAuthBean -
      Provides authentication and authorization (roles and initial schema) - according to JAAS modules configured by the runtime JAAS implementation.
      -
      class LdapAuthBean -
      Authenticates to a HyperSQL catalog according to entries in a LDAP - database.
      -
      - - - - - - - - - - - - - - - - - - - -
      Methods in org.hsqldb.auth with parameters of type AuthFunctionBean 
      Modifier and TypeMethodDescription
      voidAuthBeanMultiplexer.setAuthFunctionBean​(java.lang.String dbName, - AuthFunctionBean authFunctionBean) -
      This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign ths single given AuthFunctionBean as the - specified database's authenticator.
      -
      voidAuthBeanMultiplexer.setAuthFunctionBean​(java.sql.Connection c, - AuthFunctionBean authFunctionBean) -
      Exactly the same as setAuthFunctionBeans(String, List) other than taking - an open Connection to identify the database.
      -
      - - - - - - - - - - - - - - - - - - - - - - - - -
      Method parameters in org.hsqldb.auth with type arguments of type AuthFunctionBean 
      Modifier and TypeMethodDescription
      voidAuthBeanMultiplexer.setAuthFunctionBeans​(java.lang.String dbName, - java.util.List<AuthFunctionBean> authFunctionBeans) -
      This is not an "adder" function, but a "setter" function for the - specified dbName , so do not use this to add to a database's - FunctionBeans, but to assign the entire list for that database.
      -
      voidAuthBeanMultiplexer.setAuthFunctionBeans​(java.sql.Connection c, - java.util.List<AuthFunctionBean> authFunctionBeans) -
      Wrapper for setAuthFunctionBeans(String, List<AuthFunctionBean>)
      -
      voidAuthBeanMultiplexer.setAuthFunctionBeans​(java.util.Map<java.lang.String,​java.util.List<AuthFunctionBean>> authFunctionBeanMap) -
      Primary purpose of this class is to manage this static map.
      -
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthUtils.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthUtils.html deleted file mode 100644 index 674278ef..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/AuthUtils.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.AuthUtils (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.AuthUtils

-
-
No usage of org.hsqldb.auth.AuthUtils
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/DenyException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/DenyException.html deleted file mode 100644 index afbe82a1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/DenyException.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.DenyException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.DenyException

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use DenyException 
    PackageDescription
    org.hsqldb.auth -
    Contains the HyperSQL utility classes for managing external user authentication.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of DenyException in org.hsqldb.auth

      - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods in org.hsqldb.auth that throw DenyException 
      Modifier and TypeMethodDescription
      java.lang.String[]HsqldbSlaveAuthBean.authenticate​(java.lang.String userName, - java.lang.String password) 
      java.lang.String[]JaasAuthBean.authenticate​(java.lang.String userName, - java.lang.String password) 
      java.lang.String[]LdapAuthBean.authenticate​(java.lang.String userName, - java.lang.String password) 
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/HsqldbSlaveAuthBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/HsqldbSlaveAuthBean.html deleted file mode 100644 index eebd2c5f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/HsqldbSlaveAuthBean.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.HsqldbSlaveAuthBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.HsqldbSlaveAuthBean

-
-
No usage of org.hsqldb.auth.HsqldbSlaveAuthBean
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/JaasAuthBean.UPCallbackHandler.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/JaasAuthBean.UPCallbackHandler.html deleted file mode 100644 index dcdb81e1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/JaasAuthBean.UPCallbackHandler.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.JaasAuthBean.UPCallbackHandler (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.JaasAuthBean.UPCallbackHandler

-
-
No usage of org.hsqldb.auth.JaasAuthBean.UPCallbackHandler
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/JaasAuthBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/JaasAuthBean.html deleted file mode 100644 index f3623787..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/JaasAuthBean.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.JaasAuthBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.JaasAuthBean

-
-
No usage of org.hsqldb.auth.JaasAuthBean
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/LdapAuthBean.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/LdapAuthBean.html deleted file mode 100644 index d6e0390c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/LdapAuthBean.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.LdapAuthBean (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.LdapAuthBean

-
-
No usage of org.hsqldb.auth.LdapAuthBean
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/LdapAuthBeanTester.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/LdapAuthBeanTester.html deleted file mode 100644 index 1018b079..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/class-use/LdapAuthBeanTester.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.auth.LdapAuthBeanTester (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.auth.LdapAuthBeanTester

-
-
No usage of org.hsqldb.auth.LdapAuthBeanTester
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-summary.html deleted file mode 100644 index d401023d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-summary.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - -org.hsqldb.auth (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.auth

-
-
-
- - -
Contains the HyperSQL utility classes for managing external user authentication.
-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    AuthFunctionBean -
    AuthFunctionBeans are NOT directly usable as HyperSQL Authentication - Function methods, they are POJO beans to be managed by AuthBeanMultiplexer - (which does have a real HyperSQL Authentication Function static method).
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    AuthBeanMultiplexer -
    This class provides a method which can be used directly as a HyperSQL static - Java function method.
    -
    AuthUtils -
    Static external-auth-related utilities.
    -
    HsqldbSlaveAuthBean -
    Delegates authentication decisions, and optionally determination of user - roles and schema, to a different HyperSQL catalog, which may be in the same - JVM or remote.
    -
    JaasAuthBean -
    Provides authentication and authorization (roles and initial schema) - according to JAAS modules configured by the runtime JAAS implementation.
    -
    JaasAuthBean.UPCallbackHandler 
    LdapAuthBean -
    Authenticates to a HyperSQL catalog according to entries in a LDAP - database.
    -
    LdapAuthBeanTester -
    Tests the settings for LdapAuthBean.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    DenyException 
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-tree.html deleted file mode 100644 index 5a74a005..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-tree.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - -org.hsqldb.auth Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.auth

-Package Hierarchies: - -
-
-
-

Class Hierarchy

- -
-
-

Interface Hierarchy

- -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-use.html deleted file mode 100644 index 37547fc3..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/auth/package-use.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - -Uses of Package org.hsqldb.auth (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.auth

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use org.hsqldb.auth 
    PackageDescription
    org.hsqldb.auth -
    Contains the HyperSQL utility classes for managing external user authentication.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - -
    Classes in org.hsqldb.auth used by org.hsqldb.auth 
    ClassDescription
    AuthBeanMultiplexer -
    This class provides a method which can be used directly as a HyperSQL static - Java function method.
    -
    AuthFunctionBean -
    AuthFunctionBeans are NOT directly usable as HyperSQL Authentication - Function methods, they are POJO beans to be managed by AuthBeanMultiplexer - (which does have a real HyperSQL Authentication Function static method).
    -
    DenyException 
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCArray.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCArray.html deleted file mode 100644 index 136f0ee5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCArray.html +++ /dev/null @@ -1,943 +0,0 @@ - - - - - -JDBCArray (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCArray

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCArray
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Array
    -
    -
    -
    public class JDBCArray
    -extends java.lang.Object
    -implements java.sql.Array
    -
    The mapping in the Java programming language for the SQL type - ARRAY. - By default, an Array value is a transaction-duration - reference to an SQL ARRAY value. By default, an Array - object is implemented using an SQL LOCATOR(array) internally, which - means that an Array object contains a logical pointer - to the data in the SQL ARRAY value rather - than containing the ARRAY value's data. -

    - The Array interface provides methods for bringing an SQL - ARRAY value's data to the client as either an array or a - ResultSet object. - If the elements of the SQL ARRAY - are a UDT, they may be custom mapped. To create a custom mapping, - a programmer must do two things: -

      -
    • create a class that implements the SQLData - interface for the UDT to be custom mapped. -
    • make an entry in a type map that contains -
        -
      • the fully-qualified SQL type name of the UDT -
      • the Class object for the class implementing - SQLData -
      -
    -

    - When a type map with an entry for - the base type is supplied to the methods getArray - and getResultSet, the mapping - it contains will be used to map the elements of the ARRAY value. - If no type map is supplied, which would typically be the case, - the connection's type map is used by default. - If the connection's type map or a type map supplied to a method has no entry - for the base type, the elements are mapped according to the standard mapping. -

    - All methods on the Array interface must be fully implemented if the - JDBC driver supports the data type.

    -
    -
    Since:
    -
    JDK 1.2, HSQLDB 2.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCArray​(java.lang.Object[] data, - org.hsqldb.types.Type type, - org.hsqldb.types.Type arrayType, - org.hsqldb.SessionInterface session) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidfree() -
      This method frees the Array object and releases the resources that - it holds.
      -
      java.lang.ObjectgetArray() -
      Retrieves the contents of the SQL ARRAY value designated - by this - Array object in the form of an array in the Java - programming language.
      -
      java.lang.ObjectgetArray​(long index, - int count) -
      Retrieves a slice of the SQL ARRAY - value designated by this Array object, beginning with the - specified index and containing up to count - successive elements of the SQL array.
      -
      java.lang.ObjectgetArray​(long index, - int count, - java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves a slice of the SQL ARRAY value - designated by this Array object, beginning with the specified - index and containing up to count - successive elements of the SQL array.
      -
      java.lang.ObjectgetArray​(java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves the contents of the SQL ARRAY value designated by this - Array object.
      -
      java.lang.Object[]getArrayInternal() 
      intgetBaseType() -
      Retrieves the JDBC type of the elements in the array designated - by this Array object.
      -
      java.lang.StringgetBaseTypeName() -
      Retrieves the SQL type name of the elements in - the array designated by this Array object.
      -
      java.sql.ResultSetgetResultSet() -
      Retrieves a result set that contains the elements of the SQL - ARRAY value - designated by this Array object.
      -
      java.sql.ResultSetgetResultSet​(long index, - int count) -
      Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
      -
      java.sql.ResultSetgetResultSet​(long index, - int count, - java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
      -
      java.sql.ResultSetgetResultSet​(java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves a result set that contains the elements of the SQL - ARRAY value designated by this Array object.
      -
      java.lang.StringtoString() -
      Returns a string representation in the form ARRAY[..., ...]
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCArray

        -
        public JDBCArray​(java.lang.Object[] data,
        -                 org.hsqldb.types.Type type,
        -                 org.hsqldb.types.Type arrayType,
        -                 org.hsqldb.SessionInterface session)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getBaseTypeName

        -
        public java.lang.String getBaseTypeName()
        -                                 throws java.sql.SQLException
        -
        Retrieves the SQL type name of the elements in - the array designated by this Array object. - If the elements are a built-in type, it returns - the database-specific type name of the elements. - If the elements are a user-defined type (UDT), - this method returns the fully-qualified SQL type name.
        -
        -
        Specified by:
        -
        getBaseTypeName in interface java.sql.Array
        -
        Returns:
        -
        a String that is the database-specific - name for a built-in base type; or the fully-qualified SQL type - name for a base type that is a UDT
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting - to access the type name
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBaseType

        -
        public int getBaseType()
        -                throws java.sql.SQLException
        -
        Retrieves the JDBC type of the elements in the array designated - by this Array object.
        -
        -
        Specified by:
        -
        getBaseType in interface java.sql.Array
        -
        Returns:
        -
        a constant from the class Types that is - the type code for the elements in the array designated by this - Array object
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting - to access the base type
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray()
        -                          throws java.sql.SQLException
        -
        - Retrieves the contents of the SQL ARRAY value designated - by this - Array object in the form of an array in the Java - programming language. This version of the method getArray - uses the type map associated with the connection for customizations of - the type mappings. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Returns:
        -
        an array in the Java programming language that contains - the ordered elements of the SQL ARRAY value - designated by this Array object
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                          throws java.sql.SQLException
        -
        - Retrieves the contents of the SQL ARRAY value designated by this - Array object. - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getArray uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Parameters:
        -
        map - a java.util.Map object that contains mappings - of SQL type names to classes in the Java programming language
        -
        Returns:
        -
        an array in the Java programming language that contains the ordered - elements of the SQL array designated by this object
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray​(long index,
        -                                 int count)
        -                          throws java.sql.SQLException
        -
        - Retrieves a slice of the SQL ARRAY - value designated by this Array object, beginning with the - specified index and containing up to count - successive elements of the SQL array. This method uses the type map - associated with the connection for customizations of the type mappings. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to retrieve
        -
        Returns:
        -
        an array containing up to count consecutive elements - of the SQL array, beginning with element index
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray​(long index,
        -                                 int count,
        -                                 java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                          throws java.sql.SQLException
        -
        - Retrieves a slice of the SQL ARRAY value - designated by this Array object, beginning with the specified - index and containing up to count - successive elements of the SQL array. -

        - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getArray uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to - retrieve
        -
        map - a java.util.Map object - that contains SQL type names and the classes in - the Java programming language to which they are mapped
        -
        Returns:
        -
        an array containing up to count - consecutive elements of the SQL ARRAY value designated by this - Array object, beginning with element - index
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet()
        -                                throws java.sql.SQLException
        -
        Retrieves a result set that contains the elements of the SQL - ARRAY value - designated by this Array object. If appropriate, - the elements of the array are mapped using the connection's type - map; otherwise, the standard mapping is used. -

        - The result set contains one row for each array element, with - two columns in each row. The second column stores the element - value; the first column stores the index into the array for - that element (with the first array element being at index 1). - The rows are in ascending order corresponding to - the order of the indices.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Returns:
        -
        a ResultSet object containing one row for each - of the elements in the array designated by this Array - object, with the rows in ascending order based on the indices.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                                throws java.sql.SQLException
        -
        Retrieves a result set that contains the elements of the SQL - ARRAY value designated by this Array object. - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getResultSet uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - The result set contains one row for each array element, with - two columns in each row. The second column stores the element - value; the first column stores the index into the array for - that element (with the first array element being at index 1). - The rows are in ascending order corresponding to - the order of the indices.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Parameters:
        -
        map - contains the mapping of SQL user-defined types to - classes in the Java programming language
        -
        Returns:
        -
        a ResultSet object containing one row for each - of the elements in the array designated by this Array - object, with the rows in ascending order based on the indices.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet​(long index,
        -                                       int count)
        -                                throws java.sql.SQLException
        -
        Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements. This method uses - the connection's type map to map the elements of the array if - the map contains an entry for the base type. Otherwise, the - standard mapping is used. -

        - The result set has one row for each element of the SQL array - designated by this object, with the first row containing the - element at index index. The result set has - up to count rows in ascending order based on the - indices. Each row has two columns: The second column stores - the element value; the first column stores the index into the - array for that element.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to retrieve
        -
        Returns:
        -
        a ResultSet object containing up to - count consecutive elements of the SQL array - designated by this Array object, starting at - index index.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet​(long index,
        -                                       int count,
        -                                       java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                                throws java.sql.SQLException
        -
        Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements. - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getResultSet uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - The result set has one row for each element of the SQL array - designated by this object, with the first row containing the - element at index index. The result set has - up to count rows in ascending order based on the - indices. Each row has two columns: The second column stores - the element value; the first column stores the index into the - array for that element.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to retrieve
        -
        map - the Map object that contains the mapping - of SQL type names to classes in the Java(tm) programming language
        -
        Returns:
        -
        a ResultSet object containing up to - count consecutive elements of the SQL array - designated by this Array object, starting at - index index.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Returns a string representation in the form ARRAY[..., ...]
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Array object and releases the resources that - it holds. The object is invalid once the free - method is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. -

        -
        -
        Specified by:
        -
        free in interface java.sql.Array
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Array's resources
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        getArrayInternal

        -
        public java.lang.Object[] getArrayInternal()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCArrayBasic.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCArrayBasic.html deleted file mode 100644 index 601ecec8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCArrayBasic.html +++ /dev/null @@ -1,931 +0,0 @@ - - - - - -JDBCArrayBasic (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCArrayBasic

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCArrayBasic
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Array
    -
    -
    -
    public class JDBCArrayBasic
    -extends java.lang.Object
    -implements java.sql.Array
    -
    The mapping in the Java programming language for the SQL type - ARRAY. - By default, an Array value is a transaction-duration - reference to an SQL ARRAY value. By default, an Array - object is implemented using an SQL LOCATOR(array) internally, which - means that an Array object contains a logical pointer - to the data in the SQL ARRAY value rather - than containing the ARRAY value's data. -

    - The Array interface provides methods for bringing an SQL - ARRAY value's data to the client as either an array or a - ResultSet object. - If the elements of the SQL ARRAY - are a UDT, they may be custom mapped. To create a custom mapping, - a programmer must do two things: -

      -
    • create a class that implements the SQLData - interface for the UDT to be custom mapped. -
    • make an entry in a type map that contains -
        -
      • the fully-qualified SQL type name of the UDT -
      • the Class object for the class implementing - SQLData -
      -
    -

    - When a type map with an entry for - the base type is supplied to the methods getArray - and getResultSet, the mapping - it contains will be used to map the elements of the ARRAY value. - If no type map is supplied, which would typically be the case, - the connection's type map is used by default. - If the connection's type map or a type map supplied to a method has no entry - for the base type, the elements are mapped according to the standard mapping. -

    - All methods on the Array interface must be fully implemented if the - JDBC driver supports the data type.

    -
    -
    Since:
    -
    JDK 1.2, HSQLDB 2.0.1
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCArrayBasic​(java.lang.Object[] data, - org.hsqldb.types.Type type) -
      Public constructor to create an Array object from an Object[] and an - HSQLDB org.hsqldb.types.Type object.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidfree() -
      This method frees the Array object and releases the resources that - it holds.
      -
      java.lang.ObjectgetArray() -
      Retrieves the contents of the SQL ARRAY value designated - by this - Array object in the form of an array in the Java - programming language.
      -
      java.lang.ObjectgetArray​(long index, - int count) -
      Retrieves a slice of the SQL ARRAY - value designated by this Array object, beginning with the - specified index and containing up to count - successive elements of the SQL array.
      -
      java.lang.ObjectgetArray​(long index, - int count, - java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves a slice of the SQL ARRAY value - designated by this Array object, beginning with the specified - index and containing up to count - successive elements of the SQL array.
      -
      java.lang.ObjectgetArray​(java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves the contents of the SQL ARRAY value designated by this - Array object.
      -
      intgetBaseType() -
      Retrieves the JDBC type of the elements in the array designated - by this Array object.
      -
      java.lang.StringgetBaseTypeName() -
      Retrieves the SQL type name of the elements in - the array designated by this Array object.
      -
      java.sql.ResultSetgetResultSet() -
      Retrieves a result set that contains the elements of the SQL - ARRAY value - designated by this Array object.
      -
      java.sql.ResultSetgetResultSet​(long index, - int count) -
      Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
      -
      java.sql.ResultSetgetResultSet​(long index, - int count, - java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements.
      -
      java.sql.ResultSetgetResultSet​(java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Retrieves a result set that contains the elements of the SQL - ARRAY value designated by this Array object.
      -
      java.lang.StringtoString() -
      Returns a string representation in the form ARRAY[..., ...]
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCArrayBasic

        -
        public JDBCArrayBasic​(java.lang.Object[] data,
        -                      org.hsqldb.types.Type type)
        -
        Public constructor to create an Array object from an Object[] and an - HSQLDB org.hsqldb.types.Type object.
        -
        -
        Parameters:
        -
        data - the Object[]
        -
        type - the HSQLDB org.hsqldb.types.Type object
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getBaseTypeName

        -
        public java.lang.String getBaseTypeName()
        -                                 throws java.sql.SQLException
        -
        Retrieves the SQL type name of the elements in - the array designated by this Array object. - If the elements are a built-in type, it returns - the database-specific type name of the elements. - If the elements are a user-defined type (UDT), - this method returns the fully-qualified SQL type name.
        -
        -
        Specified by:
        -
        getBaseTypeName in interface java.sql.Array
        -
        Returns:
        -
        a String that is the database-specific - name for a built-in base type; or the fully-qualified SQL type - name for a base type that is a UDT
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting - to access the type name
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBaseType

        -
        public int getBaseType()
        -                throws java.sql.SQLException
        -
        Retrieves the JDBC type of the elements in the array designated - by this Array object.
        -
        -
        Specified by:
        -
        getBaseType in interface java.sql.Array
        -
        Returns:
        -
        a constant from the class Types that is - the type code for the elements in the array designated by this - Array object
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting - to access the base type
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray()
        -
        - Retrieves the contents of the SQL ARRAY value designated - by this - Array object in the form of an array in the Java - programming language. This version of the method getArray - uses the type map associated with the connection for customizations of - the type mappings. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Returns:
        -
        an array in the Java programming language that contains - the ordered elements of the SQL ARRAY value - designated by this Array object
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                          throws java.sql.SQLException
        -
        - Retrieves the contents of the SQL ARRAY value designated by this - Array object. - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getArray uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Parameters:
        -
        map - a java.util.Map object that contains mappings - of SQL type names to classes in the Java programming language
        -
        Returns:
        -
        an array in the Java programming language that contains the ordered - elements of the SQL array designated by this object
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray​(long index,
        -                                 int count)
        -                          throws java.sql.SQLException
        -
        - Retrieves a slice of the SQL ARRAY - value designated by this Array object, beginning with the - specified index and containing up to count - successive elements of the SQL array. This method uses the type map - associated with the connection for customizations of the type mappings. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to retrieve
        -
        Returns:
        -
        an array containing up to count consecutive elements - of the SQL array, beginning with element index
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.lang.Object getArray​(long index,
        -                                 int count,
        -                                 java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                          throws java.sql.SQLException
        -
        - Retrieves a slice of the SQL ARRAY value - designated by this Array object, beginning with the specified - index and containing up to count - successive elements of the SQL array. -

        - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getArray uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - Note: When getArray is used to materialize - a base type that maps to a primitive data type, then it is - implementation-defined whether the array returned is an array of - that primitive data type or an array of Object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns an array of Object. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to - retrieve
        -
        map - a java.util.Map object - that contains SQL type names and the classes in - the Java programming language to which they are mapped
        -
        Returns:
        -
        an array containing up to count - consecutive elements of the SQL ARRAY value designated by this - Array object, beginning with element - index
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet()
        -                                throws java.sql.SQLException
        -
        Retrieves a result set that contains the elements of the SQL - ARRAY value - designated by this Array object. If appropriate, - the elements of the array are mapped using the connection's type - map; otherwise, the standard mapping is used. -

        - The result set contains one row for each array element, with - two columns in each row. The second column stores the element - value; the first column stores the index into the array for - that element (with the first array element being at index 1). - The rows are in ascending order corresponding to - the order of the indices.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Returns:
        -
        a ResultSet object containing one row for each - of the elements in the array designated by this Array - object, with the rows in ascending order based on the indices.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                                throws java.sql.SQLException
        -
        Retrieves a result set that contains the elements of the SQL - ARRAY value designated by this Array object. - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getResultSet uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - The result set contains one row for each array element, with - two columns in each row. The second column stores the element - value; the first column stores the index into the array for - that element (with the first array element being at index 1). - The rows are in ascending order corresponding to - the order of the indices.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Parameters:
        -
        map - contains the mapping of SQL user-defined types to - classes in the Java programming language
        -
        Returns:
        -
        a ResultSet object containing one row for each - of the elements in the array designated by this Array - object, with the rows in ascending order based on the indices.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet​(long index,
        -                                       int count)
        -                                throws java.sql.SQLException
        -
        Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements. This method uses - the connection's type map to map the elements of the array if - the map contains an entry for the base type. Otherwise, the - standard mapping is used. -

        - The result set has one row for each element of the SQL array - designated by this object, with the first row containing the - element at index index. The result set has - up to count rows in ascending order based on the - indices. Each row has two columns: The second column stores - the element value; the first column stores the index into the - array for that element.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to retrieve
        -
        Returns:
        -
        a ResultSet object containing up to - count consecutive elements of the SQL array - designated by this Array object, starting at - index index.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet​(long index,
        -                                       int count,
        -                                       java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                                throws java.sql.SQLException
        -
        Retrieves a result set holding the elements of the subarray that - starts at index index and contains up to - count successive elements. - This method uses - the specified map for type map customizations - unless the base type of the array does not match a user-defined - type in map, in which case it - uses the standard mapping. This version of the method - getResultSet uses either the given type map or the standard mapping; - it never uses the type map associated with the connection. -

        - The result set has one row for each element of the SQL array - designated by this object, with the first row containing the - element at index index. The result set has - up to count rows in ascending order based on the - indices. Each row has two columns: The second column stores - the element value; the first column stores the index into the - array for that element.

        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Array
        -
        Parameters:
        -
        index - the array index of the first element to retrieve; - the first element is at index 1
        -
        count - the number of successive SQL array elements to retrieve
        -
        map - the Map object that contains the mapping - of SQL type names to classes in the Java(tm) programming language
        -
        Returns:
        -
        a ResultSet object containing up to - count consecutive elements of the SQL array - designated by this Array object, starting at - index index.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while attempting to - access the array
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Returns a string representation in the form ARRAY[..., ...]
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Array object and releases the resources that - it holds. The object is invalid once the free - method is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. -

        -
        -
        Specified by:
        -
        free in interface java.sql.Array
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Array's resources
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlob.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlob.html deleted file mode 100644 index b16daa86..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlob.html +++ /dev/null @@ -1,1016 +0,0 @@ - - - - - -JDBCBlob (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCBlob

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCBlob
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Blob
    -
    -
    -
    public class JDBCBlob
    -extends java.lang.Object
    -implements java.sql.Blob
    -
    The representation (mapping) in - the Java™ programming language of an SQL - BLOB value. An SQL BLOB is a built-in type - that stores a Binary Large Object as a column value in a row of - a database table. By default drivers implement Blob using - an SQL locator(BLOB), which means that a - Blob object contains a logical pointer to the - SQL BLOB data rather than the data itself. - A Blob object is valid for the duration of the - transaction in which it was created. - -

    Methods in the interfaces ResultSet, - CallableStatement, and PreparedStatement, such as - getBlob and setBlob allow a programmer to - access an SQL BLOB value. - The Blob interface provides methods for getting the - length of an SQL BLOB (Binary Large Object) value, - for materializing a BLOB value on the client, and for - determining the position of a pattern of bytes within a - BLOB value. In addition, this interface has methods for updating - a BLOB value. -

    - All methods on the Blob interface must be fully implemented if the - JDBC driver supports the data type. - - -

    -

    HSQLDB-Specific Information:

    - - Previous to 2.0, the HSQLDB driver did not implement Blob using an SQL - locator(BLOB). That is, an HSQLDB Blob object did not contain a logical - pointer to SQL BLOB data; rather it directly contained a representation of - the data (a byte array). As a result, an HSQLDB Blob object was itself - valid beyond the duration of the transaction in which is was created, - although it did not necessarily represent a corresponding value - on the database. Also, the interface methods for updating a BLOB value - were unsupported, with the exception of the truncate method, - in that it could be used to truncate the local value.

    - - Starting with 2.0, the HSQLDB driver fully supports both local and remote - SQL BLOB data implementations, meaning that an HSQLDB Blob object may - contain a logical pointer to remote SQL BLOB data (see JDBCBlobClient) or it may directly contain a local representation of the - data (as implemented in this class). In particular, when the product is built - under JDK 1.6+ and the Blob instance is constructed as a result of calling - JDBCConnection.createBlob(), then the resulting Blob instance is initially - disconnected (is not bound to the transaction scope of the vending Connection - object), the data is contained directly and all interface methods for - updating the BLOB value are supported for local use until the first - invocation of free(); otherwise, an HSQLDB Blob's implementation is - determined at runtime by the driver, it is typically not valid beyond the - duration of the transaction in which is was created, and there no - standard way to query whether it represents a local or remote - value.

    - -

    -
    -
    -
    Since:
    -
    JDK 1.2, HSQLDB 1.7.2
    -
    Author:
    -
    james house (jhouse@part.net), Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCBlob​(byte[] data) -
      Constructs a new JDBCBlob instance wrapping the given octet sequence.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidfree() -
      This method frees the Blob object and releases the resources that - it holds.
      -
      java.io.InputStreamgetBinaryStream() -
      Retrieves the BLOB value designated by this - Blob instance as a stream.
      -
      java.io.InputStreamgetBinaryStream​(long pos, - long length) -
      Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
      -
      byte[]getBytes​(long pos, - int length) -
      Retrieves all or part of the BLOB - value that this Blob object represents, as an array of - bytes.
      -
      longlength() -
      Returns the number of bytes in the BLOB value - designated by this Blob object.
      -
      longposition​(byte[] pattern, - long start) -
      Retrieves the byte position at which the specified byte array - pattern begins within the BLOB - value that this Blob object represents.
      -
      longposition​(java.sql.Blob pattern, - long start) -
      Retrieves the byte position in the BLOB value - designated by this Blob object at which - pattern begins.
      -
      java.io.OutputStreamsetBinaryStream​(long pos) -
      Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents.
      -
      intsetBytes​(long pos, - byte[] bytes) -
      Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written.
      -
      intsetBytes​(long pos, - byte[] bytes, - int offset, - int len) -
      Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written.
      -
      voidtruncate​(long len) -
      Truncates the BLOB value that this Blob - object represents to be len bytes in length.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCBlob

        -
        public JDBCBlob​(byte[] data)
        -         throws java.sql.SQLException
        -
        Constructs a new JDBCBlob instance wrapping the given octet sequence.

        - - This constructor is used internally to retrieve result set values as - Blob objects, yet it must be public to allow access from other packages. - As such (in the interest of efficiency) this object maintains a reference - to the given octet sequence rather than making a copy; special care - should be taken by external clients never to use this constructor with a - byte array object that may later be modified externally.

        -
        -
        Parameters:
        -
        data - the octet sequence representing the Blob value
        -
        Throws:
        -
        java.sql.SQLException - if the argument is null
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        length

        -
        public long length()
        -            throws java.sql.SQLException
        -
        Returns the number of bytes in the BLOB value - designated by this Blob object.
        -
        -
        Specified by:
        -
        length in interface java.sql.Blob
        -
        Returns:
        -
        length of the BLOB in bytes
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - length of the BLOB
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes​(long pos,
        -                       int length)
        -                throws java.sql.SQLException
        -
        Retrieves all or part of the BLOB - value that this Blob object represents, as an array of - bytes. This byte array contains up to length - consecutive bytes starting at position pos. - - -
        -

        HSQLDB-Specific Information:

        - - The official specification above is ambiguous in that it does not - precisely indicate the policy to be observed when - pos > this.length() - length. One policy would be to retrieve the - octets from pos to this.length(). Another would be to throw an - exception. HSQLDB observes the second policy. -

        -
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the ordinal position of the first byte in the - BLOB value to be extracted; the first byte is at - position 1
        -
        length - the number of consecutive bytes to be copied; JDBC 4.1[the value - for length must be 0 or greater]
        -
        Returns:
        -
        a byte array containing up to length - consecutive bytes from the BLOB value designated - by this Blob object, starting with the - byte at position pos
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value; if pos is less than 1 or length is - less than 0
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        See Also:
        -
        setBytes(long, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream()
        -                                    throws java.sql.SQLException
        -
        Retrieves the BLOB value designated by this - Blob instance as a stream.
        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.Blob
        -
        Returns:
        -
        a stream containing the BLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        See Also:
        -
        setBinaryStream(long)
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(byte[] pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the byte position at which the specified byte array - pattern begins within the BLOB - value that this Blob object represents. The - search for pattern begins at position - start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Blob
        -
        Parameters:
        -
        pattern - the byte array for which to search
        -
        start - the position at which to begin searching; the - first position is 1
        -
        Returns:
        -
        the position at which the pattern appears, else -1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB or if start is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.sql.Blob pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the byte position in the BLOB value - designated by this Blob object at which - pattern begins. The search begins at position - start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Blob
        -
        Parameters:
        -
        pattern - the Blob object designating - the BLOB value for which to search
        -
        start - the position in the BLOB value - at which to begin searching; the first position is 1
        -
        Returns:
        -
        the position at which the pattern begins, else -1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if start is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public int setBytes​(long pos,
        -                    byte[] bytes)
        -             throws java.sql.SQLException
        -
        Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written. - The array of bytes will overwrite the existing bytes - in the Blob object starting at the position - pos. If the end of the Blob value is reached - while writing the array of bytes, then the length of the Blob - value will be increased to accommodate the extra bytes. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is supported.

        - - When built under JDK 1.6+ and the Blob instance is constructed as a - result of calling JDBCConnection.createBlob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createBlob() constructs disconnected, - initially empty Blob instances. To propagate the Blob value to a database - in this case, it is required to supply the Blob instance to an updating - or inserting setXXX method of a Prepared or Callable Statement, or to - supply the Blob instance to an updateXXX method of an updatable - ResultSet.

        - - Implementation Notes:

        - - Starting with HSQLDB 2.1, JDBCBlob no longer utilizes volatile fields - and is effectively thread safe, but still uses local variable - snapshot isolation.

        - - As such, the synchronization policy still does not strictly enforce - serialized read/write access to the underlying data

        - - So, if an application may perform concurrent JDBCBlob modifications and - the integrity of the application depends on total order Blob modification - semantics, then such operations should be synchronized on an appropriate - monitor.

        - -

        -
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB object at which - to start writing; the first position is 1
        -
        bytes - the array of bytes to be written to the BLOB - value that this Blob object represents
        -
        Returns:
        -
        the number of bytes written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        getBytes(long, int)
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public int setBytes​(long pos,
        -                    byte[] bytes,
        -                    int offset,
        -                    int len)
        -             throws java.sql.SQLException
        -
        Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written. - Writing starts at position pos in the BLOB - value; len bytes from the given byte array are written. - The array of bytes will overwrite the existing bytes - in the Blob object starting at the position - pos. If the end of the Blob value is reached - while writing the array of bytes, then the length of the Blob - value will be increased to accommodate the extra bytes. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is supported.

        - - When built under JDK 1.6+ and the Blob instance is constructed as a - result of calling JDBCConnection.createBlob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createBlob() constructs disconnected, - initially empty Blob instances. To propagate the Blob value to a database - in this case, it is required to supply the Blob instance to an updating - or inserting setXXX method of a Prepared or Callable Statement, or to - supply the Blob instance to an updateXXX method of an updatable - ResultSet.

        - - Implementation Notes:

        - - If the value specified for pos - is greater than the length of the BLOB value, then - the BLOB value is extended in length to accept the - written octets and the undefined region up to pos is - filled with (byte)0.

        - - Starting with HSQLDB 2.1, JDBCBlob no longer utilizes volatile fields - and is effectively thread safe, but still uses local variable - snapshot isolation.

        - - As such, the synchronization policy still does not strictly enforce - serialized read/write access to the underlying data

        - - So, if an application may perform concurrent JDBCBlob modifications and - the integrity of the application depends on total order Blob modification - semantics, then such operations should be synchronized on an appropriate - monitor.

        - -

        -
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB object at which - to start writing; the first position is 1
        -
        bytes - the array of bytes to be written to this BLOB - object
        -
        offset - the offset into the array bytes at which - to start reading the bytes to be set
        -
        len - the number of bytes to be written to the BLOB - value from the array of bytes bytes
        -
        Returns:
        -
        the number of bytes written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        getBytes(long, int)
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public java.io.OutputStream setBinaryStream​(long pos)
        -                                     throws java.sql.SQLException
        -
        Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents. The stream begins - at position pos. - The bytes written to the stream will overwrite the existing bytes - in the Blob object starting at the position - pos. If the end of the Blob value is reached - while writing to the stream, then the length of the Blob - value will be increased to accommodate the extra bytes. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is supported.

        - - When built under JDK 1.6+ and the Blob instance is constructed as a - result of calling JDBCConnection.createBlob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createBlob() constructs disconnected, - initially empty Blob instances. To propagate the Blob value to a database - in this case, it is required to supply the Blob instance to an updating - or inserting setXXX method of a Prepared or Callable Statement, or to - supply the Blob instance to an updateXXX method of an updatable - ResultSet.

        - - Implementation Notes:

        - - The data written to the stream does not appear in this - Blob until the stream is closed

        - - When the stream is closed, if the value specified for pos - is greater than the length of the BLOB value, then - the BLOB value is extended in length to accept the - written octets and the undefined region up to pos is - filled with (byte)0.

        - - Starting with HSQLDB 2.1, JDBCBlob no longer utilizes volatile fields - and is effectively thread safe, but still uses local variable - snapshot isolation.

        - - As such, the synchronization policy still does not strictly enforce - serialized read/write access to the underlying data

        - - So, if an application may perform concurrent JDBCBlob modifications and - the integrity of the application depends on total order Blob modification - semantics, then such operations should be synchronized on an appropriate - monitor.

        - -

        -
        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB value at which - to start writing; the first position is 1
        -
        Returns:
        -
        a java.io.OutputStream object to which data can - be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        getBinaryStream()
        -
        -
      • -
      - - - -
        -
      • -

        truncate

        -
        public void truncate​(long len)
        -              throws java.sql.SQLException
        -
        Truncates the BLOB value that this Blob - object represents to be len bytes in length. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is fully supported.

        - - When built under JDK 1.6+ and the Blob instance is constructed as a - result of calling JDBCConnection.createBlob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createBlob() constructs disconnected, - initially empty Blob instances. To propagate the truncated Blob value to - a database in this case, it is required to supply the Blob instance to - an updating or inserting setXXX method of a Prepared or Callable - Statement, or to supply the Blob instance to an updateXXX method of an - updateable ResultSet.

        - -

        -
        -
        -
        Specified by:
        -
        truncate in interface java.sql.Blob
        -
        Parameters:
        -
        len - the length, in bytes, to which the BLOB value - that this Blob object represents should be truncated
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if len is less than 0
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Blob object and releases the resources that - it holds. The object is invalid once the free - method is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. -

        -
        -
        Specified by:
        -
        free in interface java.sql.Blob
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Blob's resources
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream​(long pos,
        -                                           long length)
        -                                    throws java.sql.SQLException
        -
        Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the offset to the first byte of the partial value to be retrieved. - The first byte in the Blob is at position 1
        -
        length - the length in bytes of the partial value to be retrieved
        -
        Returns:
        -
        InputStream through which the partial Blob value can be read.
        -
        Throws:
        -
        java.sql.SQLException - if pos is less than 1 or if pos is greater than the number of bytes - in the Blob or if pos + length is greater than the number of bytes - in the Blob
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlobClient.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlobClient.html deleted file mode 100644 index 9eea1a09..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlobClient.html +++ /dev/null @@ -1,760 +0,0 @@ - - - - - -JDBCBlobClient (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCBlobClient

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCBlobClient
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Blob
    -
    -
    -
    public class JDBCBlobClient
    -extends java.lang.Object
    -implements java.sql.Blob
    -
    A wrapper for HSQLDB BlobData objects. - - Instances of this class are returned by calls to ResultSet methods.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCBlobClient​(org.hsqldb.SessionInterface session, - org.hsqldb.types.BlobDataID blob) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclearUpdates() 
      voidfree() -
      This method frees the Blob object and releases the resources that - it holds.
      -
      java.io.InputStreamgetBinaryStream() -
      Retrieves the BLOB value designated by this - Blob instance as a stream.
      -
      java.io.InputStreamgetBinaryStream​(long pos, - long length) -
      Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
      -
      org.hsqldb.types.BlobDataIDgetBlob() 
      byte[]getBytes​(long pos, - int length) -
      Retrieves all or part of the BLOB value that this - Blob object represents, as an array of bytes.
      -
      booleanisClosed() 
      longlength() -
      Returns the number of bytes in the BLOB value designated - by this Blob object.
      -
      longposition​(byte[] pattern, - long start) -
      Retrieves the byte position at which the specified byte array - pattern begins within the BLOB value that - this Blob object represents.
      -
      longposition​(java.sql.Blob pattern, - long start) -
      Retrieves the byte position in the BLOB value designated - by this Blob object at which pattern begins.
      -
      java.io.OutputStreamsetBinaryStream​(long pos) -
      Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents.
      -
      intsetBytes​(long pos, - byte[] bytes) -
      Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written.
      -
      intsetBytes​(long pos, - byte[] bytes, - int offset, - int len) -
      Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written.
      -
      voidsetWritable​(JDBCResultSet result, - int index) 
      voidtruncate​(long len) -
      Truncates the BLOB value that this Blob - object represents to be len bytes in length.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCBlobClient

        -
        public JDBCBlobClient​(org.hsqldb.SessionInterface session,
        -                      org.hsqldb.types.BlobDataID blob)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        length

        -
        public long length()
        -            throws java.sql.SQLException
        -
        Returns the number of bytes in the BLOB value designated - by this Blob object.
        -
        -
        Specified by:
        -
        length in interface java.sql.Blob
        -
        Returns:
        -
        length of the BLOB in bytes
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the length of the - BLOB
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes​(long pos,
        -                       int length)
        -                throws java.sql.SQLException
        -
        Retrieves all or part of the BLOB value that this - Blob object represents, as an array of bytes.
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the ordinal position of the first byte in the - BLOB value to be extracted; the first byte is at - position 1
        -
        length - the number of consecutive bytes to be copied
        -
        Returns:
        -
        a byte array containing up to length consecutive - bytes from the BLOB value designated by this - Blob object, starting with the byte at position - pos
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream()
        -                                    throws java.sql.SQLException
        -
        Retrieves the BLOB value designated by this - Blob instance as a stream.
        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.Blob
        -
        Returns:
        -
        a stream containing the BLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(byte[] pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the byte position at which the specified byte array - pattern begins within the BLOB value that - this Blob object represents.
        -
        -
        Specified by:
        -
        position in interface java.sql.Blob
        -
        Parameters:
        -
        pattern - the byte array for which to search
        -
        start - the position at which to begin searching; the first - position is 1
        -
        Returns:
        -
        the position at which the pattern appears, else -1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.sql.Blob pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the byte position in the BLOB value designated - by this Blob object at which pattern begins.
        -
        -
        Specified by:
        -
        position in interface java.sql.Blob
        -
        Parameters:
        -
        pattern - the Blob object designating the - BLOB value for which to search
        -
        start - the position in the BLOB value at which to - begin searching; the first position is 1
        -
        Returns:
        -
        the position at which the pattern begins, else -1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public int setBytes​(long pos,
        -                    byte[] bytes)
        -             throws java.sql.SQLException
        -
        Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written.
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB object at which to - start writing
        -
        bytes - the array of bytes to be written to the - BLOB value that this Blob object - represents
        -
        Returns:
        -
        the number of bytes written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public int setBytes​(long pos,
        -                    byte[] bytes,
        -                    int offset,
        -                    int len)
        -             throws java.sql.SQLException
        -
        Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written.
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB object at which to - start writing
        -
        bytes - the array of bytes to be written to this - BLOB object
        -
        offset - the offset into the array bytes at which - to start reading the bytes to be set
        -
        len - the number of bytes to be written to the BLOB - value from the array of bytes bytes
        -
        Returns:
        -
        the number of bytes written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public java.io.OutputStream setBinaryStream​(long pos)
        -                                     throws java.sql.SQLException
        -
        Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents.
        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB value at which to - start writing
        -
        Returns:
        -
        a java.io.OutputStream object to which data can - be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        -
      • -
      - - - -
        -
      • -

        truncate

        -
        public void truncate​(long len)
        -              throws java.sql.SQLException
        -
        Truncates the BLOB value that this Blob - object represents to be len bytes in length.
        -
        -
        Specified by:
        -
        truncate in interface java.sql.Blob
        -
        Parameters:
        -
        len - the length, in bytes, to which the BLOB value - that this Blob object represents should be truncated
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Blob object and releases the resources that - it holds. The object is invalid once the free - method is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. -

        -
        -
        Specified by:
        -
        free in interface java.sql.Blob
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Blob's resources
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream​(long pos,
        -                                           long length)
        -                                    throws java.sql.SQLException
        -
        Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the offset to the first byte of the partial value to be retrieved. - The first byte in the Blob is at position 1
        -
        length - the length in bytes of the partial value to be retrieved
        -
        Returns:
        -
        InputStream through which the partial Blob value can be read.
        -
        Throws:
        -
        java.sql.SQLException - if pos is less than 1 or if pos is greater than the number of bytes - in the Blob or if pos + length is greater than the number of bytes - in the Blob
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
      • -
      - - - -
        -
      • -

        getBlob

        -
        public org.hsqldb.types.BlobDataID getBlob()
        -
      • -
      - - - -
        -
      • -

        setWritable

        -
        public void setWritable​(JDBCResultSet result,
        -                        int index)
        -
      • -
      - - - -
        -
      • -

        clearUpdates

        -
        public void clearUpdates()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlobFile.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlobFile.html deleted file mode 100644 index 96bd90c7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCBlobFile.html +++ /dev/null @@ -1,1120 +0,0 @@ - - - - - -JDBCBlobFile (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCBlobFile

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCBlobFile
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Blob
    -
    -
    -
    public class JDBCBlobFile
    -extends java.lang.Object
    -implements java.sql.Blob
    -
    A client-side file-based implementation of Blob. - - -
    -

    HSQLDB-Specific Information:

    - - Starting with 2.1, in addition to HSQLDB driver support for both client-side - in-memory and remote SQL CLOB data implementations, this class is provided - to expose efficient, relatively high-performance BLOB operations over client - accessible files.

    - - Design Notes

    - - Although it is possible to implement a transactional version of this class, - the present implementation directly propagates changes to the underlying - file such that changes become visible as soon as they are either - implicitly or explicitly flushed to disk. -

    - -

    -
    -
    -
    Since:
    -
    HSQLDB 2.1
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static java.lang.StringTEMP_FILE_PREFIX 
      static java.lang.StringTEMP_FILE_SUFFIX 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCBlobFile() -
      Convenience constructor; equivalent to JDBCBlobFile(true);
      -
      JDBCBlobFile​(boolean deleteOnFree) -
      Constructs a new instance backed by a File object created in response - to invoking File.createTempFile(TEMP_FILE_PREFIX,TEMP_FILE_SUFFIX)
      -
      JDBCBlobFile​(java.io.File file) -
      Convenience constructor; equivalent to JDBCBlobFile(file, false);
      -
      JDBCBlobFile​(java.io.File file, - boolean deleteOnFree) -
      Constructs a new instance backed by the given File object.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidfree() -
      This method frees the Blob object and releases the resources that - it holds.
      -
      java.io.InputStreamgetBinaryStream() -
      Retrieves the BLOB value designated by this - Blob instance as a stream.
      -
      java.io.InputStreamgetBinaryStream​(long pos, - long length) -
      Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
      -
      byte[]getBytes​(long pos, - int length) -
      Retrieves all or part of the BLOB - value that this Blob object represents, as an array of - bytes.
      -
      java.io.FilegetFile() -
      Retrieves the canonical File object denoting the file that - backs this BLOB.
      -
      booleanisDeleteOnFree() -
      Retrieves whether an attempt to delete the backing file - is made in response to invocation of free().
      -
      longlength() -
      Returns the number of bytes in the BLOB value - designated by this Blob object.
      -
      longposition​(byte[] pattern, - long start) -
      Retrieves the byte position at which the specified byte array - pattern begins within the BLOB - value that this Blob object represents.
      -
      longposition​(java.sql.Blob pattern, - long start) -
      Retrieves the byte position in the BLOB value - designated by this Blob object at which - pattern begins.
      -
      java.io.OutputStreamsetBinaryStream​(long pos) -
      Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents.
      -
      intsetBytes​(long pos, - byte[] bytes) -
      Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written.
      -
      intsetBytes​(long pos, - byte[] bytes, - int offset, - int len) -
      Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written.
      -
      voidsetDeleteOnFree​(boolean deleteOnFree) -
      Assigns whether an attempt to delete the backing file - is made in response to invocation of free().
      -
      voidtruncate​(long len) -
      Truncates the BLOB value that this Blob - object represents to be len bytes in length.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        TEMP_FILE_PREFIX

        -
        public static final java.lang.String TEMP_FILE_PREFIX
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        TEMP_FILE_SUFFIX

        -
        public static final java.lang.String TEMP_FILE_SUFFIX
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCBlobFile

        -
        public JDBCBlobFile()
        -             throws java.sql.SQLException
        -
        Convenience constructor; equivalent to JDBCBlobFile(true);
        -
        -
        Throws:
        -
        java.sql.SQLException - If a file could not be created or if a security - manager exists and its SecurityManager.checkWrite(java.lang.String) - method does not allow a file to be created.
        -
        -
      • -
      - - - -
        -
      • -

        JDBCBlobFile

        -
        public JDBCBlobFile​(boolean deleteOnFree)
        -             throws java.sql.SQLException
        -
        Constructs a new instance backed by a File object created in response - to invoking File.createTempFile(TEMP_FILE_PREFIX,TEMP_FILE_SUFFIX)

        -
        -
        Parameters:
        -
        deleteOnFree - Assigns whether an attempt to delete the backing file - is to be made in response to invocation of free().
        -
        Throws:
        -
        java.sql.SQLException - If a file could not be created or if a security - manager exists and its SecurityManager.checkWrite(java.lang.String) - method does not allow a file to be created.
        -
        -
      • -
      - - - -
        -
      • -

        JDBCBlobFile

        -
        public JDBCBlobFile​(java.io.File file)
        -             throws java.sql.SQLException
        -
        Convenience constructor; equivalent to JDBCBlobFile(file, false);
        -
        -
        Parameters:
        -
        file - used to back this BLOB instance.
        -
        Throws:
        -
        java.sql.SQLException - If an I/O error occurs, which is possible because - the construction of the canonical pathname may require file system - queries; if a required system property value cannot be accessed, - or if a security manager exists and its SecurityManager.checkRead(java.io.FileDescriptor) method denies - read access to the file
        -
        -
      • -
      - - - -
        -
      • -

        JDBCBlobFile

        -
        public JDBCBlobFile​(java.io.File file,
        -                    boolean deleteOnFree)
        -             throws java.sql.SQLException
        -
        Constructs a new instance backed by the given File object.
        -
        -
        Parameters:
        -
        file - used to back this BLOB instance.
        -
        deleteOnFree - Assigns whether an attempt to delete the backing file - is to be made in response to invocation of free().
        -
        Throws:
        -
        java.sql.SQLException - If an I/O error occurs, which is possible because - the construction of the canonical pathname may require file system - queries; if a required system property value cannot be accessed, - or if a security manager exists and its SecurityManager.checkRead(java.io.FileDescriptor) method denies - read access to the file
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        length

        -
        public long length()
        -            throws java.sql.SQLException
        -
        Returns the number of bytes in the BLOB value - designated by this Blob object.
        -
        -
        Specified by:
        -
        length in interface java.sql.Blob
        -
        Returns:
        -
        length of the BLOB in bytes
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - length of the BLOB
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes​(long pos,
        -                       int length)
        -                throws java.sql.SQLException
        -
        Retrieves all or part of the BLOB - value that this Blob object represents, as an array of - bytes. This byte array contains up to length - consecutive bytes starting at position pos.
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the ordinal position of the first byte in the - BLOB value to be extracted; the first byte is at - position 1
        -
        length - the number of consecutive bytes to be copied; the value - for length must be 0 or greater
        -
        Returns:
        -
        a byte array containing up to length - consecutive bytes from the BLOB value designated - by this Blob object, starting with the - byte at position pos
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value; if pos is less than 1 or length is - less than 0
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setBytes(long, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream()
        -                                    throws java.sql.SQLException
        -
        Retrieves the BLOB value designated by this - Blob instance as a stream.
        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.Blob
        -
        Returns:
        -
        a stream containing the BLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setBinaryStream(long)
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(byte[] pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the byte position at which the specified byte array - pattern begins within the BLOB - value that this Blob object represents. The - search for pattern begins at position - start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Blob
        -
        Parameters:
        -
        pattern - the byte array for which to search
        -
        start - the position at which to begin searching; the - first position is 1
        -
        Returns:
        -
        the position at which the pattern appears, else -1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB or if start is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.sql.Blob pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the byte position in the BLOB value - designated by this Blob object at which - pattern begins. The search begins at position - start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Blob
        -
        Parameters:
        -
        pattern - the Blob object designating - the BLOB value for which to search
        -
        start - the position in the BLOB value - at which to begin searching; the first position is 1
        -
        Returns:
        -
        the position at which the pattern begins, else -1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if start is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public int setBytes​(long pos,
        -                    byte[] bytes)
        -             throws java.sql.SQLException
        -
        Writes the given array of bytes to the BLOB value that - this Blob object represents, starting at position - pos, and returns the number of bytes written. - The array of bytes will overwrite the existing bytes - in the Blob object starting at the position - pos. If the end of the Blob value is reached - while writing the array of bytes, then the length of the Blob - value will be increased to accommodate the extra bytes. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - This operation affects only the content of the underlying file; it has no - effect upon a value stored in a database. To propagate the updated - Blob value to a database, it is required to supply the Blob instance to - an updating or inserting setXXX method of a Prepared or Callable - Statement, or to supply the Blob instance to an updateXXX method of an - updatable ResultSet.

        - -

        -
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB object at which - to start writing; the first position is 1
        -
        bytes - the array of bytes to be written to the BLOB - value that this Blob object represents
        -
        Returns:
        -
        the number of bytes written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        See Also:
        -
        getBytes(long, int)
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public int setBytes​(long pos,
        -                    byte[] bytes,
        -                    int offset,
        -                    int len)
        -             throws java.sql.SQLException
        -
        Writes all or part of the given byte array to the - BLOB value that this Blob object represents - and returns the number of bytes written. - Writing starts at position pos in the BLOB - value; len bytes from the given byte array are written. - The array of bytes will overwrite the existing bytes - in the Blob object starting at the position - pos. If the end of the Blob value is reached - while writing the array of bytes, then the length of the Blob - value will be increased to accommodate the extra bytes. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - This operation affects only the content of the underlying file; it has no - effect upon a value stored in a database. To propagate the updated - Blob value to a database, it is required to supply the Blob instance to - an updating or inserting setXXX method of a Prepared or Callable - Statement, or to supply the Blob instance to an updateXXX method of an - updatable ResultSet.

        - -

        -
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB object at which - to start writing; the first position is 1
        -
        bytes - the array of bytes to be written to this BLOB - object
        -
        offset - the offset into the array bytes at which - to start reading the bytes to be set
        -
        len - the number of bytes to be written to the BLOB - value from the array of bytes bytes
        -
        Returns:
        -
        the number of bytes written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        See Also:
        -
        getBytes(long, int)
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public java.io.OutputStream setBinaryStream​(long pos)
        -                                     throws java.sql.SQLException
        -
        Retrieves a stream that can be used to write to the BLOB - value that this Blob object represents. The stream begins - at position pos. - The bytes written to the stream will overwrite the existing bytes - in the Blob object starting at the position - pos. If the end of the Blob value is reached - while writing to the stream, then the length of the Blob - value will be increased to accommodate the extra bytes. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Data written to the returned stream affects only the content of the - underlying file; it has no effect upon a value stored in a database. - To propagate the updated Blob value to a database, it is required to - supply the Blob instance to an updating or inserting setXXX method of a - Prepared or Callable Statement, or to supply the Blob instance to an - updateXXX method of an updateable ResultSet.

        - -

        -
        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the position in the BLOB value at which - to start writing; the first position is 1
        -
        Returns:
        -
        a java.io.OutputStream object to which data can - be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        See Also:
        -
        getBinaryStream()
        -
        -
      • -
      - - - -
        -
      • -

        truncate

        -
        public void truncate​(long len)
        -              throws java.sql.SQLException
        -
        Truncates the BLOB value that this Blob - object represents to be len bytes in length. -

        - Note: If the value specified for pos - is greater than the length+1 of the BLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - This operation affects only the length of the underlying file; it has no - effect upon a value stored in a database. To propagate the truncated - Blob value to a database, it is required to supply the Blob instance to - an updating or inserting setXXX method of a Prepared or Callable - Statement, or to supply the Blob instance to an updateXXX method of an - updatable ResultSet.

        - -

        -
        -
        -
        Specified by:
        -
        truncate in interface java.sql.Blob
        -
        Parameters:
        -
        len - the length, in bytes, to which the BLOB value - that this Blob object represents should be truncated
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - BLOB value or if len is less than 0
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Blob object and releases the resources that - it holds. The object is invalid once the free - method is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. - - -

        -

        HSQLDB-Specific Information:

        - - This operation closes any input and/or output streams obtained - via getBinaryStream(), getBinaryStream(long, long) or - setBinaryStream(long).

        - - Additionally, if the property isDeleteOnFree() is true, then - an attempt is made to delete the backing file. - -

        -
        -
        -
        Specified by:
        -
        free in interface java.sql.Blob
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Blob's resources
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        See Also:
        -
        setDeleteOnFree(boolean), -isDeleteOnFree()
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream​(long pos,
        -                                           long length)
        -                                    throws java.sql.SQLException
        -
        Returns an InputStream object that contains a partial Blob value, - starting with the byte specified by pos, which is length bytes in length.
        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.Blob
        -
        Parameters:
        -
        pos - the offset to the first byte of the partial value to be retrieved. - The first byte in the Blob is at position 1
        -
        length - the length in bytes of the partial value to be retrieved
        -
        Returns:
        -
        InputStream through which the partial Blob value can be read.
        -
        Throws:
        -
        java.sql.SQLException - if pos is less than 1 or if pos is greater than the number of bytes - in the Blob or if pos + length is greater than the number of bytes - in the Blob
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        getFile

        -
        public java.io.File getFile()
        -
        Retrieves the canonical File object denoting the file that - backs this BLOB.
        -
        -
        Returns:
        -
        the file that backs this BLOB.
        -
        -
      • -
      - - - -
        -
      • -

        isDeleteOnFree

        -
        public boolean isDeleteOnFree()
        -
        Retrieves whether an attempt to delete the backing file - is made in response to invocation of free().
        -
        -
        Returns:
        -
        true if backing file deletion is attempted; otherwise false.
        -
        -
      • -
      - - - -
        -
      • -

        setDeleteOnFree

        -
        public void setDeleteOnFree​(boolean deleteOnFree)
        -
        Assigns whether an attempt to delete the backing file - is made in response to invocation of free().
        -
        -
        Parameters:
        -
        deleteOnFree - the new value to assign
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCCallableStatement.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCCallableStatement.html deleted file mode 100644 index e41d6967..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCCallableStatement.html +++ /dev/null @@ -1,7308 +0,0 @@ - - - - - -JDBCCallableStatement (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCCallableStatement

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.lang.AutoCloseable, java.sql.CallableStatement, java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper
    -
    -
    -
    public class JDBCCallableStatement
    -extends JDBCPreparedStatement
    -implements java.sql.CallableStatement
    -
    - - The interface used to execute SQL stored procedures. The JDBC API - provides a stored procedure SQL escape syntax that allows stored procedures - to be called in a standard way for all RDBMSs. This escape syntax has one - form that includes a result parameter and one that does not. If used, the result - parameter must be registered as an OUT parameter. The other parameters - can be used for input, output or both. Parameters are referred to - sequentially, by number, with the first parameter being 1. -

    (JDBC4 clarification:) -

    -   {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
    -   {call <procedure-name>[(<arg1>,<arg2>, ...)]}
    - 
    -

    - IN parameter values are set using the set methods inherited from - PreparedStatement. The type of all OUT parameters must be - registered prior to executing the stored procedure; their values - are retrieved after execution via the get methods provided here. -

    - A CallableStatement can return one ResultSet object or - multiple ResultSet objects. Multiple - ResultSet objects are handled using operations - inherited from Statement. -

    - For maximum portability, a call's ResultSet objects and - update counts should be processed prior to getting the values of output - parameters. - - - - -

    -

    HSQLDB-Specific Information:

    - - Beyond the XOpen/ODBC extended scalar functions, stored procedures are - typically supported in ways that vary greatly from one DBMS implementation - to the next. So, it is almost guaranteed that the code for a stored - procedure written under a specific DBMS product will not work without - at least some modification in the context of another vendor's product - or even across a single vendor's product lines. Moving stored procedures - from one DBMS product line to another almost invariably involves complex - porting issues and often may not be possible at all. Be warned.

    - - One kind of HSQLDB stored procedures and functions is SQL/JRT, Java routines - that map directly onto the static methods of compiled Java classes found on - the class path of the engine at runtime. The CREATE PROCEDURE or CREATE FUNCTION - statements are used in SQL to support the Java methods.

    - - The other kind of HSQLDB stored procedures is SQL/PSM routines that are - written entirely in the SQL procedural language. - - Overloaded methods are supported and resolved according to the type of - parameters. - - With procedures, OUT and IN OUT parameters - are also supported.

    - - In addition, HSQLDB stored procedure call mechanism allows the - more general HSQLDB SQL expression evaluation mechanism. This - extension provides the ability to evaluate simple SQL expressions, possibly - containing Java method invocations.

    - - With HSQLDB, executing a CALL statement that produces an opaque - (OTHER) or known scalar object reference has virtually the same effect as: - -

    - CREATE TABLE DUAL (dummy VARCHAR);
    - INSERT INTO DUAL VALUES(NULL);
    - SELECT <simple-expression> FROM DUAL;
    - 
    - - HSQLDB functions can return a single result set. HSQLDB procedures can - return one or more result sets. - - Here is a very simple example of an HSQLDB stored procedure generating a - user-defined result set: - -
    - package mypackage;
    -
    - import java.sql.ResultSet;
    - import java.sql.SQLException;
    -
    - class MyLibraryClass {
    -
    -      public static ResultSet mySp() throws SQLException {
    -          return ctx.getConnection().createStatement().executeQuery("select * from my_table");
    -      }
    - }
    -
    - 
    - - (campbell-burnet@users) -
    -
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCConnection.prepareCall(java.lang.String), -JDBCResultSet
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface java.sql.Statement

        -CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCCallableStatement​(JDBCConnection c, - java.lang.String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) -
      Constructs a new JDBCCallableStatement with the specified connection and - result type.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethodDescription
      voidclose() -
      Does the specialized work required to free this object's resources and - that of its parent classes.
      -
      voidcloseOnCompletion() -
      Specifies that this Statement will be closed when all its - dependent result sets are closed.
      -
      java.sql.ResultSetexecuteQuery() -
      Executes the SQL query in this PreparedStatement object - and returns the ResultSet object generated by the query.
      -
      java.sql.ArraygetArray​(int parameterIndex) -
      Retrieves the value of the designated JDBC ARRAY parameter as an - Array object in the Java programming language.
      -
      java.sql.ArraygetArray​(java.lang.String parameterName) -
      Retrieves the value of a JDBC ARRAY parameter as an - Array object in the Java programming language.
      -
      java.math.BigDecimalgetBigDecimal​(int parameterIndex) -
      Retrieves the value of the designated JDBC NUMERIC parameter as a - java.math.BigDecimal object with as many digits to the - right of the decimal point as the value contains.
      -
      java.math.BigDecimalgetBigDecimal​(int parameterIndex, - int scale) -
      Deprecated. -
      use getBigDecimal(int parameterIndex) - or getBigDecimal(String parameterName)
      -
      -
      java.math.BigDecimalgetBigDecimal​(java.lang.String parameterName) -
      Retrieves the value of a JDBC NUMERIC parameter as a - java.math.BigDecimal object with as many digits to the - right of the decimal point as the value contains.
      -
      java.sql.BlobgetBlob​(int parameterIndex) -
      Retrieves the value of the designated JDBC BLOB parameter as a - Blob object in the Java programming language.
      -
      java.sql.BlobgetBlob​(java.lang.String parameterName) -
      Retrieves the value of a JDBC BLOB parameter as a - Blob object in the Java programming language.
      -
      booleangetBoolean​(int parameterIndex) -
      (JDBC4 modified:) - Retrieves the value of the designated JDBC BIT - or BOOLEAN parameter as a - boolean in the Java programming language.
      -
      booleangetBoolean​(java.lang.String parameterName) -
      (JDBC4 modified:)
      -
      bytegetByte​(int parameterIndex) -
      Retrieves the value of the designated JDBC TINYINT parameter - as a byte in the Java programming language.
      -
      bytegetByte​(java.lang.String parameterName) -
      Retrieves the value of a JDBC TINYINT parameter as a byte - in the Java programming language.
      -
      byte[]getBytes​(int parameterIndex) -
      Retrieves the value of the designated JDBC BINARY or - VARBINARY parameter as an array of byte - values in the Java programming language.
      -
      byte[]getBytes​(java.lang.String parameterName) -
      Retrieves the value of a JDBC BINARY or VARBINARY - parameter as an array of byte values in the Java - programming language.
      -
      java.io.ReadergetCharacterStream​(int parameterIndex) -
      Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
      -
      java.io.ReadergetCharacterStream​(java.lang.String parameterName) -
      Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
      -
      java.sql.ClobgetClob​(int parameterIndex) -
      Retrieves the value of the designated JDBC CLOB parameter as a - java.sql.Clob object in the Java programming language.
      -
      java.sql.ClobgetClob​(java.lang.String parameterName) -
      Retrieves the value of a JDBC CLOB parameter as a - Clob object in the Java programming language.
      -
      java.sql.DategetDate​(int parameterIndex) -
      Retrieves the value of the designated JDBC DATE parameter as a - java.sql.Date object.
      -
      java.sql.DategetDate​(int parameterIndex, - java.util.Calendar cal) -
      Retrieves the value of the designated JDBC DATE parameter as a - java.sql.Date object, using - the given Calendar object - to construct the date.
      -
      java.sql.DategetDate​(java.lang.String parameterName) -
      Retrieves the value of a JDBC DATE parameter as a - java.sql.Date object.
      -
      java.sql.DategetDate​(java.lang.String parameterName, - java.util.Calendar cal) -
      Retrieves the value of a JDBC DATE parameter as a - java.sql.Date object, using - the given Calendar object - to construct the date.
      -
      doublegetDouble​(int parameterIndex) -
      Retrieves the value of the designated JDBC DOUBLE parameter as a double - in the Java programming language.
      -
      doublegetDouble​(java.lang.String parameterName) -
      Retrieves the value of a JDBC DOUBLE parameter as a double - in the Java programming language.
      -
      floatgetFloat​(int parameterIndex) -
      Retrieves the value of the designated JDBC FLOAT parameter - as a float in the Java programming language.
      -
      floatgetFloat​(java.lang.String parameterName) -
      Retrieves the value of a JDBC FLOAT parameter as a float - in the Java programming language.
      -
      intgetInt​(int parameterIndex) -
      Retrieves the value of the designated JDBC INTEGER parameter - as an int in the Java programming language.
      -
      intgetInt​(java.lang.String parameterName) -
      Retrieves the value of a JDBC INTEGER parameter as an int - in the Java programming language.
      -
      longgetLong​(int parameterIndex) -
      Retrieves the value of the designated JDBC BIGINT parameter - as a long in the Java programming language.
      -
      longgetLong​(java.lang.String parameterName) -
      Retrieves the value of a JDBC BIGINT parameter as a long - in the Java programming language.
      -
      java.io.ReadergetNCharacterStream​(int parameterIndex) -
      Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
      -
      java.io.ReadergetNCharacterStream​(java.lang.String parameterName) -
      Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language.
      -
      java.sql.NClobgetNClob​(int parameterIndex) -
      Retrieves the value of the designated JDBC NCLOB parameter as a - java.sql.NClob object in the Java programming language.
      -
      java.sql.NClobgetNClob​(java.lang.String parameterName) -
      Retrieves the value of a JDBC NCLOB parameter as a - java.sql.NClob object in the Java programming language.
      -
      java.lang.StringgetNString​(int parameterIndex) -
      Retrieves the value of the designated NCHAR, - NVARCHAR - or LONGNVARCHAR parameter as - a String in the Java programming language.
      -
      java.lang.StringgetNString​(java.lang.String parameterName) -
      Retrieves the value of the designated NCHAR, - NVARCHAR - or LONGNVARCHAR parameter as - a String in the Java programming language.
      -
      java.lang.ObjectgetObject​(int parameterIndex) -
      Retrieves the value of the designated parameter as an Object - in the Java programming language.
      -
      <T> TgetObject​(int parameterIndex, - java.lang.Class<T> type) -
      Returns an object representing the value of OUT parameter - parameterIndex and will convert from the - SQL type of the parameter to the requested Java data type, if the - conversion is supported.
      -
      java.lang.ObjectgetObject​(int parameterIndex, - java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Returns an object representing the value of OUT parameter - parameterIndex and uses map for the custom - mapping of the parameter value.
      -
      java.lang.ObjectgetObject​(java.lang.String parameterName) -
      Retrieves the value of a parameter as an Object in the Java - programming language.
      -
      <T> TgetObject​(java.lang.String parameterName, - java.lang.Class<T> type) -
      Returns an object representing the value of OUT parameter - parameterName and will convert from the - SQL type of the parameter to the requested Java data type, if the - conversion is supported.
      -
      java.lang.ObjectgetObject​(java.lang.String parameterName, - java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Returns an object representing the value of OUT parameter - parameterName and uses map for the custom - mapping of the parameter value.
      -
      java.sql.RefgetRef​(int parameterIndex) -
      Retrieves the value of the designated JDBC REF(<structured-type>) - parameter as a Ref object in the Java programming language.
      -
      java.sql.RefgetRef​(java.lang.String parameterName) -
      Retrieves the value of a JDBC REF(<structured-type>) - parameter as a Ref object in the Java programming language.
      -
      java.sql.ResultSetgetResultSet() -
      Retrieves the current result as a ResultSet object.
      -
      java.sql.RowIdgetRowId​(int parameterIndex) -
      Retrieves the value of the designated JDBC ROWID parameter as a - java.sql.RowId object.
      -
      java.sql.RowIdgetRowId​(java.lang.String parameterName) -
      Retrieves the value of the designated JDBC ROWID parameter as a - java.sql.RowId object.
      -
      shortgetShort​(int parameterIndex) -
      Retrieves the value of the designated JDBC SMALLINT parameter - as a short in the Java programming language.
      -
      shortgetShort​(java.lang.String parameterName) -
      Retrieves the value of a JDBC SMALLINT parameter as a short - in the Java programming language.
      -
      java.sql.SQLXMLgetSQLXML​(int parameterIndex) -
      Retrieves the value of the designated SQL XML parameter as a - java.sql.SQLXML object in the Java programming language.
      -
      java.sql.SQLXMLgetSQLXML​(java.lang.String parameterName) -
      Retrieves the value of the designated SQL XML parameter as a - java.sql.SQLXML object in the Java programming language.
      -
      java.lang.StringgetString​(int parameterIndex) -
      Retrieves the value of the designated JDBC CHAR, - VARCHAR, or LONGVARCHAR parameter as a - String in the Java programming language.
      -
      java.lang.StringgetString​(java.lang.String parameterName) -
      Retrieves the value of a JDBC CHAR, VARCHAR, - or LONGVARCHAR parameter as a String in - the Java programming language.
      -
      java.sql.TimegetTime​(int parameterIndex) -
      Retrieves the value of the designated JDBC TIME parameter as a - java.sql.Time object.
      -
      java.sql.TimegetTime​(int parameterIndex, - java.util.Calendar cal) -
      Retrieves the value of the designated JDBC TIME parameter as a - java.sql.Time object, using - the given Calendar object - to construct the time.
      -
      java.sql.TimegetTime​(java.lang.String parameterName) -
      Retrieves the value of a JDBC TIME parameter as a - java.sql.Time object.
      -
      java.sql.TimegetTime​(java.lang.String parameterName, - java.util.Calendar cal) -
      Retrieves the value of a JDBC TIME parameter as a - java.sql.Time object, using - the given Calendar object - to construct the time.
      -
      java.sql.TimestampgetTimestamp​(int parameterIndex) -
      Retrieves the value of the designated JDBC TIMESTAMP - parameter as a java.sql.Timestamp object.
      -
      java.sql.TimestampgetTimestamp​(int parameterIndex, - java.util.Calendar cal) -
      Retrieves the value of the designated JDBC TIMESTAMP parameter as a - java.sql.Timestamp object, using - the given Calendar object to construct - the Timestamp object.
      -
      java.sql.TimestampgetTimestamp​(java.lang.String parameterName) -
      Retrieves the value of a JDBC TIMESTAMP parameter as a - java.sql.Timestamp object.
      -
      java.sql.TimestampgetTimestamp​(java.lang.String parameterName, - java.util.Calendar cal) -
      Retrieves the value of a JDBC TIMESTAMP parameter as a - java.sql.Timestamp object, using - the given Calendar object to construct - the Timestamp object.
      -
      java.net.URLgetURL​(int parameterIndex) -
      Retrieves the value of the designated JDBC DATALINK parameter as a - java.net.URL object.
      -
      java.net.URLgetURL​(java.lang.String parameterName) -
      Retrieves the value of a JDBC DATALINK parameter as a - java.net.URL object.
      -
      booleanisCloseOnCompletion() -
      Returns a value indicating whether this Statement will be - closed when all its dependent result sets are closed.
      -
      voidregisterOutParameter​(int parameterIndex, - int sqlType) -
      Registers the OUT parameter in ordinal position - parameterIndex to the JDBC type - sqlType.
      -
      voidregisterOutParameter​(int parameterIndex, - int sqlType, - int scale) -
      Registers the parameter in ordinal position - parameterIndex to be of JDBC type - sqlType.
      -
      voidregisterOutParameter​(int parameterIndex, - int sqlType, - java.lang.String typeName) -
      Registers the designated output parameter.
      -
      voidregisterOutParameter​(int parameterIndex, - java.sql.SQLType sqlType) -
      Registers the OUT parameter in ordinal position - parameterIndex to the JDBC type - sqlType.
      -
      voidregisterOutParameter​(int parameterIndex, - java.sql.SQLType sqlType, - int scale) -
      Registers the parameter in ordinal position - parameterIndex to be of JDBC type - sqlType.
      -
      voidregisterOutParameter​(int parameterIndex, - java.sql.SQLType sqlType, - java.lang.String typeName) -
      Registers the designated output parameter.
      -
      voidregisterOutParameter​(java.lang.String parameterName, - int sqlType) -
      Registers the OUT parameter named - parameterName to the JDBC type - sqlType.
      -
      voidregisterOutParameter​(java.lang.String parameterName, - int sqlType, - int scale) -
      Registers the parameter named - parameterName to be of JDBC type - sqlType.
      -
      voidregisterOutParameter​(java.lang.String parameterName, - int sqlType, - java.lang.String typeName) -
      Registers the designated output parameter.
      -
      voidregisterOutParameter​(java.lang.String parameterName, - java.sql.SQLType sqlType) -
      Registers the OUT parameter named - parameterName to the JDBC type - sqlType.
      -
      voidregisterOutParameter​(java.lang.String parameterName, - java.sql.SQLType sqlType, - int scale) -
      Registers the parameter named - parameterName to be of JDBC type - sqlType.
      -
      voidregisterOutParameter​(java.lang.String parameterName, - java.sql.SQLType sqlType, - java.lang.String typeName) -
      Registers the designated output parameter.
      -
      voidsetAsciiStream​(java.lang.String parameterName, - java.io.InputStream x) -
      Sets the designated parameter to the given input stream.
      -
      voidsetAsciiStream​(java.lang.String parameterName, - java.io.InputStream x, - int length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetAsciiStream​(java.lang.String parameterName, - java.io.InputStream x, - long length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetBigDecimal​(java.lang.String parameterName, - java.math.BigDecimal x) -
      Sets the designated parameter to the given - java.math.BigDecimal value.
      -
      voidsetBinaryStream​(java.lang.String parameterName, - java.io.InputStream x) -
      Sets the designated parameter to the given input stream.
      -
      voidsetBinaryStream​(java.lang.String parameterName, - java.io.InputStream x, - int length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetBinaryStream​(java.lang.String parameterName, - java.io.InputStream x, - long length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetBlob​(java.lang.String parameterName, - java.io.InputStream inputStream) -
      Sets the designated parameter to a InputStream object.
      -
      voidsetBlob​(java.lang.String parameterName, - java.io.InputStream inputStream, - long length) -
      Sets the designated parameter to a InputStream object.
      -
      voidsetBlob​(java.lang.String parameterName, - java.sql.Blob x) -
      Sets the designated parameter to the given java.sql.Blob object.
      -
      voidsetBoolean​(java.lang.String parameterName, - boolean x) -
      Sets the designated parameter to the given Java boolean value.
      -
      voidsetByte​(java.lang.String parameterName, - byte x) -
      Sets the designated parameter to the given Java byte value.
      -
      voidsetBytes​(java.lang.String parameterName, - byte[] x) -
      Sets the designated parameter to the given Java array of bytes.
      -
      voidsetCharacterStream​(java.lang.String parameterName, - java.io.Reader reader) -
      Sets the designated parameter to the given Reader - object.
      -
      voidsetCharacterStream​(java.lang.String parameterName, - java.io.Reader reader, - int length) -
      Sets the designated parameter to the given Reader - object, which is the given number of characters long.
      -
      voidsetCharacterStream​(java.lang.String parameterName, - java.io.Reader reader, - long length) -
      Sets the designated parameter to the given Reader - object, which is the given number of characters long.
      -
      voidsetClob​(java.lang.String parameterName, - java.io.Reader reader) -
      Sets the designated parameter to a Reader object.
      -
      voidsetClob​(java.lang.String parameterName, - java.io.Reader reader, - long length) -
      Sets the designated parameter to a Reader object.
      -
      voidsetClob​(java.lang.String parameterName, - java.sql.Clob x) -
      Sets the designated parameter to the given java.sql.Clob object.
      -
      voidsetDate​(java.lang.String parameterName, - java.sql.Date x) -
      Sets the designated parameter to the given java.sql.Date value - (JDBC4 clarification:)
      -
      voidsetDate​(java.lang.String parameterName, - java.sql.Date x, - java.util.Calendar cal) -
      Sets the designated parameter to the given java.sql.Date value, - using the given Calendar object.
      -
      voidsetDouble​(java.lang.String parameterName, - double x) -
      Sets the designated parameter to the given Java double value.
      -
      voidsetFloat​(java.lang.String parameterName, - float x) -
      Sets the designated parameter to the given Java float value.
      -
      voidsetInt​(java.lang.String parameterName, - int x) -
      Sets the designated parameter to the given Java int value.
      -
      voidsetLong​(java.lang.String parameterName, - long x) -
      Sets the designated parameter to the given Java long value.
      -
      voidsetNCharacterStream​(java.lang.String parameterName, - java.io.Reader value) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNCharacterStream​(java.lang.String parameterName, - java.io.Reader value, - long length) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNClob​(java.lang.String parameterName, - java.io.Reader reader) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNClob​(java.lang.String parameterName, - java.io.Reader reader, - long length) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNClob​(java.lang.String parameterName, - java.sql.NClob value) -
      Sets the designated parameter to a java.sql.NClob object.
      -
      voidsetNString​(java.lang.String parameterName, - java.lang.String value) -
      Sets the designated parameter to the given String object.
      -
      voidsetNull​(java.lang.String parameterName, - int sqlType) -
      Sets the designated parameter to SQL NULL.
      -
      voidsetNull​(java.lang.String parameterName, - int sqlType, - java.lang.String typeName) -
      Sets the designated parameter to SQL NULL.
      -
      voidsetObject​(java.lang.String parameterName, - java.lang.Object x) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetObject​(java.lang.String parameterName, - java.lang.Object x, - int targetSqlType) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetObject​(java.lang.String parameterName, - java.lang.Object x, - int targetSqlType, - int scale) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetObject​(java.lang.String parameterName, - java.lang.Object x, - java.sql.SQLType targetSqlType) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetObject​(java.lang.String parameterName, - java.lang.Object x, - java.sql.SQLType targetSqlType, - int scaleOrLength) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetRowId​(java.lang.String parameterName, - java.sql.RowId x) -
      Sets the designated parameter to the given java.sql.RowId object.
      -
      voidsetShort​(java.lang.String parameterName, - short x) -
      Sets the designated parameter to the given Java short value.
      -
      voidsetSQLXML​(java.lang.String parameterName, - java.sql.SQLXML xmlObject) -
      Sets the designated parameter to the given java.sql.SQLXML object.
      -
      voidsetString​(java.lang.String parameterName, - java.lang.String x) -
      Sets the designated parameter to the given Java String value.
      -
      voidsetTime​(java.lang.String parameterName, - java.sql.Time x) -
      Sets the designated parameter to the given java.sql.Time value.
      -
      voidsetTime​(java.lang.String parameterName, - java.sql.Time x, - java.util.Calendar cal) -
      Sets the designated parameter to the given java.sql.Time value, - using the given Calendar object.
      -
      voidsetTimestamp​(java.lang.String parameterName, - java.sql.Timestamp x) -
      Sets the designated parameter to the given java.sql.Timestamp value.
      -
      voidsetTimestamp​(java.lang.String parameterName, - java.sql.Timestamp x, - java.util.Calendar cal) -
      Sets the designated parameter to the given java.sql.Timestamp value, - using the given Calendar object.
      -
      voidsetURL​(java.lang.String parameterName, - java.net.URL val) -
      Sets the designated parameter to the given java.net.URL object.
      -
      booleanwasNull() -
      Retrieves whether the last OUT parameter read had the value of - SQL NULL.
      -
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.sql.PreparedStatement

        -addBatch, clearParameters, execute, executeLargeUpdate, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
      • -
      -
        -
      • - - -

        Methods inherited from interface java.sql.Statement

        -addBatch, cancel, clearBatch, clearWarnings, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
      • -
      -
        -
      • - - -

        Methods inherited from interface java.sql.Wrapper

        -isWrapperFor, unwrap
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCCallableStatement

        -
        public JDBCCallableStatement​(JDBCConnection c,
        -                             java.lang.String sql,
        -                             int resultSetType,
        -                             int resultSetConcurrency,
        -                             int resultSetHoldability)
        -                      throws org.hsqldb.HsqlException,
        -                             java.sql.SQLException
        -
        Constructs a new JDBCCallableStatement with the specified connection and - result type.
        -
        -
        Parameters:
        -
        c - the connection on which this statement will execute
        -
        sql - the SQL statement this object represents
        -
        resultSetType - the type of result this statement will produce
        -
        resultSetConcurrency - (updatability)
        -
        resultSetHoldability - (validity beyond commit)
        -
        Throws:
        -
        org.hsqldb.HsqlException - if the statement is not accepted by the database
        -
        java.sql.SQLException - if preprocessing by driver fails
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(int parameterIndex,
        -                                 int sqlType)
        -                          throws java.sql.SQLException
        -
        - - Registers the OUT parameter in ordinal position - parameterIndex to the JDBC type - sqlType. All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - If the JDBC type expected to be returned to this output parameter - is specific to this particular database, sqlType - should be java.sql.Types.OTHER. The method - getObject(int) retrieves the value. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature. This method can be called after a - PrepareCall method. HSQLDB has already determined which parameters are - OUT or INOUT parameters, therefore this method only checks and - throws an exception if the parameter is not of the correct form. - The data type argument is ignored

        - - The get method to read the value of the parameter is - determined by the engine based on the data type of the parameter. - - Furthermore, HSQLDB supports multiple OUT and INOUT parameters for - stored procedures.

        -

        -
        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        sqlType - the JDBC type code defined by java.sql.Types. - If the parameter is of JDBC type NUMERIC - or DECIMAL, the version of - registerOutParameter that accepts a scale value - should be used.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1 [if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet()
        -                                throws java.sql.SQLException
        -
        Description copied from class: JDBCPreparedStatement
        -
        - Retrieves the current result as a ResultSet object. - This method should be called only once per result. - - - -
        -

        HSQLDB-Specific Information:

        - - Without an interceding call to executeXXX, each invocation of this - method will produce a new, initialized ResultSet instance referring to - the current result, if any. -

        -
        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Statement
        -
        Overrides:
        -
        getResultSet in class JDBCPreparedStatement
        -
        Returns:
        -
        the current result as a ResultSet object or - null if the result is an update count or there are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        JDBCPreparedStatement.execute()
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(int parameterIndex,
        -                                 int sqlType,
        -                                 int scale)
        -                          throws java.sql.SQLException
        -
        - - Registers the parameter in ordinal position - parameterIndex to be of JDBC type - sqlType. (JDBC4 clarification:) All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - This version of registerOutParameter should be - used when the parameter is of JDBC type NUMERIC - or DECIMAL. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        sqlType - the SQL type code defined by java.sql.Types.
        -
        scale - the desired number of digits to the right of the - decimal point. It must be greater than or equal to zero.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        wasNull

        -
        public boolean wasNull()
        -                throws java.sql.SQLException
        -
        - - Retrieves whether the last OUT parameter read had the value of - SQL NULL. Note that this method should be called only after - calling a getter method; otherwise, there is no value to use in - determining whether it is null or not. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        wasNull in interface java.sql.CallableStatement
        -
        Returns:
        -
        true if the last parameter read was SQL - NULL; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(int parameterIndex)
        -                           throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC CHAR, - VARCHAR, or LONGVARCHAR parameter as a - String in the Java programming language. -

        - For the fixed-length type JDBC CHAR, - the String object - returned has exactly the same value the (JDBC4 clarification:) SQL - CHAR value had in the - database, including any padding added by the database. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getString in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, - the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setString(java.lang.String, java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean​(int parameterIndex)
        -                   throws java.sql.SQLException
        -
        - - (JDBC4 modified:) - Retrieves the value of the designated JDBC BIT - or BOOLEAN parameter as a - boolean in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBoolean in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, - the result is false.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setBoolean(java.lang.String, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        getByte

        -
        public byte getByte​(int parameterIndex)
        -             throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC TINYINT parameter - as a byte in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getByte in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setByte(java.lang.String, byte)
        -
        -
      • -
      - - - -
        -
      • -

        getShort

        -
        public short getShort​(int parameterIndex)
        -               throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC SMALLINT parameter - as a short in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getShort in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setShort(java.lang.String, short)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt​(int parameterIndex)
        -           throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC INTEGER parameter - as an int in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getInt in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setInt(java.lang.String, int)
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong​(int parameterIndex)
        -             throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC BIGINT parameter - as a long in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getLong in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setLong(java.lang.String, long)
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat​(int parameterIndex)
        -               throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC FLOAT parameter - as a float in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getFloat in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setFloat(java.lang.String, float)
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble​(int parameterIndex)
        -                 throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC DOUBLE parameter as a double - in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getDouble in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setDouble(java.lang.String, double)
        -
        -
      • -
      - - - -
        -
      • -

        getBigDecimal

        -
        @Deprecated
        -public java.math.BigDecimal getBigDecimal​(int parameterIndex,
        -                                          int scale)
        -                                   throws java.sql.SQLException
        -
        Deprecated. -
        use getBigDecimal(int parameterIndex) - or getBigDecimal(String parameterName)
        -
        -
        - - Retrieves the value of the designated JDBC NUMERIC parameter as a - java.math.BigDecimal object with scale digits to - the right of the decimal point. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBigDecimal in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        scale - the number of digits to the right of the decimal point
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        See Also:
        -
        setBigDecimal(java.lang.String, java.math.BigDecimal)
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes​(int parameterIndex)
        -                throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC BINARY or - VARBINARY parameter as an array of byte - values in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setBytes(java.lang.String, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(int parameterIndex)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC DATE parameter as a - java.sql.Date object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setDate(java.lang.String, java.sql.Date)
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(int parameterIndex)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC TIME parameter as a - java.sql.Time object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setTime(java.lang.String, java.sql.Time)
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(int parameterIndex)
        -                                throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC TIMESTAMP - parameter as a java.sql.Timestamp object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        setTimestamp(java.lang.String, java.sql.Timestamp)
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(int parameterIndex)
        -                           throws java.sql.SQLException
        -
        - - Retrieves the value of the designated parameter as an Object - in the Java programming language. If the value is an SQL NULL, - the driver returns a Java null. -

        - This method returns a Java object whose type corresponds to the JDBC - type that was registered for this parameter using the method - registerOutParameter. By registering the target JDBC - type as java.sql.Types.OTHER, this method can be used - to read database-specific abstract data types. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        A java.lang.Object holding the OUT parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        See Also:
        -
        Types, -setObject(java.lang.String, java.lang.Object, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        getBigDecimal

        -
        public java.math.BigDecimal getBigDecimal​(int parameterIndex)
        -                                   throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC NUMERIC parameter as a - java.math.BigDecimal object with as many digits to the - right of the decimal point as the value contains. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBigDecimal in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value in full precision. If the value is - SQL NULL, the result is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setBigDecimal(java.lang.String, java.math.BigDecimal)
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(int parameterIndex,
        -                                  java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                           throws java.sql.SQLException
        -
        - - Returns an object representing the value of OUT parameter - parameterIndex and uses map for the custom - mapping of the parameter value. -

        - This method returns a Java object whose type corresponds to the - JDBC type that was registered for this parameter using the method - registerOutParameter. By registering the target - JDBC type as java.sql.Types.OTHER, this method can - be used to read database-specific abstract data types. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, and so on
        -
        map - the mapping from SQL type names to Java classes
        -
        Returns:
        -
        a java.lang.Object holding the OUT parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setObject(java.lang.String, java.lang.Object, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        getRef

        -
        public java.sql.Ref getRef​(int parameterIndex)
        -                    throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC REF(<structured-type>) - parameter as a Ref object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getRef in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        Returns:
        -
        the parameter value as a Ref object in the - Java programming language. If the value was SQL NULL, the value - null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBlob

        -
        public java.sql.Blob getBlob​(int parameterIndex)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC BLOB parameter as a - Blob object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBlob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, and so on
        -
        Returns:
        -
        the parameter value as a Blob object in the - Java programming language. If the value was SQL NULL, the value - null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getClob

        -
        public java.sql.Clob getClob​(int parameterIndex)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC CLOB parameter as a - java.sql.Clob object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, and - so on
        -
        Returns:
        -
        the parameter value as a Clob object in the - Java programming language. If the value was SQL NULL, the - value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.sql.Array getArray​(int parameterIndex)
        -                        throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC ARRAY parameter as an - Array object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, and - so on
        -
        Returns:
        -
        the parameter value as an Array object in - the Java programming language. If the value was SQL NULL, the - value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(int parameterIndex,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC DATE parameter as a - java.sql.Date object, using - the given Calendar object - to construct the date. - With a Calendar object, the driver - can calculate the date taking into account a custom timezone and locale. - If no Calendar object is specified, the driver uses the - default timezone and locale. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        cal - the Calendar object the driver will use - to construct the date
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setDate(java.lang.String, java.sql.Date)
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(int parameterIndex,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC TIME parameter as a - java.sql.Time object, using - the given Calendar object - to construct the time. - With a Calendar object, the driver - can calculate the time taking into account a custom timezone and locale. - If no Calendar object is specified, the driver uses the - default timezone and locale. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        cal - the Calendar object the driver will use - to construct the time
        -
        Returns:
        -
        the parameter value; if the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setTime(java.lang.String, java.sql.Time)
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(int parameterIndex,
        -                                       java.util.Calendar cal)
        -                                throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC TIMESTAMP parameter as a - java.sql.Timestamp object, using - the given Calendar object to construct - the Timestamp object. - With a Calendar object, the driver - can calculate the timestamp taking into account a custom timezone and locale. - If no Calendar object is specified, the driver uses the - default timezone and locale. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        cal - the Calendar object the driver will use - to construct the timestamp
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setTimestamp(java.lang.String, java.sql.Timestamp)
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(int parameterIndex,
        -                                 int sqlType,
        -                                 java.lang.String typeName)
        -                          throws java.sql.SQLException
        -
        - - Registers the designated output parameter. - This version of - the method registerOutParameter - should be used for a user-defined or REF output parameter. Examples - of user-defined types include: STRUCT, DISTINCT, - JAVA_OBJECT, and named array types. -

        - All OUT parameters must be registered - before a stored procedure is executed. -

        For a user-defined parameter, the fully-qualified SQL - type name of the parameter should also be given, while a REF - parameter requires that the fully-qualified type name of the - referenced type be given. A JDBC driver that does not need the - type code and type name information may ignore it. To be portable, - however, applications should always provide these values for - user-defined and REF parameters. - - Although it is intended for user-defined and REF parameters, - this method may be used to register a parameter of any JDBC type. - If the parameter does not have a user-defined or REF type, the - typeName parameter is ignored. - -

        Note: When reading the value of an out parameter, you - must use the getter method whose Java type corresponds to the - parameter's registered SQL type. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2,...
        -
        sqlType - a value from Types
        -
        typeName - the fully-qualified name of an SQL structured type
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(java.lang.String parameterName,
        -                                 int sqlType)
        -                          throws java.sql.SQLException
        -
        - - Registers the OUT parameter named - parameterName to the JDBC type - sqlType. All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - If the JDBC type expected to be returned to this output parameter - is specific to this particular database, sqlType - should be java.sql.Types.OTHER. The method - getObject(int) retrieves the value. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - the JDBC type code defined by java.sql.Types. - If the parameter is of JDBC type NUMERIC - or DECIMAL, the version of - registerOutParameter that accepts a scale value - should be used.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 41.[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type or if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQL 1.7.0
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(java.lang.String parameterName,
        -                                 int sqlType,
        -                                 int scale)
        -                          throws java.sql.SQLException
        -
        - - Registers the parameter named - parameterName to be of JDBC type - sqlType. (JDBC4 clarification:) All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - This version of registerOutParameter should be - used when the parameter is of JDBC type NUMERIC - or DECIMAL. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - SQL type code defined by java.sql.Types.
        -
        scale - the desired number of digits to the right of the - decimal point. It must be greater than or equal to zero.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 41.[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type or if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(java.lang.String parameterName,
        -                                 int sqlType,
        -                                 java.lang.String typeName)
        -                          throws java.sql.SQLException
        -
        - - Registers the designated output parameter. This version of - the method registerOutParameter - should be used for a user-named or REF output parameter. Examples - of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and - named array types. -

        - (JDBC4 clarification:)

        - All OUT parameters must be registered - before a stored procedure is executed. -

        - For a user-named parameter the fully-qualified SQL - type name of the parameter should also be given, while a REF - parameter requires that the fully-qualified type name of the - referenced type be given. A JDBC driver that does not need the - type code and type name information may ignore it. To be portable, - however, applications should always provide these values for - user-named and REF parameters. - - Although it is intended for user-named and REF parameters, - this method may be used to register a parameter of any JDBC type. - If the parameter does not have a user-named or REF type, the - typeName parameter is ignored. - -

        Note: When reading the value of an out parameter, you - must use the getXXX method whose Java type XXX corresponds to the - parameter's registered SQL type. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - a value from Types
        -
        typeName - the fully-qualified name of an SQL structured type
        -
        Throws:
        -
        java.sql.SQLException - JDBC 41.[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type or if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQL 1.7.0
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.net.URL getURL​(int parameterIndex)
        -                    throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC DATALINK parameter as a - java.net.URL object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getURL in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2,...
        -
        Returns:
        -
        a java.net.URL object that represents the - JDBC DATALINK value used as the designated - parameter
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs, - this method is called on a closed CallableStatement, - or if the URL being returned is - not a valid URL on the Java platform
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setURL(java.lang.String, java.net.URL)
        -
        -
      • -
      - - - -
        -
      • -

        setURL

        -
        public void setURL​(java.lang.String parameterName,
        -                   java.net.URL val)
        -            throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.net.URL object. - The driver converts this to an SQL DATALINK value when - it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        setURL in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        val - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs, - this method is called on a closed CallableStatement, - or if a URL is malformed
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getURL(int)
        -
        -
      • -
      - - - -
        -
      • -

        setNull

        -
        public void setNull​(java.lang.String parameterName,
        -                    int sqlType)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to SQL NULL. - -

        Note: You must specify the parameter's SQL type. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setNull in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - the SQL type code defined in java.sql.Types
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        setBoolean

        -
        public void setBoolean​(java.lang.String parameterName,
        -                       boolean x)
        -                throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java boolean value. - -

        (JDBC4 clarification:)

        - - The driver converts this - to an SQL BIT or BOOLEAN value when it sends it to the database. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setBoolean in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getBoolean(int), -getBoolean(int)
        -
        -
      • -
      - - - -
        -
      • -

        setByte

        -
        public void setByte​(java.lang.String parameterName,
        -                    byte x)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java byte value. - The driver converts this - to an SQL TINYINT value when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setByte in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getByte(int)
        -
        -
      • -
      - - - -
        -
      • -

        setShort

        -
        public void setShort​(java.lang.String parameterName,
        -                     short x)
        -              throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java short value. - The driver converts this - to an SQL SMALLINT value when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setShort in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getShort(int)
        -
        -
      • -
      - - - -
        -
      • -

        setInt

        -
        public void setInt​(java.lang.String parameterName,
        -                   int x)
        -            throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java int value. - The driver converts this - to an SQL INTEGER value when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setInt in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getInt(int)
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong​(java.lang.String parameterName,
        -                    long x)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java long value. - The driver converts this - to an SQL BIGINT value when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setLong in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getLong(int)
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        public void setFloat​(java.lang.String parameterName,
        -                     float x)
        -              throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java float value. - The driver converts this - to an SQL FLOAT value when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setFloat in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getFloat(int)
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble​(java.lang.String parameterName,
        -                      double x)
        -               throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java double value. - The driver converts this - to an SQL DOUBLE value when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setDouble in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getDouble(int)
        -
        -
      • -
      - - - -
        -
      • -

        setBigDecimal

        -
        public void setBigDecimal​(java.lang.String parameterName,
        -                          java.math.BigDecimal x)
        -                   throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given - java.math.BigDecimal value. - The driver converts this to an SQL NUMERIC value when - it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setBigDecimal in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getBigDecimal(int, int)
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public void setString​(java.lang.String parameterName,
        -                      java.lang.String x)
        -               throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java String value. - The driver converts this - to an SQL VARCHAR or LONGVARCHAR value - (depending on the argument's - size relative to the driver's limits on VARCHAR values) - when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setString in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getString(int)
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public void setBytes​(java.lang.String parameterName,
        -                     byte[] x)
        -              throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Java array of bytes. - The driver converts this to an SQL VARBINARY or - LONGVARBINARY (depending on the argument's size relative - to the driver's limits on VARBINARY values) when it sends - it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getBytes(int)
        -
        -
      • -
      - - - -
        -
      • -

        setDate

        -
        public void setDate​(java.lang.String parameterName,
        -                    java.sql.Date x)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.sql.Date value - (JDBC4 clarification:)

        - using the default time zone of the virtual machine that is running - the application. - The driver converts this - to an SQL DATE value when it sends it to the database. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setDate in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getDate(int)
        -
        -
      • -
      - - - -
        -
      • -

        setTime

        -
        public void setTime​(java.lang.String parameterName,
        -                    java.sql.Time x)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.sql.Time value. - The driver converts this - to an SQL TIME value when it sends it to the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setTime in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getTime(int)
        -
        -
      • -
      - - - -
        -
      • -

        setTimestamp

        -
        public void setTimestamp​(java.lang.String parameterName,
        -                         java.sql.Timestamp x)
        -                  throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.sql.Timestamp value. - The driver - converts this to an SQL TIMESTAMP value when it sends it to the - database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setTimestamp in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getTimestamp(int)
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public void setAsciiStream​(java.lang.String parameterName,
        -                           java.io.InputStream x,
        -                           int length)
        -                    throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the Java input stream that contains the ASCII parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public void setBinaryStream​(java.lang.String parameterName,
        -                            java.io.InputStream x,
        -                            int length)
        -                     throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large binary value is input to a LONGVARBINARY - parameter, it may be more practical to send it via a - java.io.InputStream object. The data will be read from the stream - as needed until end-of-file is reached. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the java input stream which contains the binary parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(java.lang.String parameterName,
        -                      java.lang.Object x,
        -                      int targetSqlType,
        -                      int scale)
        -               throws java.sql.SQLException
        -
        - - Sets the value of the designated parameter with the given object. The second - argument must be an object type; for integral values, the - java.lang equivalent objects should be used. - -

        The given Java object will be converted to the given targetSqlType - before being sent to the database. - - If the object has a custom mapping (is of a class implementing the - interface SQLData), - the JDBC driver should call the method SQLData.writeSQL to write it - to the SQL data stream. - If, on the other hand, the object is of a class implementing - Ref, Blob, Clob, NClob, - Struct, java.net.URL, - or Array, the driver should pass it to the database as a - value of the corresponding SQL type. -

        - Note that this method may be used to pass database- - specific abstract data types. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type (as defined in java.sql.Types) to be - sent to the database. The scale argument may further qualify this type.
        -
        scale - for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, - this is the number of digits after the decimal point. For all other - types, this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if targetSqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        Types, -getObject(int)
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(java.lang.String parameterName,
        -                      java.lang.Object x,
        -                      int targetSqlType)
        -               throws java.sql.SQLException
        -
        - - Sets the value of the designated parameter with the given object. - This method is like the method setObject - above, except that it assumes a scale of zero. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type (as defined in java.sql.Types) to be - sent to the database
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if targetSqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getObject(int)
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(java.lang.String parameterName,
        -                      java.lang.Object x)
        -               throws java.sql.SQLException
        -
        - - Sets the value of the designated parameter with the given object. - The second parameter must be of type Object; therefore, the - java.lang equivalent objects should be used for built-in types. - -

        The JDBC specification specifies a standard mapping from - Java Object types to SQL types. The given argument - will be converted to the corresponding SQL type before being - sent to the database. - -

        Note that this method may be used to pass datatabase- - specific abstract data types, by using a driver-specific Java - type. - - If the object is of a class implementing the interface SQLData, - the JDBC driver should call the method SQLData.writeSQL - to write it to the SQL data stream. - If, on the other hand, the object is of a class implementing - Ref, Blob, Clob, NClob, - Struct, java.net.URL, - or Array, the driver should pass it to the database as a - value of the corresponding SQL type. -

        - This method throws an exception if there is an ambiguity, for example, if the - object is of a class implementing more than one of the interfaces named above. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the object containing the input parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs, - this method is called on a closed CallableStatement or if the given - Object parameter is ambiguous
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getObject(int)
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public void setCharacterStream​(java.lang.String parameterName,
        -                               java.io.Reader reader,
        -                               int length)
        -                        throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        reader - the java.io.Reader object that - contains the UNICODE data used as the designated parameter
        -
        length - the number of characters in the stream
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        setDate

        -
        public void setDate​(java.lang.String parameterName,
        -                    java.sql.Date x,
        -                    java.util.Calendar cal)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.sql.Date value, - using the given Calendar object. The driver uses - the Calendar object to construct an SQL DATE value, - which the driver then sends to the database. With a - a Calendar object, the driver can calculate the date - taking into account a custom timezone. If no - Calendar object is specified, the driver uses the default - timezone, which is that of the virtual machine running the application. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setDate in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        cal - the Calendar object the driver will use - to construct the date
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getDate(int)
        -
        -
      • -
      - - - -
        -
      • -

        setTime

        -
        public void setTime​(java.lang.String parameterName,
        -                    java.sql.Time x,
        -                    java.util.Calendar cal)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.sql.Time value, - using the given Calendar object. The driver uses - the Calendar object to construct an SQL TIME value, - which the driver then sends to the database. With a - a Calendar object, the driver can calculate the time - taking into account a custom timezone. If no - Calendar object is specified, the driver uses the default - timezone, which is that of the virtual machine running the application. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setTime in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        cal - the Calendar object the driver will use - to construct the time
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getTime(int)
        -
        -
      • -
      - - - -
        -
      • -

        setTimestamp

        -
        public void setTimestamp​(java.lang.String parameterName,
        -                         java.sql.Timestamp x,
        -                         java.util.Calendar cal)
        -                  throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.sql.Timestamp value, - using the given Calendar object. The driver uses - the Calendar object to construct an SQL TIMESTAMP value, - which the driver then sends to the database. With a - a Calendar object, the driver can calculate the timestamp - taking into account a custom timezone. If no - Calendar object is specified, the driver uses the default - timezone, which is that of the virtual machine running the application. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        setTimestamp in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        cal - the Calendar object the driver will use - to construct the timestamp
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        getTimestamp(int)
        -
        -
      • -
      - - - -
        -
      • -

        setNull

        -
        public void setNull​(java.lang.String parameterName,
        -                    int sqlType,
        -                    java.lang.String typeName)
        -             throws java.sql.SQLException
        -
        - - Sets the designated parameter to SQL NULL. - This version of the method setNull should - be used for user-defined types and REF type parameters. Examples - of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and - named array types. - -

        Note: To be portable, applications must give the - SQL type code and the fully-qualified SQL type name when specifying - a NULL user-defined or REF parameter. In the case of a user-defined type - the name is the type name of the parameter itself. For a REF - parameter, the name is the type name of the referenced type. If - a JDBC driver does not need the type code or type name information, - it may ignore it. - - Although it is intended for user-defined and Ref parameters, - this method may be used to set a null parameter of any JDBC type. - If the parameter does not have a user-defined or REF type, the given - typeName is ignored. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        setNull in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - a value from java.sql.Types
        -
        typeName - the fully-qualified name of an SQL user-defined type; - ignored if the parameter is not a user-defined type or - SQL REF value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String parameterName)
        -                           throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC CHAR, VARCHAR, - or LONGVARCHAR parameter as a String in - the Java programming language. -

        - For the fixed-length type JDBC CHAR, - the String object - returned has exactly the same value the (JDBC4 clarification:) SQL - CHAR value had in the - database, including any padding added by the database. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getString in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setString(java.lang.String, java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean​(java.lang.String parameterName)
        -                   throws java.sql.SQLException
        -
        - - (JDBC4 modified:)

        - Retrieves the value of a JDBC BIT or BOOLEAN - parameter as a - boolean in the Java programming language. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBoolean in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is false.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setBoolean(java.lang.String, boolean)
        -
        -
      • -
      - - - -
        -
      • -

        getByte

        -
        public byte getByte​(java.lang.String parameterName)
        -             throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC TINYINT parameter as a byte - in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getByte in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setByte(java.lang.String, byte)
        -
        -
      • -
      - - - -
        -
      • -

        getShort

        -
        public short getShort​(java.lang.String parameterName)
        -               throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC SMALLINT parameter as a short - in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getShort in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setShort(java.lang.String, short)
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt​(java.lang.String parameterName)
        -           throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC INTEGER parameter as an int - in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getInt in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, - the result is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setInt(java.lang.String, int)
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong​(java.lang.String parameterName)
        -             throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC BIGINT parameter as a long - in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getLong in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, - the result is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setLong(java.lang.String, long)
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat​(java.lang.String parameterName)
        -               throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC FLOAT parameter as a float - in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getFloat in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, - the result is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setFloat(java.lang.String, float)
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble​(java.lang.String parameterName)
        -                 throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC DOUBLE parameter as a double - in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getDouble in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, - the result is 0.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setDouble(java.lang.String, double)
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes​(java.lang.String parameterName)
        -                throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC BINARY or VARBINARY - parameter as an array of byte values in the Java - programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result is - null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setBytes(java.lang.String, byte[])
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(java.lang.String parameterName)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC DATE parameter as a - java.sql.Date object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setDate(java.lang.String, java.sql.Date)
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(java.lang.String parameterName)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC TIME parameter as a - java.sql.Time object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setTime(java.lang.String, java.sql.Time)
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(java.lang.String parameterName)
        -                                throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC TIMESTAMP parameter as a - java.sql.Timestamp object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result - is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setTimestamp(java.lang.String, java.sql.Timestamp)
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(java.lang.String parameterName)
        -                           throws java.sql.SQLException
        -
        - - Retrieves the value of a parameter as an Object in the Java - programming language. If the value is an SQL NULL, the - driver returns a Java null. -

        - This method returns a Java object whose type corresponds to the JDBC - type that was registered for this parameter using the method - registerOutParameter. By registering the target JDBC - type as java.sql.Types.OTHER, this method can be used - to read database-specific abstract data types. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        A java.lang.Object holding the OUT parameter value.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        Types, -setObject(java.lang.String, java.lang.Object, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        getBigDecimal

        -
        public java.math.BigDecimal getBigDecimal​(java.lang.String parameterName)
        -                                   throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC NUMERIC parameter as a - java.math.BigDecimal object with as many digits to the - right of the decimal point as the value contains. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBigDecimal in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value in full precision. If the value is - SQL NULL, the result is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setBigDecimal(java.lang.String, java.math.BigDecimal)
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(java.lang.String parameterName,
        -                                  java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                           throws java.sql.SQLException
        -
        - - Returns an object representing the value of OUT parameter - parameterName and uses map for the custom - mapping of the parameter value. -

        - This method returns a Java object whose type corresponds to the - JDBC type that was registered for this parameter using the method - registerOutParameter. By registering the target - JDBC type as java.sql.Types.OTHER, this method can - be used to read database-specific abstract data types. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        map - the mapping from SQL type names to Java classes
        -
        Returns:
        -
        a java.lang.Object holding the OUT parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setObject(java.lang.String, java.lang.Object, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        getRef

        -
        public java.sql.Ref getRef​(java.lang.String parameterName)
        -                    throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC REF(<structured-type>) - parameter as a Ref object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getRef in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value as a Ref object in the - Java programming language. If the value was SQL NULL, - the value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getBlob

        -
        public java.sql.Blob getBlob​(java.lang.String parameterName)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC BLOB parameter as a - Blob object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getBlob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value as a Blob object in the - Java programming language. If the value was SQL NULL, - the value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getClob

        -
        public java.sql.Clob getClob​(java.lang.String parameterName)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC CLOB parameter as a - Clob object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value as a Clob object in the - Java programming language. If the value was SQL NULL, - the value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.sql.Array getArray​(java.lang.String parameterName)
        -                        throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC ARRAY parameter as an - Array object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value as an Array object in - Java programming language. If the value was SQL NULL, - the value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(java.lang.String parameterName,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC DATE parameter as a - java.sql.Date object, using - the given Calendar object - to construct the date. - With a Calendar object, the driver - can calculate the date taking into account a custom timezone and locale. - If no Calendar object is specified, the driver uses the - default timezone and locale. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        cal - the Calendar object the driver will use - to construct the date
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, - the result is null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setDate(java.lang.String, java.sql.Date)
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(java.lang.String parameterName,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC TIME parameter as a - java.sql.Time object, using - the given Calendar object - to construct the time. - With a Calendar object, the driver - can calculate the time taking into account a custom timezone and locale. - If no Calendar object is specified, the driver uses the - default timezone and locale. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        cal - the Calendar object the driver will use - to construct the time
        -
        Returns:
        -
        the parameter value; if the value is SQL NULL, the result is - null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setTime(java.lang.String, java.sql.Time)
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(java.lang.String parameterName,
        -                                       java.util.Calendar cal)
        -                                throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC TIMESTAMP parameter as a - java.sql.Timestamp object, using - the given Calendar object to construct - the Timestamp object. - With a Calendar object, the driver - can calculate the timestamp taking into account a custom timezone and locale. - If no Calendar object is specified, the driver uses the - default timezone and locale. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        cal - the Calendar object the driver will use - to construct the timestamp
        -
        Returns:
        -
        the parameter value. If the value is SQL NULL, the result is - null.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setTimestamp(java.lang.String, java.sql.Timestamp)
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.net.URL getURL​(java.lang.String parameterName)
        -                    throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC DATALINK parameter as a - java.net.URL object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getURL in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value as a java.net.URL object in the - Java programming language. If the value was SQL NULL, the - value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs, - this method is called on a closed CallableStatement, - or if there is a problem with the URL
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        See Also:
        -
        setURL(java.lang.String, java.net.URL)
        -
        -
      • -
      - - - -
        -
      • -

        getRowId

        -
        public java.sql.RowId getRowId​(int parameterIndex)
        -                        throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC ROWID parameter as a - java.sql.RowId object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getRowId in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2,...
        -
        Returns:
        -
        a RowId object that represents the JDBC ROWID - value is used as the designated parameter. If the parameter contains - a SQL NULL, then a null value is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[ if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getRowId

        -
        public java.sql.RowId getRowId​(java.lang.String parameterName)
        -                        throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC ROWID parameter as a - java.sql.RowId object. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getRowId in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        a RowId object that represents the JDBC ROWID - value is used as the designated parameter. If the parameter contains - a SQL NULL, then a null value is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setRowId

        -
        public void setRowId​(java.lang.String parameterName,
        -                     java.sql.RowId x)
        -              throws java.sql.SQLException
        -
        - - Sets the designated parameter to the given java.sql.RowId object. The - driver converts this to a SQL ROWID when it sends it to the - database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        setRowId in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNString

        -
        public void setNString​(java.lang.String parameterName,
        -                       java.lang.String value)
        -                throws java.sql.SQLException
        -
        Sets the designated parameter to the given String object. - The driver converts this to a SQL NCHAR or - NVARCHAR or LONGNVARCHAR
        -
        -
        Specified by:
        -
        setNString in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter to be set
        -
        value - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNCharacterStream

        -
        public void setNCharacterStream​(java.lang.String parameterName,
        -                                java.io.Reader value,
        -                                long length)
        -                         throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The - Reader reads the data till end-of-file is reached. The - driver does the necessary conversion from Java character format to - the national character set in the database.
        -
        -
        Specified by:
        -
        setNCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter to be set
        -
        value - the parameter value
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNClob

        -
        public void setNClob​(java.lang.String parameterName,
        -                     java.sql.NClob value)
        -              throws java.sql.SQLException
        -
        Sets the designated parameter to a java.sql.NClob object. The object - implements the java.sql.NClob interface. This NClob - object maps to a SQL NCLOB.
        -
        -
        Specified by:
        -
        setNClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter to be set
        -
        value - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setClob

        -
        public void setClob​(java.lang.String parameterName,
        -                    java.io.Reader reader,
        -                    long length)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The reader must contain the number - of characters specified by length otherwise a SQLException will be - generated when the CallableStatement is executed. - This method differs from the setCharacterStream (int, Reader, int) method - because it informs the driver that the parameter value should be sent to - the server as a CLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARCHAR or a CLOB
        -
        -
        Specified by:
        -
        setClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter to be set
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if the length specified is less than zero; - a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setBlob

        -
        public void setBlob​(java.lang.String parameterName,
        -                    java.io.InputStream inputStream,
        -                    long length)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a InputStream object. The inputstream must contain the number - of characters specified by length, otherwise a SQLException will be - generated when the CallableStatement is executed. - This method differs from the setBinaryStream (int, InputStream, int) - method because it informs the driver that the parameter value should be - sent to the server as a BLOB. When the setBinaryStream method is used, - the driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARBINARY or a BLOB
        -
        -
        Specified by:
        -
        setBlob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter to be set - the second is 2, ...
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        length - the number of bytes in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if the length specified - is less than zero; if the number of bytes in the input stream does not match - the specified length; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNClob

        -
        public void setNClob​(java.lang.String parameterName,
        -                     java.io.Reader reader,
        -                     long length)
        -              throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The reader must contain the number - of characters specified by length otherwise a SQLException will be - generated when the CallableStatement is executed. - This method differs from the setCharacterStream (int, Reader, int) method - because it informs the driver that the parameter value should be sent to - the server as a NCLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGNVARCHAR or a NCLOB
        -
        -
        Specified by:
        -
        setNClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter to be set
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if the length specified is less than zero; - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNClob

        -
        public java.sql.NClob getNClob​(int parameterIndex)
        -                        throws java.sql.SQLException
        -
        - - Retrieves the value of the designated JDBC NCLOB parameter as a - java.sql.NClob object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getNClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, and - so on
        -
        Returns:
        -
        the parameter value as a NClob object in the - Java programming language. If the value was SQL NULL, the - value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNClob

        -
        public java.sql.NClob getNClob​(java.lang.String parameterName)
        -                        throws java.sql.SQLException
        -
        - - Retrieves the value of a JDBC NCLOB parameter as a - java.sql.NClob object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getNClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        the parameter value as a NClob object in the - Java programming language. If the value was SQL NULL, - the value null is returned.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setSQLXML

        -
        public void setSQLXML​(java.lang.String parameterName,
        -                      java.sql.SQLXML xmlObject)
        -               throws java.sql.SQLException
        -
        Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - SQL XML value when it sends it to the database.
        -
        -
        Specified by:
        -
        setSQLXML in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        xmlObject - a SQLXML object that maps an SQL XML value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs; - this method is called on a closed CallableStatement or - the java.xml.transform.Result, - Writer or OutputStream has not been closed for the SQLXML object
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getSQLXML

        -
        public java.sql.SQLXML getSQLXML​(int parameterIndex)
        -                          throws java.sql.SQLException
        -
        - - Retrieves the value of the designated SQL XML parameter as a - java.sql.SQLXML object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getSQLXML in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        a SQLXML object that maps an SQL XML value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getSQLXML

        -
        public java.sql.SQLXML getSQLXML​(java.lang.String parameterName)
        -                          throws java.sql.SQLException
        -
        - - Retrieves the value of the designated SQL XML parameter as a - java.sql.SQLXML object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getSQLXML in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        a SQLXML object that maps an SQL XML value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNString

        -
        public java.lang.String getNString​(int parameterIndex)
        -                            throws java.sql.SQLException
        -
        - - Retrieves the value of the designated NCHAR, - NVARCHAR - or LONGNVARCHAR parameter as - a String in the Java programming language. -

        - For the fixed-length type JDBC NCHAR, - the String object - returned has exactly the same value the SQL - NCHAR value had in the - database, including any padding added by the database. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getNString in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        a String object that maps an - NCHAR, NVARCHAR or LONGNVARCHAR value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        See Also:
        -
        setNString(java.lang.String, java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        getNString

        -
        public java.lang.String getNString​(java.lang.String parameterName)
        -                            throws java.sql.SQLException
        -
        - - Retrieves the value of the designated NCHAR, - NVARCHAR - or LONGNVARCHAR parameter as - a String in the Java programming language. -

        - For the fixed-length type JDBC NCHAR, - the String object - returned has exactly the same value the SQL - NCHAR value had in the - database, including any padding added by the database. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getNString in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        a String object that maps an - NCHAR, NVARCHAR or LONGNVARCHAR value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        See Also:
        -
        setNString(java.lang.String, java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        getNCharacterStream

        -
        public java.io.Reader getNCharacterStream​(int parameterIndex)
        -                                   throws java.sql.SQLException
        -
        - - Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language. - It is intended for use when - accessing NCHAR,NVARCHAR - and LONGNVARCHAR parameters. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getNCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        a java.io.Reader object that contains the parameter - value; if the value is SQL NULL, the value returned is - null in the Java programming language.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNCharacterStream

        -
        public java.io.Reader getNCharacterStream​(java.lang.String parameterName)
        -                                   throws java.sql.SQLException
        -
        - - Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language. - It is intended for use when - accessing NCHAR,NVARCHAR - and LONGNVARCHAR parameters. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getNCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        a java.io.Reader object that contains the parameter - value; if the value is SQL NULL, the value returned is - null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream​(int parameterIndex)
        -                                  throws java.sql.SQLException
        -
        - - Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature.

        - - Calling this method always throws an SQLException. -

        -
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        a java.io.Reader object that contains the parameter - value; if the value is SQL NULL, the value returned is - null in the Java programming language.
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if the parameterIndex is not valid;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream​(java.lang.String parameterName)
        -                                  throws java.sql.SQLException
        -
        - - Retrieves the value of the designated parameter as a - java.io.Reader object in the Java programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        Returns:
        -
        a java.io.Reader object that contains the parameter - value; if the value is SQL NULL, the value returned is - null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setBlob

        -
        public void setBlob​(java.lang.String parameterName,
        -                    java.sql.Blob x)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to the given java.sql.Blob object. - The driver converts this to an SQL BLOB value when it - sends it to the database.
        -
        -
        Specified by:
        -
        setBlob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - a Blob object that maps an SQL BLOB value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setClob

        -
        public void setClob​(java.lang.String parameterName,
        -                    java.sql.Clob x)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to the given java.sql.Clob object. - The driver converts this to an SQL CLOB value when it - sends it to the database.
        -
        -
        Specified by:
        -
        setClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - a Clob object that maps an SQL CLOB value
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public void setAsciiStream​(java.lang.String parameterName,
        -                           java.io.InputStream x,
        -                           long length)
        -                    throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface.

        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the Java input stream that contains the ASCII parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public void setBinaryStream​(java.lang.String parameterName,
        -                            java.io.InputStream x,
        -                            long length)
        -                     throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large binary value is input to a LONGVARBINARY - parameter, it may be more practical to send it via a - java.io.InputStream object. The data will be read from the stream - as needed until end-of-file is reached. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface.

        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the java input stream which contains the binary parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public void setCharacterStream​(java.lang.String parameterName,
        -                               java.io.Reader reader,
        -                               long length)
        -                        throws java.sql.SQLException
        -
        Sets the designated parameter to the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface.

        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        reader - the java.io.Reader object that - contains the UNICODE data used as the designated parameter
        -
        length - the number of characters in the stream
        -
        Throws:
        -
        java.sql.SQLException - JDBC 4.1[if parameterName does not correspond to a named - parameter;] if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public void setAsciiStream​(java.lang.String parameterName,
        -                           java.io.InputStream x)
        -                    throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setAsciiStream which takes a length parameter.

        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the Java input stream that contains the ASCII parameter value
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public void setBinaryStream​(java.lang.String parameterName,
        -                            java.io.InputStream x)
        -                     throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream. - When a very large binary value is input to a LONGVARBINARY - parameter, it may be more practical to send it via a - java.io.InputStream object. The data will be read from the - stream as needed until end-of-file is reached. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setBinaryStream which takes a length parameter.

        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the java input stream which contains the binary parameter value
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public void setCharacterStream​(java.lang.String parameterName,
        -                               java.io.Reader reader)
        -                        throws java.sql.SQLException
        -
        Sets the designated parameter to the given Reader - object. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setCharacterStream which takes a length parameter.

        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        reader - the java.io.Reader object that contains the - Unicode data
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method - JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNCharacterStream

        -
        public void setNCharacterStream​(java.lang.String parameterName,
        -                                java.io.Reader value)
        -                         throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The - Reader reads the data till end-of-file is reached. The - driver does the necessary conversion from Java character format to - the national character set in the database. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setNCharacterStream which takes a length parameter.

        -
        -
        Specified by:
        -
        setNCharacterStream in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        value - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs; or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method - JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setClob

        -
        public void setClob​(java.lang.String parameterName,
        -                    java.io.Reader reader)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. - This method differs from the setCharacterStream (int, Reader) method - because it informs the driver that the parameter value should be sent to - the server as a CLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARCHAR or a CLOB - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setClob which takes a length parameter.

        -
        -
        Specified by:
        -
        setClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or this method is called on - a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method - JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setBlob

        -
        public void setBlob​(java.lang.String parameterName,
        -                    java.io.InputStream inputStream)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a InputStream object. - This method differs from the setBinaryStream (int, InputStream) - method because it informs the driver that the parameter value should be - sent to the server as a BLOB. When the setBinaryStream method is used, - the driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARBINARY or a BLOB - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setBlob which takes a length parameter.

        -
        -
        Specified by:
        -
        setBlob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method - - JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNClob

        -
        public void setNClob​(java.lang.String parameterName,
        -                     java.io.Reader reader)
        -              throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. - This method differs from the setCharacterStream (int, Reader) method - because it informs the driver that the parameter value should be sent to - the server as a NCLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGNVARCHAR or a NCLOB -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setNClob which takes a length parameter.

        -
        -
        Specified by:
        -
        setNClob in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if the driver does not support national character sets; - if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method - - JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public <T> T getObject​(int parameterIndex,
        -                       java.lang.Class<T> type)
        -                throws java.sql.SQLException
        -

        Returns an object representing the value of OUT parameter - parameterIndex and will convert from the - SQL type of the parameter to the requested Java data type, if the - conversion is supported. If the conversion is not - supported or null is specified for the type, a - SQLException is thrown. -

        - At a minimum, an implementation must support the conversions defined in - Appendix B, Table B-3 and conversion of appropriate user defined SQL - types to a Java type which implements SQLData, or Struct. - Additional conversions may be supported and are vendor defined.

        -
        -
        Specified by:
        -
        getObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, and so on
        -
        type - Class representing the Java data type to convert the - designated parameter to.
        -
        Returns:
        -
        an instance of type holding the OUT parameter value
        -
        Throws:
        -
        java.sql.SQLException - if conversion is not supported, type is null or - another error occurs. The getCause() method of the - exception may provide a more detailed exception, for example, if - a conversion error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public <T> T getObject​(java.lang.String parameterName,
        -                       java.lang.Class<T> type)
        -                throws java.sql.SQLException
        -

        Returns an object representing the value of OUT parameter - parameterName and will convert from the - SQL type of the parameter to the requested Java data type, if the - conversion is supported. If the conversion is not - supported or null is specified for the type, a - SQLException is thrown. -

        - At a minimum, an implementation must support the conversions defined in - Appendix B, Table B-3 and conversion of appropriate user defined SQL - types to a Java type which implements SQLData, or Struct. - Additional conversions may be supported and are vendor defined.

        -
        -
        Specified by:
        -
        getObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        type - Class representing the Java data type to convert - the designated parameter to.
        -
        Returns:
        -
        an instance of type holding the OUT parameter - value
        -
        Throws:
        -
        java.sql.SQLException - if conversion is not supported, type is null or - another error occurs. The getCause() method of the - exception may provide a more detailed exception, for example, if - a conversion error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(java.lang.String parameterName,
        -                      java.lang.Object x,
        -                      java.sql.SQLType targetSqlType,
        -                      int scaleOrLength)
        -               throws java.sql.SQLException
        -

        Sets the value of the designated parameter with the given object. - - If the second argument is an InputStream then the stream - must contain the number of bytes specified by scaleOrLength. - If the second argument is a Reader then the reader must - contain the number of characters specified - by scaleOrLength. If these conditions are not true the driver - will generate a - SQLException when the prepared statement is executed. - -

        The given Java object will be converted to the given targetSqlType - before being sent to the database. - - If the object has a custom mapping (is of a class implementing the - interface SQLData), - the JDBC driver should call the method SQLData.writeSQL to - write it to the SQL data stream. - If, on the other hand, the object is of a class implementing - Ref, Blob, Clob, NClob, - Struct, java.net.URL, - or Array, the driver should pass it to the database as a - value of the corresponding SQL type. - -

        Note that this method may be used to pass database-specific - abstract data types. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        setObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type to be - sent to the database. The scale argument may further qualify this type.
        -
        scaleOrLength - for java.sql.JDBCType.DECIMAL - or java.sql.JDBCType.NUMERIC types, - this is the number of digits after the decimal point. For - Java Object types InputStream and Reader, - this is the length - of the data in the stream or reader. For all other types, - this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs - or this method is called on a closed CallableStatement or - if the Java Object specified by x is an InputStream - or Reader object and the value of the scale parameter is less - than zero
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(java.lang.String parameterName,
        -                      java.lang.Object x,
        -                      java.sql.SQLType targetSqlType)
        -               throws java.sql.SQLException
        -
        Sets the value of the designated parameter with the given object. - - This method is similar to setObject(String parameterName, - Object x, SQLType targetSqlType, int scaleOrLength), - except that it assumes a scale of zero. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        setObject in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type to be sent to the database
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs - or this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(int parameterIndex,
        -                                 java.sql.SQLType sqlType)
        -                          throws java.sql.SQLException
        -
        Registers the OUT parameter in ordinal position - parameterIndex to the JDBC type - sqlType. All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - If the JDBC type expected to be returned to this output parameter - is specific to this particular database, sqlType - may be JDBCType.OTHER or a SQLType that is supported by - the JDBC driver. The method - getObject(int) retrieves the value. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        sqlType - the JDBC type code defined by SQLType to use to - register the OUT Parameter. - If the parameter is of JDBC type JDBCType.NUMERIC - or JDBCType.DECIMAL, the version of - registerOutParameter that accepts a scale value - should be used.
        -
        Throws:
        -
        java.sql.SQLException - if the parameterIndex is not valid; - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified sqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(int parameterIndex,
        -                                 java.sql.SQLType sqlType,
        -                                 int scale)
        -                          throws java.sql.SQLException
        -
        Registers the parameter in ordinal position - parameterIndex to be of JDBC type - sqlType. All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - This version of registerOutParameter should be - used when the parameter is of JDBC type JDBCType.NUMERIC - or JDBCType.DECIMAL. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, - and so on
        -
        sqlType - the JDBC type code defined by SQLType to use to - register the OUT Parameter.
        -
        scale - the desired number of digits to the right of the - decimal point. It must be greater than or equal to zero.
        -
        Throws:
        -
        java.sql.SQLException - if the parameterIndex is not valid; - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified sqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(int parameterIndex,
        -                                 java.sql.SQLType sqlType,
        -                                 java.lang.String typeName)
        -                          throws java.sql.SQLException
        -
        Registers the designated output parameter. - This version of - the method registerOutParameter - should be used for a user-defined or REF output parameter. - Examples - of user-defined types include: STRUCT, DISTINCT, - JAVA_OBJECT, and named array types. -

        - All OUT parameters must be registered - before a stored procedure is executed. -

        For a user-defined parameter, the fully-qualified SQL - type name of the parameter should also be given, while a REF - parameter requires that the fully-qualified type name of the - referenced type be given. A JDBC driver that does not need the - type code and type name information may ignore it. To be portable, - however, applications should always provide these values for - user-defined and REF parameters. - - Although it is intended for user-defined and REF parameters, - this method may be used to register a parameter of any JDBC type. - If the parameter does not have a user-defined or REF type, the - typeName parameter is ignored. - -

        Note: When reading the value of an out parameter, you - must use the getter method whose Java type corresponds to the - parameter's registered SQL type. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2,...
        -
        sqlType - the JDBC type code defined by SQLType to use to - register the OUT Parameter.
        -
        typeName - the fully-qualified name of an SQL structured type
        -
        Throws:
        -
        java.sql.SQLException - if the parameterIndex is not valid; - if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified sqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(java.lang.String parameterName,
        -                                 java.sql.SQLType sqlType)
        -                          throws java.sql.SQLException
        -
        Registers the OUT parameter named - parameterName to the JDBC type - sqlType. All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - If the JDBC type expected to be returned to this output parameter - is specific to this particular database, sqlType - should be JDBCType.OTHER or a SQLType that is supported - by the JDBC driver. The method - getObject(int) retrieves the value. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - the JDBC type code defined by SQLType to use to - register the OUT Parameter. - If the parameter is of JDBC type JDBCType.NUMERIC - or JDBCType.DECIMAL, the version of - registerOutParameter that accepts a scale value - should be used.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified sqlType - or if the JDBC driver does not support - this method
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(java.lang.String parameterName,
        -                                 java.sql.SQLType sqlType,
        -                                 int scale)
        -                          throws java.sql.SQLException
        -
        Registers the parameter named - parameterName to be of JDBC type - sqlType. All OUT parameters must be registered - before a stored procedure is executed. -

        - The JDBC type specified by sqlType for an OUT - parameter determines the Java type that must be used - in the get method to read the value of that parameter. -

        - This version of registerOutParameter should be - used when the parameter is of JDBC type JDBCType.NUMERIC - or JDBCType.DECIMAL. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - the JDBC type code defined by SQLType to use to - register the OUT Parameter.
        -
        scale - the desired number of digits to the right of the - decimal point. It must be greater than or equal to zero.
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified sqlType - or if the JDBC driver does not support - this method
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        registerOutParameter

        -
        public void registerOutParameter​(java.lang.String parameterName,
        -                                 java.sql.SQLType sqlType,
        -                                 java.lang.String typeName)
        -                          throws java.sql.SQLException
        -
        Registers the designated output parameter. This version of - the method registerOutParameter - should be used for a user-named or REF output parameter. Examples - of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and - named array types. -

        - All OUT parameters must be registered - before a stored procedure is executed. -

        - For a user-named parameter the fully-qualified SQL - type name of the parameter should also be given, while a REF - parameter requires that the fully-qualified type name of the - referenced type be given. A JDBC driver that does not need the - type code and type name information may ignore it. To be portable, - however, applications should always provide these values for - user-named and REF parameters. - - Although it is intended for user-named and REF parameters, - this method may be used to register a parameter of any JDBC type. - If the parameter does not have a user-named or REF type, the - typeName parameter is ignored. - -

        Note: When reading the value of an out parameter, you - must use the getXXX method whose Java type XXX corresponds to the - parameter's registered SQL type. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        registerOutParameter in interface java.sql.CallableStatement
        -
        Parameters:
        -
        parameterName - the name of the parameter
        -
        sqlType - the JDBC type code defined by SQLType to use to - register the OUT Parameter.
        -
        typeName - the fully-qualified name of an SQL structured type
        -
        Throws:
        -
        java.sql.SQLException - if parameterName does not correspond to a named - parameter; if a database access error occurs or - this method is called on a closed CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified sqlType - or if the JDBC driver does not support this method
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.sql.SQLException
        -
        Does the specialized work required to free this object's resources and - that of its parent classes.

        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.sql.Statement
        -
        Overrides:
        -
        close in class JDBCPreparedStatement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        closeOnCompletion

        -
        public void closeOnCompletion()
        -                       throws java.sql.SQLException
        -
        Specifies that this Statement will be closed when all its - dependent result sets are closed. If execution of the Statement - does not produce any result sets, this method has no effect. -

        - Note: Multiple calls to closeOnCompletion do - not toggle the effect on this Statement. However, a call to - closeOnCompletion does effect both the subsequent execution of - statements, and statements that currently have open, dependent, - result sets.

        -
        -
        Specified by:
        -
        closeOnCompletion in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement
        -
        -
      • -
      - - - -
        -
      • -

        isCloseOnCompletion

        -
        public boolean isCloseOnCompletion()
        -                            throws java.sql.SQLException
        -
        Returns a value indicating whether this Statement will be - closed when all its dependent result sets are closed.
        -
        -
        Specified by:
        -
        isCloseOnCompletion in interface java.sql.Statement
        -
        Returns:
        -
        true if the Statement will be closed when all - of its dependent result sets are closed; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement
        -
        -
      • -
      - - - -
        -
      • -

        executeQuery

        -
        public java.sql.ResultSet executeQuery()
        -                                throws java.sql.SQLException
        -
        - Executes the SQL query in this PreparedStatement object - and returns the ResultSet object generated by the query. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this method for a call to a FUNCTION that returns a result. - For a PROCEDURE that returns one or more results, the first result is - returned.

        - - If the FUNCTION or PROCEDURE does not return a ResultSet, an - SQLException is thrown. -

        -
        -
        -
        Specified by:
        -
        executeQuery in interface java.sql.PreparedStatement
        -
        Overrides:
        -
        executeQuery in class JDBCPreparedStatement
        -
        Returns:
        -
        a ResultSet object that contains the data produced by the - query; never null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement or the SQL - statement does not return a ResultSet object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClob.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClob.html deleted file mode 100644 index 2484ec55..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClob.html +++ /dev/null @@ -1,1212 +0,0 @@ - - - - - -JDBCClob (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCClob

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCClob
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Clob
    -
    -
    -
    Direct Known Subclasses:
    -
    JDBCNClob
    -
    -
    -
    public class JDBCClob
    -extends java.lang.Object
    -implements java.sql.Clob
    -
    The mapping in the Java™ programming language for the SQL CLOB type. - An SQL CLOB is a built-in type - that stores a Character Large Object as a column value in a row of - a database table. - By default drivers implement a Clob object using an SQL - locator(CLOB), which means that a Clob object - contains a logical pointer to the SQL CLOB data rather than - the data itself. A Clob object is valid for the duration - of the transaction in which it was created. -

    The Clob interface provides methods for getting the - length of an SQL CLOB (Character Large Object) value, - for materializing a CLOB value on the client, and for - searching for a substring or CLOB object within a - CLOB value. - Methods in the interfaces ResultSet, - CallableStatement, and PreparedStatement, such as - getClob and setClob allow a programmer to - access an SQL CLOB value. In addition, this interface - has methods for updating a CLOB value. -

    - All methods on the Clob interface must be fully implemented if the - JDBC driver supports the data type. - - -

    -

    HSQLDB-Specific Information:

    - - Previous to 2.0, the HSQLDB driver did not implement Clob using an SQL - locator(CLOB). That is, an HSQLDB Clob object did not contain a logical - pointer to SQL CLOB data; rather it directly contained a representation of - the data (a String). As a result, an HSQLDB Clob object was itself - valid beyond the duration of the transaction in which is was created, - although it did not necessarily represent a corresponding value - on the database. Also, the interface methods for updating a CLOB value - were unsupported, with the exception of the truncate method, - in that it could be used to truncate the local value.

    - - Starting with 2.0, the HSQLDB driver fully supports both local and remote - SQL CLOB data implementations, meaning that an HSQLDB Clob object may - contain a logical pointer to remote SQL CLOB data (see JDBCClobClient) or it may directly contain a local representation of the - data (as implemented in this class). In particular, when the product is built - under JDK 1.6+ and the Clob instance is constructed as a result of calling - JDBCConnection.createClob(), then the resulting Clob instance is initially - disconnected (is not bound to the transaction scope of the vending Connection - object), the data is contained directly and all interface methods for - updating the CLOB value are supported for local use until the first - invocation of free(); otherwise, an HSQLDB Clob's implementation is - determined at runtime by the driver, it is typically not valid beyond - the duration of the transaction in which is was created, and there no - standard way to query whether it represents a local or remote value.

    - -

    -
    -
    -
    Since:
    -
    JDK 1.2, HSQLDB 1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCClob​(java.lang.String data) -
      Constructs a new, read-only JDBCClob object wrapping the given character - sequence.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidfree() -
      This method frees the Clob object and releases the resources - that it holds.
      -
      java.io.InputStreamgetAsciiStream() -
      Retrieves the CLOB value designated by this Clob - object as an ASCII stream.
      -
      java.io.ReadergetCharacterStream() -
      Retrieves the CLOB value designated by this Clob - object as a java.io.Reader object (or as a stream of - characters).
      -
      java.io.ReadergetCharacterStream​(long pos, - long length) -
      Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
      -
      java.lang.StringgetSubString​(long pos, - int length) -
      Retrieves a copy of the specified substring - in the CLOB value - designated by this Clob object.
      -
      longlength() -
      Retrieves the number of characters - in the CLOB value - designated by this Clob object.
      -
      longposition​(java.lang.String searchstr, - long start) -
      Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object.
      -
      longposition​(java.sql.Clob searchstr, - long start) -
      Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object.
      -
      java.io.OutputStreamsetAsciiStream​(long pos) -
      Retrieves a stream to be used to write ASCII characters to the - CLOB value that this Clob object represents, - starting at position pos.
      -
      java.io.WritersetCharacterStream​(long pos) -
      Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos.
      -
      intsetString​(long pos, - java.lang.String str) -
      Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos.
      -
      intsetString​(long pos, - java.lang.String str, - int offset, - int len) -
      Writes len characters of str, starting - at character offset, to the CLOB value - that this Clob represents.
      -
      intsetStringBuffer​(long pos, - java.lang.StringBuffer sb, - int offset, - int len) - -
      voidtruncate​(long len) -
      Truncates the CLOB value that this Clob - designates to have a length of len - characters.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCClob

        -
        public JDBCClob​(java.lang.String data)
        -         throws java.sql.SQLException
        -
        Constructs a new, read-only JDBCClob object wrapping the given character - sequence.

        - - This constructor is used internally to retrieve result set values as - Clob objects, yet it must be public to allow access from other packages. - As such (in the interest of efficiency) this object maintains a reference - to the given String object rather than making a copy and so it is - gently suggested (in the interest of effective memory management) that - external clients using this constructor either take pause to consider - the implications or at least take care to provide a String object whose - internal character buffer is not much larger than required to represent - the value.

        -
        -
        Parameters:
        -
        data - the character sequence representing the Clob value
        -
        Throws:
        -
        java.sql.SQLException - if the argument is null
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        length

        -
        public long length()
        -            throws java.sql.SQLException
        -
        Retrieves the number of characters - in the CLOB value - designated by this Clob object.
        -
        -
        Specified by:
        -
        length in interface java.sql.Clob
        -
        Returns:
        -
        length of the CLOB in characters
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - length of the CLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getSubString

        -
        public java.lang.String getSubString​(long pos,
        -                                     int length)
        -                              throws java.sql.SQLException
        -
        Retrieves a copy of the specified substring - in the CLOB value - designated by this Clob object. - The substring begins at position - pos and has up to length consecutive - characters. - - -
        -

        HSQLDB-Specific Information:

        - - The official specification above is ambiguous in that it does not - precisely indicate the policy to be observed when - pos > this.length() - length. One policy would be to retrieve - the characters from pos to this.length(). Another would - be to throw an exception. This class observes the second policy.

        - - Note

        - - This method uses String.substring(int, int). -

        - Depending on implementation (typically JDK 6 and earlier releases), the - returned value may be sharing the underlying (and possibly much larger) - character buffer. Depending on factors such as hardware acceleration for - array copies, the average length and number of sub-strings taken, and so - on, this may or may not result in faster operation and - non-trivial memory savings. On the other hand, Oracle / OpenJDK 7, it - was decided that the memory leak implications outweigh the benefits - of buffer sharing for most use cases on modern hardware. -

        - It is left up to any client of this method to determine if this is a - potential factor relative to the target runtime and to decide how to - handle space-time trade-offs (i.e. whether to make an isolated copy of - the returned substring or risk that more memory remains allocated than - is absolutely required). -

        -
        -
        -
        Specified by:
        -
        getSubString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the first character of the substring to be extracted. - The first character is at position 1.
        -
        length - the number of consecutive characters to be copied; - JDBC 4.1[ the value for length must be 0 or greater]
        -
        Returns:
        -
        a String that is the specified substring in - the CLOB value designated by this Clob object
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value; if pos is less than 1 JDBC 4.1[or length is - less than 0]
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream()
        -                                  throws java.sql.SQLException
        -
        Retrieves the CLOB value designated by this Clob - object as a java.io.Reader object (or as a stream of - characters).
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.Clob
        -
        Returns:
        -
        a java.io.Reader object containing the - CLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        See Also:
        -
        setCharacterStream(long)
        -
        -
      • -
      - - - -
        -
      • -

        getAsciiStream

        -
        public java.io.InputStream getAsciiStream()
        -                                   throws java.sql.SQLException
        -
        Retrieves the CLOB value designated by this Clob - object as an ASCII stream.
        -
        -
        Specified by:
        -
        getAsciiStream in interface java.sql.Clob
        -
        Returns:
        -
        a java.io.InputStream object containing the - CLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        See Also:
        -
        setAsciiStream(long)
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.lang.String searchstr,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object. The search - begins at position start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Clob
        -
        Parameters:
        -
        searchstr - the substring for which to search
        -
        start - the position at which to begin searching; the first position - is 1
        -
        Returns:
        -
        the position at which the substring appears or -1 if it is not - present; the first position is 1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if start is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.sql.Clob searchstr,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object. The search begins at position - start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Clob
        -
        Parameters:
        -
        searchstr - the Clob object for which to search
        -
        start - the position at which to begin searching; the first - position is 1
        -
        Returns:
        -
        the position at which the Clob object appears - or -1 if it is not present; the first position is 1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if start is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public int setString​(long pos,
        -                     java.lang.String str)
        -              throws java.sql.SQLException
        -
        Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos. The string will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing the given string, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is supported.

        - - When built under JDK 1.6+ and the Clob instance is constructed as a - result of calling JDBCConnection.createClob(), this operation affects - only the client-side value; it has no effect upon a value stored in the - database because JDBCConnection.createClob() constructs disconnected, - initially empty Clob instances. To propagate the Clob value to a database - in this case, it is required to supply the Clob instance to an updating - or inserting setXXX method of a Prepared or Callable Statement, or to - supply the Clob instance to an updateXXX method of an updateable - ResultSet.

        - - Implementation Notes:

        - - No attempt is made to ensure precise thread safety. Instead, volatile - member field and local variable snapshot isolation semantics are - implemented. This is expected to eliminate most issues related - to race conditions, with the possible exception of concurrent - invocation of free().

        - - In general, if an application may perform concurrent JDBCClob - modifications and the integrity of the application depends on total order - Clob modification semantics, then such operations should be synchronized - on an appropriate monitor.

        - - When the value specified for pos is greater then the - length+1, then the CLOB value is extended in length to accept the - written characters and the undefined region up to @{code pos} is filled - with with space (' ') characters. - - -

        -
        -
        -
        Specified by:
        -
        setString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to the CLOB - value that this Clob object represents; - The first position is 1
        -
        str - the string to be written to the CLOB - value that this Clob designates
        -
        Returns:
        -
        the number of characters written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public int setString​(long pos,
        -                     java.lang.String str,
        -                     int offset,
        -                     int len)
        -              throws java.sql.SQLException
        -
        Writes len characters of str, starting - at character offset, to the CLOB value - that this Clob represents. The string will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing the given string, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is supported.

        - - When built under JDK 1.6+ and the Clob instance is constructed as a - result of calling JDBCConnection.createClob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createClob() constructs disconnected, - initially empty Clob instances. To propagate the Clob value to a database - in this case, it is required to supply the Clob instance to an updating - or inserting setXXX method of a Prepared or Callable Statement, or to - supply the Clob instance to an updateXXX method of an updateable - ResultSet.

        - - Implementation Notes:

        - - If the value specified for pos - is greater than the length of the CLOB value, then - the CLOB value is extended in length to accept the - written characters and the undefined region up to pos is - filled with space (' ') characters.

        - - No attempt is made to ensure precise thread safety. Instead, volatile - member field and local variable snapshot isolation semantics are - implemented. This is expected to eliminate most issues related - to race conditions, with the possible exception of concurrent - invocation of free().

        - - In general, if an application may perform concurrent JDBCClob - modifications and the integrity of the application depends on total order - Clob modification semantics, then such operations should be synchronized - on an appropriate monitor.

        - -

        -
        -
        -
        Specified by:
        -
        setString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to this - CLOB object; The first position is 1
        -
        str - the string to be written to the CLOB - value that this Clob object represents
        -
        offset - the offset into str to start reading - the characters to be written
        -
        len - the number of characters to be written
        -
        Returns:
        -
        the number of characters written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public java.io.OutputStream setAsciiStream​(long pos)
        -                                    throws java.sql.SQLException
        -
        Retrieves a stream to be used to write ASCII characters to the - CLOB value that this Clob object represents, - starting at position pos. Characters written to the stream - will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing characters to the stream, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length of the CLOB value, then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is supported.

        - - When built under JDK 1.6+ and the Clob instance is constructed as a - result of calling JDBCConnection.createClob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createClob() constructs disconnected, - initially empty Clob instances. To propagate the Clob value to a database - in this case, it is required to supply the Clob instance to an updating - or inserting setXXX method of a Prepared or Callable Statement, or to - supply the Clob instance to an updateXXX method of an updatable - ResultSet.

        - - Implementation Notes:

        - - The data written to the stream does not appear in this - Clob until the stream is closed.

        - - When the stream is closed, if the value specified for pos - is greater than the length of the CLOB value, then - the CLOB value is extended in length to accept the - written characters and the undefined region up to pos is - filled with space (' ') characters.

        - - Also, no attempt is made to ensure precise thread safety. Instead, - volatile member field and local variable snapshot isolation semantics - are implemented. This is expected to eliminate most issues related - to race conditions, with the possible exception of concurrent - invocation of free().

        - - In general, if an application may perform concurrent JDBCClob - modifications and the integrity of the application depends on total order - Clob modification semantics, then such operations should be synchronized - on an appropriate monitor.

        - -

        -
        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to this - CLOB object; The first position is 1
        -
        Returns:
        -
        the stream to which ASCII encoded characters can be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        getAsciiStream()
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public java.io.Writer setCharacterStream​(long pos)
        -                                  throws java.sql.SQLException
        -
        Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos. Characters written to the stream - will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing characters to the stream, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is supported.

        - - When built under JDK 1.6+ and the Clob instance is constructed as a - result of calling JDBCConnection.createClob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createClob() constructs disconnected, - initially empty Clob instances. To propagate the Clob value to a database - in this case, it is required to supply the Clob instance to an updating - or inserting setXXX method of a Prepared or Callable Statement, or to - supply the Clob instance to an updateXXX method of an updateable - ResultSet.

        - - Implementation Notes:

        - - The data written to the stream does not appear in this - Clob until the stream is closed.

        - - When the stream is closed, if the value specified for pos - is greater than the length of the CLOB value, then - the CLOB value is extended in length to accept the - written characters and the undefined region up to pos is - filled with space (' ') characters.

        - - Also, no attempt is made to ensure precise thread safety. Instead, - volatile member field and local variable snapshot isolation semantics - are implemented. This is expected to eliminate most issues related - to race conditions, with the possible exception of concurrent - invocation of free().

        - - In general, if an application may perform concurrent JDBCClob - modifications and the integrity of the application depends on - total order Clob modification semantics, then such operations - should be synchronized on an appropriate monitor.

        - -

        -
        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to the - CLOB value; The first position is 1
        -
        Returns:
        -
        a stream to which Unicode encoded characters can be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        getCharacterStream()
        -
        -
      • -
      - - - -
        -
      • -

        truncate

        -
        public void truncate​(long len)
        -              throws java.sql.SQLException
        -
        Truncates the CLOB value that this Clob - designates to have a length of len - characters. -

        - Note: If the value specified for len - is greater than the length of the CLOB value, then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 2.0 this feature is fully supported.

        - - When built under JDK 1.6+ and the Clob instance is constructed as a - result of calling JDBCConnection.createClob(), this operation affects - only the client-side value; it has no effect upon a value stored in a - database because JDBCConnection.createClob() constructs disconnected, - initially empty Blob instances. To propagate the truncated Clob value to - a database in this case, it is required to supply the Clob instance to - an updating or inserting setXXX method of a Prepared or Callable - Statement, or to supply the Blob instance to an updateXXX method of an - updateable ResultSet.

        - - Implementation Notes:

        - - HSQLDB throws an SQLException if the specified len is greater - than the value returned by length.

        - -

        -
        -
        -
        Specified by:
        -
        truncate in interface java.sql.Clob
        -
        Parameters:
        -
        len - the length, in characters, to which the CLOB value - should be truncated
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if len is less than 0
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Clob object and releases the resources - that it holds. The object is invalid once the free method - is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. -

        -
        -
        Specified by:
        -
        free in interface java.sql.Clob
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Clob's resources
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream​(long pos,
        -                                         long length)
        -                                  throws java.sql.SQLException
        -
        Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the offset to the first character of the partial value to - be retrieved. The first character in the Clob is at position 1.
        -
        length - the length in characters of the partial value to be retrieved.
        -
        Returns:
        -
        Reader through which the partial Clob value can be read.
        -
        Throws:
        -
        java.sql.SQLException - if pos is less than 1 or if pos is greater than the number of - characters in the Clob or if pos + length is greater than the number of - characters in the Clob
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setStringBuffer

        -
        public int setStringBuffer​(long pos,
        -                           java.lang.StringBuffer sb,
        -                           int offset,
        -                           int len)
        -                    throws java.sql.SQLException
        - -
        -
        Parameters:
        -
        pos - the position at which to start writing to this - CLOB object; The first position is 1
        -
        sb - the buffer to be written to the CLOB - value that this Clob object represents
        -
        offset - the offset into sb to start reading - the characters to be written
        -
        len - the number of characters to be written
        -
        Returns:
        -
        the number of characters written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClobClient.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClobClient.html deleted file mode 100644 index c6a5ecac..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClobClient.html +++ /dev/null @@ -1,838 +0,0 @@ - - - - - -JDBCClobClient (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCClobClient

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCClobClient
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Clob
    -
    -
    -
    public class JDBCClobClient
    -extends java.lang.Object
    -implements java.sql.Clob
    -
    A wrapper for HSQLDB ClobData objects. - - Instances of this class are returned by calls to ResultSet methods.
    -
    -
    Since:
    -
    HSQLDB 1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCClobClient​(org.hsqldb.SessionInterface session, - org.hsqldb.types.ClobDataID clob) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclearUpdates() 
      voidfree() -
      This method frees the Clob object and releases the resources - that it holds.
      -
      java.io.InputStreamgetAsciiStream() -
      Retrieves the CLOB value designated by this - Clob object as an ascii stream.
      -
      java.io.ReadergetCharacterStream() -
      Retrieves the CLOB value designated by this - Clob object as a java.io.Reader object (or - as a stream of characters).
      -
      java.io.ReadergetCharacterStream​(long pos, - long length) -
      Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
      -
      org.hsqldb.types.ClobDataIDgetClob() 
      java.lang.StringgetSubString​(long pos, - int length) -
      Retrieves a copy of the specified substring in the CLOB - value designated by this Clob object.
      -
      booleanisClosed() 
      longlength() -
      Retrieves the number of characters in the CLOB value - designated by this Clob object.
      -
      longposition​(java.lang.String searchstr, - long start) -
      Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object.
      -
      longposition​(java.sql.Clob searchstr, - long start) -
      Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object.
      -
      java.io.OutputStreamsetAsciiStream​(long pos) -
      Retrieves a stream to be used to write Ascii characters to the - CLOB value that this Clob object represents, - starting at position pos.
      -
      java.io.WritersetCharacterStream​(long pos) -
      Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos.
      -
      intsetString​(long pos, - java.lang.String str) -
      Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos.
      -
      intsetString​(long pos, - java.lang.String str, - int offset, - int len) -
      Writes len characters of str, starting at - character offset, to the CLOB value that - this Clob represents.
      -
      voidsetWritable​(JDBCResultSet result, - int index) 
      voidtruncate​(long len) -
      Truncates the CLOB value that this Clob - designates to have a length of len characters.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCClobClient

        -
        public JDBCClobClient​(org.hsqldb.SessionInterface session,
        -                      org.hsqldb.types.ClobDataID clob)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getAsciiStream

        -
        public java.io.InputStream getAsciiStream()
        -                                   throws java.sql.SQLException
        -
        Retrieves the CLOB value designated by this - Clob object as an ascii stream. - - The ascii stream consists of the low ordre bytes of UTF-16 characters - in the clob. The question mark character is returnd for UTF-16 characters - beyond the range of 8-bit ASCII.
        -
        -
        Specified by:
        -
        getAsciiStream in interface java.sql.Clob
        -
        Returns:
        -
        a java.io.InputStream object containing the - CLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream()
        -                                  throws java.sql.SQLException
        -
        Retrieves the CLOB value designated by this - Clob object as a java.io.Reader object (or - as a stream of characters).
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.Clob
        -
        Returns:
        -
        a java.io.Reader object containing the - CLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        getSubString

        -
        public java.lang.String getSubString​(long pos,
        -                                     int length)
        -                              throws java.sql.SQLException
        -
        Retrieves a copy of the specified substring in the CLOB - value designated by this Clob object.
        -
        -
        Specified by:
        -
        getSubString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the first character of the substring to be extracted. The - first character is at position 1.
        -
        length - the number of consecutive characters to be copied
        -
        Returns:
        -
        a String that is the specified substring in the - CLOB value designated by this Clob object
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        length

        -
        public long length()
        -            throws java.sql.SQLException
        -
        Retrieves the number of characters in the CLOB value - designated by this Clob object.
        -
        -
        Specified by:
        -
        length in interface java.sql.Clob
        -
        Returns:
        -
        length of the CLOB in characters
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the length of the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.lang.String searchstr,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object.
        -
        -
        Specified by:
        -
        position in interface java.sql.Clob
        -
        Parameters:
        -
        searchstr - the substring for which to search
        -
        start - the position at which to begin searching; the first - position is 1
        -
        Returns:
        -
        the position at which the substring appears or -1 if it is - not present; the first position is 1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.sql.Clob searchstr,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object.
        -
        -
        Specified by:
        -
        position in interface java.sql.Clob
        -
        Parameters:
        -
        searchstr - the Clob object for which to search
        -
        start - the position at which to begin searching; the first - position is 1
        -
        Returns:
        -
        the position at which the Clob object appears or - -1 if it is not present; the first position is 1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public java.io.OutputStream setAsciiStream​(long pos)
        -                                    throws java.sql.SQLException
        -
        Retrieves a stream to be used to write Ascii characters to the - CLOB value that this Clob object represents, - starting at position pos. - - The bytes written to the OutputStream are stored verbatim in the clob as - the low order bytes of UTF-16 characters.
        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to this - CLOB object
        -
        Returns:
        -
        the stream to which ASCII encoded characters can be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public java.io.Writer setCharacterStream​(long pos)
        -                                  throws java.sql.SQLException
        -
        Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos.
        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to the - CLOB value
        -
        Returns:
        -
        a stream to which Unicode encoded characters can be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public int setString​(long pos,
        -                     java.lang.String str)
        -              throws java.sql.SQLException
        -
        Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos.
        -
        -
        Specified by:
        -
        setString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to the - CLOB value that this Clob object - represents
        -
        str - the string to be written to the CLOB value - that this Clob designates
        -
        Returns:
        -
        the number of characters written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public int setString​(long pos,
        -                     java.lang.String str,
        -                     int offset,
        -                     int len)
        -              throws java.sql.SQLException
        -
        Writes len characters of str, starting at - character offset, to the CLOB value that - this Clob represents.
        -
        -
        Specified by:
        -
        setString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to this - CLOB object
        -
        str - the string to be written to the CLOB value - that this Clob object represents
        -
        offset - the offset into str to start reading the - characters to be written
        -
        len - the number of characters to be written
        -
        Returns:
        -
        the number of characters written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        truncate

        -
        public void truncate​(long len)
        -              throws java.sql.SQLException
        -
        Truncates the CLOB value that this Clob - designates to have a length of len characters.
        -
        -
        Specified by:
        -
        truncate in interface java.sql.Clob
        -
        Parameters:
        -
        len - the length, in bytes, to which the CLOB value - should be truncated
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Clob object and releases the resources - that it holds. The object is invalid once the free method - is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. -

        -
        -
        Specified by:
        -
        free in interface java.sql.Clob
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Clob's resources
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream​(long pos,
        -                                         long length)
        -                                  throws java.sql.SQLException
        -
        Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the offset to the first character of the partial value to - be retrieved. The first character in the Clob is at position 1.
        -
        length - the length in characters of the partial value to be retrieved.
        -
        Returns:
        -
        Reader through which the partial Clob value can be read.
        -
        Throws:
        -
        java.sql.SQLException - if pos is less than 1 or if pos is greater than the number of - characters in the Clob or if pos + length is greater than the number of - characters in the Clob
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getClob

        -
        public org.hsqldb.types.ClobDataID getClob()
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
      • -
      - - - -
        -
      • -

        setWritable

        -
        public void setWritable​(JDBCResultSet result,
        -                        int index)
        -
      • -
      - - - -
        -
      • -

        clearUpdates

        -
        public void clearUpdates()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClobFile.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClobFile.html deleted file mode 100644 index 01aadc42..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCClobFile.html +++ /dev/null @@ -1,1211 +0,0 @@ - - - - - -JDBCClobFile (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCClobFile

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCClobFile
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Clob
    -
    -
    -
    public class JDBCClobFile
    -extends java.lang.Object
    -implements java.sql.Clob
    -
    A client-side file-based implementation of Clob. - - -
    -

    HSQLDB-Specific Information:

    - - Starting with 2.1, in addition to HSQLDB driver support for both client-side - in-memory and remote SQL CLOB data implementations, this class is provided - to expose efficient, relatively high-performance CLOB operations over client - accessible files.

    - - Design Notes

    - - Although it is possible to implement a transactional version of this class, - the present implementation directly propagates changes to the underlying - file such that changes become visible as soon as they are either - implicitly or explicitly flushed to disk. - -

    -
    -
    -
    Since:
    -
    HSQLDB 2.1
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static java.lang.StringTEMP_FILE_PREFIX 
      static java.lang.StringTEMP_FILE_SUFFIX 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCClobFile() -
      Convenience constructor for JDBCClobFile((String)null).
      -
      JDBCClobFile​(java.io.File file) -
      Convenience constructor for JDBCClobFile(file,null).
      -
      JDBCClobFile​(java.io.File file, - java.lang.String encoding) -
      Constructs a new JDBCClobFile instance backed by the given File object - using the given encoding to read and write file content.
      -
      JDBCClobFile​(java.lang.String encoding) -
      Constructs a new JDBCClobFile instance backed by a File object - created by File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX), - using the given encoding to read and write file content.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidfree() -
      This method frees the Clob object and releases the resources - that it holds.
      -
      java.io.InputStreamgetAsciiStream() -
      Retrieves the CLOB value designated by this Clob - object as an ASCII stream.
      -
      java.io.ReadergetCharacterStream() -
      Retrieves the CLOB value designated by this Clob - object as a java.io.Reader object (or as a stream of - characters).
      -
      java.io.ReadergetCharacterStream​(long pos, - long length) -
      Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
      -
      java.lang.StringgetEncoding() 
      java.io.FilegetFile() -
      Retrieves the canonical File object denoting the file that - backs this CLOB.
      -
      java.lang.StringgetSubString​(long pos, - int length) -
      Retrieves a copy of the specified substring - in the CLOB value - designated by this Clob object.
      -
      booleanisDeleteOnFree() -
      Retrieves whether an attempt to delete the backing file - is made in response to invocation of free().
      -
      longlength() -
      Retrieves the number of characters - in the CLOB value - designated by this Clob object.
      -
      longposition​(char[] pattern, - long start) -
      Retrieves the character position at which the specified char[] - pattern appears in the CLOB value - represented by this Clob object.
      -
      longposition​(java.lang.String searchstr, - long start) -
      Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object.
      -
      longposition​(java.sql.Clob pattern, - long start) -
      Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object.
      -
      java.io.OutputStreamsetAsciiStream​(long pos) -
      Retrieves a stream to be used to write Ascii characters to the - CLOB value that this Clob object represents, - starting at position pos.
      -
      java.io.WritersetCharacterStream​(long pos) -
      Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos.
      -
      voidsetDeleteOnFree​(boolean deleteOnFree) -
      Assigns whether an attempt to delete the backing file - is made in response to invocation of free().
      -
      intsetString​(long pos, - java.lang.String str) -
      Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos.
      -
      intsetString​(long pos, - java.lang.String str, - int offset, - int len) -
      Writes len characters of str, starting - at character offset, to the CLOB value - that this Clob represents.
      -
      voidtruncate​(long len) -
      Truncates the CLOB value that this Clob - designates to have a length of len - characters.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        TEMP_FILE_PREFIX

        -
        public static final java.lang.String TEMP_FILE_PREFIX
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        TEMP_FILE_SUFFIX

        -
        public static final java.lang.String TEMP_FILE_SUFFIX
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCClobFile

        -
        public JDBCClobFile()
        -             throws java.sql.SQLException
        -
        Convenience constructor for JDBCClobFile((String)null).

        -
        -
        Throws:
        -
        java.sql.SQLException - if the platform encoding is unsupported, - the temp file cannot be created or some other - error occurs that prevents the construction of a - valid instance of this class.
        -
        -
      • -
      - - - -
        -
      • -

        JDBCClobFile

        -
        public JDBCClobFile​(java.lang.String encoding)
        -             throws java.sql.SQLException
        -
        Constructs a new JDBCClobFile instance backed by a File object - created by File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX), - using the given encoding to read and write file content.
        -
        -
        Parameters:
        -
        encoding - the name of the character encoding used to read and write - character data in the underlying file, as well as to determine - the character length of and character offsets into the underlying - file. Specify null to denote the platform encoding.
        -
        Throws:
        -
        java.sql.SQLException - if the given encoding is unsupported, - the backing temp file could not be created or if a security - manager exists and its SecurityManager.checkWrite(java.lang.String) - method does not allow a file to be created.
        -
        -
      • -
      - - - -
        -
      • -

        JDBCClobFile

        -
        public JDBCClobFile​(java.io.File file)
        -             throws java.sql.SQLException
        -
        Convenience constructor for JDBCClobFile(file,null).
        -
        -
        Parameters:
        -
        file - that is to back the new CLOB instance.
        -
        Throws:
        -
        java.sql.SQLException - if an I/O error occurs, which is possible because the - construction of the canonical pathname may require - file-system queries; a required system property value - cannot be accessed; a security manager exists and its - SecurityManager.checkRead(java.io.FileDescriptor) - method denies read access to the file
        -
        -
      • -
      - - - -
        -
      • -

        JDBCClobFile

        -
        public JDBCClobFile​(java.io.File file,
        -                    java.lang.String encoding)
        -             throws java.sql.SQLException
        -
        Constructs a new JDBCClobFile instance backed by the given File object - using the given encoding to read and write file content.
        -
        -
        Parameters:
        -
        file - that is to back the new CLOB instance.
        -
        encoding - the name of the character encoding used to read and write - character data in the underlying file, as well as to determine - the character length of and character offsets into the underlying - file. Specify null to denote the platform encoding.
        -
        Throws:
        -
        java.sql.SQLException - if the given encoding is unsupported; - an I/O error occurs, which is possible because the - construction of the canonical pathname may require - file-system queries; a required system property value - cannot be accessed; a security manager exists and its - SecurityManager.checkRead(java.io.FileDescriptor) - method denies read access to the file
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        length

        -
        public long length()
        -            throws java.sql.SQLException
        -
        Retrieves the number of characters - in the CLOB value - designated by this Clob object.
        -
        -
        Specified by:
        -
        length in interface java.sql.Clob
        -
        Returns:
        -
        length of the CLOB in characters
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - length of the CLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getSubString

        -
        public java.lang.String getSubString​(long pos,
        -                                     int length)
        -                              throws java.sql.SQLException
        -
        Retrieves a copy of the specified substring - in the CLOB value - designated by this Clob object. - The substring begins at position - pos and has up to length consecutive - characters.
        -
        -
        Specified by:
        -
        getSubString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the first character of the substring to be extracted. - The first character is at position 1.
        -
        length - the number of consecutive characters to be copied; - the value for length must be 0 or greater
        -
        Returns:
        -
        a String that is the specified substring in - the CLOB value designated by this Clob object
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value; if pos is less than 1 or length is - less than 0
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream()
        -                                  throws java.sql.SQLException
        -
        Retrieves the CLOB value designated by this Clob - object as a java.io.Reader object (or as a stream of - characters).
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.Clob
        -
        Returns:
        -
        a java.io.Reader object containing the - CLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setCharacterStream(long)
        -
        -
      • -
      - - - -
        -
      • -

        getAsciiStream

        -
        public java.io.InputStream getAsciiStream()
        -                                   throws java.sql.SQLException
        -
        Retrieves the CLOB value designated by this Clob - object as an ASCII stream.
        -
        -
        Specified by:
        -
        getAsciiStream in interface java.sql.Clob
        -
        Returns:
        -
        a java.io.InputStream object containing the - CLOB data
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setAsciiStream(long)
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(char[] pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the character position at which the specified char[] - pattern appears in the CLOB value - represented by this Clob object. The search - begins at position start.
        -
        -
        Parameters:
        -
        pattern - the substring for which to search
        -
        start - the position at which to begin searching; the first position - is 1
        -
        Returns:
        -
        the position at which the substring appears or -1 if it is not - present; the first position is 1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.lang.String searchstr,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the character position at which the specified substring - searchstr appears in the SQL CLOB value - represented by this Clob object. The search - begins at position start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Clob
        -
        Parameters:
        -
        searchstr - the substring for which to search
        -
        start - the position at which to begin searching; the first position - is 1
        -
        Returns:
        -
        the position at which the substring appears or -1 if it is not - present; the first position is 1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        position

        -
        public long position​(java.sql.Clob pattern,
        -                     long start)
        -              throws java.sql.SQLException
        -
        Retrieves the character position at which the specified - Clob object searchstr appears in this - Clob object. The search begins at position - start.
        -
        -
        Specified by:
        -
        position in interface java.sql.Clob
        -
        Parameters:
        -
        pattern - the Clob object for which to search
        -
        start - the position at which to begin searching; the first - position is 1
        -
        Returns:
        -
        the position at which the Clob object appears - or -1 if it is not present; the first position is 1
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if start is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public int setString​(long pos,
        -                     java.lang.String str)
        -              throws java.sql.SQLException
        -
        Writes the given Java String to the CLOB - value that this Clob object designates at the position - pos. The string will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing the given string, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation.

        -
        -
        Specified by:
        -
        setString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to the CLOB - value that this Clob object represents; - The first position is 1
        -
        str - the string to be written to the CLOB - value that this Clob designates
        -
        Returns:
        -
        the number of characters written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public int setString​(long pos,
        -                     java.lang.String str,
        -                     int offset,
        -                     int len)
        -              throws java.sql.SQLException
        -
        Writes len characters of str, starting - at character offset, to the CLOB value - that this Clob represents. The string will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing the given string, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation.

        -
        -
        Specified by:
        -
        setString in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to this - CLOB object; The first position is 1
        -
        str - the string to be written to the CLOB - value that this Clob object represents
        -
        offset - the offset into str to start reading - the characters to be written
        -
        len - the number of characters to be written
        -
        Returns:
        -
        the number of characters written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public java.io.OutputStream setAsciiStream​(long pos)
        -                                    throws java.sql.SQLException
        -
        Retrieves a stream to be used to write Ascii characters to the - CLOB value that this Clob object represents, - starting at position pos. Characters written to the stream - will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing characters to the stream, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation.

        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to this - CLOB object; The first position is 1
        -
        Returns:
        -
        the stream to which ASCII encoded characters can be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        See Also:
        -
        getAsciiStream()
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public java.io.Writer setCharacterStream​(long pos)
        -                                  throws java.sql.SQLException
        -
        Retrieves a stream to be used to write a stream of Unicode characters - to the CLOB value that this Clob object - represents, at position pos. Characters written to the stream - will overwrite the existing characters - in the Clob object starting at the position - pos. If the end of the Clob value is reached - while writing characters to the stream, then the length of the Clob - value will be increased to accommodate the extra characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation. - - -

        -

        HSQLDB-Specific Information:

        - - When the value specified for pos is greater then the - length+1, an SQLException is thrown. -

        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the position at which to start writing to the - CLOB value; The first position is 1
        -
        Returns:
        -
        a stream to which Unicode encoded characters can be written
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if pos is less than 1
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        See Also:
        -
        getCharacterStream()
        -
        -
      • -
      - - - -
        -
      • -

        truncate

        -
        public void truncate​(long len)
        -              throws java.sql.SQLException
        -
        Truncates the CLOB value that this Clob - designates to have a length of len - characters. -

        - Note: If the value specified for pos - is greater than the length+1 of the CLOB value then the - behavior is undefined. Some JDBC drivers may throw a - SQLException while other drivers may support this - operation.

        -
        -
        Specified by:
        -
        truncate in interface java.sql.Clob
        -
        Parameters:
        -
        len - the length, in characters, to which the CLOB value - should be truncated
        -
        Throws:
        -
        java.sql.SQLException - if there is an error accessing the - CLOB value or if len is less than 0
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method frees the Clob object and releases the resources - that it holds. The object is invalid once the free method - is called. -

        - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op. -

        -
        -
        Specified by:
        -
        free in interface java.sql.Clob
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs releasing - the Clob's resources
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream​(long pos,
        -                                         long length)
        -                                  throws java.sql.SQLException
        -
        Returns a Reader object that contains a partial Clob value, starting - with the character specified by pos, which is length characters in length.
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.Clob
        -
        Parameters:
        -
        pos - the offset to the first character of the partial value to - be retrieved. The first character in the Clob is at position 1.
        -
        length - the length in characters of the partial value to be retrieved.
        -
        Returns:
        -
        Reader through which the partial Clob value can be read.
        -
        Throws:
        -
        java.sql.SQLException - if pos is less than 1 or if pos is greater than the number of - characters in the Clob or if pos + length is greater than the number of - characters in the Clob
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        getFile

        -
        public java.io.File getFile()
        -
        Retrieves the canonical File object denoting the file that - backs this CLOB.
        -
        -
        Returns:
        -
        the file that backs this CLOB.
        -
        -
      • -
      - - - -
        -
      • -

        getEncoding

        -
        public java.lang.String getEncoding()
        -
        -
        Returns:
        -
        the name of the character encoding used to read and write - character data in the underlying files, as well as to determine - the character length and character offsets into the underlying - file
        -
        -
      • -
      - - - -
        -
      • -

        isDeleteOnFree

        -
        public boolean isDeleteOnFree()
        -
        Retrieves whether an attempt to delete the backing file - is made in response to invocation of free().
        -
        -
        Returns:
        -
        true if backing file deletion is attempted; otherwise false.
        -
        -
      • -
      - - - -
        -
      • -

        setDeleteOnFree

        -
        public void setDeleteOnFree​(boolean deleteOnFree)
        -
        Assigns whether an attempt to delete the backing file - is made in response to invocation of free().
        -
        -
        Parameters:
        -
        deleteOnFree - the new value to assign
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCColumnMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCColumnMetaData.html deleted file mode 100644 index 59877330..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCColumnMetaData.html +++ /dev/null @@ -1,682 +0,0 @@ - - - - - -JDBCColumnMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCColumnMetaData

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCColumnMetaData
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class JDBCColumnMetaData
    -extends java.lang.Object
    -
    Provides a site for holding the ResultSetMetaData for individual ResultSet - columns. In 2.0 it is implemented as a simple data structure derived - from calls to JDBCResultSetMetaData methods. - purposes.

    -
    -
    Since:
    -
    HSQLDB 1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      java.lang.StringcatalogName -
      The column's table's catalog name.
      -
      java.lang.StringcolumnClassName -
      The fully-qualified name of the Java class whose instances are - manufactured if the method ResultSet.getObject is called to retrieve - a value from the column.
      -
      intcolumnDisplaySize -
      The column's normal max width in chars.
      -
      java.lang.StringcolumnLabel -
      The suggested column title for use in printouts and displays.
      -
      java.lang.StringcolumnName -
      The column's name.
      -
      intcolumnType -
      The column's SQL type.
      -
      booleanisAutoIncrement -
      Whether the value of the column are automatically numbered.
      -
      booleanisCaseSensitive -
      Whether the column's value's case matters.
      -
      booleanisCurrency -
      Whether the values in the column are cash values.
      -
      booleanisDefinitelyWritable -
      Whether a write on the column will definitely succeed.
      -
      intisNullable -
      The nullability of values in the column.
      -
      booleanisReadOnly -
      Whether the column's values are definitely not writable.
      -
      booleanisSearchable -
      Whether the column's values can be used in a where clause.
      -
      booleanisSigned -
      Whether values in the column are signed numbers.
      -
      booleanisWritable -
      Whether it is possible for a write on the column to succeed.
      -
      intprecision -
      The column's value's number of decimal digits.
      -
      intscale -
      The column's value's number of digits to right of the decimal point.
      -
      java.lang.StringschemaName -
      The column's table's schema.
      -
      java.lang.StringtableName -
      The column's table's name.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCColumnMetaData() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringtoString() -
      Retrieves a String representation of this object.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        catalogName

        -
        public java.lang.String catalogName
        -
        The column's table's catalog name.
        -
      • -
      - - - -
        -
      • -

        columnClassName

        -
        public java.lang.String columnClassName
        -
        The fully-qualified name of the Java class whose instances are - manufactured if the method ResultSet.getObject is called to retrieve - a value from the column.
        -
      • -
      - - - -
        -
      • -

        columnDisplaySize

        -
        public int columnDisplaySize
        -
        The column's normal max width in chars.
        -
      • -
      - - - -
        -
      • -

        columnLabel

        -
        public java.lang.String columnLabel
        -
        The suggested column title for use in printouts and displays.
        -
      • -
      - - - -
        -
      • -

        columnName

        -
        public java.lang.String columnName
        -
        The column's name.
        -
      • -
      - - - -
        -
      • -

        columnType

        -
        public int columnType
        -
        The column's SQL type.
        -
      • -
      - - - -
        -
      • -

        precision

        -
        public int precision
        -
        The column's value's number of decimal digits.
        -
      • -
      - - - -
        -
      • -

        scale

        -
        public int scale
        -
        The column's value's number of digits to right of the decimal point.
        -
      • -
      - - - -
        -
      • -

        schemaName

        -
        public java.lang.String schemaName
        -
        The column's table's schema.
        -
      • -
      - - - -
        -
      • -

        tableName

        -
        public java.lang.String tableName
        -
        The column's table's name.
        -
      • -
      - - - -
        -
      • -

        isAutoIncrement

        -
        public boolean isAutoIncrement
        -
        Whether the value of the column are automatically numbered.
        -
      • -
      - - - -
        -
      • -

        isCaseSensitive

        -
        public boolean isCaseSensitive
        -
        Whether the column's value's case matters.
        -
      • -
      - - - -
        -
      • -

        isCurrency

        -
        public boolean isCurrency
        -
        Whether the values in the column are cash values.
        -
      • -
      - - - -
        -
      • -

        isDefinitelyWritable

        -
        public boolean isDefinitelyWritable
        -
        Whether a write on the column will definitely succeed.
        -
      • -
      - - - -
        -
      • -

        isNullable

        -
        public int isNullable
        -
        The nullability of values in the column.
        -
      • -
      - - - -
        -
      • -

        isReadOnly

        -
        public boolean isReadOnly
        -
        Whether the column's values are definitely not writable.
        -
      • -
      - - - -
        -
      • -

        isSearchable

        -
        public boolean isSearchable
        -
        Whether the column's values can be used in a where clause.
        -
      • -
      - - - -
        -
      • -

        isSigned

        -
        public boolean isSigned
        -
        Whether values in the column are signed numbers.
        -
      • -
      - - - -
        -
      • -

        isWritable

        -
        public boolean isWritable
        -
        Whether it is possible for a write on the column to succeed.
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCColumnMetaData

        -
        public JDBCColumnMetaData()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Retrieves a String representation of this object.
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        a String representation of this object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCCommonDataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCCommonDataSource.html deleted file mode 100644 index 53f89777..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCCommonDataSource.html +++ /dev/null @@ -1,866 +0,0 @@ - - - - - -JDBCCommonDataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCCommonDataSource

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCCommonDataSource
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, javax.sql.CommonDataSource
    -
    -
    -
    Direct Known Subclasses:
    -
    JDBCDataSource, JDBCPooledDataSource, JDBCXADataSource
    -
    -
    -
    public abstract class JDBCCommonDataSource
    -extends java.lang.Object
    -implements javax.sql.CommonDataSource, java.io.Serializable
    -
    Common base for DataSource implementations. - - This class implements the methods used for setting the properties for new - connections. - - The setUrl() or setDatabase() methods are used to set the URL. - - It is possible to set all the rest of required properties in a Properties - file and use the setProperties() method. - - Alternatively, the setXXX() methods for user and password can be used. - - It is best to use only one method for setting the properties. - - If setXXX() methods are used, the values override the values set in a - call made to setProperties() before or after calling setXXX().
    -
    -
    Since:
    -
    JDK 1.2, HSQLDB 2.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringgetDatabase() -
      Synonym for getUrl().
      -
      java.lang.StringgetDatabaseName() -
      Synonym for getUrl().
      -
      java.lang.StringgetDataSourceName() -
      Retrieves the name of the data source.
      -
      java.lang.StringgetDescription() -
      Retrieves the description of the data source.
      -
      intgetLoginTimeout() -
      Gets the maximum time in seconds that this data source can wait - while attempting to connect to a database.
      -
      java.io.PrintWritergetLogWriter() -
      Retrieves the log writer for this DataSource - object.
      -
      java.lang.StringgetNetworkProtocol() -
      Retrieves the network protocol of the data source.
      -
      java.util.logging.LoggergetParentLogger() -
      Return the parent Logger of all the Loggers used by this data source.
      -
      java.lang.StringgetServerName() -
      Retrieves the server name attribute.
      -
      java.lang.StringgetUrl() -
      Retrieves the jdbc database connection url attribute.
      -
      java.lang.StringgetURL() -
      Retrieves the jdbc database connection url attribute.
      -
      java.lang.StringgetUser() -
      Retrieves the user name for the connection.
      -
      voidsetDatabase​(java.lang.String database) -
      Synonym for setUrl(String).
      -
      voidsetDatabaseName​(java.lang.String databaseName) -
      Synonym for setUrl(String).
      -
      voidsetLoginTimeout​(int seconds) -
      Sets the maximum time in seconds that this data source will wait - while attempting to connect to a database.
      -
      voidsetLogWriter​(java.io.PrintWriter out) -
      Sets the log writer for this DataSource - object to the given java.io.PrintWriter object.
      -
      voidsetPassword​(java.lang.String password) -
      Sets the password for the user name.
      -
      voidsetProperties​(java.util.Properties props) -
      Sets connection properties.
      -
      voidsetUrl​(java.lang.String url) -
      Sets the jdbc database URL.
      -
      voidsetURL​(java.lang.String url) -
      Sets the jdbc database URL.
      -
      voidsetUser​(java.lang.String user) -
      Sets the user name.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface javax.sql.CommonDataSource

        -createShardingKeyBuilder
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCCommonDataSource

        -
        public JDBCCommonDataSource()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getLogWriter

        -
        public java.io.PrintWriter getLogWriter()
        -                                 throws java.sql.SQLException
        -

        Retrieves the log writer for this DataSource - object. - -

        The log writer is a character output stream to which all logging - and tracing messages for this data source will be - printed. This includes messages printed by the methods of this - object, messages printed by methods of other objects manufactured - by this object, and so on. Messages printed to a data source - specific log writer are not printed to the log writer associated - with the java.sql.DriverManager class. When a - DataSource object is - created, the log writer is initially null; in other words, the - default is for logging to be disabled.

        -
        -
        Specified by:
        -
        getLogWriter in interface javax.sql.CommonDataSource
        -
        Returns:
        -
        the log writer for this data source or null if - logging is disabled
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        setLogWriter(java.io.PrintWriter)
        -
        -
      • -
      - - - -
        -
      • -

        setLogWriter

        -
        public void setLogWriter​(java.io.PrintWriter out)
        -                  throws java.sql.SQLException
        -

        Sets the log writer for this DataSource - object to the given java.io.PrintWriter object. - -

        The log writer is a character output stream to which all logging - and tracing messages for this data source will be - printed. This includes messages printed by the methods of this - object, messages printed by methods of other objects manufactured - by this object, and so on. Messages printed to a data source- - specific log writer are not printed to the log writer associated - with the java.sql.DriverManager class. When a - DataSource object is created the log writer is - initially null; in other words, the default is for logging to be - disabled.

        -
        -
        Specified by:
        -
        setLogWriter in interface javax.sql.CommonDataSource
        -
        Parameters:
        -
        out - the new log writer; to disable logging, set to null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        getLogWriter()
        -
        -
      • -
      - - - -
        -
      • -

        setLoginTimeout

        -
        public void setLoginTimeout​(int seconds)
        -                     throws java.sql.SQLException
        -

        Sets the maximum time in seconds that this data source will wait - while attempting to connect to a database. A value of zero - specifies that the timeout is the default system timeout - if there is one; otherwise, it specifies that there is no timeout. - When a DataSource object is created, the login timeout is - initially zero.

        -
        -
        Specified by:
        -
        setLoginTimeout in interface javax.sql.CommonDataSource
        -
        Parameters:
        -
        seconds - the data source login time limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs.
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        getLoginTimeout()
        -
        -
      • -
      - - - -
        -
      • -

        getLoginTimeout

        -
        public int getLoginTimeout()
        -                    throws java.sql.SQLException
        -
        Gets the maximum time in seconds that this data source can wait - while attempting to connect to a database. A value of zero - means that the timeout is the default system timeout - if there is one; otherwise, it means that there is no timeout. - When a DataSource object is created, the login timeout is - initially zero.
        -
        -
        Specified by:
        -
        getLoginTimeout in interface javax.sql.CommonDataSource
        -
        Returns:
        -
        the data source login time limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs.
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        setLoginTimeout(int)
        -
        -
      • -
      - - - -
        -
      • -

        getDescription

        -
        public java.lang.String getDescription()
        -
        Retrieves the description of the data source.

        -
        -
        Returns:
        -
        the description
        -
        -
      • -
      - - - -
        -
      • -

        getDataSourceName

        -
        public java.lang.String getDataSourceName()
        -
        Retrieves the name of the data source.

        -
        -
        Returns:
        -
        the description
        -
        -
      • -
      - - - -
        -
      • -

        getNetworkProtocol

        -
        public java.lang.String getNetworkProtocol()
        -
        Retrieves the network protocol of the data source.

        -
        -
        Returns:
        -
        the network protocol
        -
        -
      • -
      - - - -
        -
      • -

        getServerName

        -
        public java.lang.String getServerName()
        -
        Retrieves the server name attribute.

        -
        -
        Returns:
        -
        the server name attribute
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseName

        -
        public java.lang.String getDatabaseName()
        -
        Synonym for getUrl().
        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getDatabase

        -
        public java.lang.String getDatabase()
        -
        Synonym for getUrl().
        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getUrl

        -
        public java.lang.String getUrl()
        -
        Retrieves the jdbc database connection url attribute.

        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.lang.String getURL()
        -
        Retrieves the jdbc database connection url attribute.

        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getUser

        -
        public java.lang.String getUser()
        -
        Retrieves the user name for the connection.

        -
        -
        Returns:
        -
        the username for the connection
        -
        -
      • -
      - - - -
        -
      • -

        setDatabaseName

        -
        public void setDatabaseName​(java.lang.String databaseName)
        -
        Synonym for setUrl(String).

        -
        -
        Parameters:
        -
        databaseName - the new value for the attribute
        -
        -
      • -
      - - - -
        -
      • -

        setDatabase

        -
        public void setDatabase​(java.lang.String database)
        -
        Synonym for setUrl(String).

        -
        -
        Parameters:
        -
        database - the new value for the attribute
        -
        -
      • -
      - - - -
        -
      • -

        setUrl

        -
        public void setUrl​(java.lang.String url)
        -
        Sets the jdbc database URL.

        -
        -
        Parameters:
        -
        url - the new value of this object's jdbc database connection - url attribute
        -
        -
      • -
      - - - -
        -
      • -

        setURL

        -
        public void setURL​(java.lang.String url)
        -
        Sets the jdbc database URL.

        -
        -
        Parameters:
        -
        url - the new value of this object's jdbc database connection - url attribute
        -
        -
      • -
      - - - -
        -
      • -

        setPassword

        -
        public void setPassword​(java.lang.String password)
        -
        Sets the password for the user name.
        -
        -
        Parameters:
        -
        password - the password
        -
        -
      • -
      - - - -
        -
      • -

        setUser

        -
        public void setUser​(java.lang.String user)
        -
        Sets the user name.
        -
        -
        Parameters:
        -
        user - the user id
        -
        -
      • -
      - - - -
        -
      • -

        setProperties

        -
        public void setProperties​(java.util.Properties props)
        -
        Sets connection properties. If user / password / loginTimeout has been - set with one of the setXXX() methods it will be added to the Properties - object.
        -
        -
        Parameters:
        -
        props - properties. If null, then existing properties will be - cleared/replaced.
        -
        -
      • -
      - - - -
        -
      • -

        getParentLogger

        -
        public java.util.logging.Logger getParentLogger()
        -                                         throws java.sql.SQLFeatureNotSupportedException
        -
        Return the parent Logger of all the Loggers used by this data source. This - should be the Logger farthest from the root Logger that is - still an ancestor of all of the Loggers used by this data source. Configuring - this Logger will affect all of the log messages generated by the data source. - In the worst case, this may be the root Logger.
        -
        -
        Specified by:
        -
        getParentLogger in interface javax.sql.CommonDataSource
        -
        Returns:
        -
        the parent Logger for this data source
        -
        Throws:
        -
        java.sql.SQLFeatureNotSupportedException - if the data source does not use java.util.logging.
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCConnection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCConnection.html deleted file mode 100644 index d8e4c58e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCConnection.html +++ /dev/null @@ -1,4118 +0,0 @@ - - - - - -JDBCConnection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCConnection

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCConnection
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper
    -
    -
    -
    Direct Known Subclasses:
    -
    JDBCXAConnectionWrapper
    -
    -
    -
    public class JDBCConnection
    -extends java.lang.Object
    -implements java.sql.Connection
    -
    - - A connection (session) with a specific - database. SQL statements are executed and results are returned - within the context of a connection. -

    - A Connection object's database is able to provide information - describing its tables, its supported SQL grammar, its stored - procedures, the capabilities of this connection, and so on. This - information is obtained with the getMetaData method. - -

    (JDBC4 clarification:) -

    Note: When configuring a Connection, JDBC applications - should use the appropriate Connection method such as - setAutoCommit or setTransactionIsolation. - Applications should not invoke SQL commands directly to change the connection's - configuration when there is a JDBC method available. By default, a Connection object is in - auto-commit mode, which means that it automatically commits changes - after executing each statement. If auto-commit mode has been - disabled, the method commit must be called explicitly in - order to commit changes; otherwise, database changes will not be saved. -

    - A new Connection object created using the JDBC 2.1 core API - has an initially empty type map associated with it. A user may enter a - custom mapping for a UDT in this type map. - When a UDT is retrieved from a data source with the - method ResultSet.getObject, the getObject method - will check the connection's type map to see if there is an entry for that - UDT. If so, the getObject method will map the UDT to the - class indicated. If there is no entry, the UDT will be mapped using the - standard mapping. -

    - A user may create a new type map, which is a java.util.Map - object, make an entry in it, and pass it to the java.sql - methods that can perform custom mapping. In this case, the method - will use the given type map instead of the one associated with - the connection. -

    - For example, the following code fragment specifies that the SQL - type ATHLETES will be mapped to the class - Athletes in the Java programming language. - The code fragment retrieves the type map for the Connection - object con, inserts the entry into it, and then sets - the type map with the new entry as the connection's type map. -

    -      java.util.Map map = con.getTypeMap();
    -      map.put("mySchemaName.ATHLETES", Class.forName("Athletes"));
    -      con.setTypeMap(map);
    - 
    - - - - -
    -

    HSQLDB-Specific Information:

    - - To get a Connection to an HSQLDB database, the - following code may be used (updated to reflect the most recent - recommendations): - -


    - - When using HSQLDB, the database connection <url> must start with - 'jdbc:hsqldb:'

    - - Since 1.7.2, connection properties (<key-value-pairs>) may be appended - to the database connection <url>, using the form: - -

    - '<url>[;key=value]*' -

    - - Also since 1.7.2, the allowable forms of the HSQLDB database connection - <url> have been extended. However, all legacy forms continue - to work, with unchanged semantics. The extensions are as described in the - following material. - -


    - - Network Server Database Connections:

    - - The Server database connection <url> - takes one of the two following forms: - -

    -
      -
    1. 'jdbc:hsqldb:hsql://host[:port][/<alias>][<key-value-pairs>]' - -
    2. 'jdbc:hsqldb:hsqls://host[:port][/<alias>][<key-value-pairs>]' - (with TLS). -
    -

    - - The WebServer database connection <url> - takes one of two following forms: - -

    -
      -
    1. 'jdbc:hsqldb:http://host[:port][/<alias>][<key-value-pairs>]' - -
    2. 'jdbc:hsqldb:https://host[:port][/<alias>][<key-value-pairs>]' - (with TLS). -
    -

    - - In both network server database connection <url> forms, the - optional <alias> component is used to identify one of possibly - several database instances available at the indicated host and port. If the - <alias> component is omitted, then a connection is made to the - network server's default database instance, if such an instance is - available.

    - - For more information on server configuration regarding mounting multiple - databases and assigning them <alias> values, please read the - Java API documentation for Server and related - chapters in the general documentation, especially the HyperSQL User - Guide. - -


    - - Transient, In-Process Database Connections:

    - - The 100% in-memory (transient, in-process) database connection - <url> takes one of the two following forms: - -

    -
      -
    1. 'jdbc:hsqldb:.[<key-value-pairs>]' - (the legacy form, extended) - -
    2. 'jdbc:hsqldb:mem:<alias>[<key-value-pairs>]' - (the new form) -
    -

    - - The driver converts the supplied <alias> component to - Local.ENGLISH lower case and uses the resulting character sequence as the - key used to look up a mem: protocol database instance amongst the - collection of all such instances already in existence within the current - class loading context in the current JVM. If no such instance exists, one - may be automatically created and mapped to the <alias>, - as governed by the 'ifexists=true|false' connection property.

    - - The rationale for converting the supplied <alias> component to - lower case is to provide consistency with the behavior of res: - protocol database connection <url>s, explained further on in - this overview. - -


    - - Persistent, In-Process Database Connections:

    - - The standalone (persistent, in-process) database connection - <url> takes one of the three following forms: - -

    -
      -
    1. 'jdbc:hsqldb:<path>[<key-value-pairs>]' - (the legacy form, extended) - -
    2. 'jdbc:hsqldb:file:<path>[<key-value-pairs>]' - (same semantics as the legacy form) - -
    3. 'jdbc:hsqldb:res:<path>[<key-value-pairs>]' - (new form with 'files_in_jar' semantics) -
    -

    - - For the persistent, in-process database connection <url>, - the <path> component is the path prefix common to all of - the files that compose the database.

    - - From 1.7.2, although other files may be involved (such as transient working - files and/or TEXT table CSV data source files), the essential set that may, - at any particular point in time, compose an HSQLDB database is: - -

    -
      -
    • <path>.properties -
    • <path>.script -
    • <path>.log -
    • <path>.data -
    • <path>.backup -
    • <path>.lck -
    -

    - - For example: 'jdbc:hsqldb:file:test' connects to a database - composed of some subset of the files listed above, where the expansion - of <path> is 'test' prefixed with the canonical path of - the JVM's effective working directory at the time the designated database - is first opened in-process.

    - - Be careful to note that this canonical expansion of <path> is - cached by the driver until JVM exit. So, although legacy JVMs tend to fix - the reported effective working directory at the one noted upon JVM startup, - there is no guarantee that modern JVMs will continue to uphold this - behaviour. What this means is there is effectively no guarantee into the - future that a relative file: protocol database connection - <url> will connect to the same database instance for the life - of the JVM. To avoid any future ambiguity issues, it is probably a best - practice for clients to attempt to pre-canonicalize the <path> - component of file: protocol database connection* <url>s. -

    - - Under Windows, - 'jdbc:hsqldb:file:c:\databases\test' connects to a database located - on drive 'C:' in the directory 'databases', composed - of some subset of the files: - -

    - C:\
    - +--databases\
    -    +--test.properties
    -    +--test.script
    -    +--test.log
    -    +--test.data
    -    +--test.backup
    -    +--test.lck
    - 
    - - Under most variations of UNIX, 'jdbc:hsqldb:file:/databases/test' - connects to a database located in the directory 'databases' directly - under root, once again composed of some subset of the files: - -
    -
    - +--databases
    -    +--test.properties
    -    +--test.script
    -    +--test.log
    -    +--test.data
    -    +--test.backup
    -    +--test.lck
    - 
    - - Some Guidelines: - -
      -
    1. Both relative and absolute database file paths are supported. - -
    2. Relative database file paths can be specified in a platform independent - manner as: '[dir1/dir2/.../dirn/]<file-name-prefix>'. - -
    3. Specification of absolute file paths is operating-system specific.
      - Please read your OS file system documentation. - -
    4. Specification of network mounts may be operating-system specific.
      - Please read your OS file system documentation. - -
    5. Special care may be needed w.r.t. file path specifications - containing whitespace, mixed-case, special characters and/or - reserved file names.
      - Please read your OS file system documentation. -

    - - Note:HSQLDB creates - directories along the file path specified in the persistent, in-process mode - database connection <url> form, in the case that they did - not already exist. -


    - - res: protocol Connections:

    - - The 'jdbc:hsqldb:res:<path>' database connection - <url> has different semantics than the - 'jdbc:hsqldb:file:<path>' form. The semantics are similar to - those of a 'files_readonly' database, but with some additional - points to consider.

    - - Specifically, the '<path>' component of a res: protocol - database connection <url> is first converted to lower case - with Locale.ENGLISH and only then used to obtain resource URL - objects, which in turn are used to read the database files as resources on - the class path.

    - - Due to lower case conversion by the driver, res: '<path>' - components never find jar resources stored with - Locale.ENGLISH mixed case paths. The rationale for converting to - lower case is that not all pkzip implementations guarantee path case is - preserved when archiving resources, and conversion to lower case seems to - be the most common occurrence (although there is also no actual guarantee - that the conversion is Locale.ENGLISH).

    - - More importantly, res: '<path>' components must - point only to resources contained in one or more jars on the class - path. That is, only resources having the jar sub-protocol are considered - valid.

    - - This restriction is enforced to avoid the unfortunate situation in which, - because res: database instances do not create a <path>.lck - file (they are strictly files-read-only) and because the <path> - components of res: and file: database URIs are not - checked for file system equivalence, it is possible for the same database - files to be accessed concurrently by both file: and res: - database instances. That is, without this restriction, it is possible that - <path>.data and <path>.properties file content may - be written by a file: database instance without the knowledge or - cooperation of a res: database instance open on the same files, - potentially resulting in unexpected database errors, inconsistent operation - and/or data corruption.

    - - In short, a res: type database connection <url> is - designed specifically to connect to a 'files_in_jar' mode database - instance, which in turn is designed specifically to operate under - Java WebStart and - Java Applet configurations, - where co-locating the database files in the jars that make up the - WebStart application or Applet avoids the need for special security - configuration or code signing.

    - - Note: Since it is difficult and often nearly impossible to determine - or control at runtime from where all classes are being loaded or which class - loader is doing the loading (and hence how relative path specifications - are resolved) under 'files_in_jar' semantics, the <path> - component of the res: database connection <url> is always - taken to be relative to the default package and resource URL resolution is - always performed using the ClassLoader that loads the - org.hsqldb.persist.Logger class. That is, if the <path> - component does not start with '/', then'/' is prepended when obtaining the - resource URLs used to read the database files, and only the effective class - path of org.hsqldb.persist.Logger's ClassLoader is searched. - -


    - - For more information about HSQLDB file structure, various database modes - and other attributes such as those controlled through the HSQLDB properties - files, please read the general documentation, especially the HyperSQL User - Guide.

    - - JDBC 4.0 Notes:

    - - Starting with JDBC 4.0 (JDK 1.6), the DriverManager methods - getConnection and getDrivers have been - enhanced to support the Java Standard Edition Service Provider mechanism. - HSQLDB distribution - jars containing the Driver implementation also include the file - META-INF/services/java.sql.Driver. This file contains the fully - qualified class name ('org.hsqldb.jdbc.JDBCDriver') of the HSQLDB implementation - of java.sql.Driver.

    - - Hence, under JDBC 4.0 or greater, applications no longer need to explicitly - load the HSQLDB JDBC driver using Class.forName(). Of course, - existing programs which do load JDBC drivers using - Class.forName() will continue to work without modification. - -


    - - (fredt@users)
    - (campbell-burnet@users)

    - -

    -
    -
    Since:
    -
    HSQLDB 1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCDriver, -JDBCStatement, -JDBCParameterMetaData, -JDBCCallableStatement, -JDBCResultSet, -JDBCDatabaseMetaData, -DriverManager, -Statement, -ResultSet, -DatabaseMetaData
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface java.sql.Connection

        -TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCConnection​(JDBCConnection c, - JDBCConnectionEventListener eventListener) -
      Constructor for use with connection pooling and XA.
      -
      JDBCConnection​(org.hsqldb.persist.HsqlProperties props) -
      Constructs a new external Connection to an HSQLDB - Database.
      -
      JDBCConnection​(org.hsqldb.SessionInterface c) -
      Constructs an INTERNAL Connection, - using the specified SessionInterface.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidabort​(java.util.concurrent.Executor executor) -
      Terminates an open connection.
      -
      voidclearWarnings() -
      Clears all warnings reported for this Connection object.
      -
      voidclose() -
      Releases this Connection object's database and JDBC resources - immediately instead of waiting for them to be automatically released.
      -
      voidcloseFully() -
      Completely closes a pooled connection
      -
      voidcommit() -
      Makes all changes made since the previous - commit/rollback permanent and releases any database locks - currently held by this Connection object.
      -
      java.sql.ArraycreateArrayOf​(java.lang.String typeName, - java.lang.Object[] elements) -
      Factory method for creating Array objects.
      -
      java.sql.BlobcreateBlob() -
      Constructs an object that implements the Blob interface.
      -
      java.sql.ClobcreateClob() -
      Constructs an object that implements the Clob interface.
      -
      java.sql.NClobcreateNClob() -
      Constructs an object that implements the NClob interface.
      -
      java.sql.SQLXMLcreateSQLXML() -
      Constructs an object that implements the SQLXML interface.
      -
      java.sql.StatementcreateStatement() -
      Creates a Statement object for sending - SQL statements to the database.
      -
      java.sql.StatementcreateStatement​(int resultSetType, - int resultSetConcurrency) -
      Creates a Statement object that will generate - ResultSet objects with the given type and concurrency.
      -
      java.sql.StatementcreateStatement​(int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) -
      Creates a Statement object that will generate - ResultSet objects with the given type, concurrency, - and holdability.
      -
      java.sql.StructcreateStruct​(java.lang.String typeName, - java.lang.Object[] attributes) -
      Factory method for creating Struct objects.
      -
      booleangetAutoCommit() -
      Retrieves the current auto-commit mode for this Connection - object.
      -
      java.lang.StringgetCatalog() -
      Retrieves this Connection object's current catalog name.
      -
      java.util.PropertiesgetClientInfo() -
      Returns a list containing the name and current value of each client info - property supported by the driver.
      -
      java.lang.StringgetClientInfo​(java.lang.String name) -
      Returns the value of the client info property specified by name.
      -
      org.hsqldb.persist.HsqlPropertiesgetConnProperties() 
      intgetHoldability() -
      Retrieves the current holdability of ResultSet objects - created using this Connection object.
      -
      java.sql.DatabaseMetaDatagetMetaData() -
      Retrieves a DatabaseMetaData object that contains - metadata about the database to which this - Connection object represents a connection.
      -
      intgetNetworkTimeout() -
      Retrieves the number of milliseconds the driver will - wait for a database request to complete.
      -
      java.lang.StringgetSchema() -
      Retrieves this Connection object's current schema name.
      -
      org.hsqldb.SessionInterfacegetSession() -
      provides cross-package access to the proprietary (i.e.
      -
      intgetTransactionIsolation() -
      Retrieves this Connection object's current - transaction isolation level.
      -
      java.util.Map<java.lang.String,​java.lang.Class<?>>getTypeMap() -
      Retrieves the Map object associated with this - Connection object.
      -
      java.lang.StringgetURL() -
      Retrieves this connection's JDBC url.
      -
      java.sql.SQLWarninggetWarnings() -
      Retrieves the first warning reported by calls on this - Connection object.
      -
      booleanisClosed() -
      Retrieves whether this Connection object has been - closed.
      -
      booleanisInternal() 
      booleanisNetwork() 
      booleanisReadOnly() -
      Retrieves whether this Connection - object is in read-only mode.
      -
      booleanisValid​(int timeout) -
      Returns true if the connection has not been closed and is still valid.
      -
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      java.lang.StringnativeSQL​(java.lang.String sql) -
      Converts the given SQL statement into the system's native SQL grammar.
      -
      java.sql.CallableStatementprepareCall​(java.lang.String sql) -
      Creates a CallableStatement object for calling - database stored procedures.
      -
      java.sql.CallableStatementprepareCall​(java.lang.String sql, - int resultSetType, - int resultSetConcurrency) -
      Creates a CallableStatement object that will generate - ResultSet objects with the given type and concurrency.
      -
      java.sql.CallableStatementprepareCall​(java.lang.String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) -
      Creates a CallableStatement object that will generate - ResultSet objects with the given type and concurrency.
      -
      java.sql.PreparedStatementprepareStatement​(java.lang.String sql) -
      Creates a PreparedStatement object for sending - parameterized SQL statements to the database.
      -
      java.sql.PreparedStatementprepareStatement​(java.lang.String sql, - int autoGeneratedKeys) -
      Creates a default PreparedStatement object that has - the capability to retrieve auto-generated keys.
      -
      java.sql.PreparedStatementprepareStatement​(java.lang.String sql, - int[] columnIndexes) -
      Creates a default PreparedStatement object capable - of returning the auto-generated keys designated by the given array.
      -
      java.sql.PreparedStatementprepareStatement​(java.lang.String sql, - int resultSetType, - int resultSetConcurrency) -
      Creates a PreparedStatement object that will generate - ResultSet objects with the given type and concurrency.
      -
      java.sql.PreparedStatementprepareStatement​(java.lang.String sql, - int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) -
      Creates a PreparedStatement object that will generate - ResultSet objects with the given type, concurrency, - and holdability.
      -
      java.sql.PreparedStatementprepareStatement​(java.lang.String sql, - java.lang.String[] columnNames) -
      Creates a default PreparedStatement object capable - of returning the auto-generated keys designated by the given array.
      -
      voidreleaseSavepoint​(java.sql.Savepoint savepoint) -
      Removes the specified Savepoint (JDBC4 Clarification:) and subsequent Savepoint objects from the current - transaction.
      -
      voidreset() -
      Resets this connection so it can be used again.
      -
      voidrollback() -
      Undoes all changes made in the current transaction - and releases any database locks currently held - by this Connection object.
      -
      voidrollback​(java.sql.Savepoint savepoint) -
      Undoes all changes made after the given Savepoint object - was set.
      -
      voidsetAutoCommit​(boolean autoCommit) -
      Sets this connection's auto-commit mode to the given state.
      -
      voidsetCatalog​(java.lang.String catalog) -
      Sets the given catalog name in order to select - a subspace of this Connection object's database - in which to work.
      -
      voidsetClientInfo​(java.lang.String name, - java.lang.String value) -
      Sets the value of the client info property specified by name to the - value specified by value.
      -
      voidsetClientInfo​(java.util.Properties properties) -
      Sets the value of the connection's client info properties.
      -
      voidsetHoldability​(int holdability) -
      (JDBC4 Clarification:) - Changes the default holdability of ResultSet objects - created using this Connection object to the given - holdability.
      -
      voidsetNetworkTimeout​(java.util.concurrent.Executor executor, - int milliseconds) -
      Sets the maximum period a Connection or - objects created from the Connection - will wait for the database to reply to any one request.
      -
      voidsetReadOnly​(boolean readOnly) -
      Puts this connection in read-only mode as a hint to the driver to enable - database optimizations.
      -
      java.sql.SavepointsetSavepoint() -
      Creates an unnamed savepoint in the current transaction and - returns the new Savepoint object that represents it.
      -
      java.sql.SavepointsetSavepoint​(java.lang.String name) -
      Creates a savepoint with the given name in the current transaction - and returns the new Savepoint object that represents it.
      -
      voidsetSchema​(java.lang.String schema) -
      Sets the given schema name to access.
      -
      voidsetTransactionIsolation​(int level) -
      Attempts to change the transaction isolation level for this - Connection object to the one given.
      -
      voidsetTypeMap​(java.util.Map<java.lang.String,​java.lang.Class<?>> map) -
      Installs the given TypeMap object as the type map for - this Connection object.
      -
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.sql.Connection

        -beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCConnection

        -
        public JDBCConnection​(org.hsqldb.persist.HsqlProperties props)
        -               throws java.sql.SQLException
        -
        Constructs a new external Connection to an HSQLDB - Database.

        - - This constructor is called on behalf of the - java.sql.DriverManager when getting a - Connection for use in normal (external) - client code.

        - - Internal client code, that being code located in HSQLDB SQL - functions and stored procedures, receives an INTERNAL - connection constructed by the JDBCConnection(SessionInterface) constructor.

        -
        -
        Parameters:
        -
        props - A Properties object containing the connection - properties
        -
        Throws:
        -
        java.sql.SQLException - when the user/password combination is - invalid, the connection url is invalid, or the - Database is unavailable.

        - - The Database may be unavailable for a number - of reasons, including network problems or the fact that it - may already be in use by another process.

        -
        -
      • -
      - - - -
        -
      • -

        JDBCConnection

        -
        public JDBCConnection​(org.hsqldb.SessionInterface c)
        -
        Constructs an INTERNAL Connection, - using the specified SessionInterface.

        - - This constructor is called only on behalf of an existing - Session (the internal parallel of a - Connection), to be used as a parameter to a SQL - function or stored procedure that needs to execute in the context - of that Session.

        - - When a Java SQL function or stored procedure is called and its - first parameter is of type Connection, HSQLDB - automatically notices this and constructs an INTERNAL - Connection using the current Session. - HSQLDB then passes this Connection in the first - parameter position, moving any other parameter values - specified in the SQL statement to the right by one position. -

        - - To read more about this, see - Routine.

        - - Notes:

        - - Starting with HSQLDB 1.7.2, INTERNAL connections are not - closed by a call to close() or by a SQL DISCONNECT. - - For HSQLDB developers not involved with writing database - internals, this change only applies to connections obtained - automatically from the database as the first parameter to - Java stored procedures and functions. This is mainly an issue - to developers writing custom SQL function and stored procedure - libraries for HSQLDB. Presently, it is recommended that SQL function and - stored procedure code avoid depending on closing or issuing a - DISCONNECT on a connection obtained in this manner.

        -
        -
        Parameters:
        -
        c - the Session requesting the construction of this - Connection
        -
        Throws:
        -
        org.hsqldb.HsqlException - never (reserved for future use);
        -
        See Also:
        -
        Routine
        -
        -
      • -
      - - - -
        -
      • -

        JDBCConnection

        -
        public JDBCConnection​(JDBCConnection c,
        -                      JDBCConnectionEventListener eventListener)
        -
        Constructor for use with connection pooling and XA.
        -
        -
        Parameters:
        -
        c - the connection
        -
        eventListener - the listener
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createStatement

        -
        public java.sql.Statement createStatement()
        -                                   throws java.sql.SQLException
        -
        - - Creates a Statement object for sending - SQL statements to the database. - SQL statements without parameters are normally - executed using Statement objects. If the same SQL statement - is executed many times, it may be more efficient to use a - PreparedStatement object. -

        - Result sets created using the returned Statement - object will by default be type TYPE_FORWARD_ONLY - and have a concurrency level of CONCUR_READ_ONLY. - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 1.7.2, support for precompilation at the engine level - has been implemented, so it is now much more efficient and performant - to use a PreparedStatement object if the same short-running - SQL statement is to be executed many times.

        - - HSQLDB supports TYPE_FORWARD_ONLY, - TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY - results.

        - -

        -
        -
        Specified by:
        -
        createStatement in interface java.sql.Connection
        -
        Returns:
        -
        a new default Statement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 clarification:) - or this method is called on a closed connection
        -
        See Also:
        -
        createStatement(int,int), -createStatement(int,int,int)
        -
        -
      • -
      - - - -
        -
      • -

        prepareStatement

        -
        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql)
        -                                            throws java.sql.SQLException
        -
        - - Creates a PreparedStatement object for sending - parameterized SQL statements to the database. -

        - A SQL statement with or without IN parameters can be - pre-compiled and stored in a PreparedStatement object. This - object can then be used to efficiently execute this statement - multiple times. - -

        Note: This method is optimized for handling - parametric SQL statements that benefit from precompilation. If - the driver supports precompilation, - the method prepareStatement will send - the statement to the database for precompilation. Some drivers - may not support precompilation. In this case, the statement may - not be sent to the database until the PreparedStatement - object is executed. This has no direct effect on users; however, it does - affect which methods throw certain SQLException objects. -

        - Result sets created using the returned PreparedStatement - object will by default be type TYPE_FORWARD_ONLY - and have a concurrency level of CONCUR_READ_ONLY. - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 1.7.2, support for precompilation at the engine level - has been implemented, so it is now much more efficient and performant - to use a PreparedStatement object if the same short-running - SQL statement is to be executed many times.

        - - The support for and behaviour of PreparedStatement complies with SQL and - JDBC standards. Please read the introductory section - of the documentation for ${link JDBCParameterMetaData}.

        - -

        -
        -
        Specified by:
        -
        prepareStatement in interface java.sql.Connection
        -
        Parameters:
        -
        sql - an SQL statement that may contain one or more '?' IN - parameter placeholders
        -
        Returns:
        -
        a new default PreparedStatement object containing the - pre-compiled SQL statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 clarification:) - or this method is called on a closed connection
        -
        See Also:
        -
        prepareStatement(String,int,int)
        -
        -
      • -
      - - - -
        -
      • -

        prepareCall

        -
        public java.sql.CallableStatement prepareCall​(java.lang.String sql)
        -                                       throws java.sql.SQLException
        -
        - - Creates a CallableStatement object for calling - database stored procedures. - The CallableStatement object provides - methods for setting up its IN and OUT parameters, and - methods for executing the call to a stored procedure. - -

        Note: This method is optimized for handling stored - procedure call statements. Some drivers may send the call - statement to the database when the method prepareCall - is done; others - may wait until the CallableStatement object - is executed. This has no - direct effect on users; however, it does affect which method - throws certain SQLExceptions. -

        - Result sets created using the returned CallableStatement - object will by default be type TYPE_FORWARD_ONLY - and have a concurrency level of CONCUR_READ_ONLY. - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with 1.7.2, the support for and behaviour of - CallableStatement has changed. Please read the introductory section - of the documentation for org.hsqldb.jdbc.JDBCCallableStatement. - -

        -
        -
        Specified by:
        -
        prepareCall in interface java.sql.Connection
        -
        Parameters:
        -
        sql - an SQL statement that may contain one or more '?' - parameter placeholders. (JDBC4 clarification:) Typically this statement is specified using JDBC - call escape syntax.
        -
        Returns:
        -
        a new default CallableStatement object containing the - pre-compiled SQL statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 clarification:) - or this method is called on a closed connection
        -
        See Also:
        -
        prepareCall(String,int,int)
        -
        -
      • -
      - - - -
        -
      • -

        nativeSQL

        -
        public java.lang.String nativeSQL​(java.lang.String sql)
        -                           throws java.sql.SQLException
        -
        - - Converts the given SQL statement into the system's native SQL grammar. - A driver may convert the JDBC SQL grammar into its system's - native SQL grammar prior to sending it. This method returns the - native form of the statement that the driver would have sent. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the JDBC SQL - grammar into the system's native SQL grammar prior to sending - it, if escape processing is set true; this method returns the - native form of the statement that the driver would send in place - of client-specified JDBC SQL grammar.

        - - Before 1.7.2, escape processing was incomplete and - also broken in terms of support for nested escapes.

        - - Starting with 1.7.2, escape processing is complete and handles nesting - to arbitrary depth, but enforces a very strict interpretation of the - syntax and does not detect or process SQL comments.

        - - In essence, the HSQLDB engine directly handles the prescribed syntax - and date / time formats specified internal to the JDBC escapes. - It also directly offers the XOpen / ODBC extended scalar - functions specified available internal to the {fn ...} JDBC escape. - As such, the driver simply removes the curly braces and JDBC escape - codes in the simplest and fastest fashion possible, by replacing them - with whitespace. - - But to avoid a great deal of complexity, certain forms of input - whitespace are currently not recognised. For instance, - the driver handles "{?= call ...}" but not "{ ?= call ...} or - "{? = call ...}"

        - - Also, comments embedded in SQL are currently not detected or - processed and thus may have unexpected effects on the output - of this method, for instance causing otherwise valid SQL to become - invalid. It is especially important to be aware of this because escape - processing is set true by default for Statement objects and is always - set true when producing a PreparedStatement from prepareStatement() - or CallableStatement from prepareCall(). Currently, it is simply - recommended to avoid submitting SQL having comments containing JDBC - escape sequence patterns and/or single or double quotation marks, - as this will avoid any potential problems. - - It is intended to implement a less strict handling of whitespace and - proper processing of SQL comments at some point in the near future. - - In any event, 1.7.2 now correctly processes the following JDBC escape - forms to arbitrary nesting depth, but only if the exact whitespace - layout described below is used: - -

          -
        1. {call ...} -
        2. {?= call ...} -
        3. {fn ...} -
        4. {oj ...} -
        5. {d ...} -
        6. {t ...} -
        7. {ts ...} -

        - -

        -
        -
        Specified by:
        -
        nativeSQL in interface java.sql.Connection
        -
        Parameters:
        -
        sql - an SQL statement that may contain one or more '?' - parameter placeholders
        -
        Returns:
        -
        the native form of this statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 clarification:) - or this method is called on a closed connection
        -
        -
      • -
      - - - -
        -
      • -

        setAutoCommit

        -
        public void setAutoCommit​(boolean autoCommit)
        -                   throws java.sql.SQLException
        -
        - - Sets this connection's auto-commit mode to the given state. - If a connection is in auto-commit mode, then all its SQL - statements will be executed and committed as individual - transactions. Otherwise, its SQL statements are grouped into - transactions that are terminated by a call to either - the method commit or the method rollback. - By default, new connections are in auto-commit - mode. -

        - The commit occurs when the statement completes. The time when the statement - completes depends on the type of SQL Statement: -

          -
        • For DML statements, such as Insert, Update or Delete, and DDL statements, - the statement is complete as soon as it has finished executing. -
        • For Select statements, the statement is complete when the associated result - set is closed. -
        • For CallableStatement objects or for statements that return - multiple results, the statement is complete - when all of the associated result sets have been closed, and all update - counts and output parameters have been retrieved. -
        -

        - NOTE: If this method is called during a transaction and the - auto-commit mode is changed, the transaction is committed. If - setAutoCommit is called and the auto-commit mode is - not changed, the call is a no-op. - - - -

        -

        HSQLDB-Specific Information:

        - - Up to and including HSQLDB 2.0, - -

          -
        1. All rows of a result set are retrieved internally - before the first row can actually be fetched.
          - Therefore, a statement can be considered complete as soon as - any XXXStatement.executeXXX method returns.
        2. -
        -

        - - Starting with 2.0, HSQLDB may not return a result set to the network - client as a whole; the generic documentation will apply. The fetch - size is taken into account - - (campbell-burnet@users)

        -
        -
        Specified by:
        -
        setAutoCommit in interface java.sql.Connection
        -
        Parameters:
        -
        autoCommit - true to enable auto-commit mode; - false to disable it
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - (JDBC4 Clarification:) - setAutoCommit(true) is called while participating in a distributed transaction, - or this method is called on a closed connection
        -
        See Also:
        -
        getAutoCommit()
        -
        -
      • -
      - - - -
        -
      • -

        getAutoCommit

        -
        public boolean getAutoCommit()
        -                      throws java.sql.SQLException
        -
        Retrieves the current auto-commit mode for this Connection - object.
        -
        -
        Specified by:
        -
        getAutoCommit in interface java.sql.Connection
        -
        Returns:
        -
        the current state of this Connection object's - auto-commit mode
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        See Also:
        -
        setAutoCommit(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        commit

        -
        public void commit()
        -            throws java.sql.SQLException
        -
        - - Makes all changes made since the previous - commit/rollback permanent and releases any database locks - currently held by this Connection object. - This method should be - used only when auto-commit mode has been disabled. - - - -
        -

        HSQLDB-Specific Information:

        -

        -
        -
        Specified by:
        -
        commit in interface java.sql.Connection
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - (JDBC4 Clarification:) - this method is called while participating in a distributed transaction, - if this method is called on a closed connection or this - Connection object is in auto-commit mode
        -
        See Also:
        -
        setAutoCommit(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        rollback

        -
        public void rollback()
        -              throws java.sql.SQLException
        -
        - - Undoes all changes made in the current transaction - and releases any database locks currently held - by this Connection object. This method should be - used only when auto-commit mode has been disabled. - - - -
        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 1.7.2, savepoints are fully supported both - in SQL and via the JDBC interface.

        - - Using SQL, savepoints may be set, released and used in rollback - as follows: - -

        - SAVEPOINT <savepoint-name>
        - RELEASE SAVEPOINT <savepoint-name>
        - ROLLBACK TO SAVEPOINT <savepoint-name>
        - 
        - -
        -
        -
        Specified by:
        -
        rollback in interface java.sql.Connection
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - (JDBC4 Clarification:) - this method is called while participating in a distributed transaction, - this method is called on a closed connection or this - Connection object is in auto-commit mode
        -
        See Also:
        -
        setAutoCommit(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.sql.SQLException
        -
        - - Releases this Connection object's database and JDBC resources - immediately instead of waiting for them to be automatically released. -

        - Calling the method close on a Connection - object that is already closed is a no-op. -

        - It is strongly recommended that an application explicitly - commits or rolls back an active transaction prior to calling the - close method. If the close method is called - and there is an active transaction, the results are implementation-defined. - - - -

        -

        HSQLDB-Specific Information:

        - - From 1.7.2, HSQLDB INTERNAL Connection - objects are not closable from JDBC client code.

        - -

        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.sql.Connection
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -                 throws java.sql.SQLException
        -
        Retrieves whether this Connection object has been - closed. A connection is closed if the method close - has been called on it or if certain fatal errors have occurred. - This method is guaranteed to return true only when - it is called after the method Connection.close has - been called. -

        - This method generally cannot be called to determine whether a - connection to a database is valid or invalid. A typical client - can determine that a connection is invalid by catching any - exceptions that might be thrown when an operation is attempted.

        -
        -
        Specified by:
        -
        isClosed in interface java.sql.Connection
        -
        Returns:
        -
        true if this Connection object - is closed; false if it is still open
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMetaData

        -
        public java.sql.DatabaseMetaData getMetaData()
        -                                      throws java.sql.SQLException
        -
        - - Retrieves a DatabaseMetaData object that contains - metadata about the database to which this - Connection object represents a connection. - The metadata includes information about the database's - tables, its supported SQL grammar, its stored - procedures, the capabilities of this connection, and so on. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 essentially supports full database metadata.

        - - For discussion in greater detail, please follow the link to the - overview for JDBCDatabaseMetaData, below. - -

        -
        -
        Specified by:
        -
        getMetaData in interface java.sql.Connection
        -
        Returns:
        -
        a DatabaseMetaData object for this - Connection object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification) - or this method is called on a closed connection
        -
        See Also:
        -
        JDBCDatabaseMetaData
        -
        -
      • -
      - - - -
        -
      • -

        setReadOnly

        -
        public void setReadOnly​(boolean readOnly)
        -                 throws java.sql.SQLException
        -
        - - Puts this connection in read-only mode as a hint to the driver to enable - database optimizations. - -

        Note: This method cannot be called during a transaction. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports the SQL standard, which will not allow calls to - this method to succeed during a transaction.

        - - Additionally, HSQLDB provides a way to put a whole database in - read-only mode. This is done by manually adding the line - 'readonly=true' to the database's .properties file while the - database is offline. Upon restart, all connections will be - readonly, since the entire database will be readonly. To take - a database out of readonly mode, simply take the database - offline and remove the line 'readonly=true' from the - database's .properties file. Upon restart, the database will - be in regular (read-write) mode.

        - - When a database is put in readonly mode, its files are opened - in readonly mode, making it possible to create CD-based - readonly databases. To create a CD-based readonly database - that has CACHED tables and whose .data file is suspected of - being highly fragmented, it is recommended that the database - first be SHUTDOWN COMPACTed before copying the database - files to CD. This will reduce the space required and may - improve access times against the .data file which holds the - CACHED table data.

        - - Starting with 1.7.2, an alternate approach to opimizing the - .data file before creating a CD-based readonly database is to issue - the CHECKPOINT DEFRAG command followed by SHUTDOWN to take the - database offline in preparation to burn the database files to CD.

        - -

        -
        -
        Specified by:
        -
        setReadOnly in interface java.sql.Connection
        -
        Parameters:
        -
        readOnly - true enables read-only mode; - false disables it
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection or this - method is called during a transaction
        -
        -
      • -
      - - - -
        -
      • -

        isReadOnly

        -
        public boolean isReadOnly()
        -                   throws java.sql.SQLException
        -
        Retrieves whether this Connection - object is in read-only mode.
        -
        -
        Specified by:
        -
        isReadOnly in interface java.sql.Connection
        -
        Returns:
        -
        true if this Connection object - is read-only; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        -
      • -
      - - - -
        -
      • -

        setCatalog

        -
        public void setCatalog​(java.lang.String catalog)
        -                throws java.sql.SQLException
        -
        - - Sets the given catalog name in order to select - a subspace of this Connection object's database - in which to work. -

        - - (JDBC4 Clarification:)

        - If the driver does not support catalogs, it will - silently ignore this request. - JDBC 4.1[

        - Calling setCatalog has no effect on previously created or prepared - Statement objects. It is implementation defined whether a DBMS - prepare operation takes place immediately when the Connection - method prepareStatement or prepareCall is invoked. - For maximum portability, setCatalog should be called before a - Statement is created or prepared.] - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports a single catalog per database. If the given catalog name - is not the same as the database catalog name, this method throws an - error.

        -

        -
        -
        Specified by:
        -
        setCatalog in interface java.sql.Connection
        -
        Parameters:
        -
        catalog - the name of a catalog (subspace in this - Connection object's database) in which to work
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification) - or this method is called on a closed connection
        -
        See Also:
        -
        getCatalog()
        -
        -
      • -
      - - - -
        -
      • -

        getCatalog

        -
        public java.lang.String getCatalog()
        -                            throws java.sql.SQLException
        -
        - - Retrieves this Connection object's current catalog name. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports a single catalog per database. This method - returns the catalog name for the current database - error.

        - -

        -
        -
        Specified by:
        -
        getCatalog in interface java.sql.Connection
        -
        Returns:
        -
        the current catalog name or null if there is none
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        See Also:
        -
        setCatalog(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        setTransactionIsolation

        -
        public void setTransactionIsolation​(int level)
        -                             throws java.sql.SQLException
        -
        - - Attempts to change the transaction isolation level for this - Connection object to the one given. - The constants defined in the interface Connection - are the possible transaction isolation levels. -

        - Note: If this method is called during a transaction, the result - is implementation-defined. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 accepts all isolation levels. Connection.TRANSACTION_READ_UNCOMMITED - is promoted to Connection.TRANSACTION_READ_COMMITED, but the transactions become read only. - Calling this method during a transaction always succeeds and the selected - isolation level is used from the next transaction.

        - -

        -
        -
        Specified by:
        -
        setTransactionIsolation in interface java.sql.Connection
        -
        Parameters:
        -
        level - one of the following Connection constants: - Connection.TRANSACTION_READ_UNCOMMITTED, - Connection.TRANSACTION_READ_COMMITTED, - Connection.TRANSACTION_REPEATABLE_READ, or - Connection.TRANSACTION_SERIALIZABLE. - (Note that Connection.TRANSACTION_NONE cannot be used - because it specifies that transactions are not supported.)
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 End Clarification) - or the given parameter is not one of the Connection - constants
        -
        See Also:
        -
        JDBCDatabaseMetaData.supportsTransactionIsolationLevel(int), -getTransactionIsolation()
        -
        -
      • -
      - - - -
        -
      • -

        getTransactionIsolation

        -
        public int getTransactionIsolation()
        -                            throws java.sql.SQLException
        -
        - - Retrieves this Connection object's current - transaction isolation level. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports all isolation levels. Connection.TRANSACTION_READ_UNCOMMITED - is promoted to Connection.TRANSACTION_READ_COMMITED. - -

        -
        -
        Specified by:
        -
        getTransactionIsolation in interface java.sql.Connection
        -
        Returns:
        -
        the current transaction isolation level, which will be one - of the following constants: - Connection.TRANSACTION_READ_UNCOMMITTED, - Connection.TRANSACTION_READ_COMMITTED, - Connection.TRANSACTION_REPEATABLE_READ, - Connection.TRANSACTION_SERIALIZABLE, or - Connection.TRANSACTION_NONE.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        See Also:
        -
        JDBCDatabaseMetaData.supportsTransactionIsolationLevel(int), -setTransactionIsolation(int)
        -
        -
      • -
      - - - -
        -
      • -

        getWarnings

        -
        public java.sql.SQLWarning getWarnings()
        -                                throws java.sql.SQLException
        -
        - - Retrieves the first warning reported by calls on this - Connection object. If there is more than one - warning, subsequent warnings will be chained to the first one - and can be retrieved by calling the method - SQLWarning.getNextWarning on the warning - that was retrieved previously. -

        - This method may not be - called on a closed connection; doing so will cause an - SQLException to be thrown. - -

        Note: Subsequent warnings will be chained to this - SQLWarning. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB produces warnings whenever a createStatement(), - prepareStatement() or prepareCall() invocation requests an unsupported - but defined combination of result set type, concurrency and holdability, - such that another set is substituted.

        - Other warnings are typically raised during the execution of data change - and query statements.

        - - Only the warnings caused by the last operation on this connection are - returned by this method. A single operation may return up to 10 chained - warnings. - -

        -
        -
        Specified by:
        -
        getWarnings in interface java.sql.Connection
        -
        Returns:
        -
        the first SQLWarning object or null - if there are none
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed connection
        -
        See Also:
        -
        SQLWarning
        -
        -
      • -
      - - - -
        -
      • -

        clearWarnings

        -
        public void clearWarnings()
        -                   throws java.sql.SQLException
        -
        - - Clears all warnings reported for this Connection object. - After a call to this method, the method getWarnings - returns null until a new warning is - reported for this Connection object. - - - -
        -

        HSQLDB-Specific Information:

        - - The standard behaviour is implemented.

        - -

        -
        -
        Specified by:
        -
        clearWarnings in interface java.sql.Connection
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        -
      • -
      - - - -
        -
      • -

        createStatement

        -
        public java.sql.Statement createStatement​(int resultSetType,
        -                                          int resultSetConcurrency)
        -                                   throws java.sql.SQLException
        -
        - - Creates a Statement object that will generate - ResultSet objects with the given type and concurrency. - This method is the same as the createStatement method - above, but it allows the default result set - type and concurrency to be overridden. - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - interpretation of of resultSetType and resultSetConcurrency has - changed in this version.

        - - HSQLDB supports TYPE_FORWARD_ONLY, - TYPE_SCROLL_INSENSITIVE, - CONCUR_READ_ONLY, - CONCUR_UPDATABLE - results.

        - - If an unsupported combination is requested, a SQLWarning is issued on - this Connection and the closest supported combination is used instead.

        - -

        -
        -
        Specified by:
        -
        createStatement in interface java.sql.Connection
        -
        Parameters:
        -
        resultSetType - a result set type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        resultSetConcurrency - a concurrency type; one of - ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        Returns:
        -
        a new Statement object that will generate - ResultSet objects with the given type and - concurrency
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 Clarification) - or the given parameters are not ResultSet - constants indicating type and concurrency
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method or this method is not supported for the specified result - set type and result set concurrency.
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        prepareStatement

        -
        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
        -                                                   int resultSetType,
        -                                                   int resultSetConcurrency)
        -                                            throws java.sql.SQLException
        -
        - - Creates a PreparedStatement object that will generate - ResultSet objects with the given type and concurrency. - This method is the same as the prepareStatement method - above, but it allows the default result set - type and concurrency to be overridden. - (JDBC4 Clarification:) - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - interpretation of of resultSetType and resultSetConcurrency has - changed in this version.

        - - HSQLDB supports TYPE_FORWARD_ONLY, - TYPE_SCROLL_INSENSITIVE, - CONCUR_READ_ONLY, - CONCUR_UPDATABLE - results.

        - - If an unsupported combination is requested, a SQLWarning is issued on - this Connection and the closest supported combination is used instead.

        - -

        -
        -
        Specified by:
        -
        prepareStatement in interface java.sql.Connection
        -
        Parameters:
        -
        sql - a String object that is the SQL statement to - be sent to the database; may contain one or more '?' IN - parameters
        -
        resultSetType - a result set type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        resultSetConcurrency - a concurrency type; one of - ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        Returns:
        -
        a new PreparedStatement object containing the - pre-compiled SQL statement that will produce ResultSet - objects with the given type and concurrency
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 Clarification) - or the given parameters are not ResultSet - constants indicating type and concurrency
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method or this method is not supported for the specified result - set type and result set concurrency.
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        prepareCall

        -
        public java.sql.CallableStatement prepareCall​(java.lang.String sql,
        -                                              int resultSetType,
        -                                              int resultSetConcurrency)
        -                                       throws java.sql.SQLException
        -
        - - Creates a CallableStatement object that will generate - ResultSet objects with the given type and concurrency. - This method is the same as the prepareCall method - above, but it allows the default result set - type and concurrency to be overridden. - (JDBC4 Clarification:) - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - interpretation of of resultSetType and resultSetConcurrency has - changed in this version.

        - - HSQLDB supports TYPE_FORWARD_ONLY, - TYPE_SCROLL_INSENSITIVE, - CONCUR_READ_ONLY, - CONCUR_UPDATABLE - results.

        - - If an unsupported combination is requested, a SQLWarning is issued on - this Connection and the closest supported combination is used instead.

        - -

        -
        -
        Specified by:
        -
        prepareCall in interface java.sql.Connection
        -
        Parameters:
        -
        sql - a String object that is the SQL statement to - be sent to the database; may contain on or more '?' parameters
        -
        resultSetType - a result set type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        resultSetConcurrency - a concurrency type; one of - ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        Returns:
        -
        a new CallableStatement object containing the - pre-compiled SQL statement that will produce ResultSet - objects with the given type and concurrency
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this method - (JDBC4 Clarification:) - is called on a closed connection - (:JDBC4 Clarification) - or the given parameters are not ResultSet - constants indicating type and concurrency
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method or this method is not supported for the specified result - set type and result set concurrency.
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getTypeMap

        -
        public java.util.Map<java.lang.String,​java.lang.Class<?>> getTypeMap()
        -                                                                    throws java.sql.SQLException
        -
        - - Retrieves the Map object associated with this - Connection object. - Unless the application has added an entry, the type map returned - will be empty. - JDBC 4.1[

        - You must invoke setTypeMap after making changes to the - Map object returned from - getTypeMap as a JDBC driver may create an internal - copy of the Map object passed to setTypeMap: -

        -      Map<String,Class<?>> myMap = con.getTypeMap();
        -      myMap.put("mySchemaName.ATHLETES", Athletes.class);
        -      con.setTypeMap(myMap);
        - 
        ] - - -
        -

        HSQLDB-Specific Information:

        - - For compatibility, HSQLDB returns an empty map.

        - -

        -
        -
        Specified by:
        -
        getTypeMap in interface java.sql.Connection
        -
        Returns:
        -
        the java.util.Map object associated - with this Connection object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setTypeMap(java.util.Map<java.lang.String, java.lang.Class<?>>)
        -
        -
      • -
      - - - -
        -
      • -

        setTypeMap

        -
        public void setTypeMap​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
        -                throws java.sql.SQLException
        -
        - - Installs the given TypeMap object as the type map for - this Connection object. The type map will be used for the - custom mapping of SQL structured types and distinct types. - JDBC4.1[

        - You must set the values for the TypeMap prior to - calling setMap as a JDBC driver may create an internal copy - of the TypeMap: - -

        -      Map myMap<String,Class<?>> = new HashMap<String,Class<?>>();
        -      myMap.put("mySchemaName.ATHLETES", Athletes.class);
        -      con.setTypeMap(myMap);
        - 
        ] - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not yet support this feature. Calling this - method always throws a SQLException, stating that - the function is not supported.

        - -

        -
        -
        Specified by:
        -
        setTypeMap in interface java.sql.Connection
        -
        Parameters:
        -
        map - the java.util.Map object to install - as the replacement for this Connection - object's default type map
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection or - (:JDBC4 Clarification) - the given parameter is not a java.util.Map - object
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        getTypeMap()
        -
        -
      • -
      - - - -
        -
      • -

        setHoldability

        -
        public void setHoldability​(int holdability)
        -                    throws java.sql.SQLException
        -
        - - (JDBC4 Clarification:) - Changes the default holdability of ResultSet objects - created using this Connection object to the given - holdability. The default holdability of ResultSet objects - can be determined by invoking - DatabaseMetaData.getResultSetHoldability(). - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        Specified by:
        -
        setHoldability in interface java.sql.Connection
        -
        Parameters:
        -
        holdability - a ResultSet holdability constant; one of - ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Throws:
        -
        java.sql.SQLException - if a database access occurs, this method is called - (JDBC4 Clarification:) - on a closed connection, or the given parameter - (JDBC4 Clarification:) - is not a ResultSet constant indicating holdability
        -
        java.sql.SQLFeatureNotSupportedException - if the given holdability is not supported
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        getHoldability(), -DatabaseMetaData.getResultSetHoldability(), -JDBCResultSet
        -
        -
      • -
      - - - -
        -
      • -

        getHoldability

        -
        public int getHoldability()
        -                   throws java.sql.SQLException
        -
        - - Retrieves the current holdability of ResultSet objects - created using this Connection object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB returns the current holdability.

        - - The default is HOLD_CURSORS_OVER_COMMIT.

        - -

        -
        -
        Specified by:
        -
        getHoldability in interface java.sql.Connection
        -
        Returns:
        -
        the holdability, one of - ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        setHoldability(int), -DatabaseMetaData.getResultSetHoldability(), -JDBCResultSet
        -
        -
      • -
      - - - -
        -
      • -

        setSavepoint

        -
        public java.sql.Savepoint setSavepoint()
        -                                throws java.sql.SQLException
        -
        - - Creates an unnamed savepoint in the current transaction and - returns the new Savepoint object that represents it. - -

        (JDBC4 clarification:) if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created - savepoint. - - - -

        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports this feature.

        - - Note: Unnamed savepoints are not part of the SQL:2003 standard. - Use setSavepoint(String name) instead.

        - -

        -
        -
        Specified by:
        -
        setSavepoint in interface java.sql.Connection
        -
        Returns:
        -
        the new Savepoint object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - (JDBC4 Clarification:) - this method is called while participating in a distributed transaction, - this method is called on a closed connection - or this Connection object is currently in - auto-commit mode
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        JDBCSavepoint, -Savepoint
        -
        -
      • -
      - - - -
        -
      • -

        setSavepoint

        -
        public java.sql.Savepoint setSavepoint​(java.lang.String name)
        -                                throws java.sql.SQLException
        -
        - - Creates a savepoint with the given name in the current transaction - and returns the new Savepoint object that represents it. - -

        if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created - savepoint. - - - - -

        -

        HSQLDB-Specific Information:

        - - Previous to JDBC 4, if the connection is autoCommit, - setting a savepoint has no effect, as it is cleared upon the execution - of the next transactional statement. When built for JDBC 4, this method - throws an SQLException when this Connection object is currently - in auto-commit mode, as per the JDBC 4 standard. -

        -
        -
        Specified by:
        -
        setSavepoint in interface java.sql.Connection
        -
        Parameters:
        -
        name - a String containing the name of the savepoint
        -
        Returns:
        -
        the new Savepoint object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - (JDBC4 Clarification:) - this method is called while participating in a distributed transaction, - this method is called on a closed connection - or this Connection object is currently in - auto-commit mode
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        JDBCSavepoint, -Savepoint
        -
        -
      • -
      - - - -
        -
      • -

        rollback

        -
        public void rollback​(java.sql.Savepoint savepoint)
        -              throws java.sql.SQLException
        -
        - - Undoes all changes made after the given Savepoint object - was set. -

        - This method should be used only when auto-commit has been disabled. - - - -

        -

        HSQLDB-Specific Information:

        - - Previous to JDBC 4, JDBCSavepoint objects are valid for the life of - the originating Connection object and hence can be used - interchangeably, as long as they have equal savepoint names.

        - - When built for JDBC 4, JDBCConnection objects invalidate - JDBCSavepoint objects when auto-commit mode is entered as well - as when they are used to successfully release or roll back to a named SQL - savepoint. As per the JDBC 4 standard, when built for JDBC 4, this - method throws an SQLException when this Connection - object is currently in auto-commit mode and an invalidated - JDBCSavepoint is specified. -

        -
        -
        Specified by:
        -
        rollback in interface java.sql.Connection
        -
        Parameters:
        -
        savepoint - the Savepoint object to roll back to
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called while participating in a distributed transaction, - this method is called on a closed connection, - the Savepoint object is no longer valid, - or this Connection object is currently in - auto-commit mode
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        JDBCSavepoint, -Savepoint, -rollback()
        -
        -
      • -
      - - - -
        -
      • -

        releaseSavepoint

        -
        public void releaseSavepoint​(java.sql.Savepoint savepoint)
        -                      throws java.sql.SQLException
        -
        - - Removes the specified Savepoint (JDBC4 Clarification:) and subsequent Savepoint objects from the current - transaction. Any reference to the savepoint after it have been removed - will cause an SQLException to be thrown. - - - - - HSLQDB Note:

        - - Previous to JDBC 4, JDBCSavepoint objects are valid for the life of - the originating Connection object and hence can be used - interchangeably, as long as they have equal savepoint names.

        - - When built for JDBC 4, JDBCConnection objects invalidate - JDBCSavepoint objects when auto-commit mode is entered as well - as when they are used to successfully release or roll back to a named SQL - savepoint. As per the JDBC 4 standard, when built for JDBC 4, this - method throws an SQLException when this Connection - object is currently in auto-commit mode and when an invalidated - JDBCSavepoint is specified.

        -
        -
        Specified by:
        -
        releaseSavepoint in interface java.sql.Connection
        -
        Parameters:
        -
        savepoint - the Savepoint object to be removed
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection or - the given Savepoint object is not a valid - savepoint in the current transaction
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        JDBCSavepoint, -Savepoint
        -
        -
      • -
      - - - -
        -
      • -

        createStatement

        -
        public java.sql.Statement createStatement​(int resultSetType,
        -                                          int resultSetConcurrency,
        -                                          int resultSetHoldability)
        -                                   throws java.sql.SQLException
        -
        - - Creates a Statement object that will generate - ResultSet objects with the given type, concurrency, - and holdability. - This method is the same as the createStatement method - above, but it allows the default result set - type, concurrency, and holdability to be overridden. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - interpretation of of resultSetType and resultSetConcurrency has - changed in this version.

        - - HSQLDB supports TYPE_FORWARD_ONLY, - TYPE_SCROLL_INSENSITIVE, - CONCUR_READ_ONLY, - CONCUR_UPDATABLE - results.

        - - If an unsupported combination is requested, a SQLWarning is issued on - this Connection and the closest supported combination is used instead.

        - -

        -
        -
        Specified by:
        -
        createStatement in interface java.sql.Connection
        -
        Parameters:
        -
        resultSetType - one of the following ResultSet - constants: - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        resultSetConcurrency - one of the following ResultSet - constants: - ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        resultSetHoldability - one of the following ResultSet - constants: - ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Returns:
        -
        a new Statement object that will generate - ResultSet objects with the given type, - concurrency, and holdability
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 Clarification) - or the given parameters are not ResultSet - constants indicating type, concurrency, and holdability
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method or this method is not supported for the specified result - set type, result set holdability and result set concurrency.
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        JDBCResultSet
        -
        -
      • -
      - - - -
        -
      • -

        prepareStatement

        -
        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
        -                                                   int resultSetType,
        -                                                   int resultSetConcurrency,
        -                                                   int resultSetHoldability)
        -                                            throws java.sql.SQLException
        -
        - - Creates a PreparedStatement object that will generate - ResultSet objects with the given type, concurrency, - and holdability. -

        - This method is the same as the prepareStatement method - above, but it allows the default result set - type, concurrency, and holdability to be overridden. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - interpretation of of resultSetType and resultSetConcurrency has - changed in this version.

        - - HSQLDB supports TYPE_FORWARD_ONLY, - TYPE_SCROLL_INSENSITIVE, - CONCUR_READ_ONLY, - CONCUR_UPDATABLE - results.

        - HOLD_CURSORS_OVER_COMMIT is supported only when - CONCUR_READ_ONLY is requested.

        - - - If an unsupported combination is requested, a SQLWarning is issued on - this Connection and the closest supported combination is used instead.

        - -

        -
        -
        Specified by:
        -
        prepareStatement in interface java.sql.Connection
        -
        Parameters:
        -
        sql - a String object that is the SQL statement to - be sent to the database; may contain one or more '?' IN - parameters
        -
        resultSetType - one of the following ResultSet - constants: - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        resultSetConcurrency - one of the following ResultSet - constants: - ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        resultSetHoldability - one of the following ResultSet - constants: - ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Returns:
        -
        a new PreparedStatement object, containing the - pre-compiled SQL statement, that will generate - ResultSet objects with the given type, - concurrency, and holdability
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 Clarification) - or the given parameters are not ResultSet - constants indicating type, concurrency, and holdability
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method or this method is not supported for the specified result - set type, result set holdability and result set concurrency.
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        JDBCResultSet
        -
        -
      • -
      - - - -
        -
      • -

        prepareCall

        -
        public java.sql.CallableStatement prepareCall​(java.lang.String sql,
        -                                              int resultSetType,
        -                                              int resultSetConcurrency,
        -                                              int resultSetHoldability)
        -                                       throws java.sql.SQLException
        -
        - - Creates a CallableStatement object that will generate - ResultSet objects with the given type and concurrency. - This method is the same as the prepareCall method - above, but it allows the default result set - type, result set concurrency type and holdability to be overridden. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - interpretation of of resultSetType and resultSetConcurrency has - changed in this version.

        - - HSQLDB supports TYPE_FORWARD_ONLY, - TYPE_SCROLL_INSENSITIVE, - CONCUR_READ_ONLY, - CONCUR_UPDATABLE - results.

        - - If an unsupported combination is requested, a SQLWarning is issued on - this Connection and the closest supported combination is used instead.

        - -

        -
        -
        Specified by:
        -
        prepareCall in interface java.sql.Connection
        -
        Parameters:
        -
        sql - a String object that is the SQL statement to - be sent to the database; may contain on or more '?' parameters
        -
        resultSetType - one of the following ResultSet - constants: - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        resultSetConcurrency - one of the following ResultSet - constants: - ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        resultSetHoldability - one of the following ResultSet - constants: - ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Returns:
        -
        a new CallableStatement object, containing the - pre-compiled SQL statement, that will generate - ResultSet objects with the given type, - concurrency, and holdability
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 Clarification) - or the given parameters are not ResultSet - constants indicating type, concurrency, and holdability
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method or this method is not supported for the specified result - set type, result set holdability and result set concurrency.
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        JDBCResultSet
        -
        -
      • -
      - - - -
        -
      • -

        prepareStatement

        -
        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
        -                                                   int autoGeneratedKeys)
        -                                            throws java.sql.SQLException
        -
        - - Creates a default PreparedStatement object that has - the capability to retrieve auto-generated keys. The given constant - tells the driver whether it should make auto-generated keys - available for retrieval. This parameter is ignored if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - Note: This method is optimized for handling - parametric SQL statements that benefit from pre-compilation. If - the driver supports pre-compilation, - the method prepareStatement will send - the statement to the database for pre-compilation. Some drivers - may not support pre-compilation. In this case, the statement may - not be sent to the database until the PreparedStatement - object is executed. This has no direct effect on users; however, it does - affect which methods throw certain SQLExceptions. -

        - Result sets created using the returned PreparedStatement - object will by default be type TYPE_FORWARD_ONLY - and have a concurrency level of CONCUR_READ_ONLY. - (JDBC4 Clarification:) - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports returning generated columns - with single-row and multi-row INSERT, UPDATE and MERGE statements.

        - If the table has an IDENTITY or GENERATED column(s) the values for these - columns are returned in the next call to getGeneratedKeys() after each - execution of the PreparedStatement.

        - - HSQLDB also supports returning primary key values from he rows by using the - org.hsqldb.jdbc.JDBCStatement.RETURN_PRIMARY_KEYS constant.

        - -

        -
        -
        Specified by:
        -
        prepareStatement in interface java.sql.Connection
        -
        Parameters:
        -
        sql - an SQL statement that may contain one or more '?' IN - parameter placeholders
        -
        autoGeneratedKeys - a flag indicating whether auto-generated keys - should be returned; one of - Statement.RETURN_GENERATED_KEYS or - Statement.NO_GENERATED_KEYS
        -
        Returns:
        -
        a new PreparedStatement object, containing the - pre-compiled SQL statement, that will have the capability of - returning auto-generated keys
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 Clarification) - or the given parameter is not a Statement - constant indicating whether auto-generated keys should be - returned
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method with a constant of Statement.RETURN_GENERATED_KEYS
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        prepareStatement

        -
        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
        -                                                   int[] columnIndexes)
        -                                            throws java.sql.SQLException
        -
        - Creates a default PreparedStatement object capable - of returning the auto-generated keys designated by the given array. - This array contains the indexes of the columns in the target - table that contain the auto-generated keys that should be made - available. The driver will ignore the array if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - An SQL statement with or without IN parameters can be - pre-compiled and stored in a PreparedStatement object. This - object can then be used to efficiently execute this statement - multiple times. -

        - Note: This method is optimized for handling - parametric SQL statements that benefit from pre-compilation. If - the driver supports pre-compilation, - the method prepareStatement will send - the statement to the database for pre-compilation. Some drivers - may not support pre-compilation. In this case, the statement may - not be sent to the database until the PreparedStatement - object is executed. This has no direct effect on users; however, it does - affect which methods throw certain SQLExceptions. -

        - Result sets created using the returned PreparedStatement - object will by default be type TYPE_FORWARD_ONLY - and have a concurrency level of CONCUR_READ_ONLY. - (JDBC4 Clarification:) - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports returning generated columns - with single-row and multi-row INSERT, UPDATE and MERGE statements.

        - The columnIndexes may specify any set of columns of the table. - -

        -
        -
        Specified by:
        -
        prepareStatement in interface java.sql.Connection
        -
        Parameters:
        -
        sql - an SQL statement that may contain one or more '?' IN - parameter placeholders
        -
        columnIndexes - an array of column indexes indicating the columns - that should be returned from the inserted row or rows
        -
        Returns:
        -
        a new PreparedStatement object, containing the - pre-compiled statement, that is capable of returning the - auto-generated keys designated by the given array of column - indexes
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        prepareStatement

        -
        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
        -                                                   java.lang.String[] columnNames)
        -                                            throws java.sql.SQLException
        -
        - - Creates a default PreparedStatement object capable - of returning the auto-generated keys designated by the given array. - This array contains the names of the columns in the target - table that contain the auto-generated keys that should be returned. - The driver will ignore the array if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - An SQL statement with or without IN parameters can be - pre-compiled and stored in a PreparedStatement object. This - object can then be used to efficiently execute this statement - multiple times. -

        - Note: This method is optimized for handling - parametric SQL statements that benefit from pre-compilation. If - the driver supports pre-compilation, - the method prepareStatement will send - the statement to the database for pre-compilation. Some drivers - may not support pre-compilation. In this case, the statement may - not be sent to the database until the PreparedStatement - object is executed. This has no direct effect on users; however, it does - affect which methods throw certain SQLExceptions. -

        - Result sets created using the returned PreparedStatement - object will by default be type TYPE_FORWARD_ONLY - and have a concurrency level of CONCUR_READ_ONLY. - (JDBC4 Clarification:) - The holdability of the created result sets can be determined by - calling getHoldability(). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports returning generated columns - with single-row and multi-row INSERT, UPDATE and MERGE statements.

        - The columnNames may specify any set of columns of the table. The names - are case-sensitive, unlike column names in ResultSet methods. - -

        -
        -
        Specified by:
        -
        prepareStatement in interface java.sql.Connection
        -
        Parameters:
        -
        sql - an SQL statement that may contain one or more '?' IN - parameter placeholders
        -
        columnNames - an array of column names indicating the columns - that should be returned from the inserted row or rows
        -
        Returns:
        -
        a new PreparedStatement object, containing the - pre-compiled statement, that is capable of returning the - auto-generated keys designated by the given array of column - names
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - (JDBC4 Clarification:) - or this method is called on a closed connection
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        createClob

        -
        public java.sql.Clob createClob()
        -                         throws java.sql.SQLException
        -
        Constructs an object that implements the Clob interface. The object - returned initially contains no data. The setAsciiStream, - setCharacterStream and setString methods of - the Clob interface may be used to add data to the Clob.
        -
        -
        Specified by:
        -
        createClob in interface java.sql.Connection
        -
        Returns:
        -
        An object that implements the Clob interface
        -
        Throws:
        -
        java.sql.SQLException - if an object that implements the - Clob interface can not be constructed, this method is - called on a closed connection or a database access error occurs.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this data type
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        createBlob

        -
        public java.sql.Blob createBlob()
        -                         throws java.sql.SQLException
        -
        Constructs an object that implements the Blob interface. The object - returned initially contains no data. The setBinaryStream and - setBytes methods of the Blob interface may be used to add data to - the Blob.
        -
        -
        Specified by:
        -
        createBlob in interface java.sql.Connection
        -
        Returns:
        -
        An object that implements the Blob interface
        -
        Throws:
        -
        java.sql.SQLException - if an object that implements the - Blob interface can not be constructed, this method is - called on a closed connection or a database access error occurs.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this data type
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        createNClob

        -
        public java.sql.NClob createNClob()
        -                           throws java.sql.SQLException
        -
        Constructs an object that implements the NClob interface. The object - returned initially contains no data. The setAsciiStream, - setCharacterStream and setString methods of the NClob interface may - be used to add data to the NClob.
        -
        -
        Specified by:
        -
        createNClob in interface java.sql.Connection
        -
        Returns:
        -
        An object that implements the NClob interface
        -
        Throws:
        -
        java.sql.SQLException - if an object that implements the - NClob interface can not be constructed, this method is - called on a closed connection or a database access error occurs.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this data type
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        createSQLXML

        -
        public java.sql.SQLXML createSQLXML()
        -                             throws java.sql.SQLException
        -
        Constructs an object that implements the SQLXML interface. The object - returned initially contains no data. The createXmlStreamWriter object and - setString method of the SQLXML interface may be used to add data to the SQLXML - object.
        -
        -
        Specified by:
        -
        createSQLXML in interface java.sql.Connection
        -
        Returns:
        -
        An object that implements the SQLXML interface
        -
        Throws:
        -
        java.sql.SQLException - if an object that implements the SQLXML interface can not - be constructed, this method is - called on a closed connection or a database access error occurs.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this data type
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isValid

        -
        public boolean isValid​(int timeout)
        -                throws java.sql.SQLException
        -
        - - Returns true if the connection has not been closed and is still valid. - The driver shall submit a query on the connection or use some other - mechanism that positively verifies the connection is still valid when - this method is called. -

        - The query submitted by the driver to validate the connection shall be - executed in the context of the current transaction. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB uses a maximum timeout of 60 seconds if timeout has been specified - as zero. - -

        -
        -
        Specified by:
        -
        isValid in interface java.sql.Connection
        -
        Parameters:
        -
        timeout - - The time in seconds to wait for the database operation - used to validate the connection to complete. If - the timeout period expires before the operation - completes, this method returns false. A value of - 0 indicates a timeout is not applied to the - database operation.
        -
        Returns:
        -
        true if the connection is valid, false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if the value supplied for timeout - is less than 0
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        See Also:
        -
        JDBCDatabaseMetaData.getClientInfoProperties()
        -
        -
      • -
      - - - -
        -
      • -

        setClientInfo

        -
        public void setClientInfo​(java.lang.String name,
        -                          java.lang.String value)
        -                   throws java.sql.SQLClientInfoException
        -
        Sets the value of the client info property specified by name to the - value specified by value. -

        - Applications may use the DatabaseMetaData.getClientInfoProperties - method to determine the client info properties supported by the driver - and the maximum length that may be specified for each property. -

        - The driver stores the value specified in a suitable location in the - database. For example in a special register, session parameter, or - system table column. For efficiency the driver may defer setting the - value in the database until the next time a statement is executed or - prepared. Other than storing the client information in the appropriate - place in the database, these methods shall not alter the behavior of - the connection in any way. The values supplied to these methods are - used for accounting, diagnostics and debugging purposes only. -

        - The driver shall generate a warning if the client info name specified - is not recognized by the driver. -

        - If the value specified to this method is greater than the maximum - length for the property the driver may either truncate the value and - generate a warning or generate a SQLClientInfoException. If the driver - generates a SQLClientInfoException, the value specified was not set on the - connection. -

        - The following are standard client info properties. Drivers are not - required to support these properties however if the driver supports a - client info property that can be described by one of the standard - properties, the standard property name should be used. - -

          -
        • ApplicationName - The name of the application currently utilizing - the connection
        • -
        • ClientUser - The name of the user that the application using - the connection is performing work for. This may - not be the same as the user name that was used - in establishing the connection.
        • -
        • ClientHostname - The host name of the computer the application - using the connection is running on.
        • -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0, throws an SQLClientInfoException when this method is - called. -

        -
        -
        -
        Specified by:
        -
        setClientInfo in interface java.sql.Connection
        -
        Parameters:
        -
        name - The name of the client info property to set
        -
        value - The value to set the client info property to. If the - value is null, the current value of the specified - property is cleared. -

        -
        Throws:
        -
        java.sql.SQLClientInfoException - if the database server returns an error while - setting the client info value on the database server or this method - is called on a closed connection -

        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setClientInfo

        -
        public void setClientInfo​(java.util.Properties properties)
        -                   throws java.sql.SQLClientInfoException
        -
        Sets the value of the connection's client info properties. The - Properties object contains the names and values of the client info - properties to be set. The set of client info properties contained in - the properties list replaces the current set of client info properties - on the connection. If a property that is currently set on the - connection is not present in the properties list, that property is - cleared. Specifying an empty properties list will clear all of the - properties on the connection. See setClientInfo (String, String) for - more information. -

        - If an error occurs in setting any of the client info properties, a - SQLClientInfoException is thrown. The SQLClientInfoException - contains information indicating which client info properties were not set. - The state of the client information is unknown because - some databases do not allow multiple client info properties to be set - atomically. For those databases, one or more properties may have been - set before the error occurred. -

        -
        -
        Specified by:
        -
        setClientInfo in interface java.sql.Connection
        -
        Parameters:
        -
        properties - the list of client info properties to set -

        -
        Throws:
        -
        java.sql.SQLClientInfoException - if the database server returns an error while - setting the clientInfo values on the database server or this method - is called on a closed connection
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0 -

        -
        See Also:
        -
        setClientInfo(String, String)
        -
        -
      • -
      - - - -
        -
      • -

        getClientInfo

        -
        public java.lang.String getClientInfo​(java.lang.String name)
        -                               throws java.sql.SQLException
        -
        Returns the value of the client info property specified by name. This - method may return null if the specified client info property has not - been set and does not have a default value. This method will also - return null if the specified client info property name is not supported - by the driver. -

        - Applications may use the DatabaseMetaData.getClientInfoProperties - method to determine the client info properties supported by the driver. -

        -
        -
        Specified by:
        -
        getClientInfo in interface java.sql.Connection
        -
        Parameters:
        -
        name - The name of the client info property to retrieve -

        -
        Returns:
        -
        The value of the client info property specified -

        -
        Throws:
        -
        java.sql.SQLException - if the database server returns an error when - fetching the client info value from the database - or this method is called on a closed connection -

        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        See Also:
        -
        DatabaseMetaData.getClientInfoProperties()
        -
        -
      • -
      - - - -
        -
      • -

        getClientInfo

        -
        public java.util.Properties getClientInfo()
        -                                   throws java.sql.SQLException
        -
        Returns a list containing the name and current value of each client info - property supported by the driver. The value of a client info property - may be null if the property has not been set and does not have a - default value. -

        -
        -
        Specified by:
        -
        getClientInfo in interface java.sql.Connection
        -
        Returns:
        -
        A Properties object that contains the name and current value of - each of the client info properties supported by the driver. -

        -
        Throws:
        -
        java.sql.SQLException - if the database server returns an error when - fetching the client info values from the database - or this method is called on a closed connection -

        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        createArrayOf

        -
        public java.sql.Array createArrayOf​(java.lang.String typeName,
        -                                    java.lang.Object[] elements)
        -                             throws java.sql.SQLException
        -
        Factory method for creating Array objects. -

        - Note: When createArrayOf is used to create an array object - that maps to a primitive data type, then it is implementation-defined - whether the Array object is an array of that primitive - data type or an array of Object. -

        - Note: The JDBC driver is responsible for mapping the elements - Object array to the default JDBC SQL type defined in - java.sql.Types for the given class of Object. The default - mapping is specified in Appendix B of the JDBC specification. If the - resulting JDBC type is not the appropriate type for the given typeName then - it is implementation defined whether an SQLException is - thrown or the driver supports the resulting conversion.

        -
        -
        Specified by:
        -
        createArrayOf in interface java.sql.Connection
        -
        Parameters:
        -
        typeName - the SQL name of the type the elements of the array map to. The typeName is a - database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - is the value returned by Array.getBaseTypeName
        -
        elements - the elements that populate the returned object
        -
        Returns:
        -
        an Array object whose elements map to the specified SQL type
        -
        Throws:
        -
        java.sql.SQLException - if a database error occurs, the JDBC type is not - appropriate for the typeName and the conversion is not supported, the typeName is null or this method is called on a closed connection
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this data type
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        createStruct

        -
        public java.sql.Struct createStruct​(java.lang.String typeName,
        -                                    java.lang.Object[] attributes)
        -                             throws java.sql.SQLException
        -
        Factory method for creating Struct objects.
        -
        -
        Specified by:
        -
        createStruct in interface java.sql.Connection
        -
        Parameters:
        -
        typeName - the SQL type name of the SQL structured type that this Struct - object maps to. The typeName is the name of a user-defined type that - has been defined for this database. It is the value returned by - Struct.getSQLTypeName.
        -
        attributes - the attributes that populate the returned object
        -
        Returns:
        -
        a Struct object that maps to the given SQL type and is populated with the given attributes
        -
        Throws:
        -
        java.sql.SQLException - if a database error occurs, the typeName is null or this method is called on a closed connection
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this data type
        -
        Since:
        -
        JDK 1.6_b80, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return - the result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Type Parameters:
        -
        T - by which the return type is inferred from input parameter.
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setSchema

        -
        public void setSchema​(java.lang.String schema)
        -               throws java.sql.SQLException
        -
        Sets the given schema name to access. -

        - If the driver does not support schemas, it will - silently ignore this request. -

        - Calling setSchema has no effect on previously created or prepared - Statement objects. It is implementation defined whether a DBMS - prepare operation takes place immediately when the Connection - method prepareStatement or prepareCall is invoked. - For maximum portability, setSchema should be called before a - Statement is created or prepared.

        -
        -
        Specified by:
        -
        setSchema in interface java.sql.Connection
        -
        Parameters:
        -
        schema - the name of a schema in which to work
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed connection
        -
        Since:
        -
        JDK 1.7, HSQLDB 2.0.1
        -
        See Also:
        -
        getSchema()
        -
        -
      • -
      - - - -
        -
      • -

        getSchema

        -
        public java.lang.String getSchema()
        -                           throws java.sql.SQLException
        -
        Retrieves this Connection object's current schema name.
        -
        -
        Specified by:
        -
        getSchema in interface java.sql.Connection
        -
        Returns:
        -
        the current schema name or null if there is none
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed connection
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        See Also:
        -
        setSchema(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        abort

        -
        public void abort​(java.util.concurrent.Executor executor)
        -           throws java.sql.SQLException
        -
        Terminates an open connection. Calling abort results in: -
          -
        • The connection marked as closed -
        • Closes any physical connection to the database -
        • Releases resources used by the connection -
        • Insures that any thread that is currently accessing the connection - will either progress to completion or throw an SQLException. -
        -

        - Calling abort marks the connection closed and releases any - resources. Calling abort on a closed connection is a - no-op. -

        - It is possible that the aborting and releasing of the resources that are - held by the connection can take an extended period of time. When the - abort method returns, the connection will have been marked as - closed and the Executor that was passed as a parameter to abort - may still be executing tasks to release resources. -

        - This method checks to see that there is an SQLPermission - object before allowing the method to proceed. If a - SecurityManager exists and its - checkPermission method denies calling abort, - this method throws a - java.lang.SecurityException.

        -
        -
        Specified by:
        -
        abort in interface java.sql.Connection
        -
        Parameters:
        -
        executor - The Executor implementation which will - be used by abort.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - the executor is null,
        -
        java.lang.SecurityException - if a security manager exists and its - checkPermission method denies calling abort
        -
        Since:
        -
        JDK 1.7, HSQLDB 2.0.1
        -
        See Also:
        -
        SecurityManager.checkPermission(java.security.Permission), -Executor
        -
        -
      • -
      - - - -
        -
      • -

        setNetworkTimeout

        -
        public void setNetworkTimeout​(java.util.concurrent.Executor executor,
        -                              int milliseconds)
        -                       throws java.sql.SQLException
        -
        Sets the maximum period a Connection or - objects created from the Connection - will wait for the database to reply to any one request. If any - request remains unanswered, the waiting method will - return with a SQLException, and the Connection - or objects created from the Connection will be marked as - closed. Any subsequent use of - the objects, with the exception of the close, - isClosed or Connection.isValid - methods, will result in a SQLException. -

        - Note: This method is intended to address a rare but serious - condition where network partitions can cause threads issuing JDBC calls - to hang uninterruptedly in socket reads, until the OS TCP-TIMEOUT - (typically 10 minutes). This method is related to the - abort() method which provides an administrator - thread a means to free any such threads in cases where the - JDBC connection is accessible to the administrator thread. - The setNetworkTimeout method will cover cases where - there is no administrator thread, or it has no access to the - connection. This method is severe in its effects, and should be - given a high enough value so it is never triggered before any more - normal timeouts, such as transaction timeouts. -

        - JDBC driver implementations may also choose to support the - setNetworkTimeout method to impose a limit on database - response time, in environments where no network is present. -

        - Drivers may internally implement some or all of their API calls with - multiple internal driver-database transmissions, and it is left to the - driver implementation to determine whether the limit will be - applied always to the response to the API call, or to any - single request made during the API call. -

        - - This method can be invoked more than once, such as to set a limit for an - area of JDBC code, and to reset to the default on exit from this area. - Invocation of this method has no impact on already outstanding - requests. -

        - The Statement.setQueryTimeout() timeout value is independent of the - timeout value specified in setNetworkTimeout. If the query timeout - expires before the network timeout then the - statement execution will be canceled. If the network is still - active the result will be that both the statement and connection - are still usable. However if the network timeout expires before - the query timeout or if the statement timeout fails due to network - problems, the connection will be marked as closed, any resources held by - the connection will be released and both the connection and - statement will be unusable. -

        - When the driver determines that the setNetworkTimeout timeout - value has expired, the JDBC driver marks the connection - closed and releases any resources held by the connection. -

        - - This method checks to see that there is an SQLPermission - object before allowing the method to proceed. If a - SecurityManager exists and its - checkPermission method denies calling - setNetworkTimeout, this method throws a - java.lang.SecurityException.

        -
        -
        Specified by:
        -
        setNetworkTimeout in interface java.sql.Connection
        -
        Parameters:
        -
        executor - The Executor implementation which will - be used by setNetworkTimeout.
        -
        milliseconds - The time in milliseconds to wait for the database - operation - to complete. If the JDBC driver does not support milliseconds, the - JDBC driver will round the value up to the nearest second. If the - timeout period expires before the operation - completes, a SQLException will be thrown. - A value of 0 indicates that there is no timeout for database operations.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - method is called on a closed connection, - the executor is null, - or the value specified for seconds is less than 0.
        -
        java.lang.SecurityException - if a security manager exists and its - checkPermission method denies calling - setNetworkTimeout.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        See Also:
        -
        SecurityManager.checkPermission(java.security.Permission), -Statement.setQueryTimeout(int), -getNetworkTimeout(), -abort(java.util.concurrent.Executor), -Executor
        -
        -
      • -
      - - - -
        -
      • -

        getNetworkTimeout

        -
        public int getNetworkTimeout()
        -                      throws java.sql.SQLException
        -
        Retrieves the number of milliseconds the driver will - wait for a database request to complete. - If the limit is exceeded, a - SQLException is thrown.
        -
        -
        Specified by:
        -
        getNetworkTimeout in interface java.sql.Connection
        -
        Returns:
        -
        the current timeout limit in milliseconds; zero means there is - no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Connection
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        See Also:
        -
        setNetworkTimeout(java.util.concurrent.Executor, int)
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.lang.String getURL()
        -                        throws java.sql.SQLException
        -
        Retrieves this connection's JDBC url. - - This method is in support of the JDBCDatabaseMetaData.getURL() method.
        -
        -
        Returns:
        -
        the database connection url with which this object was - constructed
        -
        Throws:
        -
        java.sql.SQLException - if this connection is closed
        -
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -           throws java.sql.SQLException
        -
        Resets this connection so it can be used again. Used when connections are - returned to a connection pool.
        -
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        closeFully

        -
        public void closeFully()
        -
        Completely closes a pooled connection
        -
      • -
      - - - -
        -
      • -

        getSession

        -
        public org.hsqldb.SessionInterface getSession()
        -
        provides cross-package access to the proprietary (i.e. non-JDBC) - HSQLDB session interface.

        -
        -
        Returns:
        -
        the underlying sessionProxy for this connection
        -
        -
      • -
      - - - -
        -
      • -

        isInternal

        -
        public boolean isInternal()
        -
      • -
      - - - -
        -
      • -

        isNetwork

        -
        public boolean isNetwork()
        -
      • -
      - - - -
        -
      • -

        getConnProperties

        -
        public org.hsqldb.persist.HsqlProperties getConnProperties()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCConnectionEventListener.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCConnectionEventListener.html deleted file mode 100644 index 01dab8af..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCConnectionEventListener.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - -JDBCConnectionEventListener (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface JDBCConnectionEventListener

-
-
-
- -
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        connectionClosed

        -
        void connectionClosed()
        -
      • -
      - - - -
        -
      • -

        connectionErrorOccurred

        -
        void connectionErrorOccurred​(java.sql.SQLException e)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDataSource.html deleted file mode 100644 index b7a778bb..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDataSource.html +++ /dev/null @@ -1,550 +0,0 @@ - - - - - -JDBCDataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCDataSource

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.DataSource
    -
    -
    -
    public class JDBCDataSource
    -extends JDBCCommonDataSource
    -implements javax.sql.DataSource, java.io.Serializable, javax.naming.Referenceable, java.sql.Wrapper
    -

    A factory for connections to the physical data source that this - DataSource object represents. An alternative to the - DriverManager facility, a DataSource object - is the preferred means of getting a connection. An object that implements - the DataSource interface will typically be - registered with a naming service based on the - Java™ Naming and Directory (JNDI) API. -

    - The DataSource interface is implemented by a driver vendor. - There are three types of implementations: -

      -
    1. Basic implementation -- produces a standard Connection - object -
    2. Connection pooling implementation -- produces a Connection - object that will automatically participate in connection pooling. This - implementation works with a middle-tier connection pooling manager. -
    3. Distributed transaction implementation -- produces a - Connection object that may be used for distributed - transactions and almost always participates in connection pooling. - This implementation works with a middle-tier - transaction manager and almost always with a connection - pooling manager. -
    -

    - A DataSource object has properties that can be modified - when necessary. For example, if the data source is moved to a different - server, the property for the server can be changed. The benefit is that - because the data source's properties can be changed, any code accessing - that data source does not need to be changed. -

    - A driver that is accessed via a DataSource object does not - register itself with the DriverManager. Rather, a - DataSource object is retrieved though a lookup operation - and then used to create a Connection object. With a basic - implementation, the connection obtained through a DataSource - object is identical to a connection obtained through the - DriverManager facility. - - -

    -

    HSQLDB-Specific Information:

    - - This implementation of data source is a basic implementation and does not - perform connection pooling.

    - - The getter and setter methods of the parent class, JDBCCommonDataSource, - can be used.

    -

    -
    -
    -
    Since:
    -
    JDK 1.4, 1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCDataSource

        -
        public JDBCDataSource()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException
        -
        Retrieves a new connection using the properties that have already been - set.
        -
        -
        Specified by:
        -
        getConnection in interface javax.sql.DataSource
        -
        Returns:
        -
        a connection to the data source
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection​(java.lang.String username,
        -                                         java.lang.String password)
        -                                  throws java.sql.SQLException
        -
        Retrieves a new connection using the given username and password, - and the database url that has been set. No other properties are - used for the connection
        -
        -
        Specified by:
        -
        getConnection in interface javax.sql.DataSource
        -
        Parameters:
        -
        username - the database user on whose behalf the connection is - being made
        -
        password - the user's password
        -
        Returns:
        -
        a connection to the data source
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return - the result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getReference

        -
        public javax.naming.Reference getReference()
        -                                    throws javax.naming.NamingException
        -
        Retrieves the Reference of this object.
        -
        -
        Specified by:
        -
        getReference in interface javax.naming.Referenceable
        -
        Returns:
        -
        The non-null Reference of this object.
        -
        Throws:
        -
        javax.naming.NamingException - If a naming exception was encountered - while retrieving the reference.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDataSourceFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDataSourceFactory.html deleted file mode 100644 index c7574e77..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDataSourceFactory.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - -JDBCDataSourceFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCDataSourceFactory

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCDataSourceFactory
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    javax.naming.spi.ObjectFactory
    -
    -
    -
    public class JDBCDataSourceFactory
    -extends java.lang.Object
    -implements javax.naming.spi.ObjectFactory
    -
    A JNDI ObjectFactory for creating data sources supported by HyperSQL - JDBCDataSource for plain - connections for the end user. - JDBCPool for pooled plain - connections for the end user. - JDBCPooledDataSource for - PooleConnection objects used - by external connection pooling software. - JDBCXADataSource for - XAConnection objects used by external connection pooling software.
    -
    -
    Author:
    -
    Darin DeForest (deforest@users dot sourceforge.net) original version, Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static javax.sql.DataSourcecreateDataSource​(java.util.Properties props) -
      Static method to create a JDBCDataSource instance using the - given properties for url, user, password, etc.
      -
      java.lang.ObjectgetObjectInstance​(java.lang.Object obj, - javax.naming.Name name, - javax.naming.Context nameCtx, - java.util.Hashtable environment) -
      Creates a DataSource object using the javax.naming.Reference object - specified.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCDataSourceFactory

        -
        public JDBCDataSourceFactory()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createDataSource

        -
        public static javax.sql.DataSource createDataSource​(java.util.Properties props)
        -                                             throws java.lang.Exception
        -
        Static method to create a JDBCDataSource instance using the - given properties for url, user, password, etc.
        -
        -
        Parameters:
        -
        props - properties
        -
        Returns:
        -
        the data source instance
        -
        Throws:
        -
        java.lang.Exception - on any error
        -
        -
      • -
      - - - -
        -
      • -

        getObjectInstance

        -
        public java.lang.Object getObjectInstance​(java.lang.Object obj,
        -                                          javax.naming.Name name,
        -                                          javax.naming.Context nameCtx,
        -                                          java.util.Hashtable environment)
        -                                   throws java.lang.Exception
        -
        Creates a DataSource object using the javax.naming.Reference object - specified.

        - - The Reference object's class name should be one of the four supported - data source class names and it must support the properties, database, - user and password. It may optionally support the loginTimeout property. - - HyperSQL's JDBCPooledDataSource and JDBCXADataSource object are intended - as factories used by a connection pooling DataSource.

        - JDBCDataSource is a factory for normal connections and can be accessed - directly by user applications.

        - JDBCPool is a connection pool accessed directly by user applications.

        -
        -
        Specified by:
        -
        getObjectInstance in interface javax.naming.spi.ObjectFactory
        -
        Parameters:
        -
        obj - The reference information used in creating a - Datasource object.
        -
        name - ignored
        -
        nameCtx - ignored
        -
        environment - ignored
        -
        Returns:
        -
        A newly created JDBCDataSource object; null if an object - cannot be created.
        -
        Throws:
        -
        java.lang.Exception - is thrown if database or user is null or invalid
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDatabaseMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDatabaseMetaData.html deleted file mode 100644 index a20a4b0f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDatabaseMetaData.html +++ /dev/null @@ -1,8596 +0,0 @@ - - - - - -JDBCDatabaseMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCDatabaseMetaData

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCDatabaseMetaData
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.DatabaseMetaData, java.sql.Wrapper
    -
    -
    -
    public class JDBCDatabaseMetaData
    -extends java.lang.Object
    -implements java.sql.DatabaseMetaData, java.sql.Wrapper
    -
    Comprehensive information about the database as a whole. -

    - This interface is implemented by driver vendors to let users know the capabilities - of a Database Management System (DBMS) in combination with - the driver based on JDBC technology - ("JDBC driver") that is used with it. Different relational DBMSs often support - different features, implement features in different ways, and use different - data types. In addition, a driver may implement a feature on top of what the - DBMS offers. Information returned by methods in this interface applies - to the capabilities of a particular driver and a particular DBMS working - together. Note that as used in this documentation, the term "database" is - used generically to refer to both the driver and DBMS. -

    - A user for this interface is commonly a tool that needs to discover how to - deal with the underlying DBMS. This is especially true for applications - that are intended to be used with more than one DBMS. For example, a tool might use the method - getTypeInfo to find out what data types can be used in a - CREATE TABLE statement. Or a user might call the method - supportsCorrelatedSubqueries to see if it is possible to use - a correlated subquery or supportsBatchUpdates to see if it is - possible to use batch updates. -

    - Some DatabaseMetaData methods return lists of information - in the form of ResultSet objects. - Regular ResultSet methods, such as - getString and getInt, can be used - to retrieve the data from these ResultSet objects. If - a given form of metadata is not available, an empty ResultSet - will be returned. Additional columns beyond the columns defined to be - returned by the ResultSet object for a given method - can be defined by the JDBC driver vendor and must be accessed - by their column label. -

    - Some DatabaseMetaData methods take arguments that are - String patterns. These arguments all have names such as fooPattern. - Within a pattern String, "%" means match any substring of 0 or more - characters, and "_" means match any one character. Only metadata - entries matching the search pattern are returned. If a search pattern - argument is set to null, that argument's criterion will - be dropped from the search. -

    - A method that gets information about a feature that the driver does not - support will throw an SQLException. - In the case of methods that return a ResultSet - object, either a ResultSet object (which may be empty) is - returned or an SQLException is thrown. - - -

    -

    HSQLDB-Specific Information:

    - -

    Metadata Table Production

    - - Starting with HSQLDB 1.7.2, the metadata table (a.k.a system table) production - implementation provided in the default build filters metadata based on each - SQL session user's access rights which in turn lifts the pre-HSQLDB 1.7.2 - restriction that only users with the DBA role - ('admin' users in older HSQLDB parlance) could expect trouble-free access to - all metadata.

    - - Also starting with HSQLDB 1.7.2, the metadata table production implementation - classes are loaded dynamically, using a precedence policy to find and load - the richest producer available at runtime. In the event that no better - alternative is found, the default minimal (completely restricted) provider - is selected. Under this scheme, it is possible for third party packagers to - create custom distributions targeted at supporting full (design-time), - custom-written (proprietary / micro environment), minimal (production-time) - or completely-restricted (space-constrained | device embedded | real-time | - hostile environment) metadata table production scenarios. To learn more - about this option, interested parties can review the documentation and source - code for the org.hsqldb.dbinfo.DatabaseInformation class.

    - - Please also note that in addition to the metadata tables produced to - directly support this class, starting with HSQLDB 1.7.2, the default build - provides many additional tables covering all or most HSQLDB features, such - as descriptions of the triggers and aliases defined in the database.

    - - For instance, in the default build, a fairly comprehensive description of - each INFORMATION_SCHEMA table and each INFORMATION_SCHEMA table - column is included in the REMARKS column of the getTables(...) and getColumns(...) results, which derive - from INFORMATION_SCHEMA.SYSTEM_TABLES and INFORMATION_SCHEMA.SYSTEM_COLUMNS, - respectively.

    - - Since HSQLDB 2.0 the INFORMATION_SCHEMA views have been vastly expanded - in compliance with the SQL:2011 Standard and report the properties of all - database objects.

    - -

    Schema Metadata

    - - The SQL SCHEMA concept became fully supported in the HSQLDB 1.8.x series and - this fact is reflected in the all subsequent versions of this class. - -

    Catalog Metadata

    - - Starting with HSQLDB 2.0, SQL standards compliance up to SQL:2008 and beyond - is a major theme which is reflected in the provision of the majority of the - standard-defined full-name INFORMATION_SCHEMA views.

    - - However, just as CATALOG semantics and handling are still considered to be - implementation defined by the most recent SQL standard (SQL:2011), so is the - HSQLDB CATALOG concept still in the process of being defined and refined in - HSQLDB 2.x. and beyond.

    - - Similarly, starting with HSQLDB 2.x, from the perspective - of SQL identification, an HSQLDB JDBC URL connects to a single HSQLDB - database instance which consists of a single, default CATALOG - named PUBLIC in which each SCHEMA instance of the database resides. The name of - this catalog can be changed with the ALTER CATALOG <name> RENAME TO statement. - As of version 2.1.0, HSQLDB supports qualification by the containing CATALOG of - database objects at the syntactic level, but does not yet support operations - such as opening, manipulating or querying against multiple database - catalogs within a single session, not even in a one-at-a-time fashion. - -

    Index Metadata

    - - It must still be noted that as of the most recent release, HSQLDB continues - to ignore the approximate argument of getIndexInfo() as no data is returned for CARDINALITY and PAGES coloumns. - -

    Notes for developers extending metadata table production

    - - Note that in the absence of an ORDER BY clause, queries against the metadata - tables that directly support this class are expected to return rows in JDBC - contract order. The reason for this is that results typically come - back much faster when no "ORDER BY" clause is used.

    - - As such, when adding, extending or replacing a JDBC database metadata table - production routine, developers need to be aware of this fact and either add the - contract "ORDER BY" clause to the driving SQL or, when possible, - preferably maintain rows in the contract order by correctly coding the - primary index definition in the table producer class. - -


    - - (fredt@users)
    - (campbell-burnet@users) -
    -
    -
    -
    Since:
    -
    HSQLDB 1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    DatabaseInformation
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static intJDBC_MAJOR 
      static intJDBC_MINOR 
      static java.lang.StringTHIS_VERSION 
      -
        -
      • - - -

        Fields inherited from interface java.sql.DatabaseMetaData

        -attributeNoNulls, attributeNullable, attributeNullableUnknown, bestRowNotPseudo, bestRowPseudo, bestRowSession, bestRowTemporary, bestRowTransaction, bestRowUnknown, columnNoNulls, columnNullable, columnNullableUnknown, functionColumnIn, functionColumnInOut, functionColumnOut, functionColumnResult, functionColumnUnknown, functionNoNulls, functionNoTable, functionNullable, functionNullableUnknown, functionResultUnknown, functionReturn, functionReturnsTable, importedKeyCascade, importedKeyInitiallyDeferred, importedKeyInitiallyImmediate, importedKeyNoAction, importedKeyNotDeferrable, importedKeyRestrict, importedKeySetDefault, importedKeySetNull, procedureColumnIn, procedureColumnInOut, procedureColumnOut, procedureColumnResult, procedureColumnReturn, procedureColumnUnknown, procedureNoNulls, procedureNoResult, procedureNullable, procedureNullableUnknown, procedureResultUnknown, procedureReturnsResult, sqlStateSQL, sqlStateSQL99, sqlStateXOpen, tableIndexClustered, tableIndexHashed, tableIndexOther, tableIndexStatistic, typeNoNulls, typeNullable, typeNullableUnknown, typePredBasic, typePredChar, typePredNone, typeSearchable, versionColumnNotPseudo, versionColumnPseudo, versionColumnUnknown
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanallProceduresAreCallable() -
      Retrieves whether the current user can call all the procedures - returned by the method getProcedures.
      -
      booleanallTablesAreSelectable() -
      Retrieves whether the current user can use all the tables returned - by the method getTables in a SELECT - statement.
      -
      booleanautoCommitFailureClosesAllResultSets() -
      Retrieves whether a SQLException while autoCommit is true indicates - that all open ResultSets are closed, even ones that are holdable.
      -
      booleandataDefinitionCausesTransactionCommit() -
      Retrieves whether a data definition statement within a transaction forces - the transaction to commit.
      -
      booleandataDefinitionIgnoredInTransactions() -
      Retrieves whether this database ignores a data definition statement - within a transaction.
      -
      booleandeletesAreDetected​(int type) -
      Retrieves whether or not a visible row delete can be detected by - calling the method ResultSet.rowDeleted.
      -
      booleandoesMaxRowSizeIncludeBlobs() -
      Retrieves whether the return value for the method - getMaxRowSize includes the SQL data types - LONGVARCHAR and LONGVARBINARY.
      -
      booleangeneratedKeyAlwaysReturned() -
      Retrieves whether a generated key will always be returned if the column - name(s) or index(es) specified for the auto generated key column(s) - are valid and the statement succeeds.
      -
      java.sql.ResultSetgetAttributes​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String typeNamePattern, - java.lang.String attributeNamePattern) -
      Retrieves a description of the given attribute of the given type - for a user-defined type (UDT) that is available in the given schema - and catalog.
      -
      java.sql.ResultSetgetBestRowIdentifier​(java.lang.String catalog, - java.lang.String schema, - java.lang.String table, - int scope, - boolean nullable) -
      Retrieves a description of a table's optimal set of columns that - uniquely identifies a row.
      -
      java.sql.ResultSetgetCatalogs() -
      Retrieves the catalog names available in this database.
      -
      java.lang.StringgetCatalogSeparator() -
      Retrieves the String that this database uses as the - separator between a catalog and table name.
      -
      java.lang.StringgetCatalogTerm() -
      Retrieves the database vendor's preferred term for "catalog".
      -
      java.sql.ResultSetgetClientInfoProperties() -
      Retrieves a list of the client info properties - that the driver supports.
      -
      java.sql.ResultSetgetColumnPrivileges​(java.lang.String catalog, - java.lang.String schema, - java.lang.String table, - java.lang.String columnNamePattern) -
      Retrieves a description of the access rights for a table's columns.
      -
      java.sql.ResultSetgetColumns​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String tableNamePattern, - java.lang.String columnNamePattern) -
      Retrieves a description of table columns available in - the specified catalog.
      -
      java.sql.ConnectiongetConnection() -
      Retrieves the connection that produced this metadata object.
      -
      java.sql.ResultSetgetCrossReference​(java.lang.String parentCatalog, - java.lang.String parentSchema, - java.lang.String parentTable, - java.lang.String foreignCatalog, - java.lang.String foreignSchema, - java.lang.String foreignTable) -
      (JDBC4 clarification:) - Retrieves a description of the foreign key columns in the given foreign key - table that reference the primary key or the columns representing a unique constraint of the parent table (could be the same or a different table).
      -
      java.lang.StringgetDatabaseDefaultCollation() -
      Returns the name of the default collation for database.
      -
      intgetDatabaseMajorVersion() -
      Retrieves the major version number of the underlying database.
      -
      intgetDatabaseMinorVersion() -
      Retrieves the minor version number of the underlying database.
      -
      java.lang.StringgetDatabaseProductName() -
      Retrieves the name of this database product.
      -
      java.lang.StringgetDatabaseProductVersion() -
      Retrieves the version number of this database product.
      -
      intgetDefaultTransactionIsolation() -
      Retrieves this database's default transaction isolation level.
      -
      intgetDriverMajorVersion() -
      Retrieves this JDBC driver's major version number.
      -
      intgetDriverMinorVersion() -
      Retrieves this JDBC driver's minor version number.
      -
      java.lang.StringgetDriverName() -
      Retrieves the name of this JDBC driver.
      -
      java.lang.StringgetDriverVersion() -
      Retrieves the version number of this JDBC driver as a String.
      -
      java.sql.ResultSetgetExportedKeys​(java.lang.String catalog, - java.lang.String schema, - java.lang.String table) -
      Retrieves a description of the foreign key columns that reference the - given table's primary key columns (the foreign keys exported by a - table).
      -
      java.lang.StringgetExtraNameCharacters() -
      Retrieves all the "extra" characters that can be used in unquoted - identifier names (those beyond a-z, A-Z, 0-9 and _).
      -
      java.sql.ResultSetgetFunctionColumns​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String functionNamePattern, - java.lang.String columnNamePattern) -
      Retrieves a description of the given catalog's system or user - function parameters and return type.
      -
      java.sql.ResultSetgetFunctions​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String functionNamePattern) -
      Retrieves a description of the JDBC 4.1[ system and ]user functions available - in the given catalog.
      -
      java.lang.StringgetIdentifierQuoteString() -
      Retrieves the string used to quote SQL identifiers.
      -
      java.sql.ResultSetgetImportedKeys​(java.lang.String catalog, - java.lang.String schema, - java.lang.String table) -
      Retrieves a description of the primary key columns that are - referenced by the given table's foreign key columns (the primary keys - imported by a table).
      -
      java.sql.ResultSetgetIndexInfo​(java.lang.String catalog, - java.lang.String schema, - java.lang.String table, - boolean unique, - boolean approximate) -
      Retrieves a description of the given table's indices and statistics.
      -
      intgetJDBCMajorVersion() -
      Retrieves the major JDBC version number for this - driver.
      -
      intgetJDBCMinorVersion() -
      Retrieves the minor JDBC version number for this - driver.
      -
      intgetMaxBinaryLiteralLength() -
      Retrieves the maximum number of hex characters this database allows in an - inline binary literal.
      -
      intgetMaxCatalogNameLength() -
      Retrieves the maximum number of characters that this database allows in a - catalog name.
      -
      intgetMaxCharLiteralLength() -
      Retrieves the maximum number of characters this database allows - for a character literal.
      -
      intgetMaxColumnNameLength() -
      Retrieves the maximum number of characters this database allows - for a column name.
      -
      intgetMaxColumnsInGroupBy() -
      Retrieves the maximum number of columns this database allows in a - GROUP BY clause.
      -
      intgetMaxColumnsInIndex() -
      Retrieves the maximum number of columns this database allows in an index.
      -
      intgetMaxColumnsInOrderBy() -
      Retrieves the maximum number of columns this database allows in an - ORDER BY clause.
      -
      intgetMaxColumnsInSelect() -
      Retrieves the maximum number of columns this database allows in a - SELECT list.
      -
      intgetMaxColumnsInTable() -
      Retrieves the maximum number of columns this database allows in a table.
      -
      intgetMaxConnections() -
      Retrieves the maximum number of concurrent connections to this - database that are possible.
      -
      intgetMaxCursorNameLength() -
      Retrieves the maximum number of characters that this database allows in a - cursor name.
      -
      intgetMaxIndexLength() -
      Retrieves the maximum number of bytes this database allows for an - index, including all of the parts of the index.
      -
      longgetMaxLogicalLobSize() -
      Retrieves the maximum number of bytes this database allows for - the logical size for a LOB.
      -
      intgetMaxProcedureNameLength() -
      Retrieves the maximum number of characters that this database allows in a - procedure name.
      -
      intgetMaxRowSize() -
      Retrieves the maximum number of bytes this database allows in - a single row.
      -
      intgetMaxSchemaNameLength() -
      Retrieves the maximum number of characters that this database allows in a - schema name.
      -
      intgetMaxStatementLength() -
      Retrieves the maximum number of characters this database allows in - an SQL statement.
      -
      intgetMaxStatements() -
      Retrieves the maximum number of active statements to this database - that can be open at the same time.
      -
      intgetMaxTableNameLength() -
      Retrieves the maximum number of characters this database allows in - a table name.
      -
      intgetMaxTablesInSelect() -
      Retrieves the maximum number of tables this database allows in a - SELECT statement.
      -
      intgetMaxUserNameLength() -
      Retrieves the maximum number of characters this database allows in - a user name.
      -
      java.lang.StringgetNumericFunctions() -
      Retrieves a comma-separated list of math functions available with - this database.
      -
      java.sql.ResultSetgetPrimaryKeys​(java.lang.String catalog, - java.lang.String schema, - java.lang.String table) -
      Retrieves a description of the given table's primary key columns.
      -
      java.sql.ResultSetgetProcedureColumns​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String procedureNamePattern, - java.lang.String columnNamePattern) -
      Retrieves a description of the given catalog's stored procedure parameter - and result columns.
      -
      java.sql.ResultSetgetProcedures​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String procedureNamePattern) -
      Retrieves a description of the stored procedures available in the given - catalog.
      -
      java.lang.StringgetProcedureTerm() -
      Retrieves the database vendor's preferred term for "procedure".
      -
      java.sql.ResultSetgetPseudoColumns​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String tableNamePattern, - java.lang.String columnNamePattern) -
      Retrieves a description of the pseudo or hidden columns available - in a given table within the specified catalog and schema.
      -
      intgetResultSetHoldability() -
      (JDBC4 clarification:) - Retrieves this database's default holdability for ResultSet - objects.
      -
      java.sql.RowIdLifetimegetRowIdLifetime() -
      Indicates whether or not this data source supports the SQL ROWID type, - and if so the lifetime for which a RowId object remains valid.
      -
      java.sql.ResultSetgetSchemas() -
      Retrieves the schema names available in this database.
      -
      java.sql.ResultSetgetSchemas​(java.lang.String catalog, - java.lang.String schemaPattern) -
      Retrieves the schema names available in this database.
      -
      java.lang.StringgetSchemaTerm() -
      Retrieves the database vendor's preferred term for "schema".
      -
      java.lang.StringgetSearchStringEscape() -
      Retrieves the string that can be used to escape wildcard characters.
      -
      java.lang.StringgetSQLKeywords() -
      Retrieves a comma-separated list of all of this database's SQL keywords - that are NOT also SQL:2003 keywords.
      -
      intgetSQLStateType() -
      (JDBC4 modified:) - Indicates whether the SQLSTATE returned by SQLException.getSQLState - is X/Open (now known as Open Group) SQL CLI or SQL:2003.
      -
      java.lang.StringgetStringFunctions() -
      Retrieves a comma-separated list of string functions available with - this database.
      -
      java.sql.ResultSetgetSuperTables​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String tableNamePattern) -
      Retrieves a description of the table hierarchies defined in a particular - schema in this database.
      -
      java.sql.ResultSetgetSuperTypes​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String typeNamePattern) -
      Retrieves a description of the user-defined type (UDT) hierarchies defined in a - particular schema in this database.
      -
      java.lang.StringgetSystemFunctions() -
      Retrieves a comma-separated list of system functions available with - this database.
      -
      java.sql.ResultSetgetTablePrivileges​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String tableNamePattern) -
      Retrieves a description of the access rights for each table available - in a catalog.
      -
      java.sql.ResultSetgetTables​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String tableNamePattern, - java.lang.String[] types) -
      Retrieves a description of the tables available in the given catalog.
      -
      java.sql.ResultSetgetTableTypes() -
      Retrieves the table types available in this database.
      -
      java.lang.StringgetTimeDateFunctions() -
      Retrieves a comma-separated list of the time and date functions available - with this database.
      -
      java.sql.ResultSetgetTypeInfo() -
      Retrieves a description of all the (JDBC4 clarification:) data types supported by - this database.
      -
      java.sql.ResultSetgetUDTs​(java.lang.String catalog, - java.lang.String schemaPattern, - java.lang.String typeNamePattern, - int[] types) -
      Retrieves a description of the user-defined types (UDTs) defined - in a particular schema.
      -
      java.lang.StringgetURL() -
      Retrieves the URL for this DBMS.
      -
      java.lang.StringgetUserName() -
      Retrieves the user name as known to this database.
      -
      java.sql.ResultSetgetVersionColumns​(java.lang.String catalog, - java.lang.String schema, - java.lang.String table) -
      Retrieves a description of a table's columns that are automatically - updated when any value in a row is updated.
      -
      booleaninsertsAreDetected​(int type) -
      Retrieves whether or not a visible row insert can be detected - by calling the method ResultSet.rowInserted.
      -
      booleanisCatalogAtStart() -
      Retrieves whether a catalog appears at the start of a fully qualified - table name.
      -
      booleanisReadOnly() -
      Retrieves whether this database is in read-only mode.
      -
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      booleanlocatorsUpdateCopy() -
      Indicates whether updates made to a LOB are made on a copy or directly - to the LOB.
      -
      booleannullPlusNonNullIsNull() -
      Retrieves whether this database supports concatenations between - NULL and non-NULL values being - NULL.
      -
      booleannullsAreSortedAtEnd() -
      Retrieves whether NULL values are sorted at the end regardless of - sort order.
      -
      booleannullsAreSortedAtStart() -
      Retrieves whether NULL values are sorted at the start regardless - of sort order.
      -
      booleannullsAreSortedHigh() -
      Retrieves whether NULL values are sorted high.
      -
      booleannullsAreSortedLow() -
      Retrieves whether NULL values are sorted low.
      -
      booleanothersDeletesAreVisible​(int type) -
      Retrieves whether deletes made by others are visible.
      -
      booleanothersInsertsAreVisible​(int type) -
      Retrieves whether inserts made by others are visible.
      -
      booleanothersUpdatesAreVisible​(int type) -
      Retrieves whether updates made by others are visible.
      -
      booleanownDeletesAreVisible​(int type) -
      Retrieves whether a result set's own deletes are visible.
      -
      booleanownInsertsAreVisible​(int type) -
      Retrieves whether a result set's own inserts are visible.
      -
      booleanownUpdatesAreVisible​(int type) -
      Retrieves whether for the given type of ResultSet object, - the result set's own updates are visible.
      -
      booleanstoresLowerCaseIdentifiers() -
      Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in lower case.
      -
      booleanstoresLowerCaseQuotedIdentifiers() -
      Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in lower case.
      -
      booleanstoresMixedCaseIdentifiers() -
      Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in mixed case.
      -
      booleanstoresMixedCaseQuotedIdentifiers() -
      Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in mixed case.
      -
      booleanstoresUpperCaseIdentifiers() -
      Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in upper case.
      -
      booleanstoresUpperCaseQuotedIdentifiers() -
      Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in upper case.
      -
      booleansupportsAlterTableWithAddColumn() -
      Retrieves whether this database supports ALTER TABLE - with add column.
      -
      booleansupportsAlterTableWithDropColumn() -
      Retrieves whether this database supports ALTER TABLE - with drop column.
      -
      booleansupportsANSI92EntryLevelSQL() -
      Retrieves whether this database supports the ANSI92 entry level SQL - grammar.
      -
      booleansupportsANSI92FullSQL() -
      Retrieves whether this database supports the ANSI92 full SQL grammar supported.
      -
      booleansupportsANSI92IntermediateSQL() -
      Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported.
      -
      booleansupportsBatchUpdates() -
      Retrieves whether this database supports batch updates.
      -
      booleansupportsCatalogsInDataManipulation() -
      Retrieves whether a catalog name can be used in a data manipulation statement.
      -
      booleansupportsCatalogsInIndexDefinitions() -
      Retrieves whether a catalog name can be used in an index definition statement.
      -
      booleansupportsCatalogsInPrivilegeDefinitions() -
      Retrieves whether a catalog name can be used in a privilege definition statement.
      -
      booleansupportsCatalogsInProcedureCalls() -
      Retrieves whether a catalog name can be used in a procedure call statement.
      -
      booleansupportsCatalogsInTableDefinitions() -
      Retrieves whether a catalog name can be used in a table definition statement.
      -
      booleansupportsColumnAliasing() -
      Retrieves whether this database supports column aliasing.
      -
      booleansupportsConvert() -
      (JDBC4 clarification:) - Retrieves whether this database supports the JDBC scalar function - CONVERT for the conversion of one JDBC type to another.
      -
      booleansupportsConvert​(int fromType, - int toType) -
      (JDBC4 clarification:) - Retrieves whether this database supports the JDBC scalar function - CONVERT for conversions between the JDBC types fromType - and toType.
      -
      booleansupportsCoreSQLGrammar() -
      Retrieves whether this database supports the ODBC Core SQL grammar.
      -
      booleansupportsCorrelatedSubqueries() -
      Retrieves whether this database supports correlated subqueries.
      -
      booleansupportsDataDefinitionAndDataManipulationTransactions() -
      Retrieves whether this database supports both data definition and - data manipulation statements within a transaction.
      -
      booleansupportsDataManipulationTransactionsOnly() -
      Retrieves whether this database supports only data manipulation - statements within a transaction.
      -
      booleansupportsDifferentTableCorrelationNames() -
      Retrieves whether, when table correlation names are supported, they - are restricted to being different from the names of the tables.
      -
      booleansupportsExpressionsInOrderBy() -
      Retrieves whether this database supports expressions in - ORDER BY lists.
      -
      booleansupportsExtendedSQLGrammar() -
      Retrieves whether this database supports the ODBC Extended SQL grammar.
      -
      booleansupportsFullOuterJoins() -
      Retrieves whether this database supports full nested outer joins.
      -
      booleansupportsGetGeneratedKeys() -
      Retrieves whether auto-generated keys can be retrieved after - a statement has been executed - - -
      -
      booleansupportsGroupBy() -
      Retrieves whether this database supports some form of - GROUP BY clause.
      -
      booleansupportsGroupByBeyondSelect() -
      Retrieves whether this database supports using columns not included in - the SELECT statement in a GROUP BY clause - provided that all of the columns in the SELECT statement - are included in the GROUP BY clause.
      -
      booleansupportsGroupByUnrelated() -
      Retrieves whether this database supports using a column that is - not in the SELECT statement in a - GROUP BY clause.
      -
      booleansupportsIntegrityEnhancementFacility() -
      Retrieves whether this database supports the SQL Integrity - Enhancement Facility.
      -
      booleansupportsLikeEscapeClause() -
      Retrieves whether this database supports specifying a - LIKE escape clause.
      -
      booleansupportsLimitedOuterJoins() -
      Retrieves whether this database provides limited support for outer - joins.
      -
      booleansupportsMinimumSQLGrammar() -
      Retrieves whether this database supports the ODBC Minimum SQL grammar.
      -
      booleansupportsMixedCaseIdentifiers() -
      Retrieves whether this database treats mixed case unquoted SQL identifiers as - case sensitive and as a result stores them in mixed case.
      -
      booleansupportsMixedCaseQuotedIdentifiers() -
      Retrieves whether this database treats mixed case quoted SQL identifiers as - case sensitive and as a result stores them in mixed case.
      -
      booleansupportsMultipleOpenResults() -
      Retrieves whether it is possible to have multiple ResultSet objects - returned from a CallableStatement object - simultaneously.
      -
      booleansupportsMultipleResultSets() -
      Retrieves whether this database supports getting multiple - ResultSet objects from a single call to the - method execute.
      -
      booleansupportsMultipleTransactions() -
      Retrieves whether this database allows having multiple - transactions open at once (on different connections).
      -
      booleansupportsNamedParameters() -
      Retrieves whether this database supports named parameters to callable - statements.
      -
      booleansupportsNonNullableColumns() -
      Retrieves whether columns in this database may be defined as non-nullable.
      -
      booleansupportsOpenCursorsAcrossCommit() -
      Retrieves whether this database supports keeping cursors open - across commits.
      -
      booleansupportsOpenCursorsAcrossRollback() -
      Retrieves whether this database supports keeping cursors open - across rollbacks.
      -
      booleansupportsOpenStatementsAcrossCommit() -
      Retrieves whether this database supports keeping statements open - across commits.
      -
      booleansupportsOpenStatementsAcrossRollback() -
      Retrieves whether this database supports keeping statements open - across rollbacks.
      -
      booleansupportsOrderByUnrelated() -
      Retrieves whether this database supports using a column that is - not in the SELECT statement in an - ORDER BY clause.
      -
      booleansupportsOuterJoins() -
      Retrieves whether this database supports some form of outer join.
      -
      booleansupportsPositionedDelete() -
      Retrieves whether this database supports positioned DELETE - statements.
      -
      booleansupportsPositionedUpdate() -
      Retrieves whether this database supports positioned UPDATE - statements.
      -
      booleansupportsRefCursors() -
      Retrieves whether this database supports REF CURSOR.
      -
      booleansupportsResultSetConcurrency​(int type, - int concurrency) -
      Retrieves whether this database supports the given concurrency type - in combination with the given result set type.
      -
      booleansupportsResultSetHoldability​(int holdability) -
      Retrieves whether this database supports the given result set holdability.
      -
      booleansupportsResultSetType​(int type) -
      Retrieves whether this database supports the given result set type.
      -
      booleansupportsSavepoints() -
      Retrieves whether this database supports savepoints.
      -
      booleansupportsSchemasInDataManipulation() -
      Retrieves whether a schema name can be used in a data manipulation statement.
      -
      booleansupportsSchemasInIndexDefinitions() -
      Retrieves whether a schema name can be used in an index definition statement.
      -
      booleansupportsSchemasInPrivilegeDefinitions() -
      Retrieves whether a schema name can be used in a privilege definition statement.
      -
      booleansupportsSchemasInProcedureCalls() -
      Retrieves whether a schema name can be used in a procedure call statement.
      -
      booleansupportsSchemasInTableDefinitions() -
      Retrieves whether a schema name can be used in a table definition statement.
      -
      booleansupportsSelectForUpdate() -
      Retrieves whether this database supports SELECT FOR UPDATE - statements.
      -
      booleansupportsStatementPooling() -
      Retrieves whether this database supports statement pooling.
      -
      booleansupportsStoredFunctionsUsingCallSyntax() -
      Retrieves whether this database supports invoking user-defined or vendor functions - using the stored procedure escape syntax.
      -
      booleansupportsStoredProcedures() -
      Retrieves whether this database supports stored procedure calls - that use the stored procedure escape syntax.
      -
      booleansupportsSubqueriesInComparisons() -
      Retrieves whether this database supports subqueries in comparison - expressions.
      -
      booleansupportsSubqueriesInExists() -
      Retrieves whether this database supports subqueries in - EXISTS expressions.
      -
      booleansupportsSubqueriesInIns() -
      (JDBC4 correction:) - Retrieves whether this database supports subqueries in - IN expressions.
      -
      booleansupportsSubqueriesInQuantifieds() -
      Retrieves whether this database supports subqueries in quantified - expressions.
      -
      booleansupportsTableCorrelationNames() -
      Retrieves whether this database supports table correlation names.
      -
      booleansupportsTransactionIsolationLevel​(int level) -
      Retrieves whether this database supports the given transaction isolation level.
      -
      booleansupportsTransactions() -
      Retrieves whether this database supports transactions.
      -
      booleansupportsUnion() -
      Retrieves whether this database supports SQL UNION.
      -
      booleansupportsUnionAll() -
      Retrieves whether this database supports SQL UNION ALL.
      -
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to non-standard methods, - or standard methods not exposed by the proxy.
      -
      booleanupdatesAreDetected​(int type) -
      Retrieves whether or not a visible row update can be detected by - calling the method ResultSet.rowUpdated.
      -
      booleanusesLocalFilePerTable() -
      Retrieves whether this database uses a file for each table.
      -
      booleanusesLocalFiles() -
      Retrieves whether this database stores tables in a local file.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.sql.DatabaseMetaData

        -supportsSharding
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        allProceduresAreCallable

        -
        public boolean allProceduresAreCallable()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether the current user can call all the procedures - returned by the method getProcedures. - - -
        -

        HSQLDB-Specific Information:

        - - This method always returns - true because the listed procedures are those which - the current user can use.

        -

        -
        -
        -
        Specified by:
        -
        allProceduresAreCallable in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        allTablesAreSelectable

        -
        public boolean allTablesAreSelectable()
        -                               throws java.sql.SQLException
        -
        Retrieves whether the current user can use all the tables returned - by the method getTables in a SELECT - statement. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB always reports true.

        - - The getTables call returns the list of tables to which the - invoking user has some access rights.

        - -

        -
        -
        -
        Specified by:
        -
        allTablesAreSelectable in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.lang.String getURL()
        -                        throws java.sql.SQLException
        -
        Retrieves the URL for this DBMS.
        -
        -
        Specified by:
        -
        getURL in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the URL for this DBMS or null if it cannot be - generated
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getUserName

        -
        public java.lang.String getUserName()
        -                             throws java.sql.SQLException
        -
        Retrieves the user name as known to this database.
        -
        -
        Specified by:
        -
        getUserName in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the database user name
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isReadOnly

        -
        public boolean isReadOnly()
        -                   throws java.sql.SQLException
        -
        Retrieves whether this database is in read-only mode. - - -
        -

        HSQLDB-Specific Information:

        - - This makes an SQL call to the isReadOnlyDatabase function - which provides correct determination of the read-only status for - both local and remote database instances. -

        -
        -
        -
        Specified by:
        -
        isReadOnly in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        nullsAreSortedHigh

        -
        public boolean nullsAreSortedHigh()
        -                           throws java.sql.SQLException
        -
        Retrieves whether NULL values are sorted high. - Sorted high means that NULL values - sort higher than any other value in a domain. In an ascending order, - if this method returns true, NULL values - will appear at the end. By contrast, the method - nullsAreSortedAtEnd indicates whether NULL values - are sorted at the end regardless of sort order. - - -
        -

        HSQLDB-Specific Information:

        - - By default HSQLDB sorts null at start and - this method returns false. - But a different value is returned if sql.nulls_first or - sql.nulls_lasst properties have a non-default value. -

        -
        -
        -
        Specified by:
        -
        nullsAreSortedHigh in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        nullsAreSortedLow

        -
        public boolean nullsAreSortedLow()
        -                          throws java.sql.SQLException
        -
        Retrieves whether NULL values are sorted low. - Sorted low means that NULL values - sort lower than any other value in a domain. In an ascending order, - if this method returns true, NULL values - will appear at the beginning. By contrast, the method - nullsAreSortedAtStart indicates whether NULL values - are sorted at the beginning regardless of sort order. - - -
        -

        HSQLDB-Specific Information:

        - - By default HSQLDB sorts null at start and - this method returns false. - But a different value is returned if sql.nulls_first or - sql.nulls_lasst properties have a non-default value. -

        -
        -
        -
        Specified by:
        -
        nullsAreSortedLow in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        nullsAreSortedAtStart

        -
        public boolean nullsAreSortedAtStart()
        -                              throws java.sql.SQLException
        -
        Retrieves whether NULL values are sorted at the start regardless - of sort order. - - -
        -

        HSQLDB-Specific Information:

        - - By default HSQLDB sorts null at start and - this method returns true. - But a different value is returned if sql.nulls_first or - sql.nulls_last properties have a non-default value.

        - Use NULLS LAST in the ORDER BY clause to sort null at the end. -

        -
        -
        -
        Specified by:
        -
        nullsAreSortedAtStart in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        nullsAreSortedAtEnd

        -
        public boolean nullsAreSortedAtEnd()
        -                            throws java.sql.SQLException
        -
        Retrieves whether NULL values are sorted at the end regardless of - sort order. - - -
        -

        HSQLDB-Specific Information:

        - - By default HSQLDB sorts null at start and - this method returns false. - But a different value is returned if sql.nulls_first or - sql.nulls_last properties have a non-default value.

        - Use NULLS LAST in the ORDER BY clause to sort null at the end. -

        -
        -
        -
        Specified by:
        -
        nullsAreSortedAtEnd in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseProductName

        -
        public java.lang.String getDatabaseProductName()
        -                                        throws java.sql.SQLException
        -
        Retrieves the name of this database product. - -
        -

        HSQLDB-Specific Information:

        - - Returns the name of the HSQLDB engine. -

        -
        -
        Specified by:
        -
        getDatabaseProductName in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        database product name
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseProductVersion

        -
        public java.lang.String getDatabaseProductVersion()
        -                                           throws java.sql.SQLException
        -
        Retrieves the version number of this database product. - -
        -

        HSQLDB-Specific Information:

        - - Returns the full version string. -

        -
        -
        Specified by:
        -
        getDatabaseProductVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        database version number
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getDriverName

        -
        public java.lang.String getDriverName()
        -                               throws java.sql.SQLException
        -
        Retrieves the name of this JDBC driver.
        -
        -
        Specified by:
        -
        getDriverName in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        JDBC driver name
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getDriverVersion

        -
        public java.lang.String getDriverVersion()
        -                                  throws java.sql.SQLException
        -
        Retrieves the version number of this JDBC driver as a String.
        -
        -
        Specified by:
        -
        getDriverVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        JDBC driver version
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getDriverMajorVersion

        -
        public int getDriverMajorVersion()
        -
        Retrieves this JDBC driver's major version number.
        -
        -
        Specified by:
        -
        getDriverMajorVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        JDBC driver major version
        -
        -
      • -
      - - - -
        -
      • -

        getDriverMinorVersion

        -
        public int getDriverMinorVersion()
        -
        Retrieves this JDBC driver's minor version number.
        -
        -
        Specified by:
        -
        getDriverMinorVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        JDBC driver minor version number
        -
        -
      • -
      - - - -
        -
      • -

        usesLocalFiles

        -
        public boolean usesLocalFiles()
        -                       throws java.sql.SQLException
        -
        Retrieves whether this database stores tables in a local file. - - -
        -

        HSQLDB-Specific Information:

        - - From HSQLDB 1.7.2 it is assumed that this refers to data being stored - by the JDBC client. This method always returns false. -

        -
        -
        -
        Specified by:
        -
        usesLocalFiles in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        usesLocalFilePerTable

        -
        public boolean usesLocalFilePerTable()
        -                              throws java.sql.SQLException
        -
        Retrieves whether this database uses a file for each table. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not use a file for each table. - This method always returns false. -

        -
        -
        -
        Specified by:
        -
        usesLocalFilePerTable in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if this database uses a local file for each table; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsMixedCaseIdentifiers

        -
        public boolean supportsMixedCaseIdentifiers()
        -                                     throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case unquoted SQL identifiers as - case sensitive and as a result stores them in mixed case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        supportsMixedCaseIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        storesUpperCaseIdentifiers

        -
        public boolean storesUpperCaseIdentifiers()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in upper case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        storesUpperCaseIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        storesLowerCaseIdentifiers

        -
        public boolean storesLowerCaseIdentifiers()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in lower case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        storesLowerCaseIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        storesMixedCaseIdentifiers

        -
        public boolean storesMixedCaseIdentifiers()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case unquoted SQL identifiers as - case insensitive and stores them in mixed case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        storesMixedCaseIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsMixedCaseQuotedIdentifiers

        -
        public boolean supportsMixedCaseQuotedIdentifiers()
        -                                           throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case quoted SQL identifiers as - case sensitive and as a result stores them in mixed case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsMixedCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        storesUpperCaseQuotedIdentifiers

        -
        public boolean storesUpperCaseQuotedIdentifiers()
        -                                         throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in upper case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        storesUpperCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        storesLowerCaseQuotedIdentifiers

        -
        public boolean storesLowerCaseQuotedIdentifiers()
        -                                         throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in lower case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        storesLowerCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        storesMixedCaseQuotedIdentifiers

        -
        public boolean storesMixedCaseQuotedIdentifiers()
        -                                         throws java.sql.SQLException
        -
        Retrieves whether this database treats mixed case quoted SQL identifiers as - case insensitive and stores them in mixed case. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB treats unquoted identifiers as case insensitive and stores - them in upper case. It treats quoted identifiers as case sensitive and - stores them verbatim; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        storesMixedCaseQuotedIdentifiers in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getIdentifierQuoteString

        -
        public java.lang.String getIdentifierQuoteString()
        -                                          throws java.sql.SQLException
        -
        Retrieves the string used to quote SQL identifiers. - This method returns a space " " if identifier quoting is not supported. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB uses the standard SQL identifier quote character - (the double quote character); this method always returns ". -

        -
        -
        -
        Specified by:
        -
        getIdentifierQuoteString in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the quoting string or a space if quoting is not supported
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getSQLKeywords

        -
        public java.lang.String getSQLKeywords()
        -                                throws java.sql.SQLException
        -
        Retrieves a comma-separated list of all of this database's SQL keywords - that are NOT also SQL:2003 keywords. - (JDBC4 modified to SQL:2003) - - -
        -

        HSQLDB-Specific Information:

        - - The list is empty. However, HSQLDB also supports SQL:2008 keywords - and disallows them for database object names without double quoting. -

        -
        -
        -
        Specified by:
        -
        getSQLKeywords in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the list of this database's keywords that are not also - SQL:2003 keywords - (JDBC4 modified to SQL:2003)
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getNumericFunctions

        -
        public java.lang.String getNumericFunctions()
        -                                     throws java.sql.SQLException
        -
        Retrieves a comma-separated list of math functions available with - this database. These are the Open /Open CLI math function names used in - the JDBC function escape clause.
        -
        -
        Specified by:
        -
        getNumericFunctions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the list of math functions supported by this database
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getStringFunctions

        -
        public java.lang.String getStringFunctions()
        -                                    throws java.sql.SQLException
        -
        Retrieves a comma-separated list of string functions available with - this database. These are the Open Group CLI string function names used - in the JDBC function escape clause.
        -
        -
        Specified by:
        -
        getStringFunctions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the list of string functions supported by this database
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getSystemFunctions

        -
        public java.lang.String getSystemFunctions()
        -                                    throws java.sql.SQLException
        -
        Retrieves a comma-separated list of system functions available with - this database. These are the Open Group CLI system function names used - in the JDBC function escape clause.
        -
        -
        Specified by:
        -
        getSystemFunctions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        a list of system functions supported by this database
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getTimeDateFunctions

        -
        public java.lang.String getTimeDateFunctions()
        -                                      throws java.sql.SQLException
        -
        Retrieves a comma-separated list of the time and date functions available - with this database.
        -
        -
        Specified by:
        -
        getTimeDateFunctions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the list of time and date functions supported by this database
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getSearchStringEscape

        -
        public java.lang.String getSearchStringEscape()
        -                                       throws java.sql.SQLException
        -
        Retrieves the string that can be used to escape wildcard characters. - This is the string that can be used to escape '_' or '%' in - the catalog search parameters that are a pattern (and therefore use one - of the wildcard characters). - -

        The '_' character represents any single character; - the '%' character represents any sequence of zero or - more characters. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB uses the "\" character to escape wildcard characters. -

        -
        -
        -
        Specified by:
        -
        getSearchStringEscape in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the string used to escape wildcard characters
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getExtraNameCharacters

        -
        public java.lang.String getExtraNameCharacters()
        -                                        throws java.sql.SQLException
        -
        Retrieves all the "extra" characters that can be used in unquoted - identifier names (those beyond a-z, A-Z, 0-9 and _). - - -
        -

        HSQLDB-Specific Information:

        - - By default HSQLDB does not support using any "extra" characters in - unquoted identifier names; this method always returns the empty String. -

        -
        -
        -
        Specified by:
        -
        getExtraNameCharacters in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the string containing the extra characters
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsAlterTableWithAddColumn

        -
        public boolean supportsAlterTableWithAddColumn()
        -                                        throws java.sql.SQLException
        -
        Retrieves whether this database supports ALTER TABLE - with add column. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this type of - ALTER TABLE statement; this method always - returns true. -

        -
        -
        -
        Specified by:
        -
        supportsAlterTableWithAddColumn in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsAlterTableWithDropColumn

        -
        public boolean supportsAlterTableWithDropColumn()
        -                                         throws java.sql.SQLException
        -
        Retrieves whether this database supports ALTER TABLE - with drop column. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this type of - ALTER TABLE statement; this method always - returns true. -

        -
        -
        -
        Specified by:
        -
        supportsAlterTableWithDropColumn in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsColumnAliasing

        -
        public boolean supportsColumnAliasing()
        -                               throws java.sql.SQLException
        -
        Retrieves whether this database supports column aliasing. - -

        If so, the SQL AS clause can be used to provide names for - computed columns or to provide alias names for columns as - required. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports column aliasing; this method always - returns true. -

        -
        -
        -
        Specified by:
        -
        supportsColumnAliasing in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        nullPlusNonNullIsNull

        -
        public boolean nullPlusNonNullIsNull()
        -                              throws java.sql.SQLException
        -
        Retrieves whether this database supports concatenations between - NULL and non-NULL values being - NULL. - - -
        -

        HSQLDB-Specific Information:

        - - By default HSQLDB returns NULL when NULL and non-NULL values - are concatenated. - By default this method returns false. - But a different value is returned if the sql.concat_nulls - property has a non-default value.

        -

        -
        -
        -
        Specified by:
        -
        nullPlusNonNullIsNull in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsConvert

        -
        public boolean supportsConvert()
        -                        throws java.sql.SQLException
        -
        (JDBC4 clarification:) - Retrieves whether this database supports the JDBC scalar function - CONVERT for the conversion of one JDBC type to another. - The JDBC types are the generic SQL data types defined - in java.sql.Types. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports conversions; this method always - returns true. -

        -
        -
        -
        Specified by:
        -
        supportsConvert in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsConvert

        -
        public boolean supportsConvert​(int fromType,
        -                               int toType)
        -                        throws java.sql.SQLException
        -
        (JDBC4 clarification:) - Retrieves whether this database supports the JDBC scalar function - CONVERT for conversions between the JDBC types fromType - and toType. The JDBC types are the generic SQL data types defined - in java.sql.Types. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports conversion according to SQL standards. In addition, - it supports conversion between values of BOOLEAN and BIT types. -

        -
        -
        -
        Specified by:
        -
        supportsConvert in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        fromType - the type to convert from; one of the type codes from - the class java.sql.Types
        -
        toType - the type to convert to; one of the type codes from - the class java.sql.Types
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        supportsTableCorrelationNames

        -
        public boolean supportsTableCorrelationNames()
        -                                      throws java.sql.SQLException
        -
        Retrieves whether this database supports table correlation names. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports table correlation names; this method always - returns true. -

        -
        -
        -
        Specified by:
        -
        supportsTableCorrelationNames in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsDifferentTableCorrelationNames

        -
        public boolean supportsDifferentTableCorrelationNames()
        -                                               throws java.sql.SQLException
        -
        Retrieves whether, when table correlation names are supported, they - are restricted to being different from the names of the tables. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not require that table correlation names are different from the - names of the tables; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        supportsDifferentTableCorrelationNames in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsExpressionsInOrderBy

        -
        public boolean supportsExpressionsInOrderBy()
        -                                     throws java.sql.SQLException
        -
        Retrieves whether this database supports expressions in - ORDER BY lists. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports expressions in ORDER BY lists; this - method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsExpressionsInOrderBy in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsOrderByUnrelated

        -
        public boolean supportsOrderByUnrelated()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports using a column that is - not in the SELECT statement in an - ORDER BY clause. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports using a column that is not in the SELECT - statement in an ORDER BY clause; this method always - returns true. -

        -
        -
        -
        Specified by:
        -
        supportsOrderByUnrelated in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsGroupBy

        -
        public boolean supportsGroupBy()
        -                        throws java.sql.SQLException
        -
        Retrieves whether this database supports some form of - GROUP BY clause. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports using the GROUP BY clause; this method - always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsGroupBy in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsGroupByUnrelated

        -
        public boolean supportsGroupByUnrelated()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports using a column that is - not in the SELECT statement in a - GROUP BY clause. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports using a column that is - not in the SELECT statement in a - GROUP BY clause; this method - always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsGroupByUnrelated in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsGroupByBeyondSelect

        -
        public boolean supportsGroupByBeyondSelect()
        -                                    throws java.sql.SQLException
        -
        Retrieves whether this database supports using columns not included in - the SELECT statement in a GROUP BY clause - provided that all of the columns in the SELECT statement - are included in the GROUP BY clause. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports using columns not included in - the SELECT statement in a GROUP BY clause - provided that all of the columns in the SELECT statement - are included in the GROUP BY clause; this method - always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsGroupByBeyondSelect in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsLikeEscapeClause

        -
        public boolean supportsLikeEscapeClause()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports specifying a - LIKE escape clause. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports specifying a - LIKE escape clause; this method - always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsLikeEscapeClause in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsMultipleResultSets

        -
        public boolean supportsMultipleResultSets()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether this database supports getting multiple - ResultSet objects from a single call to the - method execute. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports getting multiple - ResultSet objects from a single call to the method - execute of the CallableStatement interface; - this method returns true.

        - -

        -
        -
        -
        Specified by:
        -
        supportsMultipleResultSets in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsMultipleTransactions

        -
        public boolean supportsMultipleTransactions()
        -                                     throws java.sql.SQLException
        -
        Retrieves whether this database allows having multiple - transactions open at once (on different connections). - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB allows having multiple - transactions open at once (on different connections); this method - always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsMultipleTransactions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsNonNullableColumns

        -
        public boolean supportsNonNullableColumns()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether columns in this database may be defined as non-nullable. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the specification of non-nullable columns; this method - always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsNonNullableColumns in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsMinimumSQLGrammar

        -
        public boolean supportsMinimumSQLGrammar()
        -                                  throws java.sql.SQLException
        -
        Retrieves whether this database supports the ODBC Minimum SQL grammar. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports the ODBC Minimum SQL grammar; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsMinimumSQLGrammar in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsCoreSQLGrammar

        -
        public boolean supportsCoreSQLGrammar()
        -                               throws java.sql.SQLException
        -
        Retrieves whether this database supports the ODBC Core SQL grammar. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports the ODBC Core SQL grammar; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsCoreSQLGrammar in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsExtendedSQLGrammar

        -
        public boolean supportsExtendedSQLGrammar()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether this database supports the ODBC Extended SQL grammar. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports the ODBC Extended SQL grammar; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsExtendedSQLGrammar in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsANSI92EntryLevelSQL

        -
        public boolean supportsANSI92EntryLevelSQL()
        -                                    throws java.sql.SQLException
        -
        Retrieves whether this database supports the ANSI92 entry level SQL - grammar. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports the ANSI92 entry level SQL grammar; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsANSI92EntryLevelSQL in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsANSI92IntermediateSQL

        -
        public boolean supportsANSI92IntermediateSQL()
        -                                      throws java.sql.SQLException
        -
        Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports the ANSI92 intermediate SQL grammar; - this method always returns true. -

        -

        -
        -
        -
        Specified by:
        -
        supportsANSI92IntermediateSQL in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsANSI92FullSQL

        -
        public boolean supportsANSI92FullSQL()
        -                              throws java.sql.SQLException
        -
        Retrieves whether this database supports the ANSI92 full SQL grammar supported. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports the ANSI92 full SQL grammar. The exceptions, - such as support for ASSERTION, are not considered grammar issues. - This method always returns true.

        -

        -
        -
        -
        Specified by:
        -
        supportsANSI92FullSQL in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsIntegrityEnhancementFacility

        -
        public boolean supportsIntegrityEnhancementFacility()
        -                                             throws java.sql.SQLException
        -
        Retrieves whether this database supports the SQL Integrity - Enhancement Facility. - - -
        -

        HSQLDB-Specific Information:

        - - This method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsIntegrityEnhancementFacility in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsOuterJoins

        -
        public boolean supportsOuterJoins()
        -                           throws java.sql.SQLException
        -
        Retrieves whether this database supports some form of outer join. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports outer joins; this method always returns - true. -

        -
        -
        -
        Specified by:
        -
        supportsOuterJoins in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsFullOuterJoins

        -
        public boolean supportsFullOuterJoins()
        -                               throws java.sql.SQLException
        -
        Retrieves whether this database supports full nested outer joins. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports full nested outer - joins; this method always returns true.

        -

        -
        -
        -
        Specified by:
        -
        supportsFullOuterJoins in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsLimitedOuterJoins

        -
        public boolean supportsLimitedOuterJoins()
        -                                  throws java.sql.SQLException
        -
        Retrieves whether this database provides limited support for outer - joins. (This will be true if the method - supportsFullOuterJoins returns true). - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the LEFT OUTER join syntax; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsLimitedOuterJoins in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getSchemaTerm

        -
        public java.lang.String getSchemaTerm()
        -                               throws java.sql.SQLException
        -
        Retrieves the database vendor's preferred term for "schema". - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 1.8.0, HSQLDB supports schemas. -

        -
        -
        -
        Specified by:
        -
        getSchemaTerm in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the vendor term for "schema"
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getProcedureTerm

        -
        public java.lang.String getProcedureTerm()
        -                                  throws java.sql.SQLException
        -
        Retrieves the database vendor's preferred term for "procedure". - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports declaration of - functions or procedures directly in SQL.

        -

        -
        -
        -
        Specified by:
        -
        getProcedureTerm in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the vendor term for "procedure"
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getCatalogTerm

        -
        public java.lang.String getCatalogTerm()
        -                                throws java.sql.SQLException
        -
        Retrieves the database vendor's preferred term for "catalog". - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB uses the standard name CATALOG. -

        -
        -
        -
        Specified by:
        -
        getCatalogTerm in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the vendor term for "catalog"
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isCatalogAtStart

        -
        public boolean isCatalogAtStart()
        -                         throws java.sql.SQLException
        -
        Retrieves whether a catalog appears at the start of a fully qualified - table name. If not, the catalog appears at the end. - - -
        -

        HSQLDB-Specific Information:

        - - When allowed, a catalog appears at the start of a fully qualified - table name; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        isCatalogAtStart in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if the catalog name appears at the beginning - of a fully qualified table name; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getCatalogSeparator

        -
        public java.lang.String getCatalogSeparator()
        -                                     throws java.sql.SQLException
        -
        Retrieves the String that this database uses as the - separator between a catalog and table name. - - -
        -

        HSQLDB-Specific Information:

        - - When used, a catalog name is separated with period; - this method always returns a period -

        -
        -
        -
        Specified by:
        -
        getCatalogSeparator in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the separator string
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSchemasInDataManipulation

        -
        public boolean supportsSchemasInDataManipulation()
        -                                          throws java.sql.SQLException
        -
        Retrieves whether a schema name can be used in a data manipulation statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports schemas where allowed by the standard; - this method always returns true. - -

        -
        -
        -
        Specified by:
        -
        supportsSchemasInDataManipulation in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSchemasInProcedureCalls

        -
        public boolean supportsSchemasInProcedureCalls()
        -                                        throws java.sql.SQLException
        -
        Retrieves whether a schema name can be used in a procedure call statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports schemas where allowed by the standard; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsSchemasInProcedureCalls in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSchemasInTableDefinitions

        -
        public boolean supportsSchemasInTableDefinitions()
        -                                          throws java.sql.SQLException
        -
        Retrieves whether a schema name can be used in a table definition statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports schemas where allowed by the standard; - this method always returns true. - -

        -
        -
        -
        Specified by:
        -
        supportsSchemasInTableDefinitions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSchemasInIndexDefinitions

        -
        public boolean supportsSchemasInIndexDefinitions()
        -                                          throws java.sql.SQLException
        -
        Retrieves whether a schema name can be used in an index definition statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports schemas where allowed by the standard; - this method always returns true. - -

        -
        -
        -
        Specified by:
        -
        supportsSchemasInIndexDefinitions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSchemasInPrivilegeDefinitions

        -
        public boolean supportsSchemasInPrivilegeDefinitions()
        -                                              throws java.sql.SQLException
        -
        Retrieves whether a schema name can be used in a privilege definition statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports schemas where allowed by the standard; - this method always returns true. - -

        -
        -
        -
        Specified by:
        -
        supportsSchemasInPrivilegeDefinitions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsCatalogsInDataManipulation

        -
        public boolean supportsCatalogsInDataManipulation()
        -                                           throws java.sql.SQLException
        -
        Retrieves whether a catalog name can be used in a data manipulation statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports catalog names where allowed by the standard; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsCatalogsInDataManipulation in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsCatalogsInProcedureCalls

        -
        public boolean supportsCatalogsInProcedureCalls()
        -                                         throws java.sql.SQLException
        -
        Retrieves whether a catalog name can be used in a procedure call statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports catalog names where allowed by the standard; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsCatalogsInProcedureCalls in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsCatalogsInTableDefinitions

        -
        public boolean supportsCatalogsInTableDefinitions()
        -                                           throws java.sql.SQLException
        -
        Retrieves whether a catalog name can be used in a table definition statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports catalog names where allowed by the standard; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsCatalogsInTableDefinitions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsCatalogsInIndexDefinitions

        -
        public boolean supportsCatalogsInIndexDefinitions()
        -                                           throws java.sql.SQLException
        -
        Retrieves whether a catalog name can be used in an index definition statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports catalog names where allowed by the standard; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsCatalogsInIndexDefinitions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsCatalogsInPrivilegeDefinitions

        -
        public boolean supportsCatalogsInPrivilegeDefinitions()
        -                                               throws java.sql.SQLException
        -
        Retrieves whether a catalog name can be used in a privilege definition statement. - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB supports catalog names where allowed by the standard; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsCatalogsInPrivilegeDefinitions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsPositionedDelete

        -
        public boolean supportsPositionedDelete()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports positioned DELETE - statements. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports updatable result sets; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsPositionedDelete in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsPositionedUpdate

        -
        public boolean supportsPositionedUpdate()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports positioned UPDATE - statements. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports updatable result sets; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsPositionedUpdate in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSelectForUpdate

        -
        public boolean supportsSelectForUpdate()
        -                                throws java.sql.SQLException
        -
        Retrieves whether this database supports SELECT FOR UPDATE - statements. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports updatable result sets; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsSelectForUpdate in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsStoredProcedures

        -
        public boolean supportsStoredProcedures()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports stored procedure calls - that use the stored procedure escape syntax. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports calling public static Java methods in the context of SQL - Stored Procedures; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsStoredProcedures in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        JDBCParameterMetaData, -JDBCConnection.prepareCall(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        supportsSubqueriesInComparisons

        -
        public boolean supportsSubqueriesInComparisons()
        -                                        throws java.sql.SQLException
        -
        Retrieves whether this database supports subqueries in comparison - expressions. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB has always supported subqueries in comparison expressions; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsSubqueriesInComparisons in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSubqueriesInExists

        -
        public boolean supportsSubqueriesInExists()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether this database supports subqueries in - EXISTS expressions. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB has always supported subqueries in EXISTS - expressions; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsSubqueriesInExists in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSubqueriesInIns

        -
        public boolean supportsSubqueriesInIns()
        -                                throws java.sql.SQLException
        -
        (JDBC4 correction:) - Retrieves whether this database supports subqueries in - IN expressions. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB has always supported subqueries in IN - statements; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsSubqueriesInIns in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsSubqueriesInQuantifieds

        -
        public boolean supportsSubqueriesInQuantifieds()
        -                                        throws java.sql.SQLException
        -
        Retrieves whether this database supports subqueries in quantified - expressions. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB has always supported subqueries in quantified - expressions; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsSubqueriesInQuantifieds in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsCorrelatedSubqueries

        -
        public boolean supportsCorrelatedSubqueries()
        -                                     throws java.sql.SQLException
        -
        Retrieves whether this database supports correlated subqueries. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB has always supported correlated subqueries; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsCorrelatedSubqueries in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsUnion

        -
        public boolean supportsUnion()
        -                      throws java.sql.SQLException
        -
        Retrieves whether this database supports SQL UNION. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports SQL UNION; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsUnion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsUnionAll

        -
        public boolean supportsUnionAll()
        -                         throws java.sql.SQLException
        -
        Retrieves whether this database supports SQL UNION ALL. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports SQL UNION ALL; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsUnionAll in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsOpenCursorsAcrossCommit

        -
        public boolean supportsOpenCursorsAcrossCommit()
        -                                        throws java.sql.SQLException
        -
        Retrieves whether this database supports keeping cursors open - across commits. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports keeping cursors open across commits. - This method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsOpenCursorsAcrossCommit in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if cursors always remain open; - false if they might not remain open
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsOpenCursorsAcrossRollback

        -
        public boolean supportsOpenCursorsAcrossRollback()
        -                                          throws java.sql.SQLException
        -
        Retrieves whether this database supports keeping cursors open - across rollbacks. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 closes open cursors at rollback. - This method always returns false. -

        -
        -
        -
        Specified by:
        -
        supportsOpenCursorsAcrossRollback in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if cursors always remain open; - false if they might not remain open
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsOpenStatementsAcrossCommit

        -
        public boolean supportsOpenStatementsAcrossCommit()
        -                                           throws java.sql.SQLException
        -
        Retrieves whether this database supports keeping statements open - across commits. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports keeping statements open across commits; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsOpenStatementsAcrossCommit in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if statements always remain open; - false if they might not remain open
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsOpenStatementsAcrossRollback

        -
        public boolean supportsOpenStatementsAcrossRollback()
        -                                             throws java.sql.SQLException
        -
        Retrieves whether this database supports keeping statements open - across rollbacks. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports keeping statements open across rollbacks; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsOpenStatementsAcrossRollback in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if statements always remain open; - false if they might not remain open
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxBinaryLiteralLength

        -
        public int getMaxBinaryLiteralLength()
        -                              throws java.sql.SQLException
        -
        Retrieves the maximum number of hex characters this database allows in an - inline binary literal. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxBinaryLiteralLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        max the maximum length (in hex characters) for a binary literal; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxCharLiteralLength

        -
        public int getMaxCharLiteralLength()
        -                            throws java.sql.SQLException
        -
        Retrieves the maximum number of characters this database allows - for a character literal. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxCharLiteralLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed for a character literal; - a result of zero means that there is no limit or the limit is - not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxColumnNameLength

        -
        public int getMaxColumnNameLength()
        -                           throws java.sql.SQLException
        -
        Retrieves the maximum number of characters this database allows - for a column name. - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - all names. -

        -
        -
        -
        Specified by:
        -
        getMaxColumnNameLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed for a column name; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxColumnsInGroupBy

        -
        public int getMaxColumnsInGroupBy()
        -                           throws java.sql.SQLException
        -
        Retrieves the maximum number of columns this database allows in a - GROUP BY clause. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxColumnsInGroupBy in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of columns allowed; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxColumnsInIndex

        -
        public int getMaxColumnsInIndex()
        -                         throws java.sql.SQLException
        -
        Retrieves the maximum number of columns this database allows in an index. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxColumnsInIndex in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of columns allowed; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxColumnsInOrderBy

        -
        public int getMaxColumnsInOrderBy()
        -                           throws java.sql.SQLException
        -
        Retrieves the maximum number of columns this database allows in an - ORDER BY clause. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxColumnsInOrderBy in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of columns allowed; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxColumnsInSelect

        -
        public int getMaxColumnsInSelect()
        -                          throws java.sql.SQLException
        -
        Retrieves the maximum number of columns this database allows in a - SELECT list. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxColumnsInSelect in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of columns allowed; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxColumnsInTable

        -
        public int getMaxColumnsInTable()
        -                         throws java.sql.SQLException
        -
        Retrieves the maximum number of columns this database allows in a table. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxColumnsInTable in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of columns allowed; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxConnections

        -
        public int getMaxConnections()
        -                      throws java.sql.SQLException
        -
        Retrieves the maximum number of concurrent connections to this - database that are possible. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxConnections in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of active connections possible at one time; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxCursorNameLength

        -
        public int getMaxCursorNameLength()
        -                           throws java.sql.SQLException
        -
        Retrieves the maximum number of characters that this database allows in a - cursor name. - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - all names. -

        -
        -
        -
        Specified by:
        -
        getMaxCursorNameLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed in a cursor name; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxIndexLength

        -
        public int getMaxIndexLength()
        -                      throws java.sql.SQLException
        -
        Retrieves the maximum number of bytes this database allows for an - index, including all of the parts of the index. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory and disk availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxIndexLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of bytes allowed; this limit includes the - composite of all the constituent parts of the index; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxSchemaNameLength

        -
        public int getMaxSchemaNameLength()
        -                           throws java.sql.SQLException
        -
        Retrieves the maximum number of characters that this database allows in a - schema name. - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - all names. -

        -
        -
        -
        Specified by:
        -
        getMaxSchemaNameLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed in a schema name; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxProcedureNameLength

        -
        public int getMaxProcedureNameLength()
        -                              throws java.sql.SQLException
        -
        Retrieves the maximum number of characters that this database allows in a - procedure name. - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - all names. -

        -
        -
        -
        Specified by:
        -
        getMaxProcedureNameLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed in a procedure name; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxCatalogNameLength

        -
        public int getMaxCatalogNameLength()
        -                            throws java.sql.SQLException
        -
        Retrieves the maximum number of characters that this database allows in a - catalog name. - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - all names. -

        -
        -
        -
        Specified by:
        -
        getMaxCatalogNameLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed in a catalog name; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxRowSize

        -
        public int getMaxRowSize()
        -                  throws java.sql.SQLException
        -
        Retrieves the maximum number of bytes this database allows in - a single row. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory and disk availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxRowSize in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of bytes allowed for a row; a result of - zero means that there is no limit or the limit is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        doesMaxRowSizeIncludeBlobs

        -
        public boolean doesMaxRowSizeIncludeBlobs()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether the return value for the method - getMaxRowSize includes the SQL data types - LONGVARCHAR and LONGVARBINARY. - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0, getMaxRowSize() always returns - 0, indicating that the maximum row size is unknown or has no limit. - This applies to the above types as well; this method always - returns true. -

        -
        -
        -
        Specified by:
        -
        doesMaxRowSizeIncludeBlobs in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxStatementLength

        -
        public int getMaxStatementLength()
        -                          throws java.sql.SQLException
        -
        Retrieves the maximum number of characters this database allows in - an SQL statement. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxStatementLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed for an SQL statement; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxStatements

        -
        public int getMaxStatements()
        -                     throws java.sql.SQLException
        -
        Retrieves the maximum number of active statements to this database - that can be open at the same time. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxStatements in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of statements that can be open at one time; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxTableNameLength

        -
        public int getMaxTableNameLength()
        -                          throws java.sql.SQLException
        -
        Retrieves the maximum number of characters this database allows in - a table name. - - -
        -

        HSQLDB-Specific Information:

        - - Up to and including 1.8.0.x, HSQLDB did not impose a "known" limit. Th - hard limit was the maximum length of a java.lang.String - (java.lang.Integer.MAX_VALUE); this method always returned - 0. - - Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - all names. -

        -
        -
        -
        Specified by:
        -
        getMaxTableNameLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed for a table name; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxTablesInSelect

        -
        public int getMaxTablesInSelect()
        -                         throws java.sql.SQLException
        -
        Retrieves the maximum number of tables this database allows in a - SELECT statement. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not impose a "known" limit. The limit is subject to - memory availability; this method always returns 0. -

        -
        -
        -
        Specified by:
        -
        getMaxTablesInSelect in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of tables allowed in a SELECT - statement; a result of zero means that there is no limit or - the limit is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxUserNameLength

        -
        public int getMaxUserNameLength()
        -                         throws java.sql.SQLException
        -
        Retrieves the maximum number of characters this database allows in - a user name. - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - all names. -

        -
        -
        -
        Specified by:
        -
        getMaxUserNameLength in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of characters allowed for a user name; - a result of zero means that there is no limit or the limit - is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getDefaultTransactionIsolation

        -
        public int getDefaultTransactionIsolation()
        -                                   throws java.sql.SQLException
        -
        Retrieves this database's default transaction isolation level. The - possible values are defined in java.sql.Connection. - - -
        -

        HSQLDB-Specific Information:

        - - Default isolation mode in version 2.0 is TRANSACTION_READ_COMMITTED. -
        -
        -
        -
        Specified by:
        -
        getDefaultTransactionIsolation in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the default isolation level
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        JDBCConnection
        -
        -
      • -
      - - - -
        -
      • -

        supportsTransactions

        -
        public boolean supportsTransactions()
        -                             throws java.sql.SQLException
        -
        Retrieves whether this database supports transactions. If not, invoking the - method commit is a noop, and the isolation level is - TRANSACTION_NONE. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports transactions; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsTransactions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if transactions are supported; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsTransactionIsolationLevel

        -
        public boolean supportsTransactionIsolationLevel​(int level)
        -                                          throws java.sql.SQLException
        -
        Retrieves whether this database supports the given transaction isolation level. - - -
        -

        HSQLDB-Specific Information:

        - HSQLDB supports all levels. -
        -
        -
        -
        Specified by:
        -
        supportsTransactionIsolationLevel in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        level - one of the transaction isolation levels defined in - java.sql.Connection
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        JDBCConnection
        -
        -
      • -
      - - - -
        -
      • -

        supportsDataDefinitionAndDataManipulationTransactions

        -
        public boolean supportsDataDefinitionAndDataManipulationTransactions()
        -                                                              throws java.sql.SQLException
        -
        Retrieves whether this database supports both data definition and - data manipulation statements within a transaction. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support a mix of both data definition and - data manipulation statements within a transaction. DDL commits the - current transaction before proceeding; - this method always returns false. -

        -
        -
        -
        Specified by:
        -
        supportsDataDefinitionAndDataManipulationTransactions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        supportsDataManipulationTransactionsOnly

        -
        public boolean supportsDataManipulationTransactionsOnly()
        -                                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports only data manipulation - statements within a transaction. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports only data manipulation - statements within a transaction. DDL commits the - current transaction before proceeding, while DML does not; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsDataManipulationTransactionsOnly in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        dataDefinitionCausesTransactionCommit

        -
        public boolean dataDefinitionCausesTransactionCommit()
        -                                              throws java.sql.SQLException
        -
        Retrieves whether a data definition statement within a transaction forces - the transaction to commit. - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0, a data definition statement within a transaction forces - the transaction to commit; this method always returns true. -

        -
        -
        -
        Specified by:
        -
        dataDefinitionCausesTransactionCommit in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        dataDefinitionIgnoredInTransactions

        -
        public boolean dataDefinitionIgnoredInTransactions()
        -                                            throws java.sql.SQLException
        -
        Retrieves whether this database ignores a data definition statement - within a transaction. - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0, a data definition statement is not ignored within a - transaction. Rather, a data definition statement within a - transaction forces the transaction to commit; this method - always returns false. -

        -
        -
        -
        Specified by:
        -
        dataDefinitionIgnoredInTransactions in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getProcedures

        -
        public java.sql.ResultSet getProcedures​(java.lang.String catalog,
        -                                        java.lang.String schemaPattern,
        -                                        java.lang.String procedureNamePattern)
        -                                 throws java.sql.SQLException
        -
        Retrieves a description of the stored procedures available in the given - catalog. -

        - Only procedure descriptions matching the schema and - procedure name criteria are returned. They are ordered by - JDBC 4.1[PROCEDURE_CAT,] PROCEDURE_SCHEM, - PROCEDURE_NAME and (new to JDBC4)[SPECIFIC_ NAME]. - -

        Each procedure description has the the following columns: -

          -
        1. PROCEDURE_CAT String => procedure catalog (may be null) -
        2. PROCEDURE_SCHEM String => procedure schema (may be null) -
        3. PROCEDURE_NAME String => procedure name -
        4. reserved for future use - (HSQLDB-specific: NUM_INPUT_PARAMS) -
        5. reserved for future use - (HSQLDB-specific: NUM_OUTPUT_PARAMS) -
        6. reserved for future use - (HSQLDB-specific: NUM_RESULT_SETS) -
        7. REMARKS String => explanatory comment on the procedure -
        8. PROCEDURE_TYPE short => kind of procedure: -
            -
          • procedureResultUnknown - (JDBC4 clarification:) Cannot determine if a return value - will be returned -
          • procedureNoResult - (JDBC4 clarification:) Does not return a return value -
          • procedureReturnsResult - (JDBC4 clarification:) Returns a return value -
          -
        9. SPECIFIC_NAME String => (JDBC4 new:) The name which uniquely identifies this - procedure within its schema. -
        -

        - A user may not have permissions to execute any of the procedures that are - returned by getProcedures - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database.

        - - In version 1.9, the rows returned by this method are based on rows in - the INFORMATION_SCHEMA.ROUTINES table. -

        -
        -
        -
        Specified by:
        -
        getProcedures in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        procedureNamePattern - a procedure name pattern; must match the - procedure name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row is a procedure description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        getProcedureColumns

        -
        public java.sql.ResultSet getProcedureColumns​(java.lang.String catalog,
        -                                              java.lang.String schemaPattern,
        -                                              java.lang.String procedureNamePattern,
        -                                              java.lang.String columnNamePattern)
        -                                       throws java.sql.SQLException
        -
        Retrieves a description of the given catalog's stored procedure parameter - and result columns. - -

        Only descriptions matching the schema, procedure and - parameter name criteria are returned. They are ordered by - JDBC 4.1[PROCEDURE_CAT,] PROCEDURE_SCHEM, PROCEDURE_NAME and SPECIFIC_NAME. Within this, the return value, - if any, is first. Next are the parameter descriptions in call - order. The column descriptions follow in column number order. - -

        Each row in the ResultSet is a parameter description or - column description with the following fields: -

          -
        1. PROCEDURE_CAT String => procedure catalog (may be null) -
        2. PROCEDURE_SCHEM String => procedure schema (may be null) -
        3. PROCEDURE_NAME String => procedure name -
        4. COLUMN_NAME String => column/parameter name -
        5. COLUMN_TYPE Short => kind of column/parameter: -
            -
          • procedureColumnUnknown - nobody knows -
          • procedureColumnIn - IN parameter -
          • procedureColumnInOut - INOUT parameter -
          • procedureColumnOut - OUT parameter -
          • procedureColumnReturn - procedure return value -
          • procedureColumnResult - result column in ResultSet -
          -
        6. DATA_TYPE int => SQL type from java.sql.Types -
        7. TYPE_NAME String => SQL type name, for a UDT type the - type name is fully qualified -
        8. PRECISION int => precision -
        9. LENGTH int => length in bytes of data -
        10. SCALE short => scale - null is returned for data types where - SCALE is not applicable. -
        11. RADIX short => radix -
        12. NULLABLE short => can it contain NULL. -
            -
          • procedureNoNulls - does not allow NULL values -
          • procedureNullable - allows NULL values -
          • procedureNullableUnknown - nullability unknown -
          -
        13. REMARKS String => comment describing parameter/column -
        14. COLUMN_DEF String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null) -
            -
          • The string NULL (not enclosed in quotes) - if NULL was specified as the default value -
          • TRUNCATE (not enclosed in quotes) - if the specified default value cannot be represented without truncation -
          • NULL - if a default value was not specified -
          -
        15. SQL_DATA_TYPE int => (JDBC4 new:) Reserved for future use - -

          HSQLDB-specific: CLI type from SQL 2003 Table 37, - tables 6-9 Annex A1, and/or addenda in other - documents, such as:
          - SQL 2003 Part 9: Management of External Data (SQL/MED) : DATALINK
          - SQL 2003 Part 14: XML-Related Specifications (SQL/XML) : XML - -

        16. SQL_DATETIME_SUB int => (JDBC4 new:) reserved for future use - -

          HSQLDB-specific: CLI SQL_DATETIME_SUB from SQL 2003 Table 37 - -

        17. CHAR_OCTET_LENGTH int => (JDBC4 new:) the maximum length of binary and character based columns. For any other datatype the returned value is a - NULL -
        18. ORDINAL_POSITION int => (JDBC4 new:) the ordinal position, starting from 1, for the input and output parameters for a procedure. A value of 0 - is returned if this row describes the procedure's return value. JDBC 4.1[For result set columns, it is the - ordinal position of the column in the result set starting from 1. If there are - multiple result sets, the column ordinal positions are implementation - defined.] -
        19. IS_NULLABLE String => ISO rules are used to determine the nullability for a column. -
            -
          • YES --- if the parameter or result column can include NULLs -
          • NO --- if the parameter or result column cannot include NULLs -
          • empty string --- if the nullability for the - parameter or result column is unknown -
          -
        20. SPECIFIC_NAME String => (JDBC4 new:) the name which uniquely identifies this procedure within its schema. -
        - -

        Note: Some databases may not return the column - descriptions for a procedure. Additional columns beyond (JDBC4 modified:) - SPECIFIC_NAME can be defined by the database and must be accessed by their column name. - -

        (JDBC4 clarification:) -

        The PRECISION column represents the specified column size for the given column. - For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - column size is not applicable. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database. -

        -
        -
        -
        Specified by:
        -
        getProcedureColumns in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        procedureNamePattern - a procedure name pattern; must match the - procedure name as it is stored in the database
        -
        columnNamePattern - a column name pattern; must match the column name - as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row describes a stored procedure parameter or - column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        getTables

        -
        public java.sql.ResultSet getTables​(java.lang.String catalog,
        -                                    java.lang.String schemaPattern,
        -                                    java.lang.String tableNamePattern,
        -                                    java.lang.String[] types)
        -                             throws java.sql.SQLException
        -
        Retrieves a description of the tables available in the given catalog. - Only table descriptions matching the catalog, schema, table - name and type criteria are returned. They are ordered by - TABLE_TYPE, JDBC 4.1[TABLE_CAT,] - TABLE_SCHEM and TABLE_NAME. -

        - Each table description has the following columns: -

          -
        1. TABLE_CAT String => table catalog (may be null) -
        2. TABLE_SCHEM String => table schema (may be null) -
        3. TABLE_NAME String => table name -
        4. TABLE_TYPE String => table type. Typical types are "TABLE", - "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - "LOCAL TEMPORARY", "ALIAS", "SYNONYM". -
        5. REMARKS String => explanatory comment on the table -
        6. TYPE_CAT String => the types catalog (may be null) -
        7. TYPE_SCHEM String => the types schema (may be null) -
        8. TYPE_NAME String => type name (may be null) -
        9. SELF_REFERENCING_COL_NAME String => name of the designated - "identifier" column of a typed table (may be null) -
        10. REF_GENERATION String => specifies how values in - SELF_REFERENCING_COL_NAME are created. Values are - "SYSTEM", "USER", "DERIVED". (may be null) -
        - -

        Note: Some databases may not return information for - all tables. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database.

        - - HSQLDB returns extra information on TEXT tables in the REMARKS column.

        - - HSQLDB includes the JDBC3 columns TYPE_CAT, TYPE_SCHEM, TYPE_NAME and - SELF_REFERENCING_COL_NAME in anticipation of JDBC3 compliant tools.

        - - Since 1.7.2, this feature is supported by default. If the jar is - compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - not supported. The default implementation is - the org.hsqldb.dbinfo.DatabaseInformationMain class. -

        -
        -
        -
        Specified by:
        -
        getTables in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        tableNamePattern - a table name pattern; must match the - table name as it is stored in the database
        -
        types - a list of table types, which must be from the list of table types - returned from getTableTypes(),to include; null returns - all types
        -
        Returns:
        -
        ResultSet - each row is a table description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        getSchemas

        -
        public java.sql.ResultSet getSchemas()
        -                              throws java.sql.SQLException
        -
        Retrieves the schema names available in this database. The results - are ordered by JDBC 4.1[TABLE_CATALOG] and - TABLE_SCHEM. - -

        The schema columns are: -

          -
        1. TABLE_SCHEM String => schema name -
        2. TABLE_CATALOG String => catalog name (may be null) -
        - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 1.8.0, the list of schemas is returned. -

        -
        -
        -
        Specified by:
        -
        getSchemas in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        a ResultSet object in which each row is a - schema description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getCatalogs

        -
        public java.sql.ResultSet getCatalogs()
        -                               throws java.sql.SQLException
        -
        Retrieves the catalog names available in this database. The results - are ordered by catalog name. - -

        The catalog column is: -

          -
        1. TABLE_CAT String => catalog name -
        - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.7.2, this feature is supported by default. If the jar is - compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - not supported. The default implementation is - the org.hsqldb.dbinfo.DatabaseInformationMain class. -

        -
        -
        -
        Specified by:
        -
        getCatalogs in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        a ResultSet object in which each row has a - single String column that is a catalog name
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getTableTypes

        -
        public java.sql.ResultSet getTableTypes()
        -                                 throws java.sql.SQLException
        -
        Retrieves the table types available in this database. The results - are ordered by table type. - -

        The table type is: -

          -
        1. TABLE_TYPE String => table type. Typical types are "TABLE", - "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - "LOCAL TEMPORARY", "ALIAS", "SYNONYM". -
        - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.7.1, HSQLDB reports: "TABLE", "VIEW" and "GLOBAL TEMPORARY" - types. - - Since 1.7.2, this feature is supported by default. If the jar is - compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - not supported. The default implementation is - the org.hsqldb.dbinfo.DatabaseInformationMain class. -

        -
        -
        -
        Specified by:
        -
        getTableTypes in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        a ResultSet object in which each row has a - single String column that is a table type
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getColumns

        -
        public java.sql.ResultSet getColumns​(java.lang.String catalog,
        -                                     java.lang.String schemaPattern,
        -                                     java.lang.String tableNamePattern,
        -                                     java.lang.String columnNamePattern)
        -                              throws java.sql.SQLException
        -
        Retrieves a description of table columns available in - the specified catalog. - -

        Only column descriptions matching the catalog, schema, table - and column name criteria are returned. They are ordered by - JDBC 4.1[TABLE_CAT, ]TABLE_SCHEM, - TABLE_NAME, and ORDINAL_POSITION. - -

        Each column description has the following columns: -

          -
        1. TABLE_CAT String => table catalog (may be null) -
        2. TABLE_SCHEM String => table schema (may be null) -
        3. TABLE_NAME String => table name -
        4. COLUMN_NAME String => column name -
        5. DATA_TYPE int => SQL type from java.sql.Types -
        6. TYPE_NAME String => Data source dependent type name, - for a UDT the type name is fully qualified -
        7. COLUMN_SIZE int => column size. -
        8. BUFFER_LENGTH is not used. -
        9. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where - DECIMAL_DIGITS is not applicable. -
        10. NUM_PREC_RADIX int => Radix (typically either 10 or 2) -
        11. NULLABLE int => is NULL allowed. -
            -
          • columnNoNulls - might not allow NULL values -
          • columnNullable - definitely allows NULL values -
          • columnNullableUnknown - nullability unknown -
          -
        12. REMARKS String => comment describing column (may be null) -
        13. COLUMN_DEF String => (JDBC4 clarification:) default value for the column, which should be interpreted as a string when the value is enclosed in quotes (may be null) -
        14. SQL_DATA_TYPE int => unused - -

          HSQLDB-specific: CLI type from SQL 2003 Table 37, - tables 6-9 Annex A1, and/or addendums in other - documents, such as:
          - SQL 2003 Part 9: Management of External Data (SQL/MED) : DATALINK
          - SQL 2003 Part 14: XML-Related Specifications (SQL/XML) : XML - -

        15. SQL_DATETIME_SUB int => unused (HSQLDB-specific: SQL 2003 CLI datetime/interval subcode) -
        16. CHAR_OCTET_LENGTH int => for char types the - maximum number of bytes in the column -
        17. ORDINAL_POSITION int => index of column in table - (starting at 1) -
        18. IS_NULLABLE String => ISO rules are used to determine the nullability for a column. -
            -
          • YES --- if the column can include NULLs -
          • NO --- if the column cannot include NULLs -
          • empty string --- if the nullability for the - column is unknown -
          -
        19. JDBC 4.1 Deleted[SCOPE_CATLOG] JDBC 4.1 Added[SCOPE_CATALOG] String => catalog of table that is the scope - of a reference attribute (null if DATA_TYPE isn't REF) -
        20. SCOPE_SCHEMA String => schema of table that is the scope - of a reference attribute (null if the DATA_TYPE isn't REF) -
        21. SCOPE_TABLE String => table name that this the scope - of a reference attribute (null if the DATA_TYPE isn't REF) -
        22. SOURCE_DATA_TYPE short => source type of a distinct type or user-generated - Ref type, SQL type from java.sql.Types (null if DATA_TYPE - isn't DISTINCT or user-generated REF) -
        23. IS_AUTOINCREMENT String => Indicates whether this column is auto incremented -
            -
          • YES --- if the column is auto incremented -
          • NO --- if the column is not auto incremented -
          • empty string --- if it cannot be determined whether the column is auto incremented -
          -
        24. (JDBC 4.1 New:)IS_GENERATEDCOLUMN String => Indicates whether this is a generated column -
            -
          • YES --- if this a generated column -
          • NO --- if this not a generated column -
          • empty string --- if it cannot be determined whether this is a generated column -
          -
        - -

        (JDBC4 clarification:) The COLUMN_SIZE column represents the specified column size for the given column. - For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - column size is not applicable. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database.

        - - This feature is supported by default. If the jar is - compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - not supported. The default implementation is - the org.hsqldb.dbinfo.DatabaseInformationMain class. -

        -
        -
        -
        Specified by:
        -
        getColumns in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        tableNamePattern - a table name pattern; must match the - table name as it is stored in the database
        -
        columnNamePattern - a column name pattern; must match the column - name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row is a column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        getColumnPrivileges

        -
        public java.sql.ResultSet getColumnPrivileges​(java.lang.String catalog,
        -                                              java.lang.String schema,
        -                                              java.lang.String table,
        -                                              java.lang.String columnNamePattern)
        -                                       throws java.sql.SQLException
        -
        Retrieves a description of the access rights for a table's columns. - -

        Only privileges matching the column name criteria are - returned. They are ordered by COLUMN_NAME and PRIVILEGE. - -

        Each privilege description has the following columns: -

          -
        1. TABLE_CAT String => table catalog (may be null) -
        2. TABLE_SCHEM String => table schema (may be null) -
        3. TABLE_NAME String => table name -
        4. COLUMN_NAME String => column name -
        5. GRANTOR String => grantor of access (may be null) -
        6. GRANTEE String => grantee of access -
        7. PRIVILEGE String => name of access (SELECT, - INSERT, UPDATE, REFRENCES, ...) -
        8. IS_GRANTABLE String => "YES" if grantee is permitted - to grant to others; "NO" if not; null if unknown -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database.

        - - This feature is supported by default. The default implementation is - the org.hsqldb.dbinfo.DatabaseInformationMain class. -

        -
        -
        -
        Specified by:
        -
        getColumnPrivileges in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schema - a schema name; must match the schema name as it is - stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        table - a table name; must match the table name as it is - stored in the database
        -
        columnNamePattern - a column name pattern; must match the column - name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row is a column privilege description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        getTablePrivileges

        -
        public java.sql.ResultSet getTablePrivileges​(java.lang.String catalog,
        -                                             java.lang.String schemaPattern,
        -                                             java.lang.String tableNamePattern)
        -                                      throws java.sql.SQLException
        -
        Retrieves a description of the access rights for each table available - in a catalog. Note that a table privilege applies to one or - more columns in the table. It would be wrong to assume that - this privilege applies to all columns (this may be true for - some systems but is not true for all.) - -

        Only privileges matching the schema and table name - criteria are returned. They are ordered by - JDBC 4.1[TABLE_CAT,] - TABLE_SCHEM, TABLE_NAME, - and PRIVILEGE. - -

        Each privilege description has the following columns: -

          -
        1. TABLE_CAT String => table catalog (may be null) -
        2. TABLE_SCHEM String => table schema (may be null) -
        3. TABLE_NAME String => table name -
        4. GRANTOR String => grantor of access (may be null) -
        5. GRANTEE String => grantee of access -
        6. PRIVILEGE String => name of access (SELECT, - INSERT, UPDATE, REFRENCES, ...) -
        7. IS_GRANTABLE String => "YES" if grantee is permitted - to grant to others; "NO" if not; null if unknown -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database. -

        -
        -
        -
        Specified by:
        -
        getTablePrivileges in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        tableNamePattern - a table name pattern; must match the - table name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row is a table privilege description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        getBestRowIdentifier

        -
        public java.sql.ResultSet getBestRowIdentifier​(java.lang.String catalog,
        -                                               java.lang.String schema,
        -                                               java.lang.String table,
        -                                               int scope,
        -                                               boolean nullable)
        -                                        throws java.sql.SQLException
        -
        Retrieves a description of a table's optimal set of columns that - uniquely identifies a row. They are ordered by SCOPE. - -

        Each column description has the following columns: -

          -
        1. SCOPE short => actual scope of result -
            -
          • bestRowTemporary - very temporary, while using row -
          • bestRowTransaction - valid for remainder of current transaction -
          • bestRowSession - valid for remainder of current session -
          -
        2. COLUMN_NAME String => column name -
        3. DATA_TYPE int => SQL data type from java.sql.Types -
        4. TYPE_NAME String => Data source dependent type name, - for a UDT the type name is fully qualified -
        5. COLUMN_SIZE int => precision -
        6. BUFFER_LENGTH int => not used -
        7. DECIMAL_DIGITS short => scale - Null is returned for data types where - DECIMAL_DIGITS is not applicable. -
        8. PSEUDO_COLUMN short => is this a pseudo column - like an Oracle ROWID -
            -
          • bestRowUnknown - may or may not be pseudo column -
          • bestRowNotPseudo - is NOT a pseudo column -
          • bestRowPseudo - is a pseudo column -
          -
        - -

        (JDBC4 clarification:) -

        The COLUMN_SIZE column represents the specified column size for the given column. - For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - column size is not applicable. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database.

        - - If the name of a column is defined in the database without double - quotes, an all-uppercase name must be specified when calling this - method. Otherwise, the name must be specified in the exact case of - the column definition in the database. -

        -
        -
        -
        Specified by:
        -
        getBestRowIdentifier in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schema - a schema name; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        table - a table name; must match the table name as it is stored - in the database
        -
        scope - the scope of interest; use same values as SCOPE
        -
        nullable - include columns that are nullable.
        -
        Returns:
        -
        ResultSet - each row is a column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getVersionColumns

        -
        public java.sql.ResultSet getVersionColumns​(java.lang.String catalog,
        -                                            java.lang.String schema,
        -                                            java.lang.String table)
        -                                     throws java.sql.SQLException
        -
        Retrieves a description of a table's columns that are automatically - updated when any value in a row is updated. They are - unordered. - -

        Each column description has the following columns: -

          -
        1. SCOPE short => is not used -
        2. COLUMN_NAME String => column name -
        3. DATA_TYPE int => SQL data type from java.sql.Types -
        4. TYPE_NAME String => Data source-dependent type name -
        5. COLUMN_SIZE int => precision -
        6. BUFFER_LENGTH int => length of column value in bytes -
        7. DECIMAL_DIGITS short => scale - Null is returned for data types where - DECIMAL_DIGITS is not applicable. -
        8. PSEUDO_COLUMN short => whether this is pseudo column - like an Oracle ROWID -
            -
          • versionColumnUnknown - may or may not be pseudo column -
          • versionColumnNotPseudo - is NOT a pseudo column -
          • versionColumnPseudo - is a pseudo column -
          -
        - -

        (JDBC4 clarification:) -

        The COLUMN_SIZE column represents the specified column size for the given column. - For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0], JDBC 4.1 Added[Null] is returned for data types where the - column size is not applicable. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.5.0 and later returns information on auto-updated - TIMESTAMP columns defined with ON UPDATE CURRENT_TIMESTAMP, and the - columns of SYSTEM_TIME periods. Columns defined as GENERATED AS IDENTITY, - SEQUENCE, or an expression are not returned as they are not always - automatically updated when other columns in a row are updated. - -

        -
        -
        -
        Specified by:
        -
        getVersionColumns in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schema - a schema name; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        table - a table name; must match the table name as it is stored - in the database
        -
        Returns:
        -
        a ResultSet object in which each row is a - column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getPrimaryKeys

        -
        public java.sql.ResultSet getPrimaryKeys​(java.lang.String catalog,
        -                                         java.lang.String schema,
        -                                         java.lang.String table)
        -                                  throws java.sql.SQLException
        -
        Retrieves a description of the given table's primary key columns. They - are ordered by COLUMN_NAME. - -

        Each primary key column description has the following columns: -

          -
        1. TABLE_CAT String => table catalog (may be null) -
        2. TABLE_SCHEM String => table schema (may be null) -
        3. TABLE_NAME String => table name -
        4. COLUMN_NAME String => column name -
        5. KEY_SEQ short => (JDBC4 Clarification:) sequence number within primary key( a value - of 1 represents the first column of the primary key, a value of 2 would - represent the second column within the primary key). -
        6. PK_NAME String => primary key name (may be null) -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database. -

        -
        -
        -
        Specified by:
        -
        getPrimaryKeys in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schema - a schema name; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        table - a table name; must match the table name as it is stored - in the database
        -
        Returns:
        -
        ResultSet - each row is a primary key column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        supportsMixedCaseQuotedIdentifiers(), -storesUpperCaseIdentifiers()
        -
        -
      • -
      - - - -
        -
      • -

        getImportedKeys

        -
        public java.sql.ResultSet getImportedKeys​(java.lang.String catalog,
        -                                          java.lang.String schema,
        -                                          java.lang.String table)
        -                                   throws java.sql.SQLException
        -
        Retrieves a description of the primary key columns that are - referenced by the given table's foreign key columns (the primary keys - imported by a table). They are ordered by PKTABLE_CAT, - PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. - -

        Each primary key column description has the following columns: -

          -
        1. PKTABLE_CAT String => primary key table catalog - being imported (may be null) -
        2. PKTABLE_SCHEM String => primary key table schema - being imported (may be null) -
        3. PKTABLE_NAME String => primary key table name - being imported -
        4. PKCOLUMN_NAME String => primary key column name - being imported -
        5. FKTABLE_CAT String => foreign key table catalog (may be null) -
        6. FKTABLE_SCHEM String => foreign key table schema (may be null) -
        7. FKTABLE_NAME String => foreign key table name -
        8. FKCOLUMN_NAME String => foreign key column name -
        9. KEY_SEQ short => (JDBC4 clarification) sequence number within a foreign key (a value - of 1 represents the first column of the foreign key, a value of 2 would - represent the second column within the foreign key). -
        10. UPDATE_RULE short => What happens to a - foreign key when the primary key is updated: -
            -
          • importedNoAction - do not allow update of primary - key if it has been imported -
          • importedKeyCascade - change imported key to agree - with primary key update -
          • importedKeySetNull - change imported key to NULL - if its primary key has been updated -
          • importedKeySetDefault - change imported key to default values - if its primary key has been updated -
          • importedKeyRestrict - same as importedKeyNoAction - (for ODBC 2.x compatibility) -
          -
        11. DELETE_RULE short => What happens to - the foreign key when primary is deleted. -
            -
          • importedKeyNoAction - do not allow delete of primary - key if it has been imported -
          • importedKeyCascade - delete rows that import a deleted key -
          • importedKeySetNull - change imported key to NULL if - its primary key has been deleted -
          • importedKeyRestrict - same as importedKeyNoAction - (for ODBC 2.x compatibility) -
          • importedKeySetDefault - change imported key to default if - its primary key has been deleted -
          -
        12. FK_NAME String => foreign key name (may be null) -
        13. PK_NAME String => primary key name (may be null) -
        14. DEFERRABILITY short => can the evaluation of foreign key - constraints be deferred until commit -
            -
          • importedKeyInitiallyDeferred - see SQL92 for definition -
          • importedKeyInitiallyImmediate - see SQL92 for definition -
          • importedKeyNotDeferrable - see SQL92 for definition -
          -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database. -

        -
        -
        -
        Specified by:
        -
        getImportedKeys in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schema - a schema name; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        table - a table name; must match the table name as it is stored - in the database
        -
        Returns:
        -
        ResultSet - each row is a primary key column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getExportedKeys(java.lang.String, java.lang.String, java.lang.String), -supportsMixedCaseQuotedIdentifiers(), -storesUpperCaseIdentifiers()
        -
        -
      • -
      - - - -
        -
      • -

        getExportedKeys

        -
        public java.sql.ResultSet getExportedKeys​(java.lang.String catalog,
        -                                          java.lang.String schema,
        -                                          java.lang.String table)
        -                                   throws java.sql.SQLException
        -
        Retrieves a description of the foreign key columns that reference the - given table's primary key columns (the foreign keys exported by a - table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, - FKTABLE_NAME, and KEY_SEQ. - -

        Each foreign key column description has the following columns: -

          -
        1. PKTABLE_CAT String => primary key table catalog (may be null) -
        2. PKTABLE_SCHEM String => primary key table schema (may be null) -
        3. PKTABLE_NAME String => primary key table name -
        4. PKCOLUMN_NAME String => primary key column name -
        5. FKTABLE_CAT String => foreign key table catalog (may be null) - being exported (may be null) -
        6. FKTABLE_SCHEM String => foreign key table schema (may be null) - being exported (may be null) -
        7. FKTABLE_NAME String => foreign key table name - being exported -
        8. FKCOLUMN_NAME String => foreign key column name - being exported -
        9. KEY_SEQ short => (JDBC4 clarification:) sequence number within foreign key( a value - of 1 represents the first column of the foreign key, a value of 2 would - represent the second column within the foreign key). -
        10. UPDATE_RULE short => What happens to - foreign key when primary is updated: -
            -
          • importedNoAction - do not allow update of primary - key if it has been imported -
          • importedKeyCascade - change imported key to agree - with primary key update -
          • importedKeySetNull - change imported key to NULL if - its primary key has been updated -
          • importedKeySetDefault - change imported key to default values - if its primary key has been updated -
          • importedKeyRestrict - same as importedKeyNoAction - (for ODBC 2.x compatibility) -
          -
        11. DELETE_RULE short => What happens to - the foreign key when primary is deleted. -
            -
          • importedKeyNoAction - do not allow delete of primary - key if it has been imported -
          • importedKeyCascade - delete rows that import a deleted key -
          • importedKeySetNull - change imported key to NULL if - its primary key has been deleted -
          • importedKeyRestrict - same as importedKeyNoAction - (for ODBC 2.x compatibility) -
          • importedKeySetDefault - change imported key to default if - its primary key has been deleted -
          -
        12. FK_NAME String => foreign key name (may be null) -
        13. PK_NAME String => primary key name (may be null) -
        14. DEFERRABILITY short => can the evaluation of foreign key - constraints be deferred until commit -
            -
          • importedKeyInitiallyDeferred - see SQL92 for definition -
          • importedKeyInitiallyImmediate - see SQL92 for definition -
          • importedKeyNotDeferrable - see SQL92 for definition -
          -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database. -

        -
        -
        -
        Specified by:
        -
        getExportedKeys in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in this database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schema - a schema name; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        table - a table name; must match the table name as it is stored - in this database
        -
        Returns:
        -
        a ResultSet object in which each row is a - foreign key column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getImportedKeys(java.lang.String, java.lang.String, java.lang.String), -supportsMixedCaseQuotedIdentifiers(), -storesUpperCaseIdentifiers()
        -
        -
      • -
      - - - -
        -
      • -

        getCrossReference

        -
        public java.sql.ResultSet getCrossReference​(java.lang.String parentCatalog,
        -                                            java.lang.String parentSchema,
        -                                            java.lang.String parentTable,
        -                                            java.lang.String foreignCatalog,
        -                                            java.lang.String foreignSchema,
        -                                            java.lang.String foreignTable)
        -                                     throws java.sql.SQLException
        -
        (JDBC4 clarification:) - Retrieves a description of the foreign key columns in the given foreign key - table that reference the primary key or the columns representing a unique constraint of the parent table (could be the same or a different table). - The number of columns returned from the parent table must match the number of - columns that make up the foreign key. They - are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and - KEY_SEQ. - -

        Each foreign key column description has the following columns: -

          -
        1. PKTABLE_CAT String => parent key table catalog (may be null) -
        2. PKTABLE_SCHEM String => parent key table schema (may be null) -
        3. PKTABLE_NAME String => parent key table name -
        4. PKCOLUMN_NAME String => parent key column name -
        5. FKTABLE_CAT String => foreign key table catalog (may be null) - being exported (may be null) -
        6. FKTABLE_SCHEM String => foreign key table schema (may be null) - being exported (may be null) -
        7. FKTABLE_NAME String => foreign key table name - being exported -
        8. FKCOLUMN_NAME String => foreign key column name - being exported -
        9. KEY_SEQ short => sequence number within foreign key( a value - of 1 represents the first column of the foreign key, a value of 2 would - represent the second column within the foreign key). -
        10. UPDATE_RULE short => What happens to - foreign key when parent key is updated: -
            -
          • importedNoAction - do not allow update of parent - key if it has been imported -
          • importedKeyCascade - change imported key to agree - with parent key update -
          • importedKeySetNull - change imported key to NULL if - its parent key has been updated -
          • importedKeySetDefault - change imported key to default values - if its parent key has been updated -
          • importedKeyRestrict - same as importedKeyNoAction - (for ODBC 2.x compatibility) -
          -
        11. DELETE_RULE short => What happens to - the foreign key when parent key is deleted. -
            -
          • importedKeyNoAction - do not allow delete of parent - key if it has been imported -
          • importedKeyCascade - delete rows that import a deleted key -
          • importedKeySetNull - change imported key to NULL if - its primary key has been deleted -
          • importedKeyRestrict - same as importedKeyNoAction - (for ODBC 2.x compatibility) -
          • importedKeySetDefault - change imported key to default if - its parent key has been deleted -
          -
        12. FK_NAME String => foreign key name (may be null) -
        13. PK_NAME String => parent key name (may be null) -
        14. DEFERRABILITY short => can the evaluation of foreign key - constraints be deferred until commit -
            -
          • importedKeyInitiallyDeferred - see SQL92 for definition -
          • importedKeyInitiallyImmediate - see SQL92 for definition -
          • importedKeyNotDeferrable - see SQL92 for definition -
          -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database. -

        -
        -
        -
        Specified by:
        -
        getCrossReference in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        parentCatalog - a catalog name; must match the catalog name - as it is stored in the database; "" retrieves those without a - catalog; null means drop catalog name from the selection criteria
        -
        parentSchema - a schema name; must match the schema name as - it is stored in the database; "" retrieves those without a schema; - null means drop schema name from the selection criteria
        -
        parentTable - the name of the table that exports the key; must match - the table name as it is stored in the database
        -
        foreignCatalog - a catalog name; must match the catalog name as - it is stored in the database; "" retrieves those without a - catalog; null means drop catalog name from the selection criteria
        -
        foreignSchema - a schema name; must match the schema name as it - is stored in the database; "" retrieves those without a schema; - null means drop schema name from the selection criteria
        -
        foreignTable - the name of the table that imports the key; must match - the table name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row is a foreign key column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        getImportedKeys(java.lang.String, java.lang.String, java.lang.String), -supportsMixedCaseQuotedIdentifiers(), -storesUpperCaseIdentifiers()
        -
        -
      • -
      - - - -
        -
      • -

        getTypeInfo

        -
        public java.sql.ResultSet getTypeInfo()
        -                               throws java.sql.SQLException
        -
        Retrieves a description of all the (JDBC4 clarification:) data types supported by - this database. They are ordered by DATA_TYPE and then by how - closely the data type maps to the corresponding JDBC SQL type. - -

        (JDBC4 clarification:) If the database supports SQL distinct types, then getTypeInfo() will return - a single row with a TYPE_NAME of DISTINCT and a DATA_TYPE of Types.DISTINCT. - If the database supports SQL structured types, then getTypeInfo() will return - a single row with a TYPE_NAME of STRUCT and a DATA_TYPE of Types.STRUCT. - -

        (JDBC4 clarification:) -

        If SQL distinct or structured types are supported, then information on the - individual types may be obtained from the getUDTs() method. - - -

        Each type description has the following columns: -

          -
        1. TYPE_NAME String => Type name -
        2. DATA_TYPE int => SQL data type from java.sql.Types -
        3. PRECISION int => maximum precision -
        4. LITERAL_PREFIX String => prefix used to quote a literal - (may be null) -
        5. LITERAL_SUFFIX String => suffix used to quote a literal - (may be null) -
        6. CREATE_PARAMS String => parameters used in creating - the type (may be null) -
        7. NULLABLE short => can you use NULL for this type. -
            -
          • typeNoNulls - does not allow NULL values -
          • typeNullable - allows NULL values -
          • typeNullableUnknown - nullability unknown -
          -
        8. CASE_SENSITIVE boolean=> is it case sensitive. -
        9. SEARCHABLE short => can you use "WHERE" based on this type: -
            -
          • typePredNone - No support -
          • typePredChar - Only supported with WHERE .. LIKE -
          • typePredBasic - Supported except for WHERE .. LIKE -
          • typeSearchable - Supported for all WHERE .. -
          -
        10. UNSIGNED_ATTRIBUTE boolean => is it unsigned. -
        11. FIXED_PREC_SCALE boolean => can it be a money value. -
        12. AUTO_INCREMENT boolean => can it be used for an - auto-increment value. -
        13. LOCAL_TYPE_NAME String => localized version of type name - (may be null) -
        14. MINIMUM_SCALE short => minimum scale supported -
        15. MAXIMUM_SCALE short => maximum scale supported -
        16. SQL_DATA_TYPE int => unused -
        17. SQL_DATETIME_SUB int => unused -
        18. NUM_PREC_RADIX int => usually 2 or 10 -
        - -

        (JDBC4 clarification:) The PRECISION column represents the maximum column size that the server supports for the given datatype. - For numeric data, this is the maximum precision. For character data, this is the [maximum] length in characters. - For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - column size is not applicable. - - -

        -

        HSQLDB-Specific Information:

        - - This feature is supported. -

        -
        -
        -
        Specified by:
        -
        getTypeInfo in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        a ResultSet object in which each row is an SQL - type description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getIndexInfo

        -
        public java.sql.ResultSet getIndexInfo​(java.lang.String catalog,
        -                                       java.lang.String schema,
        -                                       java.lang.String table,
        -                                       boolean unique,
        -                                       boolean approximate)
        -                                throws java.sql.SQLException
        -
        Retrieves a description of the given table's indices and statistics. They are - ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. - -

        Each index column description has the following columns: -

          -
        1. TABLE_CAT String => table catalog (may be null) -
        2. TABLE_SCHEM String => table schema (may be null) -
        3. TABLE_NAME String => table name -
        4. NON_UNIQUE boolean => Can index values be non-unique. - false when TYPE is tableIndexStatistic -
        5. INDEX_QUALIFIER String => index catalog (may be null); - null when TYPE is tableIndexStatistic -
        6. INDEX_NAME String => index name; null when TYPE is - tableIndexStatistic -
        7. TYPE short => index type: -
            -
          • tableIndexStatistic - this identifies table statistics that are - returned in conjunction with a table's index descriptions -
          • tableIndexClustered - this is a clustered index -
          • tableIndexHashed - this is a hashed index -
          • tableIndexOther - this is some other style of index -
          -
        8. ORDINAL_POSITION short => column sequence number - within index; zero when TYPE is tableIndexStatistic -
        9. COLUMN_NAME String => column name; null when TYPE is - tableIndexStatistic -
        10. ASC_OR_DESC String => column sort sequence, "A" => ascending, - "D" => descending, may be null if sort sequence is not supported; - null when TYPE is tableIndexStatistic -
        11. CARDINALITY int => When TYPE is tableIndexStatistic, then - this is the number of rows in the table; otherwise, it is the - number of unique values in the index. -
        12. PAGES int => When TYPE is tableIndexStatistic then - this is the number of pages used for the table, otherwise it - is the number of pages used for the current index. -
        13. FILTER_CONDITION String => Filter condition, if any. - (may be null) -
        - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database. -

        -
        -
        -
        Specified by:
        -
        getIndexInfo in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in this database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schema - a schema name; must match the schema name - as it is stored in this database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        table - a table name; must match the table name as it is stored - in this database
        -
        unique - when true, return only indices for unique values; - when false, return indices regardless of whether unique or not
        -
        approximate - when true, result is allowed to reflect approximate - or out of data values; when false, results are requested to be - accurate
        -
        Returns:
        -
        ResultSet - each row is an index column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        supportsMixedCaseQuotedIdentifiers(), -storesUpperCaseIdentifiers()
        -
        -
      • -
      - - - -
        -
      • -

        supportsResultSetType

        -
        public boolean supportsResultSetType​(int type)
        -                              throws java.sql.SQLException
        -
        Retrieves whether this database supports the given result set type.
        -
        -
        Specified by:
        -
        supportsResultSetType in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - defined in java.sql.ResultSet
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        JDBCConnection
        -
        -
      • -
      - - - -
        -
      • -

        supportsResultSetConcurrency

        -
        public boolean supportsResultSetConcurrency​(int type,
        -                                            int concurrency)
        -                                     throws java.sql.SQLException
        -
        Retrieves whether this database supports the given concurrency type - in combination with the given result set type.
        -
        -
        Specified by:
        -
        supportsResultSetConcurrency in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - defined in java.sql.ResultSet
        -
        concurrency - type defined in java.sql.ResultSet
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        JDBCConnection
        -
        -
      • -
      - - - -
        -
      • -

        ownUpdatesAreVisible

        -
        public boolean ownUpdatesAreVisible​(int type)
        -                             throws java.sql.SQLException
        -
        Retrieves whether for the given type of ResultSet object, - the result set's own updates are visible. - - -
        -

        HSQLDB-Specific Information:

        - Updates to ResultSet rows are not visible after moving from the updated - row. -

        -
        -
        -
        Specified by:
        -
        ownUpdatesAreVisible in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if updates are visible for the given result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        ownDeletesAreVisible

        -
        public boolean ownDeletesAreVisible​(int type)
        -                             throws java.sql.SQLException
        -
        Retrieves whether a result set's own deletes are visible. - - -
        -

        HSQLDB-Specific Information:

        - - Rows deleted from the ResultSet are still visible after moving from the - deleted row. -

        -
        -
        -
        Specified by:
        -
        ownDeletesAreVisible in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if deletes are visible for the given result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        ownInsertsAreVisible

        -
        public boolean ownInsertsAreVisible​(int type)
        -                             throws java.sql.SQLException
        -
        Retrieves whether a result set's own inserts are visible. - - -
        -

        HSQLDB-Specific Information:

        - - Rows added to a ResultSet are not visible after moving from the - insert row; this method always returns false. -

        -
        -
        -
        Specified by:
        -
        ownInsertsAreVisible in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if inserts are visible for the given result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        othersUpdatesAreVisible

        -
        public boolean othersUpdatesAreVisible​(int type)
        -                                throws java.sql.SQLException
        -
        Retrieves whether updates made by others are visible. - - -
        -

        HSQLDB-Specific Information:

        - - Updates made by other connections or the same connection while the - ResultSet is open are not visible in the ResultSet. -

        -
        -
        -
        Specified by:
        -
        othersUpdatesAreVisible in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if updates made by others - are visible for the given result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        othersDeletesAreVisible

        -
        public boolean othersDeletesAreVisible​(int type)
        -                                throws java.sql.SQLException
        -
        Retrieves whether deletes made by others are visible. - - -
        -

        HSQLDB-Specific Information:

        - - Deletes made by other connections or the same connection while the - ResultSet is open are not visible in the ResultSet. -

        -
        -
        -
        Specified by:
        -
        othersDeletesAreVisible in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if deletes made by others - are visible for the given result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        othersInsertsAreVisible

        -
        public boolean othersInsertsAreVisible​(int type)
        -                                throws java.sql.SQLException
        -
        Retrieves whether inserts made by others are visible. - - -
        -

        HSQLDB-Specific Information:

        - - Inserts made by other connections or the same connection while the - ResultSet is open are not visible in the ResultSet. -

        -
        -
        -
        Specified by:
        -
        othersInsertsAreVisible in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if inserts made by others - are visible for the given result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updatesAreDetected

        -
        public boolean updatesAreDetected​(int type)
        -                           throws java.sql.SQLException
        -
        Retrieves whether or not a visible row update can be detected by - calling the method ResultSet.rowUpdated. - - -
        -

        HSQLDB-Specific Information:

        - - Updates made to the rows of the ResultSet are not detected by - calling the ResultSet.rowUpdated. -

        -
        -
        -
        Specified by:
        -
        updatesAreDetected in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if changes are detected by the result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        deletesAreDetected

        -
        public boolean deletesAreDetected​(int type)
        -                           throws java.sql.SQLException
        -
        Retrieves whether or not a visible row delete can be detected by - calling the method ResultSet.rowDeleted. If the method - deletesAreDetected returns false, it means that - deleted rows are removed from the result set. - - -
        -

        HSQLDB-Specific Information:

        - - Deletes made to the rows of the ResultSet are not detected by - calling the ResultSet.rowDeleted. -

        -
        -
        -
        Specified by:
        -
        deletesAreDetected in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if deletes are detected by the given result set type; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        insertsAreDetected

        -
        public boolean insertsAreDetected​(int type)
        -                           throws java.sql.SQLException
        -
        Retrieves whether or not a visible row insert can be detected - by calling the method ResultSet.rowInserted. - - -
        -

        HSQLDB-Specific Information:

        - - Inserts made into the ResultSet are not visible and thus not detected by - calling the ResultSet.rowInserted. -

        -
        -
        -
        Specified by:
        -
        insertsAreDetected in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        type - the ResultSet type; one of - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Returns:
        -
        true if changes are detected by the specified result - set type; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        supportsBatchUpdates

        -
        public boolean supportsBatchUpdates()
        -                             throws java.sql.SQLException
        -
        Retrieves whether this database supports batch updates. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports batch updates; - this method always returns true. -

        -
        -
        -
        Specified by:
        -
        supportsBatchUpdates in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if this database supports batch updates; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getUDTs

        -
        public java.sql.ResultSet getUDTs​(java.lang.String catalog,
        -                                  java.lang.String schemaPattern,
        -                                  java.lang.String typeNamePattern,
        -                                  int[] types)
        -                           throws java.sql.SQLException
        -
        Retrieves a description of the user-defined types (UDTs) defined - in a particular schema. Schema-specific UDTs may have type - JAVA_OBJECT, STRUCT, - or DISTINCT. - -

        Only types matching the catalog, schema, type name and type - criteria are returned. They are ordered by DATA_TYPE, - JDBC 4.1[TYPE_CAT,] TYPE_SCHEM and - TYPE_NAME. The type name parameter may be a fully-qualified - name. In this case, the catalog and schemaPattern parameters are - ignored. - -

        Each type description has the following columns: -

          -
        1. TYPE_CAT String => the type's catalog (may be null) -
        2. TYPE_SCHEM String => type's schema (may be null) -
        3. TYPE_NAME String => type name -
        4. CLASS_NAME String => Java class name -
        5. DATA_TYPE int => type value defined in java.sql.Types. - One of JAVA_OBJECT, STRUCT, or DISTINCT -
        6. REMARKS String => explanatory comment on the type -
        7. BASE_TYPE short => type code of the source type of a - DISTINCT type or the type that implements the user-generated - reference type of the SELF_REFERENCING_COLUMN of a structured - type as defined in java.sql.Types (null if DATA_TYPE is not - DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) -
        - -

        Note: If the driver does not support UDTs, an empty - result set is returned. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database.

        - - Starting with 2.0, DISTICT types are supported and are reported by this - method. -

        -
        -
        -
        Specified by:
        -
        getUDTs in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema pattern name; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        typeNamePattern - a type name pattern; must match the type name - as it is stored in the database; may be a fully qualified name
        -
        types - a list of user-defined types (JAVA_OBJECT, - STRUCT, or DISTINCT) to include; null returns all types
        -
        Returns:
        -
        ResultSet object in which each row describes a UDT
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        (JDBC4 clarification)
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException
        -
        Retrieves the connection that produced this metadata object. -

        -
        -
        Specified by:
        -
        getConnection in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the connection that produced this metadata object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        supportsSavepoints

        -
        public boolean supportsSavepoints()
        -                           throws java.sql.SQLException
        -
        Retrieves whether this database supports savepoints. - - -
        -

        HSQLDB-Specific Information:

        - - This SQL feature is supported through JDBC as well as SQL. - -

        -
        -
        -
        Specified by:
        -
        supportsSavepoints in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if savepoints are supported; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        supportsNamedParameters

        -
        public boolean supportsNamedParameters()
        -                                throws java.sql.SQLException
        -
        Retrieves whether this database supports named parameters to callable - statements. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports JDBC named parameters to - callable statements; this method returns true. - -

        -
        -
        -
        Specified by:
        -
        supportsNamedParameters in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if named parameters are supported; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        supportsMultipleOpenResults

        -
        public boolean supportsMultipleOpenResults()
        -                                    throws java.sql.SQLException
        -
        Retrieves whether it is possible to have multiple ResultSet objects - returned from a CallableStatement object - simultaneously. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports multiple ResultSet - objects returned from a CallableStatement; - this method always returns true.

        -

        -
        -
        -
        Specified by:
        -
        supportsMultipleOpenResults in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if a CallableStatement object - can return multiple ResultSet objects - simultaneously; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        supportsGetGeneratedKeys

        -
        public boolean supportsGetGeneratedKeys()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether auto-generated keys can be retrieved after - a statement has been executed - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports retrieval of - autogenerated keys through the JDBC interface; - this method always returns true.

        -

        -
        -
        -
        Specified by:
        -
        supportsGetGeneratedKeys in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if auto-generated keys can be retrieved - after a statement has executed; false otherwise -

        (JDBC4 Clarification:) -

        If true is returned, the JDBC driver must support the - returning of auto-generated keys for at least SQL INSERT statements -

        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getSuperTypes

        -
        public java.sql.ResultSet getSuperTypes​(java.lang.String catalog,
        -                                        java.lang.String schemaPattern,
        -                                        java.lang.String typeNamePattern)
        -                                 throws java.sql.SQLException
        -
        Retrieves a description of the user-defined type (UDT) hierarchies defined in a - particular schema in this database. Only the immediate super type - sub type relationship is modeled. -

        - Only supertype information for UDTs matching the catalog, - schema, and type name is returned. The type name parameter - may be a fully-qualified name. When the UDT name supplied is a - fully-qualified name, the catalog and schemaPattern parameters are - ignored. -

        - If a UDT does not have a direct super type, it is not listed here. - A row of the ResultSet object returned by this method - describes the designated UDT and a direct supertype. A row has the following - columns: -

          -
        1. TYPE_CAT String => the UDT's catalog (may be null) -
        2. TYPE_SCHEM String => UDT's schema (may be null) -
        3. TYPE_NAME String => type name of the UDT -
        4. SUPERTYPE_CAT String => the direct super type's catalog - (may be null) -
        5. SUPERTYPE_SCHEM String => the direct super type's schema - (may be null) -
        6. SUPERTYPE_NAME String => the direct super type's name -
        - -

        Note: If the driver does not support type hierarchies, an - empty result set is returned. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports the SQL Standard. It treats unquoted identifiers as - case insensitive in SQL and stores - them in upper case; it treats quoted identifiers as case sensitive and - stores them verbatim. All JDBCDatabaseMetaData methods perform - case-sensitive comparison between name (pattern) arguments and the - corresponding identifier values as they are stored in the database. - Therefore, care must be taken to specify name arguments precisely - (including case) as they are stored in the database.

        - - From 2.0, this feature is supported by default and return supertypes - for DOMAIN and DISTINCT types.

        - - If the jar is - compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - not supported. The default implementation is - the org.hsqldb.dbinfo.DatabaseInformationMain class. -

        -
        -
        -
        Specified by:
        -
        getSuperTypes in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; "" retrieves those without a catalog; - null means drop catalog name from the selection criteria
        -
        schemaPattern - a schema name pattern; "" retrieves those - without a schema
        -
        typeNamePattern - a UDT name pattern; may be a fully-qualified - name
        -
        Returns:
        -
        a ResultSet object in which a row gives information - about the designated UDT
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        (JDBC4 clarification)
        -
        -
      • -
      - - - -
        -
      • -

        getSuperTables

        -
        public java.sql.ResultSet getSuperTables​(java.lang.String catalog,
        -                                         java.lang.String schemaPattern,
        -                                         java.lang.String tableNamePattern)
        -                                  throws java.sql.SQLException
        -
        Retrieves a description of the table hierarchies defined in a particular - schema in this database. - -

        Only supertable information for tables matching the catalog, schema - and table name are returned. The table name parameter may be a fully- - qualified name, in which case, the catalog and schemaPattern parameters - are ignored. If a table does not have a super table, it is not listed here. - Supertables have to be defined in the same catalog and schema as the - sub tables. Therefore, the type description does not need to include - this information for the supertable. - -

        Each type description has the following columns: -

          -
        1. TABLE_CAT String => the type's catalog (may be null) -
        2. TABLE_SCHEM String => type's schema (may be null) -
        3. TABLE_NAME String => type name -
        4. SUPERTABLE_NAME String => the direct super type's name -
        - -

        Note: If the driver does not support type hierarchies, an - empty result set is returned. - - -

        -

        HSQLDB-Specific Information:

        - - This method is intended for tables of structured types. - From 2.0 this method returns an empty ResultSet. - the org.hsqldb.dbinfo.DatabaseInformationMain class. -

        -
        -
        -
        Specified by:
        -
        getSuperTables in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; "" retrieves those without a catalog; - null means drop catalog name from the selection criteria
        -
        schemaPattern - a schema name pattern; "" retrieves those - without a schema
        -
        tableNamePattern - a table name pattern; may be a fully-qualified - name
        -
        Returns:
        -
        a ResultSet object in which each row is a type description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        (JDBC4 clarification)
        -
        -
      • -
      - - - -
        -
      • -

        getAttributes

        -
        public java.sql.ResultSet getAttributes​(java.lang.String catalog,
        -                                        java.lang.String schemaPattern,
        -                                        java.lang.String typeNamePattern,
        -                                        java.lang.String attributeNamePattern)
        -                                 throws java.sql.SQLException
        -
        Retrieves a description of the given attribute of the given type - for a user-defined type (UDT) that is available in the given schema - and catalog. -

        - Descriptions are returned only for attributes of UDTs matching the - catalog, schema, type, and attribute name criteria. They are ordered by - JDBC 4.1[TYPE_CAT, ]TYPE_SCHEM, - TYPE_NAME and ORDINAL_POSITION. This description - does not contain inherited attributes. -

        - The ResultSet object that is returned has the following - columns: -

          -
        1. TYPE_CAT String => type catalog (may be null) -
        2. TYPE_SCHEM String => type schema (may be null) -
        3. TYPE_NAME String => type name -
        4. ATTR_NAME String => attribute name -
        5. DATA_TYPE int => attribute type SQL type from java.sql.Types -
        6. ATTR_TYPE_NAME String => Data source dependent type name. - For a UDT, the type name is fully qualified. For a REF, the type name is - fully qualified and represents the target type of the reference type. -
        7. ATTR_SIZE int => column size. For char or date - types this is the maximum number of characters; for numeric or - decimal types this is precision. -
        8. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where - DECIMAL_DIGITS is not applicable. -
        9. NUM_PREC_RADIX int => Radix (typically either 10 or 2) -
        10. NULLABLE int => whether NULL is allowed -
            -
          • attributeNoNulls - might not allow NULL values -
          • attributeNullable - definitely allows NULL values -
          • attributeNullableUnknown - nullability unknown -
          -
        11. REMARKS String => comment describing column (may be null) -
        12. ATTR_DEF String => default value (may be null) -
        13. SQL_DATA_TYPE int => unused -
        14. SQL_DATETIME_SUB int => unused -
        15. CHAR_OCTET_LENGTH int => for char types the - maximum number of bytes in the column -
        16. ORDINAL_POSITION int => index of JDBC 4.1 correction[the attribute in the UDT] - (starting at 1) -
        17. IS_NULLABLE String => ISO rules are used to determine - the nullability for a column. -
            -
          • YES --- if the JDBC 4.1 correction[attribute] can include NULLs -
          • NO --- if the JDBC 4.1 correction[attribute] cannot include NULLs -
          • empty string --- if the nullability for the - JDBC 4.1 correction[attribute] is unknown -
          -
        18. SCOPE_CATALOG String => catalog of table that is the - scope of a reference attribute (null if DATA_TYPE isn't REF) -
        19. SCOPE_SCHEMA String => schema of table that is the - scope of a reference attribute (null if DATA_TYPE isn't REF) -
        20. SCOPE_TABLE String => table name that is the scope of a - reference attribute (null if the DATA_TYPE isn't REF) -
        21. SOURCE_DATA_TYPE short => source type of a distinct type or user-generated - Ref type,SQL type from java.sql.Types (null if DATA_TYPE - isn't DISTINCT or user-generated REF) -
        - - -
        -

        HSQLDB-Specific Information:

        - - This method is intended for attributes of structured types. - From 2.0 this method returns an empty ResultSet. -

        -
        -
        -
        Specified by:
        -
        getAttributes in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        typeNamePattern - a type name pattern; must match the - type name as it is stored in the database
        -
        attributeNamePattern - an attribute name pattern; must match the attribute - name as it is declared in the database
        -
        Returns:
        -
        a ResultSet object in which each row is an - attribute description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        supportsResultSetHoldability

        -
        public boolean supportsResultSetHoldability​(int holdability)
        -                                     throws java.sql.SQLException
        -
        Retrieves whether this database supports the given result set holdability. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB returns true for both alternatives.

        - -

        -
        -
        -
        Specified by:
        -
        supportsResultSetHoldability in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        holdability - one of the following constants: - ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        JDBCConnection
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetHoldability

        -
        public int getResultSetHoldability()
        -                            throws java.sql.SQLException
        -
        (JDBC4 clarification:) - Retrieves this database's default holdability for ResultSet - objects. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB defaults to HOLD_CURSORS_OVER_COMMIT for CONSUR_READ_ONLY - ResultSet objects. - If the ResultSet concurrency is CONCUR_UPDATABLE, then holdability is - is enforced as CLOSE_CURSORS_AT_COMMIT.

        - -

        -
        -
        -
        Specified by:
        -
        getResultSetHoldability in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the default holdability; either - ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseMajorVersion

        -
        public int getDatabaseMajorVersion()
        -                            throws java.sql.SQLException
        -
        Retrieves the major version number of the underlying database. - - -
        -

        HSQLDB-Specific Information:

        - Returns the major version -

        -
        -
        -
        Specified by:
        -
        getDatabaseMajorVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the underlying database's major version
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseMinorVersion

        -
        public int getDatabaseMinorVersion()
        -                            throws java.sql.SQLException
        -
        Retrieves the minor version number of the underlying database. - - -
        -

        HSQLDB-Specific Information:

        - - This returns the digit after the first point in version. -

        -
        -
        -
        Specified by:
        -
        getDatabaseMinorVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        underlying database's minor version
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getJDBCMajorVersion

        -
        public int getJDBCMajorVersion()
        -                        throws java.sql.SQLException
        -
        Retrieves the major JDBC version number for this - driver. - - -
        -

        HSQLDB-Specific Information:

        -

        -
        -
        -
        Specified by:
        -
        getJDBCMajorVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        JDBC version major number
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getJDBCMinorVersion

        -
        public int getJDBCMinorVersion()
        -                        throws java.sql.SQLException
        -
        Retrieves the minor JDBC version number for this - driver. - - -
        -

        HSQLDB-Specific Information:

        -

        -
        -
        -
        Specified by:
        -
        getJDBCMinorVersion in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        JDBC version minor number
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getSQLStateType

        -
        public int getSQLStateType()
        -                    throws java.sql.SQLException
        -
        (JDBC4 modified:) - Indicates whether the SQLSTATE returned by SQLException.getSQLState - is X/Open (now known as Open Group) SQL CLI or SQL:2003. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB returns sqlStateSQL under JDBC4 which is equivalent - to JDBC3 value of sqlStateSQL99.

        -

        -
        -
        -
        Specified by:
        -
        getSQLStateType in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the type of SQLSTATE; one of: - sqlStateXOpen or - sqlStateSQL - -

        sqlStateSQL is new in JDBC4 and its value is the same as JDBC3 sqlStateSQL99

        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        locatorsUpdateCopy

        -
        public boolean locatorsUpdateCopy()
        -                           throws java.sql.SQLException
        -
        Indicates whether updates made to a LOB are made on a copy or directly - to the LOB. - - -
        -

        HSQLDB-Specific Information:

        - - Updates to a LOB are made directly. This means the lobs in an updatable - ResultSet can be updated and the change is applied when the updateRow() - method is applied. Lobs created by calling the Connection methods - createClob() and createBlob() can be updated. The lob can then be sent to - the database in a PreparedStatement with an UPDATE or INSERT SQL - statement. - -

        -
        -
        -
        Specified by:
        -
        locatorsUpdateCopy in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if updates are made to a copy of the LOB; - false if updates are made directly to the LOB
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        supportsStatementPooling

        -
        public boolean supportsStatementPooling()
        -                                 throws java.sql.SQLException
        -
        Retrieves whether this database supports statement pooling. - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB supports statement pooling when built under - JDK 1.6+.

        -

        -
        -
        -
        Specified by:
        -
        supportsStatementPooling in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getRowIdLifetime

        -
        public java.sql.RowIdLifetime getRowIdLifetime()
        -                                        throws java.sql.SQLException
        -
        Indicates whether or not this data source supports the SQL ROWID type, - and if so the lifetime for which a RowId object remains valid. -

        - The returned int values have the following relationship: -

        
        -     ROWID_UNSUPPORTED < ROWID_VALID_OTHER < ROWID_VALID_TRANSACTION
        -         < ROWID_VALID_SESSION < ROWID_VALID_FOREVER
        - 
        - so conditional logic such as -
        
        -     if (metadata.getRowIdLifetime() > DatabaseMetaData.ROWID_VALID_TRANSACTION)
        - 
        - can be used. Valid Forever means valid across all Sessions, and valid for - a Session means valid across all its contained Transactions.
        -
        -
        Specified by:
        -
        getRowIdLifetime in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the status indicating the lifetime of a RowId
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        -
      • -
      - - - -
        -
      • -

        getSchemas

        -
        public java.sql.ResultSet getSchemas​(java.lang.String catalog,
        -                                     java.lang.String schemaPattern)
        -                              throws java.sql.SQLException
        -
        Retrieves the schema names available in this database. The results - are ordered by JDBC 4.1[TABLE_CATALOG] and - TABLE_SCHEM. - -

        The schema columns are: -

          -
        1. TABLE_SCHEM String => schema name -
        2. TABLE_CATALOG String => catalog name (may be null) -
        -
        -
        Specified by:
        -
        getSchemas in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it is stored - in the database;"" retrieves those without a catalog; null means catalog - name should not be used to narrow down the search.
        -
        schemaPattern - a schema name; must match the schema name as it is - stored in the database; null means - schema name should not be used to narrow down the search.
        -
        Returns:
        -
        a ResultSet object in which each row is a - schema description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        supportsStoredFunctionsUsingCallSyntax

        -
        public boolean supportsStoredFunctionsUsingCallSyntax()
        -                                               throws java.sql.SQLException
        -
        Retrieves whether this database supports invoking user-defined or vendor functions - using the stored procedure escape syntax.
        -
        -
        Specified by:
        -
        supportsStoredFunctionsUsingCallSyntax in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        -
      • -
      - - - -
        -
      • -

        autoCommitFailureClosesAllResultSets

        -
        public boolean autoCommitFailureClosesAllResultSets()
        -                                             throws java.sql.SQLException
        -
        Retrieves whether a SQLException while autoCommit is true indicates - that all open ResultSets are closed, even ones that are holdable. When a SQLException occurs while - autocommit is true, it is vendor specific whether the JDBC driver responds with a commit operation, a - rollback operation, or by doing neither a commit nor a rollback. A potential result of this difference - is in whether or not holdable ResultSets are closed.
        -
        -
        Specified by:
        -
        autoCommitFailureClosesAllResultSets in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        -
      • -
      - - - -
        -
      • -

        getClientInfoProperties

        -
        public java.sql.ResultSet getClientInfoProperties()
        -                                           throws java.sql.SQLException
        -
        Retrieves a list of the client info properties - that the driver supports. The result set contains the following columns -
          -
        1. NAME String=> The name of the client info property
          -
        2. MAX_LEN int=> The maximum length of the value for the property
          -
        3. DEFAULT_VALUE String=> The default value of the property
          -
        4. DESCRIPTION String=> A description of the property. This will typically - contain information as to where this property is - stored in the database. -
        -

        - The ResultSet is sorted by the NAME column -

        -
        -
        Specified by:
        -
        getClientInfoProperties in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        A ResultSet object; each row is a supported client info - property -

        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs -

        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        -
      • -
      - - - -
        -
      • -

        getFunctions

        -
        public java.sql.ResultSet getFunctions​(java.lang.String catalog,
        -                                       java.lang.String schemaPattern,
        -                                       java.lang.String functionNamePattern)
        -                                throws java.sql.SQLException
        -
        Retrieves a description of the JDBC 4.1[ system and ]user functions available - in the given catalog. -

        - Only system and user function descriptions matching the schema and - function name criteria are returned. They are ordered by - FUNCTION_CAT, FUNCTION_SCHEM, - FUNCTION_NAME and - SPECIFIC_ NAME. - -

        Each function description has the following columns: -

          -
        1. FUNCTION_CAT String => function catalog (may be null) -
        2. FUNCTION_SCHEM String => function schema (may be null) -
        3. FUNCTION_NAME String => function name. This is the name - used to invoke the function -
        4. REMARKS String => explanatory comment on the function -
        5. FUNCTION_TYPE short => kind of function: -
            -
          • functionResultUnknown - Cannot determine if a return value - or table will be returned -
          • functionNoTable- Does not return a table -
          • functionReturnsTable - Returns a table -
          -
        6. SPECIFIC_NAME String => the name which uniquely identifies - this function within its schema. This is a user specified, or DBMS - generated, name that may be different then the FUNCTION_NAME - for example with overload functions -
        -

        - A user may not have permission to execute any of the functions that are - returned by getFunctions

        -
        -
        Specified by:
        -
        getFunctions in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        functionNamePattern - a function name pattern; must match the - function name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row is a function description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        getFunctionColumns

        -
        public java.sql.ResultSet getFunctionColumns​(java.lang.String catalog,
        -                                             java.lang.String schemaPattern,
        -                                             java.lang.String functionNamePattern,
        -                                             java.lang.String columnNamePattern)
        -                                      throws java.sql.SQLException
        -
        Retrieves a description of the given catalog's system or user - function parameters and return type. - -

        Only descriptions matching the schema, function and - parameter name criteria are returned. They are ordered by - FUNCTION_CAT, FUNCTION_SCHEM, - FUNCTION_NAME and - SPECIFIC_ NAME. Within this, the return value, - if any, is first. Next are the parameter descriptions in call - order. The column descriptions follow in column number order. - -

        Each row in the ResultSet - is a parameter description, column description or - return type description with the following fields: -

          -
        1. FUNCTION_CAT String => function catalog (may be null) -
        2. FUNCTION_SCHEM String => function schema (may be null) -
        3. FUNCTION_NAME String => function name. This is the name - used to invoke the function -
        4. COLUMN_NAME String => column/parameter name -
        5. COLUMN_TYPE Short => kind of column/parameter: -
            -
          • functionColumnUnknown - nobody knows -
          • functionColumnIn - IN parameter -
          • functionColumnInOut - INOUT parameter -
          • functionColumnOut - OUT parameter -
          • functionColumnReturn - function return value -
          • functionColumnResult - Indicates that the parameter or column - is a column in the ResultSet -
          -
        6. DATA_TYPE int => SQL type from java.sql.Types -
        7. TYPE_NAME String => SQL type name, for a UDT type the - type name is fully qualified -
        8. PRECISION int => precision -
        9. LENGTH int => length in bytes of data -
        10. SCALE short => scale - null is returned for data types where - SCALE is not applicable. -
        11. RADIX short => radix -
        12. NULLABLE short => can it contain NULL. -
            -
          • functionNoNulls - does not allow NULL values -
          • functionNullable - allows NULL values -
          • functionNullableUnknown - nullability unknown -
          -
        13. REMARKS String => comment describing column/parameter -
        14. CHAR_OCTET_LENGTH int => the maximum length of binary - and character based parameters or columns. For any other datatype the returned value - is a NULL -
        15. ORDINAL_POSITION int => the ordinal position, starting - from 1, for the input and output parameters. A value of 0 - is returned if this row describes the function's return value. - For result set columns, it is the - ordinal position of the column in the result set starting from 1. -
        16. IS_NULLABLE String => ISO rules are used to determine - the nullability for a parameter or column. -
            -
          • YES --- if the parameter or column can include NULLs -
          • NO --- if the parameter or column cannot include NULLs -
          • empty string --- if the nullability for the - parameter or column is unknown -
          -
        17. SPECIFIC_NAME String => the name which uniquely identifies - this function within its schema. This is a user specified, or DBMS - generated, name that may be different then the FUNCTION_NAME - for example with overload functions -
        - -

        The PRECISION column represents the specified column size for the given - parameter or column. - For numeric data, this is the maximum precision. For character data, this is the length in characters. - For datetime datatypes, this is the length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - this is the length in bytes. Null is returned for data types where the - column size is not applicable.

        -
        -
        Specified by:
        -
        getFunctionColumns in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        functionNamePattern - a procedure name pattern; must match the - function name as it is stored in the database
        -
        columnNamePattern - a parameter name pattern; must match the - parameter or column name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row describes a - user function parameter, column or return type
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        See Also:
        -
        getSearchStringEscape()
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to non-standard methods, - or standard methods not exposed by the proxy. - The result may be either the object found to implement the interface or a proxy for that object. - If the receiver implements the interface then that is the object. If the receiver is a wrapper - and the wrapped object implements the interface then that is the object. Otherwise the object is - the result of calling unwrap recursively on the wrapped object. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 1.9
        -
        -
      • -
      - - - -
        -
      • -

        getPseudoColumns

        -
        public java.sql.ResultSet getPseudoColumns​(java.lang.String catalog,
        -                                           java.lang.String schemaPattern,
        -                                           java.lang.String tableNamePattern,
        -                                           java.lang.String columnNamePattern)
        -                                    throws java.sql.SQLException
        -
        Retrieves a description of the pseudo or hidden columns available - in a given table within the specified catalog and schema. - Pseudo or hidden columns may not always be stored within - a table and are not visible in a ResultSet unless they are - specified in the query's outermost SELECT list. Pseudo or hidden - columns may not necessarily be able to be modified. If there are - no pseudo or hidden columns, an empty ResultSet is returned. - -

        Only column descriptions matching the catalog, schema, table - and column name criteria are returned. They are ordered by - TABLE_CAT,TABLE_SCHEM, TABLE_NAME - and COLUMN_NAME. - -

        Each column description has the following columns: -

          -
        1. TABLE_CAT String => table catalog (may be null) -
        2. TABLE_SCHEM String => table schema (may be null) -
        3. TABLE_NAME String => table name -
        4. COLUMN_NAME String => column name -
        5. DATA_TYPE int => SQL type from java.sql.Types -
        6. COLUMN_SIZE int => column size. -
        7. DECIMAL_DIGITS int => the number of fractional digits. Null is returned for data types where - DECIMAL_DIGITS is not applicable. -
        8. NUM_PREC_RADIX int => Radix (typically either 10 or 2) -
        9. COLUMN_USAGE String => The allowed usage for the column. The - value returned will correspond to the enum name returned by PseudoColumnUsage.name() -
        10. REMARKS String => comment describing column (may be null) -
        11. CHAR_OCTET_LENGTH int => for char types the - maximum number of bytes in the column -
        12. IS_NULLABLE String => ISO rules are used to determine the nullability for a column. -
            -
          • YES --- if the column can include NULLs -
          • NO --- if the column cannot include NULLs -
          • empty string --- if the nullability for the column is unknown -
          -
        - -

        The COLUMN_SIZE column specifies the column size for the given column. - For numeric data, this is the maximum precision. For character data, this is the length in characters. - For datetime datatypes, this is the length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - this is the length in bytes. Null is returned for data types where the - column size is not applicable.

        -
        -
        Specified by:
        -
        getPseudoColumns in interface java.sql.DatabaseMetaData
        -
        Parameters:
        -
        catalog - a catalog name; must match the catalog name as it - is stored in the database; "" retrieves those without a catalog; - null means that the catalog name should not be used to narrow - the search
        -
        schemaPattern - a schema name pattern; must match the schema name - as it is stored in the database; "" retrieves those without a schema; - null means that the schema name should not be used to narrow - the search
        -
        tableNamePattern - a table name pattern; must match the - table name as it is stored in the database
        -
        columnNamePattern - a column name pattern; must match the column - name as it is stored in the database
        -
        Returns:
        -
        ResultSet - each row is a column description
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        See Also:
        -
        PseudoColumnUsage
        -
        -
      • -
      - - - -
        -
      • -

        generatedKeyAlwaysReturned

        -
        public boolean generatedKeyAlwaysReturned()
        -                                   throws java.sql.SQLException
        -
        Retrieves whether a generated key will always be returned if the column - name(s) or index(es) specified for the auto generated key column(s) - are valid and the statement succeeds. The key that is returned may or - may not be based on the column(s) for the auto generated key. - Consult your JDBC driver documentation for additional details.
        -
        -
        Specified by:
        -
        generatedKeyAlwaysReturned in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      - - - -
        -
      • -

        getMaxLogicalLobSize

        -
        public long getMaxLogicalLobSize()
        -                          throws java.sql.SQLException
        -
        Retrieves the maximum number of bytes this database allows for - the logical size for a LOB.
        -
        -
        Specified by:
        -
        getMaxLogicalLobSize in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        the maximum number of bytes allowed; a result of zero - means that there is no limit or the limit is not known
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        1.8
        -
        -
      • -
      - - - -
        -
      • -

        supportsRefCursors

        -
        public boolean supportsRefCursors()
        -                           throws java.sql.SQLException
        -
        Retrieves whether this database supports REF CURSOR.
        -
        -
        Specified by:
        -
        supportsRefCursors in interface java.sql.DatabaseMetaData
        -
        Returns:
        -
        true if this database supports REF CURSOR; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        1.8
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseDefaultCollation

        -
        public java.lang.String getDatabaseDefaultCollation()
        -
        Returns the name of the default collation for database.
        -
        -
        Returns:
        -
        name of collation
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDriver.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDriver.html deleted file mode 100644 index b92ba0d4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCDriver.html +++ /dev/null @@ -1,767 +0,0 @@ - - - - - -JDBCDriver (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCDriver

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCDriver
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Driver
    -
    -
    -
    public class JDBCDriver
    -extends java.lang.Object
    -implements java.sql.Driver
    -
    Provides the java.sql.Driver interface implementation required by - the JDBC specification.

    - - The Java SQL framework allows for multiple database drivers.

    - - The DriverManager will try to load as many drivers as it can find and - then for any given connection request, it will ask each driver in turn - to try to connect to the target URL.

    - - The application developer will normally not need to call any function of - the Driver directly. All required calls are made by the DriverManager. - - -

    -

    HSQLDB-Specific Information:

    - - When the HSQL Database Engine Driver class is loaded, it creates an - instance of itself and register it with the DriverManager. This means - that a user can load and register the HSQL Database Engine driver by - calling: -

    -  Class.forName("org.hsqldb.jdbc.JDBCDriver")
    -  
    - - For detailed information about how to obtain HSQLDB JDBC Connections, - please see JDBCConnection. - -
    - - JDBC 4.0 notes:

    - - Starting with JDBC 4.0 (JDK 1.6), the DriverManager methods - getConnection and getDrivers have been - enhanced to support the Java Standard Edition Service Provider mechanism. - When built under a Java runtime that supports JDBC 4.0, HSQLDB distribution - jars containing the Driver implementation also include the file - META-INF/services/java.sql.Driver. This file contains the fully - qualified class name ('org.hsqldb.jdbc.JDBCDriver') of the HSQLDB implementation - of java.sql.Driver.

    - - Hence, under JDBC 4.0 or greater, applications no longer need to explicitly - load the HSQLDB JDBC driver using Class.forName(). Of course, - existing programs which do load JDBC drivers using - Class.forName() will continue to work without modification.

    - - JDBC 4.2 methods added in Java 8 are generally supported when the HSQLDB jar - is compiled with JDK 8 -


    -
    -
    Since:
    -
    HSQLDB 1.9.0 -
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCConnection
    - -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static JDBCDriverdriverInstance 
      java.lang.ThreadLocal<JDBCConnection>threadConnection -
      As a separate instance of this class is registered with DriverManager - for each class loader, the threadConnection is not declared as static.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCDriver() -
      Default constructor
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanacceptsURL​(java.lang.String url) -
      Returns true if the driver thinks that it can open a connection to - the given URL.
      -
      java.sql.Connectionconnect​(java.lang.String url, - java.util.Properties info) -
      Attempts to make a database connection to the given URL.
      -
      static java.sql.ConnectiongetConnection​(java.lang.String url, - java.util.Properties info) -
      The static equivalent of the connect(String,Properties) - method.
      -
      intgetMajorVersion() -
      Gets the driver's major version number.
      -
      intgetMinorVersion() -
      Gets the driver's minor version number.
      -
      java.util.logging.LoggergetParentLogger() -
      Return the parent Logger of all the Loggers used by this driver.
      -
      java.sql.DriverPropertyInfo[]getPropertyInfo​(java.lang.String url, - java.util.Properties info) -
      Gets information about the possible properties for this driver.
      -
      booleanjdbcCompliant() -
      Reports whether this driver is a genuine JDBC Compliant™ driver.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        driverInstance

        -
        public static final JDBCDriver driverInstance
        -
      • -
      - - - -
        -
      • -

        threadConnection

        -
        public final java.lang.ThreadLocal<JDBCConnection> threadConnection
        -
        As a separate instance of this class is registered with DriverManager - for each class loader, the threadConnection is not declared as static. - The registered instance is kept to allow access to its threadConnection.
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCDriver

        -
        public JDBCDriver()
        -
        Default constructor
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        connect

        -
        public java.sql.Connection connect​(java.lang.String url,
        -                                   java.util.Properties info)
        -                            throws java.sql.SQLException
        -
        Attempts to make a database connection to the given URL.

        - - Returns "null" if this is the wrong kind of driver to connect to the - given URL. This will be common, as when the JDBC driver manager is asked - to connect to a given URL it passes the URL to each loaded driver in - turn. - -

        The driver throws an SQLException if it is the right - driver to connect to the given URL but has trouble connecting to - the database. - -

        The java.util.Properties argument can be used to pass - arbitrary string tag/value pairs as connection arguments. - Normally at least "user" and "password" properties should be - included in the Properties object. - - -

        -

        HSQLDB-Specific Information:

        - - For the HSQL Database Engine, at least "user" and - "password" properties should be included in the Properties.

        - - From version 1.7.1, two optional properties are supported: - -

          -
        • get_column_name (default true) - if set to false, - a ResultSetMetaData.getColumnName() call will return the user - defined label (getColumnLabel()) instead of the column - name.
          - - This property is available in order to achieve - compatibility with certain non-HSQLDB JDBC driver - implementations.
        • - -
        • strict_md if set to true, some ResultSetMetaData - methods return more strict values for compatibility - reasons.
        • -

        - - From version 1.8.0.x, strict_md is deprecated (ignored) - because metadata reporting is always strict (JDBC-compliant), and - three new optional properties are supported: - -

          -
        • ifexits (default false) - when true, an exception - is raised when attempting to connect to an in-process - file: or mem: scheme database instance if it has not yet been - created. When false, an in-process file: or mem: scheme - database instance is created automatically if it has not yet - been created. This property does not apply to requests for - network or res: (i.e. files_in_jar) scheme connections.
        • - -
        • shutdown (default false) - when true, the - the target database mimics the behaviour of 1.7.1 and older - versions. When the last connection to a database is closed, - the database is automatically shut down. The property takes - effect only when the first connection is made to the database. - This means the connection that opens the database. It has no - effect if used with subsequent, simultaneous connections.
          - - This command has two uses. One is for test suites, where - connections to the database are made from one JVM context, - immediately followed by another context. The other use is for - applications where it is not easy to configure the environment - to shutdown the database. Examples reported by users include - web application servers, where the closing of the last - connection coincides with the web application being shut down. -
        • - -
        • default_schema - backwards compatibility feature. - To be used for clients written before HSQLDB schema support. - Denotes whether to use the default schema when a schema - qualifier is not included in a database object's SQL identifier - character sequence. Also affects the semantics of - DatabaseMetaData calls that supply null-valued schemaNamePattern - parameter values.
        • -
        - - -
        -
        -
        Specified by:
        -
        connect in interface java.sql.Driver
        -
        Parameters:
        -
        url - the URL of the database to which to connect
        -
        info - a list of arbitrary string tag/value pairs as connection - arguments. Normally at least a "user" and "password" property - should be included.
        -
        Returns:
        -
        a Connection object that represents a - connection to the URL
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public static java.sql.Connection getConnection​(java.lang.String url,
        -                                                java.util.Properties info)
        -                                         throws java.sql.SQLException
        -
        The static equivalent of the connect(String,Properties) - method.

        -
        -
        Parameters:
        -
        url - the URL of the database to which to connect
        -
        info - a list of arbitrary string tag/value pairs as connection - arguments including at least at a "user" and a "password" property
        -
        Returns:
        -
        a Connection object that represents a - connection to the URL
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        acceptsURL

        -
        public boolean acceptsURL​(java.lang.String url)
        -
        Returns true if the driver thinks that it can open a connection to - the given URL. Typically drivers will return true if they understand - the subprotocol specified in the URL and false if they don't.
        -
        -
        Specified by:
        -
        acceptsURL in interface java.sql.Driver
        -
        Parameters:
        -
        url - the URL of the database
        -
        Returns:
        -
        true if this driver can connect to the given URL
        -
        -
      • -
      - - - -
        -
      • -

        getPropertyInfo

        -
        public java.sql.DriverPropertyInfo[] getPropertyInfo​(java.lang.String url,
        -                                                     java.util.Properties info)
        -
        Gets information about the possible properties for this driver.

        - - The getPropertyInfo method is intended to allow a generic GUI tool - to discover what properties it should prompt a human for in order to - get enough information to connect to a database. Note that depending - on the values the human has supplied so far, additional values may - become necessary, so it may be necessary to iterate though several - calls to getPropertyInfo. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB uses the values submitted in info to set the value for - each DriverPropertyInfo object returned. It does not use the default - value that it would use for the property if the value is null.

        - -

        -
        -
        Specified by:
        -
        getPropertyInfo in interface java.sql.Driver
        -
        Parameters:
        -
        url - the URL of the database to which to connect
        -
        info - a proposed list of tag/value pairs that will be sent on - connect open
        -
        Returns:
        -
        an array of DriverPropertyInfo objects describing possible - properties. This array may be an empty array if no properties - are required.
        -
        -
      • -
      - - - -
        -
      • -

        getMajorVersion

        -
        public int getMajorVersion()
        -
        Gets the driver's major version number.
        -
        -
        Specified by:
        -
        getMajorVersion in interface java.sql.Driver
        -
        Returns:
        -
        this driver's major version number
        -
        -
      • -
      - - - -
        -
      • -

        getMinorVersion

        -
        public int getMinorVersion()
        -
        Gets the driver's minor version number.
        -
        -
        Specified by:
        -
        getMinorVersion in interface java.sql.Driver
        -
        Returns:
        -
        this driver's minor version number
        -
        -
      • -
      - - - -
        -
      • -

        jdbcCompliant

        -
        public boolean jdbcCompliant()
        -
        Reports whether this driver is a genuine JDBC Compliant™ driver. - A driver may only report - true here if it passes the JDBC compliance tests; otherwise - it is required to return false.

        - - JDBC compliance requires full support for the JDBC API and full support - for SQL 92 Entry Level. - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 is aimed to be compliant with JDBC 4.2 specification. - It supports SQL 92 Entry Level and beyond. -

        - - This method is not intended to encourage the development of non-JDBC - compliant drivers, but is a recognition of the fact that some vendors - are interested in using the JDBC API and framework for lightweight - databases that do not support full database functionality, or for - special databases such as document information retrieval where a SQL - implementation may not be feasible.
        -
        -
        Specified by:
        -
        jdbcCompliant in interface java.sql.Driver
        -
        Returns:
        -
        true if this driver is JDBC Compliant; - false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        getParentLogger

        -
        public java.util.logging.Logger getParentLogger()
        -                                         throws java.sql.SQLFeatureNotSupportedException
        -
        Return the parent Logger of all the Loggers used by this driver. This - should be the Logger farthest from the root Logger that is - still an ancestor of all of the Loggers used by this driver. Configuring - this Logger will affect all of the log messages generated by the driver. - In the worst case, this may be the root Logger.
        -
        -
        Specified by:
        -
        getParentLogger in interface java.sql.Driver
        -
        Returns:
        -
        the parent Logger for this driver
        -
        Throws:
        -
        java.sql.SQLFeatureNotSupportedException - if the driver does not use java.util.logging.
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCNClob.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCNClob.html deleted file mode 100644 index 57688bef..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCNClob.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - -JDBCNClob (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCNClob

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Clob, java.sql.NClob
    -
    -
    -
    public class JDBCNClob
    -extends JDBCClob
    -implements java.sql.NClob
    -
    The mapping in the Java™ programming language - for the SQL NCLOB type. - An SQL NCLOB is a built-in type - that stores a Character Large Object using the National Character Set - as a column value in a row of a database table. -

    The NClob interface extends the Clob interface - which provides methods for getting the - length of an SQL NCLOB value, - for materializing a NCLOB value on the client, and for - searching for a substring or NCLOB object within a - NCLOB value. A NClob object, just like a Clob object, is valid for the duration - of the transaction in which it was created. - Methods in the interfaces ResultSet, - CallableStatement, and PreparedStatement, such as - getNClob and setNClob allow a programmer to - access an SQL NCLOB value. In addition, this interface - has methods for updating a NCLOB value. - - -

    -

    HSQLDB-Specific Information:

    - - First, it should be noted that since HSQLDB represents all character data - internally as Java UNICODE (UTF16) String objects, there is not currently any - appreciable difference between the HSQLDB XXXCHAR types and the SQL 2003 - NXXXCHAR and NCLOB types.

    - - See JDBCClob for further information. - -

    -
    -
    -
    Since:
    -
    JDK 1.6, HSQLDB 2.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCClob, -JDBCClobClient
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCNClob

        -
        public JDBCNClob​(java.lang.String data)
        -          throws java.sql.SQLException
        -
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCParameterMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCParameterMetaData.html deleted file mode 100644 index 511cc189..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCParameterMetaData.html +++ /dev/null @@ -1,689 +0,0 @@ - - - - - -JDBCParameterMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCParameterMetaData

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCParameterMetaData
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.ParameterMetaData, java.sql.Wrapper
    -
    -
    -
    public class JDBCParameterMetaData
    -extends java.lang.Object
    -implements java.sql.ParameterMetaData, java.sql.Wrapper
    -
    An object that can be used to get information about the types - and properties for each parameter marker in a - PreparedStatement object. (JDBC4 Clarification:) For some queries and driver - implementations, the data that would be returned by a ParameterMetaData - object may not be available until the PreparedStatement has - been executed. -

    - Some driver implementations may not be able to provide information about the - types and properties for each parameter marker in a CallableStatement - object.

    -
    -
    Since:
    -
    JDK 1.4, HSQLDB 1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface java.sql.ParameterMetaData

        -parameterModeIn, parameterModeInOut, parameterModeOut, parameterModeUnknown, parameterNoNulls, parameterNullable, parameterNullableUnknown
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringgetParameterClassName​(int param) -
      Retrieves the fully-qualified name of the Java class whose instances - should be passed to the method PreparedStatement.setObject.
      -
      intgetParameterCount() -
      Retrieves the number of parameters in the PreparedStatement - object for which this ParameterMetaData object contains - information.
      -
      intgetParameterMode​(int param) -
      Retrieves the designated parameter's mode.
      -
      intgetParameterType​(int param) -
      Retrieves the designated parameter's SQL type.
      -
      java.lang.StringgetParameterTypeName​(int param) -
      Retrieves the designated parameter's database-specific type name.
      -
      intgetPrecision​(int param) -
      Retrieves the designated parameter's specified column size.
      -
      intgetScale​(int param) -
      Retrieves the designated parameter's number of digits to right of the decimal point.
      -
      intisNullable​(int param) -
      Retrieves whether null values are allowed in the designated parameter.
      -
      booleanisSigned​(int param) -
      Retrieves whether values for the designated parameter can be signed numbers.
      -
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      java.lang.StringtoString() -
      Retrieves a String representation of this object.
      -
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getParameterCount

        -
        public int getParameterCount()
        -                      throws java.sql.SQLException
        -
        Retrieves the number of parameters in the PreparedStatement - object for which this ParameterMetaData object contains - information.
        -
        -
        Specified by:
        -
        getParameterCount in interface java.sql.ParameterMetaData
        -
        Returns:
        -
        the number of parameters
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        isNullable

        -
        public int isNullable​(int param)
        -               throws java.sql.SQLException
        -
        Retrieves whether null values are allowed in the designated parameter.
        -
        -
        Specified by:
        -
        isNullable in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        the nullability status of the given parameter; one of - ParameterMetaData.parameterNoNulls, - ParameterMetaData.parameterNullable, or - ParameterMetaData.parameterNullableUnknown
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        isSigned

        -
        public boolean isSigned​(int param)
        -                 throws java.sql.SQLException
        -
        Retrieves whether values for the designated parameter can be signed numbers.
        -
        -
        Specified by:
        -
        isSigned in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getPrecision

        -
        public int getPrecision​(int param)
        -                 throws java.sql.SQLException
        -
        Retrieves the designated parameter's specified column size. - -

        The returned value represents the maximum column size for the given parameter. - For numeric data, this is the maximum precision. For character data, this is the length in characters. - For datetime datatypes, this is the length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - this is the length in bytes. 0 is returned for data types where the - column size is not applicable.

        -
        -
        Specified by:
        -
        getPrecision in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        precision
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getScale

        -
        public int getScale​(int param)
        -             throws java.sql.SQLException
        -
        Retrieves the designated parameter's number of digits to right of the decimal point. - 0 is returned for data types where the scale is not applicable.
        -
        -
        Specified by:
        -
        getScale in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        scale
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getParameterType

        -
        public int getParameterType​(int param)
        -                     throws java.sql.SQLException
        -
        Retrieves the designated parameter's SQL type.
        -
        -
        Specified by:
        -
        getParameterType in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        SQL type from java.sql.Types
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        getParameterTypeName

        -
        public java.lang.String getParameterTypeName​(int param)
        -                                      throws java.sql.SQLException
        -
        Retrieves the designated parameter's database-specific type name.
        -
        -
        Specified by:
        -
        getParameterTypeName in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        type the name used by the database. If the parameter type is - a user-defined type, then a fully-qualified type name is returned.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getParameterClassName

        -
        public java.lang.String getParameterClassName​(int param)
        -                                       throws java.sql.SQLException
        -
        Retrieves the fully-qualified name of the Java class whose instances - should be passed to the method PreparedStatement.setObject.
        -
        -
        Specified by:
        -
        getParameterClassName in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        the fully-qualified name of the class in the Java programming - language that would be used by the method - PreparedStatement.setObject to set the value - in the specified parameter. This is the class name used - for custom mapping.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        getParameterMode

        -
        public int getParameterMode​(int param)
        -                     throws java.sql.SQLException
        -
        Retrieves the designated parameter's mode.
        -
        -
        Specified by:
        -
        getParameterMode in interface java.sql.ParameterMetaData
        -
        Parameters:
        -
        param - the first parameter is 1, the second is 2, ...
        -
        Returns:
        -
        mode of the parameter; one of - ParameterMetaData.parameterModeIn, - ParameterMetaData.parameterModeOut, or - ParameterMetaData.parameterModeInOut - ParameterMetaData.parameterModeUnknown.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.2
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return - the result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Retrieves a String representation of this object.

        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        a String representation of this object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCPool.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCPool.html deleted file mode 100644 index 803d9f57..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCPool.html +++ /dev/null @@ -1,1128 +0,0 @@ - - - - - -JDBCPool (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCPool

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCPool
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Wrapper, java.util.EventListener, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.ConnectionEventListener, javax.sql.DataSource, javax.sql.StatementEventListener
    -
    -
    -
    public class JDBCPool
    -extends java.lang.Object
    -implements javax.sql.DataSource, javax.naming.Referenceable, javax.sql.ConnectionEventListener, javax.sql.StatementEventListener, java.sql.Wrapper
    -
    A fast connection pool. - - -
    -

    HSQLDB-Specific Information:

    - - A connection pool for HyperSQL connections. This implementation of - DataSource is dedicated to HyperSQL and - guarantees all connection states are automatically reset when a connection - is reused.

    - - The methods of the parent class, - JDBCCommonDataSource are used to specify the database URL, user, - password, and / or connection properties.

    - -

    -
    -
    -
    Since:
    -
    2.2.9
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCPool() -
      Creates a connection pool with the maximum size of 8.
      -
      JDBCPool​(int size) -
      Creates a connection pool with the given maximum size.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose​(int wait) -
      Closes the pool immediately.
      -
      voidconnectionClosed​(javax.sql.ConnectionEvent event) 
      voidconnectionErrorOccurred​(javax.sql.ConnectionEvent event) 
      java.sql.ConnectiongetConnection() -
      Retrieves a new connection using the properties that have already been - set.
      -
      java.sql.ConnectiongetConnection​(java.lang.String username, - java.lang.String password) -
      Retrieves a new connection using the given username and password, - and the database url that has been set.
      -
      java.lang.StringgetDatabase() -
      Synonym for getUrl().
      -
      java.lang.StringgetDatabaseName() -
      Synonym for getUrl().
      -
      java.lang.StringgetDataSourceName() -
      Retrieves the name of the data source.
      -
      java.lang.StringgetDescription() -
      Retrieves the description of the data source.
      -
      intgetLoginTimeout() -
      Gets the maximum time in seconds that this data source can wait - while attempting to connect to a database.
      -
      java.io.PrintWritergetLogWriter() -
      Retrieves the log writer for this DataSource - object.
      -
      java.util.logging.LoggergetParentLogger() -
      Return the parent Logger of all the Loggers used by this data source.
      -
      javax.naming.ReferencegetReference() -
      Retrieves the Reference of this object.
      -
      java.lang.StringgetUrl() -
      Retrieves the jdbc database connection url attribute.
      -
      java.lang.StringgetURL() -
      Retrieves the jdbc database connection url attribute.
      -
      java.lang.StringgetUser() -
      Retrieves the user name for the connection.
      -
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      voidsetDatabase​(java.lang.String database) -
      Synonym for setUrl(String).
      -
      voidsetDatabaseName​(java.lang.String databaseName) -
      Synonym for setUrl(String).
      -
      voidsetLoginTimeout​(int seconds) -
      Sets the maximum time in seconds that this data source will wait - while attempting to connect to a database.
      -
      voidsetLogWriter​(java.io.PrintWriter out) -
      Sets the log writer for this DataSource - object to the given java.io.PrintWriter object.
      -
      voidsetPassword​(java.lang.String password) -
      Sets the password for the user name.
      -
      voidsetProperties​(java.util.Properties props) -
      Sets connection properties.
      -
      voidsetUrl​(java.lang.String url) -
      Sets the jdbc database URL.
      -
      voidsetURL​(java.lang.String url) -
      Sets the jdbc database URL.
      -
      voidsetUser​(java.lang.String user) -
      Sets the user name.
      -
      voidstatementClosed​(javax.sql.StatementEvent event) 
      voidstatementErrorOccurred​(javax.sql.StatementEvent event) 
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface javax.sql.CommonDataSource

        -createShardingKeyBuilder
      • -
      -
        -
      • - - -

        Methods inherited from interface javax.sql.DataSource

        -createConnectionBuilder
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCPool

        -
        public JDBCPool()
        -
        Creates a connection pool with the maximum size of 8. The database and - connection settings are made before the getConnection() is called.
        -
      • -
      - - - -
        -
      • -

        JDBCPool

        -
        public JDBCPool​(int size)
        -
        Creates a connection pool with the given maximum size. The database and - connection settings are made before the getConnection() is called.
        -
        -
        Parameters:
        -
        size - int maximum size of the pool
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException
        -
        Retrieves a new connection using the properties that have already been - set.
        -
        -
        Specified by:
        -
        getConnection in interface javax.sql.DataSource
        -
        Returns:
        -
        a connection to the data source
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection​(java.lang.String username,
        -                                         java.lang.String password)
        -                                  throws java.sql.SQLException
        -
        Retrieves a new connection using the given username and password, - and the database url that has been set. No other properties are - used for the connection. - - This method can be used only with the same username and password used - for the connection pool. The first call to this method sets the user name - and password for the connection pool.
        -
        -
        Specified by:
        -
        getConnection in interface javax.sql.DataSource
        -
        Parameters:
        -
        username - the database user on whose behalf the connection is - being made
        -
        password - the user's password
        -
        Returns:
        -
        a connection to the data source
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return the - result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getReference

        -
        public javax.naming.Reference getReference()
        -                                    throws javax.naming.NamingException
        -
        Retrieves the Reference of this object.
        -
        -
        Specified by:
        -
        getReference in interface javax.naming.Referenceable
        -
        Returns:
        -
        The non-null Reference of this object.
        -
        Throws:
        -
        javax.naming.NamingException - If a naming exception was encountered - while retrieving the reference.
        -
        -
      • -
      - - - -
        -
      • -

        connectionClosed

        -
        public void connectionClosed​(javax.sql.ConnectionEvent event)
        -
        -
        Specified by:
        -
        connectionClosed in interface javax.sql.ConnectionEventListener
        -
        -
      • -
      - - - -
        -
      • -

        connectionErrorOccurred

        -
        public void connectionErrorOccurred​(javax.sql.ConnectionEvent event)
        -
        -
        Specified by:
        -
        connectionErrorOccurred in interface javax.sql.ConnectionEventListener
        -
        -
      • -
      - - - -
        -
      • -

        statementClosed

        -
        public void statementClosed​(javax.sql.StatementEvent event)
        -
        -
        Specified by:
        -
        statementClosed in interface javax.sql.StatementEventListener
        -
        -
      • -
      - - - -
        -
      • -

        statementErrorOccurred

        -
        public void statementErrorOccurred​(javax.sql.StatementEvent event)
        -
        -
        Specified by:
        -
        statementErrorOccurred in interface javax.sql.StatementEventListener
        -
        -
      • -
      - - - -
        -
      • -

        getLogWriter

        -
        public java.io.PrintWriter getLogWriter()
        -                                 throws java.sql.SQLException
        -

        Retrieves the log writer for this DataSource - object. - -

        The log writer is a character output stream to which all logging - and tracing messages for this data source will be - printed. This includes messages printed by the methods of this - object, messages printed by methods of other objects manufactured - by this object, and so on. Messages printed to a data source - specific log writer are not printed to the log writer associated - with the java.sql.DriverManager class. When a - DataSource object is - created, the log writer is initially null; in other words, the - default is for logging to be disabled.

        -
        -
        Specified by:
        -
        getLogWriter in interface javax.sql.CommonDataSource
        -
        Specified by:
        -
        getLogWriter in interface javax.sql.DataSource
        -
        Returns:
        -
        the log writer for this data source or null if - logging is disabled
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        setLogWriter(java.io.PrintWriter)
        -
        -
      • -
      - - - -
        -
      • -

        setLogWriter

        -
        public void setLogWriter​(java.io.PrintWriter out)
        -                  throws java.sql.SQLException
        -

        Sets the log writer for this DataSource - object to the given java.io.PrintWriter object. - -

        The log writer is a character output stream to which all logging - and tracing messages for this data source will be - printed. This includes messages printed by the methods of this - object, messages printed by methods of other objects manufactured - by this object, and so on. Messages printed to a data source- - specific log writer are not printed to the log writer associated - with the java.sql.DriverManager class. When a - DataSource object is created the log writer is - initially null; in other words, the default is for logging to be - disabled.

        -
        -
        Specified by:
        -
        setLogWriter in interface javax.sql.CommonDataSource
        -
        Specified by:
        -
        setLogWriter in interface javax.sql.DataSource
        -
        Parameters:
        -
        out - the new log writer; to disable logging, set to null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        getLogWriter()
        -
        -
      • -
      - - - -
        -
      • -

        setLoginTimeout

        -
        public void setLoginTimeout​(int seconds)
        -                     throws java.sql.SQLException
        -

        Sets the maximum time in seconds that this data source will wait - while attempting to connect to a database. A value of zero - specifies that the timeout is the default system timeout - if there is one; otherwise, it specifies that there is no timeout. - When a DataSource object is created, the login timeout is - initially zero.

        -
        -
        Specified by:
        -
        setLoginTimeout in interface javax.sql.CommonDataSource
        -
        Specified by:
        -
        setLoginTimeout in interface javax.sql.DataSource
        -
        Parameters:
        -
        seconds - the data source login time limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs.
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        getLoginTimeout()
        -
        -
      • -
      - - - -
        -
      • -

        getLoginTimeout

        -
        public int getLoginTimeout()
        -                    throws java.sql.SQLException
        -
        Gets the maximum time in seconds that this data source can wait - while attempting to connect to a database. A value of zero - means that the timeout is the default system timeout - if there is one; otherwise, it means that there is no timeout. - When a DataSource object is created, the login timeout is - initially zero.
        -
        -
        Specified by:
        -
        getLoginTimeout in interface javax.sql.CommonDataSource
        -
        Specified by:
        -
        getLoginTimeout in interface javax.sql.DataSource
        -
        Returns:
        -
        the data source login time limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs.
        -
        Since:
        -
        1.4
        -
        See Also:
        -
        setLoginTimeout(int)
        -
        -
      • -
      - - - -
        -
      • -

        getDescription

        -
        public java.lang.String getDescription()
        -
        Retrieves the description of the data source.

        -
        -
        Returns:
        -
        the description
        -
        -
      • -
      - - - -
        -
      • -

        getDataSourceName

        -
        public java.lang.String getDataSourceName()
        -
        Retrieves the name of the data source.

        -
        -
        Returns:
        -
        the description
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseName

        -
        public java.lang.String getDatabaseName()
        -
        Synonym for getUrl().
        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getDatabase

        -
        public java.lang.String getDatabase()
        -
        Synonym for getUrl().
        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getUrl

        -
        public java.lang.String getUrl()
        -
        Retrieves the jdbc database connection url attribute.

        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.lang.String getURL()
        -
        Retrieves the jdbc database connection url attribute.

        -
        -
        Returns:
        -
        the jdbc database connection url attribute
        -
        -
      • -
      - - - -
        -
      • -

        getUser

        -
        public java.lang.String getUser()
        -
        Retrieves the user name for the connection.

        -
        -
        Returns:
        -
        the username for the connection
        -
        -
      • -
      - - - -
        -
      • -

        setDatabaseName

        -
        public void setDatabaseName​(java.lang.String databaseName)
        -
        Synonym for setUrl(String).

        -
        -
        Parameters:
        -
        databaseName - the new value for the attribute
        -
        -
      • -
      - - - -
        -
      • -

        setDatabase

        -
        public void setDatabase​(java.lang.String database)
        -
        Synonym for setUrl(String).

        -
        -
        Parameters:
        -
        database - the new value for the attribute
        -
        -
      • -
      - - - -
        -
      • -

        setUrl

        -
        public void setUrl​(java.lang.String url)
        -
        Sets the jdbc database URL.

        -
        -
        Parameters:
        -
        url - the new value of this object's jdbc database connection - url attribute
        -
        -
      • -
      - - - -
        -
      • -

        setURL

        -
        public void setURL​(java.lang.String url)
        -
        Sets the jdbc database URL.

        -
        -
        Parameters:
        -
        url - the new value of this object's jdbc database connection - url attribute
        -
        -
      • -
      - - - -
        -
      • -

        setPassword

        -
        public void setPassword​(java.lang.String password)
        -
        Sets the password for the user name.
        -
        -
        Parameters:
        -
        password - the password
        -
        -
      • -
      - - - -
        -
      • -

        setUser

        -
        public void setUser​(java.lang.String user)
        -
        Sets the user name.
        -
        -
        Parameters:
        -
        user - the user id
        -
        -
      • -
      - - - -
        -
      • -

        setProperties

        -
        public void setProperties​(java.util.Properties props)
        -
        Sets connection properties. If user / password / loginTimeout has been - set with one of the setXXX() methods it will be added to the Properties - object.
        -
        -
        Parameters:
        -
        props - properties. If null, then existing properties will be - cleared/replaced.
        -
        -
      • -
      - - - -
        -
      • -

        getParentLogger

        -
        public java.util.logging.Logger getParentLogger()
        -                                         throws java.sql.SQLFeatureNotSupportedException
        -
        Return the parent Logger of all the Loggers used by this data source. This - should be the Logger farthest from the root Logger that is - still an ancestor of all of the Loggers used by this data source. Configuring - this Logger will affect all of the log messages generated by the data source. - In the worst case, this may be the root Logger.
        -
        -
        Specified by:
        -
        getParentLogger in interface javax.sql.CommonDataSource
        -
        Returns:
        -
        the parent Logger for this data source
        -
        Throws:
        -
        java.sql.SQLFeatureNotSupportedException - if the data source does not use java.util.logging.
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.2.9
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close​(int wait)
        -           throws java.sql.SQLException
        -
        Closes the pool immediately. Waits the given number of seconds before - closing all existing connections in the pool.
        -
        -
        Parameters:
        -
        wait - int number of seconds to wait before closing the connections, maximum 60 seconds
        -
        Throws:
        -
        java.sql.SQLException - on any error
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCPreparedStatement.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCPreparedStatement.html deleted file mode 100644 index 454ca40d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCPreparedStatement.html +++ /dev/null @@ -1,5374 +0,0 @@ - - - - - -JDBCPreparedStatement (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCPreparedStatement

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCPreparedStatement
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.lang.AutoCloseable, java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper
    -
    -
    -
    Direct Known Subclasses:
    -
    JDBCCallableStatement
    -
    -
    -
    public class JDBCPreparedStatement
    -extends java.lang.Object
    -implements java.sql.PreparedStatement
    -
    - - An object that represents a precompiled SQL statement. -

    A SQL statement is precompiled and stored in a - PreparedStatement object. This object can then be used to - efficiently execute this statement multiple times. - -

    Note: The setter methods (setShort, setString, - and so on) for setting IN parameter values - must specify types that are compatible with the defined SQL type of - the input parameter. For instance, if the IN parameter has SQL type - INTEGER, then the method setInt should be used. - -

    If arbitrary parameter type conversions are required, the method - setObject should be used with a target SQL type. -

    - In the following example of setting a parameter, con represents - an active connection: -

    -   PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
    -                                     SET SALARY = ? WHERE ID = ?");
    -   pstmt.setBigDecimal(1, 153833.00)
    -   pstmt.setInt(2, 110592)
    - 
    - - - - -
    -

    HSQLDB-Specific Information:

    - - From version 2.0, the implementation meets the JDBC specification - requirement that any existing ResultSet is closed when execute() or - executeQuery() methods are called. The connection property close_result=true - is required for this behaviour. -

    - JDBCPreparedStatement objects are backed by - a true compiled parametric representation. Hence, there are now significant - performance gains to be had by using a JDBCPreparedStatement object in - preference to a JDBCStatement object when a short-running SQL statement is - to be executed more than once.

    - - When it can be otherwise avoided, it should be considered poor practice to - fully prepare (construct), parameterize, execute, fetch and close a - JDBCParameterMetaData object for each execution cycle. Indeed, - because the prepare and execute phases - both represent a round-trip to the engine, this practice is likely to be - noticeably less performant for short-running statements (and - possibly even orders of magnitude less performant over network connections - for short-running statements) than the equivalent process using JDBCStatement - objects, albeit far more convenient, less error prone and certainly much - less resource-intensive, especially when large binary and character values - are involved, due to the optimized parameterization facility.

    - - Instead, when developing an application that is not totally oriented toward - the execution of ad hoc SQL, it is recommended to expend some effort toward - identifying the SQL statements that are good candidates for regular reuse and - adapting the structure of the application accordingly. Often, this is done - by recording the text of candidate SQL statements in an application resource - object (which has the nice side-benefit of isolating and hiding differences - in SQL dialects across different drivers) and caching for possible reuse the - PreparedStatement objects derived from the recorded text.

    - - Starting with 2.0, when built under a JDBC 4 environment, statement caching - can be transparently enabled or disabled on a statement-by-statement basis by - invoking setPoolable(true | false), respectively, upon Statement objects of - interest.

    - - Multi thread use:

    - - A PreparedStatement object is stateful and should not normally be shared - by multiple threads. If it has to be shared, the calls to set the - parameters, calls to add batch statements, the execute call and any - post-execute calls should be made within a block synchronized on the - PreparedStatement Object.

    - - (fredt@users)
    - (campbell-burnet@users)

    - -

    -
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCConnection.prepareStatement(java.lang.String), -JDBCResultSet
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface java.sql.Statement

        -CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethodDescription
      voidaddBatch() -
      Adds a set of parameters to this PreparedStatement - object's batch of commands.
      -
      voidaddBatch​(java.lang.String sql) -
      This method should always throw if called for a PreparedStatement or - CallableStatement.
      -
      voidcancel() -
      Cancels this Statement object if both the DBMS and - driver support aborting an SQL statement.
      -
      voidclearBatch() -
      Empties this Statement object's current list of - SQL commands.
      -
      voidclearParameters() -
      Clears the current parameter values immediately.
      -
      voidclearWarnings() -
      Clears all the warnings reported on this Statement - object.
      -
      voidclose() -
      Does the specialized work required to free this object's resources and - that of its parent class.
      -
      voidcloseOnCompletion() -
      Specifies that this Statement will be closed when all its - dependent result sets are closed.
      -
      booleanexecute() -
      Executes the SQL statement in this PreparedStatement object, - which may be any kind of SQL statement.
      -
      booleanexecute​(java.lang.String sql) -
      This method should always throw if called for a PreparedStatement or - CallableStatement.
      -
      booleanexecute​(java.lang.String sql, - int autoGeneratedKeys) 
      booleanexecute​(java.lang.String sql, - int[] columnIndexes) 
      booleanexecute​(java.lang.String sql, - java.lang.String[] columnNames) 
      int[]executeBatch() -
      Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
      -
      long[]executeLargeBatch() -
      Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
      -
      longexecuteLargeUpdate() -
      Executes the SQL statement in this PreparedStatement object, - which must be an SQL Data Manipulation Language (DML) statement, - such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
      -
      java.sql.ResultSetexecuteQuery() -
      Executes the SQL query in this PreparedStatement object - and returns the ResultSet object generated by the query.
      -
      java.sql.ResultSetexecuteQuery​(java.lang.String sql) -
      This method should always throw if called for a PreparedStatement or - CallableStatement.
      -
      intexecuteUpdate() -
      Executes the SQL statement in this PreparedStatement object, - (JDBC4 clarification:) - which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
      -
      intexecuteUpdate​(java.lang.String sql) -
      This method should always throw if called for a PreparedStatement or - CallableStatement.
      -
      intexecuteUpdate​(java.lang.String sql, - int autoGeneratedKeys) -
      Statement methods that must be overridden in this class and throw - an exception.
      -
      intexecuteUpdate​(java.lang.String sql, - int[] columnIndexes) 
      intexecuteUpdate​(java.lang.String sql, - java.lang.String[] columnNames) 
      java.sql.ConnectiongetConnection() -
      Retrieves the Connection object - that produced this Statement object.
      -
      intgetFetchDirection() -
      Retrieves the direction for fetching rows from - database tables that is the default for result sets - generated from this Statement object.
      -
      intgetFetchSize() -
      Retrieves the number of result set rows that is the default - fetch size for ResultSet objects - generated from this Statement object.
      -
      java.sql.ResultSetgetGeneratedKeys() -
      Retrieves any auto-generated keys created as a result of executing this - Statement object.
      -
      longgetLargeMaxRows() -
      Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
      -
      longgetLargeUpdateCount() -
      Retrieves the current result as an update count; if the result - is a ResultSet object or there are no more results, -1 - is returned.
      -
      intgetMaxFieldSize() -
      Retrieves the maximum number of bytes that can be - returned for character and binary column values in a ResultSet - object produced by this Statement object.
      -
      intgetMaxRows() -
      Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
      -
      java.sql.ResultSetMetaDatagetMetaData() -
      Retrieves a ResultSetMetaData object that contains - information about the columns of the ResultSet object - that will be returned when this PreparedStatement object - is executed.
      -
      booleangetMoreResults() -
      Moves to this Statement object's next result, returns - true if it is a ResultSet object, and - implicitly closes any current ResultSet - object(s) obtained with the method getResultSet.
      -
      booleangetMoreResults​(int current) -
      Moves to this Statement object's next result, deals with - any current ResultSet object(s) according to the instructions - specified by the given flag, and returns - true if the next result is a ResultSet object.
      -
      java.sql.ParameterMetaDatagetParameterMetaData() -
      Retrieves the number, types and properties of this - PreparedStatement object's parameters.
      -
      org.hsqldb.result.ResultMetaDatagetParameterMetaDataDirect() 
      intgetQueryTimeout() -
      Retrieves the number of seconds the driver will - wait for a Statement object to execute.
      -
      java.sql.ResultSetgetResultSet() -
      Retrieves the current result as a ResultSet object.
      -
      intgetResultSetConcurrency() -
      Retrieves the result set concurrency for ResultSet objects - generated by this Statement object.
      -
      intgetResultSetHoldability() -
      Retrieves the result set holdability for ResultSet objects - generated by this Statement object.
      -
      JDBCResultSetMetaDatagetResultSetMetaData() 
      intgetResultSetType() -
      Retrieves the result set type for ResultSet objects - generated by this Statement object.
      -
      java.lang.StringgetSQL() 
      longgetStatementID() 
      intgetUpdateCount() -
      Retrieves the current result as an update count; - if the result is a ResultSet object or there are no more results, -1 - is returned.
      -
      java.sql.SQLWarninggetWarnings() -
      Retrieves the first warning reported by calls on this Statement object.
      -
      booleanisClosed() -
      Retrieves whether this Statement object has been closed.
      -
      booleanisCloseOnCompletion() -
      Returns a value indicating whether this Statement will be - closed when all its dependent result sets are closed.
      -
      booleanisPoolable() -
      Returns a value indicating whether the Statement - is poolable or not.
      -
      booleanisRowCount() 
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      voidsetArray​(int parameterIndex, - java.sql.Array x) -
      Sets the designated parameter to the given java.sql.Array object.
      -
      voidsetAsciiStream​(int parameterIndex, - java.io.InputStream x) -
      Sets the designated parameter to the given input stream.
      -
      voidsetAsciiStream​(int parameterIndex, - java.io.InputStream x, - int length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetAsciiStream​(int parameterIndex, - java.io.InputStream x, - long length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetBigDecimal​(int parameterIndex, - java.math.BigDecimal x) -
      Sets the designated parameter to the given java.math.BigDecimal value.
      -
      voidsetBinaryStream​(int parameterIndex, - java.io.InputStream x) -
      Sets the designated parameter to the given input stream.
      -
      voidsetBinaryStream​(int parameterIndex, - java.io.InputStream x, - int length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetBinaryStream​(int parameterIndex, - java.io.InputStream x, - long length) -
      Sets the designated parameter to the given input stream, which will have - the specified number of bytes.
      -
      voidsetBlob​(int parameterIndex, - java.io.InputStream inputStream) -
      Sets the designated parameter to a InputStream object.
      -
      voidsetBlob​(int parameterIndex, - java.io.InputStream inputStream, - long length) -
      Sets the designated parameter to a InputStream object.
      -
      voidsetBlob​(int parameterIndex, - java.sql.Blob x) -
      Sets the designated parameter to the given java.sql.Blob object.
      -
      voidsetBoolean​(int parameterIndex, - boolean x) -
      Sets the designated parameter to the given Java boolean value.
      -
      voidsetByte​(int parameterIndex, - byte x) -
      Sets the designated parameter to the given Java byte value.
      -
      voidsetBytes​(int parameterIndex, - byte[] x) -
      Sets the designated parameter to the given Java array of bytes.
      -
      voidsetCharacterStream​(int parameterIndex, - java.io.Reader reader) -
      Sets the designated parameter to the given Reader - object.
      -
      voidsetCharacterStream​(int parameterIndex, - java.io.Reader reader, - int length) -
      Sets the designated parameter to the given Reader - object, which is the given number of characters long.
      -
      voidsetCharacterStream​(int parameterIndex, - java.io.Reader reader, - long length) -
      Sets the designated parameter to the given Reader - object, which is the given number of characters long.
      -
      voidsetClob​(int parameterIndex, - java.io.Reader reader) -
      Sets the designated parameter to a Reader object.
      -
      voidsetClob​(int parameterIndex, - java.io.Reader reader, - long length) -
      Sets the designated parameter to a Reader object.
      -
      voidsetClob​(int parameterIndex, - java.sql.Clob x) -
      Sets the designated parameter to the given java.sql.Clob object.
      -
      voidsetCursorName​(java.lang.String name) -
      Sets the SQL cursor name to the given String, which - will be used by subsequent Statement object - execute methods.
      -
      voidsetDate​(int parameterIndex, - java.sql.Date x) -
      (JDBC4 clarification:) - Sets the designated parameter to the given java.sql.Date value - using the default time zone of the virtual machine that is running - the application.
      -
      voidsetDate​(int parameterIndex, - java.sql.Date x, - java.util.Calendar cal) -
      Sets the designated parameter to the given java.sql.Date value, - using the given Calendar object.
      -
      voidsetDouble​(int parameterIndex, - double x) -
      Sets the designated parameter to the given Java double value.
      -
      voidsetEscapeProcessing​(boolean enable) -
      Sets escape processing on or off.
      -
      voidsetFetchDirection​(int direction) -
      Gives the driver a hint as to the direction in which - rows will be processed in ResultSet - objects created using this Statement object.
      -
      voidsetFetchSize​(int rows) -
      (JDBC4 clarification:) - Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for - ResultSet objects generated by this Statement.
      -
      voidsetFloat​(int parameterIndex, - float x) -
      Sets the designated parameter to the given Java float value.
      -
      voidsetInt​(int parameterIndex, - int x) -
      Sets the designated parameter to the given Java int value.
      -
      voidsetLargeMaxRows​(long max) -
      Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
      -
      voidsetLong​(int parameterIndex, - long x) -
      Sets the designated parameter to the given Java long value.
      -
      voidsetMaxFieldSize​(int max) -
      (JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - Sets the limit for the maximum number of bytes that can be returned for - character and binary column values in a ResultSet - object produced by this Statement object.
      -
      voidsetMaxRows​(int max) -
      (JDBC4 clarification:) - Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
      -
      voidsetNCharacterStream​(int parameterIndex, - java.io.Reader value) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNCharacterStream​(int parameterIndex, - java.io.Reader value, - long length) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNClob​(int parameterIndex, - java.io.Reader reader) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNClob​(int parameterIndex, - java.io.Reader reader, - long length) -
      Sets the designated parameter to a Reader object.
      -
      voidsetNClob​(int parameterIndex, - java.sql.NClob value) -
      Sets the designated parameter to a java.sql.NClob object.
      -
      voidsetNString​(int parameterIndex, - java.lang.String value) -
      Sets the designated parameter to the given String object.
      -
      voidsetNull​(int parameterIndex, - int sqlType) -
      Sets the designated parameter to SQL NULL.
      -
      voidsetNull​(int parameterIndex, - int sqlType, - java.lang.String typeName) -
      Sets the designated parameter to SQL NULL.
      -
      voidsetObject​(int parameterIndex, - java.lang.Object x)
      voidsetObject​(int parameterIndex, - java.lang.Object x, - int targetSqlType) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetObject​(int parameterIndex, - java.lang.Object x, - int targetSqlType, - int scaleOrLength) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetObject​(int parameterIndex, - java.lang.Object x, - java.sql.SQLType targetSqlType) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetObject​(int parameterIndex, - java.lang.Object x, - java.sql.SQLType targetSqlType, - int scaleOrLength) -
      Sets the value of the designated parameter with the given object.
      -
      voidsetPoolable​(boolean poolable) -
      Requests that a Statement be pooled or not pooled.
      -
      voidsetQueryTimeout​(int seconds) -
      Sets the number of seconds the driver will wait for a - Statement object to execute to the given number of seconds.
      -
      voidsetRef​(int parameterIndex, - java.sql.Ref x) -
      Sets the designated parameter to the given - REF(<structured-type>) value.
      -
      voidsetRowId​(int parameterIndex, - java.sql.RowId x) -
      Sets the designated parameter to the given java.sql.RowId object.
      -
      voidsetShort​(int parameterIndex, - short x) -
      Sets the designated parameter to the given Java short value.
      -
      voidsetSQLXML​(int parameterIndex, - java.sql.SQLXML xmlObject) -
      Sets the designated parameter to the given java.sql.SQLXML object.
      -
      voidsetString​(int parameterIndex, - java.lang.String x) -
      Sets the designated parameter to the given Java String value.
      -
      voidsetTime​(int parameterIndex, - java.sql.Time x) -
      Sets the designated parameter to the given java.sql.Time value.
      -
      voidsetTime​(int parameterIndex, - java.sql.Time x, - java.util.Calendar cal) -
      Sets the designated parameter to the given java.sql.Time value, - using the given Calendar object.
      -
      voidsetTimestamp​(int parameterIndex, - java.sql.Timestamp x) -
      Sets the designated parameter to the given java.sql.Timestamp value.
      -
      voidsetTimestamp​(int parameterIndex, - java.sql.Timestamp x, - java.util.Calendar cal) -
      Sets the designated parameter to the given java.sql.Timestamp value, - using the given Calendar object.
      -
      voidsetUnicodeStream​(int parameterIndex, - java.io.InputStream x, - int length) -
      Deprecated. -
      Sun does not include a reason, but presumably - this is because setCharacterStream is now preferred
      -
      -
      voidsetURL​(int parameterIndex, - java.net.URL x) -
      Sets the designated parameter to the given java.net.URL value.
      -
      java.lang.StringtoString() -
      Retrieves a String representation of this object.
      -
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.sql.Statement

        -closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, isCloseOnCompletion, isSimpleIdentifier
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        executeQuery

        -
        public java.sql.ResultSet executeQuery()
        -                                throws java.sql.SQLException
        -
        - Executes the SQL query in this PreparedStatement object - and returns the ResultSet object generated by the query. -
        -
        -
        Specified by:
        -
        executeQuery in interface java.sql.PreparedStatement
        -
        Returns:
        -
        a ResultSet object that contains the data produced by the - query; never null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement or the SQL - statement does not return a ResultSet object
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate()
        -                  throws java.sql.SQLException
        -
        - Executes the SQL statement in this PreparedStatement object, - (JDBC4 clarification:) - which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement. -
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.PreparedStatement
        -
        Returns:
        -
        (JDBC4 clarification:) either (1) the row count for SQL Data Manipulation Language (DML) statements - or (2) 0 for SQL statements that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement - or the SQL - statement returns a ResultSet object
        -
        -
      • -
      - - - -
        -
      • -

        setNull

        -
        public void setNull​(int parameterIndex,
        -                    int sqlType)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to SQL NULL. - -

        Note: You must specify the parameter's SQL type. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB currently ignores the sqlType argument. -

        -
        -
        -
        Specified by:
        -
        setNull in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        sqlType - the SQL type code defined in java.sql.Types
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        -
      • -
      - - - -
        -
      • -

        setBoolean

        -
        public void setBoolean​(int parameterIndex,
        -                       boolean x)
        -                throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java boolean value. - The driver converts this - (JDBC4 Modified:) - to an SQL BIT or BOOLEAN value when it sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports BOOLEAN type for boolean values. This method can also - be used to set the value of a parameter of the SQL type BIT(1), which is - a bit string consisting of a 0 or 1. -

        -
        -
        -
        Specified by:
        -
        setBoolean in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setByte

        -
        public void setByte​(int parameterIndex,
        -                    byte x)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java byte value. - The driver converts this - to an SQL TINYINT value when it sends it to the database. -
        -
        -
        Specified by:
        -
        setByte in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setShort

        -
        public void setShort​(int parameterIndex,
        -                     short x)
        -              throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java short value. - The driver converts this - to an SQL SMALLINT value when it sends it to the database. -
        -
        -
        Specified by:
        -
        setShort in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setInt

        -
        public void setInt​(int parameterIndex,
        -                   int x)
        -            throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java int value. - The driver converts this - to an SQL INTEGER value when it sends it to the database. -
        -
        -
        Specified by:
        -
        setInt in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setLong

        -
        public void setLong​(int parameterIndex,
        -                    long x)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java long value. - The driver converts this - to an SQL BIGINT value when it sends it to the database. -
        -
        -
        Specified by:
        -
        setLong in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setFloat

        -
        public void setFloat​(int parameterIndex,
        -                     float x)
        -              throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java float value. - The driver converts this - (JDBC4 correction:) - to an SQL REAL value when it sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.7.1, HSQLDB handles Java positive/negative Infinity - and NaN float values consistent with the Java Language - Specification; these special values are now correctly stored - to and retrieved from the database. -

        -
        -
        -
        Specified by:
        -
        setFloat in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setDouble

        -
        public void setDouble​(int parameterIndex,
        -                      double x)
        -               throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java double value. - The driver converts this - to an SQL DOUBLE value when it sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.7.1, HSQLDB handles Java positive/negative Infinity - and NaN double values consistent with the Java Language - Specification; these special values are now correctly stored - to and retrieved from the database. -

        -
        -
        -
        Specified by:
        -
        setDouble in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setBigDecimal

        -
        public void setBigDecimal​(int parameterIndex,
        -                          java.math.BigDecimal x)
        -                   throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.math.BigDecimal value. - The driver converts this to an SQL NUMERIC value when - it sends it to the database. -
        -
        -
        Specified by:
        -
        setBigDecimal in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public void setString​(int parameterIndex,
        -                      java.lang.String x)
        -               throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java String value. - The driver converts this - to an SQL VARCHAR or LONGVARCHAR value - (depending on the argument's - size relative to the driver's limits on VARCHAR values) - when it sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0, HSQLDB represents all XXXCHAR values internally as - java.lang.String objects; there is no appreciable difference between - CHAR, VARCHAR and LONGVARCHAR. -

        -
        -
        -
        Specified by:
        -
        setString in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setBytes

        -
        public void setBytes​(int parameterIndex,
        -                     byte[] x)
        -              throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Java array of bytes. The driver converts - this to an SQL VARBINARY or LONGVARBINARY - (depending on the argument's size relative to the driver's limits on - VARBINARY values) when it sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0, HSQLDB represents all XXXBINARY values the same way - internally; there is no appreciable difference between BINARY, - VARBINARY and LONGVARBINARY as far as JDBC is concerned. -

        -
        -
        -
        Specified by:
        -
        setBytes in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setDate

        -
        public void setDate​(int parameterIndex,
        -                    java.sql.Date x)
        -             throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Sets the designated parameter to the given java.sql.Date value - using the default time zone of the virtual machine that is running - the application. - The driver converts this - to an SQL DATE value when it sends it to the database. - -
        -

        HSQLDB-Specific Information:

        - - When a setXXX method is used to set a parameter of type - TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone of the - client application is used as time zone -

        -
        -
        -
        Specified by:
        -
        setDate in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setTime

        -
        public void setTime​(int parameterIndex,
        -                    java.sql.Time x)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Time value. - The driver converts this - to an SQL TIME value when it sends it to the database. - -
        -

        HSQLDB-Specific Information:

        - - When a setXXX method is used to set a parameter of type - TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone of the - client application is used as time zone -

        -
        -
        -
        Specified by:
        -
        setTime in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setTimestamp

        -
        public void setTimestamp​(int parameterIndex,
        -                         java.sql.Timestamp x)
        -                  throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Timestamp value. - The driver - converts this to an SQL TIMESTAMP value when it sends it to the - database. - -
        -

        HSQLDB-Specific Information:

        - - When a setXXX method is used to set a parameter of type - TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone of the - client application is used as time zone.

        - - When this method is used to set a parameter of type TIME or - TIME WITH TIME ZONE, then the nanosecond value of the Timestamp object - will be used if the TIME parameter accepts fractional seconds. -

        -
        -
        -
        Specified by:
        -
        setTimestamp in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public void setAsciiStream​(int parameterIndex,
        -                           java.io.InputStream x,
        -                           int length)
        -                    throws java.sql.SQLException
        -
        - Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - -

        -

        HSQLDB-Specific Information:

        - - From HSQLDB 2.0 this method uses the US-ASCII character encoding to convert bytes - from the stream into the characters of a String.

        - This method does not use streaming to send the data, - whether the target is a CLOB or other binary object.

        - - For long streams (larger than a few megabytes) with CLOB targets, - it is more efficient to use a version of setCharacterStream which takes - the a length parameter. -

        -
        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the Java input stream that contains the ASCII parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setUnicodeStream

        -
        @Deprecated
        -public void setUnicodeStream​(int parameterIndex,
        -                             java.io.InputStream x,
        -                             int length)
        -                      throws java.sql.SQLException
        -
        Deprecated. -
        Sun does not include a reason, but presumably - this is because setCharacterStream is now preferred
        -
        -
        - Sets the designated parameter to the given input stream, which - will have the specified number of bytes. - (JDBC4 deleted:) - [A Unicode character has two bytes, with the first byte being the high - byte, and the second being the low byte.]

        - - When a very large Unicode value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream object. The data will be read from the - stream as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from Unicode to the database char format. - - (JDBC4 added:) - The byte format of the Unicode stream must be a Java UTF-8, as defined in the - Java Virtual Machine Specification. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, this method behaves according to the JDBC4 - specification (the stream is treated as though it has UTF-8 encoding. - This method is deprecated: please use setCharacterStream(...) instead. -

        -
        -
        -
        Specified by:
        -
        setUnicodeStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - a java.io.InputStream object that contains the - Unicode parameter value - (JDBC4 deleted:) - [as two-byte Unicode characters]
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public void setBinaryStream​(int parameterIndex,
        -                            java.io.InputStream x,
        -                            int length)
        -                     throws java.sql.SQLException
        -
        - Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large binary value is input to a LONGVARBINARY - parameter, it may be more practical to send it via a - java.io.InputStream object. The data will be read from the - stream as needed until end-of-file is reached. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - - -

        -

        HSQLDB-Specific Information:

        - - Since 1.7.2, this method works according to the standard. -

        -
        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the java input stream which contains the binary parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        clearParameters

        -
        public void clearParameters()
        -                     throws java.sql.SQLException
        -
        - Clears the current parameter values immediately. -

        In general, parameter values remain in force for repeated use of a - statement. Setting a parameter value automatically clears its - previous value. However, in some cases it is useful to immediately - release the resources used by the current parameter values; this can - be done by calling the method clearParameters. -

        -
        -
        Specified by:
        -
        clearParameters in interface java.sql.PreparedStatement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(int parameterIndex,
        -                      java.lang.Object x,
        -                      int targetSqlType,
        -                      int scaleOrLength)
        -               throws java.sql.SQLException
        -

        Sets the value of the designated parameter with the given object. The second - argument must be an object type; for integral values, the - java.lang equivalent objects should be used. - - If the second argument is an InputStream then the stream must contain - the number of bytes specified by scaleOrLength. If the second argument is a - Reader then the reader must contain the number of characters specified - by scaleOrLength. If these conditions are not true the driver will generate a - SQLException when the prepared statement is executed. - -

        The given Java object will be converted to the given targetSqlType - before being sent to the database. - - If the object has a custom mapping (is of a class implementing the - interface SQLData), - the JDBC driver should call the method SQLData.writeSQL to - write it to the SQL data stream. - If, on the other hand, the object is of a class implementing - Ref, Blob, Clob, NClob, - Struct, java.net.URL, - or Array, the driver should pass it to the database as a - value of the corresponding SQL type. - -

        Note that this method may be used to pass database-specific - abstract data types.

        -
        -
        Specified by:
        -
        setObject in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type (as defined in java.sql.Types) to be - sent to the database. The scale argument may further qualify this type.
        -
        scaleOrLength - for java.sql.Types.DECIMAL - or java.sql.Types.NUMERIC types, - this is the number of digits after the decimal point. For - Java Object types InputStream and Reader, - this is the length - of the data in the stream or reader. For all other types, - this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement or - if the Java Object specified by x is an InputStream - or Reader object and the value of the scale parameter is less - than zero
        -
        java.sql.SQLFeatureNotSupportedException - if targetSqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(int parameterIndex,
        -                      java.lang.Object x,
        -                      int targetSqlType)
        -               throws java.sql.SQLException
        -
        - Sets the value of the designated parameter with the given object. - This method is like the method setObject - above, except that it assumes a scale of zero. - - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.7.2, this method supports conversions listed in the - conversion table B-5 of the JDBC 3 specification. -

        -
        -
        -
        Specified by:
        -
        setObject in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type (as defined in java.sql.Types) to be - sent to the database
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if targetSqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type
        -
        See Also:
        -
        setObject(int,Object)
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(int parameterIndex,
        -                      java.lang.Object x)
        -               throws java.sql.SQLException
        -
        -

        Sets the value of the designated parameter using the given object. - The second parameter must be of type Object; therefore, the - java.lang equivalent objects should be used for built-in types. - -

        The JDBC specification specifies a standard mapping from - Java Object types to SQL types. The given argument - will be converted to the corresponding SQL type before being - sent to the database. - -

        Note that this method may be used to pass database- - specific abstract data types, by using a driver-specific Java - type. - - If the object is of a class implementing the interface SQLData, - the JDBC driver should call the method SQLData.writeSQL - to write it to the SQL data stream. - If, on the other hand, the object is of a class implementing - Ref, Blob, Clob, (JDBC4 new:) [ NClob ], - Struct, java.net.URL, (JDBC4 new:) [ RowId, SQLXML ] - or Array, the driver should pass it to the database as a - value of the corresponding SQL type. -

        - Note: Not all databases allow for a non-typed Null to be sent to - the backend. For maximum portability, the setNull or the - setObject(int parameterIndex, Object x, int sqlType) - method should be used - instead of setObject(int parameterIndex, Object x). -

        - Note: This method throws an exception if there is an ambiguity, for example, if the - object is of a class implementing more than one of the interfaces named above. - - - -

        -

        HSQLDB-Specific Information:

        - - Since 1.7.2, this method supports conversions listed in the conversion - table B-5 of the JDBC 3 specification. -

        -
        -
        Specified by:
        -
        setObject in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the object containing the input parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement - or the type of the given object is ambiguous
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute()
        -                throws java.sql.SQLException
        -
        - Executes the SQL statement in this PreparedStatement object, - which may be any kind of SQL statement. - Some prepared statements return multiple results; the execute - method handles these complex statements as well as the simpler - form of statements handled by the methods executeQuery - and executeUpdate. -

        - The execute method returns a boolean to - indicate the form of the first result. You must call either the method - getResultSet or getUpdateCount - to retrieve the result; you must call getMoreResults to - move to any subsequent result(s). - - - -

        -

        HSQLDB-Specific Information:

        - - If the statement is a call to a PROCEDURE, it may return multiple - multiple fetchable results.

        - -

        -
        -
        Specified by:
        -
        execute in interface java.sql.PreparedStatement
        -
        Returns:
        -
        true if the first result is a ResultSet - object; false if the first result is an update - count or there is no result
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement - or an argument is supplied to this method
        -
        See Also:
        -
        JDBCStatement.execute(java.lang.String), -JDBCStatement.getResultSet(), -JDBCStatement.getUpdateCount(), -JDBCStatement.getMoreResults()
        -
        -
      • -
      - - - -
        -
      • -

        addBatch

        -
        public void addBatch()
        -              throws java.sql.SQLException
        -
        - Adds a set of parameters to this PreparedStatement - object's batch of commands. - - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.7.2, this feature is supported. -

        -
        -
        -
        Specified by:
        -
        addBatch in interface java.sql.PreparedStatement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        JDBCStatement.addBatch(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public void setCharacterStream​(int parameterIndex,
        -                               java.io.Reader reader,
        -                               int length)
        -                        throws java.sql.SQLException
        -
        - Sets the designated parameter to the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - - -

        -

        HSQLDB-Specific Information:

        - - From HSQLDB 2.0 this method uses streaming to send data - when the target is a CLOB.

        - HSQLDB represents CHARACTER and related SQL types as UTF16 Unicode - internally, so this method does not perform any conversion. -

        -
        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        reader - the java.io.Reader object that contains the - Unicode data
        -
        length - the number of characters in the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setRef

        -
        public void setRef​(int parameterIndex,
        -                   java.sql.Ref x)
        -            throws java.sql.SQLException
        -
        - Sets the designated parameter to the given - REF(<structured-type>) value. - The driver converts this to an SQL REF value when it - sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0 HSQLDB does not support the SQL REF type. Calling this method - throws an exception. - -

        -
        -
        -
        Specified by:
        -
        setRef in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - an SQL REF value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setBlob

        -
        public void setBlob​(int parameterIndex,
        -                    java.sql.Blob x)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Blob object. - The driver converts this to an SQL BLOB value when it - sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - For parameters of type Blob, setBlob works normally.

        - - In addition since 1.7.2, setBlob is supported for BINARY and VARBINARY - parameters. In this context, the Blob object is - hard-limited to those of length less than or equal to Integer.MAX_VALUE. - In practice, soft limits such as available heap and maximum disk usage - per file (such as the transaction log) dictate a much smaller maximum - length.

        - - For BINARY and VARBINARY parameter types setBlob(i,x) is roughly - equivalent (null and length handling not shown) to: - -

        - setBinaryStream(i, x.getBinaryStream(), (int) x.length());
        - 
        -
        -
        -
        Specified by:
        -
        setBlob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - a Blob object that maps an SQL BLOB value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setClob

        -
        public void setClob​(int parameterIndex,
        -                    java.sql.Clob x)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Clob object. - The driver converts this to an SQL CLOB value when it - sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - For parameters of type Clob, setClob works normally.

        - - In addition since 1.7.2, setClob is supported for CHARACTER and VARCHAR - parameters. In this context, the Clob object is - hard-limited to those of length less than or equal to Integer.MAX_VALUE. - In practice, soft limits such as available heap and maximum disk usage - per file (such as the transaction log) dictate a much smaller maximum - length.

        - - For CHARACTER and VARCHAR parameter types setClob(i,x) is roughly - equivalent (null and length handling not shown) to: - -

        - setCharacterStream(i, x.getCharacterStream(), (int) x.length());
        - 
        -
        -
        -
        Specified by:
        -
        setClob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - a Clob object that maps an SQL CLOB value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setArray

        -
        public void setArray​(int parameterIndex,
        -                     java.sql.Array x)
        -              throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Array object. - The driver converts this to an SQL ARRAY value when it - sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - From version 2.0, HSQLDB supports the SQL ARRAY type. - -

        -
        -
        -
        Specified by:
        -
        setArray in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - an Array object that maps an SQL ARRAY value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getMetaData

        -
        public java.sql.ResultSetMetaData getMetaData()
        -                                       throws java.sql.SQLException
        -
        - Retrieves a ResultSetMetaData object that contains - information about the columns of the ResultSet object - that will be returned when this PreparedStatement object - is executed. -

        - Because a PreparedStatement object is pre-compiled, it is - possible to know about the ResultSet object that it will - return without having to execute it. Consequently, it is possible - to invoke the method getMetaData on a - PreparedStatement object rather than waiting to execute - it and then invoking the ResultSet.getMetaData method - on the ResultSet object that is returned. -

        - NOTE: Using this method may be expensive for some drivers due - to the lack of underlying DBMS support. - - - -

        -

        HSQLDB-Specific Information:

        - - Since 1.7.2, this feature is supported and is inexpensive as - it is backed by underlying DBMS support. If the statement - generates an update count, then null is returned. -

        -
        -
        -
        Specified by:
        -
        getMetaData in interface java.sql.PreparedStatement
        -
        Returns:
        -
        the description of a ResultSet object's columns or - null if the driver cannot return a - ResultSetMetaData object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setDate

        -
        public void setDate​(int parameterIndex,
        -                    java.sql.Date x,
        -                    java.util.Calendar cal)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Date value, - using the given Calendar object. The driver uses - the Calendar object to construct an SQL DATE value, - which the driver then sends to the database. With - a Calendar object, the driver can calculate the date - taking into account a custom timezone. If no - Calendar object is specified, the driver uses the default - timezone, which is that of the virtual machine running the application. -
        -
        -
        Specified by:
        -
        setDate in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        cal - the Calendar object the driver will use - to construct the date
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setTime

        -
        public void setTime​(int parameterIndex,
        -                    java.sql.Time x,
        -                    java.util.Calendar cal)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Time value, - using the given Calendar object. The driver uses - the Calendar object to construct an SQL TIME value, - which the driver then sends to the database. With - a Calendar object, the driver can calculate the time - taking into account a custom timezone. If no - Calendar object is specified, the driver uses the default - timezone, which is that of the virtual machine running the application. - -
        -

        HSQLDB-Specific Information:

        - - When a setXXX method is used to set a parameter of type - TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone (including - Daylight Saving Time) of the Calendar is used as time zone for the - value.

        - -

        -
        -
        -
        Specified by:
        -
        setTime in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        cal - the Calendar object the driver will use - to construct the time
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setTimestamp

        -
        public void setTimestamp​(int parameterIndex,
        -                         java.sql.Timestamp x,
        -                         java.util.Calendar cal)
        -                  throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.sql.Timestamp value, - using the given Calendar object. The driver uses - the Calendar object to construct an SQL TIMESTAMP value, - which the driver then sends to the database. With a - Calendar object, the driver can calculate the timestamp - taking into account a custom timezone. If no - Calendar object is specified, the driver uses the default - timezone, which is that of the virtual machine running the application. - -
        -

        HSQLDB-Specific Information:

        - - When a setXXX method is used to set a parameter of type - TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone (including - Daylight Saving Time) of the Calendar is used as time zone.

        - In this case, if the Calendar argument is null, then the default Calendar - for the clients JVM is used as the Calendar

        - - When this method is used to set a parameter of type TIME or - TIME WITH TIME ZONE, then the nanosecond value of the Timestamp object - is used if the TIME parameter accepts fractional seconds.

        - -

        -
        -
        -
        Specified by:
        -
        setTimestamp in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        cal - the Calendar object the driver will use - to construct the timestamp
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setNull

        -
        public void setNull​(int parameterIndex,
        -                    int sqlType,
        -                    java.lang.String typeName)
        -             throws java.sql.SQLException
        -
        - Sets the designated parameter to SQL NULL. - This version of the method setNull should - be used for user-defined types and REF type parameters. Examples - of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and - named array types. - -

        Note: To be portable, applications must give the - SQL type code and the fully-qualified SQL type name when specifying - a NULL user-defined or REF parameter. In the case of a user-defined type - the name is the type name of the parameter itself. For a REF - parameter, the name is the type name of the referenced type. If - a JDBC driver does not need the type code or type name information, - it may ignore it. - - Although it is intended for user-defined and Ref parameters, - this method may be used to set a null parameter of any JDBC type. - If the parameter does not have a user-defined or REF type, the given - typeName is ignored. - - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB simply ignores the sqlType and typeName arguments. -

        -
        -
        -
        Specified by:
        -
        setNull in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        sqlType - a value from java.sql.Types
        -
        typeName - the fully-qualified name of an SQL user-defined type; - ignored if the parameter is not a user-defined type or REF
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if sqlType is - a ARRAY, BLOB, CLOB, - DATALINK, JAVA_OBJECT, NCHAR, - NCLOB, NVARCHAR, LONGNVARCHAR, - REF, ROWID, SQLXML - or STRUCT data type and the JDBC driver does not support - this data type or if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        executeBatch

        -
        public int[] executeBatch()
        -                   throws java.sql.SQLException
        -
        - Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts. - The int elements of the array that is returned are ordered - to correspond to the commands in the batch, which are ordered - according to the order in which they were added to the batch. - The elements in the array returned by the method executeBatch - may be one of the following: -
          -
        1. A number greater than or equal to zero -- indicates that the - command was processed successfully and is an update count giving the - number of rows in the database that were affected by the command's - execution -
        2. A value of SUCCESS_NO_INFO -- indicates that the command was - processed successfully but that the number of rows affected is - unknown -

          - If one of the commands in a batch update fails to execute properly, - this method throws a BatchUpdateException, and a JDBC - driver may or may not continue to process the remaining commands in - the batch. However, the driver's behavior must be consistent with a - particular DBMS, either always continuing to process commands or never - continuing to process commands. If the driver continues processing - after a failure, the array returned by the method - BatchUpdateException.getUpdateCounts - will contain as many elements as there are commands in the batch, and - at least one of the elements will be the following: -

        3. A value of EXECUTE_FAILED -- indicates that the command failed - to execute successfully and occurs only if a driver continues to - process commands after a command fails -
        -

        - A driver is not required to implement this method. - The possible implementations and return values have been modified in - the Java 2 SDK, Standard Edition, version 1.3 to - accommodate the option of continuing to process commands in a batch - update after a BatchUpdateException object has been thrown. - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 1.7.2, this feature is supported.

        - - HSQLDB stops execution of commands in a batch when one of the commands - results in an exception. The size of the returned array equals the - number of commands that were executed successfully.

        - -

        -
        -
        -
        Specified by:
        -
        executeBatch in interface java.sql.Statement
        -
        Returns:
        -
        an array of update counts containing one element for each - command in the batch. The elements of the array are ordered according - to the order in which commands were added to the batch.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - driver does not support batch statements. Throws BatchUpdateException - (a subclass of SQLException) if one of the commands sent to the - database fails to execute properly or attempts to return a result set.
        -
        Since:
        -
        JDK 1.3
        -
        See Also:
        -
        addBatch(), -DatabaseMetaData.supportsBatchUpdates()
        -
        -
      • -
      - - - -
        -
      • -

        setEscapeProcessing

        -
        public void setEscapeProcessing​(boolean enable)
        -                         throws java.sql.SQLException
        -
        - Sets escape processing on or off. - - - -
        -

        HSQLDB-Specific Information:

        - - As per JDBC spec, calling this method has no effect. -

        -
        -
        -
        Specified by:
        -
        setEscapeProcessing in interface java.sql.Statement
        -
        Parameters:
        -
        enable - true to enable escape processing; - false to disable it
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        addBatch

        -
        public void addBatch​(java.lang.String sql)
        -              throws java.sql.SQLException
        -
        This method should always throw if called for a PreparedStatement or - CallableStatement.
        -
        -
        Specified by:
        -
        addBatch in interface java.sql.Statement
        -
        Parameters:
        -
        sql - ignored
        -
        Throws:
        -
        java.sql.SQLException - always
        -
        -
      • -
      - - - -
        -
      • -

        executeQuery

        -
        public java.sql.ResultSet executeQuery​(java.lang.String sql)
        -                                throws java.sql.SQLException
        -
        This method should always throw if called for a PreparedStatement or - CallableStatement.
        -
        -
        Specified by:
        -
        executeQuery in interface java.sql.Statement
        -
        Parameters:
        -
        sql - ignored
        -
        Returns:
        -
        nothing
        -
        Throws:
        -
        java.sql.SQLException - always
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql)
        -                throws java.sql.SQLException
        -
        This method should always throw if called for a PreparedStatement or - CallableStatement.
        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Parameters:
        -
        sql - ignored
        -
        Returns:
        -
        nothing
        -
        Throws:
        -
        java.sql.SQLException - always
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql)
        -                  throws java.sql.SQLException
        -
        This method should always throw if called for a PreparedStatement or - CallableStatement.
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - ignored
        -
        Returns:
        -
        nothing
        -
        Throws:
        -
        java.sql.SQLException - always
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.sql.SQLException
        -
        Does the specialized work required to free this object's resources and - that of its parent class.

        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Retrieves a String representation of this object.

        - - The representation is of the form:

        - - class-name@hash[sql=[char-sequence], parameters=[p1, ...pi, ...pn]]

        - - p1, ...pi, ...pn are the String representations of the currently set - parameter values that will be used with the non-batch execution - methods.

        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        a String representation of this object
        -
        -
      • -
      - - - -
        -
      • -

        setURL

        -
        public void setURL​(int parameterIndex,
        -                   java.net.URL x)
        -            throws java.sql.SQLException
        -
        - Sets the designated parameter to the given java.net.URL value. - The driver converts this to an SQL DATALINK value - when it sends it to the database. - - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0, HSQLDB does not support the DATALINK SQL type for which this - method is intended. Calling this method throws an exception. - -

        -
        -
        -
        Specified by:
        -
        setURL in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the java.net.URL object to be set
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.4, HSQL 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getParameterMetaData

        -
        public java.sql.ParameterMetaData getParameterMetaData()
        -                                                throws java.sql.SQLException
        -
        - Retrieves the number, types and properties of this - PreparedStatement object's parameters. - - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.7.2, this feature is supported. -

        -
        -
        -
        Specified by:
        -
        getParameterMetaData in interface java.sql.PreparedStatement
        -
        Returns:
        -
        a ParameterMetaData object that contains information - about the number, types and properties for each - parameter marker of this PreparedStatement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.4, HSQL 1.7.0
        -
        See Also:
        -
        ParameterMetaData
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql,
        -                         int autoGeneratedKeys)
        -                  throws java.sql.SQLException
        -
        Statement methods that must be overridden in this class and throw - an exception.
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql,
        -                       int autoGeneratedKeys)
        -                throws java.sql.SQLException
        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql,
        -                         int[] columnIndexes)
        -                  throws java.sql.SQLException
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql,
        -                       int[] columnIndexes)
        -                throws java.sql.SQLException
        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql,
        -                         java.lang.String[] columnNames)
        -                  throws java.sql.SQLException
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql,
        -                       java.lang.String[] columnNames)
        -                throws java.sql.SQLException
        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        getMoreResults

        -
        public boolean getMoreResults​(int current)
        -                       throws java.sql.SQLException
        -
        - Moves to this Statement object's next result, deals with - any current ResultSet object(s) according to the instructions - specified by the given flag, and returns - true if the next result is a ResultSet object. - -

        There are no more results when the following is true: -

        
        -     // stmt is a Statement object
        -     ((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1))
        - 
        - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - - This is used with CallableStatement objects that return multiple - ResultSet objects. -

        -
        -
        -
        Specified by:
        -
        getMoreResults in interface java.sql.Statement
        -
        Parameters:
        -
        current - one of the following Statement - constants indicating what should happen to current - ResultSet objects obtained using the method - getResultSet: - Statement.CLOSE_CURRENT_RESULT, - Statement.KEEP_CURRENT_RESULT, or - Statement.CLOSE_ALL_RESULTS
        -
        Returns:
        -
        true if the next result is a ResultSet - object; false if it is an update count or there are no - more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the argument - supplied is not one of the following: - Statement.CLOSE_CURRENT_RESULT, - Statement.KEEP_CURRENT_RESULT, or - Statement.CLOSE_ALL_RESULTS
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        execute()
        -
        -
      • -
      - - - -
        -
      • -

        getGeneratedKeys

        -
        public java.sql.ResultSet getGeneratedKeys()
        -                                    throws java.sql.SQLException
        -
        - Retrieves any auto-generated keys created as a result of executing this - Statement object. If this Statement object did - not generate any keys, an empty ResultSet - object is returned. -

        (JDBC4 clarification:) -

        Note:If the columns which represent the auto-generated keys were not specified, - the JDBC driver implementation will determine the columns which best represent the auto-generated keys. - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports this feature with single-row and - multi-row insert, update and merge statements.

        - - This method returns a result set only if - the executeUpdate methods that was used is one of the three methods that - have the extra parameter indicating return of generated keys

        - - If the executeUpdate method did not specify the columns which represent - the auto-generated keys the IDENTITY column or GENERATED column(s) of the - table are returned.

        - - The executeUpdate methods with column indexes or column names return the - post-insert or post-update values of the specified columns, whether the - columns are generated or not. This allows values that have been modified - by execution of triggers to be returned.

        - - If column names or indexes provided by the user in the executeUpdate() - method calls do not correspond to table columns (incorrect names or - indexes larger than the column count), an empty result is returned. - -

        -
        -
        -
        Specified by:
        -
        getGeneratedKeys in interface java.sql.Statement
        -
        Returns:
        -
        a ResultSet object containing the auto-generated key(s) - generated by the execution of this Statement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetHoldability

        -
        public int getResultSetHoldability()
        -                            throws java.sql.SQLException
        -
        - Retrieves the result set holdability for ResultSet objects - generated by this Statement object. -
        -
        -
        Specified by:
        -
        getResultSetHoldability in interface java.sql.Statement
        -
        Returns:
        -
        either ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Retrieves whether this Statement object has been closed. A Statement is closed if the - method close has been called on it, or if it is automatically closed.
        -
        -
        Specified by:
        -
        isClosed in interface java.sql.Statement
        -
        Returns:
        -
        true if this Statement object is closed; false if it is still open
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setRowId

        -
        public void setRowId​(int parameterIndex,
        -                     java.sql.RowId x)
        -              throws java.sql.SQLException
        -
        Sets the designated parameter to the given java.sql.RowId object. The - driver converts this to a SQL ROWID value when it sends it - to the database
        -
        -
        Specified by:
        -
        setRowId in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNString

        -
        public void setNString​(int parameterIndex,
        -                       java.lang.String value)
        -                throws java.sql.SQLException
        -
        Sets the designated parameter to the given String object. - The driver converts this to a SQL NCHAR or - NVARCHAR or LONGNVARCHAR value - (depending on the argument's - size relative to the driver's limits on NVARCHAR values) - when it sends it to the database.
        -
        -
        Specified by:
        -
        setNString in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - of the first parameter is 1, the second is 2, ...
        -
        value - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur ; if a database access error occurs; or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNCharacterStream

        -
        public void setNCharacterStream​(int parameterIndex,
        -                                java.io.Reader value,
        -                                long length)
        -                         throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The - Reader reads the data till end-of-file is reached. The - driver does the necessary conversion from Java character format to - the national character set in the database.
        -
        -
        Specified by:
        -
        setNCharacterStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - of the first parameter is 1, the second is 2, ...
        -
        value - the parameter value
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur ; if a database access error occurs; or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNClob

        -
        public void setNClob​(int parameterIndex,
        -                     java.sql.NClob value)
        -              throws java.sql.SQLException
        -
        Sets the designated parameter to a java.sql.NClob object. The driver converts this to a - SQL NCLOB value when it sends it to the database.
        -
        -
        Specified by:
        -
        setNClob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - of the first parameter is 1, the second is 2, ...
        -
        value - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur ; if a database access error occurs; or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setClob

        -
        public void setClob​(int parameterIndex,
        -                    java.io.Reader reader,
        -                    long length)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The reader must contain the number - of characters specified by length otherwise a SQLException will be - generated when the PreparedStatement is executed. - This method differs from the setCharacterStream (int, Reader, int) method - because it informs the driver that the parameter value should be sent to - the server as a CLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARCHAR or a CLOB
        -
        -
        Specified by:
        -
        setClob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, the second is 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this method is called on - a closed PreparedStatement, if parameterIndex does not correspond to a parameter - marker in the SQL statement, or if the length specified is less than zero.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setBlob

        -
        public void setBlob​(int parameterIndex,
        -                    java.io.InputStream inputStream,
        -                    long length)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a InputStream object. The input stream must contain the number - of characters specified by length otherwise a SQLException will be - generated when the PreparedStatement is executed. - This method differs from the setBinaryStream (int, InputStream, int) - method because it informs the driver that the parameter value should be - sent to the server as a BLOB. When the setBinaryStream method is used, - the driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARBINARY or a BLOB - -
        -

        HSQLDB-Specific Information:

        - - In HSQLDB 2.0, this method uses streaming to send the data when the - stream is assigned to a BLOB target. For other binary targets the - stream is read on the client side and a byte array is sent. -

        -
        -
        -
        Specified by:
        -
        setBlob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, - the second is 2, ...
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        length - the number of bytes in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement, - if parameterIndex does not correspond - to a parameter marker in the SQL statement, if the length specified - is less than zero or if the number of bytes in the input stream does not match - the specified length.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setNClob

        -
        public void setNClob​(int parameterIndex,
        -                     java.io.Reader reader,
        -                     long length)
        -              throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The reader must contain the number - of characters specified by length otherwise a SQLException will be - generated when the PreparedStatement is executed. - This method differs from the setCharacterStream (int, Reader, int) method - because it informs the driver that the parameter value should be sent to - the server as a NCLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGNVARCHAR or a NCLOB
        -
        -
        Specified by:
        -
        setNClob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, the second is 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; if the length specified is less than zero; - if the driver does not support national character sets; - if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setSQLXML

        -
        public void setSQLXML​(int parameterIndex,
        -                      java.sql.SQLXML xmlObject)
        -               throws java.sql.SQLException
        -
        Sets the designated parameter to the given java.sql.SQLXML object. - The driver converts this to an - SQL XML value when it sends it to the database. -

        -
        -
        Specified by:
        -
        setSQLXML in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, the second is 2, ...
        -
        xmlObject - a SQLXML object that maps an SQL XML value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed PreparedStatement - or the java.xml.transform.Result, - Writer or OutputStream has not been closed for - the SQLXML object
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public void setAsciiStream​(int parameterIndex,
        -                           java.io.InputStream x,
        -                           long length)
        -                    throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - -

        -

        HSQLDB-Specific Information:

        - - From HSQLDB 2.0 this method uses the US-ASCII character encoding to convert bytes - from the stream into the characters of a String.

        - This method does not use streaming to send the data, - whether the target is a CLOB or other binary object.

        - - For long streams (larger than a few megabytes) with CLOB targets, - it is more efficient to use a version of setCharacterStream which takes - the a length parameter. -

        -
        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the Java input stream that contains the ASCII parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public void setBinaryStream​(int parameterIndex,
        -                            java.io.InputStream x,
        -                            long length)
        -                     throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream, which will have - the specified number of bytes. - When a very large binary value is input to a LONGVARBINARY - parameter, it may be more practical to send it via a - java.io.InputStream object. The data will be read from the - stream as needed until end-of-file is reached. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - -

        -

        HSQLDB-Specific Information:

        - - This method uses streaming to send the data when the - stream is assigned to a BLOB target. For other binary targets the - stream is read on the client side and a byte array is sent. -

        -
        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the java input stream which contains the binary parameter value
        -
        length - the number of bytes in the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public void setCharacterStream​(int parameterIndex,
        -                               java.io.Reader reader,
        -                               long length)
        -                        throws java.sql.SQLException
        -
        Sets the designated parameter to the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. - - -

        -

        HSQLDB-Specific Information:

        - - This method uses streaming to send data - when the target is a CLOB.

        -

        -
        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        reader - the java.io.Reader object that contains the - Unicode data
        -
        length - the number of characters in the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setAsciiStream

        -
        public void setAsciiStream​(int parameterIndex,
        -                           java.io.InputStream x)
        -                    throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setAsciiStream which takes a length parameter. - - -

        -

        HSQLDB-Specific Information:

        - - In HSQLDB 2.0, this method does not use streaming to send the data, - whether the target is a CLOB or other binary object. - - For long streams (larger than a few megabytes), it is more efficient to - use a version of setCharacterStream which takes the a length parameter. -

        -
        -
        -
        Specified by:
        -
        setAsciiStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the Java input stream that contains the ASCII parameter value
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public void setBinaryStream​(int parameterIndex,
        -                            java.io.InputStream x)
        -                     throws java.sql.SQLException
        -
        Sets the designated parameter to the given input stream. - When a very large binary value is input to a LONGVARBINARY - parameter, it may be more practical to send it via a - java.io.InputStream object. The data will be read from the - stream as needed until end-of-file is reached. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setBinaryStream which takes a length parameter. - - -

        -

        HSQLDB-Specific Information:

        - - This method does not use streaming to send the data, - whether the target is a CLOB or other binary object.

        - - For long streams (larger than a few megabytes) with CLOB targets, - it is more efficient to use a version of setCharacterStream which takes - the a length parameter. -

        -
        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the java input stream which contains the binary parameter value
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public void setCharacterStream​(int parameterIndex,
        -                               java.io.Reader reader)
        -                        throws java.sql.SQLException
        -
        Sets the designated parameter to the given Reader - object. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setCharacterStream which takes a length parameter. - - -

        -

        HSQLDB-Specific Information:

        - - In HSQLDB 2.0, this method does not use streaming to send the data, - whether the target is a CLOB or other binary object. - - For long streams (larger than a few megabytes), it is more efficient to - use a version of setCharacterStream which takes the a length parameter. -

        -
        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        reader - the java.io.Reader object that contains the - Unicode data
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        setNCharacterStream

        -
        public void setNCharacterStream​(int parameterIndex,
        -                                java.io.Reader value)
        -                         throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. The - Reader reads the data till end-of-file is reached. The - driver does the necessary conversion from Java character format to - the national character set in the database. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setNCharacterStream which takes a length parameter.

        -
        -
        Specified by:
        -
        setNCharacterStream in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - of the first parameter is 1, the second is 2, ...
        -
        value - the parameter value
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; if a database access error occurs; or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        setClob

        -
        public void setClob​(int parameterIndex,
        -                    java.io.Reader reader)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. - This method differs from the setCharacterStream (int, Reader) method - because it informs the driver that the parameter value should be sent to - the server as a CLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARCHAR or a CLOB - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setClob which takes a length parameter.

        -
        -
        Specified by:
        -
        setClob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, the second is 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; if a database access error occurs; this method is called on - a closed PreparedStatementor if parameterIndex does not correspond to a parameter - marker in the SQL statement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        setBlob

        -
        public void setBlob​(int parameterIndex,
        -                    java.io.InputStream inputStream)
        -             throws java.sql.SQLException
        -
        Sets the designated parameter to a InputStream object. - This method differs from the setBinaryStream (int, InputStream) - method because it informs the driver that the parameter value should be - sent to the server as a BLOB. When the setBinaryStream method is used, - the driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGVARBINARY or a BLOB - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setBlob which takes a length parameter.

        -
        -
        Specified by:
        -
        setBlob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, - the second is 2, ...
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; if a database access error occurs; - this method is called on a closed PreparedStatement or - if parameterIndex does not correspond - to a parameter marker in the SQL statement,
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        setNClob

        -
        public void setNClob​(int parameterIndex,
        -                     java.io.Reader reader)
        -              throws java.sql.SQLException
        -
        Sets the designated parameter to a Reader object. - This method differs from the setCharacterStream (int, Reader) method - because it informs the driver that the parameter value should be sent to - the server as a NCLOB. When the setCharacterStream method is used, the - driver may have to do extra work to determine whether the parameter - data should be sent to the server as a LONGNVARCHAR or a NCLOB -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - setNClob which takes a length parameter.

        -
        -
        Specified by:
        -
        setNClob in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - index of the first parameter is 1, the second is 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a parameter - marker in the SQL statement; - if the driver does not support national character sets; - if the driver can detect that a data conversion - error could occur; if a database access error occurs or - this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        getMaxFieldSize

        -
        public int getMaxFieldSize()
        -                    throws java.sql.SQLException
        -
        - Retrieves the maximum number of bytes that can be - returned for character and binary column values in a ResultSet - object produced by this Statement object. - This limit applies only to BINARY, VARBINARY, - LONGVARBINARY, CHAR, VARCHAR, - (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR - and LONGVARCHAR columns. If the limit is exceeded, the - excess data is silently discarded. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB always returns zero, meaning there is no limit. -

        -
        -
        -
        Specified by:
        -
        getMaxFieldSize in interface java.sql.Statement
        -
        Returns:
        -
        the current column size limit for columns storing character and - binary values; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        setMaxFieldSize(int)
        -
        -
      • -
      - - - -
        -
      • -

        setMaxFieldSize

        -
        public void setMaxFieldSize​(int max)
        -                     throws java.sql.SQLException
        -
        - (JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - Sets the limit for the maximum number of bytes that can be returned for - character and binary column values in a ResultSet - object produced by this Statement object. - - This limit applies - only to BINARY, VARBINARY, - LONGVARBINARY, CHAR, VARCHAR, - (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR and - LONGVARCHAR fields. If the limit is exceeded, the excess data - is silently discarded. For maximum portability, use values - greater than 256. - - - -
        -

        HSQLDB-Specific Information:

        - - To present, calls to this method are simply ignored; HSQLDB always - stores the full number of bytes when dealing with any of the field types - mentioned above. These types all have an absolute maximum element upper - bound determined by the Java array index limit - java.lang.Integer.MAX_VALUE. For XXXBINARY types, this translates to - Integer.MAX_VALUE bytes. For XXXCHAR types, this translates to - 2 * Integer.MAX_VALUE bytes (2 bytes / character).

        - - In practice, field sizes are limited to values much smaller than the - absolute maximum element upper bound, in particular due to limits imposed - on the maximum available Java heap memory. -

        -
        -
        -
        Specified by:
        -
        setMaxFieldSize in interface java.sql.Statement
        -
        Parameters:
        -
        max - the new column size limit in bytes; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition max >= 0 is not satisfied
        -
        See Also:
        -
        getMaxFieldSize()
        -
        -
      • -
      - - - -
        -
      • -

        getMaxRows

        -
        public int getMaxRows()
        -               throws java.sql.SQLException
        -
        - Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain. If this limit is exceeded, - the excess rows are silently dropped. -
        -
        -
        Specified by:
        -
        getMaxRows in interface java.sql.Statement
        -
        Returns:
        -
        the current maximum number of rows for a ResultSet - object produced by this Statement object; - zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        setMaxRows(int)
        -
        -
      • -
      - - - -
        -
      • -

        setMaxRows

        -
        public void setMaxRows​(int max)
        -                throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number. - If the limit is exceeded, the excess - rows are silently dropped. -
        -
        -
        Specified by:
        -
        setMaxRows in interface java.sql.Statement
        -
        Parameters:
        -
        max - the new max rows limit; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition max >= 0 is not satisfied
        -
        See Also:
        -
        getMaxRows()
        -
        -
      • -
      - - - -
        -
      • -

        getQueryTimeout

        -
        public int getQueryTimeout()
        -                    throws java.sql.SQLException
        -
        - Retrieves the number of seconds the driver will - wait for a Statement object to execute. - If the limit is exceeded, a - SQLException is thrown. - - - -
        -

        HSQLDB-Specific Information:

        - - To present, HSQLDB always returns zero, meaning there - is no limit. -

        -
        -
        -
        Specified by:
        -
        getQueryTimeout in interface java.sql.Statement
        -
        Returns:
        -
        the current query timeout limit in seconds; zero means there is - no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        setQueryTimeout(int)
        -
        -
      • -
      - - - -
        -
      • -

        setQueryTimeout

        -
        public void setQueryTimeout​(int seconds)
        -                     throws java.sql.SQLException
        -
        - Sets the number of seconds the driver will wait for a - Statement object to execute to the given number of seconds. - If the limit is exceeded, an SQLException is thrown. A JDBC - (JDBC4 clarification:) - driver must apply this limit to the execute, - executeQuery and executeUpdate methods. JDBC driver - implementations may also apply this limit to ResultSet methods - (consult your driver vendor documentation for details). - - - -
        -

        HSQLDB-Specific Information:

        - - The maximum number of seconds to wait is 32767. -

        -
        -
        -
        Specified by:
        -
        setQueryTimeout in interface java.sql.Statement
        -
        Parameters:
        -
        seconds - the new query timeout limit in seconds; zero means - there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition seconds >= 0 is not satisfied
        -
        See Also:
        -
        getQueryTimeout()
        -
        -
      • -
      - - - -
        -
      • -

        cancel

        -
        public void cancel()
        -            throws java.sql.SQLException
        -
        - Cancels this Statement object if both the DBMS and - driver support aborting an SQL statement. - This method can be used by one thread to cancel a statement that - is being executed by another thread. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB version 2.3.4 and later supports aborting an SQL query - or data update statement. -

        -
        -
        -
        Specified by:
        -
        cancel in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        getWarnings

        -
        public java.sql.SQLWarning getWarnings()
        -                                throws java.sql.SQLException
        -
        - Retrieves the first warning reported by calls on this Statement object. - Subsequent Statement object warnings will be chained to this - SQLWarning object. - -

        The warning chain is automatically cleared each time - a statement is (re)executed. This method may not be called on a closed - Statement object; doing so will cause an SQLException - to be thrown. - -

        Note: If you are processing a ResultSet object, any - warnings associated with reads on that ResultSet object - will be chained on it rather than on the Statement - object that produced it. - - - -

        -

        HSQLDB-Specific Information:

        - - From 1.9 HSQLDB, produces Statement warnings. -

        -
        -
        -
        Specified by:
        -
        getWarnings in interface java.sql.Statement
        -
        Returns:
        -
        the first SQLWarning object or null - if there are no warnings
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        -
      • -
      - - - -
        -
      • -

        clearWarnings

        -
        public void clearWarnings()
        -                   throws java.sql.SQLException
        -
        - Clears all the warnings reported on this Statement - object. After a call to this method, - the method getWarnings will return - null until a new warning is reported for this - Statement object. - - - -
        -

        HSQLDB-Specific Information:

        - - Supported in HSQLDB 1.9. -

        -
        -
        -
        Specified by:
        -
        clearWarnings in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        -
      • -
      - - - -
        -
      • -

        setCursorName

        -
        public void setCursorName​(java.lang.String name)
        -                   throws java.sql.SQLException
        -
        - Sets the SQL cursor name to the given String, which - will be used by subsequent Statement object - execute methods. This name can then be - used in SQL positioned update or delete statements to identify the - current row in the ResultSet object generated by this - statement. If the database does not support positioned update/delete, - this method is a noop. To ensure that a cursor has the proper isolation - level to support updates, the cursor's SELECT statement - should have the form SELECT FOR UPDATE. If - FOR UPDATE is not present, positioned updates may fail. - -

        Note: By definition, the execution of positioned updates and - deletes must be done by a different Statement object than - the one that generated the ResultSet object being used for - positioning. Also, cursor names must be unique within a connection. - - - -

        -

        HSQLDB-Specific Information:

        - - Including 2.0, HSQLDB does not support named cursors; - calls to this method are ignored. -

        -
        -
        -
        Specified by:
        -
        setCursorName in interface java.sql.Statement
        -
        Parameters:
        -
        name - the new cursor name, which must be unique within - a connection
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet()
        -                                throws java.sql.SQLException
        -
        - Retrieves the current result as a ResultSet object. - This method should be called only once per result. - - - -
        -

        HSQLDB-Specific Information:

        - - Without an interceding call to executeXXX, each invocation of this - method will produce a new, initialized ResultSet instance referring to - the current result, if any. -

        -
        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Statement
        -
        Returns:
        -
        the current result as a ResultSet object or - null if the result is an update count or there are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        execute()
        -
        -
      • -
      - - - -
        -
      • -

        getUpdateCount

        -
        public int getUpdateCount()
        -                   throws java.sql.SQLException
        -
        - Retrieves the current result as an update count; - if the result is a ResultSet object or there are no more results, -1 - is returned. This method should be called only once per result. -
        -
        -
        Specified by:
        -
        getUpdateCount in interface java.sql.Statement
        -
        Returns:
        -
        the current result as an update count; -1 if the current result is a - ResultSet object or there are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        execute()
        -
        -
      • -
      - - - -
        -
      • -

        getMoreResults

        -
        public boolean getMoreResults()
        -                       throws java.sql.SQLException
        -
        - Moves to this Statement object's next result, returns - true if it is a ResultSet object, and - implicitly closes any current ResultSet - object(s) obtained with the method getResultSet. - -

        There are no more results when the following is true: -

        
        -     // stmt is a Statement object
        -     ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
        - 
        -
        -
        -
        Specified by:
        -
        getMoreResults in interface java.sql.Statement
        -
        Returns:
        -
        true if the next result is a ResultSet - object; false if it is an update count or there are - no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        execute()
        -
        -
      • -
      - - - -
        -
      • -

        setFetchDirection

        -
        public void setFetchDirection​(int direction)
        -                       throws java.sql.SQLException
        -
        - Gives the driver a hint as to the direction in which - rows will be processed in ResultSet - objects created using this Statement object. The - default value is ResultSet.FETCH_FORWARD. -

        - Note that this method sets the default fetch direction for - result sets generated by this Statement object. - Each result set has its own methods for getting and setting - its own fetch direction. - - - -

        -

        HSQLDB-Specific Information:

        - - Up to 1.8.0.x, HSQLDB supports only FETCH_FORWARD; - Setting any other value would throw an SQLException - stating that the operation is not supported.

        - - Starting with 2.0, HSQLDB accepts any valid value. -

        -
        -
        -
        Specified by:
        -
        setFetchDirection in interface java.sql.Statement
        -
        Parameters:
        -
        direction - the initial direction for processing rows
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the given direction - is not one of ResultSet.FETCH_FORWARD, - ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        getFetchDirection()
        -
        -
      • -
      - - - -
        -
      • -

        getFetchDirection

        -
        public int getFetchDirection()
        -                      throws java.sql.SQLException
        -
        - Retrieves the direction for fetching rows from - database tables that is the default for result sets - generated from this Statement object. - If this Statement object has not set - a fetch direction by calling the method setFetchDirection, - the return value is implementation-specific. - - - -
        -

        HSQLDB-Specific Information:

        - - Up to 1.8.0.x, HSQLDB always returned FETCH_FORWARD. - - Starting with 2.0, HSQLDB returns FETCH_FORWARD by default, or - whatever value has been explicitly assigned by invoking - setFetchDirection. - . -

        -
        -
        -
        Specified by:
        -
        getFetchDirection in interface java.sql.Statement
        -
        Returns:
        -
        the default fetch direction for result sets generated - from this Statement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setFetchDirection(int)
        -
        -
      • -
      - - - -
        -
      • -

        setFetchSize

        -
        public void setFetchSize​(int rows)
        -                  throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for - ResultSet objects generated by this Statement. - If the value specified is zero, then the hint is ignored. - The default value is zero. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB uses the specified value as a hint, but may process more or fewer - rows than specified. -

        -
        -
        -
        Specified by:
        -
        setFetchSize in interface java.sql.Statement
        -
        Parameters:
        -
        rows - the number of rows to fetch
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - (JDBC4 modified:) - condition <code>rows >= 0</code> is not satisfied.
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        getFetchSize()
        -
        -
      • -
      - - - -
        -
      • -

        getFetchSize

        -
        public int getFetchSize()
        -                 throws java.sql.SQLException
        -
        - Retrieves the number of result set rows that is the default - fetch size for ResultSet objects - generated from this Statement object. - If this Statement object has not set - a fetch size by calling the method setFetchSize, - the return value is implementation-specific. - - - -
        - HSQLDB-Specific Information

        - - HSQLDB returns 0 by default, or the fetch size specified by setFetchSize -

        -
        -
        -
        Specified by:
        -
        getFetchSize in interface java.sql.Statement
        -
        Returns:
        -
        the default fetch size for result sets generated - from this Statement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setFetchSize(int)
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetConcurrency

        -
        public int getResultSetConcurrency()
        -                            throws java.sql.SQLException
        -
        - Retrieves the result set concurrency for ResultSet objects - generated by this Statement object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports CONCUR_READ_ONLY and - CONCUR_READ_UPDATEBLE concurrency. -

        -
        -
        -
        Specified by:
        -
        getResultSetConcurrency in interface java.sql.Statement
        -
        Returns:
        -
        either ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetType

        -
        public int getResultSetType()
        -                     throws java.sql.SQLException
        -
        - Retrieves the result set type for ResultSet objects - generated by this Statement object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 1.7.0 and later versions support TYPE_FORWARD_ONLY - and TYPE_SCROLL_INSENSITIVE. -

        -
        -
        -
        Specified by:
        -
        getResultSetType in interface java.sql.Statement
        -
        Returns:
        -
        one of ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        clearBatch

        -
        public void clearBatch()
        -                throws java.sql.SQLException
        -
        - Empties this Statement object's current list of - SQL commands. -

        - (JDBC4 clarification:)

        - NOTE: Support of an ability to batch updates is optional. - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 1.7.2, this feature is supported. -

        -
        -
        -
        Specified by:
        -
        clearBatch in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - driver does not support batch updates
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        addBatch()
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException
        -
        - Retrieves the Connection object - that produced this Statement object. -
        -
        -
        Specified by:
        -
        getConnection in interface java.sql.Statement
        -
        Returns:
        -
        the connection that produced this statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setPoolable

        -
        public void setPoolable​(boolean poolable)
        -                 throws java.sql.SQLException
        -
        Requests that a Statement be pooled or not pooled. The value - specified is a hint to the statement pool implementation indicating - whether the application wants the statement to be pooled. It is up to - the statement pool manager as to whether the hint is used. -

        - The poolable value of a statement is applicable to both internal - statement caches implemented by the driver and external statement caches - implemented by application servers and other applications. -

        - By default, a Statement is not poolable when created, and - a PreparedStatement and CallableStatement - are poolable when created. -

        -
        -
        Specified by:
        -
        setPoolable in interface java.sql.Statement
        -
        Parameters:
        -
        poolable - requests that the statement be pooled if true and - that the statement not be pooled if false -

        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement -

        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isPoolable

        -
        public boolean isPoolable()
        -                   throws java.sql.SQLException
        -
        Returns a value indicating whether the Statement - is poolable or not. -

        -
        -
        Specified by:
        -
        isPoolable in interface java.sql.Statement
        -
        Returns:
        -
        true if the Statement - is poolable; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement -

        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0 -

        -
        See Also:
        -
        setPoolable(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return the - result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getLargeUpdateCount

        -
        public long getLargeUpdateCount()
        -                         throws java.sql.SQLException
        -
        Retrieves the current result as an update count; if the result - is a ResultSet object or there are no more results, -1 - is returned. This method should be called only once per result. -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - The public implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        getLargeUpdateCount in interface java.sql.Statement
        -
        Returns:
        -
        the current result as an update count; -1 if the current result - is a ResultSet object or there are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        execute()
        -
        -
      • -
      - - - -
        -
      • -

        setLargeMaxRows

        -
        public void setLargeMaxRows​(long max)
        -                     throws java.sql.SQLException
        -
        Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number. - If the limit is exceeded, the excess - rows are silently dropped. -

        - This method should be used when the row limit may exceed - Integer.MAX_VALUE. -

        - The default implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        setLargeMaxRows in interface java.sql.Statement
        -
        Parameters:
        -
        max - the new max rows limit; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition max >= 0 is not satisfied
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        getMaxRows()
        -
        -
      • -
      - - - -
        -
      • -

        getLargeMaxRows

        -
        public long getLargeMaxRows()
        -                     throws java.sql.SQLException
        -
        Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain. If this limit is exceeded, - the excess rows are silently dropped. -

        - This method should be used when the returned row limit may exceed - Integer.MAX_VALUE. -

        - The default implementation will return 0

        -
        -
        Specified by:
        -
        getLargeMaxRows in interface java.sql.Statement
        -
        Returns:
        -
        the current maximum number of rows for a ResultSet - object produced by this Statement object; - zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        setMaxRows(int)
        -
        -
      • -
      - - - -
        -
      • -

        executeLargeBatch

        -
        public long[] executeLargeBatch()
        -                         throws java.sql.SQLException
        -
        Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts. - The long elements of the array that is returned are ordered - to correspond to the commands in the batch, which are ordered - according to the order in which they were added to the batch. - The elements in the array returned by the method executeLargeBatch - may be one of the following: -
          -
        1. A number greater than or equal to zero -- indicates that the - command was processed successfully and is an update count giving the - number of rows in the database that were affected by the command's - execution -
        2. A value of SUCCESS_NO_INFO -- indicates that the command was - processed successfully but that the number of rows affected is - unknown -

          - If one of the commands in a batch update fails to execute properly, - this method throws a BatchUpdateException, and a JDBC - driver may or may not continue to process the remaining commands in - the batch. However, the driver's behavior must be consistent with a - particular DBMS, either always continuing to process commands or never - continuing to process commands. If the driver continues processing - after a failure, the array returned by the method - BatchUpdateException.getLargeUpdateCounts - will contain as many elements as there are commands in the batch, and - at least one of the elements will be the following: - -

        3. A value of EXECUTE_FAILED -- indicates that the command failed - to execute successfully and occurs only if a driver continues to - process commands after a command fails -
        -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - The default implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        executeLargeBatch in interface java.sql.Statement
        -
        Returns:
        -
        an array of update counts containing one element for each - command in the batch. The elements of the array are ordered according - to the order in which commands were added to the batch.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - driver does not support batch statements. Throws BatchUpdateException - (a subclass of SQLException) if one of the commands sent to the - database fails to execute properly or attempts to return a result set.
        -
        java.sql.SQLTimeoutException - when the driver has determined that the - timeout value that was specified by the setQueryTimeout - method has been exceeded and has at least attempted to cancel - the currently running Statement
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        addBatch(), -DatabaseMetaData.supportsBatchUpdates()
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(int parameterIndex,
        -                      java.lang.Object x,
        -                      java.sql.SQLType targetSqlType,
        -                      int scaleOrLength)
        -               throws java.sql.SQLException
        -

        Sets the value of the designated parameter with the given object. - - If the second argument is an InputStream then the stream - must contain the number of bytes specified by scaleOrLength. - If the second argument is a Reader then the reader must - contain the number of characters specified by scaleOrLength. If these - conditions are not true the driver will generate a - SQLException when the prepared statement is executed. - -

        The given Java object will be converted to the given targetSqlType - before being sent to the database. - - If the object has a custom mapping (is of a class implementing the - interface SQLData), - the JDBC driver should call the method SQLData.writeSQL to - write it to the SQL data stream. - If, on the other hand, the object is of a class implementing - Ref, Blob, Clob, NClob, - Struct, java.net.URL, - or Array, the driver should pass it to the database as a - value of the corresponding SQL type. - -

        Note that this method may be used to pass database-specific - abstract data types. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        setObject in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type to be sent to the database. The - scale argument may further qualify this type.
        -
        scaleOrLength - for java.sql.JDBCType.DECIMAL - or java.sql.JDBCType.NUMERIC types, - this is the number of digits after the decimal point. For - Java Object types InputStream and Reader, - this is the length - of the data in the stream or reader. For all other types, - this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a - parameter marker in the SQL statement; if a database access error occurs - or this method is called on a closed PreparedStatement or - if the Java Object specified by x is an InputStream - or Reader object and the value of the scale parameter is less - than zero
        -
        java.sql.SQLFeatureNotSupportedException - if - the JDBC driver does not support the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        setObject

        -
        public void setObject​(int parameterIndex,
        -                      java.lang.Object x,
        -                      java.sql.SQLType targetSqlType)
        -               throws java.sql.SQLException
        -
        Sets the value of the designated parameter with the given object. - - This method is similar to setObject(int parameterIndex, - Object x, SQLType targetSqlType, int scaleOrLength), - except that it assumes a scale of zero. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        setObject in interface java.sql.PreparedStatement
        -
        Parameters:
        -
        parameterIndex - the first parameter is 1, the second is 2, ...
        -
        x - the object containing the input parameter value
        -
        targetSqlType - the SQL type to be sent to the database
        -
        Throws:
        -
        java.sql.SQLException - if parameterIndex does not correspond to a - parameter marker in the SQL statement; if a database access error occurs - or this method is called on a closed PreparedStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        executeLargeUpdate

        -
        public long executeLargeUpdate()
        -                        throws java.sql.SQLException
        -
        Executes the SQL statement in this PreparedStatement object, - which must be an SQL Data Manipulation Language (DML) statement, - such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement. -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - The default implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        executeLargeUpdate in interface java.sql.PreparedStatement
        -
        Returns:
        -
        either (1) the row count for SQL Data Manipulation Language - (DML) statements or (2) 0 for SQL statements that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs; - this method is called on a closed PreparedStatement - or the SQL statement returns a ResultSet object
        -
        java.sql.SQLTimeoutException - when the driver has determined that the - timeout value that was specified by the setQueryTimeout - method has been exceeded and has at least attempted to cancel - the currently running Statement
        -
        Since:
        -
        1.8
        -
        -
      • -
      - - - -
        -
      • -

        getSQL

        -
        public java.lang.String getSQL()
        -
      • -
      - - - -
        -
      • -

        getStatementID

        -
        public long getStatementID()
        -
      • -
      - - - -
        -
      • -

        isRowCount

        -
        public boolean isRowCount()
        -
      • -
      - - - - - - - -
        -
      • -

        getParameterMetaDataDirect

        -
        public org.hsqldb.result.ResultMetaData getParameterMetaDataDirect()
        -
      • -
      - - - -
        -
      • -

        closeOnCompletion

        -
        public void closeOnCompletion()
        -                       throws java.sql.SQLException
        -
        Specifies that this Statement will be closed when all its - dependent result sets are closed. If execution of the Statement - does not produce any result sets, this method has no effect. -

        - Note: Multiple calls to closeOnCompletion do - not toggle the effect on this Statement. However, a call to - closeOnCompletion does effect both the subsequent execution of - statements, and statements that currently have open, dependent, - result sets.

        -
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      - - - -
        -
      • -

        isCloseOnCompletion

        -
        public boolean isCloseOnCompletion()
        -                            throws java.sql.SQLException
        -
        Returns a value indicating whether this Statement will be - closed when all its dependent result sets are closed.
        -
        -
        Returns:
        -
        true if the Statement will be closed when all - of its dependent result sets are closed; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCResultSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCResultSet.html deleted file mode 100644 index bc1083a9..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCResultSet.html +++ /dev/null @@ -1,10093 +0,0 @@ - - - - - -JDBCResultSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCResultSet

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCResultSet
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.lang.AutoCloseable, java.sql.ResultSet, java.sql.Wrapper
    -
    -
    -
    public class JDBCResultSet
    -extends java.lang.Object
    -implements java.sql.ResultSet
    -
    - A table of data representing a database result set, which - is usually generated by executing a statement that queries the database. - -

    A ResultSet object maintains a cursor pointing - to its current row of data. Initially the cursor is positioned - before the first row. The next method moves the - cursor to the next row, and because it returns false - when there are no more rows in the ResultSet object, - it can be used in a while loop to iterate through - the result set. -

    - A default ResultSet object is not updatable and - has a cursor that moves forward only. Thus, you can - iterate through it only once and only from the first row to the - last row. It is possible to - produce ResultSet objects that are scrollable and/or - updatable. The following code fragment, in which con - is a valid Connection object, illustrates how to make - a result set that is scrollable and insensitive to updates by others, and - that is updatable. See ResultSet fields for other - options. -

    -
    -       Statement stmt = con.createStatement(
    -                                      ResultSet.TYPE_SCROLL_INSENSITIVE,
    -                                      ResultSet.CONCUR_UPDATABLE);
    -       ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
    -       // rs will be scrollable, will not show changes made by others,
    -       // and will be updatable
    -
    - 
    - The ResultSet interface provides - getter methods (getBoolean, getLong, and so on) - for retrieving column values from the current row. - Values can be retrieved using either the index number of the - column or the name of the column. In general, using the - column index will be more efficient. Columns are numbered from 1. - For maximum portability, result set columns within each row should be - read in left-to-right order, and each column should be read only once. - -

    For the getter methods, a JDBC driver attempts - to convert the underlying data to the Java type specified in the - getter method and returns a suitable Java value. The JDBC specification - has a table showing the allowable mappings from SQL types to Java types - that can be used by the ResultSet getter methods. - -

    Column names used as input to getter methods are case - insensitive. When a getter method is called with - a column name and several columns have the same name, - the value of the first matching column will be returned. - The column name option is - designed to be used when column names are used in the SQL - query that generated the result set. - For columns that are NOT explicitly named in the query, it - is best to use column numbers. (JDBC4 clarification:) If column names are used, the - programmer should take care to guarantee that they uniquely refer to - the intended columns, which can be assured with the SQL AS clause. -

    - A set of updater methods were added to this interface - in the JDBC 2.0 API (Java™ 2 SDK, - Standard Edition, version 1.2). The comments regarding parameters - to the getter methods also apply to parameters to the - updater methods. -

    - The updater methods may be used in two ways: -

      -
    1. to update a column value in the current row. In a scrollable - ResultSet object, the cursor can be moved backwards - and forwards, to an absolute position, or to a position - relative to the current row. - The following code fragment updates the NAME column - in the fifth row of the ResultSet object - rs and then uses the method updateRow - to update the data source table from which rs was derived. -
      -
      -       rs.absolute(5); // moves the cursor to the fifth row of rs
      -       rs.updateString("NAME", "AINSWORTH"); // updates the
      -          // NAME column of row 5 to be AINSWORTH
      -       rs.updateRow(); // updates the row in the data source
      -
      - 
      -
    2. -
    3. to insert column values into the insert row. An updatable - ResultSet object has a special row associated with - it that serves as a staging area for building a row to be inserted. - The following code fragment moves the cursor to the insert row, builds - a three-column row, and inserts it into rs and into - the data source table using the method insertRow. -
      -
      -       rs.moveToInsertRow(); // moves cursor to the insert row
      -       rs.updateString(1, "AINSWORTH"); // updates the
      -          // first column of the insert row to be AINSWORTH
      -       rs.updateInt(2,35); // updates the second column to be 35
      -       rs.updateBoolean(3, true); // updates the third column to true
      -       rs.insertRow();
      -       rs.moveToCurrentRow();
      -
      - 
      -
    4. -
    -

    A ResultSet object is automatically closed when the - Statement object that - generated it is closed, re-executed, or used - to retrieve the next result from a sequence of multiple results. - -

    The number, types and properties of a ResultSet - object's columns are provided by the ResultSetMetaData - object returned by the ResultSet.getMetaData method. - - - -

    -

    HSQLDB-Specific Information:

    - - A ResultSet object generated by HSQLDB is by default of - ResultSet.TYPE_FORWARD_ONLY (as is standard JDBC behavior) - and does not allow the use of absolute and relative positioning - methods. If a statement is created with: - -

    - Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    - 
    - - then the ResultSet objects it produces support - using all of the absolute and relative positioning methods of JDBC2 - to set the position of the current row, for example: - -
    - rs.absolute(5);
    - String fifthRowValue = rs.getString(1);
    - rs.relative(4);
    - String ninthRowValue = rs.getString(1);
    - 
    - - Note: An HSQLDB ResultSet object stays open if it is not - explicitly closed, even after its - connection is closed. This is regardless of the operational mode of - the Database from which it came. That is, they - persist whether originating from a Server, - WebServer or in-process mode Database. A connection - opened with the property setting close_result=true closes - any remaining open results when the connection is closed. -

    - - From HSQLDB 2.0, there is full support for updatable result sets. - Supported methods - include all updateXXX methods for the supported types, as well as the - insertRow(), - updateRow(), deleteRow(), moveToInsertRow() - methods.

    - - The Statement must be created with ResultSet.CONCUR_UPDATABLE instead of - CONCUR_READ_ONLY.

    - - Updatability of a result set follows the SQL standards. Some or all columns - of an updatable result set can be updated. The current row in such result sets - can be deleted using the deleteRow() method. Some updatable result set - can also be inserted into and support moveToInsertRow().

    - - A result set is updatable if the SELECT statement - is updatable. This includes SELECT from TABLE and updatable VIEW objects. - An updatable SELECT statement has a single underlying table or view. - HSQLDB supports both scrollable and forward-only result sets for updatability. - -

    - -- In the SELECT below, columns A and B are updatable, any row can be
    - -- deleted, but it is not insertable-into as column C is not directly from
    - -- the table.
    - SELECT A, B, A + B AS C FROM T WHERE ...
    -
    - -- The SELECT below can be insertable-into so long as other columns of the
    - -- table that do not appear in the SELECT list have a default value.
    - SELECT A, B FROM T WHERE ...
    - 
    - - (fredt@users)
    - (campbell-burnet@users)

    - -

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCStatement.executeQuery(java.lang.String), -JDBCStatement.getResultSet(), -ResultSetMetaData
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      org.hsqldb.result.Resultresult -
      The underlying result.
      -
      -
        -
      • - - -

        Fields inherited from interface java.sql.ResultSet

        -CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCResultSet​(JDBCConnection conn, - org.hsqldb.jdbc.JDBCStatementBase s, - org.hsqldb.result.Result r, - org.hsqldb.result.ResultMetaData metaData) -
      Constructs a new JDBCResultSet object using the specified - navigator and org.hsqldb.result.ResultMetaData.
      -
      JDBCResultSet​(JDBCConnection conn, - org.hsqldb.result.Result r, - org.hsqldb.result.ResultMetaData metaData) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and TypeMethodDescription
      booleanabsolute​(int row) -
      Moves the cursor to the given row number in - this ResultSet object.
      -
      voidafterLast() -
      Moves the cursor to the end of - this ResultSet object, just after the - last row.
      -
      voidbeforeFirst() -
      Moves the cursor to the front of - this ResultSet object, just before the - first row.
      -
      voidcancelRowUpdates() -
      Cancels the updates made to the current row in this - ResultSet object.
      -
      voidclearWarnings() -
      Clears all warnings reported on this ResultSet object.
      -
      voidclose() -
      Releases this ResultSet object's database and - JDBC resources immediately instead of waiting for - this to happen when it is automatically closed.
      -
      voiddeleteRow() -
      Deletes the current row from this ResultSet object - and from the underlying database.
      -
      intfindColumn​(java.lang.String columnLabel) -
      Maps the given ResultSet column label to its - ResultSet column index.
      -
      booleanfirst() -
      Moves the cursor to the first row in - this ResultSet object.
      -
      java.sql.ArraygetArray​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as an Array object - in the Java programming language.
      -
      java.sql.ArraygetArray​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as an Array object - in the Java programming language.
      -
      java.io.InputStreamgetAsciiStream​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a stream of ASCII characters.
      -
      java.io.InputStreamgetAsciiStream​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of - ASCII characters.
      -
      java.math.BigDecimalgetBigDecimal​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.math.BigDecimal with full precision.
      -
      java.math.BigDecimalgetBigDecimal​(int columnIndex, - int scale) -
      Deprecated. -
      by java.sun.com as of JDK 1.2
      -
      -
      java.math.BigDecimalgetBigDecimal​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.math.BigDecimal with full precision.
      -
      java.math.BigDecimalgetBigDecimal​(java.lang.String columnLabel, - int scale) -
      Deprecated. -
      by java.sun.com as of JDK 1.2
      -
      -
      java.io.InputStreamgetBinaryStream​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of - uninterpreted bytes.
      -
      java.io.InputStreamgetBinaryStream​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of uninterpreted - bytes.
      -
      java.sql.BlobgetBlob​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a Blob object - in the Java programming language.
      -
      java.sql.BlobgetBlob​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a Blob object - in the Java programming language.
      -
      booleangetBoolean​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a boolean in the Java programming language.
      -
      booleangetBoolean​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a boolean in the Java programming language.
      -
      bytegetByte​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte in the Java programming language.
      -
      bytegetByte​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte in the Java programming language.
      -
      byte[]getBytes​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte array in the Java programming language.
      -
      byte[]getBytes​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte array in the Java programming language.
      -
      java.io.ReadergetCharacterStream​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
      -
      java.io.ReadergetCharacterStream​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
      -
      java.sql.ClobgetClob​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a Clob object - in the Java programming language.
      -
      java.sql.ClobgetClob​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a Clob object - in the Java programming language.
      -
      intgetConcurrency() -
      Retrieves the concurrency mode of this ResultSet object.
      -
      java.lang.StringgetCursorName() -
      Retrieves the name of the SQL cursor used by this ResultSet - object.
      -
      java.sql.DategetDate​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Date object in the Java programming language.
      -
      java.sql.DategetDate​(int columnIndex, - java.util.Calendar cal) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Date object - in the Java programming language.
      -
      java.sql.DategetDate​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Date object in the Java programming language.
      -
      java.sql.DategetDate​(java.lang.String columnLabel, - java.util.Calendar cal) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Date object - in the Java programming language.
      -
      doublegetDouble​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a double in the Java programming language.
      -
      doublegetDouble​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a double in the Java programming language.
      -
      intgetFetchDirection() -
      Retrieves the fetch direction for this - ResultSet object.
      -
      intgetFetchSize() -
      Retrieves the fetch size for this - ResultSet object.
      -
      floatgetFloat​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a float in the Java programming language.
      -
      floatgetFloat​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a float in the Java programming language.
      -
      intgetHoldability() -
      Retrieves the holdability of this ResultSet object
      -
      intgetInt​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - an int in the Java programming language.
      -
      intgetInt​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - an int in the Java programming language.
      -
      longgetLong​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a long in the Java programming language.
      -
      longgetLong​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a long in the Java programming language.
      -
      java.sql.ResultSetMetaDatagetMetaData() -
      Retrieves the number, types and properties of - this ResultSet object's columns.
      -
      java.io.ReadergetNCharacterStream​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
      -
      java.io.ReadergetNCharacterStream​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object.
      -
      java.sql.NClobgetNClob​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a NClob object - in the Java programming language.
      -
      java.sql.NClobgetNClob​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a NClob object - in the Java programming language.
      -
      java.lang.StringgetNString​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
      -
      java.lang.StringgetNString​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
      -
      java.lang.ObjectgetObject​(int columnIndex)
      <T> TgetObject​(int columnIndex, - java.lang.Class<T> type) -
      Retrieves the value of the designated column in the current row - of this ResultSet object and will convert from the - SQL type of the column to the requested Java data type, if the - conversion is supported.
      -
      java.lang.ObjectgetObject​(int columnIndex, - java.util.Map map) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as an Object - in the Java programming language.
      -
      java.lang.ObjectgetObject​(java.lang.String columnLabel)
      <T> TgetObject​(java.lang.String columnLabel, - java.lang.Class<T> type) -
      Retrieves the value of the designated column in the current row - of this ResultSet object and will convert from the - SQL type of the column to the requested Java data type, if the - conversion is supported.
      -
      java.lang.ObjectgetObject​(java.lang.String columnLabel, - java.util.Map map) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as an Object - in the Java programming language.
      -
      java.sql.RefgetRef​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a Ref object - in the Java programming language.
      -
      java.sql.RefgetRef​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a Ref object - in the Java programming language.
      -
      intgetRow() -
      Retrieves the current row number.
      -
      java.sql.RowIdgetRowId​(int columnIndex) -
      Retrieves the value of the designated column in the current row of this - ResultSet object as a java.sql.RowId object in the Java - programming language.
      -
      java.sql.RowIdgetRowId​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row of this - ResultSet object as a java.sql.RowId object in the Java - programming language.
      -
      shortgetShort​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a short in the Java programming language.
      -
      shortgetShort​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a short in the Java programming language.
      -
      java.sql.SQLXMLgetSQLXML​(int columnIndex) -
      Retrieves the value of the designated column in the current row of - this ResultSet as a - java.sql.SQLXML object in the Java programming language.
      -
      java.sql.SQLXMLgetSQLXML​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row of - this ResultSet as a - java.sql.SQLXML object in the Java programming language.
      -
      java.sql.StatementgetStatement() -
      Retrieves the Statement object that produced this - ResultSet object.
      -
      java.lang.StringgetString​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
      -
      java.lang.StringgetString​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language.
      -
      java.sql.TimegetTime​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Time object in the Java programming language.
      -
      java.sql.TimegetTime​(int columnIndex, - java.util.Calendar cal) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Time - object in the Java programming language.
      -
      java.sql.TimegetTime​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Time object in the Java programming language.
      -
      java.sql.TimegetTime​(java.lang.String columnLabel, - java.util.Calendar cal) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Time object - in the Java programming language.
      -
      java.sql.TimestampgetTimestamp​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Timestamp object in the Java programming language.
      -
      java.sql.TimestampgetTimestamp​(int columnIndex, - java.util.Calendar cal) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Timestamp object - in the Java programming language.
      -
      java.sql.TimestampgetTimestamp​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Timestamp object in the Java programming language.
      -
      java.sql.TimestampgetTimestamp​(java.lang.String columnLabel, - java.util.Calendar cal) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Timestamp object - in the Java programming language.
      -
      intgetType() -
      Retrieves the type of this ResultSet object.
      -
      java.io.InputStreamgetUnicodeStream​(int columnIndex) -
      Deprecated. -
      use getCharacterStream in place of - getUnicodeStream
      -
      -
      java.io.InputStreamgetUnicodeStream​(java.lang.String columnLabel) -
      Deprecated. -
      use getCharacterStream instead
      -
      -
      java.net.URLgetURL​(int columnIndex) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.net.URL - object in the Java programming language.
      -
      java.net.URLgetURL​(java.lang.String columnLabel) -
      Retrieves the value of the designated column in the current row - of this ResultSet object as a java.net.URL - object in the Java programming language.
      -
      java.sql.SQLWarninggetWarnings() -
      Retrieves the first warning reported by calls on this - ResultSet object.
      -
      voidinsertRow() -
      Inserts the contents of the insert row into this - ResultSet object and into the database.
      -
      booleanisAfterLast() -
      Retrieves whether the cursor is after the last row in - this ResultSet object.
      -
      booleanisBeforeFirst() -
      Retrieves whether the cursor is before the first row in - this ResultSet object.
      -
      booleanisClosed() -
      Retrieves whether this ResultSet object has been closed.
      -
      booleanisFirst() -
      Retrieves whether the cursor is on the first row of - this ResultSet object.
      -
      booleanisLast() -
      Retrieves whether the cursor is on the last row of - this ResultSet object.
      -
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      booleanlast() -
      Moves the cursor to the last row in - this ResultSet object.
      -
      voidmoveToCurrentRow() -
      Moves the cursor to the remembered cursor position, usually the - current row.
      -
      voidmoveToInsertRow() -
      Moves the cursor to the insert row.
      -
      static JDBCResultSetnewEmptyResultSet() 
      static JDBCResultSetnewJDBCResultSet​(org.hsqldb.result.Result r, - org.hsqldb.result.ResultMetaData metaData) -
      Factory method returns a new JDBCResultSet object for - use with user defined functions that return a ResultSet object.
      -
      booleannext() -
      Moves the cursor froward one row from its current position.
      -
      booleanprevious() -
      Moves the cursor to the previous row in this - ResultSet object.
      -
      voidrefreshRow() -
      Refreshes the current row with its most recent value in - the database.
      -
      booleanrelative​(int rows) -
      Moves the cursor a relative number of rows, either positive or negative.
      -
      booleanrowDeleted() -
      Retrieves whether a row has been deleted.
      -
      booleanrowInserted() -
      Retrieves whether the current row has had an insertion.
      -
      booleanrowUpdated() -
      Retrieves whether the current row has been updated.
      -
      voidsetFetchDirection​(int direction) -
      Gives a hint as to the direction in which the rows in this - ResultSet object will be processed.
      -
      voidsetFetchSize​(int rows) -
      Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for this - ResultSet object.
      -
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
      -
      voidupdateArray​(int columnIndex, - java.sql.Array x) -
      Updates the designated column with a java.sql.Array value.
      -
      voidupdateArray​(java.lang.String columnLabel, - java.sql.Array x) -
      Updates the designated column with a java.sql.Array value.
      -
      voidupdateAsciiStream​(int columnIndex, - java.io.InputStream x) -
      Updates the designated column with an ascii stream value.
      -
      voidupdateAsciiStream​(int columnIndex, - java.io.InputStream x, - int length) -
      (JDBC4 clarification:) - Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
      -
      voidupdateAsciiStream​(int columnIndex, - java.io.InputStream x, - long length) -
      Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
      -
      voidupdateAsciiStream​(java.lang.String columnLabel, - java.io.InputStream x) -
      Updates the designated column with an ascii stream value.
      -
      voidupdateAsciiStream​(java.lang.String columnLabel, - java.io.InputStream x, - int length) -
      (JDBC4 clarification:) - Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
      -
      voidupdateAsciiStream​(java.lang.String columnLabel, - java.io.InputStream x, - long length) -
      Updates the designated column with an ascii stream value, which will have - the specified number of bytes.
      -
      voidupdateBigDecimal​(int columnIndex, - java.math.BigDecimal x) -
      Updates the designated column with a java.math.BigDecimal - value.
      -
      voidupdateBigDecimal​(java.lang.String columnLabel, - java.math.BigDecimal x) -
      Updates the designated column with a java.sql.BigDecimal - value.
      -
      voidupdateBinaryStream​(int columnIndex, - java.io.InputStream x) -
      Updates the designated column with a binary stream value.
      -
      voidupdateBinaryStream​(int columnIndex, - java.io.InputStream x, - int length) -
      (JDBC4 clarification:) - Updates the designated column with a binary stream value, which will have - the specified number of bytes.
      -
      voidupdateBinaryStream​(int columnIndex, - java.io.InputStream x, - long length) -
      Updates the designated column with a binary stream value, which will have - the specified number of bytes.
      -
      voidupdateBinaryStream​(java.lang.String columnLabel, - java.io.InputStream x) -
      Updates the designated column with a binary stream value.
      -
      voidupdateBinaryStream​(java.lang.String columnLabel, - java.io.InputStream x, - int length) -
      (JDBC4 clarification:) - Updates the designated column with a binary stream value, which will have - the specified number of bytes.
      -
      voidupdateBinaryStream​(java.lang.String columnLabel, - java.io.InputStream x, - long length) -
      Updates the designated column with a binary stream value, which will have - the specified number of bytes.
      -
      voidupdateBlob​(int columnIndex, - java.io.InputStream inputStream) -
      Updates the designated column using the given input stream.
      -
      voidupdateBlob​(int columnIndex, - java.io.InputStream inputStream, - long length) -
      Updates the designated column using the given input stream, which - will have the specified number of bytes.
      -
      voidupdateBlob​(int columnIndex, - java.sql.Blob x) -
      Updates the designated column with a java.sql.Blob value.
      -
      voidupdateBlob​(java.lang.String columnLabel, - java.io.InputStream inputStream) -
      Updates the designated column using the given input stream.
      -
      voidupdateBlob​(java.lang.String columnLabel, - java.io.InputStream inputStream, - long length) -
      Updates the designated column using the given input stream, which - will have the specified number of bytes.
      -
      voidupdateBlob​(java.lang.String columnLabel, - java.sql.Blob x) -
      Updates the designated column with a java.sql.Blob value.
      -
      voidupdateBoolean​(int columnIndex, - boolean x) -
      Updates the designated column with a boolean value.
      -
      voidupdateBoolean​(java.lang.String columnLabel, - boolean x) -
      Updates the designated column with a boolean value.
      -
      voidupdateByte​(int columnIndex, - byte x) -
      Updates the designated column with a byte value.
      -
      voidupdateByte​(java.lang.String columnLabel, - byte x) -
      Updates the designated column with a byte value.
      -
      voidupdateBytes​(int columnIndex, - byte[] x) -
      Updates the designated column with a byte array value.
      -
      voidupdateBytes​(java.lang.String columnLabel, - byte[] x) -
      Updates the designated column with a byte array value.
      -
      voidupdateCharacterStream​(int columnIndex, - java.io.Reader x) -
      Updates the designated column with a character stream value.
      -
      voidupdateCharacterStream​(int columnIndex, - java.io.Reader x, - int length) -
      (JDBC4 clarification:) - Updates the designated column with a character stream value, which will have - the specified number of (CHECKME: characters?) bytes.
      -
      voidupdateCharacterStream​(int columnIndex, - java.io.Reader x, - long length) -
      Updates the designated column with a character stream value, which will have - the specified number of bytes.
      -
      voidupdateCharacterStream​(java.lang.String columnLabel, - java.io.Reader reader) -
      Updates the designated column with a character stream value.
      -
      voidupdateCharacterStream​(java.lang.String columnLabel, - java.io.Reader reader, - int length) -
      (JDBC4 clarification) - Updates the designated column with a character stream value, which will have - the specified number of (CHECKME: characters?) bytes.
      -
      voidupdateCharacterStream​(java.lang.String columnLabel, - java.io.Reader reader, - long length) -
      Updates the designated column with a character stream value, which will have - the specified number of bytes.
      -
      voidupdateClob​(int columnIndex, - java.io.Reader reader) -
      Updates the designated column using the given Reader - object.
      -
      voidupdateClob​(int columnIndex, - java.io.Reader reader, - long length) -
      Updates the designated column using the given Reader - object, which is the given number of characters long.
      -
      voidupdateClob​(int columnIndex, - java.sql.Clob x) -
      Updates the designated column with a java.sql.Clob value.
      -
      voidupdateClob​(java.lang.String columnLabel, - java.io.Reader reader) -
      Updates the designated column using the given Reader - object.
      -
      voidupdateClob​(java.lang.String columnLabel, - java.io.Reader reader, - long length) -
      Updates the designated column using the given Reader - object, which is the given number of characters long.
      -
      voidupdateClob​(java.lang.String columnLabel, - java.sql.Clob x) -
      Updates the designated column with a java.sql.Clob value.
      -
      voidupdateDate​(int columnIndex, - java.sql.Date x) -
      Updates the designated column with a java.sql.Date value.
      -
      voidupdateDate​(java.lang.String columnLabel, - java.sql.Date x) -
      Updates the designated column with a java.sql.Date value.
      -
      voidupdateDouble​(int columnIndex, - double x) -
      Updates the designated column with a double value.
      -
      voidupdateDouble​(java.lang.String columnLabel, - double x) -
      Updates the designated column with a double value.
      -
      voidupdateFloat​(int columnIndex, - float x) -
      Updates the designated column with a float value.
      -
      voidupdateFloat​(java.lang.String columnLabel, - float x) -
      Updates the designated column with a float value.
      -
      voidupdateInt​(int columnIndex, - int x) -
      Updates the designated column with an int value.
      -
      voidupdateInt​(java.lang.String columnLabel, - int x) -
      Updates the designated column with an int value.
      -
      voidupdateLong​(int columnIndex, - long x) -
      Updates the designated column with a long value.
      -
      voidupdateLong​(java.lang.String columnLabel, - long x) -
      Updates the designated column with a long value.
      -
      voidupdateNCharacterStream​(int columnIndex, - java.io.Reader reader) -
      Updates the designated column with a character stream value.
      -
      voidupdateNCharacterStream​(int columnIndex, - java.io.Reader x, - long length) -
      Updates the designated column with a character stream value, which will have - the specified number of bytes.
      -
      voidupdateNCharacterStream​(java.lang.String columnLabel, - java.io.Reader reader) -
      Updates the designated column with a character stream value.
      -
      voidupdateNCharacterStream​(java.lang.String columnLabel, - java.io.Reader reader, - long length) -
      Updates the designated column with a character stream value, which will have - the specified number of bytes.
      -
      voidupdateNClob​(int columnIndex, - java.io.Reader reader) -
      Updates the designated column using the given Reader - - The data will be read from the stream - as needed until end-of-stream is reached.
      -
      voidupdateNClob​(int columnIndex, - java.io.Reader reader, - long length) -
      Updates the designated column using the given Reader - object, which is the given number of characters long.
      -
      voidupdateNClob​(int columnIndex, - java.sql.NClob nClob) -
      Updates the designated column with a java.sql.NClob value.
      -
      voidupdateNClob​(java.lang.String columnLabel, - java.io.Reader reader) -
      Updates the designated column using the given Reader - object.
      -
      voidupdateNClob​(java.lang.String columnLabel, - java.io.Reader reader, - long length) -
      Updates the designated column using the given Reader - object, which is the given number of characters long.
      -
      voidupdateNClob​(java.lang.String columnLabel, - java.sql.NClob nClob) -
      Updates the designated column with a java.sql.NClob value.
      -
      voidupdateNString​(int columnIndex, - java.lang.String nString) -
      Updates the designated column with a String value.
      -
      voidupdateNString​(java.lang.String columnLabel, - java.lang.String nString) -
      Updates the designated column with a String value.
      -
      voidupdateNull​(int columnIndex) -
      (JDBC4 clarification:) - Updates the designated column with a null value.
      -
      voidupdateNull​(java.lang.String columnLabel) -
      Updates the designated column with a null value.
      -
      voidupdateObject​(int columnIndex, - java.lang.Object x) -
      Updates the designated column with an Object value.
      -
      voidupdateObject​(int columnIndex, - java.lang.Object x, - int scaleOrLength) -
      Updates the designated column with an Object value.
      -
      voidupdateObject​(int columnIndex, - java.lang.Object x, - java.sql.SQLType targetSqlType) -
      Updates the designated column with an Object value.
      -
      voidupdateObject​(int columnIndex, - java.lang.Object x, - java.sql.SQLType targetSqlType, - int scaleOrLength) -
      Updates the designated column with an Object value.
      -
      voidupdateObject​(java.lang.String columnLabel, - java.lang.Object x) -
      Updates the designated column with an Object value.
      -
      voidupdateObject​(java.lang.String columnLabel, - java.lang.Object x, - int scaleOrLength) -
      Updates the designated column with an Object value.
      -
      voidupdateObject​(java.lang.String columnLabel, - java.lang.Object x, - java.sql.SQLType targetSqlType) -
      Updates the designated column with an Object value.
      -
      voidupdateObject​(java.lang.String columnLabel, - java.lang.Object x, - java.sql.SQLType targetSqlType, - int scaleOrLength) -
      Updates the designated column with an Object value.
      -
      voidupdateRef​(int columnIndex, - java.sql.Ref x) -
      Updates the designated column with a java.sql.Ref value.
      -
      voidupdateRef​(java.lang.String columnLabel, - java.sql.Ref x) -
      Updates the designated column with a java.sql.Ref value.
      -
      voidupdateRow() -
      Updates the underlying database with the new contents of the - current row of this ResultSet object.
      -
      voidupdateRowId​(int columnIndex, - java.sql.RowId x) -
      Updates the designated column with a RowId value.
      -
      voidupdateRowId​(java.lang.String columnLabel, - java.sql.RowId x) -
      Updates the designated column with a RowId value.
      -
      voidupdateShort​(int columnIndex, - short x) -
      Updates the designated column with a short value.
      -
      voidupdateShort​(java.lang.String columnLabel, - short x) -
      Updates the designated column with a short value.
      -
      voidupdateSQLXML​(int columnIndex, - java.sql.SQLXML xmlObject) -
      Updates the designated column with a java.sql.SQLXML value.
      -
      voidupdateSQLXML​(java.lang.String columnLabel, - java.sql.SQLXML xmlObject) -
      Updates the designated column with a java.sql.SQLXML value.
      -
      voidupdateString​(int columnIndex, - java.lang.String x) -
      Updates the designated column with a String value.
      -
      voidupdateString​(java.lang.String columnLabel, - java.lang.String x) -
      Updates the designated column with a String value.
      -
      voidupdateTime​(int columnIndex, - java.sql.Time x) -
      Updates the designated column with a java.sql.Time value.
      -
      voidupdateTime​(java.lang.String columnLabel, - java.sql.Time x) -
      Updates the designated column with a java.sql.Time value.
      -
      voidupdateTimestamp​(int columnIndex, - java.sql.Timestamp x) -
      Updates the designated column with a java.sql.Timestamp - value.
      -
      voidupdateTimestamp​(java.lang.String columnLabel, - java.sql.Timestamp x) -
      Updates the designated column with a java.sql.Timestamp - value.
      -
      booleanwasNull() -
      Reports whether - the last column read had a value of SQL NULL.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        result

        -
        public org.hsqldb.result.Result result
        -
        The underlying result.
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCResultSet

        -
        public JDBCResultSet​(JDBCConnection conn,
        -                     org.hsqldb.jdbc.JDBCStatementBase s,
        -                     org.hsqldb.result.Result r,
        -                     org.hsqldb.result.ResultMetaData metaData)
        -
        Constructs a new JDBCResultSet object using the specified - navigator and org.hsqldb.result.ResultMetaData. -

        -
        -
        Parameters:
        -
        conn - JDBCConnection
        -
        s - the statement
        -
        r - the internal result form that the new - JDBCResultSet represents
        -
        metaData - the connection properties
        -
        -
      • -
      - - - -
        -
      • -

        JDBCResultSet

        -
        public JDBCResultSet​(JDBCConnection conn,
        -                     org.hsqldb.result.Result r,
        -                     org.hsqldb.result.ResultMetaData metaData)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        next

        -
        public boolean next()
        -             throws java.sql.SQLException
        -
        - Moves the cursor froward one row from its current position. - A ResultSet cursor is initially positioned - before the first row; the first call to the method - next makes the first row the current row; the - second call makes the second row the current row, and so on. -

        (JDBC4 clarification:) - When a call to the next method returns false, - the cursor is positioned after the last row. Any - invocation of a ResultSet method which requires a - current row will result in a SQLException being thrown. - If the result set type is TYPE_FORWARD_ONLY, it is vendor specified - whether their JDBC driver implementation will return false or - throw an SQLException on a - subsequent call to next. - -

        If an input stream is open for the current row, a call - to the method next will - implicitly close it. A ResultSet object's - warning chain is cleared when a new row is read. -

        -
        -
        Specified by:
        -
        next in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the new current row is valid; - false if there are no more rows
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.sql.SQLException
        -
        - Releases this ResultSet object's database and - JDBC resources immediately instead of waiting for - this to happen when it is automatically closed. - -

        (JDBC4 clarification:) - The closing of a ResultSet object does not close the Blob, - Clob or NClob objects created by the ResultSet. Blob, - Clob or NClob objects remain valid for at least the duration of the - transaction in which they are created, unless their free method is invoked. -

        - (JDBC4 clarification:) - When a ResultSet is closed, any ResultSetMetaData - instances that were created by calling the getMetaData - method remain accessible. - -

        Note: A ResultSet object - is automatically closed by the - Statement object that generated it when - that Statement object is closed, - re-executed, or is used to retrieve the next result from a - sequence of multiple results. - (JDBC4 deleted:) [A ResultSet object is also automatically - closed when it is garbage collected.] -

        - Calling the method close on a ResultSet - object that is already closed is a no-op. - -

        -

        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        wasNull

        -
        public boolean wasNull()
        -                throws java.sql.SQLException
        -
        - Reports whether - the last column read had a value of SQL NULL. - Note that you must first call one of the getter methods - on a column to try to read its value and then call - the method wasNull to see if the value read was - SQL NULL. -
        -
        -
        Specified by:
        -
        wasNull in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the last column value read was SQL - NULL and false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(int columnIndex)
        -                           throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language. -
        -
        -
        Specified by:
        -
        getString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean​(int columnIndex)
        -                   throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a boolean in the Java programming language. - - -

        (JDBC4 clarification:) -

        If the designated column has a datatype of CHAR or VARCHAR - and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - and contains a 0, a value of false is returned. If the designated column has a datatype - of CHAR or VARCHAR - and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - and contains a 1, a value of true is returned. -

        -
        -
        Specified by:
        -
        getBoolean in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is false
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getByte

        -
        public byte getByte​(int columnIndex)
        -             throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the numeric value to the return type. If the value is - out of the range for the return type, an error is returned. For example, - this can happen if getByte() or getShort() is used to retrieve a value - of type INTEGER or BIGINT and the value is beyond the range covered by - the return type. - -

        -
        -
        -
        Specified by:
        -
        getByte in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getShort

        -
        public short getShort​(int columnIndex)
        -               throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a short in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the numeric value to the return type. If the value is - out of the range for the return type, an error is returned. For example, - this can happen if getByte() or getShort() is used to retrieve a value - of type INTEGER or BIGINT and the value is beyond the range covered by - the return type. - -

        -
        -
        -
        Specified by:
        -
        getShort in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt​(int columnIndex)
        -           throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - an int in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the numeric value to the return type. If the value is - out of the range for the return type, an error is returned. For example, - this can happen if getInt() or getLong() is used to retrieve a value - of type DECIMAL or NUMERIC with a large precision and the value is beyond - the range covered by the return type. - -

        -
        -
        -
        Specified by:
        -
        getInt in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong​(int columnIndex)
        -             throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a long in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the numeric value to the return type. If the value is - out of the range for the return type, an error is returned. For example, - this can happen if getInt() or getLong() is used to retrieve a value - of type DECIMAL or NUMERIC with a large precision and the value is beyond - the range covered by the return type. - -

        -
        -
        -
        Specified by:
        -
        getLong in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat​(int columnIndex)
        -               throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a float in the Java programming language. - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the numeric value to the return type. If the value is - out of the range for the return type, an error is returned. For example, - this can happen if getFloat() or getDouble() is used to retrieve a value - of type DECIMAL or NUMERIC with a large precision and the value is beyond - the range covered by the return type. - -

        -
        -
        -
        Specified by:
        -
        getFloat in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble​(int columnIndex)
        -                 throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a double in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the numeric value to the return type. If the value is - out of the range for the return type, an error is returned. For example, - this can happen if getFloat() or getDouble() is used to retrieve a value - of type DECIMAL or NUMERIC with a large precision and the value is beyond - the range covered by the return type. - -

        -
        -
        -
        Specified by:
        -
        getDouble in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getBigDecimal

        -
        @Deprecated
        -public java.math.BigDecimal getBigDecimal​(int columnIndex,
        -                                          int scale)
        -                                   throws java.sql.SQLException
        -
        Deprecated. -
        by java.sun.com as of JDK 1.2
        -
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.BigDecimal in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the result and sets the scale - with BigDecimal.ROUND_HALF_DOWN. -

        -
        -
        -
        Specified by:
        -
        getBigDecimal in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        scale - the number of digits to the right of the decimal point
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes​(int columnIndex)
        -                throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte array in the Java programming language. - The bytes represent the raw values returned by the driver. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB returns correct values for columns of binary types - BINARY, BIT, BLOB -

        -
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(int columnIndex)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Date object in the Java programming language. -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(int columnIndex)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Time object in the Java programming language. -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(int columnIndex)
        -                                throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Timestamp object in the Java programming language. -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getAsciiStream

        -
        public java.io.InputStream getAsciiStream​(int columnIndex)
        -                                   throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a stream of ASCII characters. The value can then be read in chunks from the - stream. This method is particularly - suitable for retrieving large LONGVARCHAR values. - The JDBC driver will - do any necessary conversion from the database format into ASCII. - -

        Note: All the data in the returned stream must be - read prior to getting the value of any other column. The next - call to a getter method implicitly closes the stream. Also, a - stream may return 0 when the method - InputStream.available - is called whether there is data available or not. - - - -

        -

        HSQLDB-Specific Information:

        - - The limitation noted above does not apply to HSQLDB.

        - - When the column is of type CHAR and its variations, it requires no - conversion since it is represented internally already as a - Java String object. When the column is not of type CHAR and its - variations, the returned stream is based on a conversion to the - Java String representation of the value. In either case, - the obtained stream is always equivalent to a stream of the low order - bytes from the value's String representation.

        - - HSQLDB SQL CHAR and its variations are all Unicode strings - internally, so the recommended alternatives to this method are - getString, - getUnicodeStream (deprecated) - and new to 1.7.0: getCharacterStream - (now preferred over the deprecated getUnicodeStream alternative). -

        -
        -
        -
        Specified by:
        -
        getAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a Java input stream that delivers the database column value - as a stream of one-byte ASCII characters; - if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getUnicodeStream

        -
        @Deprecated
        -public java.io.InputStream getUnicodeStream​(int columnIndex)
        -                                     throws java.sql.SQLException
        -
        Deprecated. -
        use getCharacterStream in place of - getUnicodeStream
        -
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object - as a stream of two-byte Unicode characters. The first byte is - the high byte; the second byte is the low byte. - - The value can then be read in chunks from the - stream. This method is particularly - suitable for retrieving large LONGVARCHARvalues. The - JDBC driver will do any necessary conversion from the database - format into Unicode. - -

        Note: All the data in the returned stream must be - read prior to getting the value of any other column. The next - call to a getter method implicitly closes the stream. - Also, a stream may return 0 when the method - InputStream.available - is called, whether there is data available or not. - - - -

        -

        HSQLDB-Specific Information:

        - - The limitation noted above does not apply to HSQLDB.

        - - When the column is of type CHAR and its variations, it requires no - conversion since it is represented internally already as - Java Strings. When the column is not of type CHAR and its variations, - the returned stream is based on a conversion to the - Java String representation of the value. In either case, - the obtained stream is always equivalent to a stream of - bytes from the value's String representation, with high-byte first. -

        -
        -
        -
        Specified by:
        -
        getUnicodeStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a Java input stream that delivers the database column value - as a stream of two-byte Unicode characters; - if the value is SQL NULL, the value returned is - null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream​(int columnIndex)
        -                                    throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of - uninterpreted bytes. The value can then be read in chunks from the - stream. This method is particularly - suitable for retrieving large LONGVARBINARY values. - -

        Note: All the data in the returned stream must be - read prior to getting the value of any other column. The next - call to a getter method implicitly closes the stream. Also, a - stream may return 0 when the method - InputStream.available - is called whether there is data available or not. -

        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a Java input stream that delivers the database column value - as a stream of uninterpreted bytes; - if the value is SQL NULL, the value returned is - null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String columnLabel)
        -                           throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language. -
        -
        -
        Specified by:
        -
        getString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getBoolean

        -
        public boolean getBoolean​(java.lang.String columnLabel)
        -                   throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a boolean in the Java programming language. - -

        (JDBC4 clarification:) If the designated column has a datatype of CHAR or VARCHAR - and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - and contains a 0, a value of false is returned. If the designated column has a datatype - of CHAR or VARCHAR - and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - and contains a 1, a value of true is returned. -

        -
        -
        Specified by:
        -
        getBoolean in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is false
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getByte

        -
        public byte getByte​(java.lang.String columnLabel)
        -             throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte in the Java programming language. -
        -
        -
        Specified by:
        -
        getByte in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getShort

        -
        public short getShort​(java.lang.String columnLabel)
        -               throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a short in the Java programming language. -
        -
        -
        Specified by:
        -
        getShort in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getInt

        -
        public int getInt​(java.lang.String columnLabel)
        -           throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - an int in the Java programming language. -
        -
        -
        Specified by:
        -
        getInt in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getLong

        -
        public long getLong​(java.lang.String columnLabel)
        -             throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a long in the Java programming language. -
        -
        -
        Specified by:
        -
        getLong in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getFloat

        -
        public float getFloat​(java.lang.String columnLabel)
        -               throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a float in the Java programming language. -
        -
        -
        Specified by:
        -
        getFloat in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getDouble

        -
        public double getDouble​(java.lang.String columnLabel)
        -                 throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a double in the Java programming language. -
        -
        -
        Specified by:
        -
        getDouble in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is 0
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getBigDecimal

        -
        @Deprecated
        -public java.math.BigDecimal getBigDecimal​(java.lang.String columnLabel,
        -                                          int scale)
        -                                   throws java.sql.SQLException
        -
        Deprecated. -
        by java.sun.com as of JDK 1.2
        -
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.math.BigDecimal in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB converts the result and sets the scale - with BigDecimal.ROUND_HALF_DOWN. -

        -
        -
        -
        Specified by:
        -
        getBigDecimal in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        scale - the number of digits to the right of the decimal point
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes​(java.lang.String columnLabel)
        -                throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a byte array in the Java programming language. - The bytes represent the raw values returned by the driver. -
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(java.lang.String columnLabel)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Date object in the Java programming language. -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(java.lang.String columnLabel)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Time object in the Java programming language. -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; - if the value is SQL NULL, - the value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(java.lang.String columnLabel)
        -                                throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as - a java.sql.Timestamp object in the Java programming language. -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getAsciiStream

        -
        public java.io.InputStream getAsciiStream​(java.lang.String columnLabel)
        -                                   throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of - ASCII characters. The value can then be read in chunks from the - stream. This method is particularly - suitable for retrieving large LONGVARCHAR values. - The JDBC driver will - do any necessary conversion from the database format into ASCII. - -

        Note: All the data in the returned stream must be - read prior to getting the value of any other column. The next - call to a getter method implicitly closes the stream. Also, a - stream may return 0 when the method available - is called whether there is data available or not. -

        -
        -
        Specified by:
        -
        getAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a Java input stream that delivers the database column value - as a stream of one-byte ASCII characters. - If the value is SQL NULL, - the value returned is null.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        See Also:
        -
        getAsciiStream(int)
        -
        -
      • -
      - - - -
        -
      • -

        getUnicodeStream

        -
        @Deprecated
        -public java.io.InputStream getUnicodeStream​(java.lang.String columnLabel)
        -                                     throws java.sql.SQLException
        -
        Deprecated. -
        use getCharacterStream instead
        -
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of two-byte - Unicode characters. The first byte is the high byte; the second - byte is the low byte. - - The value can then be read in chunks from the - stream. This method is particularly - suitable for retrieving large LONGVARCHAR values. - The JDBC technology-enabled driver will - do any necessary conversion from the database format into Unicode. - -

        Note: All the data in the returned stream must be - read prior to getting the value of any other column. The next - call to a getter method implicitly closes the stream. - Also, a stream may return 0 when the method - InputStream.available is called, whether there - is data available or not. -

        -
        -
        Specified by:
        -
        getUnicodeStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a Java input stream that delivers the database column value - as a stream of two-byte Unicode characters. - If the value is SQL NULL, the value returned - is null.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        See Also:
        -
        getUnicodeStream(int)
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream​(java.lang.String columnLabel)
        -                                    throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a stream of uninterpreted - bytes. - The value can then be read in chunks from the - stream. This method is particularly - suitable for retrieving large LONGVARBINARY - values. - -

        Note: All the data in the returned stream must be - read prior to getting the value of any other column. The next - call to a getter method implicitly closes the stream. Also, a - stream may return 0 when the method available - is called whether there is data available or not. -

        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a Java input stream that delivers the database column value - as a stream of uninterpreted bytes; - if the value is SQL NULL, the result is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getWarnings

        -
        public java.sql.SQLWarning getWarnings()
        -                                throws java.sql.SQLException
        -
        - Retrieves the first warning reported by calls on this - ResultSet object. - Subsequent warnings on this ResultSet object - will be chained to the SQLWarning object that - this method returns. - -

        The warning chain is automatically cleared each time a new - row is read. This method may not be called on a ResultSet - object that has been closed; doing so will cause an - SQLException to be thrown. -

        - Note: This warning chain only covers warnings caused - by ResultSet methods. Any warning caused by - Statement methods - (such as reading OUT parameters) will be chained on the - Statement object. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB does not produce SQLWarning - objects on any ResultSet object warning chain; this - method always returns null. -

        -
        -
        -
        Specified by:
        -
        getWarnings in interface java.sql.ResultSet
        -
        Returns:
        -
        the first SQLWarning object reported or - null if there are none
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        clearWarnings

        -
        public void clearWarnings()
        -                   throws java.sql.SQLException
        -
        - Clears all warnings reported on this ResultSet object. - After this method is called, the method getWarnings - returns null until a new warning is - reported for this ResultSet object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not produce SQLWarning - objects on any ResultSet object warning chain; calls to this method - are ignored. -

        -
        -
        -
        Specified by:
        -
        clearWarnings in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getCursorName

        -
        public java.lang.String getCursorName()
        -                               throws java.sql.SQLException
        -
        - Retrieves the name of the SQL cursor used by this ResultSet - object. - -

        In SQL, a result table is retrieved through a cursor that is - named. The current row of a result set can be updated or deleted - using a positioned update/delete statement that references the - cursor name. To ensure that the cursor has the proper isolation - level to support update, the cursor's SELECT statement - should be of the form SELECT FOR UPDATE. If - FOR UPDATE is omitted, the positioned updates may fail. - -

        The JDBC API supports this SQL feature by providing the name of the - SQL cursor used by a ResultSet object. - The current row of a ResultSet object - is also the current row of this SQL cursor. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature when the cursor has a name.

        - -

        -
        -
        -
        Specified by:
        -
        getCursorName in interface java.sql.ResultSet
        -
        Returns:
        -
        the SQL name for this ResultSet object's cursor
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        getMetaData

        -
        public java.sql.ResultSetMetaData getMetaData()
        -                                       throws java.sql.SQLException
        -
        - Retrieves the number, types and properties of - this ResultSet object's columns. - - - -
        -

        HSQLDB-Specific Information:

        - - Example:

        - - The following code fragment creates a ResultSet object rs, - creates a ResultSetMetaData object rsmd, and uses rsmd - to find out how many columns rs has and whether the first column - in rs can be used in a WHERE clause. - -

        - ResultSet rs   = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
        - ResultSetMetaData rsmd = rs.getMetaData();
        - int numberOfColumns = rsmd.getColumnCount();
        - boolean b = rsmd.isSearchable(1);
        -
        - -
        - - Changes:

        - - With version 2.0, the engine's SQL implementation has been - completely rewritten. Changes to this class and the implementation of - ResultSetMetaData reflect the engine's new capabilities and provide - more accurate information.

        - - changes to consider: - -

          -
        1. isAutoIncrement(int) always returned false
        2. -
        3. isNullable(int) returns the nullability of a real table or view - column in the ResultSet and returns - columnNoNulls for non-base-column ResultSet columns - (columns of the ResultSet that are based on expressions or - aggregates).
        4. -
        5. getColumnDisplaySize(int) returns correct results even for expression - columns.
        6. -
        7. getPrecision(int) returns the correct precision even for expression - columns.
        8. -
        9. getScale(int) returns the correct precision even for expression - columns.
        10. -
        11. getCatalogName(int) returns the catalog name of the database.
        12. -
        - -
        -
        -
        -
        -
        Specified by:
        -
        getMetaData in interface java.sql.ResultSet
        -
        Returns:
        -
        the description of this ResultSet object's columns
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        See Also:
        -
        JDBCResultSetMetaData
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(int columnIndex)
        -                           throws java.sql.SQLException
        -
        -

        Gets the value of the designated column in the current row - of this ResultSet object as - an Object in the Java programming language. - -

        This method will return the value of the given column as a - Java object. The type of the Java object will be the default - Java object type corresponding to the column's SQL type, - following the mapping for built-in types specified in the JDBC - specification. If the value is an SQL NULL, - the driver returns a Java null. - -

        This method may also be used to read database-specific - abstract data types. - - In the JDBC 2.0 API, the behavior of method - getObject is extended to materialize - data of SQL user-defined types. -

        - If Connection.getTypeMap does not throw a - SQLFeatureNotSupportedException, - then when a column contains a structured or distinct value, - the behavior of this method is as - if it were a call to: getObject(columnIndex, - this.getStatement().getConnection().getTypeMap()). - - If Connection.getTypeMap does throw a - SQLFeatureNotSupportedException, - then structured values are not supported, and distinct values - are mapped to the default Java class as determined by the - underlying SQL type of the DISTINCT type. -

        -
        -
        Specified by:
        -
        getObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a java.lang.Object holding the column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(java.lang.String columnLabel)
        -                           throws java.sql.SQLException
        -
        -

        Gets the value of the designated column in the current row - of this ResultSet object as - an Object in the Java programming language. - -

        This method will return the value of the given column as a - Java object. The type of the Java object will be the default - Java object type corresponding to the column's SQL type, - following the mapping for built-in types specified in the JDBC - specification. If the value is an SQL NULL, - the driver returns a Java null. -

        - This method may also be used to read database-specific - abstract data types. -

        - In the JDBC 2.0 API, the behavior of the method - getObject is extended to materialize - data of SQL user-defined types. When a column contains - a structured or distinct value, the behavior of this method is as - if it were a call to: getObject(columnIndex, - this.getStatement().getConnection().getTypeMap()). -

        -
        -
        Specified by:
        -
        getObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a java.lang.Object holding the column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        findColumn

        -
        public int findColumn​(java.lang.String columnLabel)
        -               throws java.sql.SQLException
        -
        - Maps the given ResultSet column label to its - ResultSet column index. - - - -
        -

        HSQLDB-Specific Information:

        - - Starting with 1.9.x, HSQLDB does an exhaustive search, backed by - a cache lookup (to improve performance for subsequent invocations with - a given input).

        - - Upon careful investigation of the JDBC specification and the behaviour - of existing JDBC drivers, there is actually nothing preventing the - findColumn method from doing an exhaustive search, as long as it conforms - to the following rules (which describe the new implementation): - -

          -
        1. the entire search is case insensitive -
        2. each search iteration occurs from leftmost to rightmost column, - returning the first match encountered -
        3. the first pass matches only bare column labels -
        4. the second pass matches only simple column names -
        5. further passes conform to the identifier qualification - and identifier quoting rules of the engine -
        - - In this implementation, the SQL tokenizer is not employed, both because - it does not yet correctly handle greater than two part qualification - and also because is is not immediately considered important to do a - truly exhaustive search, handling the full range of possibly mixed quoted - and unquoted identifier components.

        - - Instead: -

          -
        • a third pass matches simple table-dot-column qualified names -
        • a fourth pass matches simple schema-dot-table-dot-column qualified column names -
        -
        -
        -
        Specified by:
        -
        findColumn in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column index of the given column name
        -
        Throws:
        -
        java.sql.SQLException - if the ResultSet object - does not contain a column labeled columnLabel, a database access error occurs - or this method is called on a closed result set
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream​(int columnIndex)
        -                                  throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a java.io.Reader object that contains the column - value; if the value is SQL NULL, the value returned is - null in the Java programming language.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream​(java.lang.String columnLabel)
        -                                  throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a java.io.Reader object that contains the column - value; if the value is SQL NULL, the value returned is - null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBigDecimal

        -
        public java.math.BigDecimal getBigDecimal​(int columnIndex)
        -                                   throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.math.BigDecimal with full precision. -
        -
        -
        Specified by:
        -
        getBigDecimal in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value (full precision); - if the value is SQL NULL, the value returned is - null in the Java programming language.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBigDecimal

        -
        public java.math.BigDecimal getBigDecimal​(java.lang.String columnLabel)
        -                                   throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.math.BigDecimal with full precision. -
        -
        -
        Specified by:
        -
        getBigDecimal in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        the column value (full precision); - if the value is SQL NULL, the value returned is - null in the Java programming language.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        isBeforeFirst

        -
        public boolean isBeforeFirst()
        -                      throws java.sql.SQLException
        -
        - Retrieves whether the cursor is before the first row in - this ResultSet object. -

        - (JDBC4 Clarification:)

        - Note:Support for the isBeforeFirst method - is optional for ResultSets with a result - set type of TYPE_FORWARD_ONLY -

        -
        -
        Specified by:
        -
        isBeforeFirst in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the cursor is before the first row; - false if the cursor is at any other position or the - result set contains no rows
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        isAfterLast

        -
        public boolean isAfterLast()
        -                    throws java.sql.SQLException
        -
        - Retrieves whether the cursor is after the last row in - this ResultSet object. -

        - (JDBC4 Clarification:)

        - Note:Support for the isAfterLast method - is optional for ResultSets with a result - set type of TYPE_FORWARD_ONLY -

        -
        -
        Specified by:
        -
        isAfterLast in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the cursor is after the last row; - false if the cursor is at any other position or the - result set contains no rows
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        isFirst

        -
        public boolean isFirst()
        -                throws java.sql.SQLException
        -
        - Retrieves whether the cursor is on the first row of - this ResultSet object. -

        - (JDBC4 Clarification:)

        - Note:Support for the isFirst method - is optional for ResultSets with a result - set type of TYPE_FORWARD_ONLY -

        -
        -
        Specified by:
        -
        isFirst in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the cursor is on the first row; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        isLast

        -
        public boolean isLast()
        -               throws java.sql.SQLException
        -
        - Retrieves whether the cursor is on the last row of - this ResultSet object. - Note: Calling the method isLast may be expensive - because the JDBC driver - might need to fetch ahead one row in order to determine - whether the current row is the last row in the result set. -

        - (JDBC4 Clarification:)

        - Note: Support for the isLast method - is optional for ResultSets with a result - set type of TYPE_FORWARD_ONLY -

        -
        -
        Specified by:
        -
        isLast in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the cursor is on the last row; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or this method is - called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        beforeFirst

        -
        public void beforeFirst()
        -                 throws java.sql.SQLException
        -
        - Moves the cursor to the front of - this ResultSet object, just before the - first row. This method has no effect if the result set contains no rows. -
        -
        -
        Specified by:
        -
        beforeFirst in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs, this method is called on a closed result set or the - result set type is TYPE_FORWARD_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        afterLast

        -
        public void afterLast()
        -               throws java.sql.SQLException
        -
        - Moves the cursor to the end of - this ResultSet object, just after the - last row. This method has no effect if the result set contains no rows. -
        -
        -
        Specified by:
        -
        afterLast in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs, this method is called on a closed result set - or the result set type is TYPE_FORWARD_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        first

        -
        public boolean first()
        -              throws java.sql.SQLException
        -
        - Moves the cursor to the first row in - this ResultSet object. -
        -
        -
        Specified by:
        -
        first in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the cursor is on a valid row; - false if there are no rows in the result set
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs, this method is called on a closed result set - or the result set type is TYPE_FORWARD_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        last

        -
        public boolean last()
        -             throws java.sql.SQLException
        -
        - Moves the cursor to the last row in - this ResultSet object. -
        -
        -
        Specified by:
        -
        last in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the cursor is on a valid row; - false if there are no rows in the result set
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs, this method is called on a closed result set - or the result set type is TYPE_FORWARD_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getRow

        -
        public int getRow()
        -           throws java.sql.SQLException
        -
        - Retrieves the current row number. The first row is number 1, the - second number 2, and so on. -

        - (JDBC4 Clarification:)

        - Note:Support for the getRow method - is optional for ResultSets with a result - set type of TYPE_FORWARD_ONLY -

        -
        -
        Specified by:
        -
        getRow in interface java.sql.ResultSet
        -
        Returns:
        -
        the current row number; 0 if there is no current row
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        absolute

        -
        public boolean absolute​(int row)
        -                 throws java.sql.SQLException
        -
        - Moves the cursor to the given row number in - this ResultSet object. - -

        If the row number is positive, the cursor moves to - the given row number with respect to the - beginning of the result set. The first row is row 1, the second - is row 2, and so on. - -

        If the given row number is negative, the cursor moves to - an absolute row position with respect to - the end of the result set. For example, calling the method - absolute(-1) positions the - cursor on the last row; calling the method absolute(-2) - moves the cursor to the next-to-last row, and so on. - -

        An attempt to position the cursor beyond the first/last row in - the result set leaves the cursor before the first row or after - the last row. - -

        Note: Calling absolute(1) is the same - as calling first(). Calling absolute(-1) - is the same as calling last(). -

        -
        -
        Specified by:
        -
        absolute in interface java.sql.ResultSet
        -
        Parameters:
        -
        row - the number of the row to which the cursor should move. - A positive number indicates the row number counting from the - beginning of the result set; a negative number indicates the - row number counting from the end of the result set
        -
        Returns:
        -
        true if the cursor is moved to a position in this - ResultSet object; - false if the cursor is before the first row or after the - last row
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs, this method is called on a closed result set - or the result set type is TYPE_FORWARD_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        relative

        -
        public boolean relative​(int rows)
        -                 throws java.sql.SQLException
        -
        - Moves the cursor a relative number of rows, either positive or negative. - Attempting to move beyond the first/last row in the - result set positions the cursor before/after - the first/last row. Calling relative(0) is valid, but does - not change the cursor position. - -

        Note: Calling the method relative(1) - is identical to calling the method next() and - calling the method relative(-1) is identical - to calling the method previous(). -

        -
        -
        Specified by:
        -
        relative in interface java.sql.ResultSet
        -
        Parameters:
        -
        rows - an int specifying the number of rows to - move from the current row; a positive number moves the cursor - forward; a negative number moves the cursor backward
        -
        Returns:
        -
        true if the cursor is on a row; - false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this method - is called on a closed result set, - there is no current row, or the result set type is - TYPE_FORWARD_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        previous

        -
        public boolean previous()
        -                 throws java.sql.SQLException
        -
        - Moves the cursor to the previous row in this - ResultSet object. -

        - (JDBC4 clarification:) - When a call to the previous method returns false, - the cursor is positioned before the first row. Any invocation of a - ResultSet method which requires a current row will result in a - SQLException being thrown. -

        - (JDBC4 clarification:) - If an input stream is open for the current row, a call to the method - previous will implicitly close it. A ResultSet - object's warning change is cleared when a new row is read. -

        -

        -
        -
        Specified by:
        -
        previous in interface java.sql.ResultSet
        -
        Returns:
        -
        (JDBC4 clarification:) true if the cursor is now positioned on a valid row; - false if the cursor is positioned before the first row
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs; this method is called on a closed result set - or the result set type is TYPE_FORWARD_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        setFetchDirection

        -
        public void setFetchDirection​(int direction)
        -                       throws java.sql.SQLException
        -
        - Gives a hint as to the direction in which the rows in this - ResultSet object will be processed. - The initial value is determined by the - Statement object - that produced this ResultSet object. - The fetch direction may be changed at any time. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not need this hint. However, as mandated by the JDBC standard, - an SQLException is thrown if the result set type is TYPE_FORWARD_ONLY - and a fetch direction other than FETCH_FORWARD is requested.

        -

        -
        -
        -
        Specified by:
        -
        setFetchDirection in interface java.sql.ResultSet
        -
        Parameters:
        -
        direction - an int specifying the suggested - fetch direction; one of ResultSet.FETCH_FORWARD, - ResultSet.FETCH_REVERSE, or - ResultSet.FETCH_UNKNOWN
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs; this - method is called on a closed result set or - the result set type is TYPE_FORWARD_ONLY and the fetch - direction is not FETCH_FORWARD
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        JDBCStatement.setFetchDirection(int), -getFetchDirection()
        -
        -
      • -
      - - - -
        -
      • -

        getFetchDirection

        -
        public int getFetchDirection()
        -                      throws java.sql.SQLException
        -
        - Retrieves the fetch direction for this - ResultSet object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not depend on fetch direction and always returns - FETCH_FORWARD, but the value has no real meaning.

        -

        -
        -
        -
        Specified by:
        -
        getFetchDirection in interface java.sql.ResultSet
        -
        Returns:
        -
        the current fetch direction for this ResultSet object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setFetchDirection(int)
        -
        -
      • -
      - - - -
        -
      • -

        setFetchSize

        -
        public void setFetchSize​(int rows)
        -                  throws java.sql.SQLException
        -
        - Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for this - ResultSet object. - If the fetch size specified is zero, the JDBC driver - ignores the value and is free to make its own best guess as to what - the fetch size should be. The default value is set by the - Statement object - that created the result set. The fetch size may be changed at any time. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB may not build and return a result set as a - whole. Therefore the supplied, non-zero, fetch size value is used for - some ResultSet objects. -

        -
        -
        -
        Specified by:
        -
        setFetchSize in interface java.sql.ResultSet
        -
        Parameters:
        -
        rows - the number of rows to fetch
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs; this method - (JDBC4 Clarification:) - is called on a closed result set or the - (JDBC4 clarification:) - condition rows >= 0 is not satisfied
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        getFetchSize(), -JDBCStatement.setFetchSize(int), -JDBCStatement.getFetchSize()
        -
        -
      • -
      - - - -
        -
      • -

        getFetchSize

        -
        public int getFetchSize()
        -                 throws java.sql.SQLException
        -
        - Retrieves the fetch size for this - ResultSet object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB may not build and return a result set as a - whole. The actual fetch size for this result set is returned. -

        -
        -
        -
        Specified by:
        -
        getFetchSize in interface java.sql.ResultSet
        -
        Returns:
        -
        the current fetch size for this ResultSet object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setFetchSize(int), -JDBCStatement.getFetchSize(), -JDBCStatement.setFetchSize(int)
        -
        -
      • -
      - - - -
        -
      • -

        getType

        -
        public int getType()
        -            throws java.sql.SQLException
        -
        - Retrieves the type of this ResultSet object. - The type is determined by the Statement object - that created the result set. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB accurately - reports the actual runtime scrollability of this result set instance. -

        -
        -
        -
        Specified by:
        -
        getType in interface java.sql.ResultSet
        -
        Returns:
        -
        ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, - or ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getConcurrency

        -
        public int getConcurrency()
        -                   throws java.sql.SQLException
        -
        - Retrieves the concurrency mode of this ResultSet object. - The concurrency used is determined by the - Statement object that created the result set. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports updatable result sets and accurately reports the actual - runtime concurrency of this result set instance. -

        -
        -
        -
        Specified by:
        -
        getConcurrency in interface java.sql.ResultSet
        -
        Returns:
        -
        the concurrency type, either - ResultSet.CONCUR_READ_ONLY - or ResultSet.CONCUR_UPDATABLE
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        rowUpdated

        -
        public boolean rowUpdated()
        -                   throws java.sql.SQLException
        -
        - Retrieves whether the current row has been updated. The value returned - depends on whether or not the result set can detect updates. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports updatable result sets and accurately reports the actual - value. -

        -
        -
        -
        Specified by:
        -
        rowUpdated in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the current row is detected to - have been visibly updated by the owner or another; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        JDBCDatabaseMetaData.updatesAreDetected(int)
        -
        -
      • -
      - - - -
        -
      • -

        rowInserted

        -
        public boolean rowInserted()
        -                    throws java.sql.SQLException
        -
        - Retrieves whether the current row has had an insertion. - The value returned depends on whether or not this - ResultSet object can detect visible inserts. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports updatable result sets and accurately reports the actual - value. -

        -
        -
        -
        Specified by:
        -
        rowInserted in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the current row is detected to - have been inserted; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        JDBCDatabaseMetaData.insertsAreDetected(int)
        -
        -
      • -
      - - - -
        -
      • -

        rowDeleted

        -
        public boolean rowDeleted()
        -                   throws java.sql.SQLException
        -
        - Retrieves whether a row has been deleted. A deleted row may leave - a visible "hole" in a result set. This method can be used to - detect holes in a result set. The value returned depends on whether - or not this ResultSet object can detect deletions. -

        - (JDBC4 Clarification:)

        - Note: Support for the rowDeleted method is optional with a result set - concurrency of CONCUR_READ_ONLY - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports updatable result sets and accurately reports the actual - value. -

        -
        -
        -
        Specified by:
        -
        rowDeleted in interface java.sql.ResultSet
        -
        Returns:
        -
        true if the current row is detected to - have been deleted by the owner or another; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        JDBCDatabaseMetaData.deletesAreDetected(int)
        -
        -
      • -
      - - - -
        -
      • -

        updateNull

        -
        public void updateNull​(int columnIndex)
        -                throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Updates the designated column with a null value. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow - or insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateNull in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBoolean

        -
        public void updateBoolean​(int columnIndex,
        -                          boolean x)
        -                   throws java.sql.SQLException
        -
        - Updates the designated column with a boolean value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBoolean in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateByte

        -
        public void updateByte​(int columnIndex,
        -                       byte x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a byte value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateByte in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateShort

        -
        public void updateShort​(int columnIndex,
        -                        short x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a short value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateShort in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateInt

        -
        public void updateInt​(int columnIndex,
        -                      int x)
        -               throws java.sql.SQLException
        -
        - Updates the designated column with an int value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateInt in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateLong

        -
        public void updateLong​(int columnIndex,
        -                       long x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a long value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateLong in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateFloat

        -
        public void updateFloat​(int columnIndex,
        -                        float x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a float value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateFloat in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateDouble

        -
        public void updateDouble​(int columnIndex,
        -                         double x)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with a double value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateDouble in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBigDecimal

        -
        public void updateBigDecimal​(int columnIndex,
        -                             java.math.BigDecimal x)
        -                      throws java.sql.SQLException
        -
        - Updates the designated column with a java.math.BigDecimal - value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBigDecimal in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateString

        -
        public void updateString​(int columnIndex,
        -                         java.lang.String x)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with a String value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBytes

        -
        public void updateBytes​(int columnIndex,
        -                        byte[] x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a byte array value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBytes in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateDate

        -
        public void updateDate​(int columnIndex,
        -                       java.sql.Date x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Date value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateDate in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateTime

        -
        public void updateTime​(int columnIndex,
        -                       java.sql.Time x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Time value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateTime in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateTimestamp

        -
        public void updateTimestamp​(int columnIndex,
        -                            java.sql.Timestamp x)
        -                     throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Timestamp - value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateTimestamp in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateAsciiStream

        -
        public void updateAsciiStream​(int columnIndex,
        -                              java.io.InputStream x,
        -                              int length)
        -                       throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Updates the designated column with an ascii stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        Specified by:
        -
        updateAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBinaryStream

        -
        public void updateBinaryStream​(int columnIndex,
        -                               java.io.InputStream x,
        -                               int length)
        -                        throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Updates the designated column with a binary stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateCharacterStream

        -
        public void updateCharacterStream​(int columnIndex,
        -                                  java.io.Reader x,
        -                                  int length)
        -                           throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Updates the designated column with a character stream value, which will have - the specified number of (CHECKME: characters?) bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(int columnIndex,
        -                         java.lang.Object x,
        -                         int scaleOrLength)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with an Object value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. -

        - (JDBC clarification:) - If the second argument is an InputStream then the stream must contain - the number of bytes specified by scaleOrLength. If the second argument is a - Reader then the reader must contain the number of characters specified - by scaleOrLength. If these conditions are not true the driver will generate a - SQLException when the statement is executed. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        scaleOrLength - for an object of java.math.BigDecimal , - this is the number of digits after the decimal point. For - Java Object types InputStream and Reader, - this is the length - of the data in the stream or reader. For all other types, - this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(int columnIndex,
        -                         java.lang.Object x)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with an Object value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateNull

        -
        public void updateNull​(java.lang.String columnLabel)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a null value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateNull in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBoolean

        -
        public void updateBoolean​(java.lang.String columnLabel,
        -                          boolean x)
        -                   throws java.sql.SQLException
        -
        - Updates the designated column with a boolean value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBoolean in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateByte

        -
        public void updateByte​(java.lang.String columnLabel,
        -                       byte x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a byte value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateByte in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateShort

        -
        public void updateShort​(java.lang.String columnLabel,
        -                        short x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a short value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateShort in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateInt

        -
        public void updateInt​(java.lang.String columnLabel,
        -                      int x)
        -               throws java.sql.SQLException
        -
        - Updates the designated column with an int value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateInt in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateLong

        -
        public void updateLong​(java.lang.String columnLabel,
        -                       long x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a long value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateLong in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateFloat

        -
        public void updateFloat​(java.lang.String columnLabel,
        -                        float x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a float value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateFloat in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateDouble

        -
        public void updateDouble​(java.lang.String columnLabel,
        -                         double x)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with a double value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateDouble in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBigDecimal

        -
        public void updateBigDecimal​(java.lang.String columnLabel,
        -                             java.math.BigDecimal x)
        -                      throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.BigDecimal - value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBigDecimal in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateString

        -
        public void updateString​(java.lang.String columnLabel,
        -                         java.lang.String x)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with a String value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBytes

        -
        public void updateBytes​(java.lang.String columnLabel,
        -                        byte[] x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a byte array value. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow - or insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBytes in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateDate

        -
        public void updateDate​(java.lang.String columnLabel,
        -                       java.sql.Date x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Date value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateDate in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateTime

        -
        public void updateTime​(java.lang.String columnLabel,
        -                       java.sql.Time x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Time value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateTime in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateTimestamp

        -
        public void updateTimestamp​(java.lang.String columnLabel,
        -                            java.sql.Timestamp x)
        -                     throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Timestamp - value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateTimestamp in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateAsciiStream

        -
        public void updateAsciiStream​(java.lang.String columnLabel,
        -                              java.io.InputStream x,
        -                              int length)
        -                       throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Updates the designated column with an ascii stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateBinaryStream

        -
        public void updateBinaryStream​(java.lang.String columnLabel,
        -                               java.io.InputStream x,
        -                               int length)
        -                        throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Updates the designated column with a binary stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateCharacterStream

        -
        public void updateCharacterStream​(java.lang.String columnLabel,
        -                                  java.io.Reader reader,
        -                                  int length)
        -                           throws java.sql.SQLException
        -
        - (JDBC4 clarification) - Updates the designated column with a character stream value, which will have - the specified number of (CHECKME: characters?) bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        reader - the java.io.Reader object containing - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(java.lang.String columnLabel,
        -                         java.lang.Object x,
        -                         int scaleOrLength)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with an Object value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. -

        - (JDBC4 Clarification:) - If the second argument is an InputStream then the stream must contain - the number of bytes specified by scaleOrLength. If the second argument is a - Reader then the reader must contain the number of characters specified - by scaleOrLength. If these conditions are not true the driver will generate a - SQLException when the statement is executed. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        scaleOrLength - for an object of java.math.BigDecimal , - this is the number of digits after the decimal point. For - Java Object types InputStream and Reader, - this is the length - of the data in the stream or reader. For all other types, - this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(java.lang.String columnLabel,
        -                         java.lang.Object x)
        -                  throws java.sql.SQLException
        -
        - Updates the designated column with an Object value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        insertRow

        -
        public void insertRow()
        -               throws java.sql.SQLException
        -
        - Inserts the contents of the insert row into this - ResultSet object and into the database. - The cursor must be on the insert row when this method is called. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        insertRow in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY, - this method is called on a closed result set, - if this method is called when the cursor is not on the insert row, - or if not all of non-nullable columns in - the insert row have been given a non-null value
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        updateRow

        -
        public void updateRow()
        -               throws java.sql.SQLException
        -
        - Updates the underlying database with the new contents of the - current row of this ResultSet object. - This method cannot be called when the cursor is on the insert row. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - - After updating any values in the current row, it is not possible to - move the cursor position without calling this method, or alternatively - calling cancelRowUpdates() to abandon the row update. -

        -
        -
        -
        Specified by:
        -
        updateRow in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY; - this method is called on a closed result set or - if this method is called when the cursor is on the insert row
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        deleteRow

        -
        public void deleteRow()
        -               throws java.sql.SQLException
        -
        - Deletes the current row from this ResultSet object - and from the underlying database. This method cannot be called when - the cursor is on the insert row. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        - - After a successful call to this method, the row is deleted. -

        -
        -
        -
        Specified by:
        -
        deleteRow in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY; - this method is called on a closed result set - or if this method is called when the cursor is on the insert row
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        refreshRow

        -
        public void refreshRow()
        -                throws java.sql.SQLException
        -
        - Refreshes the current row with its most recent value in - the database. This method cannot be called when - the cursor is on the insert row. - -

        The refreshRow method provides a way for an - application to - explicitly tell the JDBC driver to refetch a row(s) from the - database. An application may want to call refreshRow when - caching or prefetching is being done by the JDBC driver to - fetch the latest value of a row from the database. The JDBC driver - may actually refresh multiple rows at once if the fetch size is - greater than one. - -

        All values are refetched subject to the transaction isolation - level and cursor sensitivity. If refreshRow is called after - calling an updater method, but before calling - the method updateRow, then the - updates made to the row are lost. Calling the method - refreshRow frequently will likely slow performance. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        refreshRow in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs; this method is called on a closed result set; - the result set type is TYPE_FORWARD_ONLY or if this - method is called when the cursor is on the insert row
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method or this method is not supported for the specified result - set type and result set concurrency.
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        cancelRowUpdates

        -
        public void cancelRowUpdates()
        -                      throws java.sql.SQLException
        -
        - Cancels the updates made to the current row in this - ResultSet object. - This method may be called after calling an - updater method(s) and before calling - the method updateRow to roll back - the updates made to a row. If no updates have been made or - updateRow has already been called, this method has no - effect. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        cancelRowUpdates in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error - occurs; this method is called on a closed result set; - the result set concurrency is CONCUR_READ_ONLY - or if this method is called when the cursor is - on the insert row
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        moveToInsertRow

        -
        public void moveToInsertRow()
        -                     throws java.sql.SQLException
        -
        - Moves the cursor to the insert row. The current cursor position is - remembered while the cursor is positioned on the insert row. - - The insert row is a special row associated with an updatable - result set. It is essentially a buffer where a new row may - be constructed by calling the updater methods prior to - inserting the row into the result set. - - Only the updater, getter, - and insertRow methods may be - called when the cursor is on the insert row. All of the columns in - a result set must be given a value each time this method is - called before calling insertRow. - An updater method must be called before a - getter method can be called on a column value. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        moveToInsertRow in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs; this - method is called on a closed result set - or the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        moveToCurrentRow

        -
        public void moveToCurrentRow()
        -                      throws java.sql.SQLException
        -
        - Moves the cursor to the remembered cursor position, usually the - current row. This method has no effect if the cursor is not on - the insert row. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature.

        -

        -
        -
        -
        Specified by:
        -
        moveToCurrentRow in interface java.sql.ResultSet
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - method is called on a closed result set - or the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getStatement

        -
        public java.sql.Statement getStatement()
        -                                throws java.sql.SQLException
        -
        - Retrieves the Statement object that produced this - ResultSet object. - If the result set was generated some other way, such as by a - DatabaseMetaData method, this method may return - null. -
        -
        -
        Specified by:
        -
        getStatement in interface java.sql.ResultSet
        -
        Returns:
        -
        the Statement object that produced - this ResultSet object or null - if the result set was produced some other way
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(int columnIndex,
        -                                  java.util.Map map)
        -                           throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as an Object - in the Java programming language. - If the value is an SQL NULL, - the driver returns a Java null. - This method uses the given Map object - for the custom mapping of the - SQL structured or distinct type that is being retrieved. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature, but ignores the map.

        -

        -
        -
        -
        Specified by:
        -
        getObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        map - a java.util.Map object that contains the mapping - from SQL type names to classes in the Java programming language
        -
        Returns:
        -
        an Object in the Java programming language - representing the SQL value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getRef

        -
        public java.sql.Ref getRef​(int columnIndex)
        -                    throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a Ref object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support this feature; this method always - throws an SQLException stating that the operation is not - supported. -

        -
        -
        -
        Specified by:
        -
        getRef in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a Ref object representing an SQL REF - value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBlob

        -
        public java.sql.Blob getBlob​(int columnIndex)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a Blob object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for objects of type BLOB and BINARY. - The Blob returned for BINARY objects is a memory object. The Blob - return for BLOB objects is not held entirely in memory. Its contents are - fetched from the database when its getXXX() methods are called.

        -

        -
        -
        -
        Specified by:
        -
        getBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a Blob object representing the SQL - BLOB value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getClob

        -
        public java.sql.Clob getClob​(int columnIndex)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a Clob object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for objects of type CLOB and - the variations of CHAR. - The Clob returned for CHAR objects is a memory object. The Clob - return for CLOB objects is not held entirely in memory. Its contents are - fetched from the database when its getXXX() methods are called.

        -

        -
        -
        -
        Specified by:
        -
        getClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a Clob object representing the SQL - CLOB value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.sql.Array getArray​(int columnIndex)
        -                        throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as an Array object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - From version 2.0, HSQLDB supports array types. - -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        an Array object representing the SQL - ARRAY value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public java.lang.Object getObject​(java.lang.String columnLabel,
        -                                  java.util.Map map)
        -                           throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as an Object - in the Java programming language. - If the value is an SQL NULL, - the driver returns a Java null. - This method uses the specified Map object for - custom mapping if appropriate. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports this feature. But the Map parameter is ignored.

        - -

        -
        -
        -
        Specified by:
        -
        getObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        map - a java.util.Map object that contains the mapping - from SQL type names to classes in the Java programming language
        -
        Returns:
        -
        an Object representing the SQL value in the - specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getRef

        -
        public java.sql.Ref getRef​(java.lang.String columnLabel)
        -                    throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a Ref object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - Including 2.0, HSQLDB does not support reference types; this method - always throws an SQLException stating that the operation - is not supported. -

        -
        -
        -
        Specified by:
        -
        getRef in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a Ref object representing the SQL REF - value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getBlob

        -
        public java.sql.Blob getBlob​(java.lang.String columnLabel)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a Blob object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for objects of type BLOB and BINARY. - The Blob returned for BINARY objects is a memory object. The Blob - return for BLOB objects is not held entirely in memory. Its contents are - fetched from the database when its getXXX() methods are called.

        - -

        -
        -
        -
        Specified by:
        -
        getBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a Blob object representing the SQL BLOB - value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getClob

        -
        public java.sql.Clob getClob​(java.lang.String columnLabel)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a Clob object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for objects of type CLOB and - the variations of CHAR. - The Clob returned for CHAR objects is a memory object. The Clob - return for CLOB objects is not held entirely in memory. Its contents are - fetched from the database when its getXXX() methods are called.

        -

        -
        -
        -
        Specified by:
        -
        getClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        a Clob object representing the SQL CLOB - value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public java.sql.Array getArray​(java.lang.String columnLabel)
        -                        throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as an Array object - in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - From version 2.0, HSQLDB supports array types. -

        -
        -
        -
        Specified by:
        -
        getArray in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        Returns:
        -
        an Array object representing the SQL ARRAY value in - the specified column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(int columnIndex,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Date object - in the Java programming language. - This method uses the given calendar to construct an appropriate millisecond - value for the date if the underlying database does not store - timezone information. -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        cal - the java.util.Calendar object - to use in constructing the date
        -
        Returns:
        -
        the column value as a java.sql.Date object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getDate

        -
        public java.sql.Date getDate​(java.lang.String columnLabel,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Date object - in the Java programming language. - This method uses the given calendar to construct an appropriate millisecond - value for the date if the underlying database does not store - timezone information. -
        -
        -
        Specified by:
        -
        getDate in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        cal - the java.util.Calendar object - to use in constructing the date
        -
        Returns:
        -
        the column value as a java.sql.Date object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(int columnIndex,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Time - object in the Java programming language. - This method uses the given calendar to construct an appropriate millisecond - value for the time if the underlying database does not store - timezone information. - - -
        -

        HSQLDB-Specific Information:

        - - The JDBC specification for this method is vague. HSQLDB interprets the - specification as follows: - -

          -
        1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - of the returned java.sql.Time object is the UTC of the SQL value without - modification. In other words, the Calendar object is not used.
        2. -
        3. If the SQL type of the column is WITHOUT TIME ZONE, then the UTC - value of the returned java.sql.Time is correct for the given Calendar's - time zone.
        4. -
        5. If the cal argument is null, it it ignored and the method returns - the same Object as the method without the Calendar parameter.
        6. -
        -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        cal - the java.util.Calendar object - to use in constructing the time
        -
        Returns:
        -
        the column value as a java.sql.Time object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getTime

        -
        public java.sql.Time getTime​(java.lang.String columnLabel,
        -                             java.util.Calendar cal)
        -                      throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Time object - in the Java programming language. - This method uses the given calendar to construct an appropriate millisecond - value for the time if the underlying database does not store - timezone information. - - -
        -

        HSQLDB-Specific Information:

        - - The JDBC specification for this method is vague. HSQLDB interprets the - specification as follows: - -

          -
        1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - of the returned java.sql.Time object is the UTC of the SQL value without - modification. In other words, the Calendar object is not used.
        2. -
        3. If the SQL type of the column is WITHOUT TIME ZONE, then the - UTC value of the returned java.sql.Time will represent the correct - time for the time zone (including daylight saving time) of the given - Calendar.
        4. -
        5. If the cal argument is null, it it ignored and the method returns - the same Object as the method without the Calendar parameter.
        6. -
        -
        -
        -
        Specified by:
        -
        getTime in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        cal - the java.util.Calendar object - to use in constructing the time
        -
        Returns:
        -
        the column value as a java.sql.Time object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(int columnIndex,
        -                                       java.util.Calendar cal)
        -                                throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Timestamp object - in the Java programming language. - This method uses the given calendar to construct an appropriate millisecond - value for the timestamp if the underlying database does not store - timezone information. - - -
        -

        HSQLDB-Specific Information:

        - - The JDBC specification for this method is vague. HSQLDB interprets the - specification as follows: - -

          -
        1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - of the returned java.sql.Timestamp object is the UTC of the SQL value - without modification. In other words, the Calendar object is not used. -
        2. -
        3. If the SQL type of the column is WITHOUT TIME ZONE, then the - UTC value of the returned java.sql.Timestamp will represent the correct - timestamp for the time zone (including daylight saving time) of the given - Calendar object.
        4. -
        5. In this case, if the cal argument is null, then the default Calendar - of the JVM is used, which results in the same Object as one returned by the - getTimestamp() methods without the Calendar parameter.
        6. -
        -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        cal - the java.util.Calendar object - to use in constructing the timestamp
        -
        Returns:
        -
        the column value as a java.sql.Timestamp object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getTimestamp

        -
        public java.sql.Timestamp getTimestamp​(java.lang.String columnLabel,
        -                                       java.util.Calendar cal)
        -                                throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.sql.Timestamp object - in the Java programming language. - This method uses the given calendar to construct an appropriate millisecond - value for the timestamp if the underlying database does not store - timezone information. - - -
        -

        HSQLDB-Specific Information:

        - - The JDBC specification for this method is vague. HSQLDB interprets the - specification as follows: - -

          -
        1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - of the returned java.sql.Timestamp object is the UTC of the SQL value - without modification. In other words, the Calendar object is not used. -
        2. -
        3. If the SQL type of the column is WITHOUT TIME ZONE, then the UTC - value of the returned java.sql.Timestamp is correct for the given - Calendar object.
        4. -
        5. If the cal argument is null, it it ignored and the method returns - the same Object as the method without the Calendar parameter.
        6. -
        -
        -
        -
        Specified by:
        -
        getTimestamp in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        cal - the java.util.Calendar object - to use in constructing the date
        -
        Returns:
        -
        the column value as a java.sql.Timestamp object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.net.URL getURL​(int columnIndex)
        -                    throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.net.URL - object in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support the datalink type; this method - always throws an SQLException stating that the operation is - not supported. -

        -
        -
        -
        Specified by:
        -
        getURL in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the index of the column 1 is the first, 2 is the second,...
        -
        Returns:
        -
        the column value as a java.net.URL object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs; this method - is called on a closed result set or if a URL is malformed
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getURL

        -
        public java.net.URL getURL​(java.lang.String columnLabel)
        -                    throws java.sql.SQLException
        -
        - Retrieves the value of the designated column in the current row - of this ResultSet object as a java.net.URL - object in the Java programming language. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support the datalink type; this method - always throws an SQLException stating that the operation is - not supported. -

        -
        -
        -
        Specified by:
        -
        getURL in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        Returns:
        -
        the column value as a java.net.URL object; - if the value is SQL NULL, - the value returned is null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occur; this method - is called on a closed result set or if a URL is malformed
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateRef

        -
        public void updateRef​(int columnIndex,
        -                      java.sql.Ref x)
        -               throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Ref value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support reference types; this method - always throws an SQLException stating that the operation is - not supported. -

        -
        -
        -
        Specified by:
        -
        updateRef in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateRef

        -
        public void updateRef​(java.lang.String columnLabel,
        -                      java.sql.Ref x)
        -               throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Ref value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support reference types; this method - always throws an SQLException stating that the operation is - not supported. -

        -
        -
        -
        Specified by:
        -
        updateRef in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateBlob

        -
        public void updateBlob​(int columnIndex,
        -                       java.sql.Blob x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Blob value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for columns of type BLOB. -

        -
        -
        -
        Specified by:
        -
        updateBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateBlob

        -
        public void updateBlob​(java.lang.String columnLabel,
        -                       java.sql.Blob x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Blob value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for columns of type BLOB. -

        -
        -
        -
        Specified by:
        -
        updateBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateClob

        -
        public void updateClob​(int columnIndex,
        -                       java.sql.Clob x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Clob value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for columns of type CLOB.

        -

        -
        -
        -
        Specified by:
        -
        updateClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateClob

        -
        public void updateClob​(java.lang.String columnLabel,
        -                       java.sql.Clob x)
        -                throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Clob value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 supports this feature for columns of type CLOB.

        -

        -
        -
        -
        Specified by:
        -
        updateClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateArray

        -
        public void updateArray​(int columnIndex,
        -                        java.sql.Array x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Array value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support array types; this method always - throws an SQLException stating that the operation is not - supported. -

        -
        -
        -
        Specified by:
        -
        updateArray in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        updateArray

        -
        public void updateArray​(java.lang.String columnLabel,
        -                        java.sql.Array x)
        -                 throws java.sql.SQLException
        -
        - Updates the designated column with a java.sql.Array value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support array types; this method always - throws an SQLException stating that the operation is not - supported. -

        -
        -
        -
        Specified by:
        -
        updateArray in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7.0
        -
        -
      • -
      - - - -
        -
      • -

        getRowId

        -
        public java.sql.RowId getRowId​(int columnIndex)
        -                        throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row of this - ResultSet object as a java.sql.RowId object in the Java - programming language.
        -
        -
        Specified by:
        -
        getRowId in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second 2, ...
        -
        Returns:
        -
        the column value; if the value is a SQL NULL the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getRowId

        -
        public java.sql.RowId getRowId​(java.lang.String columnLabel)
        -                        throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row of this - ResultSet object as a java.sql.RowId object in the Java - programming language. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support the RowId type; this method always - throws an SQLException stating that the operation is not - supported. -

        -
        -
        -
        Specified by:
        -
        getRowId in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        Returns:
        -
        the column value ; if the value is a SQL NULL the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateRowId

        -
        public void updateRowId​(int columnIndex,
        -                        java.sql.RowId x)
        -                 throws java.sql.SQLException
        -
        Updates the designated column with a RowId value. The updater - methods are used to update column values in the current row or the insert - row. The updater methods do not update the underlying database; instead - the updateRow or insertRow methods are called - to update the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support the RowId type; this method always - throws an SQLException stating that the operation is not - supported. -

        -
        -
        -
        Specified by:
        -
        updateRowId in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second 2, ...
        -
        x - the column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateRowId

        -
        public void updateRowId​(java.lang.String columnLabel,
        -                        java.sql.RowId x)
        -                 throws java.sql.SQLException
        -
        Updates the designated column with a RowId value. The updater - methods are used to update column values in the current row or the insert - row. The updater methods do not update the underlying database; instead - the updateRow or insertRow methods are called - to update the database. - - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB does not support the RowId type; this method always - throws an SQLException stating that the operation is not - supported. -

        -
        -
        -
        Specified by:
        -
        updateRowId in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        x - the column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getHoldability

        -
        public int getHoldability()
        -                   throws java.sql.SQLException
        -
        Retrieves the holdability of this ResultSet object
        -
        -
        Specified by:
        -
        getHoldability in interface java.sql.ResultSet
        -
        Returns:
        -
        either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -                 throws java.sql.SQLException
        -
        Retrieves whether this ResultSet object has been closed. - A ResultSet is closed if the - method close has been called on it, or if it is automatically closed.
        -
        -
        Specified by:
        -
        isClosed in interface java.sql.ResultSet
        -
        Returns:
        -
        true if this ResultSet object is closed; false if it is still open
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNString

        -
        public void updateNString​(int columnIndex,
        -                          java.lang.String nString)
        -                   throws java.sql.SQLException
        -
        Updates the designated column with a String value. - It is intended for use when updating NCHAR,NVARCHAR - and LONGNVARCHAR columns. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateNString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second 2, ...
        -
        nString - the value for the column to be updated
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set, - the result set concurrency is CONCUR_READ_ONLY - or if a database access error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNString

        -
        public void updateNString​(java.lang.String columnLabel,
        -                          java.lang.String nString)
        -                   throws java.sql.SQLException
        -
        Updates the designated column with a String value. - It is intended for use when updating NCHAR,NVARCHAR - and LONGNVARCHAR columns. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateNString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        nString - the value for the column to be updated
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set; - the result set concurrency is CONCUR_READ_ONLY - or if a database access error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNClob

        -
        public void updateNClob​(int columnIndex,
        -                        java.sql.NClob nClob)
        -                 throws java.sql.SQLException
        -
        Updates the designated column with a java.sql.NClob value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second 2, ...
        -
        nClob - the value for the column to be updated
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set, - if a database access error occurs or - the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNClob

        -
        public void updateNClob​(java.lang.String columnLabel,
        -                        java.sql.NClob nClob)
        -                 throws java.sql.SQLException
        -
        Updates the designated column with a java.sql.NClob value. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        nClob - the value for the column to be updated
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set; - if a database access error occurs or - the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNClob

        -
        public java.sql.NClob getNClob​(int columnIndex)
        -                        throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row - of this ResultSet object as a NClob object - in the Java programming language.
        -
        -
        Specified by:
        -
        getNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a NClob object representing the SQL - NCLOB value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set - or if a database access error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNClob

        -
        public java.sql.NClob getNClob​(java.lang.String columnLabel)
        -                        throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row - of this ResultSet object as a NClob object - in the Java programming language.
        -
        -
        Specified by:
        -
        getNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        Returns:
        -
        a NClob object representing the SQL NCLOB - value in the specified column
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set - or if a database access error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getSQLXML

        -
        public java.sql.SQLXML getSQLXML​(int columnIndex)
        -                          throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row of - this ResultSet as a - java.sql.SQLXML object in the Java programming language.
        -
        -
        Specified by:
        -
        getSQLXML in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a SQLXML object that maps an SQL XML value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getSQLXML

        -
        public java.sql.SQLXML getSQLXML​(java.lang.String columnLabel)
        -                          throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row of - this ResultSet as a - java.sql.SQLXML object in the Java programming language.
        -
        -
        Specified by:
        -
        getSQLXML in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        Returns:
        -
        a SQLXML object that maps an SQL XML value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateSQLXML

        -
        public void updateSQLXML​(int columnIndex,
        -                         java.sql.SQLXML xmlObject)
        -                  throws java.sql.SQLException
        -
        Updates the designated column with a java.sql.SQLXML value. - The updater - methods are used to update column values in the current row or the insert - row. The updater methods do not update the underlying database; instead - the updateRow or insertRow methods are called - to update the database. -

        -
        -
        Specified by:
        -
        updateSQLXML in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second 2, ...
        -
        xmlObject - the value for the column to be updated
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this method - is called on a closed result set, - the java.xml.transform.Result, - Writer or OutputStream has not been closed - for the SQLXML object, - if there is an error processing the XML value or - the result set concurrency is CONCUR_READ_ONLY. The getCause method - of the exception may provide a more detailed exception, for example, if the - stream does not contain valid XML.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateSQLXML

        -
        public void updateSQLXML​(java.lang.String columnLabel,
        -                         java.sql.SQLXML xmlObject)
        -                  throws java.sql.SQLException
        -
        Updates the designated column with a java.sql.SQLXML value. - The updater - methods are used to update column values in the current row or the insert - row. The updater methods do not update the underlying database; instead - the updateRow or insertRow methods are called - to update the database. -

        -
        -
        Specified by:
        -
        updateSQLXML in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        xmlObject - the column value
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this method - is called on a closed result set, - the java.xml.transform.Result, - Writer or OutputStream has not been closed - for the SQLXML object, - if there is an error processing the XML value or - the result set concurrency is CONCUR_READ_ONLY. The getCause method - of the exception may provide a more detailed exception, for example, if the - stream does not contain valid XML.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNString

        -
        public java.lang.String getNString​(int columnIndex)
        -                            throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language. - It is intended for use when - accessing NCHAR,NVARCHAR - and LONGNVARCHAR columns.
        -
        -
        Specified by:
        -
        getNString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNString

        -
        public java.lang.String getNString​(java.lang.String columnLabel)
        -                            throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row - of this ResultSet object as - a String in the Java programming language. - It is intended for use when - accessing NCHAR,NVARCHAR - and LONGNVARCHAR columns.
        -
        -
        Specified by:
        -
        getNString in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        Returns:
        -
        the column value; if the value is SQL NULL, the - value returned is null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNCharacterStream

        -
        public java.io.Reader getNCharacterStream​(int columnIndex)
        -                                   throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object. - It is intended for use when - accessing NCHAR,NVARCHAR - and LONGNVARCHAR columns.
        -
        -
        Specified by:
        -
        getNCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        a java.io.Reader object that contains the column - value; if the value is SQL NULL, the value returned is - null in the Java programming language.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getNCharacterStream

        -
        public java.io.Reader getNCharacterStream​(java.lang.String columnLabel)
        -                                   throws java.sql.SQLException
        -
        Retrieves the value of the designated column in the current row - of this ResultSet object as a - java.io.Reader object. - It is intended for use when - accessing NCHAR,NVARCHAR - and LONGNVARCHAR columns.
        -
        -
        Specified by:
        -
        getNCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        Returns:
        -
        a java.io.Reader object that contains the column - value; if the value is SQL NULL, the value returned is - null in the Java programming language
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNCharacterStream

        -
        public void updateNCharacterStream​(int columnIndex,
        -                                   java.io.Reader x,
        -                                   long length)
        -                            throws java.sql.SQLException
        -
        Updates the designated column with a character stream value, which will have - the specified number of bytes. The - driver does the necessary conversion from Java character format to - the national character set in the database. - It is intended for use when - updating NCHAR,NVARCHAR - and LONGNVARCHAR columns. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateNCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNCharacterStream

        -
        public void updateNCharacterStream​(java.lang.String columnLabel,
        -                                   java.io.Reader reader,
        -                                   long length)
        -                            throws java.sql.SQLException
        -
        Updates the designated column with a character stream value, which will have - the specified number of bytes. The - driver does the necessary conversion from Java character format to - the national character set in the database. - It is intended for use when - updating NCHAR,NVARCHAR - and LONGNVARCHAR columns. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateNCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        reader - the java.io.Reader object containing - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateAsciiStream

        -
        public void updateAsciiStream​(int columnIndex,
        -                              java.io.InputStream x,
        -                              long length)
        -                       throws java.sql.SQLException
        -
        Updates the designated column with an ascii stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateBinaryStream

        -
        public void updateBinaryStream​(int columnIndex,
        -                               java.io.InputStream x,
        -                               long length)
        -                        throws java.sql.SQLException
        -
        Updates the designated column with a binary stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateCharacterStream

        -
        public void updateCharacterStream​(int columnIndex,
        -                                  java.io.Reader x,
        -                                  long length)
        -                           throws java.sql.SQLException
        -
        Updates the designated column with a character stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateAsciiStream

        -
        public void updateAsciiStream​(java.lang.String columnLabel,
        -                              java.io.InputStream x,
        -                              long length)
        -                       throws java.sql.SQLException
        -
        Updates the designated column with an ascii stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateBinaryStream

        -
        public void updateBinaryStream​(java.lang.String columnLabel,
        -                               java.io.InputStream x,
        -                               long length)
        -                        throws java.sql.SQLException
        -
        Updates the designated column with a binary stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        x - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateCharacterStream

        -
        public void updateCharacterStream​(java.lang.String columnLabel,
        -                                  java.io.Reader reader,
        -                                  long length)
        -                           throws java.sql.SQLException
        -
        Updates the designated column with a character stream value, which will have - the specified number of bytes. - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.
        -
        -
        Specified by:
        -
        updateCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        reader - the java.io.Reader object containing - the new column value
        -
        length - the length of the stream
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateBlob

        -
        public void updateBlob​(int columnIndex,
        -                       java.io.InputStream inputStream,
        -                       long length)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given input stream, which - will have the specified number of bytes. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.

        -
        -
        Specified by:
        -
        updateBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        length - the number of bytes in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateBlob

        -
        public void updateBlob​(java.lang.String columnLabel,
        -                       java.io.InputStream inputStream,
        -                       long length)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given input stream, which - will have the specified number of bytes. - When a very large ASCII value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.InputStream. Data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from ASCII to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.

        -
        -
        Specified by:
        -
        updateBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        length - the number of bytes in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateClob

        -
        public void updateClob​(int columnIndex,
        -                       java.io.Reader reader,
        -                       long length)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.

        -
        -
        Specified by:
        -
        updateClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateClob

        -
        public void updateClob​(java.lang.String columnLabel,
        -                       java.io.Reader reader,
        -                       long length)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.

        -
        -
        Specified by:
        -
        updateClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNClob

        -
        public void updateNClob​(int columnIndex,
        -                        java.io.Reader reader,
        -                        long length)
        -                 throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.

        -
        -
        Specified by:
        -
        updateNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set, - if a database access error occurs or - the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNClob

        -
        public void updateNClob​(java.lang.String columnLabel,
        -                        java.io.Reader reader,
        -                        long length)
        -                 throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - object, which is the given number of characters long. - When a very large UNICODE value is input to a LONGVARCHAR - parameter, it may be more practical to send it via a - java.io.Reader object. The data will be read from the stream - as needed until end-of-file is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        Note: This stream object can either be a standard - Java stream object or your own subclass that implements the - standard interface. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database.

        -
        -
        Specified by:
        -
        updateNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is the - name of the column
        -
        reader - An object that contains the data to set the parameter value to.
        -
        length - the number of characters in the parameter data.
        -
        Throws:
        -
        java.sql.SQLException - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set; - if a database access error occurs or - the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        updateNCharacterStream

        -
        public void updateNCharacterStream​(int columnIndex,
        -                                   java.io.Reader reader)
        -                            throws java.sql.SQLException
        -
        Updates the designated column with a character stream value. - The data will be read from the stream - as needed until end-of-stream is reached. The - driver does the necessary conversion from Java character format to - the national character set in the database. - It is intended for use when - updating NCHAR,NVARCHAR - and LONGNVARCHAR columns. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateNCharacterStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateNCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        reader - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateNCharacterStream

        -
        public void updateNCharacterStream​(java.lang.String columnLabel,
        -                                   java.io.Reader reader)
        -                            throws java.sql.SQLException
        -
        Updates the designated column with a character stream value. - The data will be read from the stream - as needed until end-of-stream is reached. The - driver does the necessary conversion from Java character format to - the national character set in the database. - It is intended for use when - updating NCHAR,NVARCHAR - and LONGNVARCHAR columns. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateNCharacterStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateNCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        reader - the java.io.Reader object containing - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateAsciiStream

        -
        public void updateAsciiStream​(int columnIndex,
        -                              java.io.InputStream x)
        -                       throws java.sql.SQLException
        -
        Updates the designated column with an ascii stream value. - The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateAsciiStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateBinaryStream

        -
        public void updateBinaryStream​(int columnIndex,
        -                               java.io.InputStream x)
        -                        throws java.sql.SQLException
        -
        Updates the designated column with a binary stream value. - The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateBinaryStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateCharacterStream

        -
        public void updateCharacterStream​(int columnIndex,
        -                                  java.io.Reader x)
        -                           throws java.sql.SQLException
        -
        Updates the designated column with a character stream value. - The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateCharacterStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateAsciiStream

        -
        public void updateAsciiStream​(java.lang.String columnLabel,
        -                              java.io.InputStream x)
        -                       throws java.sql.SQLException
        -
        Updates the designated column with an ascii stream value. - The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateAsciiStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateAsciiStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateBinaryStream

        -
        public void updateBinaryStream​(java.lang.String columnLabel,
        -                               java.io.InputStream x)
        -                        throws java.sql.SQLException
        -
        Updates the designated column with a binary stream value. - The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateBinaryStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateBinaryStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        x - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateCharacterStream

        -
        public void updateCharacterStream​(java.lang.String columnLabel,
        -                                  java.io.Reader reader)
        -                           throws java.sql.SQLException
        -
        Updates the designated column with a character stream value. - The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateCharacterStream which takes a length parameter.

        -
        -
        Specified by:
        -
        updateCharacterStream in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        reader - the java.io.Reader object containing - the new column value
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateBlob

        -
        public void updateBlob​(int columnIndex,
        -                       java.io.InputStream inputStream)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given input stream. The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateBlob which takes a length parameter.

        -
        -
        Specified by:
        -
        updateBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateBlob

        -
        public void updateBlob​(java.lang.String columnLabel,
        -                       java.io.InputStream inputStream)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given input stream. The data will be read from the stream - as needed until end-of-stream is reached. -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateBlob which takes a length parameter.

        -
        -
        Specified by:
        -
        updateBlob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        inputStream - An object that contains the data to set the parameter - value to.
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateClob

        -
        public void updateClob​(int columnIndex,
        -                       java.io.Reader reader)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - object. - The data will be read from the stream - as needed until end-of-stream is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateClob which takes a length parameter.

        -
        -
        Specified by:
        -
        updateClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateClob

        -
        public void updateClob​(java.lang.String columnLabel,
        -                       java.io.Reader reader)
        -                throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - object. - The data will be read from the stream - as needed until end-of-stream is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateClob which takes a length parameter.

        -
        -
        Specified by:
        -
        updateClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateNClob

        -
        public void updateNClob​(int columnIndex,
        -                        java.io.Reader reader)
        -                 throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - - The data will be read from the stream - as needed until end-of-stream is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateNClob which takes a length parameter.

        -
        -
        Specified by:
        -
        updateNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second 2, ...
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set, - if a database access error occurs or - the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        updateNClob

        -
        public void updateNClob​(java.lang.String columnLabel,
        -                        java.io.Reader reader)
        -                 throws java.sql.SQLException
        -
        Updates the designated column using the given Reader - object. - The data will be read from the stream - as needed until end-of-stream is reached. The JDBC driver will - do any necessary conversion from UNICODE to the database char format. - -

        - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. - -

        Note: Consult your JDBC driver documentation to determine if - it might be more efficient to use a version of - updateNClob which takes a length parameter.

        -
        -
        Specified by:
        -
        updateNClob in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
        -
        reader - An object that contains the data to set the parameter value to.
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; if the driver does not support national - character sets; if the driver can detect that a data conversion - error could occur; this method is called on a closed result set; - if a database access error occurs or - the result set concurrency is CONCUR_READ_ONLY
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        1.6
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return the - the result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public <T> T getObject​(int columnIndex,
        -                       java.lang.Class<T> type)
        -                throws java.sql.SQLException
        -

        Retrieves the value of the designated column in the current row - of this ResultSet object and will convert from the - SQL type of the column to the requested Java data type, if the - conversion is supported. If the conversion is not - supported or null is specified for the type, a - SQLException is thrown. -

        - At a minimum, an implementation must support the conversions defined in - Appendix B, Table B-3 and conversion of appropriate user defined SQL - types to a Java type which implements SQLData, or Struct. - Additional conversions may be supported and are vendor defined.

        -
        -
        Specified by:
        -
        getObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        type - Class representing the Java data type to convert the designated - column to.
        -
        Returns:
        -
        an instance of type holding the column value
        -
        Throws:
        -
        java.sql.SQLException - if conversion is not supported, type is null or - another error occurs. The getCause() method of the - exception may provide a more detailed exception, for example, if - a conversion error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      - - - -
        -
      • -

        getObject

        -
        public <T> T getObject​(java.lang.String columnLabel,
        -                       java.lang.Class<T> type)
        -                throws java.sql.SQLException
        -

        Retrieves the value of the designated column in the current row - of this ResultSet object and will convert from the - SQL type of the column to the requested Java data type, if the - conversion is supported. If the conversion is not - supported or null is specified for the type, a - SQLException is thrown. -

        - At a minimum, an implementation must support the conversions defined in - Appendix B, Table B-3 and conversion of appropriate user defined SQL - types to a Java type which implements SQLData, or Struct. - Additional conversions may be supported and are vendor defined.

        -
        -
        Specified by:
        -
        getObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS clause. - If the SQL AS clause was not specified, then the label is the name - of the column
        -
        type - Class representing the Java data type to convert the designated - column to.
        -
        Returns:
        -
        an instance of type holding the column value
        -
        Throws:
        -
        java.sql.SQLException - if conversion is not supported, type is null or - another error occurs. The getCause() method of the - exception may provide a more detailed exception, for example, if - a conversion error occurs
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(int columnIndex,
        -                         java.lang.Object x,
        -                         java.sql.SQLType targetSqlType,
        -                         int scaleOrLength)
        -                  throws java.sql.SQLException
        -
        Updates the designated column with an Object value. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. -

        - If the second argument is an InputStream then the stream must contain - the number of bytes specified by scaleOrLength. If the second argument is a - Reader then the reader must contain the number of characters specified - by scaleOrLength. If these conditions are not true the driver will generate a - SQLException when the statement is executed. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        targetSqlType - the SQL type to be sent to the database
        -
        scaleOrLength - for an object of java.math.BigDecimal , - this is the number of digits after the decimal point. For - Java Object types InputStream and Reader, - this is the length - of the data in the stream or reader. For all other types, - this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not - support this method; if the JDBC driver does not support the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(java.lang.String columnLabel,
        -                         java.lang.Object x,
        -                         java.sql.SQLType targetSqlType,
        -                         int scaleOrLength)
        -                  throws java.sql.SQLException
        -
        Updates the designated column with an Object value. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. -

        - If the second argument is an InputStream then the stream must - contain number of bytes specified by scaleOrLength. If the second - argument is a Reader then the reader must contain the number - of characters specified by scaleOrLength. If these conditions are not - true the driver will generate a - SQLException when the statement is executed. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is - the name of the column
        -
        x - the new column value
        -
        targetSqlType - the SQL type to be sent to the database
        -
        scaleOrLength - for an object of java.math.BigDecimal , - this is the number of digits after the decimal point. For - Java Object types InputStream and Reader, - this is the length - of the data in the stream or reader. For all other types, - this value will be ignored.
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not - support this method; if the JDBC driver does not support the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(int columnIndex,
        -                         java.lang.Object x,
        -                         java.sql.SQLType targetSqlType)
        -                  throws java.sql.SQLException
        -
        Updates the designated column with an Object value. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnIndex - the first column is 1, the second is 2, ...
        -
        x - the new column value
        -
        targetSqlType - the SQL type to be sent to the database
        -
        Throws:
        -
        java.sql.SQLException - if the columnIndex is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not - support this method; if the JDBC driver does not support the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        updateObject

        -
        public void updateObject​(java.lang.String columnLabel,
        -                         java.lang.Object x,
        -                         java.sql.SQLType targetSqlType)
        -                  throws java.sql.SQLException
        -
        Updates the designated column with an Object value. - - The updater methods are used to update column values in the - current row or the insert row. The updater methods do not - update the underlying database; instead the updateRow or - insertRow methods are called to update the database. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        updateObject in interface java.sql.ResultSet
        -
        Parameters:
        -
        columnLabel - the label for the column specified with the SQL AS - clause. If the SQL AS clause was not specified, then the label is - the name of the column
        -
        x - the new column value
        -
        targetSqlType - the SQL type to be sent to the database
        -
        Throws:
        -
        java.sql.SQLException - if the columnLabel is not valid; - if a database access error occurs; - the result set concurrency is CONCUR_READ_ONLY - or this method is called on a closed result set
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not - support this method; if the JDBC driver does not support the specified targetSqlType
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        JDBCType, -SQLType
        -
        -
      • -
      - - - -
        -
      • -

        newJDBCResultSet

        -
        public static JDBCResultSet newJDBCResultSet​(org.hsqldb.result.Result r,
        -                                             org.hsqldb.result.ResultMetaData metaData)
        -
        Factory method returns a new JDBCResultSet object for - use with user defined functions that return a ResultSet object. - See org.hsqldb.jdbc.JDBCArrayBasic for usage example. -

        -
        -
        Parameters:
        -
        r - the internal result form that the new - JDBCResultSet represents
        -
        metaData - the connection properties
        -
        Returns:
        -
        ResultSet
        -
        -
      • -
      - - - -
        -
      • -

        newEmptyResultSet

        -
        public static JDBCResultSet newEmptyResultSet()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCResultSetMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCResultSetMetaData.html deleted file mode 100644 index 28432ccb..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCResultSetMetaData.html +++ /dev/null @@ -1,1384 +0,0 @@ - - - - - -JDBCResultSetMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCResultSetMetaData

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCResultSetMetaData
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.ResultSetMetaData, java.sql.Wrapper
    -
    -
    -
    public class JDBCResultSetMetaData
    -extends java.lang.Object
    -implements java.sql.ResultSetMetaData
    -
    - An object that can be used to get information about the types - and properties of the columns in a ResultSet object. - The following code fragment creates the ResultSet object rs, - creates the ResultSetMetaData object rsmd, and uses rsmd - to find out how many columns rs has and whether the first column in rs - can be used in a WHERE clause. -
    -
    -     ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
    -     ResultSetMetaData rsmd = rs.getMetaData();
    -     int numberOfColumns = rsmd.getColumnCount();
    -     boolean b = rsmd.isSearchable(1);
    -
    - 
    - - - -
    -

    HSQLDB-Specific Information:

    - - HSQLDB supports a subset of the ResultSetMetaData interface.

    - - The JDBC specification for ResultSetMetaData is in part very - vague. This causes potential incompatibility between interpretations of the - specification as realized in different JDBC driver implementations. As such, - deciding to what degree reporting ResultSetMetaData is accurate has been - considered very carefully. Hopefully, the design decisions made in light of - these considerations have yielded precisely the subset of full - ResultSetMetaData support that is most commonly needed and that is most - important, while also providing, under the most common use-cases, the - fastest access with the least overhead and the best compromise between - speed, accuracy, jar-footprint and retention of JDBC resources.

    - - (fredt@users)
    - (campbell-burnet@users)

    -

    -
    -
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCStatement.executeQuery(java.lang.String), -JDBCStatement.getResultSet(), -ResultSetMetaData
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface java.sql.ResultSetMetaData

        -columnNoNulls, columnNullable, columnNullableUnknown
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringgetCatalogName​(int column) -
      Gets the designated column's table's catalog name.
      -
      java.lang.StringgetColumnClassName​(int column)
      intgetColumnCount() -
      Returns the number of columns in this ResultSet object.
      -
      intgetColumnDisplaySize​(int column) -
      Indicates the designated column's normal maximum width in characters.
      -
      java.lang.StringgetColumnLabel​(int column) -
      Gets the designated column's suggested title for use in printouts and - displays.
      -
      java.lang.StringgetColumnName​(int column) -
      Get the designated column's name.
      -
      intgetColumnType​(int column) -
      Retrieves the designated column's SQL type.
      -
      java.lang.StringgetColumnTypeName​(int column) -
      Retrieves the designated column's database-specific type name.
      -
      intgetPrecision​(int column) -
      (JDBC4 clarification:) - Get the designated column's specified column size.
      -
      intgetScale​(int column) -
      Gets the designated column's number of digits to right of the decimal point.
      -
      java.lang.StringgetSchemaName​(int column) -
      Get the designated column's table's schema.
      -
      java.lang.StringgetTableName​(int column) -
      Gets the designated column's table name.
      -
      booleanisAutoIncrement​(int column) -
      Indicates whether the designated column is automatically numbered.
      -
      booleanisCaseSensitive​(int column) -
      Indicates whether a column's case matters.
      -
      booleanisCurrency​(int column) -
      Indicates whether the designated column is a cash value.
      -
      booleanisDefinitelyWritable​(int column) -
      Indicates whether a write on the designated column will definitely succeed.
      -
      intisNullable​(int column) -
      Indicates the nullability of values in the designated column.
      -
      booleanisReadOnly​(int column) -
      Indicates whether the designated column is definitely not writable.
      -
      booleanisSearchable​(int column) -
      Indicates whether the designated column can be used in a where clause.
      -
      booleanisSigned​(int column) -
      Indicates whether values in the designated column are signed numbers.
      -
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      booleanisWritable​(int column) -
      Indicates whether it is possible for a write on the designated column to - succeed.
      -
      java.lang.StringtoString() -
      Returns a string representation of the object.
      -
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getColumnCount

        -
        public int getColumnCount()
        -                   throws java.sql.SQLException
        -
        - Returns the number of columns in this ResultSet object. - -
        -
        -
        Specified by:
        -
        getColumnCount in interface java.sql.ResultSetMetaData
        -
        Returns:
        -
        the number of columns
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isAutoIncrement

        -
        public boolean isAutoIncrement​(int column)
        -                        throws java.sql.SQLException
        -
        - Indicates whether the designated column is automatically numbered. -

        (JDBC4 deleted:)[, thus read-only.] - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 fully supports SQL Standard features T174 and T176 that - define identity column support. - -


        - - However, it must be stated here that contrary to the generic - documentation previous to the JDBC4 specification, HSQLDB automatically - numbered columns (IDENTITY columns, in HSQLDB parlance) are not - read-only.

        - - In fact, the generic documentation previous to the JDBC4 specification - seems to contradict the general definition of what, at minimum, - an auto-increment column is:

        - - Simply, an auto-increment column is one that guarantees it has a - autogenerated value after a successful insert or update operation, - even if no value is supplied, or DEFAULT is specified.

        - -

        -
        -
        -
        Specified by:
        -
        isAutoIncrement in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isCaseSensitive

        -
        public boolean isCaseSensitive​(int column)
        -                        throws java.sql.SQLException
        -
        - Indicates whether a column's case matters. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 1.7.1 did not report this value accurately.

        - - Starting with 1.7.2, this feature is better supported.

        - - This method returns true for any column whose data type is a character - type, with the exception of VARCHAR_IGNORECASE for which it returns - false. It also returns false for any column whose data type is a - not a character data type.

        - -

        -
        -
        -
        Specified by:
        -
        isCaseSensitive in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isSearchable

        -
        public boolean isSearchable​(int column)
        -                     throws java.sql.SQLException
        -
        - Indicates whether the designated column can be used in a where clause. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 handles this differently from previous versions.

        - - If the column in question is a database table or view column, and the - type of the column allows searching, then returns true, otherwise false. - -

        -
        -
        -
        Specified by:
        -
        isSearchable in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isCurrency

        -
        public boolean isCurrency​(int column)
        -                   throws java.sql.SQLException
        -
        - Indicates whether the designated column is a cash value. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 fully supports this feature and returns true for - NUMERIC and DECIMAL columns.

        - -

        -
        -
        -
        Specified by:
        -
        isCurrency in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isNullable

        -
        public int isNullable​(int column)
        -               throws java.sql.SQLException
        -
        - Indicates the nullability of values in the designated column. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.2 fully supports this feature.

        - - columnNoNulls is always returned for result set columns - that represent constants, sequences or table columns known - to be not null. columnNullable is returned for NULL constants, - or nullable table columns. columnNullableUnknown is returned - for all other columns such as aggregates and computed values.

        - - To determine the nullable status of a table column in isolation from - ResultSetMetaData and in a DBMS-independent fashion, the - DatabaseMetaData.getColumns() method can be invoked with the - appropriate filter values and the result should be inspected at the - position described in the DatabaseMetaData.getColumns() API - documentation. -

        -
        -
        -
        Specified by:
        -
        isNullable in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the nullability status of the given column; one of columnNoNulls, - columnNullable or columnNullableUnknown
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isSigned

        -
        public boolean isSigned​(int column)
        -                 throws java.sql.SQLException
        -
        - Indicates whether values in the designated column are signed numbers. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 fully supports this feature.

        - -

        -
        -
        -
        Specified by:
        -
        isSigned in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getColumnDisplaySize

        -
        public int getColumnDisplaySize​(int column)
        -                         throws java.sql.SQLException
        -
        - Indicates the designated column's normal maximum width in characters. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 fully supports this feature.

        - - The current calculation follows these rules: - -

          -
        1. Long character types and datetime types:

          - - The maximum length/precision, respectively. - -

        2. CHAR and VARCHAR types: - -
            -
          • If the result set column is a direct pass through of a table - column value and column size was declared, then the declared - value is returned. - -
          • Otherwise, the computed length according to SQL Standard is - returned. For very large values, the value of the system property - hsqldb.max_xxxchar_display_size or the magic value - 32766 (0x7FFE) (tested usable/accepted by most tools and - compatible with assumptions made by java.io read/write - UTF) when the system property is not defined or is not - accessible, due to security constraints.

            - -

          - - It must be noted that the latter value in no way affects the - ability of the HSQLDB JDBC driver to retrieve longer values - and serves only as the current best effort at providing a - value that maximizes usability across a wide range of tools, - given that the HSQLDB database engine allows very large - lengths to be declared. - -
        3. Number types:

          - - The max precision, plus the length of the negation character (1), - plus (if applicable) the maximum number of characters that may - occupy the exponent character sequence. Note that some legacy tools - do not correctly handle BIGINT values of greater than 18 digits. - -

        4. BOOLEAN type:

          - - The length of the character sequence "false" (5), the longer of the - two boolean value String representations. - -

        5. Remaining types:

          - - The maximum length/precision, respectively, as reported by - DatabaseMetaData.getTypeInfo(), when applicable. If the maximum - display size is unknown, unknowable or inapplicable, then zero is - returned.

          - -

        - -
        -
        -
        -
        Specified by:
        -
        getColumnDisplaySize in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the normal maximum number of characters allowed as the width - of the designated column
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getColumnLabel

        -
        public java.lang.String getColumnLabel​(int column)
        -                                throws java.sql.SQLException
        -
        - Gets the designated column's suggested title for use in printouts and - displays. (JDBC4 clarification:) The suggested title is usually specified by the SQL AS - clause. If a SQL AS is not specified, the value returned from - getColumnLabel will be the same as the value returned by the - getColumnName method. - - - -
        -

        HSQLDB-Specific Information:

        - - In HSQLDB, a ResultSet column label is determined using the - following order of precedence: - -

          -
        1. The label (alias) specified in the generating query.
        2. -
        3. The name of the underlying column, if no label is specified.
          -
        4. C1, C2, etc. for computed columns that have no label.
        5. -

        - -

        -
        -
        -
        Specified by:
        -
        getColumnLabel in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the suggested column title
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getColumnName

        -
        public java.lang.String getColumnName​(int column)
        -                               throws java.sql.SQLException
        -
        - Get the designated column's name. - - - -
        -

        HSQLDB-Specific Information:

        - - In HSQLDB, a ResultSet column name is determined using the following - order of precedence: - -

          -
        1. The name of the underlying column, if the ResultSet column - represents a column in a table.
        2. -
        3. The label or alias specified in the generating query.
        4. -
        5. C1, C2, etc. for computed columns that have no label.
        6. -

        - - If the jdbc.get_column_name property of the JDBC Connection - has been set to false, this method returns the same value as - getColumnLabel(int).

        - -

        -
        -
        -
        Specified by:
        -
        getColumnName in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        column name
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getSchemaName

        -
        public java.lang.String getSchemaName​(int column)
        -                               throws java.sql.SQLException
        -
        - Get the designated column's table's schema. - - - -
        -

        HSQLDB-Specific Information:

        - - Since 1.8.0.x, HSQLDB implements standard SQL SCHEMA support; - this method returns the actual schema of the column's table. - Columns generated in queries have no schema name. -

        -
        -
        -
        Specified by:
        -
        getSchemaName in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        schema name or "" if not applicable
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getPrecision

        -
        public int getPrecision​(int column)
        -                 throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Get the designated column's specified column size. - For numeric data, this is the maximum precision. For character data, this is the [maximum] length in characters. - For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. 0 is returned for data types where the - column size is not applicable. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 reports the correct length or precision for - all columns. For DOUBLE, the binary precision of 64 is returned, while - for other numeric types the decimal precision is returned.

        -

        -
        -
        -
        Specified by:
        -
        getPrecision in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        precision
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getScale

        -
        public int getScale​(int column)
        -             throws java.sql.SQLException
        -
        - Gets the designated column's number of digits to right of the decimal point. - 0 is returned for data types where the scale is not applicable. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 reports the correct scale for all columns.

        - - For datetime and interval types such as Timestamp or Time, the - fractional second precision is reported.

        - - The reported scale for INTEGER, BIGINT and DOUBLE is 0

        -

        -
        -
        -
        Specified by:
        -
        getScale in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        scale
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getTableName

        -
        public java.lang.String getTableName​(int column)
        -                              throws java.sql.SQLException
        -
        - Gets the designated column's table name. - -
        -
        -
        Specified by:
        -
        getTableName in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        table name or "" if not applicable
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getCatalogName

        -
        public java.lang.String getCatalogName​(int column)
        -                                throws java.sql.SQLException
        -
        - Gets the designated column's table's catalog name. - - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0, HSQLDB returns the name of the catalog. The default name is - PUBLIC. - This value can be changed for the database using an SQL command.

        - - HSQLDB supports use of catalog qualification in DLL or DML when it is - allowed by the Standard.

        - - However, not all clients respect the SQL Standard and may use a - catalog qualifier in a context where it is not supported by the Standard. -

        - - For greater detail, see discussion at: - JDBCDatabaseMetaData.

        - -

        -
        -
        -
        Specified by:
        -
        getCatalogName in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the name of the catalog for the table in which the given column - appears or "" if not applicable
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getColumnType

        -
        public int getColumnType​(int column)
        -                  throws java.sql.SQLException
        -
        - Retrieves the designated column's SQL type. - - - -
        -

        HSQLDB-Specific Information:

        - - This reports the SQL type code of the column. For time and timestamp - types that are WITH TIME ZONE, the values as the SQL Standard CLI - codes.

        - -

        -
        -
        -
        Specified by:
        -
        getColumnType in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        SQL type from java.sql.Types
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        See Also:
        -
        Types
        -
        -
      • -
      - - - -
        -
      • -

        getColumnTypeName

        -
        public java.lang.String getColumnTypeName​(int column)
        -                                   throws java.sql.SQLException
        -
        - Retrieves the designated column's database-specific type name. -
        -
        -
        Specified by:
        -
        getColumnTypeName in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        type name used by the database. If the column type is - a user-defined type, then a fully-qualified type name is returned.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isReadOnly

        -
        public boolean isReadOnly​(int column)
        -                   throws java.sql.SQLException
        -
        - Indicates whether the designated column is definitely not writable. - - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0 this method returns true if the ResultSet is not updatable - or the column in question is not updatable.

        -

        -
        -
        -
        Specified by:
        -
        isReadOnly in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isWritable

        -
        public boolean isWritable​(int column)
        -                   throws java.sql.SQLException
        -
        - Indicates whether it is possible for a write on the designated column to - succeed. - - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0 this method returns false if the ResultSet is not updatable - or the column in question is not updatable.

        - -

        -
        -
        -
        Specified by:
        -
        isWritable in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isDefinitelyWritable

        -
        public boolean isDefinitelyWritable​(int column)
        -                             throws java.sql.SQLException
        -
        - Indicates whether a write on the designated column will definitely succeed. - - - -
        -

        HSQLDB-Specific Information:

        - - From 2.0 this method returns false if the ResultSet is not updatable - or the column in question is not updatable.

        - -

        -
        -
        -
        Specified by:
        -
        isDefinitelyWritable in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        true if so; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getColumnClassName

        -
        public java.lang.String getColumnClassName​(int column)
        -                                    throws java.sql.SQLException
        -
        -

        Returns the fully-qualified name of the Java class whose instances - are manufactured if the method ResultSet.getObject - is called to retrieve a value - from the column. ResultSet.getObject may return a subclass of the - class returned by this method. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB 2.0 fully supports this feature.

        - - For columns of type OTHER, there is no specific class name and - java.lang.Object is returned. - -

        -
        -
        -
        Specified by:
        -
        getColumnClassName in interface java.sql.ResultSetMetaData
        -
        Parameters:
        -
        column - the first column is 1, the second is 2, ...
        -
        Returns:
        -
        the fully-qualified name of the class in the Java programming - language that would be used by the method - ResultSet.getObject to retrieve the value in the specified - column. This is the class name used for custom mapping.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return the - result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Returns a string representation of the object.

        - - The string consists of the name of the class of which the - object is an instance, the at-sign character `@', - the unsigned hexadecimal representation of the hash code of the - object and a comma-delimited list of this object's indexed attributes, - enclosed in square brackets.

        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        a string representation of the object.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCRowId.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCRowId.html deleted file mode 100644 index 4cd23a23..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCRowId.html +++ /dev/null @@ -1,535 +0,0 @@ - - - - - -JDBCRowId (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCRowId

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCRowId
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.RowId
    -
    -
    -
    public final class JDBCRowId
    -extends java.lang.Object
    -implements java.sql.RowId
    -
    The representation (mapping) in the Java programming language of an SQL ROWID - value. An SQL ROWID is a built-in type, a value of which can be thought of as - an address for its identified row in a database table. Whether that address - is logical or, in any respects, physical is determined by its originating data - source. -

    - Methods in the interfaces ResultSet, CallableStatement, - and PreparedStatement, such as getRowId and setRowId - allow a programmer to access a SQL ROWID value. The RowId - interface provides a method - for representing the value of the ROWID as a byte array or as a - String. -

    - The method getRowIdLifetime in the interface DatabaseMetaData, - can be used - to determine if a RowId object remains valid for the duration of the transaction in - which the RowId was created, the duration of the session in which - the RowId was created, - or, effectively, for as long as its identified row is not deleted. In addition - to specifying the duration of its valid lifetime outside its originating data - source, getRowIdLifetime specifies the duration of a ROWID - value's valid lifetime - within its originating data source. In this, it differs from a large object, - because there is no limit on the valid lifetime of a large object within its - originating data source. -

    - All methods on the RowId interface must be fully implemented if the - JDBC driver supports the data type.

    -
    -
    Since:
    -
    JDK 1.6, HSQLDB 2.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    See Also:
    -
    DatabaseMetaData
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCRowId​(byte[] id) -
      Constructs a new JDBCRowId instance wrapping the given octet sequence.
      -
      JDBCRowId​(java.lang.String hex) -
      Constructs a new JDBCRowId instance whose internal octet sequence - is that represented by the given hexadecimal character sequence.
      -
      JDBCRowId​(java.sql.RowId id) -
      Constructs a new JDBCRowId instance whose internal octet sequence - is a copy of the octet sequence of the given RowId object.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanequals​(java.lang.Object obj) -
      Compares this RowId to the specified object.
      -
      byte[]getBytes() -
      Returns an array of bytes representing the value of the SQL ROWID - designated by this java.sql.RowId object.
      -
      inthashCode() -
      Returns a hash code value of this RowId object.
      -
      java.lang.StringtoString() -
      Returns a String representing the value of the SQL ROWID designated by this - java.sql.RowId object.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -getClass, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCRowId

        -
        public JDBCRowId​(byte[] id)
        -          throws java.sql.SQLException
        -
        Constructs a new JDBCRowId instance wrapping the given octet sequence.

        - - This constructor may be used internally to retrieve result set values as - RowId objects, yet it also may need to be public to allow access from - other packages. As such (in the interest of efficiency) this object - maintains a reference to the given octet sequence rather than making a - copy; special care should be taken by external clients never to use this - constructor with a byte array object that may later be modified - externally.

        -
        -
        Parameters:
        -
        id - the octet sequence representing the Rowid value
        -
        Throws:
        -
        java.sql.SQLException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        JDBCRowId

        -
        public JDBCRowId​(java.sql.RowId id)
        -          throws java.sql.SQLException
        -
        Constructs a new JDBCRowId instance whose internal octet sequence - is a copy of the octet sequence of the given RowId object.

        -
        -
        Parameters:
        -
        id - the octet sequence representing the Rowid value
        -
        Throws:
        -
        java.sql.SQLException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        JDBCRowId

        -
        public JDBCRowId​(java.lang.String hex)
        -          throws java.sql.SQLException
        -
        Constructs a new JDBCRowId instance whose internal octet sequence - is that represented by the given hexadecimal character sequence.

        -
        -
        Parameters:
        -
        hex - the hexadecimal character sequence from which to derive - the internal octet sequence
        -
        Throws:
        -
        java.sql.SQLException - if the argument is null or is not a valid - hexadecimal character sequence
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        equals

        -
        public boolean equals​(java.lang.Object obj)
        -
        Compares this RowId to the specified object. The result is - true if and only if the argument is not null and is a RowId - object that represents the same ROWID as this object. -

        - It is important - to consider both the origin and the valid lifetime of a RowId - when comparing it to another RowId. If both are valid, and - both are from the same table on the same data source, then if they are equal - they identify - the same row; if one or more is no longer guaranteed to be valid, or if - they originate from different data sources, or different tables on the - same data source, they may be equal but still - not identify the same row.

        -
        -
        Specified by:
        -
        equals in interface java.sql.RowId
        -
        Overrides:
        -
        equals in class java.lang.Object
        -
        Parameters:
        -
        obj - the Object to compare this RowId object - against.
        -
        Returns:
        -
        true if the RowIds are equal; false otherwise
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getBytes

        -
        public byte[] getBytes()
        -
        Returns an array of bytes representing the value of the SQL ROWID - designated by this java.sql.RowId object.
        -
        -
        Specified by:
        -
        getBytes in interface java.sql.RowId
        -
        Returns:
        -
        an array of bytes, whose length is determined by the driver supplying - the connection, representing the value of the ROWID designated by this - java.sql.RowId object.
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Returns a String representing the value of the SQL ROWID designated by this - java.sql.RowId object. -

        - Like java.sql.Date.toString() - returns the contents of its DATE as the String "2004-03-17" - rather than as DATE literal in SQL (which would have been the String - DATE "2004-03-17"), toString() - returns the contents of its ROWID in a form specific to the driver supplying - the connection, and possibly not as a ROWID literal.

        -
        -
        Specified by:
        -
        toString in interface java.sql.RowId
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        a String whose format is determined by the driver supplying the - connection, representing the value of the ROWID designated - by this java.sql.RowId object.
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        Returns a hash code value of this RowId object.
        -
        -
        Specified by:
        -
        hashCode in interface java.sql.RowId
        -
        Overrides:
        -
        hashCode in class java.lang.Object
        -
        Returns:
        -
        a hash code for the RowId
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSQLXML.SAX2XMLStreamWriter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSQLXML.SAX2XMLStreamWriter.html deleted file mode 100644 index f8e29904..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSQLXML.SAX2XMLStreamWriter.html +++ /dev/null @@ -1,976 +0,0 @@ - - - - - -JDBCSQLXML.SAX2XMLStreamWriter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCSQLXML.SAX2XMLStreamWriter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.lang.AutoCloseable, org.xml.sax.ContentHandler
    -
    -
    -
    Enclosing class:
    -
    JDBCSQLXML
    -
    -
    -
    public static class JDBCSQLXML.SAX2XMLStreamWriter
    -extends java.lang.Object
    -implements org.xml.sax.ContentHandler, java.io.Closeable
    -
    Writes to a XMLStreamWriter - from SAX events.
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      SAX2XMLStreamWriter​(javax.xml.stream.XMLStreamWriter writer) -
      Constructs a new SAX2XMLStreamWriter that writes SAX events to the - designated XMLStreamWriter.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidcharacters​(char[] ch, - int start, - int length) -
      Receive notification of character data.
      -
      voidclose() -
      Closes this object.
      -
      voidcomment​(char[] ch, - int start, - int length) 
      voidendDocument() -
      Receive notification of the end of a document.
      -
      voidendElement​(java.lang.String namespaceURI, - java.lang.String localName, - java.lang.String qName) -
      Receive notification of the end of an element.
      -
      voidendPrefixMapping​(java.lang.String prefix) -
      End the scope of a prefix-URI mapping.
      -
      org.xml.sax.LocatorgetDocumentLocator() -
      Retrieves the Locator.
      -
      javax.xml.stream.XMLStreamWritergetWriter() 
      voidignorableWhitespace​(char[] ch, - int start, - int length) -
      Receive notification of ignorable whitespace in element content.
      -
      booleanisClosed() -
      Retrieves whether this object is closed.
      -
      voidprocessingInstruction​(java.lang.String target, - java.lang.String data) -
      Receive notification of a processing instruction.
      -
      voidsetDocumentLocator​(org.xml.sax.Locator locator) -
      Receive an object for locating the origin of SAX document events.
      -
      voidskippedEntity​(java.lang.String name) -
      Receive notification of a skipped entity.
      -
      voidstartDocument() -
      Receive notification of the beginning of a document.
      -
      voidstartElement​(java.lang.String namespaceURI, - java.lang.String localName, - java.lang.String qName, - org.xml.sax.Attributes atts) -
      Receive notification of the beginning of an element.
      -
      voidstartPrefixMapping​(java.lang.String prefix, - java.lang.String uri) -
      Begin the scope of a prefix-URI Namespace mapping.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SAX2XMLStreamWriter

        -
        public SAX2XMLStreamWriter​(javax.xml.stream.XMLStreamWriter writer)
        -
        Constructs a new SAX2XMLStreamWriter that writes SAX events to the - designated XMLStreamWriter.
        -
        -
        Parameters:
        -
        writer - the writer to which to write SAX events
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        startDocument

        -
        public void startDocument()
        -                   throws org.xml.sax.SAXException
        -
        Receive notification of the beginning of a document. - -

        The SAX parser will invoke this method only once, before any - other event callbacks (except for setDocumentLocator).

        -
        -
        Specified by:
        -
        startDocument in interface org.xml.sax.ContentHandler
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        See Also:
        -
        endDocument()
        -
        -
      • -
      - - - -
        -
      • -

        endDocument

        -
        public void endDocument()
        -                 throws org.xml.sax.SAXException
        -
        Receive notification of the end of a document. - -

        There is an apparent contradiction between the - documentation for this method and the documentation for ErrorHandler.fatalError(org.xml.sax.SAXParseException). Until this ambiguity is - resolved in a future major release, clients should make no - assumptions about whether endDocument() will or will not be - invoked when the parser has reported a fatalError() or thrown - an exception.

        - -

        The SAX parser will invoke this method only once, and it will - be the last method invoked during the parse. The parser shall - not invoke this method until it has either abandoned parsing - (because of an unrecoverable error) or reached the end of - input.

        -
        -
        Specified by:
        -
        endDocument in interface org.xml.sax.ContentHandler
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        See Also:
        -
        startDocument()
        -
        -
      • -
      - - - -
        -
      • -

        characters

        -
        public void characters​(char[] ch,
        -                       int start,
        -                       int length)
        -                throws org.xml.sax.SAXException
        -
        Receive notification of character data. - -

        The Parser will call this method to report each chunk of - character data. SAX parsers may return all contiguous character - data in a single chunk, or they may split it into several - chunks; however, all of the characters in any single event - must come from the same external entity so that the Locator - provides useful information.

        - -

        The application must not attempt to read from the array - outside of the specified range.

        - -

        Individual characters may consist of more than one Java - char value. There are two important cases where this - happens, because characters can't be represented in just sixteen bits. - In one case, characters are represented in a Surrogate Pair, - using two special Unicode values. Such characters are in the so-called - "Astral Planes", with a code point above U+FFFF. A second case involves - composite characters, such as a base character combining with one or - more accent characters.

        - -

        Your code should not assume that algorithms using - char-at-a-time idioms will be working in character - units; in some cases they will split characters. This is relevant - wherever XML permits arbitrary characters, such as attribute values, - processing instruction data, and comments as well as in data reported - from this method. It's also generally relevant whenever Java code - manipulates internationalized text; the issue isn't unique to XML.

        - -

        Note that some parsers will report whitespace in element - content using the ignorableWhitespace - method rather than this one (validating parsers must - do so).

        -
        -
        Specified by:
        -
        characters in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        ch - the characters from the XML document
        -
        start - the start position in the array
        -
        length - the number of characters to read from the array
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        See Also:
        -
        ignorableWhitespace(char[], int, int), -Locator
        -
        -
      • -
      - - - -
        -
      • -

        startElement

        -
        public void startElement​(java.lang.String namespaceURI,
        -                         java.lang.String localName,
        -                         java.lang.String qName,
        -                         org.xml.sax.Attributes atts)
        -                  throws org.xml.sax.SAXException
        -
        Receive notification of the beginning of an element. - -

        The Parser will invoke this method at the beginning of every - element in the XML document; there will be a corresponding - endElement event for every startElement event - (even when the element is empty). All of the element's content will be - reported, in order, before the corresponding endElement - event.

        - -

        This event allows up to three name components for each - element:

        - -
          -
        1. the Namespace URI;
        2. -
        3. the local name; and
        4. -
        5. the qualified (prefixed) name.
        6. -
        - -

        Any or all of these may be provided, depending on the - values of the http://xml.org/sax/features/namespaces - and the http://xml.org/sax/features/namespace-prefixes - properties:

        - -
          -
        • the Namespace URI and local name are required when - the namespaces property is true (the default), and are - optional when the namespaces property is false (if one is - specified, both must be);
        • -
        • the qualified name is required when the namespace-prefixes property - is true, and is optional when the namespace-prefixes property - is false (the default).
        • -
        - -

        Note that the attribute list provided will contain only - attributes with explicit values (specified or defaulted): - #IMPLIED attributes will be omitted. The attribute list - will contain attributes used for Namespace declarations - (xmlns* attributes) only if the - http://xml.org/sax/features/namespace-prefixes - property is true (it is false by default, and support for a - true value is optional).

        - -

        Like characters(), attribute values may have - characters that need more than one char value.

        -
        -
        Specified by:
        -
        startElement in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        namespaceURI - the Namespace URI, or the empty string if the - element has no Namespace URI or if Namespace - processing is not being performed
        -
        localName - the local name (without prefix), or the - empty string if Namespace processing is not being - performed
        -
        qName - the qualified name (with prefix), or the - empty string if qualified names are not available
        -
        atts - the attributes attached to the element. If - there are no attributes, it shall be an empty - Attributes object. The value of this object after - startElement returns is undefined
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        See Also:
        -
        endElement(java.lang.String, java.lang.String, java.lang.String), -Attributes, -AttributesImpl
        -
        -
      • -
      - - - -
        -
      • -

        endElement

        -
        public void endElement​(java.lang.String namespaceURI,
        -                       java.lang.String localName,
        -                       java.lang.String qName)
        -                throws org.xml.sax.SAXException
        -
        Receive notification of the end of an element. - -

        The SAX parser will invoke this method at the end of every - element in the XML document; there will be a corresponding - startElement event for every endElement - event (even when the element is empty).

        - -

        For information on the names, see startElement.

        -
        -
        Specified by:
        -
        endElement in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        namespaceURI - the Namespace URI, or the empty string if the - element has no Namespace URI or if Namespace - processing is not being performed
        -
        localName - the local name (without prefix), or the - empty string if Namespace processing is not being - performed
        -
        qName - the qualified XML name (with prefix), or the - empty string if qualified names are not available
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        -
      • -
      - - - -
        -
      • -

        startPrefixMapping

        -
        public void startPrefixMapping​(java.lang.String prefix,
        -                               java.lang.String uri)
        -                        throws org.xml.sax.SAXException
        -
        Begin the scope of a prefix-URI Namespace mapping. - -

        The information from this event is not necessary for - normal Namespace processing: the SAX XML reader will - automatically replace prefixes for element and attribute - names when the http://xml.org/sax/features/namespaces - feature is true (the default).

        - -

        There are cases, however, when applications need to - use prefixes in character data or in attribute values, - where they cannot safely be expanded automatically; the - start/endPrefixMapping event supplies the information - to the application to expand prefixes in those contexts - itself, if necessary.

        - -

        Note that start/endPrefixMapping events are not - guaranteed to be properly nested relative to each other: - all startPrefixMapping events will occur immediately before the - corresponding startElement event, - and all endPrefixMapping - events will occur immediately after the corresponding - endElement event, - but their order is not otherwise - guaranteed.

        - -

        There should never be start/endPrefixMapping events for the - "xml" prefix, since it is predeclared and immutable.

        -
        -
        Specified by:
        -
        startPrefixMapping in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        prefix - the Namespace prefix being declared. - An empty string is used for the default element namespace, - which has no prefix.
        -
        uri - the Namespace URI the prefix is mapped to
        -
        Throws:
        -
        org.xml.sax.SAXException - the client may throw - an exception during processing
        -
        See Also:
        -
        endPrefixMapping(java.lang.String), -startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
        -
        -
      • -
      - - - -
        -
      • -

        endPrefixMapping

        -
        public void endPrefixMapping​(java.lang.String prefix)
        -                      throws org.xml.sax.SAXException
        -
        End the scope of a prefix-URI mapping. - -

        See startPrefixMapping for - details. These events will always occur immediately after the - corresponding endElement event, but the order of - endPrefixMapping events is not otherwise - guaranteed.

        -
        -
        Specified by:
        -
        endPrefixMapping in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        prefix - the prefix that was being mapped. - This is the empty string when a default mapping scope ends.
        -
        Throws:
        -
        org.xml.sax.SAXException - the client may throw - an exception during processing
        -
        See Also:
        -
        startPrefixMapping(java.lang.String, java.lang.String), -endElement(java.lang.String, java.lang.String, java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        ignorableWhitespace

        -
        public void ignorableWhitespace​(char[] ch,
        -                                int start,
        -                                int length)
        -                         throws org.xml.sax.SAXException
        -
        Receive notification of ignorable whitespace in element content. - -

        Validating Parsers must use this method to report each chunk - of whitespace in element content (see the W3C XML 1.0 - recommendation, section 2.10): non-validating parsers may also - use this method if they are capable of parsing and using - content models.

        - -

        SAX parsers may return all contiguous whitespace in a single - chunk, or they may split it into several chunks; however, all of - the characters in any single event must come from the same - external entity, so that the Locator provides useful - information.

        - -

        The application must not attempt to read from the array - outside of the specified range.

        -
        -
        Specified by:
        -
        ignorableWhitespace in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        ch - the characters from the XML document
        -
        start - the start position in the array
        -
        length - the number of characters to read from the array
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        See Also:
        -
        characters(char[], int, int)
        -
        -
      • -
      - - - -
        -
      • -

        processingInstruction

        -
        public void processingInstruction​(java.lang.String target,
        -                                  java.lang.String data)
        -                           throws org.xml.sax.SAXException
        -
        Receive notification of a processing instruction. - -

        The Parser will invoke this method once for each processing - instruction found: note that processing instructions may occur - before or after the main document element.

        - -

        A SAX parser must never report an XML declaration (XML 1.0, - section 2.8) or a text declaration (XML 1.0, section 4.3.1) - using this method.

        - -

        Like characters(), processing instruction - data may have characters that need more than one char - value.

        -
        -
        Specified by:
        -
        processingInstruction in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        target - the processing instruction target
        -
        data - the processing instruction data, or null if - none was supplied. The data does not include any - whitespace separating it from the target
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        -
      • -
      - - - -
        -
      • -

        setDocumentLocator

        -
        public void setDocumentLocator​(org.xml.sax.Locator locator)
        -
        Receive an object for locating the origin of SAX document events. - -

        SAX parsers are strongly encouraged (though not absolutely - required) to supply a locator: if it does so, it must supply - the locator to the application by invoking this method before - invoking any of the other methods in the ContentHandler - interface.

        - -

        The locator allows the application to determine the end - position of any document-related event, even if the parser is - not reporting an error. Typically, the application will - use this information for reporting its own errors (such as - character content that does not match an application's - business rules). The information returned by the locator - is probably not sufficient for use with a search engine.

        - -

        Note that the locator will return correct information only - during the invocation SAX event callbacks after - startDocument returns and before - endDocument is called. The - application should not attempt to use it at any other time.

        -
        -
        Specified by:
        -
        setDocumentLocator in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        locator - an object that can return the location of - any SAX document event
        -
        See Also:
        -
        Locator
        -
        -
      • -
      - - - -
        -
      • -

        getDocumentLocator

        -
        public org.xml.sax.Locator getDocumentLocator()
        -
        Retrieves the Locator.

        -
        -
        Returns:
        -
        the Locator
        -
        -
      • -
      - - - -
        -
      • -

        skippedEntity

        -
        public void skippedEntity​(java.lang.String name)
        -                   throws org.xml.sax.SAXException
        -
        Receive notification of a skipped entity. - This is not called for entity references within markup constructs - such as element start tags or markup declarations. (The XML - recommendation requires reporting skipped external entities. - SAX also reports internal entity expansion/non-expansion, except - within markup constructs.) - -

        The Parser will invoke this method each time the entity is - skipped. Non-validating processors may skip entities if they - have not seen the declarations (because, for example, the - entity was declared in an external DTD subset). All processors - may skip external entities, depending on the values of the - http://xml.org/sax/features/external-general-entities - and the - http://xml.org/sax/features/external-parameter-entities - properties.

        -
        -
        Specified by:
        -
        skippedEntity in interface org.xml.sax.ContentHandler
        -
        Parameters:
        -
        name - the name of the skipped entity. If it is a - parameter entity, the name will begin with '%', and if - it is the external DTD subset, it will be the string - "[dtd]"
        -
        Throws:
        -
        org.xml.sax.SAXException - any SAX exception, possibly - wrapping another exception
        -
        -
      • -
      - - - -
        -
      • -

        comment

        -
        public void comment​(char[] ch,
        -                    int start,
        -                    int length)
        -             throws org.xml.sax.SAXException
        -
        -
        Throws:
        -
        org.xml.sax.SAXException
        -
        -
      • -
      - - - -
        -
      • -

        getWriter

        -
        public javax.xml.stream.XMLStreamWriter getWriter()
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        Closes this object.
        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Retrieves whether this object is closed.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSQLXML.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSQLXML.html deleted file mode 100644 index 27d397d8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSQLXML.html +++ /dev/null @@ -1,1031 +0,0 @@ - - - - - -JDBCSQLXML (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCSQLXML

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCSQLXML
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.SQLXML
    -
    -
    -
    public class JDBCSQLXML
    -extends java.lang.Object
    -implements java.sql.SQLXML
    -
    - The mapping in the JavaTM programming language for the SQL XML type. - XML is a built-in type that stores an XML value - as a column value in a row of a database table. - By default drivers implement an SQLXML object as - a logical pointer to the XML data - rather than the data itself. - An SQLXML object is valid for the duration of the transaction in which it was created. -

    - The SQLXML interface provides methods for accessing the XML value - as a String, a Reader or Writer, or as a Stream. The XML value - may also be accessed through a Source or set as a Result, which - are used with XML Parser APIs such as DOM, SAX, and StAX, as - well as with XSLT transforms and XPath evaluations. -

    - Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement, - such as getSQLXML allow a programmer to access an XML value. - In addition, this interface has methods for updating an XML value. -

    - The XML value of the SQLXML instance may be obtained as a BinaryStream using -

    -   SQLXML sqlxml = resultSet.getSQLXML(column);
    -   InputStream binaryStream = sqlxml.getBinaryStream();
    - 
    - For example, to parse an XML value with a DOM parser: -
    -   DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    -   Document result = parser.parse(binaryStream);
    - 
    - or to parse an XML value with a SAX parser to your handler: -
    -   SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
    -   parser.parse(binaryStream, myHandler);
    - 
    - or to parse an XML value with a StAX parser: -
    -   XMLInputFactory factory = XMLInputFactory.newInstance();
    -   XMLStreamReader streamReader = factory.createXMLStreamReader(binaryStream);
    - 
    -

    - Because databases may use an optimized representation for the XML, - accessing the value through getSource() and - setResult() can lead to improved processing performance - without serializing to a stream representation and parsing the XML. -

    - For example, to obtain a DOM Document Node: -

    -   DOMSource domSource = sqlxml.getSource(DOMSource.class);
    -   Document document = (Document) domSource.getNode();
    - 
    - or to set the value to a DOM Document Node to myNode: -
    -   DOMResult domResult = sqlxml.setResult(DOMResult.class);
    -   domResult.setNode(myNode);
    - 
    - or, to send SAX events to your handler: -
    -   SAXSource saxSource = sqlxml.getSource(SAXSource.class);
    -   XMLReader xmlReader = saxSource.getXMLReader();
    -   xmlReader.setContentHandler(myHandler);
    -   xmlReader.parse(saxSource.getInputSource());
    - 
    - or, to set the result value from SAX events: -
    -   SAXResult saxResult = sqlxml.setResult(SAXResult.class);
    -   ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
    -   contentHandler.startDocument();
    -   // set the XML elements and attributes into the result
    -   contentHandler.endDocument();
    - 
    - or, to obtain StAX events: -
    -   StAXSource staxSource = sqlxml.getSource(StAXSource.class);
    -   XMLStreamReader streamReader = staxSource.getXMLStreamReader();
    - 
    - or, to set the result value from StAX events: -
    -   StAXResult staxResult = sqlxml.getResult(StAXResult.class);
    -   XMLStreamWriter streamWriter = staxResult.getXMLStreamWriter();
    - 
    - or, to perform XSLT transformations on the XML value using the XSLT in xsltFile - output to file resultFile: -
    -   File xsltFile = new File("a.xslt");
    -   File myFile = new File("result.xml");
    -   Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
    -   Source source = sqlxml.getSource(null);
    -   Result result = new StreamResult(myFile);
    -   xslt.transform(source, result);
    - 
    - or, to evaluate an XPath expression on the XML value: -
    -   XPath xpath = XPathFactory.newInstance().newXPath();
    -   DOMSource domSource = sqlxml.getSource(DOMSource.class);
    -   Document document = (Document) domSource.getNode();
    -   String expression = "/foo/@bar";
    -   String barValue = xpath.evaluate(expression, document);
    - 
    - To set the XML value to be the result of an XSLT transform: -
    -   File sourceFile = new File("source.xml");
    -   Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
    -   Source streamSource = new StreamSource(sourceFile);
    -   Result result = sqlxml.setResult(null);
    -   xslt.transform(streamSource, result);
    - 
    - Any Source can be transformed to a Result using the identity transform - specified by calling newTransformer(): -
    -   Transformer identity = TransformerFactory.newInstance().newTransformer();
    -   Source source = sqlxml.getSource(null);
    -   File myFile = new File("result.xml");
    -   Result result = new StreamResult(myFile);
    -   identity.transform(source, result);
    - 
    - To write the contents of a Source to standard output: -
    -   Transformer identity = TransformerFactory.newInstance().newTransformer();
    -   Source source = sqlxml.getSource(null);
    -   Result result = new StreamResult(System.out);
    -   identity.transform(source, result);
    - 
    - To create a DOMSource from a DOMResult: -
    -    DOMSource domSource = new DOMSource(domResult.getNode());
    - 
    -

    - Incomplete or invalid XML values may cause an SQLException when - set or the exception may occur when execute() occurs. All streams - must be closed before execute() occurs or an SQLException will be thrown. -

    - Reading and writing XML values to or from an SQLXML object can happen at most once. - The conceptual states of readable and not readable determine if one - of the reading APIs will return a value or throw an exception. - The conceptual states of writable and not writable determine if one - of the writing APIs will set a value or throw an exception. -

    - The state moves from readable to not readable once free() or any of the - reading APIs are called: getBinaryStream(), getCharacterStream(), getSource(), and getString(). - Implementations may also change the state to not writable when this occurs. -

    - The state moves from writable to not writeable once free() or any of the - writing APIs are called: setBinaryStream(), setCharacterStream(), setResult(), and setString(). - Implementations may also change the state to not readable when this occurs. -

    - All methods on the SQLXML interface must be fully implemented if the - JDBC driver supports the data type. - - - -

    -

    HSQLDB-Specific Information:

    - - Starting with HSQLDB 2.0, a rudimentary client-side SQLXML interface - implementation (this class) is supported for local use when the product is - built and run under JDK 1.6+ and the SQLXML instance is constructed as the - result of calling JDBCConnection.createSQLXML().

    - - SQLXML instances retrieved in such a fashion are initially write-only, with - the lifecycle of read and write availability constrained in accordance with - the documentation of the interface methods.

    - - When build and run under JDK 1.6+, it is also possible to retrieve read-only - SQLXML instances from JDBCResultSet.getSQLXML(...), given that the underlying - data can be converted to an XML Document Object Model (DOM).

    - - However, at the time of this writing (2007-06-12) it is not yet possible to - store SQLXML objects directly into an HSQLDB database or to use them directly - for HSQLDB statement parameterization purposes. This is because the SQLXML - data type is not yet natively supported by the HSQLDB engine. Instead, a - JDBCSQLXML instance must first be read as a string, binary input stream, - character input stream and so on, which can then be used for such purposes.

    - - Here is the current read/write availability lifecycle for JDBCSQLXML: - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Lifecycle
    - Origin - - Initially - - After 1st Write - - After 1st Read - - After 1st Free -
    - org.hsqldb.jdbc.JDBCConnection.createSQLXML() - - Write-only - - Read-only - - Not readable or writable - - Not readable or writable -
    - org.hsqldb.jdbc.JDBCResultSet.getSQLXML(...) - - Read-only - - N/A - - Not readable or writable - - Not readable or writable -
    -

    -
    -
    -
    Since:
    -
    JDK 1.6, HSQLDB 2.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    See Also:
    -
    javax.xml.parsers, -javax.xml.stream, -javax.xml.transform, -javax.xml.xpath
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      - - - - - - - - - - - - -
      Nested Classes 
      Modifier and TypeClassDescription
      static class JDBCSQLXML.SAX2XMLStreamWriter -
      Writes to a XMLStreamWriter - from SAX events.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCSQLXML​(javax.xml.transform.Source source) -
      Constructs a new read-only JDBCSQLXML object from the given Source - object.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidfree() -
      This method closes this object and releases the resources that it held.
      -
      java.io.InputStreamgetBinaryStream() -
      Retrieves the XML value designated by this SQLXML instance as a stream.
      -
      java.io.ReadergetCharacterStream() -
      Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object.
      -
      <T extends javax.xml.transform.Source>
      T
      getSource​(java.lang.Class<T> sourceClass) -
      Returns a Source for reading the XML value designated by this SQLXML instance.
      -
      java.lang.StringgetString() -
      Returns a string representation of the XML value designated by this SQLXML instance.
      -
      booleanisReadable() -
      Retrieves the object's readability status.
      -
      booleanisWritable() -
      Retrieves the object's readability status.
      -
      java.io.OutputStreamsetBinaryStream() -
      Retrieves a stream that can be used to write the XML value that this SQLXML instance represents.
      -
      java.io.WritersetCharacterStream() -
      Retrieves a stream to be used to write the XML value that this SQLXML instance represents.
      -
      <T extends javax.xml.transform.Result>
      T
      setResult​(java.lang.Class<T> resultClass) -
      Returns a Result for setting the XML value designated by this SQLXML instance.
      -
      voidsetString​(java.lang.String value) -
      Sets the XML value designated by this SQLXML instance to the given String representation.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCSQLXML

        -
        public JDBCSQLXML​(javax.xml.transform.Source source)
        -           throws java.sql.SQLException
        -
        Constructs a new read-only JDBCSQLXML object from the given Source - object.
        -
        -
        Parameters:
        -
        source - a Source representing an SQLXML value
        -
        Throws:
        -
        java.sql.SQLException - if the argument does not represent a - valid SQLXML value
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        free

        -
        public void free()
        -          throws java.sql.SQLException
        -
        This method closes this object and releases the resources that it held. - The SQL XML object becomes invalid and neither readable nor writable - when this method is called.

        - - After free has been called, any attempt to invoke a - method other than free will result in a SQLException - being thrown. If free is called multiple times, the subsequent - calls to free are treated as a no-op.

        -
        -
        Specified by:
        -
        free in interface java.sql.SQLXML
        -
        Throws:
        -
        java.sql.SQLException - if there is an error freeing the XML value.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryStream

        -
        public java.io.InputStream getBinaryStream()
        -                                    throws java.sql.SQLException
        -
        Retrieves the XML value designated by this SQLXML instance as a stream. - The bytes of the input stream are interpreted according to appendix F of the XML 1.0 specification. - The behavior of this method is the same as ResultSet.getBinaryStream() - when the designated column of the ResultSet has a type java.sql.Types of SQLXML. -

        - The SQL XML object becomes not readable when this method is called and - may also become not writable depending on implementation.

        -
        -
        Specified by:
        -
        getBinaryStream in interface java.sql.SQLXML
        -
        Returns:
        -
        a stream containing the XML data.
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value. - An exception is thrown if the state is not readable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        setBinaryStream

        -
        public java.io.OutputStream setBinaryStream()
        -                                     throws java.sql.SQLException
        -
        Retrieves a stream that can be used to write the XML value that this SQLXML instance represents. - The stream begins at position 0. - The bytes of the stream are interpreted according to appendix F of the XML 1.0 specification - The behavior of this method is the same as ResultSet.updateBinaryStream() - when the designated column of the ResultSet has a type java.sql.Types of SQLXML. -

        - The SQL XML object becomes not writeable when this method is called and - may also become not readable depending on implementation.

        -
        -
        Specified by:
        -
        setBinaryStream in interface java.sql.SQLXML
        -
        Returns:
        -
        a stream to which data can be written.
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value. - An exception is thrown if the state is not writable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        getCharacterStream

        -
        public java.io.Reader getCharacterStream()
        -                                  throws java.sql.SQLException
        -
        Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object. - The format of this stream is defined by org.xml.sax.InputSource, - where the characters in the stream represent the unicode code points for - XML according to section 2 and appendix B of the XML 1.0 specification. - Although an encoding declaration other than unicode may be present, - the encoding of the stream is unicode. - The behavior of this method is the same as ResultSet.getCharacterStream() - when the designated column of the ResultSet has a type java.sql.Types of SQLXML. -

        - The SQL XML object becomes not readable when this method is called and - may also become not writable depending on implementation.

        -
        -
        Specified by:
        -
        getCharacterStream in interface java.sql.SQLXML
        -
        Returns:
        -
        a stream containing the XML data.
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value. - The getCause() method of the exception may provide a more detailed exception, for example, - if the stream does not contain valid characters. - An exception is thrown if the state is not readable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        setCharacterStream

        -
        public java.io.Writer setCharacterStream()
        -                                  throws java.sql.SQLException
        -
        Retrieves a stream to be used to write the XML value that this SQLXML instance represents. - The format of this stream is defined by org.xml.sax.InputSource, - where the characters in the stream represent the unicode code points for - XML according to section 2 and appendix B of the XML 1.0 specification. - Although an encoding declaration other than unicode may be present, - the encoding of the stream is unicode. - The behavior of this method is the same as ResultSet.updateCharacterStream() - when the designated column of the ResultSet has a type java.sql.Types of SQLXML. -

        - The SQL XML object becomes not writable when this method is called and - may also become not readable depending on implementation.

        -
        -
        Specified by:
        -
        setCharacterStream in interface java.sql.SQLXML
        -
        Returns:
        -
        a stream to which data can be written.
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value. - The getCause() method of the exception may provide a more detailed exception, for example, - if the stream does not contain valid characters. - An exception is thrown if the state is not writable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6 Build 79
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString()
        -                           throws java.sql.SQLException
        -
        Returns a string representation of the XML value designated by this SQLXML instance. - The format of this String is defined by org.xml.sax.InputSource, - where the characters in the stream represent the unicode code points for - XML according to section 2 and appendix B of the XML 1.0 specification. - Although an encoding declaration other than unicode may be present, - the encoding of the String is unicode. - The behavior of this method is the same as ResultSet.getString() - when the designated column of the ResultSet has a type java.sql.Types of SQLXML. -

        - The SQL XML object becomes not readable when this method is called and - may also become not writable depending on implementation.

        -
        -
        Specified by:
        -
        getString in interface java.sql.SQLXML
        -
        Returns:
        -
        a string representation of the XML value designated by this SQLXML instance.
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value. - The getCause() method of the exception may provide a more detailed exception, for example, - if the stream does not contain valid characters. - An exception is thrown if the state is not readable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        setString

        -
        public void setString​(java.lang.String value)
        -               throws java.sql.SQLException
        -
        Sets the XML value designated by this SQLXML instance to the given String representation. - The format of this String is defined by org.xml.sax.InputSource, - where the characters in the stream represent the unicode code points for - XML according to section 2 and appendix B of the XML 1.0 specification. - Although an encoding declaration other than unicode may be present, - the encoding of the String is unicode. - The behavior of this method is the same as ResultSet.updateString() - when the designated column of the ResultSet has a type java.sql.Types of SQLXML. -

        - The SQL XML object becomes not writeable when this method is called and - may also become not readable depending on implementation.

        -
        -
        Specified by:
        -
        setString in interface java.sql.SQLXML
        -
        Parameters:
        -
        value - the XML value
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value. - The getCause() method of the exception may provide a more detailed exception, for example, - if the stream does not contain valid characters. - An exception is thrown if the state is not writable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6
        -
        -
      • -
      - - - -
        -
      • -

        getSource

        -
        public <T extends javax.xml.transform.Source> T getSource​(java.lang.Class<T> sourceClass)
        -                                                   throws java.sql.SQLException
        -
        Returns a Source for reading the XML value designated by this SQLXML instance. - Sources are used as inputs to XML parsers and XSLT transformers. -

        - Sources for XML parsers will have namespace processing on by default. - The systemID of the Source is implementation dependent. -

        - The SQL XML object becomes not readable when this method is called and - may also become not writable depending on implementation. -

        - Note that SAX is a callback architecture, so a returned - SAXSource should then be set with a content handler that will - receive the SAX events from parsing. The content handler - will receive callbacks based on the contents of the XML. -

        -   SAXSource saxSource = sqlxml.getSource(SAXSource.class);
        -   XMLReader xmlReader = saxSource.getXMLReader();
        -   xmlReader.setContentHandler(myHandler);
        -   xmlReader.parse(saxSource.getInputSource());
        - 
        -
        -
        Specified by:
        -
        getSource in interface java.sql.SQLXML
        -
        Parameters:
        -
        sourceClass - The class of the source, or null. - If the class is null, a vendor specific Source implementation will be returned. - The following classes are supported at a minimum: -
        -   javax.xml.transform.dom.DOMSource - returns a DOMSource
        -   javax.xml.transform.sax.SAXSource - returns a SAXSource
        -   javax.xml.transform.stax.StAXSource - returns a StAXSource
        -   javax.xml.transform.stream.StreamSource - returns a StreamSource
        - 
        -
        Returns:
        -
        a Source for reading the XML value.
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value - or if this feature is not supported. - The getCause() method of the exception may provide a more detailed exception, for example, - if an XML parser exception occurs. - An exception is thrown if the state is not readable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6 Build 79
        -
        -
      • -
      - - - -
        -
      • -

        setResult

        -
        public <T extends javax.xml.transform.Result> T setResult​(java.lang.Class<T> resultClass)
        -                                                   throws java.sql.SQLException
        -
        Returns a Result for setting the XML value designated by this SQLXML instance. -

        - The systemID of the Result is implementation dependent. -

        - The SQL XML object becomes not writable when this method is called and - may also become not readable depending on implementation. -

        - Note that SAX is a callback architecture and the returned - SAXResult has a content handler assigned that will receive the - SAX events based on the contents of the XML. Call the content - handler with the contents of the XML document to assign the values. -

        -   SAXResult saxResult = sqlxml.getResult(SAXResult.class);
        -   ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
        -   contentHandler.startDocument();
        -   // set the XML elements and attributes into the result
        -   contentHandler.endDocument();
        - 
        -
        -
        Specified by:
        -
        setResult in interface java.sql.SQLXML
        -
        Parameters:
        -
        resultClass - The class of the result, or null. - If resultClass is null, a vendor specific Result implementation will be returned. - The following classes are supported at a minimum: -
        -   javax.xml.transform.dom.DOMResult - returns a DOMResult
        -   javax.xml.transform.sax.SAXResult - returns a SAXResult
        -   javax.xml.transform.stax.StAXResult - returns a StAXResult
        -   javax.xml.transform.stream.StreamResult - returns a StreamResult
        - 
        -
        Returns:
        -
        Returns a Result for setting the XML value.
        -
        Throws:
        -
        java.sql.SQLException - if there is an error processing the XML value - or if this feature is not supported. - The getCause() method of the exception may provide a more detailed exception, for example, - if an XML parser exception occurs. - An exception is thrown if the state is not writable.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        Since:
        -
        JDK 1.6 Build 79
        -
        -
      • -
      - - - -
        -
      • -

        isReadable

        -
        public boolean isReadable()
        -
        Retrieves the object's readability status.
        -
        -
        Returns:
        -
        if true, then readable; else not readable
        -
        -
      • -
      - - - -
        -
      • -

        isWritable

        -
        public boolean isWritable()
        -
        Retrieves the object's readability status.
        -
        -
        Returns:
        -
        if true, then writable; else not writable
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSavepoint.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSavepoint.html deleted file mode 100644 index 3e35f005..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCSavepoint.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - -JDBCSavepoint (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCSavepoint

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCSavepoint
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.sql.Savepoint
    -
    -
    -
    public class JDBCSavepoint
    -extends java.lang.Object
    -implements java.sql.Savepoint
    -
    The representation of a savepoint, which is a point within - the current transaction that can be referenced from the - Connection.rollback method. When a transaction - is rolled back to a savepoint all changes made after that - savepoint are undone. -

    - Savepoints can be either named or unnamed. Unnamed savepoints - are identified by an ID generated by the underlying data source. - - -

    -

    HSQLDB-Specific Information:

    - - SQL 2003 standard does not support unnamed savepoints. However, this - feature is supported from version 2.0.

    - - If the connection is autoCommit, setting savepoints has no effect as any - such savepoint is cleared upon the execution of the first transactional - statement.

    - -

    -
    -
    -
    Since:
    -
    JDK 1.4, HSQLDB 1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intgetSavepointId() -
      Retrieves the generated ID for the savepoint that this - Savepoint object represents.
      -
      java.lang.StringgetSavepointName() -
      Retrieves the name of the savepoint that this Savepoint - object represents.
      -
      java.lang.StringtoString() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getSavepointId

        -
        public int getSavepointId()
        -                   throws java.sql.SQLException
        -
        Retrieves the generated ID for the savepoint that this - Savepoint object represents.
        -
        -
        Specified by:
        -
        getSavepointId in interface java.sql.Savepoint
        -
        Returns:
        -
        the numeric ID of this savepoint
        -
        Throws:
        -
        java.sql.SQLException - if this is a named savepoint
        -
        Since:
        -
        1.4
        -
        -
      • -
      - - - -
        -
      • -

        getSavepointName

        -
        public java.lang.String getSavepointName()
        -                                  throws java.sql.SQLException
        -
        Retrieves the name of the savepoint that this Savepoint - object represents.
        -
        -
        Specified by:
        -
        getSavepointName in interface java.sql.Savepoint
        -
        Returns:
        -
        the name of this savepoint
        -
        Throws:
        -
        java.sql.SQLException - if this is an un-named savepoint
        -
        Since:
        -
        1.4
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCStatement.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCStatement.html deleted file mode 100644 index 64e0330a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCStatement.html +++ /dev/null @@ -1,3010 +0,0 @@ - - - - - -JDBCStatement (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCStatement

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCStatement
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.lang.AutoCloseable, java.sql.Statement, java.sql.Wrapper
    -
    -
    -
    public class JDBCStatement
    -extends java.lang.Object
    -implements java.sql.Statement, java.sql.Wrapper
    -
    - The object used for executing a static SQL statement - and returning the results it produces. -

    - By default, only one ResultSet object per Statement - object can be open at the same time. Therefore, if the reading of one - ResultSet object is interleaved - with the reading of another, each must have been generated by - different Statement objects. All execution methods in the - Statement interface implicitly close a statement's current - ResultSet object if an open one exists. - - - -

    -

    HSQLDB-Specific Information:

    - From version 2.0, the implementation meets the JDBC specification - requirement that any existing ResultSet is closed when execute() or - executeQuery() methods are called. The connection property close_result=true - is required for this behaviour.

    - - Methods added in JAVA 8 are generally supported when the HSQLDB jar is compiled - with JDK 8. -

    - - (fredt@users)
    - (campbell-burnet@users)

    - -

    -
    -
    -
    Since:
    -
    HSQLDB 1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    JDBCConnection.createStatement(), -JDBCResultSet
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static intRETURN_PRIMARY_KEYS 
      -
        -
      • - - -

        Fields inherited from interface java.sql.Statement

        -CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidaddBatch​(java.lang.String sql) -
      Adds the given SQL command to the current list of commands for this - Statement object.
      -
      voidcancel() -
      Cancels this Statement object if both the DBMS and - driver support aborting an SQL statement.
      -
      voidclearBatch() -
      Empties this Statement object's current list of - SQL commands.
      -
      voidclearWarnings() -
      Clears all the warnings reported on this Statement - object.
      -
      voidclose() -
      Releases this Statement object's database - and JDBC resources immediately instead of waiting for - this to happen when it is automatically closed.
      -
      voidcloseOnCompletion() -
      Specifies that this Statement will be closed when all its - dependent result sets are closed.
      -
      booleanexecute​(java.lang.String sql) -
      Executes the given SQL statement, which may return multiple results.
      -
      booleanexecute​(java.lang.String sql, - int autoGeneratedKeys) -
      Executes the given SQL statement, which may return multiple results, - and signals the driver that any - auto-generated keys should be made available - for retrieval.
      -
      booleanexecute​(java.lang.String sql, - int[] columnIndexes) -
      Executes the given SQL statement, which may return multiple results, - and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
      -
      booleanexecute​(java.lang.String sql, - java.lang.String[] columnNames) -
      Executes the given SQL statement, which may return multiple results, - and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
      -
      int[]executeBatch() -
      Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
      -
      long[]executeLargeBatch() -
      Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts.
      -
      longexecuteLargeUpdate​(java.lang.String sql) -
      Executes the given SQL statement, which may be an INSERT, - UPDATE, or DELETE statement or an - SQL statement that returns nothing, such as an SQL DDL statement.
      -
      longexecuteLargeUpdate​(java.lang.String sql, - int autoGeneratedKeys) -
      Executes the given SQL statement and signals the driver with the - given flag about whether the - auto-generated keys produced by this Statement object - should be made available for retrieval.
      -
      longexecuteLargeUpdate​(java.lang.String sql, - int[] columnIndexes) -
      Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
      -
      longexecuteLargeUpdate​(java.lang.String sql, - java.lang.String[] columnNames) -
      Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
      -
      java.sql.ResultSetexecuteQuery​(java.lang.String sql) -
      Executes the given SQL statement, which returns a single - ResultSet object.
      -
      intexecuteUpdate​(java.lang.String sql) -
      Executes the given SQL statement, which may be an INSERT, - UPDATE, or DELETE statement or an - SQL statement that returns nothing, such as an SQL DDL statement.
      -
      intexecuteUpdate​(java.lang.String sql, - int autoGeneratedKeys) -
      Executes the given SQL statement and signals the driver with the - given flag about whether the - auto-generated keys produced by this Statement object - should be made available for retrieval.
      -
      intexecuteUpdate​(java.lang.String sql, - int[] columnIndexes) -
      Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
      -
      intexecuteUpdate​(java.lang.String sql, - java.lang.String[] columnNames) -
      Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval.
      -
      java.sql.ConnectiongetConnection() -
      Retrieves the Connection object - that produced this Statement object.
      -
      intgetFetchDirection() -
      Retrieves the direction for fetching rows from - database tables that is the default for result sets - generated from this Statement object.
      -
      intgetFetchSize() -
      Retrieves the number of result set rows that is the default - fetch size for ResultSet objects - generated from this Statement object.
      -
      java.sql.ResultSetgetGeneratedKeys() -
      Retrieves any auto-generated keys created as a result of executing this - Statement object.
      -
      longgetLargeMaxRows() -
      Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
      -
      longgetLargeUpdateCount() -
      Retrieves the current result as an update count; if the result - is a ResultSet object or there are no more results, -1 - is returned.
      -
      intgetMaxFieldSize() -
      Retrieves the maximum number of bytes that can be - returned for character and binary column values in a ResultSet - object produced by this Statement object.
      -
      intgetMaxRows() -
      Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain.
      -
      booleangetMoreResults() -
      Moves to this Statement object's next result, returns - true if it is a ResultSet object, and - implicitly closes any current ResultSet - object(s) obtained with the method getResultSet.
      -
      booleangetMoreResults​(int current) -
      Moves to this Statement object's next result, deals with - any current ResultSet object(s) according to the instructions - specified by the given flag, and returns - true if the next result is a ResultSet object.
      -
      intgetQueryTimeout() -
      Retrieves the number of seconds the driver will - wait for a Statement object to execute.
      -
      java.sql.ResultSetgetResultSet() -
      Retrieves the current result as a ResultSet object.
      -
      intgetResultSetConcurrency() -
      Retrieves the result set concurrency for ResultSet objects - generated by this Statement object.
      -
      intgetResultSetHoldability() -
      Retrieves the result set holdability for ResultSet objects - generated by this Statement object.
      -
      intgetResultSetScrollability() 
      intgetResultSetType() -
      Retrieves the result set type for ResultSet objects - generated by this Statement object.
      -
      intgetUpdateCount() -
      Retrieves the current result as an update count; - if the result is a ResultSet object or there are no more results, -1 - is returned.
      -
      java.sql.SQLWarninggetWarnings() -
      Retrieves the first warning reported by calls on this Statement object.
      -
      booleanisClosed() -
      Retrieves whether this Statement object has been closed.
      -
      booleanisCloseOnCompletion() -
      Returns a value indicating whether this Statement will be - closed when all its dependent result sets are closed.
      -
      booleanisPoolable() -
      Returns a value indicating whether the Statement - is poolable or not.
      -
      booleanisWrapperFor​(java.lang.Class<?> iface) -
      Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does.
      -
      voidsetCursorName​(java.lang.String name) -
      Sets the SQL cursor name to the given String, which - will be used by subsequent Statement object - execute methods.
      -
      voidsetEscapeProcessing​(boolean enable) -
      Sets escape processing on or off.
      -
      voidsetFetchDirection​(int direction) -
      Gives the driver a hint as to the direction in which - rows will be processed in ResultSet - objects created using this Statement object.
      -
      voidsetFetchSize​(int rows) -
      (JDBC4 clarification:) - Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for - ResultSet objects generated by this Statement.
      -
      voidsetLargeMaxRows​(long max) -
      Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
      -
      voidsetMaxFieldSize​(int max) -
      (JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - Sets the limit for the maximum number of bytes that can be returned for - character and binary column values in a ResultSet - object produced by this Statement object.
      -
      voidsetMaxRows​(int max) -
      (JDBC4 clarification:) - Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number.
      -
      voidsetPoolable​(boolean poolable) -
      Requests that a Statement be pooled or not pooled.
      -
      voidsetQueryTimeout​(int seconds) -
      Sets the number of seconds the driver will wait for a - Statement object to execute to the given number of seconds.
      -
      <T> Tunwrap​(java.lang.Class<T> iface) -
      Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.sql.Statement

        -closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, isCloseOnCompletion, isSimpleIdentifier
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        executeQuery

        -
        public java.sql.ResultSet executeQuery​(java.lang.String sql)
        -                                throws java.sql.SQLException
        -
        - Executes the given SQL statement, which returns a single - ResultSet object. - - - -
        -

        HSQLDB-Specific Information:

        - - This method should not be used for statements other than SELECT queries.

        - - From 2.0, HSQLDB throws an exception when the statement - is a DDL statement or an UPDATE or DELETE statement. -

        -
        -
        -
        Specified by:
        -
        executeQuery in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL statement to be sent to the database, typically a - static SQL SELECT statement
        -
        Returns:
        -
        a ResultSet object that contains the data produced - by the given query; never null
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the given - SQL statement produces anything other than a single - ResultSet object
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql)
        -                  throws java.sql.SQLException
        -
        - Executes the given SQL statement, which may be an INSERT, - UPDATE, or DELETE statement or an - SQL statement that returns nothing, such as an SQL DDL statement. -
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - (JDBC4 clarification:) an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
        -
        Returns:
        -
        (JDBC4 clarification:) either (1) the row count for SQL Data Manipulation Language (DML) statements - or (2) 0 for SQL statements that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the given - SQL statement produces a ResultSet object
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.sql.SQLException
        -
        - Releases this Statement object's database - and JDBC resources immediately instead of waiting for - this to happen when it is automatically closed. - It is generally good practice to release resources as soon as - you are finished with them to avoid tying up database - resources. -

        - Calling the method close on a Statement - object that is already closed has no effect. -

        - Note:When a Statement object is - closed, its current ResultSet object, if one exists, is - also closed. - (JDBC4 deleted:) [A Statement object is - automatically closed when it is garbage collected.] -

        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs
        -
        -
      • -
      - - - -
        -
      • -

        getMaxFieldSize

        -
        public int getMaxFieldSize()
        -                    throws java.sql.SQLException
        -
        - Retrieves the maximum number of bytes that can be - returned for character and binary column values in a ResultSet - object produced by this Statement object. - This limit applies only to BINARY, VARBINARY, - LONGVARBINARY, CHAR, VARCHAR, - (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR - and LONGVARCHAR columns. If the limit is exceeded, the - excess data is silently discarded. - - - -
        -

        HSQLDB-Specific Information:

        - - Including 1.7.2, HSQLDB always returns zero, meaning there - is no limit. -

        -
        -
        -
        Specified by:
        -
        getMaxFieldSize in interface java.sql.Statement
        -
        Returns:
        -
        the current column size limit for columns storing character and - binary values; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        setMaxFieldSize(int)
        -
        -
      • -
      - - - -
        -
      • -

        setMaxFieldSize

        -
        public void setMaxFieldSize​(int max)
        -                     throws java.sql.SQLException
        -
        - (JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - Sets the limit for the maximum number of bytes that can be returned for - character and binary column values in a ResultSet - object produced by this Statement object. - - This limit applies - only to BINARY, VARBINARY, - LONGVARBINARY, CHAR, VARCHAR, - (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR and - LONGVARCHAR fields. If the limit is exceeded, the excess data - is silently discarded. For maximum portability, use values - greater than 256. - - - -
        -

        HSQLDB-Specific Information:

        - - To present, calls to this method are simply ignored; HSQLDB always - stores the full number of bytes when dealing with any of the field types - mentioned above. These types all have an absolute maximum element upper - bound determined by the Java array index limit - java.lang.Integer.MAX_VALUE. For XXXBINARY types, this translates to - Integer.MAX_VALUE bytes. For XXXCHAR types, this translates to - 2 * Integer.MAX_VALUE bytes (2 bytes / character).

        - - In practice, field sizes are limited to values much smaller than the - absolute maximum element upper bound, in particular due to limits imposed - on the maximum available Java heap memory. -

        -
        -
        -
        Specified by:
        -
        setMaxFieldSize in interface java.sql.Statement
        -
        Parameters:
        -
        max - the new column size limit in bytes; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition max >= 0 is not satisfied
        -
        See Also:
        -
        getMaxFieldSize()
        -
        -
      • -
      - - - -
        -
      • -

        getMaxRows

        -
        public int getMaxRows()
        -               throws java.sql.SQLException
        -
        - Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain. If this limit is exceeded, - the excess rows are silently dropped. -
        -
        -
        Specified by:
        -
        getMaxRows in interface java.sql.Statement
        -
        Returns:
        -
        the current maximum number of rows for a ResultSet - object produced by this Statement object; - zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        setMaxRows(int)
        -
        -
      • -
      - - - -
        -
      • -

        setMaxRows

        -
        public void setMaxRows​(int max)
        -                throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number. - If the limit is exceeded, the excess - rows are silently dropped. -
        -
        -
        Specified by:
        -
        setMaxRows in interface java.sql.Statement
        -
        Parameters:
        -
        max - the new max rows limit; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition max >= 0 is not satisfied
        -
        See Also:
        -
        getMaxRows()
        -
        -
      • -
      - - - -
        -
      • -

        setEscapeProcessing

        -
        public void setEscapeProcessing​(boolean enable)
        -                         throws java.sql.SQLException
        -
        - Sets escape processing on or off. - If escape scanning is on (the default), the driver will do - escape substitution before sending the SQL statement to the database. - - Note: Since prepared statements have usually been parsed prior - to making this call, disabling escape processing for - PreparedStatements objects will have no effect. -
        -
        -
        Specified by:
        -
        setEscapeProcessing in interface java.sql.Statement
        -
        Parameters:
        -
        enable - true to enable escape processing; - false to disable it
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        -
      • -
      - - - -
        -
      • -

        getQueryTimeout

        -
        public int getQueryTimeout()
        -                    throws java.sql.SQLException
        -
        - Retrieves the number of seconds the driver will - wait for a Statement object to execute. - If the limit is exceeded, a - SQLException is thrown. - - - -
        -

        HSQLDB-Specific Information:

        - - To present, HSQLDB always returns zero, meaning there - is no limit. -

        -
        -
        -
        Specified by:
        -
        getQueryTimeout in interface java.sql.Statement
        -
        Returns:
        -
        the current query timeout limit in seconds; zero means there is - no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        setQueryTimeout(int)
        -
        -
      • -
      - - - -
        -
      • -

        setQueryTimeout

        -
        public void setQueryTimeout​(int seconds)
        -                     throws java.sql.SQLException
        -
        - Sets the number of seconds the driver will wait for a - Statement object to execute to the given number of seconds. - If the limit is exceeded, an SQLException is thrown. A JDBC - (JDBC4 clarification:) - driver must apply this limit to the execute, - executeQuery and executeUpdate methods. JDBC driver - implementations may also apply this limit to ResultSet methods - (consult your driver vendor documentation for details). - - - -
        -

        HSQLDB-Specific Information:

        - - The maximum number of seconds to wait is 32767. -

        -
        -
        -
        Specified by:
        -
        setQueryTimeout in interface java.sql.Statement
        -
        Parameters:
        -
        seconds - the new query timeout limit in seconds; zero means - there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition seconds >= 0 is not satisfied
        -
        See Also:
        -
        getQueryTimeout()
        -
        -
      • -
      - - - -
        -
      • -

        cancel

        -
        public void cancel()
        -            throws java.sql.SQLException
        -
        - Cancels this Statement object if both the DBMS and - driver support aborting an SQL statement. - This method can be used by one thread to cancel a statement that - is being executed by another thread. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB version 2.3.4 and later supports aborting an SQL query - or data update statement. -

        -
        -
        -
        Specified by:
        -
        cancel in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        -
      • -
      - - - -
        -
      • -

        getWarnings

        -
        public java.sql.SQLWarning getWarnings()
        -                                throws java.sql.SQLException
        -
        - Retrieves the first warning reported by calls on this Statement object. - Subsequent Statement object warnings will be chained to this - SQLWarning object. - -

        The warning chain is automatically cleared each time - a statement is (re)executed. This method may not be called on a closed - Statement object; doing so will cause an SQLException - to be thrown. - -

        Note: If you are processing a ResultSet object, any - warnings associated with reads on that ResultSet object - will be chained on it rather than on the Statement - object that produced it. - - - -

        -

        HSQLDB-Specific Information:

        - - In 2.0, HSQLDB may produces Statement warnings; - this method always returns null. -

        -
        -
        -
        Specified by:
        -
        getWarnings in interface java.sql.Statement
        -
        Returns:
        -
        the first SQLWarning object or null - if there are no warnings
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        -
      • -
      - - - -
        -
      • -

        clearWarnings

        -
        public void clearWarnings()
        -                   throws java.sql.SQLException
        -
        - Clears all the warnings reported on this Statement - object. After a call to this method, - the method getWarnings will return - null until a new warning is reported for this - Statement object. - - - -
        -

        HSQLDB-Specific Information:

        - - In HSQLDB 2.0, SQLWarning objects may - be produced for Statement Objects; calls to this method clear the warnings. -

        -
        -
        -
        Specified by:
        -
        clearWarnings in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        -
      • -
      - - - -
        -
      • -

        setCursorName

        -
        public void setCursorName​(java.lang.String name)
        -                   throws java.sql.SQLException
        -
        - Sets the SQL cursor name to the given String, which - will be used by subsequent Statement object - execute methods. This name can then be - used in SQL positioned update or delete statements to identify the - current row in the ResultSet object generated by this - statement. If the database does not support positioned update/delete, - this method is a noop. To ensure that a cursor has the proper isolation - level to support updates, the cursor's SELECT statement - should have the form SELECT FOR UPDATE. If - FOR UPDATE is not present, positioned updates may fail. - -

        Note: By definition, the execution of positioned updates and - deletes must be done by a different Statement object than - the one that generated the ResultSet object being used for - positioning. Also, cursor names must be unique within a connection. - - - -

        -

        HSQLDB-Specific Information:

        - - Including 2.0, HSQLDB does not support named cursors; - calls to this method are ignored. -

        -
        -
        -
        Specified by:
        -
        setCursorName in interface java.sql.Statement
        -
        Parameters:
        -
        name - the new cursor name, which must be unique within - a connection
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql)
        -                throws java.sql.SQLException
        -
        - Executes the given SQL statement, which may return multiple results. - In some (uncommon) situations, a single SQL statement may return - multiple result sets and/or update counts. Normally you can ignore - this unless you are (1) executing a stored procedure that you know may - return multiple results or (2) you are dynamically executing an - unknown SQL string. -

        - The execute method executes an SQL statement and indicates the - form of the first result. You must then use the methods - getResultSet or getUpdateCount - to retrieve the result, and getMoreResults to - move to any subsequent result(s). -

        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Parameters:
        -
        sql - any SQL statement
        -
        Returns:
        -
        true if the first result is a ResultSet - object; false if it is an update count or there are - no results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        getResultSet(), -getUpdateCount(), -getMoreResults()
        -
        -
      • -
      - - - -
        -
      • -

        getResultSet

        -
        public java.sql.ResultSet getResultSet()
        -                                throws java.sql.SQLException
        -
        - Retrieves the current result as a ResultSet object. - This method should be called only once per result. - - - -
        -

        HSQLDB-Specific Information:

        - -

        -
        -
        -
        Specified by:
        -
        getResultSet in interface java.sql.Statement
        -
        Returns:
        -
        the current result as a ResultSet object or - null if the result is an update count or there are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        execute(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        getUpdateCount

        -
        public int getUpdateCount()
        -                   throws java.sql.SQLException
        -
        - Retrieves the current result as an update count; - if the result is a ResultSet object or there are no more results, -1 - is returned. This method should be called only once per result. -
        -
        -
        Specified by:
        -
        getUpdateCount in interface java.sql.Statement
        -
        Returns:
        -
        the current result as an update count; -1 if the current result is a - ResultSet object or there are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        execute(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        getMoreResults

        -
        public boolean getMoreResults()
        -                       throws java.sql.SQLException
        -
        - Moves to this Statement object's next result, returns - true if it is a ResultSet object, and - implicitly closes any current ResultSet - object(s) obtained with the method getResultSet. - -

        There are no more results when the following is true: -

        -     // stmt is a Statement object 
        -     ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
        - 
        -
        -
        -
        Specified by:
        -
        getMoreResults in interface java.sql.Statement
        -
        Returns:
        -
        true if the next result is a ResultSet - object; false if it is an update count or there are - no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        See Also:
        -
        execute(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        setFetchDirection

        -
        public void setFetchDirection​(int direction)
        -                       throws java.sql.SQLException
        -
        - Gives the driver a hint as to the direction in which - rows will be processed in ResultSet - objects created using this Statement object. The - default value is ResultSet.FETCH_FORWARD. -

        - Note that this method sets the default fetch direction for - result sets generated by this Statement object. - Each result set has its own methods for getting and setting - its own fetch direction. - - - -

        -

        HSQLDB-Specific Information:

        - - HSQLDB accepts all valid parameters.

        -

        -
        -
        -
        Specified by:
        -
        setFetchDirection in interface java.sql.Statement
        -
        Parameters:
        -
        direction - the initial direction for processing rows
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the given direction - is not one of ResultSet.FETCH_FORWARD, - ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        getFetchDirection()
        -
        -
      • -
      - - - -
        -
      • -

        getFetchDirection

        -
        public int getFetchDirection()
        -                      throws java.sql.SQLException
        -
        - Retrieves the direction for fetching rows from - database tables that is the default for result sets - generated from this Statement object. - If this Statement object has not set - a fetch direction by calling the method setFetchDirection, - the return value is implementation-specific. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB returns the fetch direction.

        -

        -
        -
        -
        Specified by:
        -
        getFetchDirection in interface java.sql.Statement
        -
        Returns:
        -
        the default fetch direction for result sets generated - from this Statement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setFetchDirection(int)
        -
        -
      • -
      - - - -
        -
      • -

        setFetchSize

        -
        public void setFetchSize​(int rows)
        -                  throws java.sql.SQLException
        -
        - (JDBC4 clarification:) - Gives the JDBC driver a hint as to the number of rows that should - be fetched from the database when more rows are needed for - ResultSet objects generated by this Statement. - If the value specified is zero, then the hint is ignored. - The default value is zero. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB uses the specified value as a hint, but may process more or fewer - rows than specified. -

        -
        -
        -
        Specified by:
        -
        setFetchSize in interface java.sql.Statement
        -
        Parameters:
        -
        rows - the number of rows to fetch
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - (JDBC4 modified:) - condition rows >= 0 is not satisfied.
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        getFetchSize()
        -
        -
      • -
      - - - -
        -
      • -

        getFetchSize

        -
        public int getFetchSize()
        -                 throws java.sql.SQLException
        -
        - Retrieves the number of result set rows that is the default - fetch size for ResultSet objects - generated from this Statement object. - If this Statement object has not set - a fetch size by calling the method setFetchSize, - the return value is implementation-specific. - - - -
        - HSQLDB-Specific Information

        - - HSQLDB returns 0 by default, or the fetch size specified by setFetchSize -

        -
        -
        -
        Specified by:
        -
        getFetchSize in interface java.sql.Statement
        -
        Returns:
        -
        the default fetch size for result sets generated - from this Statement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        setFetchSize(int)
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetConcurrency

        -
        public int getResultSetConcurrency()
        -                            throws java.sql.SQLException
        -
        - Retrieves the result set concurrency for ResultSet objects - generated by this Statement object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB supports CONCUR_READ_ONLY and - CONCUR_UPDATABLE concurrency. -

        -
        -
        -
        Specified by:
        -
        getResultSetConcurrency in interface java.sql.Statement
        -
        Returns:
        -
        either ResultSet.CONCUR_READ_ONLY or - ResultSet.CONCUR_UPDATABLE
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetType

        -
        public int getResultSetType()
        -                     throws java.sql.SQLException
        -
        - Retrieves the result set type for ResultSet objects - generated by this Statement object. - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB 1.7.0 and later versions support TYPE_FORWARD_ONLY - and TYPE_SCROLL_INSENSITIVE. -

        -
        -
        -
        Specified by:
        -
        getResultSetType in interface java.sql.Statement
        -
        Returns:
        -
        one of ResultSet.TYPE_FORWARD_ONLY, - ResultSet.TYPE_SCROLL_INSENSITIVE, or - ResultSet.TYPE_SCROLL_SENSITIVE
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        addBatch

        -
        public void addBatch​(java.lang.String sql)
        -              throws java.sql.SQLException
        -
        - Adds the given SQL command to the current list of commands for this - Statement object. The commands in this list can be - executed as a batch by calling the method executeBatch. -

        - (JDBC4 clarification:)

        - NOTE: Support of an ability to batch updates is optional. - - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with 1.7.2, this feature is supported. -

        -
        -
        -
        Specified by:
        -
        addBatch in interface java.sql.Statement
        -
        Parameters:
        -
        sql - typically this is a SQL INSERT or - UPDATE statement - (:JDBC4 modified)
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - driver does not support batch updates
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        executeBatch()
        -
        -
      • -
      - - - -
        -
      • -

        clearBatch

        -
        public void clearBatch()
        -                throws java.sql.SQLException
        -
        - Empties this Statement object's current list of - SQL commands. -

        - (JDBC4 clarification:)

        - NOTE: Support of an ability to batch updates is optional. - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 1.7.2, this feature is supported. -

        -
        -
        -
        Specified by:
        -
        clearBatch in interface java.sql.Statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - driver does not support batch updates
        -
        Since:
        -
        JDK 1.2
        -
        See Also:
        -
        addBatch(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        executeBatch

        -
        public int[] executeBatch()
        -                   throws java.sql.SQLException
        -
        - Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts. - The int elements of the array that is returned are ordered - to correspond to the commands in the batch, which are ordered - according to the order in which they were added to the batch. - The elements in the array returned by the method executeBatch - may be one of the following: -
          -
        1. A number greater than or equal to zero -- indicates that the - command was processed successfully and is an update count giving the - number of rows in the database that were affected by the command's - execution -
        2. A value of SUCCESS_NO_INFO -- indicates that the command was - processed successfully but that the number of rows affected is - unknown -

          - If one of the commands in a batch update fails to execute properly, - this method throws a BatchUpdateException, and a JDBC - driver may or may not continue to process the remaining commands in - the batch. However, the driver's behavior must be consistent with a - particular DBMS, either always continuing to process commands or never - continuing to process commands. If the driver continues processing - after a failure, the array returned by the method - BatchUpdateException.getUpdateCounts - will contain as many elements as there are commands in the batch, and - at least one of the elements will be the following: - -

        3. A value of EXECUTE_FAILED -- indicates that the command failed - to execute successfully and occurs only if a driver continues to - process commands after a command fails -
        -

        - (JDBC4 clarification:)

        - NOTE: Support of an ability to batch updates is optional. -

        - The possible implementations and return values have been modified in - the Java 2 SDK, Standard Edition, version 1.3 to - accommodate the option of continuing to process commands in a batch - update after a BatchUpdateException object has been thrown. - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with HSQLDB 1.7.2, this feature is supported.

        - - HSQLDB stops execution of commands in a batch when one of the commands - results in an exception. The size of the returned array equals the - number of commands that were executed successfully.

        - -

        -
        -
        -
        Specified by:
        -
        executeBatch in interface java.sql.Statement
        -
        Returns:
        -
        an array of update counts containing one element for each - command in the batch. The elements of the array are ordered according - to the order in which commands were added to the batch.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - driver does not support batch statements. Throws BatchUpdateException - (a subclass of SQLException) if one of the commands sent to the - database fails to execute properly or attempts to return a result set.
        -
        Since:
        -
        JDK 1.3
        -
        See Also:
        -
        addBatch(java.lang.String), -DatabaseMetaData.supportsBatchUpdates()
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException
        -
        - Retrieves the Connection object - that produced this Statement object. -
        -
        -
        Specified by:
        -
        getConnection in interface java.sql.Statement
        -
        Returns:
        -
        the connection that produced this statement
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.2
        -
        -
      • -
      - - - -
        -
      • -

        getMoreResults

        -
        public boolean getMoreResults​(int current)
        -                       throws java.sql.SQLException
        -
        - Moves to this Statement object's next result, deals with - any current ResultSet object(s) according to the instructions - specified by the given flag, and returns - true if the next result is a ResultSet object. - -

        There are no more results when the following is true: -

        -     // stmt is a Statement object
        -     ((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1))
        - 
        - - - -
        -

        HSQLDB-Specific Information:

        - - HSQLDB moves to the next ResultSet and returns the correct result.

        -

        -
        -
        -
        Specified by:
        -
        getMoreResults in interface java.sql.Statement
        -
        Parameters:
        -
        current - one of the following Statement - constants indicating what should happen to current - ResultSet objects obtained using the method - getResultSet: - Statement.CLOSE_CURRENT_RESULT, - Statement.KEEP_CURRENT_RESULT, or - Statement.CLOSE_ALL_RESULTS
        -
        Returns:
        -
        true if the next result is a ResultSet - object; false if it is an update count or there are no - more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the argument - supplied is not one of the following: - Statement.CLOSE_CURRENT_RESULT, - Statement.KEEP_CURRENT_RESULT, or - Statement.CLOSE_ALL_RESULTS
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        execute(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        getGeneratedKeys

        -
        public java.sql.ResultSet getGeneratedKeys()
        -                                    throws java.sql.SQLException
        -
        - Retrieves any auto-generated keys created as a result of executing this - Statement object. If this Statement object did - not generate any keys, an empty ResultSet - object is returned. -

        (JDBC4 clarification:) -

        Note:If the columns which represent the auto-generated keys were not specified, - the JDBC driver implementation will determine the columns which best represent the auto-generated keys. - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports this feature with single-row - and multi-row insert, update and merge statements.

        - - This method returns a result set only if - the executeUpdate methods that was used is one of the three methods that - have the extra parameter indicating return of generated keys

        - - If the executeUdate method did not specify the columns which represent - the auto-generated keys the IDENTITY column or GENERATED column(s) of the - table are returned.

        - - The executeUpdate methods with column indexes or column names return the - post-insert or post-update values of the specified columns, whether the - columns are generated or not. This allows values that have been modified - by execution of triggers to be returned.

        - - If column names or indexes provided by the user in the executeUpdate() - method calls do not correspond to table columns (incorrect names or - indexes larger than the column count), an empty result is returned. - -

        -
        -
        -
        Specified by:
        -
        getGeneratedKeys in interface java.sql.Statement
        -
        Returns:
        -
        a ResultSet object containing the auto-generated key(s) - generated by the execution of this Statement object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql,
        -                         int autoGeneratedKeys)
        -                  throws java.sql.SQLException
        -
        - Executes the given SQL statement and signals the driver with the - given flag about whether the - auto-generated keys produced by this Statement object - should be made available for retrieval. The driver will ignore the - flag if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). - - - -
        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports returning generated columns - with single-row and multi-row INSERT, UPDATE and MERGE statements.

        - If the table has an IDENTITY or GENERATED column(s) the values for these - columns are returned in the next call to getGeneratedKeys(). - - HSQLDB also supports returning primary key values from the rows by using the - org.hsqldb.jdbc.JDBCStatement.RETURN_PRIMARY_KEYS constant. - -

        -
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement. - (:JDBC4 clarification)
        -
        autoGeneratedKeys - a flag indicating whether auto-generated keys - should be made available for retrieval; - one of the following constants: - Statement.RETURN_GENERATED_KEYS - Statement.NO_GENERATED_KEYS
        -
        Returns:
        -
        either (1) the row count for SQL Data Manipulation Language (DML) statements - or (2) 0 for SQL statements that return nothing - (:JDBC4 clarification)
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement, the given - SQL statement returns a ResultSet object, or - the given constant is not one of those allowed
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method with a constant of Statement.RETURN_GENERATED_KEYS
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql,
        -                         int[] columnIndexes)
        -                  throws java.sql.SQLException
        -
        - Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval. The driver will ignore the array if the SQL statement - is not an INSERT statement, or an SQL statement able to return - (JDBC 4 clarification) - auto-generated keys (the list of such statements is vendor-specific). - - - -
        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports returning generated columns - with single-row and multi-row INSERT, UPDATE and MERGE statements.

        - The columnIndexes may specify any set of columns of the table. - -

        -
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement. - (:JDBC4 clarification)
        -
        columnIndexes - an array of column indexes indicating the columns - that should be returned from the inserted row
        -
        Returns:
        -
        either (1) the row count for SQL Data Manipulation Language (DML) statements - or (2) 0 for SQL statements that return nothing - (:JDBC 4 clarification)
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement, the SQL - statement returns a ResultSet object, or the - second argument supplied to this method is not an int array - whose elements are valid column indexes
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        executeUpdate

        -
        public int executeUpdate​(java.lang.String sql,
        -                         java.lang.String[] columnNames)
        -                  throws java.sql.SQLException
        -
        - Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval. The driver will ignore the array if the SQL statement - (JDBC4 clarification:) - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). - - - -
        -

        HSQLDB-Specific Information:

        - - Starting with version 2.0, HSQLDB supports returning generated columns - with single-row and multi-row INSERT, UPDATE and MERGE statements.

        - The columnNames may specify any set of columns of the table. - -

        -
        -
        -
        Specified by:
        -
        executeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement. - (:JDBC4 clarification)
        -
        columnNames - an array of the names of the columns that should be - returned from the inserted row
        -
        Returns:
        -
        either the row count for INSERT, UPDATE, - or DELETE statements, or 0 for SQL statements - that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement, the SQL - statement returns a ResultSet object, or the - second argument supplied to this method is not a String array - whose elements are valid column names
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql,
        -                       int autoGeneratedKeys)
        -                throws java.sql.SQLException
        -
        - Executes the given SQL statement, which may return multiple results, - and signals the driver that any - auto-generated keys should be made available - for retrieval. The driver will ignore this signal if the SQL statement - is not an INSERT statement, or an SQL statement able to return - (JDBC4 clarification) - auto-generated keys (the list of such statements is vendor-specific). -

        - In some (uncommon) situations, a single SQL statement may return - multiple result sets and/or update counts. Normally you can ignore - this unless you are (1) executing a stored procedure that you know may - return multiple results or (2) you are dynamically executing an - unknown SQL string. -

        - The execute method executes an SQL statement and indicates the - form of the first result. You must then use the methods - getResultSet or getUpdateCount - to retrieve the result, and getMoreResults to - move to any subsequent result(s). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB supports this feature. - - HSQLDB also supports returning primary key values from the rows by using the - org.hsqldb.result.ResultConstants.RETURN_PRIMARY_KEYS constant. - -

        -
        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Parameters:
        -
        sql - any SQL statement
        -
        autoGeneratedKeys - a constant indicating whether auto-generated - keys should be made available for retrieval using the method - getGeneratedKeys; one of the following constants: - Statement.RETURN_GENERATED_KEYS or - Statement.NO_GENERATED_KEYS
        -
        Returns:
        -
        true if the first result is a ResultSet - object; false if it is an update count or there are - no results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the second - parameter supplied to this method is not - Statement.RETURN_GENERATED_KEYS or - Statement.NO_GENERATED_KEYS.
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method with a constant of Statement.RETURN_GENERATED_KEYS
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        getResultSet(), -getUpdateCount(), -getMoreResults(), -getGeneratedKeys()
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql,
        -                       int[] columnIndexes)
        -                throws java.sql.SQLException
        -
        - Executes the given SQL statement, which may return multiple results, - and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval. This array contains the indexes of the columns in the - target table that contain the auto-generated keys that should be made - available. The driver will ignore the array if the SQL statement - (JDBC4 clarification) - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - Under some (uncommon) situations, a single SQL statement may return - multiple result sets and/or update counts. Normally you can ignore - this unless you are (1) executing a stored procedure that you know may - return multiple results or (2) you are dynamically executing an - unknown SQL string. -

        - The execute method executes an SQL statement and indicates the - form of the first result. You must then use the methods - getResultSet or getUpdateCount - to retrieve the result, and getMoreResults to - move to any subsequent result(s). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB supports this feature. - -

        -
        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Parameters:
        -
        sql - any SQL statement
        -
        columnIndexes - an array of the indexes of the columns in the - inserted row that should be made available for retrieval by a - call to the method getGeneratedKeys
        -
        Returns:
        -
        true if the first result is a ResultSet - object; false if it is an update count or there - are no results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - elements in the int array passed to this method - are not valid column indexes
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        getResultSet(), -getUpdateCount(), -getMoreResults()
        -
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public boolean execute​(java.lang.String sql,
        -                       java.lang.String[] columnNames)
        -                throws java.sql.SQLException
        -
        - Executes the given SQL statement, which may return multiple results, - and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval. This array contains the names of the columns in the - target table that contain the auto-generated keys that should be made - available. The driver will ignore the array if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - In some (uncommon) situations, a single SQL statement may return - multiple result sets and/or update counts. Normally you can ignore - this unless you are (1) executing a stored procedure that you know may - return multiple results or (2) you are dynamically executing an - unknown SQL string. -

        - The execute method executes an SQL statement and indicates the - form of the first result. You must then use the methods - getResultSet or getUpdateCount - to retrieve the result, and getMoreResults to - move to any subsequent result(s). - - - -

        -

        HSQLDB-Specific Information:

        - - Starting with 2.0, HSQLDB supports this feature. - -

        -
        -
        -
        Specified by:
        -
        execute in interface java.sql.Statement
        -
        Parameters:
        -
        sql - any SQL statement
        -
        columnNames - an array of the names of the columns in the inserted - row that should be made available for retrieval by a call to the - method getGeneratedKeys
        -
        Returns:
        -
        true if the next result is a ResultSet - object; false if it is an update count or there - are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - elements of the String array passed to this - method are not valid column names
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        See Also:
        -
        getResultSet(), -getUpdateCount(), -getMoreResults(), -getGeneratedKeys()
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetHoldability

        -
        public int getResultSetHoldability()
        -                            throws java.sql.SQLException
        -
        - Retrieves the result set holdability for ResultSet objects - generated by this Statement object. -
        -
        -
        Specified by:
        -
        getResultSetHoldability in interface java.sql.Statement
        -
        Returns:
        -
        either ResultSet.HOLD_CURSORS_OVER_COMMIT or - ResultSet.CLOSE_CURSORS_AT_COMMIT
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        JDK 1.4, HSQLDB 1.7
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Retrieves whether this Statement object has been closed. A Statement is closed if the - method close has been called on it, or if it is automatically closed.
        -
        -
        Specified by:
        -
        isClosed in interface java.sql.Statement
        -
        Returns:
        -
        true if this Statement object is closed; false if it is still open
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        setPoolable

        -
        public void setPoolable​(boolean poolable)
        -                 throws java.sql.SQLException
        -
        Requests that a Statement be pooled or not pooled. The value - specified is a hint to the statement pool implementation indicating - whether the application wants the statement to be pooled. It is up to - the statement pool manager as to whether the hint is used. -

        - The poolable value of a statement is applicable to both internal - statement caches implemented by the driver and external statement caches - implemented by application servers and other applications. -

        - By default, a Statement is not poolable when created, and - a PreparedStatement and CallableStatement - are poolable when created. -

        -
        -
        Specified by:
        -
        setPoolable in interface java.sql.Statement
        -
        Parameters:
        -
        poolable - requests that the statement be pooled if true and - that the statement not be pooled if false -

        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement -

        -
        Since:
        -
        JDK 1.6 Build 81, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isPoolable

        -
        public boolean isPoolable()
        -                   throws java.sql.SQLException
        -
        Returns a value indicating whether the Statement - is poolable or not. -

        -
        -
        Specified by:
        -
        isPoolable in interface java.sql.Statement
        -
        Returns:
        -
        true if the Statement - is poolable; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement -

        -
        Since:
        -
        JDK 1.6 Build 81, HSQLDB 2.0 -

        -
        See Also:
        -
        setPoolable(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        unwrap

        -
        public <T> T unwrap​(java.lang.Class<T> iface)
        -             throws java.sql.SQLException
        -
        Returns an object that implements the given interface to allow access to - non-standard methods, or standard methods not exposed by the proxy. - - If the receiver implements the interface then the result is the receiver - or a proxy for the receiver. If the receiver is a wrapper - and the wrapped object implements the interface then the result is the - wrapped object or a proxy for the wrapped object. Otherwise return the - result of calling unwrap recursively on the wrapped object - or a proxy for that result. If the receiver is not a - wrapper and does not implement the interface, then an SQLException is thrown.
        -
        -
        Specified by:
        -
        unwrap in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - A Class defining an interface that the result must implement.
        -
        Returns:
        -
        an object that implements the interface. May be a proxy for the actual implementing object.
        -
        Throws:
        -
        java.sql.SQLException - If no object found that implements the interface
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        isWrapperFor

        -
        public boolean isWrapperFor​(java.lang.Class<?> iface)
        -                     throws java.sql.SQLException
        -
        Returns true if this either implements the interface argument or is directly or indirectly a wrapper - for an object that does. Returns false otherwise. If this implements the interface then return true, - else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - object. If this does not implement the interface and is not a wrapper, return false. - This method should be implemented as a low-cost operation compared to unwrap so that - callers can use this method to avoid expensive unwrap calls that may fail. If this method - returns true then calling unwrap with the same argument should succeed.
        -
        -
        Specified by:
        -
        isWrapperFor in interface java.sql.Wrapper
        -
        Parameters:
        -
        iface - a Class defining an interface.
        -
        Returns:
        -
        true if this implements the interface or directly or indirectly wraps an object that does.
        -
        Throws:
        -
        java.sql.SQLException - if an error occurs while determining whether this is a wrapper - for an object with the given interface.
        -
        Since:
        -
        JDK 1.6, HSQLDB 2.0
        -
        -
      • -
      - - - -
        -
      • -

        getLargeUpdateCount

        -
        public long getLargeUpdateCount()
        -                         throws java.sql.SQLException
        -
        Retrieves the current result as an update count; if the result - is a ResultSet object or there are no more results, -1 - is returned. This method should be called only once per result. -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - The public implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        getLargeUpdateCount in interface java.sql.Statement
        -
        Returns:
        -
        the current result as an update count; -1 if the current result - is a ResultSet object or there are no more results
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        execute(java.lang.String)
        -
        -
      • -
      - - - -
        -
      • -

        setLargeMaxRows

        -
        public void setLargeMaxRows​(long max)
        -                     throws java.sql.SQLException
        -
        Sets the limit for the maximum number of rows that any - ResultSet object generated by this Statement - object can contain to the given number. - If the limit is exceeded, the excess - rows are silently dropped. -

        - This method should be used when the row limit may exceed - Integer.MAX_VALUE. -

        - The default implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        setLargeMaxRows in interface java.sql.Statement
        -
        Parameters:
        -
        max - the new max rows limit; zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement - or the condition max >= 0 is not satisfied
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        getMaxRows()
        -
        -
      • -
      - - - -
        -
      • -

        getLargeMaxRows

        -
        public long getLargeMaxRows()
        -                     throws java.sql.SQLException
        -
        Retrieves the maximum number of rows that a - ResultSet object produced by this - Statement object can contain. If this limit is exceeded, - the excess rows are silently dropped. -

        - This method should be used when the returned row limit may exceed - Integer.MAX_VALUE. -

        - The default implementation will return 0

        -
        -
        Specified by:
        -
        getLargeMaxRows in interface java.sql.Statement
        -
        Returns:
        -
        the current maximum number of rows for a ResultSet - object produced by this Statement object; - zero means there is no limit
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs or - this method is called on a closed Statement
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        setMaxRows(int)
        -
        -
      • -
      - - - -
        -
      • -

        executeLargeBatch

        -
        public long[] executeLargeBatch()
        -                         throws java.sql.SQLException
        -
        Submits a batch of commands to the database for execution and - if all commands execute successfully, returns an array of update counts. - The long elements of the array that is returned are ordered - to correspond to the commands in the batch, which are ordered - according to the order in which they were added to the batch. - The elements in the array returned by the method executeLargeBatch - may be one of the following: -
          -
        1. A number greater than or equal to zero -- indicates that the - command was processed successfully and is an update count giving the - number of rows in the database that were affected by the command's - execution -
        2. A value of SUCCESS_NO_INFO -- indicates that the command was - processed successfully but that the number of rows affected is - unknown -

          - If one of the commands in a batch update fails to execute properly, - this method throws a BatchUpdateException, and a JDBC - driver may or may not continue to process the remaining commands in - the batch. However, the driver's behavior must be consistent with a - particular DBMS, either always continuing to process commands or never - continuing to process commands. If the driver continues processing - after a failure, the array returned by the method - BatchUpdateException.getLargeUpdateCounts - will contain as many elements as there are commands in the batch, and - at least one of the elements will be the following: - -

        3. A value of EXECUTE_FAILED -- indicates that the command failed - to execute successfully and occurs only if a driver continues to - process commands after a command fails -
        -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - The default implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        executeLargeBatch in interface java.sql.Statement
        -
        Returns:
        -
        an array of update counts containing one element for each - command in the batch. The elements of the array are ordered according - to the order in which commands were added to the batch.
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement or the - driver does not support batch statements. Throws BatchUpdateException - (a subclass of SQLException) if one of the commands sent to the - database fails to execute properly or attempts to return a result set.
        -
        java.sql.SQLTimeoutException - when the driver has determined that the - timeout value that was specified by the setQueryTimeout - method has been exceeded and has at least attempted to cancel - the currently running Statement
        -
        Since:
        -
        1.8
        -
        See Also:
        -
        addBatch(java.lang.String), -DatabaseMetaData.supportsBatchUpdates()
        -
        -
      • -
      - - - -
        -
      • -

        executeLargeUpdate

        -
        public long executeLargeUpdate​(java.lang.String sql)
        -                        throws java.sql.SQLException
        -
        Executes the given SQL statement, which may be an INSERT, - UPDATE, or DELETE statement or an - SQL statement that returns nothing, such as an SQL DDL statement. -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - Note:This method cannot be called on a - PreparedStatement or CallableStatement. -

        - The default implementation will throw UnsupportedOperationException

        -
        -
        Specified by:
        -
        executeLargeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL Data Manipulation Language (DML) statement, - such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
        -
        Returns:
        -
        either (1) the row count for SQL Data Manipulation Language - (DML) statements or (2) 0 for SQL statements that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement, the given - SQL statement produces a ResultSet object, the method is called on a - PreparedStatement or CallableStatement
        -
        java.sql.SQLTimeoutException - when the driver has determined that the - timeout value that was specified by the setQueryTimeout - method has been exceeded and has at least attempted to cancel - the currently running Statement
        -
        Since:
        -
        1.8
        -
        -
      • -
      - - - -
        -
      • -

        executeLargeUpdate

        -
        public long executeLargeUpdate​(java.lang.String sql,
        -                               int autoGeneratedKeys)
        -                        throws java.sql.SQLException
        -
        Executes the given SQL statement and signals the driver with the - given flag about whether the - auto-generated keys produced by this Statement object - should be made available for retrieval. The driver will ignore the - flag if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - Note:This method cannot be called on a - PreparedStatement or CallableStatement. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        executeLargeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL Data Manipulation Language (DML) statement, - such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
        -
        autoGeneratedKeys - a flag indicating whether auto-generated keys - should be made available for retrieval; - one of the following constants: - Statement.RETURN_GENERATED_KEYS - Statement.NO_GENERATED_KEYS
        -
        Returns:
        -
        either (1) the row count for SQL Data Manipulation Language (DML) statements - or (2) 0 for SQL statements that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement, the given - SQL statement returns a ResultSet object, - the given constant is not one of those allowed, the method is called on a - PreparedStatement or CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method with a constant of Statement.RETURN_GENERATED_KEYS
        -
        java.sql.SQLTimeoutException - when the driver has determined that the - timeout value that was specified by the setQueryTimeout - method has been exceeded and has at least attempted to cancel - the currently running Statement
        -
        Since:
        -
        1.8
        -
        -
      • -
      - - - -
        -
      • -

        executeLargeUpdate

        -
        public long executeLargeUpdate​(java.lang.String sql,
        -                               int[] columnIndexes)
        -                        throws java.sql.SQLException
        -
        Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval. This array contains the indexes of the columns in the - target table that contain the auto-generated keys that should be made - available. The driver will ignore the array if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - Note:This method cannot be called on a - PreparedStatement or CallableStatement. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        executeLargeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL Data Manipulation Language (DML) statement, - such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
        -
        columnIndexes - an array of column indexes indicating the columns - that should be returned from the inserted row
        -
        Returns:
        -
        either (1) the row count for SQL Data Manipulation Language (DML) statements - or (2) 0 for SQL statements that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement, the SQL - statement returns a ResultSet object,the second argument - supplied to this method is not an - int array whose elements are valid column indexes, the method is called on a - PreparedStatement or CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        java.sql.SQLTimeoutException - when the driver has determined that the - timeout value that was specified by the setQueryTimeout - method has been exceeded and has at least attempted to cancel - the currently running Statement
        -
        Since:
        -
        1.8
        -
        -
      • -
      - - - -
        -
      • -

        executeLargeUpdate

        -
        public long executeLargeUpdate​(java.lang.String sql,
        -                               java.lang.String[] columnNames)
        -                        throws java.sql.SQLException
        -
        Executes the given SQL statement and signals the driver that the - auto-generated keys indicated in the given array should be made available - for retrieval. This array contains the names of the columns in the - target table that contain the auto-generated keys that should be made - available. The driver will ignore the array if the SQL statement - is not an INSERT statement, or an SQL statement able to return - auto-generated keys (the list of such statements is vendor-specific). -

        - This method should be used when the returned row count may exceed - Integer.MAX_VALUE. -

        - Note:This method cannot be called on a - PreparedStatement or CallableStatement. -

        - The default implementation will throw SQLFeatureNotSupportedException

        -
        -
        Specified by:
        -
        executeLargeUpdate in interface java.sql.Statement
        -
        Parameters:
        -
        sql - an SQL Data Manipulation Language (DML) statement, - such as INSERT, UPDATE or - DELETE; or an SQL statement that returns nothing, - such as a DDL statement.
        -
        columnNames - an array of the names of the columns that should be - returned from the inserted row
        -
        Returns:
        -
        either the row count for INSERT, UPDATE, - or DELETE statements, or 0 for SQL statements - that return nothing
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - this method is called on a closed Statement, the SQL - statement returns a ResultSet object, the - second argument supplied to this method is not a String array - whose elements are valid column names, the method is called on a - PreparedStatement or CallableStatement
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support this method
        -
        java.sql.SQLTimeoutException - when the driver has determined that the - timeout value that was specified by the setQueryTimeout - method has been exceeded and has at least attempted to cancel - the currently running Statement
        -
        Since:
        -
        1.8
        -
        -
      • -
      - - - -
        -
      • -

        getResultSetScrollability

        -
        public int getResultSetScrollability()
        -
      • -
      - - - -
        -
      • -

        closeOnCompletion

        -
        public void closeOnCompletion()
        -                       throws java.sql.SQLException
        -
        Specifies that this Statement will be closed when all its - dependent result sets are closed. If execution of the Statement - does not produce any result sets, this method has no effect. -

        - Note: Multiple calls to closeOnCompletion do - not toggle the effect on this Statement. However, a call to - closeOnCompletion does effect both the subsequent execution of - statements, and statements that currently have open, dependent, - result sets.

        -
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      - - - -
        -
      • -

        isCloseOnCompletion

        -
        public boolean isCloseOnCompletion()
        -                            throws java.sql.SQLException
        -
        Returns a value indicating whether this Statement will be - closed when all its dependent result sets are closed.
        -
        -
        Returns:
        -
        true if the Statement will be closed when all - of its dependent result sets are closed; false otherwise
        -
        Throws:
        -
        java.sql.SQLException - if this method is called on a closed - Statement
        -
        Since:
        -
        JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCUtil.html deleted file mode 100644 index 5d896aed..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/JDBCUtil.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - -JDBCUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCUtil

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.JDBCUtil
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class JDBCUtil
    -extends java.lang.Object
    -
    Provides driver constants and a gateway from internal HsqlExceptions to - external SQLExceptions.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCUtil() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.sql.SQLExceptionconnectionClosedException() 
      static java.sql.SQLExceptioninvalidArgument() 
      static java.sql.SQLExceptioninvalidArgument​(int id) 
      static java.sql.SQLExceptioninvalidArgument​(java.lang.String name) 
      static java.sql.SQLExceptionnullArgument() 
      static java.sql.SQLExceptionoutOfRangeArgument() 
      static java.sql.SQLExceptionoutOfRangeArgument​(java.lang.String name) 
      static java.sql.SQLExceptionsqlException​(int id) 
      static java.sql.SQLExceptionsqlException​(int id, - int add) 
      static java.sql.SQLExceptionsqlException​(int id, - java.lang.String message) 
      static java.sql.SQLExceptionsqlException​(int id, - java.lang.String message, - java.lang.Throwable cause) 
      static java.sql.SQLExceptionsqlException​(java.lang.String msg, - java.lang.String sqlstate, - int code, - java.lang.Throwable cause) 
      static java.sql.SQLExceptionsqlException​(java.lang.Throwable t) 
      static java.sql.SQLExceptionsqlException​(org.hsqldb.HsqlException e) 
      static java.sql.SQLExceptionsqlException​(org.hsqldb.HsqlException e, - java.lang.Throwable cause) 
      static java.sql.SQLExceptionsqlException​(org.hsqldb.result.Result r) 
      static java.sql.SQLExceptionsqlExceptionSQL​(int id) 
      static java.sql.SQLWarningsqlWarning​(org.hsqldb.result.Result r) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCUtil

        -
        public JDBCUtil()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(org.hsqldb.HsqlException e)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(org.hsqldb.HsqlException e,
        -                                                 java.lang.Throwable cause)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(int id)
        -
      • -
      - - - -
        -
      • -

        sqlExceptionSQL

        -
        public static java.sql.SQLException sqlExceptionSQL​(int id)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(int id,
        -                                                 java.lang.String message)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(int id,
        -                                                 java.lang.String message,
        -                                                 java.lang.Throwable cause)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(int id,
        -                                                 int add)
        -
      • -
      - - - -
        -
      • -

        nullArgument

        -
        public static java.sql.SQLException nullArgument()
        -
      • -
      - - - -
        -
      • -

        invalidArgument

        -
        public static java.sql.SQLException invalidArgument()
        -
      • -
      - - - -
        -
      • -

        invalidArgument

        -
        public static java.sql.SQLException invalidArgument​(java.lang.String name)
        -
      • -
      - - - -
        -
      • -

        invalidArgument

        -
        public static java.sql.SQLException invalidArgument​(int id)
        -
      • -
      - - - -
        -
      • -

        outOfRangeArgument

        -
        public static java.sql.SQLException outOfRangeArgument()
        -
      • -
      - - - -
        -
      • -

        outOfRangeArgument

        -
        public static java.sql.SQLException outOfRangeArgument​(java.lang.String name)
        -
      • -
      - - - -
        -
      • -

        connectionClosedException

        -
        public static java.sql.SQLException connectionClosedException()
        -
      • -
      - - - -
        -
      • -

        sqlWarning

        -
        public static java.sql.SQLWarning sqlWarning​(org.hsqldb.result.Result r)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(java.lang.Throwable t)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(org.hsqldb.result.Result r)
        -
      • -
      - - - -
        -
      • -

        sqlException

        -
        public static java.sql.SQLException sqlException​(java.lang.String msg,
        -                                                 java.lang.String sqlstate,
        -                                                 int code,
        -                                                 java.lang.Throwable cause)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCArray.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCArray.html deleted file mode 100644 index 61170875..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCArray.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCArray (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCArray

-
-
No usage of org.hsqldb.jdbc.JDBCArray
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCArrayBasic.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCArrayBasic.html deleted file mode 100644 index 8f7cdf6c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCArrayBasic.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCArrayBasic (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCArrayBasic

-
-
No usage of org.hsqldb.jdbc.JDBCArrayBasic
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlob.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlob.html deleted file mode 100644 index 1d8e3940..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlob.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCBlob (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCBlob

-
-
No usage of org.hsqldb.jdbc.JDBCBlob
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlobClient.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlobClient.html deleted file mode 100644 index 3b858eb1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlobClient.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCBlobClient (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCBlobClient

-
-
No usage of org.hsqldb.jdbc.JDBCBlobClient
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlobFile.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlobFile.html deleted file mode 100644 index 3c8f893d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCBlobFile.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCBlobFile (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCBlobFile

-
-
No usage of org.hsqldb.jdbc.JDBCBlobFile
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCCallableStatement.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCCallableStatement.html deleted file mode 100644 index e7fe05a2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCCallableStatement.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCCallableStatement (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCCallableStatement

-
-
No usage of org.hsqldb.jdbc.JDBCCallableStatement
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClob.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClob.html deleted file mode 100644 index ae45dd2c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClob.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCClob (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCClob

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use JDBCClob 
    PackageDescription
    org.hsqldb.jdbc -
    Contains the HyperSQL JDBC Driver, and other classes providing JDBC - functionality and support.
    -
    -
  • -
  • - -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClobClient.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClobClient.html deleted file mode 100644 index 0b394e85..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClobClient.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCClobClient (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCClobClient

-
-
No usage of org.hsqldb.jdbc.JDBCClobClient
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClobFile.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClobFile.html deleted file mode 100644 index b6c4e909..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCClobFile.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCClobFile (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCClobFile

-
-
No usage of org.hsqldb.jdbc.JDBCClobFile
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCColumnMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCColumnMetaData.html deleted file mode 100644 index ba48e41e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCColumnMetaData.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCColumnMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCColumnMetaData

-
-
No usage of org.hsqldb.jdbc.JDBCColumnMetaData
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCCommonDataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCCommonDataSource.html deleted file mode 100644 index c4527457..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCCommonDataSource.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCCommonDataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCCommonDataSource

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCConnection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCConnection.html deleted file mode 100644 index 271f20d1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCConnection.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCConnection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCConnection

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCConnectionEventListener.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCConnectionEventListener.html deleted file mode 100644 index ff604b9c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCConnectionEventListener.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.jdbc.JDBCConnectionEventListener (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.jdbc.JDBCConnectionEventListener

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDataSource.html deleted file mode 100644 index 8c44d3d1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDataSource.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCDataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCDataSource

-
-
No usage of org.hsqldb.jdbc.JDBCDataSource
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDataSourceFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDataSourceFactory.html deleted file mode 100644 index b4b3c9f3..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDataSourceFactory.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCDataSourceFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCDataSourceFactory

-
-
No usage of org.hsqldb.jdbc.JDBCDataSourceFactory
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDatabaseMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDatabaseMetaData.html deleted file mode 100644 index 48d9c137..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDatabaseMetaData.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCDatabaseMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCDatabaseMetaData

-
-
No usage of org.hsqldb.jdbc.JDBCDatabaseMetaData
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDriver.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDriver.html deleted file mode 100644 index 509583c3..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCDriver.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCDriver (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCDriver

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCNClob.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCNClob.html deleted file mode 100644 index 68dc17a5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCNClob.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCNClob (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCNClob

-
-
No usage of org.hsqldb.jdbc.JDBCNClob
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCParameterMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCParameterMetaData.html deleted file mode 100644 index f50a1ae9..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCParameterMetaData.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCParameterMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCParameterMetaData

-
-
No usage of org.hsqldb.jdbc.JDBCParameterMetaData
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCPool.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCPool.html deleted file mode 100644 index 6579162f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCPool.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCPool (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCPool

-
-
No usage of org.hsqldb.jdbc.JDBCPool
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCPreparedStatement.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCPreparedStatement.html deleted file mode 100644 index 1f1c46c3..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCPreparedStatement.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCPreparedStatement (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCPreparedStatement

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCResultSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCResultSet.html deleted file mode 100644 index 2464e28b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCResultSet.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCResultSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCResultSet

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCResultSetMetaData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCResultSetMetaData.html deleted file mode 100644 index 82720c0a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCResultSetMetaData.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCResultSetMetaData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCResultSetMetaData

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCRowId.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCRowId.html deleted file mode 100644 index 3e1da37d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCRowId.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCRowId (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCRowId

-
-
No usage of org.hsqldb.jdbc.JDBCRowId
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSQLXML.SAX2XMLStreamWriter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSQLXML.SAX2XMLStreamWriter.html deleted file mode 100644 index 5d644a0c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSQLXML.SAX2XMLStreamWriter.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter

-
-
No usage of org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSQLXML.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSQLXML.html deleted file mode 100644 index c70850e9..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSQLXML.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCSQLXML (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCSQLXML

-
-
No usage of org.hsqldb.jdbc.JDBCSQLXML
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSavepoint.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSavepoint.html deleted file mode 100644 index b255039e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCSavepoint.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCSavepoint (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCSavepoint

-
-
No usage of org.hsqldb.jdbc.JDBCSavepoint
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCStatement.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCStatement.html deleted file mode 100644 index fe4c5140..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCStatement.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCStatement (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCStatement

-
-
No usage of org.hsqldb.jdbc.JDBCStatement
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCUtil.html deleted file mode 100644 index f0859d3f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/class-use/JDBCUtil.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.JDBCUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.JDBCUtil

-
-
No usage of org.hsqldb.jdbc.JDBCUtil
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-summary.html deleted file mode 100644 index 5b6216a2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-summary.html +++ /dev/null @@ -1,374 +0,0 @@ - - - - - -org.hsqldb.jdbc (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.jdbc

-
-
-
- - -
Contains the HyperSQL JDBC Driver, and other classes providing JDBC - functionality and support.
-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    JDBCConnectionEventListener 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    JDBCArray -
    The mapping in the Java programming language for the SQL type - ARRAY.
    -
    JDBCArrayBasic -
    The mapping in the Java programming language for the SQL type - ARRAY.
    -
    JDBCBlob -
    The representation (mapping) in - the Java™ programming language of an SQL - BLOB value.
    -
    JDBCBlobClient -
    A wrapper for HSQLDB BlobData objects.
    -
    JDBCBlobFile -
    A client-side file-based implementation of Blob.
    -
    JDBCCallableStatement -
    The interface used to execute SQL stored procedures.
    -
    JDBCClob -
    The mapping in the Java™ programming language for the SQL CLOB type.
    -
    JDBCClobClient -
    A wrapper for HSQLDB ClobData objects.
    -
    JDBCClobFile -
    A client-side file-based implementation of Clob.
    -
    JDBCColumnMetaData -
    Provides a site for holding the ResultSetMetaData for individual ResultSet - columns.
    -
    JDBCCommonDataSource -
    Common base for DataSource implementations.
    -
    JDBCConnection -
    A connection (session) with a specific - database.
    -
    JDBCDatabaseMetaData -
    Comprehensive information about the database as a whole.
    -
    JDBCDataSource -
    A factory for connections to the physical data source that this - DataSource object represents.
    -
    JDBCDataSourceFactory -
    A JNDI ObjectFactory for creating data sources supported by HyperSQL - JDBCDataSource for plain - connections for the end user.
    -
    JDBCDriver -
    Provides the java.sql.Driver interface implementation required by - the JDBC specification.
    -
    JDBCNClob -
    The mapping in the Java™ programming language - for the SQL NCLOB type.
    -
    JDBCParameterMetaData -
    An object that can be used to get information about the types - and properties for each parameter marker in a - PreparedStatement object.
    -
    JDBCPool -
    A fast connection pool.
    -
    JDBCPreparedStatement -
    An object that represents a precompiled SQL statement.
    -
    JDBCResultSet -
    A table of data representing a database result set, which - is usually generated by executing a statement that queries the database.
    -
    JDBCResultSetMetaData -
    An object that can be used to get information about the types - and properties of the columns in a ResultSet object.
    -
    JDBCRowId -
    The representation (mapping) in the Java programming language of an SQL ROWID - value.
    -
    JDBCSavepoint -
    The representation of a savepoint, which is a point within - the current transaction that can be referenced from the - Connection.rollback method.
    -
    JDBCSQLXML -
    The mapping in the JavaTM programming language for the SQL XML type.
    -
    JDBCSQLXML.SAX2XMLStreamWriter -
    Writes to a XMLStreamWriter - from SAX events.
    -
    JDBCStatement -
    The object used for executing a static SQL statement - and returning the results it produces.
    -
    JDBCUtil -
    Provides driver constants and a gateway from internal HsqlExceptions to - external SQLExceptions.
    -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-tree.html deleted file mode 100644 index 1ce5dfe0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-tree.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - -org.hsqldb.jdbc Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.jdbc

-Package Hierarchies: - -
-
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • org.hsqldb.jdbc.JDBCArray (implements java.sql.Array)
    • -
    • org.hsqldb.jdbc.JDBCArrayBasic (implements java.sql.Array)
    • -
    • org.hsqldb.jdbc.JDBCBlob (implements java.sql.Blob)
    • -
    • org.hsqldb.jdbc.JDBCBlobClient (implements java.sql.Blob)
    • -
    • org.hsqldb.jdbc.JDBCBlobFile (implements java.sql.Blob)
    • -
    • org.hsqldb.jdbc.JDBCClob (implements java.sql.Clob) -
        -
      • org.hsqldb.jdbc.JDBCNClob (implements java.sql.NClob)
      • -
      -
    • -
    • org.hsqldb.jdbc.JDBCClobClient (implements java.sql.Clob)
    • -
    • org.hsqldb.jdbc.JDBCClobFile (implements java.sql.Clob)
    • -
    • org.hsqldb.jdbc.JDBCColumnMetaData
    • -
    • org.hsqldb.jdbc.JDBCCommonDataSource (implements javax.sql.CommonDataSource, java.io.Serializable) -
        -
      • org.hsqldb.jdbc.JDBCDataSource (implements javax.sql.DataSource, javax.naming.Referenceable, java.io.Serializable, java.sql.Wrapper)
      • -
      -
    • -
    • org.hsqldb.jdbc.JDBCConnection (implements java.sql.Connection)
    • -
    • org.hsqldb.jdbc.JDBCDatabaseMetaData (implements java.sql.DatabaseMetaData, java.sql.Wrapper)
    • -
    • org.hsqldb.jdbc.JDBCDataSourceFactory (implements javax.naming.spi.ObjectFactory)
    • -
    • org.hsqldb.jdbc.JDBCDriver (implements java.sql.Driver)
    • -
    • org.hsqldb.jdbc.JDBCParameterMetaData (implements java.sql.ParameterMetaData, java.sql.Wrapper)
    • -
    • org.hsqldb.jdbc.JDBCPool (implements javax.sql.ConnectionEventListener, javax.sql.DataSource, javax.naming.Referenceable, javax.sql.StatementEventListener, java.sql.Wrapper)
    • -
    • org.hsqldb.jdbc.JDBCPreparedStatement (implements java.sql.PreparedStatement) - -
    • -
    • org.hsqldb.jdbc.JDBCResultSet (implements java.sql.ResultSet)
    • -
    • org.hsqldb.jdbc.JDBCResultSetMetaData (implements java.sql.ResultSetMetaData)
    • -
    • org.hsqldb.jdbc.JDBCRowId (implements java.sql.RowId)
    • -
    • org.hsqldb.jdbc.JDBCSavepoint (implements java.sql.Savepoint)
    • -
    • org.hsqldb.jdbc.JDBCSQLXML (implements java.sql.SQLXML)
    • -
    • org.hsqldb.jdbc.JDBCSQLXML.SAX2XMLStreamWriter (implements java.io.Closeable, org.xml.sax.ContentHandler)
    • -
    • org.hsqldb.jdbc.JDBCStatement (implements java.sql.Statement, java.sql.Wrapper)
    • -
    • org.hsqldb.jdbc.JDBCUtil
    • -
    -
  • -
-
-
-

Interface Hierarchy

- -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-use.html deleted file mode 100644 index b15e6a3a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/package-use.html +++ /dev/null @@ -1,269 +0,0 @@ - - - - - -Uses of Package org.hsqldb.jdbc (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.jdbc

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCPooledConnection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCPooledConnection.html deleted file mode 100644 index dd56d96d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCPooledConnection.html +++ /dev/null @@ -1,529 +0,0 @@ - - - - - -JDBCPooledConnection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCPooledConnection

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.pool.JDBCPooledConnection
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    javax.sql.PooledConnection, JDBCConnectionEventListener
    -
    -
    -
    Direct Known Subclasses:
    -
    JDBCXAConnection
    -
    -
    -
    public class JDBCPooledConnection
    -extends java.lang.Object
    -implements javax.sql.PooledConnection, JDBCConnectionEventListener
    -
    An implementations of PooledConnection - for use by connection pooling software.

    - The class maintains a lifetime connection to the database. The - getConnection() method establishes a lease on the lifetime connection - and returns a special JDBCConnection (userConnection) that is - valid until it is closed.

    - - This class uses a dedicated HyperSQL method to guarantee each lease on the - connection starts with the original state of the connection.

    - - The ConnectionEventLister objects that have been registered with this - PooledConnection are notified when each lease expires, or an unrecoverable - error occurs on the connection to the database.

    -
    -
    Since:
    -
    JDK 1.2, HSQLDB 2.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCPooledConnection

        -
        public JDBCPooledConnection​(JDBCConnection connection)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException
        -
        -
        Specified by:
        -
        getConnection in interface javax.sql.PooledConnection
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.sql.SQLException
        -
        -
        Specified by:
        -
        close in interface javax.sql.PooledConnection
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        addConnectionEventListener

        -
        public void addConnectionEventListener​(javax.sql.ConnectionEventListener listener)
        -
        -
        Specified by:
        -
        addConnectionEventListener in interface javax.sql.PooledConnection
        -
        -
      • -
      - - - -
        -
      • -

        removeConnectionEventListener

        -
        public void removeConnectionEventListener​(javax.sql.ConnectionEventListener listener)
        -
        -
        Specified by:
        -
        removeConnectionEventListener in interface javax.sql.PooledConnection
        -
        -
      • -
      - - - -
        -
      • -

        addStatementEventListener

        -
        public void addStatementEventListener​(javax.sql.StatementEventListener listener)
        -
        -
        Specified by:
        -
        addStatementEventListener in interface javax.sql.PooledConnection
        -
        -
      • -
      - - - -
        -
      • -

        removeStatementEventListener

        -
        public void removeStatementEventListener​(javax.sql.StatementEventListener listener)
        -
        -
        Specified by:
        -
        removeStatementEventListener in interface javax.sql.PooledConnection
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        isInUse

        -
        public boolean isInUse()
        -
        Returns true if getConnection() has been called and a leas has been - given.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -
        Force close the userConnection, no close event is fired.
        -
      • -
      - - - -
        -
      • -

        release

        -
        public void release()
        -
        Force close the userConnection, and connection, no close event is fired.
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCPooledDataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCPooledDataSource.html deleted file mode 100644 index 5206b046..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCPooledDataSource.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - -JDBCPooledDataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCPooledDataSource

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource
    -
    -
    -
    public class JDBCPooledDataSource
    -extends JDBCCommonDataSource
    -implements javax.sql.ConnectionPoolDataSource, java.io.Serializable, javax.naming.Referenceable, javax.sql.CommonDataSource
    -
    A data source that implements ConnectionPoolDataSource.

    - For use by connection pooling software, not by end users.

    -
    -
    Since:
    -
    JDK 1.2, HSQLDB 2.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCPooledDataSource

        -
        public JDBCPooledDataSource()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getPooledConnection

        -
        public javax.sql.PooledConnection getPooledConnection()
        -                                               throws java.sql.SQLException
        -
        -
        Specified by:
        -
        getPooledConnection in interface javax.sql.ConnectionPoolDataSource
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        getPooledConnection

        -
        public javax.sql.PooledConnection getPooledConnection​(java.lang.String user,
        -                                                      java.lang.String password)
        -                                               throws java.sql.SQLException
        -
        -
        Specified by:
        -
        getPooledConnection in interface javax.sql.ConnectionPoolDataSource
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        getReference

        -
        public javax.naming.Reference getReference()
        -                                    throws javax.naming.NamingException
        -
        Retrieves the Reference of this object.
        -
        -
        Specified by:
        -
        getReference in interface javax.naming.Referenceable
        -
        Returns:
        -
        The non-null javax.naming.Reference of this object.
        -
        Throws:
        -
        javax.naming.NamingException - If a naming exception was encountered - while retrieving the reference.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAConnection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAConnection.html deleted file mode 100644 index 64463ae6..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAConnection.html +++ /dev/null @@ -1,409 +0,0 @@ - - - - - -JDBCXAConnection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCXAConnection

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    javax.sql.PooledConnection, javax.sql.XAConnection, JDBCConnectionEventListener
    -
    -
    -
    public class JDBCXAConnection
    -extends JDBCPooledConnection
    -implements javax.sql.XAConnection
    -
    Subclass of JDBCPooledConnection implements the XAConnection interface. - For use by global transaction service managers.

    - - Each instance has an JDBCXAResource inherits the superclass's two - JDBCConnection objects, one for internal access, and one for user access.

    - - The getConnection() method returns a user connection and links this with - the JDBCXAResource. This puts the object in the inUse state. - When the user connection is closed, the object is put in the free state.

    -
    -
    Since:
    -
    HSQLDB 2.0
    -
    Author:
    -
    Fred Toussi (fredt at users.sourceforge.net)
    -
    See Also:
    -
    XAConnection
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getXAResource

        -
        public javax.transaction.xa.XAResource getXAResource()
        -                                              throws java.sql.SQLException
        -
        -
        Specified by:
        -
        getXAResource in interface javax.sql.XAConnection
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException
        -
        Returns a connection that can be used by the user application.
        -
        -
        Specified by:
        -
        getConnection in interface javax.sql.PooledConnection
        -
        Overrides:
        -
        getConnection in class JDBCPooledConnection
        -
        Returns:
        -
        Connection
        -
        Throws:
        -
        java.sql.SQLException - if a lease has already been given on this connection
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.sql.SQLException
        -
        -
        Specified by:
        -
        close in interface javax.sql.PooledConnection
        -
        Overrides:
        -
        close in class JDBCPooledConnection
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAConnectionWrapper.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAConnectionWrapper.html deleted file mode 100644 index 5b863527..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAConnectionWrapper.html +++ /dev/null @@ -1,610 +0,0 @@ - - - - - -JDBCXAConnectionWrapper (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCXAConnectionWrapper

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper
    -
    -
    -
    public class JDBCXAConnectionWrapper
    -extends JDBCConnection
    -
    This is a wrapper class for JDBCConnection objects (not java.sql.XAConnection - objects). - Purpose of this class is to intercept and handle XA-related operations - according to chapter 12 of the JDBC 3.0 specification, by returning this - wrapped JDBCConnection to end-users. - Global transaction services and XAResources will not use this wrapper. -

    - The new implementation extends JDBCConnection. A new object is created - based on the session / session proxy of the JDBCXAConnection object in the - constructor. (fredt)

    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    JDBCConnection
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCXAConnectionWrapper

        -
        public JDBCXAConnectionWrapper​(JDBCXAResource xaResource,
        -                               JDBCXAConnection xaConnection,
        -                               JDBCConnection databaseConnection)
        -                        throws java.sql.SQLException
        -
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setAutoCommit

        -
        public void setAutoCommit​(boolean autoCommit)
        -                   throws java.sql.SQLException
        -
        Interceptor method, because this method is prohibited within - any global transaction. - See section 1.2.4 of the JDBC 3.0 spec.
        -
        -
        Specified by:
        -
        setAutoCommit in interface java.sql.Connection
        -
        Overrides:
        -
        setAutoCommit in class JDBCConnection
        -
        Parameters:
        -
        autoCommit - mode
        -
        Throws:
        -
        java.sql.SQLException - on error
        -
        See Also:
        -
        JDBCConnection.getAutoCommit()
        -
        -
      • -
      - - - -
        -
      • -

        commit

        -
        public void commit()
        -            throws java.sql.SQLException
        -
        Interceptor method, because this method is prohibited within - any global transaction. - See section 1.2.4 of the JDBC 3.0 spec.
        -
        -
        Specified by:
        -
        commit in interface java.sql.Connection
        -
        Overrides:
        -
        commit in class JDBCConnection
        -
        Throws:
        -
        java.sql.SQLException - on error
        -
        See Also:
        -
        JDBCConnection.setAutoCommit(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        rollback

        -
        public void rollback()
        -              throws java.sql.SQLException
        -
        Interceptor method, because this method is prohibited within - any global transaction. - See section 1.2.4 of the JDBC 3.0 spec.
        -
        -
        Specified by:
        -
        rollback in interface java.sql.Connection
        -
        Overrides:
        -
        rollback in class JDBCConnection
        -
        Throws:
        -
        java.sql.SQLException - on error
        -
        See Also:
        -
        JDBCConnection.setAutoCommit(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        rollback

        -
        public void rollback​(java.sql.Savepoint savepoint)
        -              throws java.sql.SQLException
        -
        Interceptor method, because this method is prohibited within - any global transaction. - See section 1.2.4 of the JDBC 3.0 spec.
        -
        -
        Specified by:
        -
        rollback in interface java.sql.Connection
        -
        Overrides:
        -
        rollback in class JDBCConnection
        -
        Parameters:
        -
        savepoint - the Savepoint object to roll back to
        -
        Throws:
        -
        java.sql.SQLException - on error
        -
        See Also:
        -
        JDBCSavepoint, -Savepoint, -JDBCConnection.rollback()
        -
        -
      • -
      - - - -
        -
      • -

        setSavepoint

        -
        public java.sql.Savepoint setSavepoint()
        -                                throws java.sql.SQLException
        -
        Interceptor method, because this method is prohibited within - any global transaction. - See section 1.2.4 of the JDBC 3.0 spec.
        -
        -
        Specified by:
        -
        setSavepoint in interface java.sql.Connection
        -
        Overrides:
        -
        setSavepoint in class JDBCConnection
        -
        Returns:
        -
        the new Savepoint object
        -
        Throws:
        -
        java.sql.SQLException - on error
        -
        See Also:
        -
        JDBCSavepoint, -Savepoint
        -
        -
      • -
      - - - -
        -
      • -

        setSavepoint

        -
        public java.sql.Savepoint setSavepoint​(java.lang.String name)
        -                                throws java.sql.SQLException
        -
        Interceptor method, because this method is prohibited within - any global transaction. - See section 1.2.4 of the JDBC 3.0 spec.
        -
        -
        Specified by:
        -
        setSavepoint in interface java.sql.Connection
        -
        Overrides:
        -
        setSavepoint in class JDBCConnection
        -
        Parameters:
        -
        name - a String containing the name of the savepoint
        -
        Returns:
        -
        the new Savepoint object
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, - (JDBC4 Clarification:) - this method is called while participating in a distributed transaction, - this method is called on a closed connection - or this Connection object is currently in - auto-commit mode
        -
        java.sql.SQLFeatureNotSupportedException - if the JDBC driver does not support - this method
        -
        See Also:
        -
        JDBCSavepoint, -Savepoint
        -
        -
      • -
      - - - -
        -
      • -

        setTransactionIsolation

        -
        public void setTransactionIsolation​(int level)
        -                             throws java.sql.SQLException
        -
        Interceptor method, because there may be XA implications to - calling the method within a global transaction. - See section 1.2.4 of the JDBC 3.0 spec.

        - - HSQLDB does not allow changing the isolation level inside a transaction - of any kind.

        -
        -
        Specified by:
        -
        setTransactionIsolation in interface java.sql.Connection
        -
        Overrides:
        -
        setTransactionIsolation in class JDBCConnection
        -
        Parameters:
        -
        level - isolation level
        -
        Throws:
        -
        java.sql.SQLException - if a database access error occurs, this - (JDBC4 Clarification:) - method is called on a closed connection - (:JDBC4 End Clarification) - or the given parameter is not one of the Connection - constants
        -
        See Also:
        -
        JDBCDatabaseMetaData.supportsTransactionIsolationLevel(int), -JDBCConnection.getTransactionIsolation()
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXADataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXADataSource.html deleted file mode 100644 index 2c433bec..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXADataSource.html +++ /dev/null @@ -1,464 +0,0 @@ - - - - - -JDBCXADataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCXADataSource

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.XADataSource
    -
    -
    -
    public class JDBCXADataSource
    -extends JDBCCommonDataSource
    -implements javax.sql.XADataSource, java.io.Serializable, javax.naming.Referenceable, javax.sql.CommonDataSource
    -
    Connection factory for JDBCXAConnections. - For use by XA data source factories, not by end users.

    - - The JDBCDataSourceFactory can be used to get - instances of this class.

    - - The methods of the superclass, JDBCCommonDataSource, - are used for settings the HyperSQL server and user.

    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    XADataSource, -JDBCXAConnection, -Serialized Form
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCXADataSource

        -
        public JDBCXADataSource()
        -                 throws java.sql.SQLException
        -
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getXAConnection

        -
        public javax.sql.XAConnection getXAConnection()
        -                                       throws java.sql.SQLException
        -
        Get new XAConnection connection, to be managed by a connection manager.
        -
        -
        Specified by:
        -
        getXAConnection in interface javax.sql.XADataSource
        -
        Throws:
        -
        java.sql.SQLException - on error
        -
        -
      • -
      - - - -
        -
      • -

        getXAConnection

        -
        public javax.sql.XAConnection getXAConnection​(java.lang.String user,
        -                                              java.lang.String password)
        -                                       throws java.sql.SQLException
        -
        Gets a new XAConnection after validating the given username - and password.
        -
        -
        Specified by:
        -
        getXAConnection in interface javax.sql.XADataSource
        -
        Parameters:
        -
        user - String which must match the 'user' configured for this - JDBCXADataSource.
        -
        password - String which must match the 'password' configured - for this JDBCXADataSource.
        -
        Throws:
        -
        java.sql.SQLException - on error
        -
        See Also:
        -
        getXAConnection()
        -
        -
      • -
      - - - -
        -
      • -

        getReference

        -
        public javax.naming.Reference getReference()
        -                                    throws javax.naming.NamingException
        -
        Retrieves the Reference of this object.
        -
        -
        Specified by:
        -
        getReference in interface javax.naming.Referenceable
        -
        Returns:
        -
        The non-null javax.naming.Reference of this object.
        -
        Throws:
        -
        javax.naming.NamingException - If a naming exception was encountered - while retrieving the reference.
        -
        -
      • -
      - - - -
        -
      • -

        addResource

        -
        public void addResource​(javax.transaction.xa.Xid xid,
        -                        JDBCXAResource xaResource)
        -
      • -
      - - - -
        -
      • -

        removeResource

        -
        public JDBCXAResource removeResource​(javax.transaction.xa.Xid xid)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAResource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAResource.html deleted file mode 100644 index f3933b6e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXAResource.html +++ /dev/null @@ -1,718 +0,0 @@ - - - - - -JDBCXAResource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCXAResource

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.pool.JDBCXAResource
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    javax.transaction.xa.XAResource
    -
    -
    -
    public class JDBCXAResource
    -extends java.lang.Object
    -implements javax.transaction.xa.XAResource
    -
    Used by a global transaction service to control HSQLDB transactions. - Not for use by end-users. - End manage global transactions using transaction APIs such as JTA. -

    - According to section 12.3 of the JDBC 3.0 spec, there is a - 1:1 correspondence between XAConnection and XAResource, and - A given XAConnection object may be associated with at most one - transaction at a time. - Therefore, there may be at any time at most one transaction - managed by a XAResource object. - One implication is, the XAResource can track the current transaction - state with a scalar. - Another implication is, the Xids for most of the XAResource interface - methods just introduce unnecessary complexity and an unnecessary point - of failure-- there can be only one transaction for this object, so - why track another identifier for it. - My strategy is to just "validate" that the Xid does not change - within a transaction. - Exceptions to this are the commit and rollback methods, which the - JDBC spec says can operate against any XAResource instance from - the same XADataSource. - N.b. The JDBC Spec does not state whether the prepare and forget - methods are XAResource-specific or XADataSource-specific.

    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    XAResource
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface javax.transaction.xa.XAResource

        -TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidcommit​(javax.transaction.xa.Xid xid, - boolean onePhase) -
      Per the JDBC 3.0 spec, this commits the transaction for the specified - Xid, not necessarily for the transaction associated with this XAResource - object.
      -
      voidcommitThis​(boolean onePhase) -
      This commits the connection associated with this XAResource.
      -
      voidend​(javax.transaction.xa.Xid xid, - int flags) 
      voidforget​(javax.transaction.xa.Xid xid) -
      The XAResource API spec indicates implies that this is only for 2-phase - transactions.
      -
      intgetTransactionTimeout() 
      booleanisSameRM​(javax.transaction.xa.XAResource xares) -
      Stub.
      -
      intprepare​(javax.transaction.xa.Xid xid) -
      Vote on whether to commit the global transaction.
      -
      intprepareThis() 
      javax.transaction.xa.Xid[]recover​(int flag) -
      Obtain a list of Xids of the current resource manager for - XAResources currently in the 'prepared' * state.
      -
      voidrollback​(javax.transaction.xa.Xid xid) -
      Per the JDBC 3.0 spec, this rolls back the transaction for the specified - Xid, not necessarily for the transaction associated with this XAResource - object.
      -
      voidrollbackThis() -
      This rolls back the connection associated with this XAResource.
      -
      booleansetTransactionTimeout​(int seconds) 
      voidstart​(javax.transaction.xa.Xid xid, - int flags) 
      booleanwithinGlobalTransaction() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCXAResource

        -
        public JDBCXAResource​(JDBCXADataSource xaDataSource,
        -                      JDBCConnection connection)
        -
        Constructs a resource using the given data source and connection.
        -
        -
        Parameters:
        -
        xaDataSource - JDBCXADataSource
        -
        connection - A non-wrapped JDBCConnection which we need in order to - do real (non-wrapped) commits, rollbacks, etc. This is not for the end - user. We need the real thing.
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        withinGlobalTransaction

        -
        public boolean withinGlobalTransaction()
        -
      • -
      - - - -
        -
      • -

        commit

        -
        public void commit​(javax.transaction.xa.Xid xid,
        -                   boolean onePhase)
        -            throws javax.transaction.xa.XAException
        -
        Per the JDBC 3.0 spec, this commits the transaction for the specified - Xid, not necessarily for the transaction associated with this XAResource - object.
        -
        -
        Specified by:
        -
        commit in interface javax.transaction.xa.XAResource
        -
        Parameters:
        -
        xid - Xid
        -
        onePhase - boolean
        -
        Throws:
        -
        javax.transaction.xa.XAException - on error
        -
        -
      • -
      - - - -
        -
      • -

        commitThis

        -
        public void commitThis​(boolean onePhase)
        -                throws javax.transaction.xa.XAException
        -
        This commits the connection associated with this XAResource.
        -
        -
        Parameters:
        -
        onePhase - boolean
        -
        Throws:
        -
        javax.transaction.xa.XAException - generically, since the more specific exceptions - require a JTA API to compile.
        -
        -
      • -
      - - - -
        -
      • -

        end

        -
        public void end​(javax.transaction.xa.Xid xid,
        -                int flags)
        -         throws javax.transaction.xa.XAException
        -
        -
        Specified by:
        -
        end in interface javax.transaction.xa.XAResource
        -
        Throws:
        -
        javax.transaction.xa.XAException
        -
        -
      • -
      - - - -
        -
      • -

        forget

        -
        public void forget​(javax.transaction.xa.Xid xid)
        -            throws javax.transaction.xa.XAException
        -
        The XAResource API spec indicates implies that this is only for 2-phase - transactions. I guess that one-phase transactions need to call rollback() - to abort. I think we want this JDBCXAResource instance to be - garbage-collectable after (a) this method is called, and (b) the tx - manager releases its handle to it.
        -
        -
        Specified by:
        -
        forget in interface javax.transaction.xa.XAResource
        -
        Parameters:
        -
        xid - Xid
        -
        Throws:
        -
        javax.transaction.xa.XAException - on error
        -
        -
      • -
      - - - -
        -
      • -

        getTransactionTimeout

        -
        public int getTransactionTimeout()
        -                          throws javax.transaction.xa.XAException
        -
        -
        Specified by:
        -
        getTransactionTimeout in interface javax.transaction.xa.XAResource
        -
        Returns:
        -
        int
        -
        Throws:
        -
        javax.transaction.xa.XAException - on error
        -
        -
      • -
      - - - -
        -
      • -

        isSameRM

        -
        public boolean isSameRM​(javax.transaction.xa.XAResource xares)
        -                 throws javax.transaction.xa.XAException
        -
        Stub. See implementation comment in the method for why this is not - implemented yet.
        -
        -
        Specified by:
        -
        isSameRM in interface javax.transaction.xa.XAResource
        -
        Parameters:
        -
        xares - XAResource
        -
        Returns:
        -
        false.
        -
        Throws:
        -
        javax.transaction.xa.XAException - on error
        -
        -
      • -
      - - - -
        -
      • -

        prepare

        -
        public int prepare​(javax.transaction.xa.Xid xid)
        -            throws javax.transaction.xa.XAException
        -
        Vote on whether to commit the global transaction. We assume Xid may be - different from this, as in commit() method.
        -
        -
        Specified by:
        -
        prepare in interface javax.transaction.xa.XAResource
        -
        Parameters:
        -
        xid - Xid
        -
        Returns:
        -
        commitType of XA_RDONLY or XA_OK. (Actually only XA_OK now).
        -
        Throws:
        -
        javax.transaction.xa.XAException - to vote negative.
        -
        -
      • -
      - - - -
        -
      • -

        prepareThis

        -
        public int prepareThis()
        -                throws javax.transaction.xa.XAException
        -
        -
        Throws:
        -
        javax.transaction.xa.XAException
        -
        -
      • -
      - - - -
        -
      • -

        recover

        -
        public javax.transaction.xa.Xid[] recover​(int flag)
        -                                   throws javax.transaction.xa.XAException
        -
        Obtain a list of Xids of the current resource manager for - XAResources currently in the 'prepared' * state. According to the JDBC - 3.0 spec, the Xids of a specific resource manager are those of the same - XADataSource.
        -
        -
        Specified by:
        -
        recover in interface javax.transaction.xa.XAResource
        -
        Parameters:
        -
        flag - int
        -
        Returns:
        -
        Xid[]
        -
        Throws:
        -
        javax.transaction.xa.XAException - on error
        -
        -
      • -
      - - - -
        -
      • -

        rollback

        -
        public void rollback​(javax.transaction.xa.Xid xid)
        -              throws javax.transaction.xa.XAException
        -
        Per the JDBC 3.0 spec, this rolls back the transaction for the specified - Xid, not necessarily for the transaction associated with this XAResource - object.
        -
        -
        Specified by:
        -
        rollback in interface javax.transaction.xa.XAResource
        -
        Parameters:
        -
        xid - Xid
        -
        Throws:
        -
        javax.transaction.xa.XAException - on error
        -
        -
      • -
      - - - -
        -
      • -

        rollbackThis

        -
        public void rollbackThis()
        -                  throws javax.transaction.xa.XAException
        -
        This rolls back the connection associated with this XAResource.
        -
        -
        Throws:
        -
        javax.transaction.xa.XAException - generically, since the more - specific exceptions require a JTA API to compile.
        -
        -
      • -
      - - - -
        -
      • -

        setTransactionTimeout

        -
        public boolean setTransactionTimeout​(int seconds)
        -                              throws javax.transaction.xa.XAException
        -
        -
        Specified by:
        -
        setTransactionTimeout in interface javax.transaction.xa.XAResource
        -
        Parameters:
        -
        seconds - int
        -
        Returns:
        -
        boolean
        -
        Throws:
        -
        javax.transaction.xa.XAException - on error
        -
        -
      • -
      - - - -
        -
      • -

        start

        -
        public void start​(javax.transaction.xa.Xid xid,
        -                  int flags)
        -           throws javax.transaction.xa.XAException
        -
        -
        Specified by:
        -
        start in interface javax.transaction.xa.XAResource
        -
        Throws:
        -
        javax.transaction.xa.XAException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXID.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXID.html deleted file mode 100644 index 3c5e06f8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/JDBCXID.html +++ /dev/null @@ -1,494 +0,0 @@ - - - - - -JDBCXID (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class JDBCXID

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.jdbc.pool.JDBCXID
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    javax.transaction.xa.Xid
    -
    -
    -
    public class JDBCXID
    -extends java.lang.Object
    -implements javax.transaction.xa.Xid
    -
    Implementation of Xid for tests. - -
    - // Example usage:
    -
    - JDBCXADataSource ds = new JDBCXADataSource();
    -
    - ds.setUser(user);
    - ds.setPassword(password);
    - ds.setUrl(jdbcUrl);
    -
    - XAConnection xaCon = ds.getConnection();
    - Connection con = xaCon.getConnection();
    - Xid xid = JDBCXID.getUniqueXid((int)Thread.currentThread().getId());
    - XAResource xaRes = xaCon.getXAResource();
    -
    -  // Start the transaction.
    - System.out.println("Starting XA transaction with xid = " + xid.toString());
    -
    - xaRes.setTransactionTimeout(0);
    - xaRes.start(xid,XAResource.TMNOFLAGS);
    -
    - // Do work here ....
    -
    - // Commit the transaction.
    - xaRes.end(xid,XAResource.TMSUCCESS);
    - xaRes.commit(xid,true);
    -
    - // Cleanup.
    - con.close();
    - xaCon.close();
    - 
    -
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net), Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from interface javax.transaction.xa.Xid

        -MAXBQUALSIZE, MAXGTRIDSIZE
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      JDBCXID​(int formatID, - byte[] txID, - byte[] txBranch) 
      -
    • -
    -
    - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        JDBCXID

        -
        public JDBCXID​(int formatID,
        -               byte[] txID,
        -               byte[] txBranch)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getFormatId

        -
        public int getFormatId()
        -
        -
        Specified by:
        -
        getFormatId in interface javax.transaction.xa.Xid
        -
        -
      • -
      - - - -
        -
      • -

        getGlobalTransactionId

        -
        public byte[] getGlobalTransactionId()
        -
        -
        Specified by:
        -
        getGlobalTransactionId in interface javax.transaction.xa.Xid
        -
        -
      • -
      - - - -
        -
      • -

        getBranchQualifier

        -
        public byte[] getBranchQualifier()
        -
        -
        Specified by:
        -
        getBranchQualifier in interface javax.transaction.xa.Xid
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals​(java.lang.Object other)
        -
        -
        Overrides:
        -
        equals in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        getUniqueXid

        -
        public static javax.transaction.xa.Xid getUniqueXid​(int threadId)
        -
        Retrieves a randomly generated JDBCXID. - - The newly generated object is based on the local IP address, the given - threadId and a randomly generated number using the current time - in milliseconds as the random seed. - - Note that java.util.Random is used, not java.security.SecureRandom.
        -
        -
        Parameters:
        -
        threadId - can be a real thread id or just some convenient - tracking value.
        -
        Returns:
        -
        a randomly generated JDBCXID
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCPooledConnection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCPooledConnection.html deleted file mode 100644 index c5315e70..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCPooledConnection.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.pool.JDBCPooledConnection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.pool.JDBCPooledConnection

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCPooledDataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCPooledDataSource.html deleted file mode 100644 index 86e32b10..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCPooledDataSource.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.pool.JDBCPooledDataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.pool.JDBCPooledDataSource

-
-
No usage of org.hsqldb.jdbc.pool.JDBCPooledDataSource
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAConnection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAConnection.html deleted file mode 100644 index afbf9824..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAConnection.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.pool.JDBCXAConnection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.pool.JDBCXAConnection

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAConnectionWrapper.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAConnectionWrapper.html deleted file mode 100644 index 6f81e18b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAConnectionWrapper.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper

-
-
No usage of org.hsqldb.jdbc.pool.JDBCXAConnectionWrapper
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXADataSource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXADataSource.html deleted file mode 100644 index de7ed074..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXADataSource.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.pool.JDBCXADataSource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.pool.JDBCXADataSource

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAResource.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAResource.html deleted file mode 100644 index 42e9f3cc..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXAResource.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.pool.JDBCXAResource (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.pool.JDBCXAResource

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXID.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXID.html deleted file mode 100644 index 474aa6e6..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/class-use/JDBCXID.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.jdbc.pool.JDBCXID (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.jdbc.pool.JDBCXID

-
-
No usage of org.hsqldb.jdbc.pool.JDBCXID
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-summary.html deleted file mode 100644 index e266c7be..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-summary.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - -org.hsqldb.jdbc.pool (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.jdbc.pool

-
-
-
- - -
Contains classes for connection pooling and distributed XA connections.
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    JDBCPooledConnection -
    An implementations of PooledConnection - for use by connection pooling software.
    -
    JDBCPooledDataSource -
    A data source that implements ConnectionPoolDataSource.
    -
    JDBCXAConnection -
    Subclass of JDBCPooledConnection implements the XAConnection interface.
    -
    JDBCXAConnectionWrapper -
    This is a wrapper class for JDBCConnection objects (not java.sql.XAConnection - objects).
    -
    JDBCXADataSource -
    Connection factory for JDBCXAConnections.
    -
    JDBCXAResource -
    Used by a global transaction service to control HSQLDB transactions.
    -
    JDBCXID -
    Implementation of Xid for tests.
    -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-tree.html deleted file mode 100644 index 54d02792..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-tree.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - -org.hsqldb.jdbc.pool Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.jdbc.pool

-Package Hierarchies: - -
-
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • org.hsqldb.jdbc.JDBCCommonDataSource (implements javax.sql.CommonDataSource, java.io.Serializable) -
        -
      • org.hsqldb.jdbc.pool.JDBCPooledDataSource (implements javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource, javax.naming.Referenceable, java.io.Serializable)
      • -
      • org.hsqldb.jdbc.pool.JDBCXADataSource (implements javax.sql.CommonDataSource, javax.naming.Referenceable, java.io.Serializable, javax.sql.XADataSource)
      • -
      -
    • -
    • org.hsqldb.jdbc.JDBCConnection (implements java.sql.Connection) - -
    • -
    • org.hsqldb.jdbc.pool.JDBCPooledConnection (implements org.hsqldb.jdbc.JDBCConnectionEventListener, javax.sql.PooledConnection) - -
    • -
    • org.hsqldb.jdbc.pool.JDBCXAResource (implements javax.transaction.xa.XAResource)
    • -
    • org.hsqldb.jdbc.pool.JDBCXID (implements javax.transaction.xa.Xid)
    • -
    -
  • -
-
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-use.html deleted file mode 100644 index 82b8e837..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/jdbc/pool/package-use.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - -Uses of Package org.hsqldb.jdbc.pool (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.jdbc.pool

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AppendableException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AppendableException.html deleted file mode 100644 index 74137643..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AppendableException.html +++ /dev/null @@ -1,453 +0,0 @@ - - - - - -AppendableException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class AppendableException

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.lang.Throwable
    • -
    • -
        -
      • java.lang.Exception
      • -
      • -
          -
        • org.hsqldb.lib.AppendableException
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable
    -
    -
    -
    public class AppendableException
    -extends java.lang.Exception
    -
    Allows additional messages to be appended. - - It often makes for better (and more efficient) design to add context - details to an exception at intermediate points in the thread. - This class makes it easy and efficient to catch and rethrow for that purpose.
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      java.util.List<java.lang.String>appendages 
      static java.lang.StringLS 
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidappendMessage​(java.lang.String s) 
      java.lang.StringgetMessage() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Throwable

        -addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        LS

        -
        public static final java.lang.String LS
        -
      • -
      - - - -
        -
      • -

        appendages

        -
        public java.util.List<java.lang.String> appendages
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        AppendableException

        -
        public AppendableException()
        -
      • -
      - - - -
        -
      • -

        AppendableException

        -
        public AppendableException​(java.lang.String s)
        -
      • -
      - - - -
        -
      • -

        AppendableException

        -
        public AppendableException​(java.lang.Throwable cause)
        -
      • -
      - - - -
        -
      • -

        AppendableException

        -
        public AppendableException​(java.lang.String string,
        -                           java.lang.Throwable cause)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getMessage

        -
        public java.lang.String getMessage()
        -
        -
        Overrides:
        -
        getMessage in class java.lang.Throwable
        -
        -
      • -
      - - - -
        -
      • -

        appendMessage

        -
        public void appendMessage​(java.lang.String s)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayCounter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayCounter.html deleted file mode 100644 index 1185b8be..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayCounter.html +++ /dev/null @@ -1,404 +0,0 @@ - - - - - -ArrayCounter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ArrayCounter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ArrayCounter
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class ArrayCounter
    -extends java.lang.Object
    -
    Collection of routines for counting the distribution of the values - in an int[] array.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ArrayCounter() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static int[]countSegments​(int[] array, - int elementCount, - int segments, - int interval, - int start, - int limit) -
      Returns an int[] array of length segments containing the distribution - count of the elements in unsorted int[] array with values between min - and max (range).
      -
      static intrank​(int[] array, - int elements, - int target, - int start, - int limit, - int margin) -
      With an unsorted int[] array and with target a positive integer in the - range (1,array.length), finds the value in the range (start,limit) of the - largest element (rank) where the count of all smaller elements in that - range is less than or equals target.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ArrayCounter

        -
        public ArrayCounter()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        countSegments

        -
        public static int[] countSegments​(int[] array,
        -                                  int elementCount,
        -                                  int segments,
        -                                  int interval,
        -                                  int start,
        -                                  int limit)
        -
        Returns an int[] array of length segments containing the distribution - count of the elements in unsorted int[] array with values between min - and max (range). Values outside the min-max range are ignored

        - - A usage example is determining the count of people of each age group - in a large int[] array containing the age of each person. Called with - (array, 16,0,79), it will return an int[16] with the first element - the count of people aged 0-4, the second element the count of those - aged 5-9, and so on. People above the age of 79 are excluded. If the - range is not a multiple of segments, the last segment will be cover a - smaller sub-range than the rest.

        -
        -
        Parameters:
        -
        array - int[]
        -
        elementCount - int
        -
        segments - int
        -
        interval - int
        -
        start - int
        -
        limit - int
        -
        Returns:
        -
        int[]
        -
        -
      • -
      - - - -
        -
      • -

        rank

        -
        public static int rank​(int[] array,
        -                       int elements,
        -                       int target,
        -                       int start,
        -                       int limit,
        -                       int margin)
        -
        With an unsorted int[] array and with target a positive integer in the - range (1,array.length), finds the value in the range (start,limit) of the - largest element (rank) where the count of all smaller elements in that - range is less than or equals target. Parameter margin indicates the - margin of error in target

        - - In statistics, this can be used to calculate a median or quartile value. - A usage example applied to an array of age values is to determine - the maximum age of a given number of people. With the example array - given in countSegments, rank(array, c, 6000, 18, 65, 0) will return an age - value between 18-64 (inclusive) and the count of all people aged between - 18 and the returned value(exclusive) will be less than or equal to 6000.

        -
        -
        Parameters:
        -
        array - int[]
        -
        elements - int
        -
        target - int
        -
        start - int
        -
        limit - int
        -
        margin - int
        -
        Returns:
        -
        int
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayListIdentity.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayListIdentity.html deleted file mode 100644 index c61f874e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayListIdentity.html +++ /dev/null @@ -1,436 +0,0 @@ - - - - - -ArrayListIdentity (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ArrayListIdentity<E>

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Collection<E>, List<E>
    -
    -
    -
    public class ArrayListIdentity<E>
    -extends HsqlArrayList<E>
    -
    Extends HsqlArrayList. All search methods use Object identity for equality - comparison.
    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ArrayListIdentity

        -
        public ArrayListIdentity()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        contains

        -
        public boolean contains​(java.lang.Object element)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object element)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(Collection<? extends E> other)
        -
      • -
      - - - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(E[] array)
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        public boolean isEmpty()
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        iterator

        -
        public Iterator<E> iterator()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArraySort.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArraySort.html deleted file mode 100644 index 973111d1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArraySort.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - -ArraySort (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ArraySort

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ArraySort
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class ArraySort
    -extends java.lang.Object
    -
    FastQSorts the [l,r] partition (inclusive) of the specified array of - Rows, using the comparator.

    - - Searches an ordered array.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Tony Lai (tony_lai@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ArraySort() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static intdeDuplicate​(java.lang.Object[] array, - int limit, - java.util.Comparator comparator) 
      static voidinsertionSort​(java.lang.Object[] array, - java.util.Comparator comparator, - int lo0, - int hi0) 
      static intsearchFirst​(java.lang.Object[] array, - int start, - int limit, - java.lang.Object value, - java.util.Comparator c) -
      Returns the index of the lowest element == the given search target, or - when not found, a negative value -(insert position + 1)
      -
      static voidsort​(java.lang.Object[] array, - int limit, - java.util.Comparator comparator) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ArraySort

        -
        public ArraySort()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        searchFirst

        -
        public static int searchFirst​(java.lang.Object[] array,
        -                              int start,
        -                              int limit,
        -                              java.lang.Object value,
        -                              java.util.Comparator c)
        -
        Returns the index of the lowest element == the given search target, or - when not found, a negative value -(insert position + 1)
        -
        -
        Parameters:
        -
        array - Object[]
        -
        start - int
        -
        limit - int
        -
        value - Object
        -
        c - Comparator
        -
        Returns:
        -
        index or a negative value if not found
        -
        -
      • -
      - - - -
        -
      • -

        deDuplicate

        -
        public static int deDuplicate​(java.lang.Object[] array,
        -                              int limit,
        -                              java.util.Comparator comparator)
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public static void sort​(java.lang.Object[] array,
        -                        int limit,
        -                        java.util.Comparator comparator)
        -
      • -
      - - - -
        -
      • -

        insertionSort

        -
        public static void insertionSort​(java.lang.Object[] array,
        -                                 java.util.Comparator comparator,
        -                                 int lo0,
        -                                 int hi0)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayUtil.html deleted file mode 100644 index 780a304c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ArrayUtil.html +++ /dev/null @@ -1,2898 +0,0 @@ - - - - - -ArrayUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ArrayUtil

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ArrayUtil
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class ArrayUtil
    -extends java.lang.Object
    -
    Collection of static methods for operations on arrays
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ArrayUtil() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidadjustArray​(int type, - java.lang.Object array, - int usedElements, - int index, - int count) -
      Moves the contents of an array to allow both addition and removal of - elements.
      -
      static booleanareAllIntIndexesAsBooleanArray​(int[] arra, - boolean[] arrb) -
      Returns true if all indexes and no other positions are true in arrb.
      -
      static booleanareAllIntIndexesInBooleanArray​(int[] arra, - boolean[] arrb) 
      static booleanareEqualSets​(int[] arra, - int[] arrb) -
      Returns true if arra and arrb contain the same set of integers, not - necessarily in the same order.
      -
      static int[]arraySlice​(int[] source, - int start, - int count) -
      Returns a range of elements of source from start to end of the array.
      -
      static int[]booleanArrayToIntIndexes​(boolean[] arrb) -
      Set elements of arrb true if their indexes appear in arrb.
      -
      static char[]byteArrayToChars​(byte[] bytes) 
      static char[]byteArrayToChars​(byte[] bytes, - int bytesLength) 
      static longbyteSequenceToLong​(byte[] bytes, - int pos) 
      static intcdiv​(int a, - int b) -
      a and b must be both positive returns (a / b) or (a / b) + 1 if remainder - is larger than zero
      -
      static longcdiv​(long a, - long b) 
      static byte[]charArrayToBytes​(char[] chars) 
      static byte[]charArrayToBytes​(char[] chars, - int length) 
      static voidclearArray​(int type, - java.lang.Object data, - int from, - int to) -
      Clears an area of the given array of the given type.
      -
      static int[]commonElements​(int[] arra, - int[] arrb) -
      Returns an int[] containing elements shared between the two arrays - arra and arrb.
      -
      static intcompare​(byte[] a, - byte[] b) -
      Compares two arrays.
      -
      static intcompare​(byte[] a, - int aOffset, - int aLength, - byte[] b, - int bOffset, - int bLength) 
      static int[]concat​(int[] arra, - int[] arrb) -
      Returns an array that contains all the elements of the two arrays.
      -
      static booleancontainsAll​(int[] arra, - int[] arrb) -
      returns true if arra contains all elements of arrb
      -
      static booleancontainsAll​(java.lang.Object[] arra, - java.lang.Object[] arrb) -
      returns true if arra contains all elements of arrb
      -
      static booleancontainsAllAtStart​(int[] arra, - int[] arrb) -
      returns true if arra contains all elements of arrb at its start
      -
      static booleancontainsAllTrueElements​(boolean[] arra, - boolean[] arrb) -
      Return true if for each true element in arrb, the corresponding element - in arra is true
      -
      static booleancontainsAny​(java.lang.Object[] arra, - java.lang.Object[] arrb) -
      returns true if arra contains any element of arrb
      -
      static booleancontainsAt​(byte[] arra, - int start, - byte[] arrb) -
      Returns true if arra from position start contains all elements of arrb in - sequential order.
      -
      static booleancontainsAt​(char[] arra, - int start, - char[] arrb) -
      Returns true if arra from position start contains all elements of arrb in - sequential order.
      -
      static voidcopyAdjustArray​(java.lang.Object[] source, - java.lang.Object[] dest, - int[] colindex, - int adjust) -
      Similar to single slot adjusted copy, with multiple slots added or - removed.
      -
      static voidcopyAdjustArray​(java.lang.Object source, - java.lang.Object dest, - java.lang.Object addition, - int colindex, - int adjust) -
      Copies elements of source to dest.
      -
      static voidcopyArray​(java.lang.Object source, - java.lang.Object dest, - int count) -
      Convenience wrapper for System.arraycopy().
      -
      static byte[]copyBytes​(byte[] source, - byte[] dest, - int destOffset) -
      Copy the source to dest, returning dest or an enlarged array of result is - larger than dest.
      -
      static intcopyBytes​(long sourceOffset, - byte[] source, - int sourceOff, - int sourceLength, - long destOffset, - byte[] dest, - int destLength) -
      Byte arrays source and dest each begin at an offset in the common space.
      -
      static voidcopyMoveSegment​(java.lang.Object source, - java.lang.Object dest, - int size, - int index, - int segmentSize, - int destIndex) 
      static intcountCommonElements​(int[] arra, - int[] arrb) -
      Returns the number of elements shared between the two arrays containing - sets.
      -
      static intcountCommonElements​(java.lang.Object[] arra, - int alen, - java.lang.Object[] arrb) 
      static intcountNonStartElementsAt​(byte[] arra, - int start, - byte[] arrb) -
      Returns the count of elements in arra from position start that are not - among the elements of arrb.
      -
      static intcountSameElements​(byte[] arra, - int start, - byte[] arrb) -
      Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
      -
      static intcountSameElements​(char[] arra, - int start, - char[] arrb) -
      Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
      -
      static intcountSameElements​(int[] arra, - int start, - int[] arrb) -
      Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
      -
      static intcountSmallerElements​(int[] arra, - int value) -
      Returns the count of elements in arra that are smaller than the value.
      -
      static intcountSmallerEqualElements​(int[] arra, - int value) -
      Returns the count of elements in arra that are smaller/equal than the - value.
      -
      static intcountStartElementsAt​(byte[] arra, - int start, - byte[] arrb) -
      Returns the count of elements in arra from position start that are among - the elements of arrb.
      -
      static intcountStartIntIndexesInBooleanArray​(int[] arra, - boolean[] arrb) -
      Return array of indexes of boolean elements that are true.
      -
      static intcountTrueElements​(boolean[] arra) -
      Return count of true elements in array
      -
      static java.lang.ObjectduplicateArray​(java.lang.Object source) -
      Returns a duplicates of an array.
      -
      static voidfillArray​(boolean[] array, - boolean value) -
      Fills the int array with a value
      -
      static voidfillArray​(byte[] array, - int offset, - byte value) -
      Fills part of the array with a value.
      -
      static voidfillArray​(char[] array, - int offset, - char value) -
      Fills part of the array with a value.
      -
      static voidfillArray​(double[] array, - double value) -
      Fills the double array with a value
      -
      static voidfillArray​(int[] array, - int value) -
      Fills the int array with a value
      -
      static voidfillArray​(java.lang.Object[] array, - java.lang.Object value) -
      Fills the array with a value.
      -
      static voidfillSequence​(int[] colindex) 
      static intfind​(byte[] arra, - int start, - int limit, - byte[] arrb) -
      Returns the index of the first occurrence of arrb in arra.
      -
      static intfind​(byte[] arra, - int start, - int limit, - int b, - int c) -
      Returns the index of b or c in arra.
      -
      static intfind​(char[] array, - int value) 
      static intfind​(int[] array, - int value) -
      Finds index of value in small array.
      -
      static intfind​(int[] array, - int count, - int value) -
      Finds index of value in the first count elements of small array.
      -
      static intfind​(short[] array, - int value) 
      static intfind​(short[] array, - int value, - int offset, - int count) 
      static intfind​(java.lang.Object[] array, - java.lang.Object object) -
      Basic find for small arrays of Object.
      -
      static intfindIn​(byte[] arra, - int start, - int limit, - byte[] byteSet) -
      Returns an index into arra (or -1) where the character is in the byteSet - byte array.
      -
      static intfindNot​(int[] array, - int value) -
      Finds the first element of the array that is not equal to the given value.
      -
      static intfindNotIn​(byte[] arra, - int start, - int limit, - byte[] byteSet) -
      Returns an index into arra (or -1) where the character is not in the - charset byte array.
      -
      static longgetBinaryMultipleCeiling​(long value, - long unit) -
      uses 2**scale form and returns a multiple of unit that is larger or equal - to value
      -
      static longgetBinaryNormalisedCeiling​(long value) -
      returns the smallest value that is a power of 2 and larger or equal to - value
      -
      static longgetBinaryNormalisedCeiling​(long value, - int scale) -
      uses 2**scale form and returns a multiple of this that is larger or equal - to value
      -
      static intgetTwoPowerFloor​(int n) -
      returns the largest value that is 0 or a power of 2 and is smaller or - equal to n
      -
      static intgetTwoPowerScale​(int n) -
      returns the log2 of largest value that is 0 or a power of 2 and is - smaller or equal to n
      -
      static booleanhasAllNull​(java.lang.Object[] array, - int[] columnMap) 
      static booleanhasNull​(java.lang.Object[] array, - int[] columnMap) -
      Determines if the array has a null column for any of the positions given - in the rowColMap array.
      -
      static booleanhaveCommonElement​(int[] arra, - int[] arrb) -
      Returns true if arra and arrb share any element.
      -
      static booleanhaveEqualArrays​(int[] arra, - int[] arrb, - int count) -
      Returns true if the first count elements of arra and arrb are identical - subarrays of integers
      -
      static booleanhaveEqualArrays​(java.lang.Object[] arra, - java.lang.Object[] arrb, - int count) -
      Returns true if the first count elements of arra and arrb are identical - subarrays of Objects
      -
      static booleanhaveEqualSets​(int[] arra, - int[] arrb, - int count) -
      Returns true if the first count elements of arra and arrb are identical - sets of integers (not necessarily in the same order).
      -
      static voidintIndexesToBooleanArray​(int[] arra, - boolean[] arrb) -
      Set elements of arrb true if their indexes appear in arrb.
      -
      static booleanisAnyIntIndexInBooleanArray​(int[] arra, - boolean[] arrb) 
      static booleanisInSortedArray​(char ch, - char[] array) -
      Returns true if char argument is in array.
      -
      static booleanisTwoPower​(int n, - int max) -
      returns true if log2 n is in the range (0, max)
      -
      static voidorBooleanArray​(boolean[] source, - boolean[] dest) 
      static voidprojectMap​(int[] mainMap, - int[] subMap, - int[] newSubMap) 
      static voidprojectRow​(int[] row, - int[] columnMap, - int[] newRow) 
      static voidprojectRow​(java.lang.Object[] row, - int[] columnMap, - java.lang.Object[] newRow) -
      Copies some elements of row into newRow by using columnMap as - the list of indexes into row.
      -
      static voidprojectRowReverse​(java.lang.Object[] row, - int[] columnMap, - java.lang.Object[] newRow) -
      As above but copies in reverse direction.
      -
      static voidreorderMaps​(int[] mainMap, - int[] firstMap, - int[] secondMap) 
      static java.lang.ObjectresizeArray​(java.lang.Object source, - int newsize) -
      Returns a new array of given size, containing as many elements of the - original array as it can hold.
      -
      static java.lang.ObjectresizeArrayIfDifferent​(java.lang.Object source, - int newsize) -
      Returns the given array if newsize is the same as existing.
      -
      static voidsortArray​(int[] array) -
      Basic sort for small arrays of int.
      -
      static java.lang.ObjecttoAdjustedArray​(java.lang.Object source, - java.lang.Object addition, - int colindex, - int adjust) -
      Returns an array containing the elements of parameter source, with one - element removed or added.
      -
      static <T> T[]toAdjustedArray​(T[] source, - T addition) -
      Returns a new array containing the elements of parameter source with an - added element at the end.
      -
      static int[]toAdjustedColumnArray​(int[] colarr, - int[] colindex, - int adjust) -
      similar to the function with single colindex, but with multiple - adjustments.
      -
      static int[]toAdjustedColumnArray​(int[] colarr, - int colindex, - int adjust) -
      Returns a new array with the elements in collar adjusted to reflect - changes at colindex.
      -
      static byte[]toByteArray​(long hi, - long lo) -
      converts two longs to a byte[]
      -
      static int[]union​(int[] arra, - int[] arrb) -
      Returns an array that contains all the elements of the two arrays.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ArrayUtil

        -
        public ArrayUtil()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        clearArray

        -
        public static void clearArray​(int type,
        -                              java.lang.Object data,
        -                              int from,
        -                              int to)
        -
        Clears an area of the given array of the given type.
        -
        -
        Parameters:
        -
        type - int
        -
        data - Object
        -
        from - int
        -
        to - int
        -
        -
      • -
      - - - -
        -
      • -

        adjustArray

        -
        public static void adjustArray​(int type,
        -                               java.lang.Object array,
        -                               int usedElements,
        -                               int index,
        -                               int count)
        -
        Moves the contents of an array to allow both addition and removal of - elements. Used arguments must be in range.
        -
        -
        Parameters:
        -
        type - class type of the array
        -
        array - the array
        -
        usedElements - count of elements of array in use
        -
        index - point at which to add or remove elements
        -
        count - number of elements to add or remove
        -
        -
      • -
      - - - -
        -
      • -

        sortArray

        -
        public static void sortArray​(int[] array)
        -
        Basic sort for small arrays of int.
        -
        -
        Parameters:
        -
        array - int[]
        -
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(java.lang.Object[] array,
        -                       java.lang.Object object)
        -
        Basic find for small arrays of Object.
        -
        -
        Parameters:
        -
        array - Object[]
        -
        object - Object
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(int[] array,
        -                       int value)
        -
        Finds index of value in small array.
        -
        -
        Parameters:
        -
        array - int[]
        -
        value - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(int[] array,
        -                       int count,
        -                       int value)
        -
        Finds index of value in the first count elements of small array.
        -
        -
        Parameters:
        -
        array - int[]
        -
        count - int
        -
        value - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(short[] array,
        -                       int value)
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(short[] array,
        -                       int value,
        -                       int offset,
        -                       int count)
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(char[] array,
        -                       int value)
        -
      • -
      - - - -
        -
      • -

        findNot

        -
        public static int findNot​(int[] array,
        -                          int value)
        -
        Finds the first element of the array that is not equal to the given value.
        -
        -
        Parameters:
        -
        array - int[]
        -
        value - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        areEqualSets

        -
        public static boolean areEqualSets​(int[] arra,
        -                                   int[] arrb)
        -
        Returns true if arra and arrb contain the same set of integers, not - necessarily in the same order. This implies the arrays are of the same - length.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - int[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        haveEqualSets

        -
        public static boolean haveEqualSets​(int[] arra,
        -                                    int[] arrb,
        -                                    int count)
        -
        Returns true if the first count elements of arra and arrb are identical - sets of integers (not necessarily in the same order).
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - int[]
        -
        count - int
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        haveEqualArrays

        -
        public static boolean haveEqualArrays​(int[] arra,
        -                                      int[] arrb,
        -                                      int count)
        -
        Returns true if the first count elements of arra and arrb are identical - subarrays of integers
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - int[]
        -
        count - int
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        haveEqualArrays

        -
        public static boolean haveEqualArrays​(java.lang.Object[] arra,
        -                                      java.lang.Object[] arrb,
        -                                      int count)
        -
        Returns true if the first count elements of arra and arrb are identical - subarrays of Objects
        -
        -
        Parameters:
        -
        arra - Object[]
        -
        arrb - Object[]
        -
        count - int
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        haveCommonElement

        -
        public static boolean haveCommonElement​(int[] arra,
        -                                        int[] arrb)
        -
        Returns true if arra and arrb share any element. - -

        Used for checks for any overlap between two arrays of column indexes.

        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - int[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        commonElements

        -
        public static int[] commonElements​(int[] arra,
        -                                   int[] arrb)
        -
        Returns an int[] containing elements shared between the two arrays - arra and arrb. The arrays contain sets (no value is repeated). - - Used to find the overlap between two arrays of column indexes. - Ordering of the result arrays will be the same as in array - arra. The method assumes that each index is only listed - once in the two input arrays. -

        - e.g. - - - - - - - -
        Example
        The arrays
        int []arra={2,11,5,8}
        int []arrb={20,8,10,11,28,12}
        will result in:
        int []arrc={11,8}

        -
        -
        Parameters:
        -
        arra - int[] first column indexes
        -
        arrb - int[] second column indexes
        -
        Returns:
        -
        int[] common indexes or null if there is no overlap.
        -
        -
      • -
      - - - -
        -
      • -

        countCommonElements

        -
        public static int countCommonElements​(int[] arra,
        -                                      int[] arrb)
        -
        Returns the number of elements shared between the two arrays containing - sets.

        - - Returns the number of elements shared by two column index arrays. - This method assumes that each of these arrays contains a set (each - element index is listed only once in each index array). Otherwise the - returned number will NOT represent the number of unique column indexes - shared by both index array.

        -
        -
        Parameters:
        -
        arra - int[] first array of column indexes.
        -
        arrb - int[] second array of column indexes
        -
        Returns:
        -
        int number of elements shared by arra and arrb
        -
        -
      • -
      - - - -
        -
      • -

        countCommonElements

        -
        public static int countCommonElements​(java.lang.Object[] arra,
        -                                      int alen,
        -                                      java.lang.Object[] arrb)
        -
      • -
      - - - -
        -
      • -

        countSameElements

        -
        public static int countSameElements​(byte[] arra,
        -                                    int start,
        -                                    byte[] arrb)
        -
        Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        arrb - byte[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        countSameElements

        -
        public static int countSameElements​(char[] arra,
        -                                    int start,
        -                                    char[] arrb)
        -
        Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
        -
        -
        Parameters:
        -
        arra - char[]
        -
        start - int
        -
        arrb - char[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        countSameElements

        -
        public static int countSameElements​(int[] arra,
        -                                    int start,
        -                                    int[] arrb)
        -
        Returns the count of elements in arra from position start that are - sequentially equal to the elements of arrb.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        start - int
        -
        arrb - int[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        countSmallerElements

        -
        public static int countSmallerElements​(int[] arra,
        -                                       int value)
        -
        Returns the count of elements in arra that are smaller than the value.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        value - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        countSmallerEqualElements

        -
        public static int countSmallerEqualElements​(int[] arra,
        -                                            int value)
        -
        Returns the count of elements in arra that are smaller/equal than the - value.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        value - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        union

        -
        public static int[] union​(int[] arra,
        -                          int[] arrb)
        -
        Returns an array that contains all the elements of the two arrays. - Each array contains a set.
        -
        -
        Parameters:
        -
        arra - int[] containing unique vlaues
        -
        arrb - int[] containing unique values
        -
        Returns:
        -
        int[]
        -
        -
      • -
      - - - -
        -
      • -

        concat

        -
        public static int[] concat​(int[] arra,
        -                           int[] arrb)
        -
        Returns an array that contains all the elements of the two arrays.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - int[]
        -
        Returns:
        -
        int[]
        -
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(byte[] arra,
        -                       int start,
        -                       int limit,
        -                       byte[] arrb)
        -
        Returns the index of the first occurrence of arrb in arra. Or -1 if not - found.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        limit - int
        -
        arrb - byte[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        findNotIn

        -
        public static int findNotIn​(byte[] arra,
        -                            int start,
        -                            int limit,
        -                            byte[] byteSet)
        -
        Returns an index into arra (or -1) where the character is not in the - charset byte array.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        limit - int
        -
        byteSet - byte[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        findIn

        -
        public static int findIn​(byte[] arra,
        -                         int start,
        -                         int limit,
        -                         byte[] byteSet)
        -
        Returns an index into arra (or -1) where the character is in the byteSet - byte array.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        limit - int
        -
        byteSet - byte[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        find

        -
        public static int find​(byte[] arra,
        -                       int start,
        -                       int limit,
        -                       int b,
        -                       int c)
        -
        Returns the index of b or c in arra. Or -1 if not found.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        limit - int
        -
        b - int
        -
        c - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        booleanArrayToIntIndexes

        -
        public static int[] booleanArrayToIntIndexes​(boolean[] arrb)
        -
        Set elements of arrb true if their indexes appear in arrb.
        -
        -
        Parameters:
        -
        arrb - boolean[]
        -
        Returns:
        -
        int[]
        -
        -
      • -
      - - - -
        -
      • -

        intIndexesToBooleanArray

        -
        public static void intIndexesToBooleanArray​(int[] arra,
        -                                            boolean[] arrb)
        -
        Set elements of arrb true if their indexes appear in arrb.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - boolean[]
        -
        -
      • -
      - - - -
        -
      • -

        countStartIntIndexesInBooleanArray

        -
        public static int countStartIntIndexesInBooleanArray​(int[] arra,
        -                                                     boolean[] arrb)
        -
        Return array of indexes of boolean elements that are true.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - boolean[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        orBooleanArray

        -
        public static void orBooleanArray​(boolean[] source,
        -                                  boolean[] dest)
        -
      • -
      - - - -
        -
      • -

        areAllIntIndexesAsBooleanArray

        -
        public static boolean areAllIntIndexesAsBooleanArray​(int[] arra,
        -                                                     boolean[] arrb)
        -
        Returns true if all indexes and no other positions are true in arrb. arra - must have no duplicates. - - arra must have no duplicates.
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - boolean[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        areAllIntIndexesInBooleanArray

        -
        public static boolean areAllIntIndexesInBooleanArray​(int[] arra,
        -                                                     boolean[] arrb)
        -
      • -
      - - - -
        -
      • -

        isAnyIntIndexInBooleanArray

        -
        public static boolean isAnyIntIndexInBooleanArray​(int[] arra,
        -                                                  boolean[] arrb)
        -
      • -
      - - - -
        -
      • -

        containsAllTrueElements

        -
        public static boolean containsAllTrueElements​(boolean[] arra,
        -                                              boolean[] arrb)
        -
        Return true if for each true element in arrb, the corresponding element - in arra is true
        -
        -
        Parameters:
        -
        arra - boolean[]
        -
        arrb - boolean[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        countTrueElements

        -
        public static int countTrueElements​(boolean[] arra)
        -
        Return count of true elements in array
        -
        -
        Parameters:
        -
        arra - boolean[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        hasNull

        -
        public static boolean hasNull​(java.lang.Object[] array,
        -                              int[] columnMap)
        -
        Determines if the array has a null column for any of the positions given - in the rowColMap array.
        -
        -
        Parameters:
        -
        array - Object[]
        -
        columnMap - int[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        hasAllNull

        -
        public static boolean hasAllNull​(java.lang.Object[] array,
        -                                 int[] columnMap)
        -
      • -
      - - - -
        -
      • -

        containsAt

        -
        public static boolean containsAt​(byte[] arra,
        -                                 int start,
        -                                 byte[] arrb)
        -
        Returns true if arra from position start contains all elements of arrb in - sequential order.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        arrb - byte[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        countStartElementsAt

        -
        public static int countStartElementsAt​(byte[] arra,
        -                                       int start,
        -                                       byte[] arrb)
        -
        Returns the count of elements in arra from position start that are among - the elements of arrb. Stops at any element not in arrb.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        arrb - byte[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        containsAt

        -
        public static boolean containsAt​(char[] arra,
        -                                 int start,
        -                                 char[] arrb)
        -
        Returns true if arra from position start contains all elements of arrb in - sequential order.
        -
        -
        Parameters:
        -
        arra - char[]
        -
        start - int
        -
        arrb - char[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        countNonStartElementsAt

        -
        public static int countNonStartElementsAt​(byte[] arra,
        -                                          int start,
        -                                          byte[] arrb)
        -
        Returns the count of elements in arra from position start that are not - among the elements of arrb.
        -
        -
        Parameters:
        -
        arra - byte[]
        -
        start - int
        -
        arrb - byte[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        copyBytes

        -
        public static int copyBytes​(long sourceOffset,
        -                            byte[] source,
        -                            int sourceOff,
        -                            int sourceLength,
        -                            long destOffset,
        -                            byte[] dest,
        -                            int destLength)
        -
        Byte arrays source and dest each begin at an offset in the common space. - If there is an overlap between dest and the first sourceLength elements - of the source, the overlapping elements are copied to dest. Returns count - of copied bytes.
        -
        -
        Parameters:
        -
        sourceOffset - long
        -
        source - byte[]
        -
        sourceOff - int
        -
        sourceLength - int
        -
        destOffset - long
        -
        dest - byte[]
        -
        destLength - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        copyBytes

        -
        public static byte[] copyBytes​(byte[] source,
        -                               byte[] dest,
        -                               int destOffset)
        -
        Copy the source to dest, returning dest or an enlarged array of result is - larger than dest.
        -
        -
        Parameters:
        -
        source - byte[]
        -
        dest - byte[]
        -
        destOffset - int
        -
        Returns:
        -
        byte[]
        -
        -
      • -
      - - - -
        -
      • -

        copyArray

        -
        public static void copyArray​(java.lang.Object source,
        -                             java.lang.Object dest,
        -                             int count)
        -
        Convenience wrapper for System.arraycopy().
        -
        -
        Parameters:
        -
        source - Object
        -
        dest - Object
        -
        count - int
        -
        -
      • -
      - - - -
        -
      • -

        copyMoveSegment

        -
        public static void copyMoveSegment​(java.lang.Object source,
        -                                   java.lang.Object dest,
        -                                   int size,
        -                                   int index,
        -                                   int segmentSize,
        -                                   int destIndex)
        -
      • -
      - - - -
        -
      • -

        arraySlice

        -
        public static int[] arraySlice​(int[] source,
        -                               int start,
        -                               int count)
        -
        Returns a range of elements of source from start to end of the array.
        -
        -
        Parameters:
        -
        source - int[]
        -
        start - int
        -
        count - int
        -
        Returns:
        -
        int[]
        -
        -
      • -
      - - - -
        -
      • -

        fillArray

        -
        public static void fillArray​(char[] array,
        -                             int offset,
        -                             char value)
        -
        Fills part of the array with a value.
        -
        -
        Parameters:
        -
        array - char[]
        -
        offset - int
        -
        value - char
        -
        -
      • -
      - - - -
        -
      • -

        fillArray

        -
        public static void fillArray​(byte[] array,
        -                             int offset,
        -                             byte value)
        -
        Fills part of the array with a value.
        -
        -
        Parameters:
        -
        array - byte[]
        -
        offset - int
        -
        value - byte
        -
        -
      • -
      - - - -
        -
      • -

        fillArray

        -
        public static void fillArray​(java.lang.Object[] array,
        -                             java.lang.Object value)
        -
        Fills the array with a value.
        -
        -
        Parameters:
        -
        array - Object[]
        -
        value - Object
        -
        -
      • -
      - - - -
        -
      • -

        fillArray

        -
        public static void fillArray​(int[] array,
        -                             int value)
        -
        Fills the int array with a value
        -
        -
        Parameters:
        -
        array - int[]
        -
        value - int
        -
        -
      • -
      - - - -
        -
      • -

        fillArray

        -
        public static void fillArray​(double[] array,
        -                             double value)
        -
        Fills the double array with a value
        -
        -
        Parameters:
        -
        array - double[]
        -
        value - double
        -
        -
      • -
      - - - -
        -
      • -

        fillArray

        -
        public static void fillArray​(boolean[] array,
        -                             boolean value)
        -
        Fills the int array with a value
        -
        -
        Parameters:
        -
        array - boolean[]
        -
        value - boolean
        -
        -
      • -
      - - - -
        -
      • -

        duplicateArray

        -
        public static java.lang.Object duplicateArray​(java.lang.Object source)
        -
        Returns a duplicates of an array.
        -
        -
        Parameters:
        -
        source - Object
        -
        Returns:
        -
        Object
        -
        -
      • -
      - - - -
        -
      • -

        resizeArrayIfDifferent

        -
        public static java.lang.Object resizeArrayIfDifferent​(java.lang.Object source,
        -                                                      int newsize)
        -
        Returns the given array if newsize is the same as existing. Returns a new - array of given size, containing as many elements of the original array as - it can hold.
        -
        -
        Parameters:
        -
        source - Object
        -
        newsize - int
        -
        Returns:
        -
        Object
        -
        -
      • -
      - - - -
        -
      • -

        resizeArray

        -
        public static java.lang.Object resizeArray​(java.lang.Object source,
        -                                           int newsize)
        -
        Returns a new array of given size, containing as many elements of the - original array as it can hold. N.B. Always returns a new array even if - newsize parameter is the same as the old size.
        -
        -
        Parameters:
        -
        source - Object
        -
        newsize - int
        -
        Returns:
        -
        Object
        -
        -
      • -
      - - - - - -
        -
      • -

        toAdjustedArray

        -
        public static <T> T[] toAdjustedArray​(T[] source,
        -                                      T addition)
        -
        Returns a new array containing the elements of parameter source with an - added element at the end. Parameter addition is an Object to add.
        -
        -
        Type Parameters:
        -
        T - type of array element
        -
        Parameters:
        -
        source - T[]
        -
        addition - element to append to array
        -
        Returns:
        -
        T[]
        -
        -
      • -
      - - - -
        -
      • -

        toAdjustedArray

        -
        public static java.lang.Object toAdjustedArray​(java.lang.Object source,
        -                                               java.lang.Object addition,
        -                                               int colindex,
        -                                               int adjust)
        -
        Returns an array containing the elements of parameter source, with one - element removed or added. Parameter adjust {-1, +1} indicates the - operation. Parameter colindex indicates the position at which an element - is removed or added. Parameter addition is an Object to add when adjust - is +1.
        -
        -
        Parameters:
        -
        source - Object
        -
        addition - Object
        -
        colindex - int
        -
        adjust - int
        -
        Returns:
        -
        Object
        -
        -
      • -
      - - - -
        -
      • -

        copyAdjustArray

        -
        public static void copyAdjustArray​(java.lang.Object source,
        -                                   java.lang.Object dest,
        -                                   java.lang.Object addition,
        -                                   int colindex,
        -                                   int adjust)
        -
        Copies elements of source to dest. If adjust is -1 the element at - colindex is not copied. If adjust is +1 that element is filled with the - Object addition. All the rest of the elements in source are shifted left - or right accordingly when they are copied. If adjust is 0 the addition is - copied over the element at colindex. No checks are performed on array - sizes and an exception is thrown if they are not consistent with the - other arguments.
        -
        -
        Parameters:
        -
        source - Object
        -
        dest - Object
        -
        addition - Object
        -
        colindex - int
        -
        adjust - int
        -
        -
      • -
      - - - -
        -
      • -

        copyAdjustArray

        -
        public static void copyAdjustArray​(java.lang.Object[] source,
        -                                   java.lang.Object[] dest,
        -                                   int[] colindex,
        -                                   int adjust)
        -
        Similar to single slot adjusted copy, with multiple slots added or - removed. The colindex array is the ordered lists the slots to be added or - removed. The adjust argument can be {-1, +1) for remove or add. No checks - are performed on array sizes and no exception is thrown if they are not - consistent with the other arguments.
        -
        -
        Parameters:
        -
        source - Object[]
        -
        dest - Object[]
        -
        colindex - int[]
        -
        adjust - int
        -
        -
      • -
      - - - -
        -
      • -

        toAdjustedColumnArray

        -
        public static int[] toAdjustedColumnArray​(int[] colarr,
        -                                          int colindex,
        -                                          int adjust)
        -
        Returns a new array with the elements in collar adjusted to reflect - changes at colindex.

        - - Each element in collarr represents an index into another array - otherarr.

        - - colindex is the index at which an element is added or removed. - Each element in the result array represents the new, - adjusted index.

        - - For each element of collarr that represents an index equal to - colindex and adjust is -1, the result will not contain that element - and will be shorter than collar by one element.

        -
        -
        Parameters:
        -
        colarr - the source array
        -
        colindex - index at which to perform adjustment
        -
        adjust - +1, 0 or -1
        -
        Returns:
        -
        new, adjusted array
        -
        -
      • -
      - - - -
        -
      • -

        toAdjustedColumnArray

        -
        public static int[] toAdjustedColumnArray​(int[] colarr,
        -                                          int[] colindex,
        -                                          int adjust)
        -
        similar to the function with single colindex, but with multiple - adjustments.
        -
        -
        Parameters:
        -
        colarr - int[]
        -
        colindex - int[]
        -
        adjust - int
        -
        Returns:
        -
        int[]
        -
        -
      • -
      - - - -
        -
      • -

        projectRow

        -
        public static void projectRow​(java.lang.Object[] row,
        -                              int[] columnMap,
        -                              java.lang.Object[] newRow)
        -
        Copies some elements of row into newRow by using columnMap as - the list of indexes into row.

        - - columnMap and newRow are of equal length and are normally - shorter than row.

        -
        -
        Parameters:
        -
        row - the source array
        -
        columnMap - the list of indexes into row
        -
        newRow - the destination array
        -
        -
      • -
      - - - -
        -
      • -

        projectRow

        -
        public static void projectRow​(int[] row,
        -                              int[] columnMap,
        -                              int[] newRow)
        -
      • -
      - - - -
        -
      • -

        projectRowReverse

        -
        public static void projectRowReverse​(java.lang.Object[] row,
        -                                     int[] columnMap,
        -                                     java.lang.Object[] newRow)
        -
        As above but copies in reverse direction.

        -
        -
        Parameters:
        -
        row - the target array
        -
        columnMap - the list of indexes into row
        -
        newRow - the source array
        -
        -
      • -
      - - - -
        -
      • -

        projectMap

        -
        public static void projectMap​(int[] mainMap,
        -                              int[] subMap,
        -                              int[] newSubMap)
        -
      • -
      - - - -
        -
      • -

        reorderMaps

        -
        public static void reorderMaps​(int[] mainMap,
        -                               int[] firstMap,
        -                               int[] secondMap)
        -
      • -
      - - - -
        -
      • -

        fillSequence

        -
        public static void fillSequence​(int[] colindex)
        -
      • -
      - - - -
        -
      • -

        byteArrayToChars

        -
        public static char[] byteArrayToChars​(byte[] bytes)
        -
      • -
      - - - -
        -
      • -

        byteArrayToChars

        -
        public static char[] byteArrayToChars​(byte[] bytes,
        -                                      int bytesLength)
        -
      • -
      - - - -
        -
      • -

        charArrayToBytes

        -
        public static byte[] charArrayToBytes​(char[] chars)
        -
      • -
      - - - -
        -
      • -

        charArrayToBytes

        -
        public static byte[] charArrayToBytes​(char[] chars,
        -                                      int length)
        -
      • -
      - - - -
        -
      • -

        isInSortedArray

        -
        public static boolean isInSortedArray​(char ch,
        -                                      char[] array)
        -
        Returns true if char argument is in array.
        -
        -
        Parameters:
        -
        ch - char
        -
        array - char[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        containsAll

        -
        public static boolean containsAll​(java.lang.Object[] arra,
        -                                  java.lang.Object[] arrb)
        -
        returns true if arra contains all elements of arrb
        -
        -
        Parameters:
        -
        arra - Object[]
        -
        arrb - Object[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        containsAny

        -
        public static boolean containsAny​(java.lang.Object[] arra,
        -                                  java.lang.Object[] arrb)
        -
        returns true if arra contains any element of arrb
        -
        -
        Parameters:
        -
        arra - Object[]
        -
        arrb - Object[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        containsAll

        -
        public static boolean containsAll​(int[] arra,
        -                                  int[] arrb)
        -
        returns true if arra contains all elements of arrb
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - int[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        containsAllAtStart

        -
        public static boolean containsAllAtStart​(int[] arra,
        -                                         int[] arrb)
        -
        returns true if arra contains all elements of arrb at its start
        -
        -
        Parameters:
        -
        arra - int[]
        -
        arrb - int[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        toByteArray

        -
        public static byte[] toByteArray​(long hi,
        -                                 long lo)
        -
        converts two longs to a byte[]
        -
        -
        Parameters:
        -
        hi - long
        -
        lo - long
        -
        Returns:
        -
        byte[]
        -
        -
      • -
      - - - -
        -
      • -

        byteSequenceToLong

        -
        public static long byteSequenceToLong​(byte[] bytes,
        -                                      int pos)
        -
      • -
      - - - -
        -
      • -

        compare

        -
        public static int compare​(byte[] a,
        -                          byte[] b)
        -
        Compares two arrays. Returns -1, 0, +1. If one array is shorter and all - the elements are equal to the other's elements, -1 is returned.
        -
        -
        Parameters:
        -
        a - byte[]
        -
        b - byte[]
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        compare

        -
        public static int compare​(byte[] a,
        -                          int aOffset,
        -                          int aLength,
        -                          byte[] b,
        -                          int bOffset,
        -                          int bLength)
        -
      • -
      - - - -
        -
      • -

        getBinaryMultipleCeiling

        -
        public static long getBinaryMultipleCeiling​(long value,
        -                                            long unit)
        -
        uses 2**scale form and returns a multiple of unit that is larger or equal - to value
        -
        -
        Parameters:
        -
        value - long
        -
        unit - long
        -
        Returns:
        -
        long
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryNormalisedCeiling

        -
        public static long getBinaryNormalisedCeiling​(long value,
        -                                              int scale)
        -
        uses 2**scale form and returns a multiple of this that is larger or equal - to value
        -
        -
        Parameters:
        -
        value - long
        -
        scale - int
        -
        Returns:
        -
        long
        -
        -
      • -
      - - - -
        -
      • -

        getBinaryNormalisedCeiling

        -
        public static long getBinaryNormalisedCeiling​(long value)
        -
        returns the smallest value that is a power of 2 and larger or equal to - value
        -
        -
        Parameters:
        -
        value - long
        -
        Returns:
        -
        long
        -
        -
      • -
      - - - -
        -
      • -

        isTwoPower

        -
        public static boolean isTwoPower​(int n,
        -                                 int max)
        -
        returns true if log2 n is in the range (0, max)
        -
        -
        Parameters:
        -
        n - int
        -
        max - int
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        getTwoPowerFloor

        -
        public static int getTwoPowerFloor​(int n)
        -
        returns the largest value that is 0 or a power of 2 and is smaller or - equal to n
        -
        -
        Parameters:
        -
        n - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        getTwoPowerScale

        -
        public static int getTwoPowerScale​(int n)
        -
        returns the log2 of largest value that is 0 or a power of 2 and is - smaller or equal to n
        -
        -
        Parameters:
        -
        n - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        cdiv

        -
        public static int cdiv​(int a,
        -                       int b)
        -
        a and b must be both positive returns (a / b) or (a / b) + 1 if remainder - is larger than zero
        -
        -
        Parameters:
        -
        a - int
        -
        b - int
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        cdiv

        -
        public static long cdiv​(long a,
        -                        long b)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AsciiInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AsciiInputStream.html deleted file mode 100644 index 870e9dc7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AsciiInputStream.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - -AsciiInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class AsciiInputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.InputStream
    • -
    • -
        -
      • org.hsqldb.lib.AsciiInputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.lang.AutoCloseable
    -
    -
    -
    public class AsciiInputStream
    -extends java.io.InputStream
    -
    An input stream that reads US-ASCII values from a Reader, in compliance - with the Java US_ASCII Charset encoder, including - - utf-16-surrogate-pairs.
    -
    -
    Since:
    -
    2.7.1
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      AsciiInputStream​(java.io.Reader reader) -
      Constructs a new instance for the given reader.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose() 
      intread() -
      Reads the next byte of data from the input stream.
      -
      -
        -
      • - - -

        Methods inherited from class java.io.InputStream

        -available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        AsciiInputStream

        -
        public AsciiInputStream​(java.io.Reader reader)
        -
        Constructs a new instance for the given reader.
        -
        -
        Parameters:
        -
        reader - from which to read
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Overrides:
        -
        close in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        public int read()
        -         throws java.io.IOException
        -
        Reads the next byte of data from the input stream. The value byte is - returned as an int in the range 0 to - ASCII_MAX. If no byte is available because the end of the stream - has been reached, the value -1 is returned. This method - blocks until input data is available, the end of the stream is detected, - or an exception is thrown. -

        - UTF-16 characters above ASCII_MAX produce a - NON_ASCII_REPLACEMENT value when read. -

        - Surrogate pairs are correctly counted as a single character and produce a - single NON_ASCII_REPLACEMENT value when read.

        -
        -
        Specified by:
        -
        read in class java.io.InputStream
        -
        Returns:
        -
        the next byte of data, or -1 if the end of the - stream is reached.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AsciiOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AsciiOutputStream.html deleted file mode 100644 index 7b30afed..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/AsciiOutputStream.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - - -AsciiOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class AsciiOutputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.OutputStream
    • -
    • -
        -
      • org.hsqldb.lib.AsciiOutputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    -
    -
    -
    public class AsciiOutputStream
    -extends java.io.OutputStream
    -
    An OutputStream that writes 7-bit US-ASCII values to a Writer, in compliance - with the Java US_ASCII Charset decoder. -

    - In particular, values greater than {@link #ASCII_MAX) are written as - {@link #NON_ASCII_REPLACEMENT}.

    -
    -
    Since:
    -
    2.7.1
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static intASCII_BITS -
      is 7;
      -
      static intASCII_MASK -
      is 0b01111111
      -
      static intASCII_MAX -
      is 2^7 - 1 (127)
      -
      static intNON_ASCII_MIN -
      is 2^7 (128)
      -
      static intNON_ASCII_REPLACEMENT -
      is '�' (65533), the Unicode replacement character.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      AsciiOutputStream​(java.io.Writer writer) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose() 
      voidflush() 
      voidwrite​(int b) 
      -
        -
      • - - -

        Methods inherited from class java.io.OutputStream

        -nullOutputStream, write, write
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        ASCII_MASK

        -
        public static final int ASCII_MASK
        -
        is 0b01111111
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        ASCII_MAX

        -
        public static final int ASCII_MAX
        -
        is 2^7 - 1 (127)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        NON_ASCII_MIN

        -
        public static final int NON_ASCII_MIN
        -
        is 2^7 (128)
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        NON_ASCII_REPLACEMENT

        -
        public static final int NON_ASCII_REPLACEMENT
        -
        is '�' (65533), the Unicode replacement character.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        AsciiOutputStream

        -
        public AsciiOutputStream​(java.io.Writer writer)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Overrides:
        -
        close in class java.io.OutputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -           throws java.io.IOException
        -
        -
        Specified by:
        -
        flush in interface java.io.Flushable
        -
        Overrides:
        -
        flush in class java.io.OutputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(int b)
        -           throws java.io.IOException
        -
        -
        Specified by:
        -
        write in class java.io.OutputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/BasicTextJdkLogFormatter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/BasicTextJdkLogFormatter.html deleted file mode 100644 index 60b6c720..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/BasicTextJdkLogFormatter.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - -BasicTextJdkLogFormatter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class BasicTextJdkLogFormatter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.util.logging.Formatter
    • -
    • -
        -
      • org.hsqldb.lib.BasicTextJdkLogFormatter
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    public class BasicTextJdkLogFormatter
    -extends java.util.logging.Formatter
    -
    An implementation of java.util.logging.Formatter very close to - SimpleFormatter. - - The features here are optional timestamping, sortable numeric time stamp - text, and no indication of invoking source code location (logger ID, - class name, method name, etc.).
    -
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    Formatter, -SimpleFormatter
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static java.lang.StringLS 
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.Stringformat​(java.util.logging.LogRecord record) 
      -
        -
      • - - -

        Methods inherited from class java.util.logging.Formatter

        -formatMessage, getHead, getTail
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        LS

        -
        public static final java.lang.String LS
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        BasicTextJdkLogFormatter

        -
        public BasicTextJdkLogFormatter​(boolean withTime)
        -
      • -
      - - - -
        -
      • -

        BasicTextJdkLogFormatter

        -
        public BasicTextJdkLogFormatter()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        format

        -
        public java.lang.String format​(java.util.logging.LogRecord record)
        -
        -
        Specified by:
        -
        format in class java.util.logging.Formatter
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CharArrayWriter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CharArrayWriter.html deleted file mode 100644 index 95e5e223..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CharArrayWriter.html +++ /dev/null @@ -1,507 +0,0 @@ - - - - - -CharArrayWriter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class CharArrayWriter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.CharArrayWriter
    • -
    -
  • -
-
-
    -
  • -
    -
    public class CharArrayWriter
    -extends java.lang.Object
    -
    A writer for char strings.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      char[]getBuffer() 
      voidreset() 
      voidreset​(char[] buffer) 
      voidsetSize​(int newPos) 
      intsize() 
      char[]toCharArray() 
      java.lang.StringtoString() 
      voidwrite​(int c) 
      intwrite​(java.io.Reader reader, - int length) 
      voidwrite​(java.lang.String str, - int off, - int len) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CharArrayWriter

        -
        public CharArrayWriter​(int size)
        -
      • -
      - - - -
        -
      • -

        CharArrayWriter

        -
        public CharArrayWriter​(char[] buffer)
        -
      • -
      - - - -
        -
      • -

        CharArrayWriter

        -
        public CharArrayWriter​(java.io.Reader reader,
        -                       int length)
        -                throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        CharArrayWriter

        -
        public CharArrayWriter​(java.io.Reader reader)
        -                throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        write

        -
        public void write​(int c)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public int write​(java.io.Reader reader,
        -                 int length)
        -          throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(java.lang.String str,
        -                  int off,
        -                  int len)
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset​(char[] buffer)
        -
      • -
      - - - -
        -
      • -

        toCharArray

        -
        public char[] toCharArray()
        -
      • -
      - - - -
        -
      • -

        getBuffer

        -
        public char[] getBuffer()
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize​(int newPos)
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ClosableByteArrayOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ClosableByteArrayOutputStream.html deleted file mode 100644 index be2070ed..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ClosableByteArrayOutputStream.html +++ /dev/null @@ -1,829 +0,0 @@ - - - - - -ClosableByteArrayOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ClosableByteArrayOutputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.OutputStream
    • -
    • -
        -
      • org.hsqldb.lib.ClosableByteArrayOutputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    -
    -
    -
    public class ClosableByteArrayOutputStream
    -extends java.io.OutputStream
    -
    Provides true Closable semantics ordinarily missing in a - ByteArrayOutputStream.

    - - Accumulates output in a byte array that automatically grows as needed.

    - - Data is retrieved using toByteArray(), - toByteArrayInputStream(), toString() and - toString(encoding).

    - - Closing a ClosableByteArrayOutputStream prevents - further write operations, but all other operations may succeed until after - the first invocation of free().

    - - Freeing a ClosableByteArrayOutputStream closes the stream and - releases the internal buffer, preventing successful invocation of all - operations, with the exception of size(), close(), - isClosed(), free() and isFreed().

    - - This class is especially useful when an accumulating output stream must be - handed off to an external client under contract that the stream should - exhibit true Closable behaviour in response both to internally tracked - events and to client invocation of the OutputStream.close() method.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intcapacity() -
      Returns the current capacity of this stream's data buffer.
      -
      voidclose() -
      Closes this object for further writing.
      -
      voidflush() -
      By default, does nothing.
      -
      voidfree() -
      Closes this object and releases the underlying buffer for - garbage collection.
      -
      booleanisClosed() -
      Retrieves whether this stream is closed.
      -
      booleanisFreed() -
      Retrieves whether this stream is freed.
      -
      voidreset() -
      Resets the count field of this output stream to zero, so that - all currently accumulated data is effectively discarded.
      -
      voidsetSize​(int newSize) -
      Sets the size of this stream's accumulated data.
      -
      intsize() -
      Returns the current size of this stream's accumulated data.
      -
      byte[]toByteArray() -
      Retrieves a copy of this stream's accumulated data, as a byte array.
      -
      java.io.ByteArrayInputStreamtoByteArrayInputStream() -
      Performs an efficient (zero-copy) conversion of the data accumulated in - this output stream to an input stream.
      -
      java.lang.StringtoString() -
      Converts this stream's accumulated data into a string, translating bytes - into characters according to the platform's default character encoding.
      -
      java.lang.StringtoString​(java.lang.String enc) -
      Converts this stream's accumulated data into a string, translating bytes - into characters according to the specified character encoding.
      -
      voidtrimToSize() -
      Attempts to reduce this stream's capacity to its current size.
      -
      voidwrite​(byte[] b, - int off, - int len) -
      Writes the specified portion of the designated octet sequence.
      -
      voidwrite​(int b) -
      Writes the specified single byte.
      -
      voidwriteTo​(java.io.OutputStream out) -
      Writes the complete contents of this stream's accumulated data to the - specified output stream.
      -
      -
        -
      • - - -

        Methods inherited from class java.io.OutputStream

        -nullOutputStream, write
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ClosableByteArrayOutputStream

        -
        public ClosableByteArrayOutputStream()
        -
        Creates a new output stream.

        - - The buffer capacity is initially 32 bytes, though its size increases - if necessary.

        -
      • -
      - - - -
        -
      • -

        ClosableByteArrayOutputStream

        -
        public ClosableByteArrayOutputStream​(int size)
        -                              throws java.lang.IllegalArgumentException
        -
        Creates a new output stream with a buffer capacity of the specified - size, in bytes.
        -
        -
        Parameters:
        -
        size - the initial size.
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if size is negative.
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        write

        -
        public void write​(int b)
        -           throws java.io.IOException
        -
        Writes the specified single byte.
        -
        -
        Specified by:
        -
        write in class java.io.OutputStream
        -
        Parameters:
        -
        b - the single byte to be written.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been closed.
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(byte[] b,
        -                  int off,
        -                  int len)
        -           throws java.io.IOException
        -
        Writes the specified portion of the designated octet sequence.

        -
        -
        Overrides:
        -
        write in class java.io.OutputStream
        -
        Parameters:
        -
        b - the data.
        -
        off - the start offset in the data.
        -
        len - the number of bytes to write.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been closed.
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -           throws java.io.IOException
        -
        By default, does nothing.

        -
        -
        Specified by:
        -
        flush in interface java.io.Flushable
        -
        Overrides:
        -
        flush in class java.io.OutputStream
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been closed.
        -
        -
      • -
      - - - -
        -
      • -

        writeTo

        -
        public void writeTo​(java.io.OutputStream out)
        -             throws java.io.IOException
        -
        Writes the complete contents of this stream's accumulated data to the - specified output stream.

        - - The operation occurs as if by calling out.write(buf, 0, count).

        -
        -
        Parameters:
        -
        out - the output stream to which to write the data.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been freed.
        -
        -
      • -
      - - - -
        -
      • -

        capacity

        -
        public int capacity()
        -             throws java.io.IOException
        -
        Returns the current capacity of this stream's data buffer.
        -
        -
        Returns:
        -
        the length of the internal data array
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been freed.
        -
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -           throws java.io.IOException
        -
        Resets the count field of this output stream to zero, so that - all currently accumulated data is effectively discarded.

        - - Further write operations will reuse the allocated buffer space.

        -
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been closed.
        -
        See Also:
        -
        count
        -
        -
      • -
      - - - -
        -
      • -

        trimToSize

        -
        public void trimToSize()
        -                throws java.io.IOException
        -
        Attempts to reduce this stream's capacity to its current size.

        - - If the data buffer is larger than necessary to hold its current sequence - of bytes, then it may be resized to become more space efficient. - Calling this method may, but is not required to, affect the value - returned by a subsequent call to the capacity() method.

        -
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been freed.
        -
        -
      • -
      - - - -
        -
      • -

        toByteArray

        -
        public byte[] toByteArray()
        -                   throws java.io.IOException
        -
        Retrieves a copy of this stream's accumulated data, as a byte array.
        -
        -
        Returns:
        -
        a copy of this stream's accumulated data, as a byte array.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been freed.
        -
        See Also:
        -
        size()
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Returns the current size of this stream's accumulated data.
        -
        -
        Returns:
        -
        the value of the count field, which is the number - of valid bytes in this output stream.
        -
        See Also:
        -
        count
        -
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize​(int newSize)
        -
        Sets the size of this stream's accumulated data.

        -
        -
        Parameters:
        -
        newSize - the new size
        -
        Throws:
        -
        java.lang.ArrayIndexOutOfBoundsException - if new size is negative
        -
        -
      • -
      - - - -
        -
      • -

        toByteArrayInputStream

        -
        public java.io.ByteArrayInputStream toByteArrayInputStream()
        -                                                    throws java.io.IOException
        -
        Performs an efficient (zero-copy) conversion of the data accumulated in - this output stream to an input stream.

        - - To ensure the future integrity of the resulting input stream, free is invoked upon this output stream as a side-effect.

        -
        -
        Returns:
        -
        an input stream representing this output stream's accumulated - data
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been freed.
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Converts this stream's accumulated data into a string, translating bytes - into characters according to the platform's default character encoding.
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        String translated from this stream's accumulated data.
        -
        Throws:
        -
        java.lang.RuntimeException - may be thrown if this output stream has been - freed.
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString​(java.lang.String enc)
        -                          throws java.io.IOException,
        -                                 java.io.UnsupportedEncodingException
        -
        Converts this stream's accumulated data into a string, translating bytes - into characters according to the specified character encoding.
        -
        -
        Parameters:
        -
        enc - a character-encoding name.
        -
        Returns:
        -
        String translated from the buffer's contents.
        -
        Throws:
        -
        java.io.IOException - may be thrown if this output stream has been - freed.
        -
        java.io.UnsupportedEncodingException - If the named encoding is not - supported.
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
        Closes this object for further writing.

        - - Other operations may continue to succeed until after the first invocation - of free().

        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Overrides:
        -
        close in class java.io.OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        Retrieves whether this stream is closed.

        -
        -
        Returns:
        -
        true if this stream is closed, else false
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -
        Closes this object and releases the underlying buffer for - garbage collection.
        -
      • -
      - - - -
        -
      • -

        isFreed

        -
        public boolean isFreed()
        -
        Retrieves whether this stream is freed.

        -
        -
        Returns:
        -
        true if this stream is freed; else false.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ClosableCharArrayWriter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ClosableCharArrayWriter.html deleted file mode 100644 index 17cee879..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ClosableCharArrayWriter.html +++ /dev/null @@ -1,825 +0,0 @@ - - - - - -ClosableCharArrayWriter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ClosableCharArrayWriter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.Writer
    • -
    • -
        -
      • org.hsqldb.lib.ClosableCharArrayWriter
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable
    -
    -
    -
    public class ClosableCharArrayWriter
    -extends java.io.Writer
    -
    Provides Closable semantics ordinarily missing in a - CharArrayWriter.

    - - Accumulates output in a character array that automatically grows as needed.

    - - Data is retrieved using toCharArray(), toCharArrayReader() - and toString().

    - - Closing a ClosableCharArrayWriter prevents - further write operations, but all other operations will succeed until after - the first invocation of free().

    - - Freeing a ClosableCharArrayWriter closes the writer and - releases its internal buffer, preventing successful invocation of all - operations, with the exception of size(), close(), - isClosed(), free() and isFreed().

    - - This class is especially useful when an accumulating writer must be - handed off to an extenal client under contract that the writer should - exhibit true Closable behaviour, both in response to internally tracked - events and to client invocation of the Writer.close() method.

    -
    -
    Since:
    -
    1.8.x
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ClosableCharArrayWriter() -
      Creates a new writer.
      -
      ClosableCharArrayWriter​(int size) -
      Creates a new writer with a buffer capacity of the specified - size, in characters.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intcapacity() -
      Returns the current capacity of this writer's data buffer.
      -
      voidclose() -
      Closes this object for further writing.
      -
      voidflush() -
      By default, does nothing.
      -
      voidfree() -
      Closes this object and releases the underlying buffer for - garbage collection.
      -
      booleanisClosed() 
      booleanisFreed() 
      voidreset() -
      Resets the count field of this writer to zero, so that all - currently accumulated output is effectively discarded.
      -
      voidsetSize​(int newSize) -
      Sets the size of this writer's accumulated character data.
      -
      intsize() -
      Returns the current size of this writer's accumulated character data.
      -
      char[]toCharArray() -
      Creates a newly allocated character array.
      -
      java.io.CharArrayReadertoCharArrayReader() -
      Performs an efficient (zero-copy) conversion of the character data - accumulated in this writer to a reader.
      -
      java.lang.StringtoString() -
      Converts this writer's accumulated data into a string.
      -
      voidtrimToSize() -
      Attempts to reduce this writer's buffer capacity to its current size.
      -
      voidwrite​(char[] c, - int off, - int len) -
      Writes the designated portion of the designated character array
      -
      voidwrite​(int c) -
      Writes the specified single character.
      -
      voidwrite​(java.lang.String str, - int off, - int len) -
      Efficiently writes the designated portion of the designated string.
      -
      voidwriteTo​(java.io.Writer out) -
      Writes the complete contents of this writer's buffered data to the - specified writer.
      -
      -
        -
      • - - -

        Methods inherited from class java.io.Writer

        -append, append, append, nullWriter, write, write
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ClosableCharArrayWriter

        -
        public ClosableCharArrayWriter()
        -
        Creates a new writer.

        - - The buffer capacity is initially 32 characters, although its size - automatically increases when necessary.

        -
      • -
      - - - -
        -
      • -

        ClosableCharArrayWriter

        -
        public ClosableCharArrayWriter​(int size)
        -                        throws java.lang.IllegalArgumentException
        -
        Creates a new writer with a buffer capacity of the specified - size, in characters.
        -
        -
        Parameters:
        -
        size - the initial size.
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if size is negative.
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        write

        -
        public void write​(int c)
        -           throws java.io.IOException
        -
        Writes the specified single character.
        -
        -
        Overrides:
        -
        write in class java.io.Writer
        -
        Parameters:
        -
        c - the single character to be written.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been closed.
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(char[] c,
        -                  int off,
        -                  int len)
        -           throws java.io.IOException
        -
        Writes the designated portion of the designated character array

        .

        -
        -
        Specified by:
        -
        write in class java.io.Writer
        -
        Parameters:
        -
        c - the source character sequence.
        -
        off - the start offset in the source character sequence.
        -
        len - the number of characters to write.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been closed.
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(java.lang.String str,
        -                  int off,
        -                  int len)
        -           throws java.io.IOException
        -
        Efficiently writes the designated portion of the designated string.

        - - The operation occurs as if by calling - str.getChars(off, off + len, buf, count).

        -
        -
        Overrides:
        -
        write in class java.io.Writer
        -
        Parameters:
        -
        str - the string from which to write
        -
        off - the start offset in the string.
        -
        len - the number of characters to write.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been closed.
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -           throws java.io.IOException
        -
        By default, does nothing.

        -
        -
        Specified by:
        -
        flush in interface java.io.Flushable
        -
        Specified by:
        -
        flush in class java.io.Writer
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been closed.
        -
        -
      • -
      - - - -
        -
      • -

        writeTo

        -
        public void writeTo​(java.io.Writer out)
        -             throws java.io.IOException
        -
        Writes the complete contents of this writer's buffered data to the - specified writer.

        - - The operation occurs as if by calling out.write(buf, 0, count).

        -
        -
        Parameters:
        -
        out - the writer to which to write the data.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been freed.
        -
        -
      • -
      - - - -
        -
      • -

        capacity

        -
        public int capacity()
        -             throws java.io.IOException
        -
        Returns the current capacity of this writer's data buffer.
        -
        -
        Returns:
        -
        the current capacity (the length of the internal - data array)
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been freed.
        -
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -           throws java.io.IOException
        -
        Resets the count field of this writer to zero, so that all - currently accumulated output is effectively discarded. Further write - operations will reuse the allocated buffer space.
        -
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this output stream has been closed.
        -
        See Also:
        -
        count
        -
        -
      • -
      - - - -
        -
      • -

        trimToSize

        -
        public void trimToSize()
        -                throws java.io.IOException
        -
        Attempts to reduce this writer's buffer capacity to its current size.

        - - If the buffer is larger than necessary to hold its current sequence of - characters, then it may be resized to become more space efficient. - Calling this method may, but is not required to, affect the value - returned by a subsequent call to the capacity() method.

        -
        -
        Throws:
        -
        java.io.IOException - if buffer is freed
        -
        -
      • -
      - - - -
        -
      • -

        toCharArray

        -
        public char[] toCharArray()
        -                   throws java.io.IOException
        -
        Creates a newly allocated character array. Its size is the current - size of this writer and the valid contents of the buffer - have been copied into it.
        -
        -
        Returns:
        -
        the current contents of this writer, as a character array.
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been freed.
        -
        See Also:
        -
        size()
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Returns the current size of this writer's accumulated character data.
        -
        -
        Returns:
        -
        the value of the count field, which is the number - of valid characters accumulated in this writer.
        -
        See Also:
        -
        count
        -
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize​(int newSize)
        -
        Sets the size of this writer's accumulated character data.

        -
        -
        Parameters:
        -
        newSize - the new size of this writer's accumulated data
        -
        Throws:
        -
        java.lang.ArrayIndexOutOfBoundsException - if new size is negative
        -
        -
      • -
      - - - -
        -
      • -

        toCharArrayReader

        -
        public java.io.CharArrayReader toCharArrayReader()
        -                                          throws java.io.IOException
        -
        Performs an efficient (zero-copy) conversion of the character data - accumulated in this writer to a reader.

        - - To ensure the integrity of the resulting reader, free is invoked upon this writer as a side-effect.

        -
        -
        Returns:
        -
        a reader representing this writer's accumulated - character data
        -
        Throws:
        -
        java.io.IOException - if an I/O error occurs. - In particular, an IOException may be thrown - if this writer has been freed.
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Converts this writer's accumulated data into a string.
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        String constructed from this writer's accumulated data
        -
        Throws:
        -
        java.lang.RuntimeException - may be thrown if this writer has been - freed.
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
        Closes this object for further writing.

        - - Other operations may continue to succeed until after the first invocation - of free().

        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Specified by:
        -
        close in class java.io.Writer
        -
        -
      • -
      - - - -
        -
      • -

        isClosed

        -
        public boolean isClosed()
        -
        -
        Returns:
        -
        true if this writer is closed, else false
        -
        -
      • -
      - - - -
        -
      • -

        free

        -
        public void free()
        -
        Closes this object and releases the underlying buffer for - garbage collection.
        -
      • -
      - - - -
        -
      • -

        isFreed

        -
        public boolean isFreed()
        -
        -
        Returns:
        -
        true if this writer is freed; else false.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Collection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Collection.html deleted file mode 100644 index 487ba24e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Collection.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - -Collection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface Collection<E>

-
-
-
- -
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        int size()
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        boolean isEmpty()
        -
      • -
      - - - -
        -
      • -

        contains

        -
        boolean contains​(java.lang.Object o)
        -
      • -
      - - - - - - - - - -
        -
      • -

        add

        -
        boolean add​(E o)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        boolean remove​(java.lang.Object o)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        boolean addAll​(Collection<? extends E> c)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        void clear()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CountUpDownLatch.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CountUpDownLatch.html deleted file mode 100644 index c9f5cd0d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CountUpDownLatch.html +++ /dev/null @@ -1,715 +0,0 @@ - - - - - -CountUpDownLatch (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class CountUpDownLatch

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.CountUpDownLatch
    • -
    -
  • -
-
-
    -
  • -
    -
    public class CountUpDownLatch
    -extends java.lang.Object
    -
    A variation on CountDownLatch to allow counting up as well - as down.
    -
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      CountUpDownLatch() -
      Default constructor.
      -
      CountUpDownLatch​(int initialCount) -
      Constructs a new CountUpDownLatch initialized with the given - initialCount.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidawait() -
      Causes the current thread to wait until count reaches zero, - unless the thread is interrupted.
      -
      booleanawait​(long timeout, - java.util.concurrent.TimeUnit unit) -
      Causes the current thread to wait until count reaches zero, - unless the thread is interrupted, or the - specified waiting time elapses.
      -
      booleancountDown() -
      Decrements the count of the latch, releasing all waiting threads if the - count transitions to zero.
      -
      booleancountDown​(int amount) -
      Decrements the count of the latch by the given amount, - releasing all waiting threads if count transitions to zero.
      -
      booleancountUp() -
      Increments the count of the latch.
      -
      booleancountUp​(int amount) -
      Increments the count of the latch by the given amount.
      -
      booleanequals​(java.lang.Object obj) -
      Returns true if and only if this and obj refer to the - same object (this == obj has the value true).
      -
      booleanequals​(CountUpDownLatch other) -
      Returns true if and only if this and obj refer to the - same object (this == obj has the value true).
      -
      intgetCount() -
      Returns the current count.
      -
      inthashCode() -
      As much as is reasonably practical, returns distinct integers for - distinct objects.
      -
      booleansetCount​(int newCount) -
      Updates count to the requested newCount, returning - true on transition to zero.
      -
      java.lang.StringtoString() -
      Returns a string representation of this object.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -getClass, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CountUpDownLatch

        -
        public CountUpDownLatch()
        -
        Default constructor. -

        - Equivalent to new - CountUpDownLatch(0)

        -
      • -
      - - - -
        -
      • -

        CountUpDownLatch

        -
        public CountUpDownLatch​(int initialCount)
        -
        Constructs a new CountUpDownLatch initialized with the given - initialCount.
        -
        -
        Parameters:
        -
        initialCount - the initial count
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if initialCount is negative
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        await

        -
        public void await()
        -           throws java.lang.InterruptedException
        -
        Causes the current thread to wait until count reaches zero, - unless the thread is interrupted. -

        - If the current count is already zero, then this method returns - immediately. -

        - If the current count is greater than zero, then the current - thread becomes disabled for thread scheduling purposes and lies dormant - until either: -

        - If the current thread: -
          -
        • has its interrupted status set on entry to this method; or -
        • is interrupted while waiting, -
        - then InterruptedException is thrown and the current thread's - interrupted status is cleared.
        -
        -
        Throws:
        -
        java.lang.InterruptedException - if the current thread is interrupted - while waiting
        -
        -
      • -
      - - - -
        -
      • -

        await

        -
        public boolean await​(long timeout,
        -                     java.util.concurrent.TimeUnit unit)
        -              throws java.lang.InterruptedException
        -
        Causes the current thread to wait until count reaches zero, - unless the thread is interrupted, or the - specified waiting time elapses. -

        - If the current count is zero, then this method returns - immediately with the value true. -

        - If the current count is greater than zero, then the current - thread becomes disabled for thread scheduling purposes and lies dormant - until either: -

          -
        • The count reaches zero due to an invocation of countDown(), countDown(int}, or - setCount(int) setCount(int)} -
        • Some other thread interrupts the - current thread -
        • The specified waiting time elapses. -
        - If the count reaches zero then the method returns with the value - true. -

        - If the current thread: -

          -
        • has its interrupted status set on entry to this method; or -
        • is interrupted while waiting, -
        - then InterruptedException is thrown and the current thread's - interrupted status is cleared. -

        - If the specified waiting time elapses then the value false is - returned. If the time is less than or equal to zero, the method will not - wait at all.

        -
        -
        Parameters:
        -
        timeout - the maximum time to wait
        -
        unit - the time unit of the timeout argument
        -
        Returns:
        -
        true if the count reached zero and false if the - waiting time elapsed before the count reached zero
        -
        Throws:
        -
        java.lang.InterruptedException - if the current thread is interrupted while - waiting
        -
        -
      • -
      - - - -
        -
      • -

        countUp

        -
        public boolean countUp()
        -
        Increments the count of the latch. -

        -
        -
        Returns:
        -
        true if count transitioned from zero to a new - value
        -
        Throws:
        -
        java.lang.ArithmeticException - when the operation would otherwise cause a - silent numeric overflow, resulting in a - negative count.
        -
        -
      • -
      - - - -
        -
      • -

        countUp

        -
        public boolean countUp​(int amount)
        -
        Increments the count of the latch by the given amount. -

        -
        -
        Parameters:
        -
        amount - by which to increment count
        -
        Returns:
        -
        true if count transitioned from zero to a new - value
        -
        Throws:
        -
        java.lang.ArithmeticException - when the operation would otherwise cause - a silent numeric overflow, resulting in - a negative count.
        -
        java.lang.IllegalArgumentException - if amount is less than one.
        -
        -
      • -
      - - - -
        -
      • -

        countDown

        -
        public boolean countDown()
        -
        Decrements the count of the latch, releasing all waiting threads if the - count transitions to zero. -

        - If the current count is zero, no action occurs and false is returned - immediately;

        -
        -
        Returns:
        -
        true if count transitions to zero
        -
        -
      • -
      - - - -
        -
      • -

        countDown

        -
        public boolean countDown​(int amount)
        -
        Decrements the count of the latch by the given amount, - releasing all waiting threads if count transitions to zero. -

        - If the current count is zero, no action occurs and false is - returned immediately; otherwise, count is decremented by the - lesser of amount and current count (i.e. if - amount is greater than current count, then new - count is zero, else new count is current count - minus amount.

        -
        -
        Parameters:
        -
        amount - by which to decrement the count
        -
        Returns:
        -
        true if count transitions to zero
        -
        Throws:
        -
        java.lang.IllegalArgumentException - when amount is non-positive
        -
        -
      • -
      - - - -
        -
      • -

        getCount

        -
        public int getCount()
        -
        Returns the current count. -

        - Because another thread may update count at any time, typically - this should not be used to compute input values for any of the @{code - count} mutating methods and instead should be reserved for debugging and - testing purposes (e.g. to assert that the current count is the expected - count, given a set of know operations has occurred and given that it is - known no other threads could be updating the count)

        -
        -
        Returns:
        -
        the current count
        -
        -
      • -
      - - - -
        -
      • -

        setCount

        -
        public boolean setCount​(int newCount)
        -
        Updates count to the requested newCount, returning - true on transition to zero. -

        - If newCount is zero and the current count is zero, no - action occurs and false is returned immediately. immediately;

        -
        -
        Parameters:
        -
        newCount - to which to update count; must be non-negative.
        -
        Returns:
        -
        true if count transitions to zero.
        -
        Throws:
        -
        java.lang.IllegalArgumentException - when newCount is negative
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Returns a string representation of this object. -

        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        a string identifying this latch, as well as its current - count.
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        As much as is reasonably practical, returns distinct integers for - distinct objects.
        -
        -
        Overrides:
        -
        hashCode in class java.lang.Object
        -
        Returns:
        -
        a hash code value for this latch. This method is supported for - the benefit of hash tables
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals​(CountUpDownLatch other)
        -
        Returns true if and only if this and obj refer to the - same object (this == obj has the value true).
        -
        -
        Parameters:
        -
        other - to test.
        -
        Returns:
        -
        if and only if this == obj
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals​(java.lang.Object obj)
        -
        Returns true if and only if this and obj refer to the - same object (this == obj has the value true).
        -
        -
        Overrides:
        -
        equals in class java.lang.Object
        -
        Parameters:
        -
        obj - to test.
        -
        Returns:
        -
        if and only if this == obj
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CountdownInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CountdownInputStream.html deleted file mode 100644 index 866ad415..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/CountdownInputStream.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - -CountdownInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class CountdownInputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.InputStream
    • -
    • -
        -
      • org.hsqldb.lib.CountdownInputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.lang.AutoCloseable
    -
    -
    -
    public final class CountdownInputStream
    -extends java.io.InputStream
    -
    Counts down from a specified value the number of bytes actually read - from the wrapped InputStream.

    - - Returns minus one (-1) early from readXXX methods if the count - down reaches zero (0) before the end of the wrapped InputStream - is encountered.

    - - This class is especially useful when a fixed number of bytes is to be read - from an InputStream that is in turn to be used as the source for an - InputStreamReader.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      CountdownInputStream​(java.io.InputStream is) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intavailable() 
      voidclose() 
      longgetCount() 
      intread() 
      intread​(byte[] buf) 
      intread​(byte[] buf, - int off, - int len) 
      voidsetCount​(long count) 
      longskip​(long count) 
      -
        -
      • - - -

        Methods inherited from class java.io.InputStream

        -mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        CountdownInputStream

        -
        public CountdownInputStream​(java.io.InputStream is)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        read

        -
        public int read()
        -         throws java.io.IOException
        -
        -
        Specified by:
        -
        read in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        public int read​(byte[] buf)
        -         throws java.io.IOException
        -
        -
        Overrides:
        -
        read in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        public int read​(byte[] buf,
        -                int off,
        -                int len)
        -         throws java.io.IOException
        -
        -
        Overrides:
        -
        read in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Overrides:
        -
        close in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        available

        -
        public int available()
        -              throws java.io.IOException
        -
        -
        Overrides:
        -
        available in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        skip

        -
        public long skip​(long count)
        -          throws java.io.IOException
        -
        -
        Overrides:
        -
        skip in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        getCount

        -
        public long getCount()
        -
      • -
      - - - -
        -
      • -

        setCount

        -
        public void setCount​(long count)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DataOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DataOutputStream.html deleted file mode 100644 index bb885887..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DataOutputStream.html +++ /dev/null @@ -1,662 +0,0 @@ - - - - - -DataOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DataOutputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.OutputStream
    • -
    • -
        -
      • java.io.FilterOutputStream
      • -
      • -
          -
        • java.io.BufferedOutputStream
        • -
        • -
            -
          • org.hsqldb.lib.DataOutputStream
          • -
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.lang.AutoCloseable
    -
    -
    -
    public class DataOutputStream
    -extends java.io.BufferedOutputStream
    -implements java.io.DataOutput
    -
    A wrapper for OutputStream
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      DataOutputStream​(java.io.OutputStream stream) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      longwrite​(java.io.InputStream inputStream, - long length) 
      longwrite​(java.io.Reader reader, - long length) 
      voidwriteBoolean​(boolean v) 
      voidwriteByte​(int v) 
      voidwriteBytes​(java.lang.String s) 
      voidwriteChar​(int v) 
      voidwriteChars​(char[] c) 
      voidwriteChars​(char[] c, - int length) 
      voidwriteChars​(java.lang.String s) 
      voidwriteDouble​(double v) 
      voidwriteFloat​(float v) 
      voidwriteInt​(int v) 
      voidwriteLong​(long v) 
      voidwriteShort​(int v) 
      voidwriteUTF​(java.lang.String str) 
      -
        -
      • - - -

        Methods inherited from class java.io.BufferedOutputStream

        -flush, write, write
      • -
      -
        -
      • - - -

        Methods inherited from class java.io.FilterOutputStream

        -close, write
      • -
      -
        -
      • - - -

        Methods inherited from class java.io.OutputStream

        -nullOutputStream
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.io.DataOutput

        -write, write, write
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DataOutputStream

        -
        public DataOutputStream​(java.io.OutputStream stream)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        writeByte

        -
        public final void writeByte​(int v)
        -                     throws java.io.IOException
        -
        -
        Specified by:
        -
        writeByte in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeInt

        -
        public final void writeInt​(int v)
        -                    throws java.io.IOException
        -
        -
        Specified by:
        -
        writeInt in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeLong

        -
        public final void writeLong​(long v)
        -                     throws java.io.IOException
        -
        -
        Specified by:
        -
        writeLong in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeChar

        -
        public void writeChar​(int v)
        -               throws java.io.IOException
        -
        -
        Specified by:
        -
        writeChar in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeChars

        -
        public void writeChars​(java.lang.String s)
        -                throws java.io.IOException
        -
        -
        Specified by:
        -
        writeChars in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeChars

        -
        public void writeChars​(char[] c)
        -                throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeChars

        -
        public void writeChars​(char[] c,
        -                       int length)
        -                throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public long write​(java.io.Reader reader,
        -                  long length)
        -           throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public long write​(java.io.InputStream inputStream,
        -                  long length)
        -           throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeBoolean

        -
        public void writeBoolean​(boolean v)
        -                  throws java.io.IOException
        -
        -
        Specified by:
        -
        writeBoolean in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeShort

        -
        public void writeShort​(int v)
        -                throws java.io.IOException
        -
        -
        Specified by:
        -
        writeShort in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeFloat

        -
        public void writeFloat​(float v)
        -                throws java.io.IOException
        -
        -
        Specified by:
        -
        writeFloat in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeDouble

        -
        public void writeDouble​(double v)
        -                 throws java.io.IOException
        -
        -
        Specified by:
        -
        writeDouble in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeBytes

        -
        public void writeBytes​(java.lang.String s)
        -                throws java.io.IOException
        -
        -
        Specified by:
        -
        writeBytes in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeUTF

        -
        public void writeUTF​(java.lang.String str)
        -              throws java.io.IOException
        -
        -
        Specified by:
        -
        writeUTF in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DoubleIntIndex.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DoubleIntIndex.html deleted file mode 100644 index e3c51438..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DoubleIntIndex.html +++ /dev/null @@ -1,1172 +0,0 @@ - - - - - -DoubleIntIndex (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DoubleIntIndex

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.DoubleIntIndex
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    LongLookup
    -
    -
    -
    public class DoubleIntIndex
    -extends java.lang.Object
    -implements LongLookup
    -
    Maintains an ordered integer->integer lookup table, consisting of two - columns, one for keys, the other for values. Equal keys are allowed. - - The table is sorted on either the key or value column, depending on the calls to - setKeysSearchTarget() or setValuesSearchTarget(). By default, the table is - sorted on values. Equal values are sorted by key.

    - - findXXX() methods return the array index into the list - pair containing a matching key or value, or or -1 if not found.

    - - Sorting methods originally contributed by Tony Lai (tony_lai@users dot sourceforge.net). - Non-recursive implementation of fast quicksort added by Sergio Bossa sbtourist@users dot sourceforge.net)

    -
    -
    Since:
    -
    1.8.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      DoubleIntIndex​(int capacity) 
      DoubleIntIndex​(int capacity, - boolean fixedSize) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intadd​(int key, - int value) -
      Adds a pair, maintaining sort order on - current search target column.
      -
      intadd​(long key, - long value) 
      intaddCount​(int key) 
      intaddCount​(int key, - int value) -
      Used for values as counters.
      -
      booleanaddOrReplaceUnique​(int key, - int value) -
      Updates the value if key is present, or adds the key/value paire.
      -
      booleanaddSorted​(int key, - int value) -
      Adds a key, value pair into the table with the guarantee that the key - is equal or larger than the largest existing key.
      -
      booleanaddUnique​(int key, - int value) -
      Adds a pair, ensuring no duplicate key xor value already exists in the - current search target column.
      -
      booleanaddUnsorted​(int key, - int value) -
      Adds a pair into the table.
      -
      booleanaddUnsorted​(long key, - long value) 
      booleanaddUnsorted​(LongLookup other) 
      intcapacity() 
      voidclear() 
      booleancompactLookupAsIntervals() 
      voidcopyTo​(DoubleIntIndex other) 
      LongLookupduplicate() 
      intfindFirstEqualKeyIndex​(int value) 
      intfindFirstGreaterEqualKeyIndex​(int value) 
      intfindFirstGreaterEqualSlotIndex​(int value) -
      This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
      -
      intgetKey​(int i) 
      int[]getKeys() 
      longgetLongKey​(int i) 
      longgetLongValue​(int i) 
      longgetTotalValues() 
      intgetValue​(int i) 
      int[]getValues() 
      intlookup​(int key) 
      intlookup​(int key, - int def) 
      longlookup​(long key) 
      longlookup​(long key, - long def) 
      intlookupFirstGreaterEqual​(int key) 
      voidremove​(int position) 
      voidremoveAll() 
      booleanremoveKey​(int key) -
      Removes the (unique) key and its value.
      -
      voidremoveRange​(int start, - int limit) 
      voidsetKey​(int i, - int key) -
      Modifies an existing pair at the given index.
      -
      voidsetKeysSearchTarget() 
      voidsetLongValue​(int i, - long value) -
      Modifies an existing pair at the given index.
      -
      voidsetSize​(int newSize) 
      voidsetValue​(int i, - int value) -
      Modifies an existing pair at the given index.
      -
      voidsetValuesSearchTarget() 
      intsize() 
      voidsort() 
      voidsortOnKeys() 
      voidsortOnValues() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DoubleIntIndex

        -
        public DoubleIntIndex​(int capacity)
        -
      • -
      - - - -
        -
      • -

        DoubleIntIndex

        -
        public DoubleIntIndex​(int capacity,
        -                      boolean fixedSize)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKey

        -
        public int getKey​(int i)
        -
      • -
      - - - -
        -
      • -

        getLongKey

        -
        public long getLongKey​(int i)
        -
        -
        Specified by:
        -
        getLongKey in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        getLongValue

        -
        public long getLongValue​(int i)
        -
        -
        Specified by:
        -
        getLongValue in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        getValue

        -
        public int getValue​(int i)
        -
      • -
      - - - -
        -
      • -

        setKey

        -
        public void setKey​(int i,
        -                   int key)
        -
        Modifies an existing pair at the given index.
        -
        -
        Parameters:
        -
        i - the index
        -
        key - the new key
        -
        -
      • -
      - - - -
        -
      • -

        setValue

        -
        public void setValue​(int i,
        -                     int value)
        -
        Modifies an existing pair at the given index.
        -
        -
        Parameters:
        -
        i - the index
        -
        value - the new value
        -
        -
      • -
      - - - -
        -
      • -

        setLongValue

        -
        public void setLongValue​(int i,
        -                         long value)
        -
        Modifies an existing pair at the given index.
        -
        -
        Specified by:
        -
        setLongValue in interface LongLookup
        -
        Parameters:
        -
        i - the index
        -
        value - the new value
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Specified by:
        -
        size in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        capacity

        -
        public int capacity()
        -
      • -
      - - - -
        -
      • -

        getKeys

        -
        public int[] getKeys()
        -
      • -
      - - - -
        -
      • -

        getValues

        -
        public int[] getValues()
        -
      • -
      - - - - - - - -
        -
      • -

        setSize

        -
        public void setSize​(int newSize)
        -
      • -
      - - - -
        -
      • -

        addUnsorted

        -
        public boolean addUnsorted​(long key,
        -                           long value)
        -
        -
        Specified by:
        -
        addUnsorted in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        addUnsorted

        -
        public boolean addUnsorted​(int key,
        -                           int value)
        -
        Adds a pair into the table.
        -
        -
        Parameters:
        -
        key - the key
        -
        value - the value
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - - - - - -
        -
      • -

        addSorted

        -
        public boolean addSorted​(int key,
        -                         int value)
        -
        Adds a key, value pair into the table with the guarantee that the key - is equal or larger than the largest existing key. This prevents a sort - from taking place on next call to find()
        -
        -
        Parameters:
        -
        key - the key
        -
        value - the value
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - -
        -
      • -

        addUnique

        -
        public boolean addUnique​(int key,
        -                         int value)
        -
        Adds a pair, ensuring no duplicate key xor value already exists in the - current search target column.
        -
        -
        Parameters:
        -
        key - the key
        -
        value - the value
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - -
        -
      • -

        removeKey

        -
        public boolean removeKey​(int key)
        -
        Removes the (unique) key and its value. Must be sorted on key.
        -
        -
        Parameters:
        -
        key - the key to remove
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - -
        -
      • -

        addOrReplaceUnique

        -
        public boolean addOrReplaceUnique​(int key,
        -                                  int value)
        -
        Updates the value if key is present, or adds the key/value paire. - Must be sorted on key.
        -
        -
        Parameters:
        -
        key - the key to add or find
        -
        value - the value to add or update
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - -
        -
      • -

        addCount

        -
        public int addCount​(int key,
        -                    int value)
        -
        Used for values as counters. Adds the value to the existing value for the - key. Or adds the key - value pair.
        -
        -
        Parameters:
        -
        key - the key to update or add
        -
        value - the count to add
        -
        Returns:
        -
        the new count for the key
        -
        -
      • -
      - - - -
        -
      • -

        addCount

        -
        public int addCount​(int key)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public int add​(long key,
        -               long value)
        -
        -
        Specified by:
        -
        add in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public int add​(int key,
        -               int value)
        -
        Adds a pair, maintaining sort order on - current search target column.
        -
        -
        Parameters:
        -
        key - the key
        -
        value - the value
        -
        Returns:
        -
        index of added key or -1 if full
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        public long lookup​(long key)
        -            throws java.util.NoSuchElementException
        -
        -
        Specified by:
        -
        lookup in interface LongLookup
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        public int lookup​(int key)
        -           throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        public long lookup​(long key,
        -                   long def)
        -
        -
        Specified by:
        -
        lookup in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        public int lookup​(int key,
        -                  int def)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        -
        Specified by:
        -
        clear in interface LongLookup
        -
        -
      • -
      - - - - - - - -
        -
      • -

        lookupFirstGreaterEqual

        -
        public int lookupFirstGreaterEqual​(int key)
        -                            throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        setValuesSearchTarget

        -
        public void setValuesSearchTarget()
        -
      • -
      - - - -
        -
      • -

        setKeysSearchTarget

        -
        public void setKeysSearchTarget()
        -
      • -
      - - - -
        -
      • -

        findFirstGreaterEqualKeyIndex

        -
        public int findFirstGreaterEqualKeyIndex​(int value)
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - -
        -
      • -

        findFirstEqualKeyIndex

        -
        public int findFirstEqualKeyIndex​(int value)
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - - - - - -
        -
      • -

        findFirstGreaterEqualSlotIndex

        -
        public int findFirstGreaterEqualSlotIndex​(int value)
        -
        This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - -
        -
      • -

        sortOnKeys

        -
        public void sortOnKeys()
        -
      • -
      - - - -
        -
      • -

        sortOnValues

        -
        public void sortOnValues()
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        -
        Specified by:
        -
        sort in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        removeRange

        -
        public void removeRange​(int start,
        -                        int limit)
        -
      • -
      - - - -
        -
      • -

        removeAll

        -
        public void removeAll()
        -
      • -
      - - - - - - - -
        -
      • -

        remove

        -
        public final void remove​(int position)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DoubleLongIndex.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DoubleLongIndex.html deleted file mode 100644 index 432f8281..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/DoubleLongIndex.html +++ /dev/null @@ -1,680 +0,0 @@ - - - - - -DoubleLongIndex (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DoubleLongIndex

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.DoubleLongIndex
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    LongLookup
    -
    -
    -
    public final class DoubleLongIndex
    -extends java.lang.Object
    -implements LongLookup
    -
    Maintains an ordered long->long lookup table, consisting of two - columns, one for keys, the other for values. Equal keys are allowed.

    - - The table is sorted on key column.

    - - findXXX() methods return the array index into the list - pair containing a matching key or value, or or -1 if not found.

    - - Based on org.hsqldb.lib.DoubleIntIndex

    -
    -
    Since:
    -
    1.8.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DoubleLongIndex

        -
        public DoubleLongIndex​(int capacity)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getLongKey

        -
        public long getLongKey​(int i)
        -
        -
        Specified by:
        -
        getLongKey in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        getLongValue

        -
        public long getLongValue​(int i)
        -
        -
        Specified by:
        -
        getLongValue in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        setLongValue

        -
        public void setLongValue​(int i,
        -                         long value)
        -
        Modifies an existing pair.
        -
        -
        Specified by:
        -
        setLongValue in interface LongLookup
        -
        Parameters:
        -
        i - the index
        -
        value - the value
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Specified by:
        -
        size in interface LongLookup
        -
        -
      • -
      - - - - - - - -
        -
      • -

        setSize

        -
        public void setSize​(int newSize)
        -
      • -
      - - - -
        -
      • -

        addUnsorted

        -
        public boolean addUnsorted​(long key,
        -                           long value)
        -
        -
        Specified by:
        -
        addUnsorted in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public int add​(long key,
        -               long value)
        -
        -
        Specified by:
        -
        add in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        public long lookup​(long key)
        -            throws java.util.NoSuchElementException
        -
        -
        Specified by:
        -
        lookup in interface LongLookup
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        public long lookup​(long key,
        -                   long def)
        -
        -
        Specified by:
        -
        lookup in interface LongLookup
        -
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        -
        Specified by:
        -
        clear in interface LongLookup
        -
        -
      • -
      - - - - - - - -
        -
      • -

        findFirstGreaterEqualKeyIndex

        -
        public int findFirstGreaterEqualKeyIndex​(long value)
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - -
        -
      • -

        findFirstEqualKeyIndex

        -
        public int findFirstEqualKeyIndex​(long value)
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - -
        -
      • -

        findFirstGreaterEqualSlotIndex

        -
        public int findFirstGreaterEqualSlotIndex​(long value)
        -
        This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - - - - - -
        -
      • -

        sort

        -
        public void sort()
        -
        -
        Specified by:
        -
        sort in interface LongLookup
        -
        -
      • -
      - - - - - - - - -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/EventLogInterface.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/EventLogInterface.html deleted file mode 100644 index e91fb4aa..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/EventLogInterface.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - -EventLogInterface (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface EventLogInterface

-
-
-
-
    -
  • -
    -
    public interface EventLogInterface
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        logSevereEvent

        -
        void logSevereEvent​(java.lang.String message,
        -                    java.lang.Throwable t)
        -
      • -
      - - - -
        -
      • -

        logWarningEvent

        -
        void logWarningEvent​(java.lang.String message,
        -                     java.lang.Throwable t)
        -
      • -
      - - - -
        -
      • -

        logInfoEvent

        -
        void logInfoEvent​(java.lang.String message)
        -
      • -
      - - - -
        -
      • -

        logDetailEvent

        -
        void logDetailEvent​(java.lang.String message)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccess.FileSync.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccess.FileSync.html deleted file mode 100644 index 10d1d4f5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccess.FileSync.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - -FileAccess.FileSync (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface FileAccess.FileSync

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    FileUtil.FileSync
    -
    -
    -
    Enclosing interface:
    -
    FileAccess
    -
    -
    -
    public static interface FileAccess.FileSync
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        sync

        -
        void sync()
        -   throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccess.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccess.html deleted file mode 100644 index 9a9f1e76..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccess.html +++ /dev/null @@ -1,542 +0,0 @@ - - - - - -FileAccess (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface FileAccess

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    FileAccessRes, FileUtil
    -
    -
    -
    public interface FileAccess
    -
    Interface for abstraction of file access.
    -
    -
    Since:
    -
    1.8.0
    -
    Author:
    -
    Ocke Janssen oj@openoffice.org
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        openInputStreamElement

        -
        java.io.InputStream openInputStreamElement​(java.lang.String streamName)
        -                                    throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        openOutputStreamElement

        -
        java.io.OutputStream openOutputStreamElement​(java.lang.String streamName)
        -                                      throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        openOutputStreamElementAppend

        -
        java.io.OutputStream openOutputStreamElementAppend​(java.lang.String streamName)
        -                                            throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        isStreamElement

        -
        boolean isStreamElement​(java.lang.String elementName)
        -
      • -
      - - - -
        -
      • -

        createParentDirs

        -
        void createParentDirs​(java.lang.String filename)
        -
      • -
      - - - -
        -
      • -

        removeElement

        -
        boolean removeElement​(java.lang.String filename)
        -
      • -
      - - - -
        -
      • -

        renameElement

        -
        boolean renameElement​(java.lang.String oldName,
        -                      java.lang.String newName)
        -
      • -
      - - - -
        -
      • -

        renameElementOrCopy

        -
        boolean renameElementOrCopy​(java.lang.String oldName,
        -                            java.lang.String newName,
        -                            EventLogInterface logger)
        -
      • -
      - - - -
        -
      • -

        getFileSync

        -
        FileAccess.FileSync getFileSync​(java.io.OutputStream os)
        -                         throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccessRes.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccessRes.html deleted file mode 100644 index b174ea4b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileAccessRes.html +++ /dev/null @@ -1,519 +0,0 @@ - - - - - -FileAccessRes (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class FileAccessRes

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.FileAccessRes
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    FileAccess
    -
    -
    -
    public class FileAccessRes
    -extends java.lang.Object
    -implements FileAccess
    -
    -
    Since:
    -
    1.8.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FileAccessRes

        -
        public FileAccessRes()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        isStreamElement

        -
        public boolean isStreamElement​(java.lang.String fileName)
        -
        -
        Specified by:
        -
        isStreamElement in interface FileAccess
        -
        -
      • -
      - - - -
        -
      • -

        openInputStreamElement

        -
        public java.io.InputStream openInputStreamElement​(java.lang.String fileName)
        -                                           throws java.io.IOException
        -
        -
        Specified by:
        -
        openInputStreamElement in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        createParentDirs

        -
        public void createParentDirs​(java.lang.String filename)
        -
        -
        Specified by:
        -
        createParentDirs in interface FileAccess
        -
        -
      • -
      - - - -
        -
      • -

        removeElement

        -
        public boolean removeElement​(java.lang.String filename)
        -
        -
        Specified by:
        -
        removeElement in interface FileAccess
        -
        -
      • -
      - - - -
        -
      • -

        renameElement

        -
        public boolean renameElement​(java.lang.String oldName,
        -                             java.lang.String newName)
        -
        -
        Specified by:
        -
        renameElement in interface FileAccess
        -
        -
      • -
      - - - - - - - -
        -
      • -

        openOutputStreamElement

        -
        public java.io.OutputStream openOutputStreamElement​(java.lang.String streamName)
        -                                             throws java.io.IOException
        -
        -
        Specified by:
        -
        openOutputStreamElement in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        openOutputStreamElementAppend

        -
        public java.io.OutputStream openOutputStreamElementAppend​(java.lang.String streamName)
        -                                                   throws java.io.IOException
        -
        -
        Specified by:
        -
        openOutputStreamElementAppend in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        getFileSync

        -
        public FileAccess.FileSync getFileSync​(java.io.OutputStream os)
        -                                throws java.io.IOException
        -
        -
        Specified by:
        -
        getFileSync in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileArchiver.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileArchiver.html deleted file mode 100644 index 1a32e14e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileArchiver.html +++ /dev/null @@ -1,456 +0,0 @@ - - - - - -FileArchiver (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class FileArchiver

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.FileArchiver
    • -
    -
  • -
-
-
    -
  • -
    -
    public class FileArchiver
    -extends java.lang.Object
    -
    Creates a direct, compressed or decompressed copy of a file.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      FileArchiver() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidarchive​(java.lang.String infilename, - java.lang.String outfilename, - FileAccess storage, - int compressionType) 
      static voidcopyFile​(java.lang.String infilename, - java.lang.String outfilename, - FileAccess storage) 
      static voidunarchive​(java.lang.String infilename, - java.lang.String outfilename, - FileAccess storage, - int compressionType) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        FileArchiver

        -
        public FileArchiver()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        copyFile

        -
        public static void copyFile​(java.lang.String infilename,
        -                            java.lang.String outfilename,
        -                            FileAccess storage)
        -                     throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        archive

        -
        public static void archive​(java.lang.String infilename,
        -                           java.lang.String outfilename,
        -                           FileAccess storage,
        -                           int compressionType)
        -                    throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        unarchive

        -
        public static void unarchive​(java.lang.String infilename,
        -                             java.lang.String outfilename,
        -                             FileAccess storage,
        -                             int compressionType)
        -                      throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileUtil.FileSync.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileUtil.FileSync.html deleted file mode 100644 index 27c0198e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileUtil.FileSync.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - -FileUtil.FileSync (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class FileUtil.FileSync

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.FileUtil.FileSync
    • -
    -
  • -
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidsync() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        sync

        -
        public void sync()
        -          throws java.io.IOException
        -
        -
        Specified by:
        -
        sync in interface FileAccess.FileSync
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileUtil.html deleted file mode 100644 index fbdc47d5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FileUtil.html +++ /dev/null @@ -1,939 +0,0 @@ - - - - - -FileUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class FileUtil

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.FileUtil
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    FileAccess
    -
    -
    -
    public class FileUtil
    -extends java.lang.Object
    -implements FileAccess
    -
    A collection of file management methods.

    - Also provides the default FileAccess implementation

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net), Ocke Janssen oj@openoffice.org
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      - - - - - - - - - - - - -
      Nested Classes 
      Modifier and TypeClassDescription
      static class FileUtil.FileSync 
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringabsolutePath​(java.lang.String path) -
      Retrieves the absolute path, given some path specification.
      -
      java.io.FilecanonicalFile​(java.io.File f) -
      Retrieves the canonical file for the given file, in a JDK 1.1 compliant - way.
      -
      java.io.FilecanonicalFile​(java.lang.String path) -
      Retrieves the canonical file for the given path, in a JDK 1.1 compliant - way.
      -
      java.lang.StringcanonicalOrAbsolutePath​(java.lang.String path) -
      Retrieves the canonical path for the given path, or the absolute - path if attempting to retrieve the canonical path fails.
      -
      java.lang.StringcanonicalPath​(java.io.File f) -
      Retrieves the canonical path for the given File, in a JDK 1.1 compliant - way.
      -
      java.lang.StringcanonicalPath​(java.lang.String path) -
      Retrieves the canonical path for the given path, in a JDK 1.1 compliant - way.
      -
      voidcreateParentDirs​(java.lang.String filename) 
      booleandelete​(java.lang.String filename) -
      Delete the named file
      -
      voiddeleteOnExit​(java.io.File f) -
      Requests, in a JDK 1.1 compliant way, that the file or directory denoted - by the given abstract pathname be deleted when the virtual machine - terminates.
      -
      static booleandeleteOrRenameDatabaseFiles​(java.lang.String dbNamePath) -
      Utility method for user applications.
      -
      booleanexists​(java.lang.String filename) -
      Return true or false based on whether the named file exists.
      -
      booleanexists​(java.lang.String fileName, - boolean resource, - java.lang.Class cla) 
      static java.io.File[]getDatabaseFileList​(java.lang.String dbNamePath) -
      Utility method for user applications.
      -
      static java.io.File[]getDatabaseMainFileList​(java.lang.String dbNamePath) -
      Returns a list of existing main files for a database.
      -
      static FileAccessgetFileAccess​(boolean isResource) 
      FileAccess.FileSyncgetFileSync​(java.io.OutputStream os) 
      static FileUtilgetFileUtil() 
      booleanisStreamElement​(java.lang.String elementName) 
      static java.lang.StringmakeDirectories​(java.lang.String path) 
      voidmakeParentDirectories​(java.io.File f) 
      static java.lang.StringnewDiscardFileName​(java.lang.String filename) 
      java.io.InputStreamopenInputStreamElement​(java.lang.String streamName) 
      java.io.OutputStreamopenOutputStreamElement​(java.lang.String streamName) 
      java.io.OutputStreamopenOutputStreamElementAppend​(java.lang.String streamName) 
      booleanremoveElement​(java.lang.String filename) 
      booleanrenameElement​(java.lang.String oldName, - java.lang.String newName) 
      booleanrenameElementOrCopy​(java.lang.String oldName, - java.lang.String newName, - EventLogInterface logger) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        fsIsIgnoreCase

        -
        public final boolean fsIsIgnoreCase
        -
      • -
      - - - -
        -
      • -

        fsNormalizesPosixSeparator

        -
        public final boolean fsNormalizesPosixSeparator
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getFileUtil

        -
        public static FileUtil getFileUtil()
        -
      • -
      - - - -
        -
      • -

        getFileAccess

        -
        public static FileAccess getFileAccess​(boolean isResource)
        -
      • -
      - - - -
        -
      • -

        isStreamElement

        -
        public boolean isStreamElement​(java.lang.String elementName)
        -
        -
        Specified by:
        -
        isStreamElement in interface FileAccess
        -
        -
      • -
      - - - -
        -
      • -

        openInputStreamElement

        -
        public java.io.InputStream openInputStreamElement​(java.lang.String streamName)
        -                                           throws java.io.IOException
        -
        -
        Specified by:
        -
        openInputStreamElement in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        createParentDirs

        -
        public void createParentDirs​(java.lang.String filename)
        -
        -
        Specified by:
        -
        createParentDirs in interface FileAccess
        -
        -
      • -
      - - - -
        -
      • -

        removeElement

        -
        public boolean removeElement​(java.lang.String filename)
        -
        -
        Specified by:
        -
        removeElement in interface FileAccess
        -
        -
      • -
      - - - -
        -
      • -

        renameElement

        -
        public boolean renameElement​(java.lang.String oldName,
        -                             java.lang.String newName)
        -
        -
        Specified by:
        -
        renameElement in interface FileAccess
        -
        -
      • -
      - - - - - - - -
        -
      • -

        openOutputStreamElement

        -
        public java.io.OutputStream openOutputStreamElement​(java.lang.String streamName)
        -                                             throws java.io.IOException
        -
        -
        Specified by:
        -
        openOutputStreamElement in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        openOutputStreamElementAppend

        -
        public java.io.OutputStream openOutputStreamElementAppend​(java.lang.String streamName)
        -                                                   throws java.io.IOException
        -
        -
        Specified by:
        -
        openOutputStreamElementAppend in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        delete

        -
        public boolean delete​(java.lang.String filename)
        -
        Delete the named file
        -
        -
        Parameters:
        -
        filename - String
        -
        Returns:
        -
        true if deleted
        -
        -
      • -
      - - - -
        -
      • -

        deleteOnExit

        -
        public void deleteOnExit​(java.io.File f)
        -
        Requests, in a JDK 1.1 compliant way, that the file or directory denoted - by the given abstract pathname be deleted when the virtual machine - terminates.

        - - Deletion will be attempted only for JDK 1.2 and greater runtime - environments and only upon normal termination of the virtual - machine, as defined by the Java Language Specification.

        - - Once deletion has been sucessfully requested, it is not possible to - cancel the request. This method should therefore be used with care.

        -
        -
        Parameters:
        -
        f - the abstract pathname of the file be deleted when the virtual - machine terminates
        -
        -
      • -
      - - - -
        -
      • -

        exists

        -
        public boolean exists​(java.lang.String filename)
        -
        Return true or false based on whether the named file exists.
        -
        -
        Parameters:
        -
        filename - String
        -
        Returns:
        -
        true if exists
        -
        -
      • -
      - - - -
        -
      • -

        exists

        -
        public boolean exists​(java.lang.String fileName,
        -                      boolean resource,
        -                      java.lang.Class cla)
        -
      • -
      - - - -
        -
      • -

        absolutePath

        -
        public java.lang.String absolutePath​(java.lang.String path)
        -
        Retrieves the absolute path, given some path specification.
        -
        -
        Parameters:
        -
        path - the path for which to retrieve the absolute path
        -
        Returns:
        -
        the absolute path
        -
        -
      • -
      - - - -
        -
      • -

        canonicalFile

        -
        public java.io.File canonicalFile​(java.io.File f)
        -                           throws java.io.IOException
        -
        Retrieves the canonical file for the given file, in a JDK 1.1 compliant - way.
        -
        -
        Parameters:
        -
        f - the File for which to retrieve the absolute File
        -
        Returns:
        -
        the canonical File
        -
        Throws:
        -
        java.io.IOException - on error
        -
        -
      • -
      - - - -
        -
      • -

        canonicalFile

        -
        public java.io.File canonicalFile​(java.lang.String path)
        -                           throws java.io.IOException
        -
        Retrieves the canonical file for the given path, in a JDK 1.1 compliant - way.
        -
        -
        Parameters:
        -
        path - the path for which to retrieve the canonical File
        -
        Returns:
        -
        the canonical File
        -
        Throws:
        -
        java.io.IOException - on error
        -
        -
      • -
      - - - -
        -
      • -

        canonicalPath

        -
        public java.lang.String canonicalPath​(java.io.File f)
        -                               throws java.io.IOException
        -
        Retrieves the canonical path for the given File, in a JDK 1.1 compliant - way.
        -
        -
        Parameters:
        -
        f - the File for which to retrieve the canonical path
        -
        Returns:
        -
        the canonical path
        -
        Throws:
        -
        java.io.IOException - on error
        -
        -
      • -
      - - - -
        -
      • -

        canonicalPath

        -
        public java.lang.String canonicalPath​(java.lang.String path)
        -                               throws java.io.IOException
        -
        Retrieves the canonical path for the given path, in a JDK 1.1 compliant - way.
        -
        -
        Parameters:
        -
        path - the path for which to retrieve the canonical path
        -
        Returns:
        -
        the canonical path
        -
        Throws:
        -
        java.io.IOException - on error
        -
        -
      • -
      - - - -
        -
      • -

        canonicalOrAbsolutePath

        -
        public java.lang.String canonicalOrAbsolutePath​(java.lang.String path)
        -
        Retrieves the canonical path for the given path, or the absolute - path if attempting to retrieve the canonical path fails.
        -
        -
        Parameters:
        -
        path - the path for which to retrieve the canonical or - absolute path
        -
        Returns:
        -
        the canonical or absolute path
        -
        -
      • -
      - - - -
        -
      • -

        makeParentDirectories

        -
        public void makeParentDirectories​(java.io.File f)
        -
      • -
      - - - -
        -
      • -

        makeDirectories

        -
        public static java.lang.String makeDirectories​(java.lang.String path)
        -
      • -
      - - - -
        -
      • -

        getFileSync

        -
        public FileAccess.FileSync getFileSync​(java.io.OutputStream os)
        -                                throws java.io.IOException
        -
        -
        Specified by:
        -
        getFileSync in interface FileAccess
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        deleteOrRenameDatabaseFiles

        -
        public static boolean deleteOrRenameDatabaseFiles​(java.lang.String dbNamePath)
        -
        Utility method for user applications. Attempts to delete all the files - for the database as listed by the getDatabaseFileList() method. If any - of the current, main database files cannot be deleted, it is renamed - by adding a suffix containing a hexadecimal timestamp portion and - the ".old" extension. Also deletes the ".tmp" directory.
        -
        -
        Parameters:
        -
        dbNamePath - full path or name of database (without a file extension)
        -
        Returns:
        -
        currently always true
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseFileList

        -
        public static java.io.File[] getDatabaseFileList​(java.lang.String dbNamePath)
        -
        Utility method for user applications. Returns a list of files that - currently exist for a database. The list includes current database files - as well as ".new", and ".old" versions of the files, plus any app logs.
        -
        -
        Parameters:
        -
        dbNamePath - full path or name of database (without a file - extension)
        -
        Returns:
        -
        File[]
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseMainFileList

        -
        public static java.io.File[] getDatabaseMainFileList​(java.lang.String dbNamePath)
        -
        Returns a list of existing main files for a database. The list excludes - non-essential files.
        -
        -
        Parameters:
        -
        dbNamePath - full path or name of database (without a file - extension)
        -
        Returns:
        -
        File[]
        -
        -
      • -
      - - - -
        -
      • -

        newDiscardFileName

        -
        public static java.lang.String newDiscardFileName​(java.lang.String filename)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FilteredIterator.Filter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FilteredIterator.Filter.html deleted file mode 100644 index 2b5a0d19..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FilteredIterator.Filter.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - -FilteredIterator.Filter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface FilteredIterator.Filter<E>

-
-
-
-
    -
  • -
    -
    Enclosing class:
    -
    FilteredIterator<E>
    -
    -
    -
    public static interface FilteredIterator.Filter<E>
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - - - -
        -
      • -

        test

        -
        boolean test​(E object)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FilteredIterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FilteredIterator.html deleted file mode 100644 index 11b242b0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FilteredIterator.html +++ /dev/null @@ -1,433 +0,0 @@ - - - - - -FilteredIterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class FilteredIterator<E>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.FilteredIterator<E>
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterator<E>
    -
    -
    -
    public class FilteredIterator<E>
    -extends java.lang.Object
    -implements Iterator<E>
    -
    An iterator with an added filter.
    -
    -
    Since:
    -
    2.5.1
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        hasNext

        -
        public boolean hasNext()
        -
        -
        Specified by:
        -
        hasNext in interface Iterator<E>
        -
        -
      • -
      - - - -
        -
      • -

        next

        -
        public E next()
        -       throws java.util.NoSuchElementException
        -
        -
        Specified by:
        -
        next in interface Iterator<E>
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        nextInt

        -
        public int nextInt()
        -            throws java.util.NoSuchElementException
        -
        -
        Specified by:
        -
        nextInt in interface Iterator<E>
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        nextLong

        -
        public long nextLong()
        -              throws java.util.NoSuchElementException
        -
        -
        Specified by:
        -
        nextLong in interface Iterator<E>
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public void remove()
        -            throws java.util.NoSuchElementException
        -
        -
        Specified by:
        -
        remove in interface Iterator<E>
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FrameworkLogger.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FrameworkLogger.html deleted file mode 100644 index 6ba3bd6f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/FrameworkLogger.html +++ /dev/null @@ -1,857 +0,0 @@ - - - - - -FrameworkLogger (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class FrameworkLogger

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.FrameworkLogger
    • -
    -
  • -
-
-
    -
  • -
    -
    public class FrameworkLogger
    -extends java.lang.Object
    -
    A logging framework wrapper that supports java.util.logging and log4j. -

    - Logger hierarchies are stored at the Class level. - Log4j will be used if the Log4j system (not necessarily config files) are - found in the runtime classpath. - Otherwise, java.util.logging will be used. -

    - This is pretty safe because for use cases where multiple hierarchies - are desired, classloader hierarchies will effectively isolate multiple - class-level Logger hierarchies. -

    - Sad as it is, the java.util.logging facility lacks the most basic - developer-side and configuration-side capabilities. - Besides having a non-scalable discovery system, the designers didn't - comprehend the need for a level between WARNING and SEVERE! - Since we don't want to require log4j in Classpath, we have to live - with these constraints. -

    - As with all the popular logging frameworks, if you want to capture a - stack trace, you must use the two-parameters logging methods. - I.e., you must also pass a String, or only toString() from your - throwable will be captured. -

    - Usage example: - -

    
    - private static FrameworkLogger logger =
    -        FrameworkLogger.getLog(SqlTool.class);
    - ...
    -   logger.finer("Doing something log-worthy");
    - 
    - -

    - The system level property hsqldb.reconfig_logging=false is - required to avoid configuration of java.util.logging. Otherwise - configuration takes place.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidclearLoggers​(java.lang.String prefixToZap) -
      Frees Logger(s), if any, with the specified category, or that begins with - the specified prefix + dot.
      -
      voidenduserlog​(java.util.logging.Level level, - java.lang.String message) 
      voiderror​(java.lang.String message) -
      This is just a wrapper for FrameworkLogger.warning(), because - java.util.logging lacks a method for this critical purpose.
      -
      voiderror​(java.lang.String message, - java.lang.Throwable t) -
      Just like FrameworkLogger.error(String), but also logs a stack trace.
      -
      voidfiner​(java.lang.String message) 
      voidfiner​(java.lang.String message, - java.lang.Throwable t) -
      Just like FrameworkLogger.finer(String), but also logs a stack trace.
      -
      voidfinest​(java.lang.String message) 
      voidfinest​(java.lang.String message, - java.lang.Throwable t) -
      Just like FrameworkLogger.finest(String), but also logs a stack trace.
      -
      static FrameworkLoggergetLog​(java.lang.Class c) -
      User's entry-point into this logging system.
      -
      static FrameworkLoggergetLog​(java.lang.Class c, - java.lang.String contextId) -
      This method just defers to the getLog(Class) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
      -
      static FrameworkLoggergetLog​(java.lang.String s) -
      Alternative entry-point into this logging system, for cases where you - want to share a single logger instance among multiple classes, or you - want to use multiple logger instances from a single class.
      -
      static FrameworkLoggergetLog​(java.lang.String baseId, - java.lang.String contextId) -
      This method just defers to the getLog(String) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
      -
      voidinfo​(java.lang.String message) 
      voidinfo​(java.lang.String message, - java.lang.Throwable t) -
      Just like FrameworkLogger.info(String), but also logs a stack trace.
      -
      voidlog​(java.util.logging.Level level, - java.lang.String message) 
      voidlog​(java.util.logging.Level level, - java.lang.String message, - java.lang.Throwable t) -
      Just like FrameworkLogger.log(Level, String), - but also logs a stack trace.
      -
      voidprivlog​(java.util.logging.Level level, - java.lang.String message, - java.lang.Throwable t, - int revertMethods, - java.lang.Class skipClass) -
      The "priv" prefix is historical.
      -
      static java.lang.Stringreport() -
      Utility method for integrators.
      -
      voidsevere​(java.lang.String message) 
      voidsevere​(java.lang.String message, - java.lang.Throwable t) -
      Just like FrameworkLogger.severe(String), but also logs a stack trace.
      -
      voidwarning​(java.lang.String message) 
      voidwarning​(java.lang.String message, - java.lang.Throwable t) -
      Just like FrameworkLogger.warning(String), but also logs a stack trace.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        report

        -
        public static java.lang.String report()
        -
        Utility method for integrators. Returns a string representation of the - active Logger instance keys. - -

        Not named similar to 'toString' to avoid ambiguity with instance - method toString.

        -
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        clearLoggers

        -
        public static void clearLoggers​(java.lang.String prefixToZap)
        -
        Frees Logger(s), if any, with the specified category, or that begins with - the specified prefix + dot. - -

        Note that as of today, this depends on the underlying logging - framework implementation to release the underlying Logger instances. JUL - in Sun's JVM uses weak references, so that should be fine. Log4j as of - today seems to use strong references (and no API hooks to free anything), - so this method will probably have little benefit for Log4j.

        -
        -
        Parameters:
        -
        prefixToZap - String
        -
        -
      • -
      - - - -
        -
      • -

        getLog

        -
        public static FrameworkLogger getLog​(java.lang.Class c)
        -
        User's entry-point into this logging system.

        You normally want to - work with static (class-level) pointers to logger instances, for - performance efficiency. See the class-level JavaDoc for a usage example.

        -
        -
        Parameters:
        -
        c - Class
        -
        Returns:
        -
        FrameworkLogger
        -
        -
      • -
      - - - -
        -
      • -

        getLog

        -
        public static FrameworkLogger getLog​(java.lang.Class c,
        -                                     java.lang.String contextId)
        -
        This method just defers to the getLog(Class) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
        -
        -
        Parameters:
        -
        c - Class
        -
        contextId - String
        -
        Returns:
        -
        FrameworkLogger
        -
        -
      • -
      - - - -
        -
      • -

        getLog

        -
        public static FrameworkLogger getLog​(java.lang.String baseId,
        -                                     java.lang.String contextId)
        -
        This method just defers to the getLog(String) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
        -
        -
        Parameters:
        -
        baseId - String
        -
        contextId - String
        -
        Returns:
        -
        FrameworkLogger
        -
        -
      • -
      - - - -
        -
      • -

        getLog

        -
        public static FrameworkLogger getLog​(java.lang.String s)
        -
        Alternative entry-point into this logging system, for cases where you - want to share a single logger instance among multiple classes, or you - want to use multiple logger instances from a single class.
        -
        -
        Parameters:
        -
        s - String
        -
        Returns:
        -
        FrameworkLogger
        -
        See Also:
        -
        getLog(Class)
        -
        -
      • -
      - - - -
        -
      • -

        log

        -
        public void log​(java.util.logging.Level level,
        -                java.lang.String message,
        -                java.lang.Throwable t)
        -
        Just like FrameworkLogger.log(Level, String), - but also logs a stack trace.
        -
        -
        Parameters:
        -
        level - java.util.logging.Level level to filter and log at
        -
        message - Message to be logged
        -
        t - Throwable whose stack trace will be logged.
        -
        See Also:
        -
        log(Level, String), -Logger.log(Level, String), -Level
        -
        -
      • -
      - - - -
        -
      • -

        privlog

        -
        public void privlog​(java.util.logging.Level level,
        -                    java.lang.String message,
        -                    java.lang.Throwable t,
        -                    int revertMethods,
        -                    java.lang.Class skipClass)
        -
        The "priv" prefix is historical. This is for special usage when you need - to modify the reported call stack. If you don't know that you want to do - this, then you should not use this method.
        -
        -
        Parameters:
        -
        level - Level
        -
        message - String
        -
        t - Throwable
        -
        revertMethods - int
        -
        skipClass - Class
        -
        -
      • -
      - - - -
        -
      • -

        enduserlog

        -
        public void enduserlog​(java.util.logging.Level level,
        -                       java.lang.String message)
        -
      • -
      - - - -
        -
      • -

        log

        -
        public void log​(java.util.logging.Level level,
        -                java.lang.String message)
        -
        -
        Parameters:
        -
        level - java.util.logging.Level level to filter and log at
        -
        message - Message to be logged
        -
        See Also:
        -
        Logger.log(Level, String), -Level
        -
        -
      • -
      - - - -
        -
      • -

        finer

        -
        public void finer​(java.lang.String message)
        -
        -
        Parameters:
        -
        message - Message to be logged
        -
        See Also:
        -
        Logger.finer(String)
        -
        -
      • -
      - - - -
        -
      • -

        warning

        -
        public void warning​(java.lang.String message)
        -
        -
        Parameters:
        -
        message - Message to be logged
        -
        See Also:
        -
        Logger.warning(String)
        -
        -
      • -
      - - - -
        -
      • -

        severe

        -
        public void severe​(java.lang.String message)
        -
        -
        Parameters:
        -
        message - Message to be logged
        -
        See Also:
        -
        Logger.severe(String)
        -
        -
      • -
      - - - -
        -
      • -

        info

        -
        public void info​(java.lang.String message)
        -
        -
        Parameters:
        -
        message - Message to be logged
        -
        See Also:
        -
        Logger.info(String)
        -
        -
      • -
      - - - -
        -
      • -

        finest

        -
        public void finest​(java.lang.String message)
        -
        -
        Parameters:
        -
        message - Message to be logged
        -
        See Also:
        -
        Logger.finest(String)
        -
        -
      • -
      - - - -
        -
      • -

        error

        -
        public void error​(java.lang.String message)
        -
        This is just a wrapper for FrameworkLogger.warning(), because - java.util.logging lacks a method for this critical purpose.
        -
        -
        Parameters:
        -
        message - Message to be logged
        -
        See Also:
        -
        warning(String)
        -
        -
      • -
      - - - -
        -
      • -

        finer

        -
        public void finer​(java.lang.String message,
        -                  java.lang.Throwable t)
        -
        Just like FrameworkLogger.finer(String), but also logs a stack trace.
        -
        -
        Parameters:
        -
        message - String
        -
        t - Throwable whose stack trace will be logged.
        -
        See Also:
        -
        finer(String)
        -
        -
      • -
      - - - -
        -
      • -

        warning

        -
        public void warning​(java.lang.String message,
        -                    java.lang.Throwable t)
        -
        Just like FrameworkLogger.warning(String), but also logs a stack trace.
        -
        -
        Parameters:
        -
        message - String
        -
        t - Throwable whose stack trace will be logged.
        -
        See Also:
        -
        warning(String)
        -
        -
      • -
      - - - -
        -
      • -

        severe

        -
        public void severe​(java.lang.String message,
        -                   java.lang.Throwable t)
        -
        Just like FrameworkLogger.severe(String), but also logs a stack trace.
        -
        -
        Parameters:
        -
        message - String
        -
        t - Throwable whose stack trace will be logged.
        -
        See Also:
        -
        severe(String)
        -
        -
      • -
      - - - -
        -
      • -

        info

        -
        public void info​(java.lang.String message,
        -                 java.lang.Throwable t)
        -
        Just like FrameworkLogger.info(String), but also logs a stack trace.
        -
        -
        Parameters:
        -
        message - String
        -
        t - Throwable whose stack trace will be logged.
        -
        See Also:
        -
        info(String)
        -
        -
      • -
      - - - -
        -
      • -

        finest

        -
        public void finest​(java.lang.String message,
        -                   java.lang.Throwable t)
        -
        Just like FrameworkLogger.finest(String), but also logs a stack trace.
        -
        -
        Parameters:
        -
        message - String
        -
        t - Throwable whose stack trace will be logged.
        -
        See Also:
        -
        finest(String)
        -
        -
      • -
      - - - -
        -
      • -

        error

        -
        public void error​(java.lang.String message,
        -                  java.lang.Throwable t)
        -
        Just like FrameworkLogger.error(String), but also logs a stack trace.
        -
        -
        Parameters:
        -
        message - String
        -
        t - Throwable whose stack trace will be logged.
        -
        See Also:
        -
        error(String)
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HashMap.html deleted file mode 100644 index 0c306a2e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HashMap.html +++ /dev/null @@ -1,625 +0,0 @@ - - - - - -HashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HashMap<K,​V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.HashMap<K,​V>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<K,​V>
    -
    -
    -
    Direct Known Subclasses:
    -
    OrderedHashMap
    -
    -
    -
    public class HashMap<K,​V>
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<K,​V>
    -
    This class does not store null keys.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      HashMap() 
      HashMap​(int initialCapacity) 
      HashMap​(int initialCapacity, - ObjectComparator comparator) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<K,​V>>entrySet() 
      Vget​(java.lang.Object key) 
      Set<K>keySet() 
      <T> T[]keysToArray​(T[] array) 
      Vput​(K key, - V value) 
      voidputAll​(Map<? extends K,​? extends V> m) 
      Vremove​(java.lang.Object key) 
      booleanremove​(java.lang.Object key, - java.lang.Object value) -
      Removes the spacific key, value pair.
      -
      Collection<V>values() 
      <T> T[]valuesToArray​(T[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HashMap

        -
        public HashMap()
        -
      • -
      - - - -
        -
      • -

        HashMap

        -
        public HashMap​(int initialCapacity)
        -        throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        HashMap

        -
        public HashMap​(int initialCapacity,
        -               ObjectComparator comparator)
        -        throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<K,​V>
        -
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(K key,
        -             V value)
        -
        -
        Specified by:
        -
        put in interface Map<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object key,
        -                      java.lang.Object value)
        -
        Removes the spacific key, value pair.
        -
        -
        Parameters:
        -
        key - the key
        -
        value - the value
        -
        Returns:
        -
        the value associated with the key, or null if none
        -
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends K,​? extends V> m)
        -
        -
        Specified by:
        -
        putAll in interface Map<K,​V>
        -
        -
      • -
      - - - - - -
        -
      • -

        keysToArray

        -
        public <T> T[] keysToArray​(T[] array)
        -
      • -
      - - - - - -
        -
      • -

        valuesToArray

        -
        public <T> T[] valuesToArray​(T[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<K> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<K,​V>
        -
        -
      • -
      - - - - - - - - -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HashSet.html deleted file mode 100644 index cc2a6696..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HashSet.html +++ /dev/null @@ -1,743 +0,0 @@ - - - - - -HashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HashSet<E>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.HashSet<E>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Collection<E>, Set<E>
    -
    -
    -
    Direct Known Subclasses:
    -
    OrderedHashSet
    -
    -
    -
    public class HashSet<E>
    -extends org.hsqldb.map.BaseHashMap
    -implements Set<E>
    -
    This class does not store null keys.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      HashSet() 
      HashSet​(int initialCapacity) 
      HashSet​(int initialCapacity, - ObjectComparator comparator) 
      HashSet​(java.lang.Object[] valueList) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanadd​(E key) -
      returns true if element is added
      -
      booleanaddAll​(E[] keys) -
      returns true if any element is added
      -
      booleanaddAll​(E[] keys, - int start, - int limit) -
      returns true if any added
      -
      booleanaddAll​(Collection<? extends E> c) -
      returns true if any element is added
      -
      booleancontains​(java.lang.Object key) 
      booleancontainsAll​(Collection<?> col) 
      Eget​(E key) 
      intgetCommonElementCount​(Set<E> other) 
      EgetOrAdd​(E key) 
      Iterator<E>iterator() 
      booleanremove​(java.lang.Object key) -
      returns true if removed
      -
      booleanremoveAll​(E[] keys) -
      returns true if all were removed
      -
      booleanremoveAll​(Collection<?> c) -
      returns true if all were removed
      -
      booleanretainAll​(Collection<?> c) 
      java.lang.Object[]toArray() 
      <T> T[]toArray​(T[] a) 
      java.lang.StringtoString() -
      Returns a String like "[Drei, zwei, Eins]", exactly like - java.util.HashSet.
      -
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HashSet

        -
        public HashSet()
        -
      • -
      - - - -
        -
      • -

        HashSet

        -
        public HashSet​(int initialCapacity)
        -        throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        HashSet

        -
        public HashSet​(int initialCapacity,
        -               ObjectComparator comparator)
        -        throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        HashSet

        -
        public HashSet​(java.lang.Object[] valueList)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        contains

        -
        public boolean contains​(java.lang.Object key)
        -
        -
        Specified by:
        -
        contains in interface Collection<E>
        -
        -
      • -
      - - - -
        -
      • -

        containsAll

        -
        public boolean containsAll​(Collection<?> col)
        -
      • -
      - - - - - -
        -
      • -

        getOrAdd

        -
        public E getOrAdd​(E key)
        -
      • -
      - - - - - -
        -
      • -

        get

        -
        public E get​(E key)
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        public boolean add​(E key)
        -
        returns true if element is added
        -
        -
        Specified by:
        -
        add in interface Collection<E>
        -
        Parameters:
        -
        key - the element
        -
        Returns:
        -
        true if added
        -
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(Collection<? extends E> c)
        -
        returns true if any element is added
        -
        -
        Specified by:
        -
        addAll in interface Collection<E>
        -
        Parameters:
        -
        c - the Collection to add
        -
        Returns:
        -
        true if any element is added
        -
        -
      • -
      - - - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(E[] keys)
        -
        returns true if any element is added
        -
        -
        Parameters:
        -
        keys - the array of elements to add
        -
        Returns:
        -
        true if any element is added
        -
        -
      • -
      - - - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(E[] keys,
        -                      int start,
        -                      int limit)
        -
        returns true if any added
        -
        -
        Parameters:
        -
        keys - array of keys to add
        -
        start - first index to add
        -
        limit - limit of index to add
        -
        Returns:
        -
        true if any element was added
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object key)
        -
        returns true if removed
        -
        -
        Specified by:
        -
        remove in interface Collection<E>
        -
        Parameters:
        -
        key - Object to remove
        -
        Returns:
        -
        true if removed
        -
        -
      • -
      - - - -
        -
      • -

        removeAll

        -
        public boolean removeAll​(Collection<?> c)
        -
        returns true if all were removed
        -
        -
        Parameters:
        -
        c - Collection of elements to remove
        -
        Returns:
        -
        true if all removed
        -
        -
      • -
      - - - -
        -
      • -

        retainAll

        -
        public boolean retainAll​(Collection<?> c)
        -
      • -
      - - - - - -
        -
      • -

        removeAll

        -
        public boolean removeAll​(E[] keys)
        -
        returns true if all were removed
        -
        -
        Parameters:
        -
        keys - E[]
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        getCommonElementCount

        -
        public int getCommonElementCount​(Set<E> other)
        -
      • -
      - - - - - -
        -
      • -

        toArray

        -
        public <T> T[] toArray​(T[] a)
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public java.lang.Object[] toArray()
        -
      • -
      - - - - - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Returns a String like "[Drei, zwei, Eins]", exactly like - java.util.HashSet.
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        String representation
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlArrayHeap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlArrayHeap.html deleted file mode 100644 index 871bd48b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlArrayHeap.html +++ /dev/null @@ -1,512 +0,0 @@ - - - - - -HsqlArrayHeap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlArrayHeap<E>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.HsqlArrayHeap<E>
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    HsqlHeap<E>
    -
    -
    -
    public class HsqlArrayHeap<E>
    -extends java.lang.Object
    -implements HsqlHeap<E>
    -
    An HsqlHeap implementation backed by an array of objects and an - ObjectComparator. This implementation - is non-blocking, dynamically resizing and thread-safe.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      HsqlArrayHeap​(int capacity, - java.util.Comparator<E> comparator) -
      Creates a new HsqlArrayHeap with the given initial capacity, using the - specified ObjectComparator to maintain the heap invariant.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanadd​(E o) -
      Adds the specified element to this Heap.
      -
      voidclear() -
      Removes all of the elements from this Heap.
      -
      booleanisEmpty() -
      Retrieves whether this Heap is empty.
      -
      booleanisFull() -
      Retrieves whether this Heap is full.
      -
      Epeek() -
      Retrieves the least element from this Heap, without removing it.
      -
      Eremove() -
      Retrieves the least element from this Heap, removing it in the process.
      -
      intsize() -
      Retrieves the number of elements currently in this Heap.
      -
      java.lang.StringtoString() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqlArrayHeap

        -
        public HsqlArrayHeap​(int capacity,
        -                     java.util.Comparator<E> comparator)
        -              throws java.lang.IllegalArgumentException
        -
        Creates a new HsqlArrayHeap with the given initial capacity, using the - specified ObjectComparator to maintain the heap invariant.
        -
        -
        Parameters:
        -
        capacity - int
        -
        comparator - Comparator
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if capacity less or equal to zero or - comparator is null
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Description copied from interface: HsqlHeap
        -
        Removes all of the elements from this Heap.
        -
        -
        Specified by:
        -
        clear in interface HsqlHeap<E>
        -
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        public boolean add​(E o)
        -
        Description copied from interface: HsqlHeap
        -
        Adds the specified element to this Heap.
        -
        -
        Specified by:
        -
        add in interface HsqlHeap<E>
        -
        Parameters:
        -
        o - The element to add
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        public boolean isEmpty()
        -
        Description copied from interface: HsqlHeap
        -
        Retrieves whether this Heap is empty.
        -
        -
        Specified by:
        -
        isEmpty in interface HsqlHeap<E>
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        isFull

        -
        public boolean isFull()
        -
        Description copied from interface: HsqlHeap
        -
        Retrieves whether this Heap is full.
        -
        -
        Specified by:
        -
        isFull in interface HsqlHeap<E>
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        peek

        -
        public E peek()
        -
        Description copied from interface: HsqlHeap
        -
        Retrieves the least element from this Heap, without removing it.
        -
        -
        Specified by:
        -
        peek in interface HsqlHeap<E>
        -
        Returns:
        -
        the least element from this Heap
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public E remove()
        -
        Description copied from interface: HsqlHeap
        -
        Retrieves the least element from this Heap, removing it in the process.
        -
        -
        Specified by:
        -
        remove in interface HsqlHeap<E>
        -
        Returns:
        -
        the least element from this Heap
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        Description copied from interface: HsqlHeap
        -
        Retrieves the number of elements currently in this Heap.
        -
        -
        Specified by:
        -
        size in interface HsqlHeap<E>
        -
        Returns:
        -
        the number of elements currently in this Heap
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlArrayList.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlArrayList.html deleted file mode 100644 index 91a69311..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlArrayList.html +++ /dev/null @@ -1,853 +0,0 @@ - - - - - -HsqlArrayList (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlArrayList<E>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.HsqlArrayList<E>
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Collection<E>, List<E>
    -
    -
    -
    Direct Known Subclasses:
    -
    ArrayListIdentity
    -
    -
    -
    public class HsqlArrayList<E>
    -extends java.lang.Object
    -implements List<E>
    -
    Intended as an asynchronous alternative to Vector.
    -
    -
    Since:
    -
    1.7.0
    -
    Author:
    -
    dnordahl@users
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      HsqlArrayList() -
      Creates a new instance of HsqlArrayList
      -
      HsqlArrayList​(int initialCapacity) -
      Creates a new instance with the given initial capacity
      -
      HsqlArrayList​(int initialCapacity, - boolean minimize) -
      Creates a new instance of HsqlArrayList that minimizes the size when empty
      -
      HsqlArrayList​(E[] data, - int count) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidadd​(int index, - E element) -
      Inserts an element at the given index
      -
      booleanadd​(E element) -
      Appends an element to the end of the list
      -
      booleanaddAll​(E[] array) 
      booleanaddAll​(Collection<? extends E> other) 
      voidclear() 
      booleancontains​(java.lang.Object element) 
      Eget​(int index) -
      Gets the element at given position
      -
      E[]getArray() 
      intindexOf​(java.lang.Object o) -
      returns the index of given object or -1 if not found
      -
      booleanisEmpty() 
      Iterator<E>iterator() 
      intlastIndexOf​(java.lang.Object o) 
      Eremove​(int index) -
      Removes and returns the element at given position
      -
      booleanremove​(java.lang.Object element) 
      Eset​(int index, - E element) -
      Replaces the element at given position
      -
      voidsetSize​(int newSize) -
      Increase or reduce the size, setting discarded or added elements to null.
      -
      intsize() -
      Returns the number of elements in the array list
      -
      voidsort​(java.util.Comparator<? super E> c) 
      java.lang.Object[]toArray() 
      <T> T[]toArray​(T[] array) -
      Copies all elements of the list to a[].
      -
      voidtoArraySlice​(E[] array, - int start, - int limit) -
      Copies elements of the list from start to limit to array.
      -
      java.lang.StringtoString() 
      voidtrim() -
      Trims the array to be the same size as the number of elements.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      - - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - - - -
        -
      • -

        HsqlArrayList

        -
        public HsqlArrayList​(E[] data,
        -                     int count)
        -
      • -
      - - - -
        -
      • -

        HsqlArrayList

        -
        public HsqlArrayList()
        -
        Creates a new instance of HsqlArrayList
        -
      • -
      - - - -
        -
      • -

        HsqlArrayList

        -
        public HsqlArrayList​(int initialCapacity,
        -                     boolean minimize)
        -
        Creates a new instance of HsqlArrayList that minimizes the size when empty
        -
        -
        Parameters:
        -
        initialCapacity - int
        -
        minimize - boolean
        -
        -
      • -
      - - - -
        -
      • -

        HsqlArrayList

        -
        public HsqlArrayList​(int initialCapacity)
        -
        Creates a new instance with the given initial capacity
        -
        -
        Parameters:
        -
        initialCapacity - int
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - - - -
        -
      • -

        add

        -
        public void add​(int index,
        -                E element)
        -
        Inserts an element at the given index
        -
        -
        Specified by:
        -
        add in interface List<E>
        -
        Parameters:
        -
        index - int
        -
        element - E
        -
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        public boolean add​(E element)
        -
        Appends an element to the end of the list
        -
        -
        Specified by:
        -
        add in interface Collection<E>
        -
        Specified by:
        -
        add in interface List<E>
        -
        Parameters:
        -
        element - E
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public E get​(int index)
        -
        Gets the element at given position
        -
        -
        Specified by:
        -
        get in interface List<E>
        -
        Parameters:
        -
        index - int
        -
        Returns:
        -
        E
        -
        -
      • -
      - - - -
        -
      • -

        indexOf

        -
        public int indexOf​(java.lang.Object o)
        -
        returns the index of given object or -1 if not found
        -
        -
        Parameters:
        -
        o - Object
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public E remove​(int index)
        -
        Removes and returns the element at given position
        -
        -
        Specified by:
        -
        remove in interface List<E>
        -
        Parameters:
        -
        index - int
        -
        Returns:
        -
        E
        -
        -
      • -
      - - - - - -
        -
      • -

        set

        -
        public E set​(int index,
        -             E element)
        -
        Replaces the element at given position
        -
        -
        Specified by:
        -
        set in interface List<E>
        -
        Parameters:
        -
        index - int
        -
        element - E
        -
        Returns:
        -
        E
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public final int size()
        -
        Returns the number of elements in the array list
        -
        -
        Specified by:
        -
        size in interface Collection<E>
        -
        Specified by:
        -
        size in interface List<E>
        -
        Returns:
        -
        int
        -
        -
      • -
      - - - -
        -
      • -

        trim

        -
        public void trim()
        -
        Trims the array to be the same size as the number of elements.
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        -
        Specified by:
        -
        clear in interface Collection<E>
        -
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize​(int newSize)
        -
        Increase or reduce the size, setting discarded or added elements to null.
        -
        -
        Parameters:
        -
        newSize - int
        -
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public java.lang.Object[] toArray()
        -
      • -
      - - - - - -
        -
      • -

        toArray

        -
        public <T> T[] toArray​(T[] array)
        -
        Copies all elements of the list to a[].

        - - If a[] is too small, a new array or the same type is returned.

        - - If a[] is larger, only the list elements are copied and no other - change is made to the array.

        - - Differs from the implementation in java.util.ArrayList in the second - aspect.

        -
        -
        Type Parameters:
        -
        T - type of array element
        -
        Parameters:
        -
        array - T[]
        -
        Returns:
        -
        T[]
        -
        -
      • -
      - - - - - -
        -
      • -

        toArraySlice

        -
        public void toArraySlice​(E[] array,
        -                         int start,
        -                         int limit)
        -
        Copies elements of the list from start to limit to array. The array must - be large enough.
        -
        -
        Parameters:
        -
        array - E[]
        -
        start - int
        -
        limit - int
        -
        -
      • -
      - - - -
        -
      • -

        getArray

        -
        public E[] getArray()
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort​(java.util.Comparator<? super E> c)
        -
      • -
      - - - -
        -
      • -

        lastIndexOf

        -
        public int lastIndexOf​(java.lang.Object o)
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains​(java.lang.Object element)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object element)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(Collection<? extends E> other)
        -
      • -
      - - - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(E[] array)
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        public boolean isEmpty()
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        iterator

        -
        public Iterator<E> iterator()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlByteArrayInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlByteArrayInputStream.html deleted file mode 100644 index 81f641fa..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlByteArrayInputStream.html +++ /dev/null @@ -1,815 +0,0 @@ - - - - - -HsqlByteArrayInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlByteArrayInputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.InputStream
    • -
    • -
        -
      • org.hsqldb.lib.HsqlByteArrayInputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.io.DataInput, java.lang.AutoCloseable
    -
    -
    -
    public class HsqlByteArrayInputStream
    -extends java.io.InputStream
    -implements java.io.DataInput
    -
    This class is a replacement for both java.io.ByteArrayInputStream - (without synchronization) and java.io.DataInputStream
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqlByteArrayInputStream

        -
        public HsqlByteArrayInputStream​(byte[] buf)
        -
      • -
      - - - -
        -
      • -

        HsqlByteArrayInputStream

        -
        public HsqlByteArrayInputStream​(byte[] buf,
        -                                int offset,
        -                                int length)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getPos

        -
        public final long getPos()
        -
      • -
      - - - -
        -
      • -

        readFully

        -
        public void readFully​(byte[] b)
        -               throws java.io.IOException
        -
        -
        Specified by:
        -
        readFully in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readFully

        -
        public final void readFully​(byte[] b,
        -                            int off,
        -                            int len)
        -                     throws java.io.IOException
        -
        -
        Specified by:
        -
        readFully in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readBoolean

        -
        public boolean readBoolean()
        -                    throws java.io.IOException
        -
        -
        Specified by:
        -
        readBoolean in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readByte

        -
        public byte readByte()
        -              throws java.io.IOException
        -
        -
        Specified by:
        -
        readByte in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readUnsignedByte

        -
        public final int readUnsignedByte()
        -                           throws java.io.IOException
        -
        -
        Specified by:
        -
        readUnsignedByte in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readShort

        -
        public short readShort()
        -                throws java.io.IOException
        -
        -
        Specified by:
        -
        readShort in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readUnsignedShort

        -
        public final int readUnsignedShort()
        -                            throws java.io.IOException
        -
        -
        Specified by:
        -
        readUnsignedShort in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readChar

        -
        public char readChar()
        -              throws java.io.IOException
        -
        -
        Specified by:
        -
        readChar in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readInt

        -
        public int readInt()
        -            throws java.io.IOException
        -
        -
        Specified by:
        -
        readInt in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readLong

        -
        public long readLong()
        -              throws java.io.IOException
        -
        -
        Specified by:
        -
        readLong in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readFloat

        -
        public final float readFloat()
        -                      throws java.io.IOException
        -
        -
        Specified by:
        -
        readFloat in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readDouble

        -
        public final double readDouble()
        -                        throws java.io.IOException
        -
        -
        Specified by:
        -
        readDouble in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        skipBytes

        -
        public int skipBytes​(int n)
        -
        -
        Specified by:
        -
        skipBytes in interface java.io.DataInput
        -
        -
      • -
      - - - -
        -
      • -

        readLine

        -
        public java.lang.String readLine()
        -
        -
        Specified by:
        -
        readLine in interface java.io.DataInput
        -
        -
      • -
      - - - -
        -
      • -

        readUTF

        -
        public java.lang.String readUTF()
        -                         throws java.io.IOException
        -
        -
        Specified by:
        -
        readUTF in interface java.io.DataInput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        public int read()
        -
        -
        Specified by:
        -
        read in class java.io.InputStream
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        public int read​(byte[] b,
        -                int off,
        -                int len)
        -
        -
        Overrides:
        -
        read in class java.io.InputStream
        -
        -
      • -
      - - - -
        -
      • -

        skip

        -
        public long skip​(long n)
        -
        -
        Overrides:
        -
        skip in class java.io.InputStream
        -
        -
      • -
      - - - -
        -
      • -

        available

        -
        public int available()
        -
        -
        Overrides:
        -
        available in class java.io.InputStream
        -
        -
      • -
      - - - -
        -
      • -

        markSupported

        -
        public boolean markSupported()
        -
        -
        Overrides:
        -
        markSupported in class java.io.InputStream
        -
        -
      • -
      - - - -
        -
      • -

        mark

        -
        public void mark​(int readAheadLimit)
        -
        -
        Overrides:
        -
        mark in class java.io.InputStream
        -
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -
        -
        Overrides:
        -
        reset in class java.io.InputStream
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Overrides:
        -
        close in class java.io.InputStream
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlByteArrayOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlByteArrayOutputStream.html deleted file mode 100644 index 9440afd7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlByteArrayOutputStream.html +++ /dev/null @@ -1,994 +0,0 @@ - - - - - -HsqlByteArrayOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlByteArrayOutputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.OutputStream
    • -
    • -
        -
      • org.hsqldb.lib.HsqlByteArrayOutputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.io.DataOutput, java.io.Flushable, java.lang.AutoCloseable
    -
    -
    -
    public class HsqlByteArrayOutputStream
    -extends java.io.OutputStream
    -implements java.io.DataOutput
    -
    This class is a replacement for both java.io.ByteArrayOuputStream - (without synchronization) and java.io.DataOutputStream
    -
    -
    Since:
    -
    1.7.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose() 
      voidensureRoom​(int extra) 
      voidfill​(int b, - int len) 
      voidflush() -
      does nothing
      -
      byte[]getBuffer() 
      voidreset() 
      voidreset​(byte[] buffer) 
      voidreset​(int newSize) 
      voidsetPosition​(int newPos) 
      voidsetSize​(int size) -
      size must fit in buffer
      -
      intsize() 
      byte[]toByteArray() 
      java.lang.StringtoString() 
      java.lang.StringtoString​(java.lang.String enc) 
      voidwrite​(byte[] b) 
      voidwrite​(byte[] b, - int off, - int len) 
      voidwrite​(char[] c, - int off, - int len) 
      voidwrite​(int b) 
      intwrite​(java.io.InputStream input, - int countLimit) 
      intwrite​(java.io.Reader input, - int countLimit) 
      voidwriteBoolean​(boolean v) 
      voidwriteByte​(int v) 
      voidwriteBytes​(java.lang.String s) 
      voidwriteChar​(int v) 
      voidwriteChars​(char[] charArray) 
      voidwriteChars​(java.lang.String s) 
      voidwriteDouble​(double v) 
      voidwriteFloat​(float v) 
      voidwriteInt​(int v) 
      voidwriteLong​(long v) 
      voidwriteNoCheck​(int b) 
      voidwriteShort​(int v) 
      voidwriteTo​(java.io.OutputStream out) 
      voidwriteUTF​(java.lang.String str) 
      -
        -
      • - - -

        Methods inherited from class java.io.OutputStream

        -nullOutputStream
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqlByteArrayOutputStream

        -
        public HsqlByteArrayOutputStream()
        -
      • -
      - - - -
        -
      • -

        HsqlByteArrayOutputStream

        -
        public HsqlByteArrayOutputStream​(int size)
        -
      • -
      - - - -
        -
      • -

        HsqlByteArrayOutputStream

        -
        public HsqlByteArrayOutputStream​(byte[] buffer)
        -
      • -
      - - - -
        -
      • -

        HsqlByteArrayOutputStream

        -
        public HsqlByteArrayOutputStream​(java.io.InputStream input,
        -                                 int length)
        -                          throws java.io.IOException
        -
        Constructor from an InputStream limits size to the length argument. - Throws if the actual length of the InputStream is smaller than length - value.
        -
        -
        Parameters:
        -
        input - InputStream
        -
        length - int
        -
        Throws:
        -
        java.io.IOException - if an error occurs
        -
        -
      • -
      - - - -
        -
      • -

        HsqlByteArrayOutputStream

        -
        public HsqlByteArrayOutputStream​(java.io.InputStream input)
        -                          throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        writeShort

        -
        public void writeShort​(int v)
        -
        -
        Specified by:
        -
        writeShort in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeInt

        -
        public void writeInt​(int v)
        -
        -
        Specified by:
        -
        writeInt in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeLong

        -
        public void writeLong​(long v)
        -
        -
        Specified by:
        -
        writeLong in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeBytes

        -
        public void writeBytes​(java.lang.String s)
        -
        -
        Specified by:
        -
        writeBytes in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeFloat

        -
        public final void writeFloat​(float v)
        -
        -
        Specified by:
        -
        writeFloat in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeDouble

        -
        public final void writeDouble​(double v)
        -
        -
        Specified by:
        -
        writeDouble in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeBoolean

        -
        public void writeBoolean​(boolean v)
        -
        -
        Specified by:
        -
        writeBoolean in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeByte

        -
        public void writeByte​(int v)
        -
        -
        Specified by:
        -
        writeByte in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeChar

        -
        public void writeChar​(int v)
        -
        -
        Specified by:
        -
        writeChar in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeChars

        -
        public void writeChars​(java.lang.String s)
        -
        -
        Specified by:
        -
        writeChars in interface java.io.DataOutput
        -
        -
      • -
      - - - -
        -
      • -

        writeUTF

        -
        public void writeUTF​(java.lang.String str)
        -              throws java.io.IOException
        -
        -
        Specified by:
        -
        writeUTF in interface java.io.DataOutput
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
        does nothing
        -
        -
        Specified by:
        -
        flush in interface java.io.Flushable
        -
        Overrides:
        -
        flush in class java.io.OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(int b)
        -
        -
        Specified by:
        -
        write in interface java.io.DataOutput
        -
        Specified by:
        -
        write in class java.io.OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(byte[] b)
        -
        -
        Specified by:
        -
        write in interface java.io.DataOutput
        -
        Overrides:
        -
        write in class java.io.OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(byte[] b,
        -                  int off,
        -                  int len)
        -
        -
        Specified by:
        -
        write in interface java.io.DataOutput
        -
        Overrides:
        -
        write in class java.io.OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
        -
        Specified by:
        -
        close in interface java.lang.AutoCloseable
        -
        Specified by:
        -
        close in interface java.io.Closeable
        -
        Overrides:
        -
        close in class java.io.OutputStream
        -
        -
      • -
      - - - -
        -
      • -

        writeNoCheck

        -
        public void writeNoCheck​(int b)
        -
      • -
      - - - -
        -
      • -

        writeChars

        -
        public void writeChars​(char[] charArray)
        -
      • -
      - - - -
        -
      • -

        write

        -
        public int write​(java.io.InputStream input,
        -                 int countLimit)
        -          throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public int write​(java.io.Reader input,
        -                 int countLimit)
        -          throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        writeTo

        -
        public void writeTo​(java.io.OutputStream out)
        -             throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset()
        -
      • -
      - - - -
        -
      • -

        toByteArray

        -
        public byte[] toByteArray()
        -
      • -
      - - - -
        -
      • -

        size

        -
        public final int size()
        -
      • -
      - - - -
        -
      • -

        setPosition

        -
        public void setPosition​(int newPos)
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString​(java.lang.String enc)
        -                          throws java.io.UnsupportedEncodingException
        -
        -
        Throws:
        -
        java.io.UnsupportedEncodingException
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(char[] c,
        -                  int off,
        -                  int len)
        -
      • -
      - - - -
        -
      • -

        fill

        -
        public void fill​(int b,
        -                 int len)
        -
      • -
      - - - -
        -
      • -

        getBuffer

        -
        public byte[] getBuffer()
        -
      • -
      - - - -
        -
      • -

        ensureRoom

        -
        public void ensureRoom​(int extra)
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset​(int newSize)
        -
      • -
      - - - -
        -
      • -

        reset

        -
        public void reset​(byte[] buffer)
        -
      • -
      - - - -
        -
      • -

        setSize

        -
        public void setSize​(int size)
        -
        size must fit in buffer
        -
        -
        Parameters:
        -
        size - int
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlConsoleHandler.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlConsoleHandler.html deleted file mode 100644 index 61245e79..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlConsoleHandler.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - -HsqlConsoleHandler (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlConsoleHandler

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.util.logging.Handler
    • -
    • -
        -
      • java.util.logging.StreamHandler
      • -
      • -
          -
        • java.util.logging.ConsoleHandler
        • -
        • -
            -
          • org.hsqldb.lib.HsqlConsoleHandler
          • -
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    public class HsqlConsoleHandler
    -extends java.util.logging.ConsoleHandler
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      HsqlConsoleHandler() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.util.logging.ConsoleHandler

        -close, publish
      • -
      -
        -
      • - - -

        Methods inherited from class java.util.logging.StreamHandler

        -flush, isLoggable, setEncoding
      • -
      -
        -
      • - - -

        Methods inherited from class java.util.logging.Handler

        -getEncoding, getErrorManager, getFilter, getFormatter, getLevel, setErrorManager, setFilter, setFormatter, setLevel
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqlConsoleHandler

        -
        public HsqlConsoleHandler()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlDeque.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlDeque.html deleted file mode 100644 index 817971af..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlDeque.html +++ /dev/null @@ -1,1061 +0,0 @@ - - - - - -HsqlDeque (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlDeque<E>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.HsqlDeque<E>
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Collection<E>, List<E>
    -
    -
    -
    public class HsqlDeque<E>
    -extends java.lang.Object
    -implements List<E>
    -
    A List<E> that also implements Deque<E> and Queue<E> - and methods for usage as stack.

    - - When used as Queue<E>, elements are added to the end of - the List (tail), and retrieved from the start of the List (head).

    - - When used as a stack, elements are added to and retrieved from the start of - the List (head) using push() and pop() methods.

    - - Data is stored in an Object[] that doubles in size when the List gets full - but does not shrink when it gets empty.

    -
    -
    Since:
    -
    1.7.0, 20020130
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqlDeque

        -
        public HsqlDeque()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Specified by:
        -
        size in interface Collection<E>
        -
        Specified by:
        -
        size in interface List<E>
        -
        -
      • -
      - - - - - - - - - -
        -
      • -

        offer

        -
        public boolean offer​(E e)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public E remove()
        -
      • -
      - - - -
        -
      • -

        poll

        -
        public E poll()
        -
      • -
      - - - -
        -
      • -

        element

        -
        public E element()
        -
      • -
      - - - -
        -
      • -

        peek

        -
        public E peek()
        -
      • -
      - - - - - -
        -
      • -

        push

        -
        public void push​(E e)
        -
      • -
      - - - -
        -
      • -

        pop

        -
        public E pop()
        -
      • -
      - - - -
        -
      • -

        getFirst

        -
        public E getFirst()
        -           throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        getLast

        -
        public E getLast()
        -          throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public E get​(int i)
        -      throws java.lang.IndexOutOfBoundsException
        -
        -
        Specified by:
        -
        get in interface List<E>
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        public void add​(int i,
        -                E o)
        -         throws java.lang.IndexOutOfBoundsException
        -
        -
        Specified by:
        -
        add in interface List<E>
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        set

        -
        public E set​(int i,
        -             E o)
        -      throws java.lang.IndexOutOfBoundsException
        -
        -
        Specified by:
        -
        set in interface List<E>
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        removeFirst

        -
        public E removeFirst()
        -              throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        removeLast

        -
        public E removeLast()
        -             throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        peekFirst

        -
        public E peekFirst()
        -
      • -
      - - - -
        -
      • -

        peekLast

        -
        public E peekLast()
        -
      • -
      - - - - - -
        -
      • -

        offerFirst

        -
        public boolean offerFirst​(E e)
        -
      • -
      - - - - - -
        -
      • -

        offerLast

        -
        public boolean offerLast​(E e)
        -
      • -
      - - - -
        -
      • -

        pollFirst

        -
        public E pollFirst()
        -
      • -
      - - - -
        -
      • -

        pollLast

        -
        public E pollLast()
        -
      • -
      - - - -
        -
      • -

        removeFirstOccurrence

        -
        public boolean removeFirstOccurrence​(java.lang.Object o)
        -
      • -
      - - - -
        -
      • -

        removeLastOccurrence

        -
        public boolean removeLastOccurrence​(java.lang.Object o)
        -
      • -
      - - - -
        -
      • -

        descendingIterator

        -
        public Iterator<E> descendingIterator()
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        public boolean add​(E o)
        -
        -
        Specified by:
        -
        add in interface Collection<E>
        -
        Specified by:
        -
        add in interface List<E>
        -
        -
      • -
      - - - - - -
        -
      • -

        addLast

        -
        public void addLast​(E o)
        -
      • -
      - - - - - -
        -
      • -

        addFirst

        -
        public void addFirst​(E o)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        -
        Specified by:
        -
        clear in interface Collection<E>
        -
        -
      • -
      - - - -
        -
      • -

        indexOf

        -
        public int indexOf​(java.lang.Object value)
        -
      • -
      - - - -
        -
      • -

        lastIndexOf

        -
        public int lastIndexOf​(java.lang.Object value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public E remove​(int index)
        -
        -
        Specified by:
        -
        remove in interface List<E>
        -
        -
      • -
      - - - - - -
        -
      • -

        toArray

        -
        public <T> T[] toArray​(T[] array)
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public java.lang.Object[] toArray()
        -
      • -
      - - - -
        -
      • -

        subList

        -
        public List<E> subList​(int fromIndex,
        -                       int toIndex)
        -
      • -
      - - - -
        -
      • -

        containsAll

        -
        public boolean containsAll​(Collection c)
        -
      • -
      - - - -
        -
      • -

        removeAll

        -
        public boolean removeAll​(Collection c)
        -
      • -
      - - - -
        -
      • -

        retainAll

        -
        public boolean retainAll​(Collection c)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(int index,
        -                      Collection c)
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains​(java.lang.Object element)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object element)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(Collection<? extends E> other)
        -
      • -
      - - - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(E[] array)
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        iterator

        -
        public Iterator<E> iterator()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlHeap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlHeap.html deleted file mode 100644 index c32eaafb..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlHeap.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - - -HsqlHeap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface HsqlHeap<E>

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    HsqlArrayHeap
    -
    -
    -
    public interface HsqlHeap<E>
    -
    Provides the HyperSQL interface for Heap ADT implementations.

    - - In this context, a Heap is simply a collection-like ADT that allows addition - of elements and provides a way to remove the least element, given some - implementation-dependent strategy for imposing an order over its - elements.

    - - Typically, an HsqlHeap will be implemented as a tree-like structure that - recursively guarantees a Heap Invariant, such that all nodes below - the root are greater than the root, given some comparison strategy.

    - - This in turn provides the basis for an efficient implementation of ADTs such - PriorityQueue, since Heap operations using the typical implementation are, - in theory, guaranteed to be O(log n).

    - - This interface represents a pure queue with the same basic queue methods - as java.util.Queue but without all the extra methods.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethodDescription
      booleanadd​(E o) -
      Adds the specified element to this Heap.
      -
      voidclear() -
      Removes all of the elements from this Heap.
      -
      booleanisEmpty() -
      Retrieves whether this Heap is empty.
      -
      booleanisFull() -
      Retrieves whether this Heap is full.
      -
      Epeek() -
      Retrieves the least element from this Heap, without removing it.
      -
      Eremove() -
      Retrieves the least element from this Heap, removing it in the process.
      -
      intsize() -
      Retrieves the number of elements currently in this Heap.
      -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        clear

        -
        void clear()
        -
        Removes all of the elements from this Heap.
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        boolean isEmpty()
        -
        Retrieves whether this Heap is empty.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - -
        -
      • -

        isFull

        -
        boolean isFull()
        -
        Retrieves whether this Heap is full.
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        boolean add​(E o)
        -
        Adds the specified element to this Heap.
        -
        -
        Parameters:
        -
        o - The element to add
        -
        Returns:
        -
        boolean
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if the implementation does - not accept elements of the supplied type (optional)
        -
        java.lang.RuntimeException - if the implementation - dictates that this Heap is not currently accepting additions - or that this Heap is currently full (optional)
        -
        -
      • -
      - - - -
        -
      • -

        peek

        -
        E peek()
        -
        Retrieves the least element from this Heap, without removing it.
        -
        -
        Returns:
        -
        the least element from this Heap
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        E remove()
        -
        Retrieves the least element from this Heap, removing it in the process.
        -
        -
        Returns:
        -
        the least element from this Heap
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        int size()
        -
        Retrieves the number of elements currently in this Heap.
        -
        -
        Returns:
        -
        the number of elements currently in this Heap
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlTaskQueue.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlTaskQueue.html deleted file mode 100644 index c18a74be..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlTaskQueue.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - -HsqlTaskQueue (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlTaskQueue

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.HsqlTaskQueue
    • -
    -
  • -
-
-
    -
  • -
    -
    public class HsqlTaskQueue
    -extends java.lang.Object
    -
    Provides very simple queued execution of Runnable objects in a background - thread. The underlying queue is an HsqlDeque instance, an array-based - circular queue implementation with automatic capacity expansion.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqlTaskQueue

        -
        public HsqlTaskQueue()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getTaskRunnerThread

        -
        public java.lang.Thread getTaskRunnerThread()
        -
      • -
      - - - -
        -
      • -

        isShutdown

        -
        public boolean isShutdown()
        -
      • -
      - - - -
        -
      • -

        restart

        -
        public void restart()
        -
      • -
      - - - -
        -
      • -

        execute

        -
        public void execute​(java.lang.Runnable command)
        -             throws java.lang.RuntimeException
        -
        -
        Throws:
        -
        java.lang.RuntimeException
        -
        -
      • -
      - - - -
        -
      • -

        shutdownAfterQueued

        -
        public void shutdownAfterQueued()
        -
      • -
      - - - -
        -
      • -

        shutdownAfterCurrent

        -
        public void shutdownAfterCurrent()
        -
      • -
      - - - -
        -
      • -

        shutdownImmediately

        -
        public void shutdownImmediately()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlTimer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlTimer.html deleted file mode 100644 index 66cefee1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/HsqlTimer.html +++ /dev/null @@ -1,876 +0,0 @@ - - - - - -HsqlTimer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlTimer

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.HsqlTimer
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.util.Comparator, ThreadFactory
    -
    -
    -
    public final class HsqlTimer
    -extends java.lang.Object
    -implements java.util.Comparator, ThreadFactory
    -
    Facility to schedule tasks for future execution in a background thread.

    - - Tasks may be scheduled for one-time execution or for repeated execution at - regular intervals, using either fixed rate or fixed delay policy.

    - - This class is a JDK 1.1 compatible implementation required by HSQLDB both - because the java.util.Timer class is available only in JDK 1.3+ and because - java.util.Timer starves least recently added tasks under high load and - fixed rate scheduling, especially when the average actual task duration is - greater than the average requested task periodicity.

    - - An additional (minor) advantage over java.util.Timer is that this class does - not retain a live background thread during periods when the task queue is - empty.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      HsqlTimer() -
      Constructs a new HsqlTimer using the default thread factory - implementation.
      -
      HsqlTimer​(ThreadFactory threadFactory) -
      Constructs a new HsqlTimer.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidcancel​(java.lang.Object task) -
      Causes the task referenced by the supplied argument to be cancelled.
      -
      intcompare​(java.lang.Object a, - java.lang.Object b) -
      Required to back the priority queue for scheduled tasks.
      -
      static java.util.DategetLastScheduled​(java.lang.Object task) -
      Retrieves the last time the referenced task was executed, as a - Date object.
      -
      static java.util.DategetNextScheduled​(java.lang.Object task) -
      Retrieves the next time the referenced task is due to be executed, as a - Date object.
      -
      java.lang.ThreadgetThread() -
      Retrieves the background execution thread.
      -
      static booleanisCancelled​(java.lang.Object task) -
      Retrieves whether the specified argument references a cancelled task.
      -
      static booleanisFixedDelay​(java.lang.Object task) -
      Retrieves whether the specified argument references a task scheduled - periodically using fixed delay scheduling.
      -
      static booleanisFixedRate​(java.lang.Object task) -
      Retrieves whether the specified argument references a task scheduled - periodically using fixed rate scheduling.
      -
      static booleanisPeriodic​(java.lang.Object task) -
      Retrieves whether the specified argument references a task scheduled - for periodic execution.
      -
      java.lang.ThreadnewThread​(java.lang.Runnable runnable) -
      Default ThreadFactory implementation.
      -
      voidrestart() -
      (Re)starts background processing of the task queue.
      -
      java.lang.ObjectscheduleAfter​(long delay, - java.lang.Runnable runnable) -
      Causes the specified Runnable to be executed once in the background - after the specified delay.
      -
      java.lang.ObjectscheduleAt​(java.util.Date date, - java.lang.Runnable runnable) -
      Causes the specified Runnable to be executed once in the background - at the specified time.
      -
      java.lang.ObjectschedulePeriodicallyAfter​(long delay, - long period, - java.lang.Runnable runnable, - boolean relative) -
      Causes the specified Runnable to be executed periodically in the - background, starting after the specified delay.
      -
      java.lang.ObjectschedulePeriodicallyAt​(java.util.Date date, - long period, - java.lang.Runnable runnable, - boolean relative) -
      Causes the specified Runnable to be executed periodically in the - background, starting at the specified time.
      -
      static java.lang.ObjectsetPeriod​(java.lang.Object task, - long period) -
      Sets the periodicity of the designated task to a new value.
      -
      voidshutdown() -
      Shuts down this timer after the current task (if any) completes.
      -
      voidshutDown() -
      for compatibility with previous version
      -
      voidshutdownImmediately() -
      Shuts down this timer immediately, interrupting the wait state associated - with the current head of the task queue or the wait state internal to - the currently executing task, if any such state is currently in effect.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.util.Comparator

        -equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        HsqlTimer

        -
        public HsqlTimer()
        -
        Constructs a new HsqlTimer using the default thread factory - implementation.
        -
      • -
      - - - -
        -
      • -

        HsqlTimer

        -
        public HsqlTimer​(ThreadFactory threadFactory)
        -
        Constructs a new HsqlTimer. - - Uses the specified thread factory implementation.
        -
        -
        Parameters:
        -
        threadFactory - the ThreadFactory used to produce this timer's - background threads. If null, the default implementation supplied - by this class will be used.
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        compare

        -
        public int compare​(java.lang.Object a,
        -                   java.lang.Object b)
        -
        Required to back the priority queue for scheduled tasks.
        -
        -
        Specified by:
        -
        compare in interface java.util.Comparator
        -
        Parameters:
        -
        a - the first Task
        -
        b - the second Task
        -
        Returns:
        -
        0 if equal, < 0 if a < b, > 0 if a > b
        -
        -
      • -
      - - - -
        -
      • -

        newThread

        -
        public java.lang.Thread newThread​(java.lang.Runnable runnable)
        -
        Default ThreadFactory implementation.

        - - Constructs a new Thread from the designated runnable, sets its - name to "HSQLDB Timer @" + Integer.toHexString(hashCode()), - and sets it as a daemon thread.

        -
        -
        Specified by:
        -
        newThread in interface ThreadFactory
        -
        Parameters:
        -
        runnable - used to construct the new Thread.
        -
        Returns:
        -
        a new Thread constructed from the designated runnable.
        -
        -
      • -
      - - - -
        -
      • -

        getThread

        -
        public java.lang.Thread getThread()
        -
        Retrieves the background execution thread.

        - - null is returned if there is no such thread.

        -
        -
        Returns:
        -
        the current background thread (may be null)
        -
        -
      • -
      - - - -
        -
      • -

        restart

        -
        public void restart()
        -             throws java.lang.IllegalStateException
        -
        (Re)starts background processing of the task queue.
        -
        -
        Throws:
        -
        java.lang.IllegalStateException - if this timer is shut down.
        -
        See Also:
        -
        shutdown(), -shutdownImmediately()
        -
        -
      • -
      - - - -
        -
      • -

        scheduleAfter

        -
        public java.lang.Object scheduleAfter​(long delay,
        -                                      java.lang.Runnable runnable)
        -                               throws java.lang.IllegalArgumentException
        -
        Causes the specified Runnable to be executed once in the background - after the specified delay.
        -
        -
        Parameters:
        -
        delay - in milliseconds
        -
        runnable - the Runnable to execute.
        -
        Returns:
        -
        opaque reference to the internal task
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if runnable is null
        -
        -
      • -
      - - - -
        -
      • -

        scheduleAt

        -
        public java.lang.Object scheduleAt​(java.util.Date date,
        -                                   java.lang.Runnable runnable)
        -                            throws java.lang.IllegalArgumentException
        -
        Causes the specified Runnable to be executed once in the background - at the specified time.
        -
        -
        Parameters:
        -
        date - time at which to execute the specified Runnable
        -
        runnable - the Runnable to execute.
        -
        Returns:
        -
        opaque reference to the internal task
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if date or runnable is null
        -
        -
      • -
      - - - -
        -
      • -

        schedulePeriodicallyAt

        -
        public java.lang.Object schedulePeriodicallyAt​(java.util.Date date,
        -                                               long period,
        -                                               java.lang.Runnable runnable,
        -                                               boolean relative)
        -                                        throws java.lang.IllegalArgumentException
        -
        Causes the specified Runnable to be executed periodically in the - background, starting at the specified time.
        -
        -
        Parameters:
        -
        period - the cycle period
        -
        relative - if true, fixed rate scheduling else fixed delay scheduling
        -
        date - time at which to execute the specified Runnable
        -
        runnable - the Runnable to execute
        -
        Returns:
        -
        opaque reference to the internal task
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if date or runnable is null, or - period is <= 0
        -
        -
      • -
      - - - -
        -
      • -

        schedulePeriodicallyAfter

        -
        public java.lang.Object schedulePeriodicallyAfter​(long delay,
        -                                                  long period,
        -                                                  java.lang.Runnable runnable,
        -                                                  boolean relative)
        -                                           throws java.lang.IllegalArgumentException
        -
        Causes the specified Runnable to be executed periodically in the - background, starting after the specified delay.
        -
        -
        Parameters:
        -
        period - the cycle period
        -
        relative - if true, fixed rate scheduling else fixed delay scheduling
        -
        delay - in milliseconds
        -
        runnable - the Runnable to execute.
        -
        Returns:
        -
        opaque reference to the internal task
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if runnable is null or period is <= 0
        -
        -
      • -
      - - - -
        -
      • -

        shutdown

        -
        public void shutdown()
        -
        Shuts down this timer after the current task (if any) completes.

        - - After this call, the timer has permanently entered the shutdown state; - attempting to schedule any new task or directly restart this timer will - result in an IllegalStateException.

        -
      • -
      - - - -
        -
      • -

        shutDown

        -
        public void shutDown()
        -
        for compatibility with previous version
        -
      • -
      - - - -
        -
      • -

        shutdownImmediately

        -
        public void shutdownImmediately()
        -
        Shuts down this timer immediately, interrupting the wait state associated - with the current head of the task queue or the wait state internal to - the currently executing task, if any such state is currently in effect. - - After this call, the timer has permanently entered the shutdown state; - attempting to schedule any new task or directly restart this timer will - result in an IllegalStateException.

        - - Note: If the integrity of work performed by a scheduled task - may be adversely affected by an unplanned interruption, it is the - responsibility of the task's implementation to deal correctly with the - possibility that this method is called while such work is in progress, - for instance by catching the InterruptedException, completing the work, - and then rethrowing the exception.

        -
      • -
      - - - -
        -
      • -

        cancel

        -
        public static void cancel​(java.lang.Object task)
        -
        Causes the task referenced by the supplied argument to be cancelled. - If the referenced task is currently executing, it will continue until - finished but will not be rescheduled.
        -
        -
        Parameters:
        -
        task - a task reference
        -
        -
      • -
      - - - -
        -
      • -

        isCancelled

        -
        public static boolean isCancelled​(java.lang.Object task)
        -
        Retrieves whether the specified argument references a cancelled task.
        -
        -
        Parameters:
        -
        task - a task reference
        -
        Returns:
        -
        true if referenced task is cancelled
        -
        -
      • -
      - - - -
        -
      • -

        isFixedRate

        -
        public static boolean isFixedRate​(java.lang.Object task)
        -
        Retrieves whether the specified argument references a task scheduled - periodically using fixed rate scheduling.
        -
        -
        Parameters:
        -
        task - a task reference
        -
        Returns:
        -
        true if the task is scheduled at a fixed rate
        -
        -
      • -
      - - - -
        -
      • -

        isFixedDelay

        -
        public static boolean isFixedDelay​(java.lang.Object task)
        -
        Retrieves whether the specified argument references a task scheduled - periodically using fixed delay scheduling.
        -
        -
        Parameters:
        -
        task - a task reference
        -
        Returns:
        -
        true if the reference is scheduled using a fixed delay
        -
        -
      • -
      - - - -
        -
      • -

        isPeriodic

        -
        public static boolean isPeriodic​(java.lang.Object task)
        -
        Retrieves whether the specified argument references a task scheduled - for periodic execution.
        -
        -
        Parameters:
        -
        task - a task reference
        -
        Returns:
        -
        true if the task is scheduled for periodic execution
        -
        -
      • -
      - - - -
        -
      • -

        getLastScheduled

        -
        public static java.util.Date getLastScheduled​(java.lang.Object task)
        -
        Retrieves the last time the referenced task was executed, as a - Date object. If the task has never been executed, null is returned.
        -
        -
        Parameters:
        -
        task - a task reference
        -
        Returns:
        -
        the last time the referenced task was executed; null if never
        -
        -
      • -
      - - - -
        -
      • -

        setPeriod

        -
        public static java.lang.Object setPeriod​(java.lang.Object task,
        -                                         long period)
        -
        Sets the periodicity of the designated task to a new value.

        - - If the designated task is cancelled or the new period is identical to the - task's current period, then this invocation has essentially no effect - and the submitted object is returned.

        - - Otherwise, if the new period is greater than the designated task's - current period, then a simple assignment occurs and the submitted - object is returned.

        - - If neither case holds, then the designated task is cancelled and a new, - equivalent task with the new period is scheduled for immediate first - execution and returned to the caller.

        -
        -
        Parameters:
        -
        task - the task whose periodicity is to be set
        -
        period - the new period
        -
        Returns:
        -
        a task reference, as per the rules stated above.
        -
        -
      • -
      - - - -
        -
      • -

        getNextScheduled

        -
        public static java.util.Date getNextScheduled​(java.lang.Object task)
        -
        Retrieves the next time the referenced task is due to be executed, as a - Date object. If the referenced task is cancelled, null is returned.
        -
        -
        Parameters:
        -
        task - a task reference
        -
        Returns:
        -
        the next time the referenced task is due to be executed
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InOutUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InOutUtil.html deleted file mode 100644 index 4d5b1315..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InOutUtil.html +++ /dev/null @@ -1,607 +0,0 @@ - - - - - -InOutUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class InOutUtil

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.InOutUtil
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class InOutUtil
    -extends java.lang.Object
    -
    Input / Output utility
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net), Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static longcopy​(java.io.InputStream inputStream, - java.io.OutputStream outputStream) 
      static longcopy​(java.io.InputStream inputStream, - java.io.OutputStream outputStream, - long amount) 
      static longcopy​(java.io.InputStream inputStream, - java.io.OutputStream outputStream, - long amount, - int bufferSize) -
      the specified amount from the given input stream to the - given output stream, using a buffer of the given size.
      -
      static longcopy​(java.io.Reader reader, - java.io.Writer writer) 
      static longcopy​(java.io.Reader reader, - java.io.Writer writer, - long amount) 
      static longcopy​(java.io.Reader reader, - java.io.Writer writer, - long amount, - int bufferSize) -
      the specified amount from the given input stream to the - given output stream, using a buffer of the given size.
      -
      static java.io.Serializabledeserialize​(byte[] ba) -
      Deserializes the specified byte array to an - Object instance.
      -
      static intreadLine​(java.io.InputStream in, - java.io.OutputStream out) -
      Implementation only supports unix line-end format and is suitable for - processing HTTP and other network protocol communications.
      -
      static byte[]serialize​(java.io.Serializable s) -
      Retrieves the serialized form of the specified Object as an - array of bytes.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        DEFAULT_COPY_BUFFER_SIZE

        -
        public static final int DEFAULT_COPY_BUFFER_SIZE
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        DEFAULT_COPY_AMOUNT

        -
        public static final long DEFAULT_COPY_AMOUNT
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        readLine

        -
        public static int readLine​(java.io.InputStream in,
        -                           java.io.OutputStream out)
        -                    throws java.io.IOException
        -
        Implementation only supports unix line-end format and is suitable for - processing HTTP and other network protocol communications. Reads and - writes a line of data. Returns the number of bytes read/written.
        -
        -
        Parameters:
        -
        in - InputStream
        -
        out - OutputStream
        -
        Returns:
        -
        int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      - - - -
        -
      • -

        serialize

        -
        public static byte[] serialize​(java.io.Serializable s)
        -                        throws java.io.IOException
        -
        Retrieves the serialized form of the specified Object as an - array of bytes.
        -
        -
        Parameters:
        -
        s - the Object to serialize
        -
        Returns:
        -
        a static byte array representing the passed Object
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      - - - -
        -
      • -

        deserialize

        -
        public static java.io.Serializable deserialize​(byte[] ba)
        -                                        throws java.io.IOException,
        -                                               java.lang.ClassNotFoundException
        -
        Deserializes the specified byte array to an - Object instance.
        -
        -
        Parameters:
        -
        ba - the byte array to deserialize to an Object
        -
        Returns:
        -
        the Object resulting from deserializing the specified array of bytes
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        java.lang.ClassNotFoundException - if not found
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public static long copy​(java.io.InputStream inputStream,
        -                        java.io.OutputStream outputStream)
        -                 throws java.io.IOException
        -
        -
        Parameters:
        -
        inputStream - InputStream
        -
        outputStream - OutputStream
        -
        Returns:
        -
        long
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        copy(java.io.InputStream, java.io.OutputStream, long, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public static long copy​(java.io.InputStream inputStream,
        -                        java.io.OutputStream outputStream,
        -                        long amount)
        -                 throws java.io.IOException
        -
        -
        Parameters:
        -
        inputStream - InputStream
        -
        outputStream - OutputStream
        -
        amount - long
        -
        Returns:
        -
        long
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        copy(java.io.InputStream, java.io.OutputStream, long, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public static long copy​(java.io.InputStream inputStream,
        -                        java.io.OutputStream outputStream,
        -                        long amount,
        -                        int bufferSize)
        -                 throws java.io.IOException
        -
        the specified amount from the given input stream to the - given output stream, using a buffer of the given size.
        -
        -
        Parameters:
        -
        inputStream - from which to source bytes
        -
        outputStream - to which to sink bytes
        -
        amount - max # of bytes to transfer.
        -
        bufferSize - to use internally
        -
        Returns:
        -
        the number of bytes actually transferred.
        -
        Throws:
        -
        java.io.IOException - if any, thrown by either of the given stream objects
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public static long copy​(java.io.Reader reader,
        -                        java.io.Writer writer)
        -                 throws java.io.IOException
        -
        -
        Parameters:
        -
        reader - Reader
        -
        writer - Writer
        -
        Returns:
        -
        long
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        copy(java.io.Reader, java.io.Writer, long, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public static long copy​(java.io.Reader reader,
        -                        java.io.Writer writer,
        -                        long amount)
        -                 throws java.io.IOException
        -
        -
        Parameters:
        -
        reader - Reader
        -
        writer - Writer
        -
        amount - long
        -
        Returns:
        -
        long
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        copy(java.io.Reader, java.io.Writer, long, int)
        -
        -
      • -
      - - - -
        -
      • -

        copy

        -
        public static long copy​(java.io.Reader reader,
        -                        java.io.Writer writer,
        -                        long amount,
        -                        int bufferSize)
        -                 throws java.io.IOException
        -
        the specified amount from the given input stream to the - given output stream, using a buffer of the given size.
        -
        -
        Parameters:
        -
        reader - from which to source characters
        -
        writer - to which to sink characters
        -
        amount - max # of characters to transfer.
        -
        bufferSize - to use internally
        -
        Returns:
        -
        the number of characters actually transferred.
        -
        Throws:
        -
        java.io.IOException - if any, thrown by either of the given stream objects
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InputStreamInterface.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InputStreamInterface.html deleted file mode 100644 index 1a1a9d96..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InputStreamInterface.html +++ /dev/null @@ -1,401 +0,0 @@ - - - - - -InputStreamInterface (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface InputStreamInterface

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    InputStreamWrapper
    -
    -
    -
    public interface InputStreamInterface
    -
    -
    Since:
    -
    2.3.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        read

        -
        int read()
        -  throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        int read​(byte[] bytes)
        -  throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        int read​(byte[] bytes,
        -         int offset,
        -         int length)
        -  throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        skip

        -
        long skip​(long count)
        -   throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        available

        -
        int available()
        -       throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        void close()
        -    throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        setSizeLimit

        -
        void setSizeLimit​(long count)
        -
      • -
      - - - -
        -
      • -

        getSizeLimit

        -
        long getSizeLimit()
        -
        Invariant. Number of characters in stream, including any already read.
        -
        -
        Returns:
        -
        -1 if no explicit limit otherwise the limit
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InputStreamWrapper.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InputStreamWrapper.html deleted file mode 100644 index be992e1f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/InputStreamWrapper.html +++ /dev/null @@ -1,477 +0,0 @@ - - - - - -InputStreamWrapper (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class InputStreamWrapper

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.InputStreamWrapper
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    InputStreamInterface
    -
    -
    -
    public class InputStreamWrapper
    -extends java.lang.Object
    -implements InputStreamInterface
    -
    -
    Since:
    -
    2.2.8
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      InputStreamWrapper​(java.io.InputStream is) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intavailable() 
      voidclose() 
      longgetSizeLimit() -
      Invariant.
      -
      intread() 
      intread​(byte[] bytes) 
      intread​(byte[] bytes, - int offset, - int length) 
      voidsetSizeLimit​(long count) 
      longskip​(long count) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        InputStreamWrapper

        -
        public InputStreamWrapper​(java.io.InputStream is)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        read

        -
        public int read()
        -         throws java.io.IOException
        -
        -
        Specified by:
        -
        read in interface InputStreamInterface
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        public int read​(byte[] bytes)
        -         throws java.io.IOException
        -
        -
        Specified by:
        -
        read in interface InputStreamInterface
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        read

        -
        public int read​(byte[] bytes,
        -                int offset,
        -                int length)
        -         throws java.io.IOException
        -
        -
        Specified by:
        -
        read in interface InputStreamInterface
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        skip

        -
        public long skip​(long count)
        -          throws java.io.IOException
        -
        -
        Specified by:
        -
        skip in interface InputStreamInterface
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        available

        -
        public int available()
        -              throws java.io.IOException
        -
        -
        Specified by:
        -
        available in interface InputStreamInterface
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        -
        Specified by:
        -
        close in interface InputStreamInterface
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getSizeLimit

        -
        public long getSizeLimit()
        -
        Description copied from interface: InputStreamInterface
        -
        Invariant. Number of characters in stream, including any already read.
        -
        -
        Specified by:
        -
        getSizeLimit in interface InputStreamInterface
        -
        Returns:
        -
        -1 if no explicit limit otherwise the limit
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntHashSet.html deleted file mode 100644 index e998f7c9..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntHashSet.html +++ /dev/null @@ -1,604 +0,0 @@ - - - - - -IntHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class IntHashSet

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.IntHashSet
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    OrderedIntHashSet
    -
    -
    -
    public class IntHashSet
    -extends org.hsqldb.map.BaseHashMap
    -
    A set of int primitives.

    -
    -
    Since:
    -
    2.3.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      IntHashSet() 
      IntHashSet​(int initialCapacity) 
      IntHashSet​(int[] elements) 
      IntHashSet​(int[] elementsA, - int[] elementsB) 
      -
    • -
    -
    - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntHashSet

        -
        public IntHashSet()
        -
      • -
      - - - -
        -
      • -

        IntHashSet

        -
        public IntHashSet​(int initialCapacity)
        -           throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        IntHashSet

        -
        public IntHashSet​(int[] elements)
        -
      • -
      - - - -
        -
      • -

        IntHashSet

        -
        public IntHashSet​(int[] elementsA,
        -                  int[] elementsB)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        contains

        -
        public boolean contains​(java.lang.Object o)
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains​(int key)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public boolean add​(java.lang.Integer e)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public boolean add​(int key)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object o)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(int key)
        -
      • -
      - - - -
        -
      • -

        getStartMatchCount

        -
        public int getStartMatchCount​(int[] array)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(Collection<? extends java.lang.Integer> col)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(IntHashSet s)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public boolean addAll​(int[] elements)
        -
      • -
      - - - -
        -
      • -

        containsAll

        -
        public boolean containsAll​(Collection<?> c)
        -
      • -
      - - - -
        -
      • -

        retainAll

        -
        public boolean retainAll​(Collection<?> c)
        -
      • -
      - - - -
        -
      • -

        removeAll

        -
        public boolean removeAll​(Collection<?> c)
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public int[] toArray()
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public int[] toArray​(int[] array)
        -
      • -
      - - - - -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntIndex.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntIndex.html deleted file mode 100644 index 6e8588e2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntIndex.html +++ /dev/null @@ -1,697 +0,0 @@ - - - - - -IntIndex (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class IntIndex

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.IntIndex
    • -
    -
  • -
-
-
    -
  • -
    -
    public class IntIndex
    -extends java.lang.Object
    -
    Maintains an ordered integer index. Equal keys are allowed. - - findXXX() methods return the array index into the list - containing a matching key, or or -1 if not found.

    -
    -
    Since:
    -
    2.3.3
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      IntIndex​(int capacity, - boolean fixedSize) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intadd​(int key) -
      Adds a key, maintaining sort order on - current search target column.
      -
      booleanaddSorted​(int key) -
      Adds a key into the table with the guarantee that the key - is equal or larger than the largest existing key.
      -
      booleanaddUnique​(int key) -
      Adds a key, ensuring no duplicate key already exists in the - current search target column.
      -
      booleanaddUnsorted​(int key) -
      Adds a key into the table.
      -
      intcapacity() 
      voidclear() 
      intfindFirstConsecutiveKeys​(int number) 
      intfindFirstEqualKeyIndex​(int value) 
      intfindFirstGreaterEqualKeyIndex​(int value) 
      intfindFirstGreaterEqualSlotIndex​(int value) -
      This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
      -
      intfindFirstIndexUnsorted​(int value) 
      intgetKey​(int i) 
      int[]getKeys() 
      longgetTotalValues() 
      voidremove​(int position) 
      voidremoveAll() 
      intremoveFirstConsecutiveKeys​(int number, - int def) 
      voidremoveRange​(int start, - int limit) 
      voidsetKey​(int i, - int key) -
      Modifies an existing pair.
      -
      intsize() 
      voidsort() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntIndex

        -
        public IntIndex​(int capacity,
        -                boolean fixedSize)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKey

        -
        public int getKey​(int i)
        -
      • -
      - - - -
        -
      • -

        setKey

        -
        public void setKey​(int i,
        -                   int key)
        -
        Modifies an existing pair.
        -
        -
        Parameters:
        -
        i - the index
        -
        key - the key
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        capacity

        -
        public int capacity()
        -
      • -
      - - - -
        -
      • -

        getKeys

        -
        public int[] getKeys()
        -
      • -
      - - - -
        -
      • -

        getTotalValues

        -
        public long getTotalValues()
        -
      • -
      - - - -
        -
      • -

        addUnsorted

        -
        public boolean addUnsorted​(int key)
        -
        Adds a key into the table.
        -
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - -
        -
      • -

        addSorted

        -
        public boolean addSorted​(int key)
        -
        Adds a key into the table with the guarantee that the key - is equal or larger than the largest existing key. This prevents a sort - from taking place on next call to find()
        -
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - -
        -
      • -

        addUnique

        -
        public boolean addUnique​(int key)
        -
        Adds a key, ensuring no duplicate key already exists in the - current search target column.
        -
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        true or false depending on success
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public int add​(int key)
        -
        Adds a key, maintaining sort order on - current search target column.
        -
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        index of added key or -1 if full
        -
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        findFirstIndexUnsorted

        -
        public int findFirstIndexUnsorted​(int value)
        -
      • -
      - - - -
        -
      • -

        findFirstGreaterEqualKeyIndex

        -
        public int findFirstGreaterEqualKeyIndex​(int value)
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - -
        -
      • -

        findFirstEqualKeyIndex

        -
        public int findFirstEqualKeyIndex​(int value)
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - -
        -
      • -

        findFirstConsecutiveKeys

        -
        public int findFirstConsecutiveKeys​(int number)
        -
        -
        Parameters:
        -
        number - the number of consecutive keys required
        -
        Returns:
        -
        the index or -1 if not found
        -
        -
      • -
      - - - -
        -
      • -

        removeFirstConsecutiveKeys

        -
        public int removeFirstConsecutiveKeys​(int number,
        -                                      int def)
        -
        -
        Parameters:
        -
        number - the number of consecutive keys required
        -
        def - default value
        -
        Returns:
        -
        the first key in series or def if not found
        -
        -
      • -
      - - - -
        -
      • -

        findFirstGreaterEqualSlotIndex

        -
        public int findFirstGreaterEqualSlotIndex​(int value)
        -
        This method is similar to findFirstGreaterEqualKeyIndex(int) but - returns the index of the empty row past the end of the array if - the search value is larger than all the values / keys in the searched - column.
        -
        -
        Parameters:
        -
        value - the value
        -
        Returns:
        -
        the index
        -
        -
      • -
      - - - -
        -
      • -

        sort

        -
        public void sort()
        -
      • -
      - - - -
        -
      • -

        removeRange

        -
        public void removeRange​(int start,
        -                        int limit)
        -
      • -
      - - - -
        -
      • -

        removeAll

        -
        public void removeAll()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public final void remove​(int position)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyHashMap.html deleted file mode 100644 index 97b246de..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyHashMap.html +++ /dev/null @@ -1,665 +0,0 @@ - - - - - -IntKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class IntKeyHashMap<V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.IntKeyHashMap<V>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Integer,​V>
    -
    -
    -
    Direct Known Subclasses:
    -
    OrderedIntKeyHashMap
    -
    -
    -
    public class IntKeyHashMap<V>
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Integer,​V>
    -
    A Map of int primitives to Object values.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      IntKeyHashMap() 
      IntKeyHashMap​(int initialCapacity) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(int key) 
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<java.lang.Integer,​V>>entrySet() 
      Vget​(int key) 
      Vget​(java.lang.Object key) 
      Set<java.lang.Integer>keySet() 
      int[]keysToArray​(int[] array) 
      Vput​(int key, - V value) 
      Vput​(java.lang.Integer key, - V value) 
      voidputAll​(IntKeyHashMap other) 
      voidputAll​(Map<? extends java.lang.Integer,​? extends V> other) 
      Vremove​(int key) 
      Vremove​(java.lang.Object key) 
      Collection<V>values() 
      java.lang.Object[]valuesToArray() 
      <T> T[]valuesToArray​(T[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntKeyHashMap

        -
        public IntKeyHashMap()
        -
      • -
      - - - -
        -
      • -

        IntKeyHashMap

        -
        public IntKeyHashMap​(int initialCapacity)
        -              throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(int key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(int key)
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(java.lang.Integer key,
        -             V value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(int key,
        -             V value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(int key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Integer,​? extends V> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        keysToArray

        -
        public int[] keysToArray​(int[] array)
        -
      • -
      - - - -
        -
      • -

        valuesToArray

        -
        public java.lang.Object[] valuesToArray()
        -
      • -
      - - - - - -
        -
      • -

        valuesToArray

        -
        public <T> T[] valuesToArray​(T[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Integer> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<V> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Integer,​V>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyHashMapConcurrent.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyHashMapConcurrent.html deleted file mode 100644 index f3571116..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyHashMapConcurrent.html +++ /dev/null @@ -1,677 +0,0 @@ - - - - - -IntKeyHashMapConcurrent (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class IntKeyHashMapConcurrent<V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.IntKeyHashMapConcurrent<V>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Integer,​V>
    -
    -
    -
    public class IntKeyHashMapConcurrent<V>
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Integer,​V>
    -
    A Map of int primitives to Object values, suitable for thread-safe access.

    - - Iterators of keys or values are not thread-safe.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntKeyHashMapConcurrent

        -
        public IntKeyHashMapConcurrent()
        -
      • -
      - - - -
        -
      • -

        IntKeyHashMapConcurrent

        -
        public IntKeyHashMapConcurrent​(int initialCapacity)
        -                        throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getWriteLock

        -
        public java.util.concurrent.locks.Lock getWriteLock()
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(int key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(int key)
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(java.lang.Integer key,
        -             V value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(int key,
        -             V value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(int key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Integer,​? extends V> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getOrderedKeyMatchCount

        -
        public int getOrderedKeyMatchCount​(int[] array)
        -
      • -
      - - - -
        -
      • -

        keysToArray

        -
        public int[] keysToArray​(int[] array)
        -
      • -
      - - - - - -
        -
      • -

        valuesToArray

        -
        public <T> T[] valuesToArray​(T[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Integer> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<V> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Integer,​V>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Integer,​V>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyIntValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyIntValueHashMap.html deleted file mode 100644 index 1d857e3e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyIntValueHashMap.html +++ /dev/null @@ -1,692 +0,0 @@ - - - - - -IntKeyIntValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class IntKeyIntValueHashMap

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.IntKeyIntValueHashMap
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Integer,​java.lang.Integer>
    -
    -
    -
    public class IntKeyIntValueHashMap
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Integer,​java.lang.Integer>
    -
    A Map of int primitive keys to int primitive values.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(int key) 
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(int value) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<java.lang.Integer,​java.lang.Integer>>entrySet() 
      intget​(int key) 
      intget​(int key, - int defaultValue) 
      booleanget​(int key, - int[] value) 
      java.lang.Integerget​(java.lang.Object key) 
      Set<java.lang.Integer>keySet() 
      int[]keysToArray​(int[] array) 
      booleanput​(int key, - int value) 
      java.lang.Integerput​(java.lang.Integer key, - java.lang.Integer value) 
      voidputAll​(IntKeyIntValueHashMap other) 
      voidputAll​(Map<? extends java.lang.Integer,​? extends java.lang.Integer> other) 
      booleanremove​(int key) 
      java.lang.Integerremove​(java.lang.Object key) 
      Collection<java.lang.Integer>values() 
      int[]valuesToArray​(int[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntKeyIntValueHashMap

        -
        public IntKeyIntValueHashMap()
        -
      • -
      - - - -
        -
      • -

        IntKeyIntValueHashMap

        -
        public IntKeyIntValueHashMap​(int initialCapacity)
        -                      throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(int key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(int value)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public java.lang.Integer get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get​(int key)
        -        throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get​(int key,
        -               int defaultValue)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public boolean get​(int key,
        -                   int[] value)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public java.lang.Integer put​(java.lang.Integer key,
        -                             java.lang.Integer value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        put

        -
        public boolean put​(int key,
        -                   int value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public java.lang.Integer remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(int key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Integer,​? extends java.lang.Integer> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        keysToArray

        -
        public int[] keysToArray​(int[] array)
        -
      • -
      - - - -
        -
      • -

        valuesToArray

        -
        public int[] valuesToArray​(int[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Integer> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<java.lang.Integer> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Integer,​java.lang.Integer>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Integer,​java.lang.Integer>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyLongValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyLongValueHashMap.html deleted file mode 100644 index 1917ba0f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntKeyLongValueHashMap.html +++ /dev/null @@ -1,692 +0,0 @@ - - - - - -IntKeyLongValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class IntKeyLongValueHashMap

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.IntKeyLongValueHashMap
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Integer,​java.lang.Long>
    -
    -
    -
    public class IntKeyLongValueHashMap
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Integer,​java.lang.Long>
    -
    A Map of int primitive keys to long primitive values.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(int key) 
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(int value) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<java.lang.Integer,​java.lang.Long>>entrySet() 
      longget​(int key) 
      longget​(int key, - long defaultValue) 
      booleanget​(int key, - long[] value) 
      java.lang.Longget​(java.lang.Object key) 
      Set<java.lang.Integer>keySet() 
      int[]keysToArray​(int[] array) 
      booleanput​(int key, - long value) 
      java.lang.Longput​(java.lang.Integer key, - java.lang.Long value) 
      voidputAll​(IntKeyIntValueHashMap other) 
      voidputAll​(Map<? extends java.lang.Integer,​? extends java.lang.Long> other) 
      booleanremove​(int key) 
      java.lang.Longremove​(java.lang.Object key) 
      Collection<java.lang.Long>values() 
      long[]valuesToArray​(long[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntKeyLongValueHashMap

        -
        public IntKeyLongValueHashMap()
        -
      • -
      - - - -
        -
      • -

        IntKeyLongValueHashMap

        -
        public IntKeyLongValueHashMap​(int initialCapacity)
        -                       throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(int key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(int value)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public java.lang.Long get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public long get​(int key)
        -         throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public long get​(int key,
        -                long defaultValue)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public boolean get​(int key,
        -                   long[] value)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public java.lang.Long put​(java.lang.Integer key,
        -                          java.lang.Long value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        put

        -
        public boolean put​(int key,
        -                   long value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public java.lang.Long remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(int key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Integer,​? extends java.lang.Long> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        keysToArray

        -
        public int[] keysToArray​(int[] array)
        -
      • -
      - - - -
        -
      • -

        valuesToArray

        -
        public long[] valuesToArray​(long[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Integer> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<java.lang.Long> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Integer,​java.lang.Long>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Integer,​java.lang.Long>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntLookup.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntLookup.html deleted file mode 100644 index b4c0b1c7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntLookup.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - -IntLookup (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface IntLookup

-
-
-
-
    -
  • -
    -
    public interface IntLookup
    -
    Interface for int to int lookup.
    -
    -
    Since:
    -
    1.8.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        add

        -
        int add​(int key,
        -        int value)
        -
      • -
      - - - -
        -
      • -

        addUnsorted

        -
        boolean addUnsorted​(int key,
        -                    int value)
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        int lookup​(int key)
        -    throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        int lookup​(int key,
        -           int def)
        -
      • -
      - - - -
        -
      • -

        size

        -
        int size()
        -
      • -
      - - - -
        -
      • -

        clear

        -
        void clear()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntValueHashMap.html deleted file mode 100644 index 8a6efd8f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/IntValueHashMap.html +++ /dev/null @@ -1,557 +0,0 @@ - - - - - -IntValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class IntValueHashMap<K>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.IntValueHashMap<K>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    public class IntValueHashMap<K>
    -extends org.hsqldb.map.BaseHashMap
    -
    A Map of Object keys to int primitive values.

    - - This class does not store null keys.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(int value) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<K,​java.lang.Integer>>entrySet() 
      intget​(java.lang.Object key) 
      intget​(java.lang.Object key, - int defaultValue) 
      booleanget​(java.lang.Object key, - int[] value) 
      java.lang.ObjectgetKey​(int value) 
      Set<K>keySet() 
      booleanput​(java.lang.Object key, - int value) 
      voidputAll​(IntValueHashMap other) 
      voidputAll​(Map<? extends K,​? extends java.lang.Integer> other) 
      booleanremove​(java.lang.Object key) 
      Collection<java.lang.Integer>values() 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IntValueHashMap

        -
        public IntValueHashMap()
        -
      • -
      - - - -
        -
      • -

        IntValueHashMap

        -
        public IntValueHashMap​(int initialCapacity)
        -                throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(int value)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get​(java.lang.Object key)
        -        throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get​(java.lang.Object key,
        -               int defaultValue)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public boolean get​(java.lang.Object key,
        -                   int[] value)
        -
      • -
      - - - -
        -
      • -

        getKey

        -
        public java.lang.Object getKey​(int value)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public boolean put​(java.lang.Object key,
        -                   int value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends K,​? extends java.lang.Integer> other)
        -
      • -
      - - - - - - - -
        -
      • -

        keySet

        -
        public Set<K> keySet()
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<java.lang.Integer> values()
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<K,​java.lang.Integer>> entrySet()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Iterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Iterator.html deleted file mode 100644 index fa2fb81e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Iterator.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - - -Iterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface Iterator<E>

-
-
-
-
    -
  • -
    -
    All Known Subinterfaces:
    -
    PrimitiveIterator<E>
    -
    -
    -
    All Known Implementing Classes:
    -
    FilteredIterator, WrapperIterator
    -
    -
    -
    public interface Iterator<E>
    -
    Interface for HyperSQL iterators.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        hasNext

        -
        boolean hasNext()
        -
      • -
      - - - -
        -
      • -

        next

        -
        E next()
        -
      • -
      - - - -
        -
      • -

        nextInt

        -
        int nextInt()
        -
      • -
      - - - -
        -
      • -

        nextLong

        -
        long nextLong()
        -
      • -
      - - - -
        -
      • -

        remove

        -
        void remove()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/KMPSearchAlgorithm.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/KMPSearchAlgorithm.html deleted file mode 100644 index 3f354d99..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/KMPSearchAlgorithm.html +++ /dev/null @@ -1,638 +0,0 @@ - - - - - -KMPSearchAlgorithm (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class KMPSearchAlgorithm

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.KMPSearchAlgorithm
    • -
    -
  • -
-
-
    -
  • -
    -
    public class KMPSearchAlgorithm
    -extends java.lang.Object
    -
    Implements the Knuth-Morris-Pratt string search algorithm for searching - streams or arrays of octets or characters.

    - - This algorithm is a good choice for searching large, forward-only access - streams for repeated search using pre-processed small to medium sized - patterns.

    - - This is because in addition to the facts that it: - -

      -
    • does not require pre-processing the searched data (only the pattern) -
    • scans strictly left-to-right -
    • does not need to perform back tracking -
    • does not need to employ reverse scan order -
    • does not need to perform effectively random access lookups against - the searched data or pattern -
    - - it also has: - -
      -
    • a very simple, highly predictable behavior -
    • an O(n) complexity once the a search pattern is preprocessed -
    • an O(m) complexity for pre-processing search patterns -
    • a worst case performance characteristic of only 2n -
    • an average case performance characteristic that is deemed to be - 2-3 times better than the naive search algorithm employed by - String.indexOf(java.lang.String,int). -
    - - Note that the Boyer-Moore algorithm is generally considered to be the better - practical, all-round exact sub-string search algorithm, but due to its - reverse pattern scan order, performance considerations dictate that it - requires more space and that is somewhat more complex to implement - efficiently for searching forward-only access streams.

    - - In particular, its higher average performance is biased toward larger - search patterns, due to its ability to skip ahead further and with fewer - tests under reverse pattern scan. But when searching forward-only access - streams, overall performance considerations require the use a circular buffer - of the same size as the search pattern to hold data from the searched stream - as it is being compared in reverse order to the search pattern. Hence, - Boyer-Moore requires at minimum twice the memory required by - Knuth-Morris-Pratt to search for the same pattern and that factor has the - greatest impact precisely on the same class of patterns (larger) for which it - is most outperforms Knuth-Morris-Pratt.

    -
    -
    Since:
    -
    2.1
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    See Also:
    -
    - Knuth-Morris-Pratt algorithm
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static int[]computeTable​(byte[] pattern) -
      computes the table used to optimize octet pattern search
      -
      static int[]computeTable​(char[] pattern) -
      computes the table used to optimize octet pattern search
      -
      static int[]computeTable​(java.lang.String pattern) -
      computes the table used to optimize octet pattern search
      -
      static intsearch​(byte[] source, - byte[] pattern, - int[] table, - int start) -
      Searches the given octet string for the given octet pattern - returning the zero-based offset from given start position - at which the first match is detected.
      -
      static intsearch​(char[] source, - char[] pattern, - int[] table, - int start) -
      Searches the given character array for the given character pattern - returning the zero-based offset from given start position - at which the first match is detected.
      -
      static longsearch​(java.io.InputStream inputStream, - byte[] pattern, - int[] table) -
      Searches the given octet stream for the given octet pattern - returning the zero-based offset from the initial stream position - at which the first match is detected.
      -
      static longsearch​(java.io.Reader reader, - char[] pattern, - int[] table) -
      Searches the given character stream for the given character pattern - returning the zero-based offset from the initial stream position - at which the first match is detected.
      -
      static longsearch​(java.io.Reader reader, - java.lang.String pattern, - int[] table) -
      Searches the given character stream for the given character pattern - returning the zero-based offset from the initial stream position - at which the first match is detected.
      -
      static intsearch​(java.lang.String source, - java.lang.String pattern, - int[] table, - int start) -
      Searches the given String object for the given character pattern - returning the zero-based offset from given start position - at which the first match is detected.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        computeTable

        -
        public static int[] computeTable​(byte[] pattern)
        -
        computes the table used to optimize octet pattern search
        -
        -
        Parameters:
        -
        pattern - for which to compute the table.
        -
        Returns:
        -
        the table computed from the octet pattern.
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if pattern == null - || pattern.length < 2.
        -
        -
      • -
      - - - -
        -
      • -

        computeTable

        -
        public static int[] computeTable​(char[] pattern)
        -
        computes the table used to optimize octet pattern search
        -
        -
        Parameters:
        -
        pattern - for which to compute the table.
        -
        Returns:
        -
        the table computed from the character pattern.
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if pattern == null - || pattern.length < 2.
        -
        -
      • -
      - - - -
        -
      • -

        computeTable

        -
        public static int[] computeTable​(java.lang.String pattern)
        -
        computes the table used to optimize octet pattern search
        -
        -
        Parameters:
        -
        pattern - for which to compute the table.
        -
        Returns:
        -
        the table computed from the String pattern.
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if pattern == null - || pattern.length < 2.
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static long search​(java.io.InputStream inputStream,
        -                          byte[] pattern,
        -                          int[] table)
        -                   throws java.io.IOException
        -
        Searches the given octet stream for the given octet pattern - returning the zero-based offset from the initial stream position - at which the first match is detected. -

        - - Note that the signature includes a slot for the table so that - searches for a pattern can be performed multiple times without - incurring the overhead of computing the table each time.

        -
        -
        Parameters:
        -
        inputStream - in which to search
        -
        pattern - for which to search
        -
        table - computed from the pattern that optimizes the search. - If null, automatically computed.
        -
        Returns:
        -
        zero-based offset of first match; -1 if inputStream == null - || pattern == null or no match found, ; zero (0) if - pattern.length == 0.
        -
        Throws:
        -
        java.io.IOException - when an error occurs accessing the input stream.
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static long search​(java.io.Reader reader,
        -                          char[] pattern,
        -                          int[] table)
        -                   throws java.io.IOException
        -
        Searches the given character stream for the given character pattern - returning the zero-based offset from the initial stream position - at which the first match is detected.

        - - Note that the signature includes a slot for the table so that - searches for a pattern can be performed multiple times without - incurring the overhead of computing the table each time.

        -
        -
        Parameters:
        -
        reader - in which to search
        -
        pattern - for which to search
        -
        table - computed from the pattern that optimizes the search - If null, automatically computed.
        -
        Returns:
        -
        zero-based offset of first match; -1 if reader == null - || pattern == null or no match found, ; zero (0) if - pattern.length == 0.
        -
        Throws:
        -
        java.io.IOException - when an error occurs accessing the input stream.
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static long search​(java.io.Reader reader,
        -                          java.lang.String pattern,
        -                          int[] table)
        -                   throws java.io.IOException
        -
        Searches the given character stream for the given character pattern - returning the zero-based offset from the initial stream position - at which the first match is detected. -

        - - Note that the signature includes a slot for the table so that - searches for a pattern can be performed multiple times without - incurring the overhead of computing the table each time.

        -
        -
        Parameters:
        -
        reader - in which to search
        -
        pattern - for which to search
        -
        table - computed from the pattern that optimizes the search - If null, automatically computed.
        -
        Returns:
        -
        zero-based offset of first match; -1 if reader == null - || pattern == null or no match found, ; zero (0) if - pattern.length() == 0.
        -
        Throws:
        -
        java.io.IOException - when an error occurs accessing the input stream.
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static int search​(byte[] source,
        -                         byte[] pattern,
        -                         int[] table,
        -                         int start)
        -
        Searches the given octet string for the given octet pattern - returning the zero-based offset from given start position - at which the first match is detected.

        - - Note that the signature includes a slot for the table so that - searches for a pattern can be performed multiple times without - incurring the overhead of computing the table each time.

        -
        -
        Parameters:
        -
        source - array in which to search
        -
        pattern - to be matched
        -
        table - computed from the pattern that optimizes the search - If null, automatically computed.
        -
        start - position in source at which to start the search
        -
        Returns:
        -
        zero-based offset of first match; -1 if source == null - || pattern == null or no match found, ; start if - pattern.length == 0 and start <= source.length.
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static int search​(char[] source,
        -                         char[] pattern,
        -                         int[] table,
        -                         int start)
        -
        Searches the given character array for the given character pattern - returning the zero-based offset from given start position - at which the first match is detected.
        -
        -
        Parameters:
        -
        source - array in which to search
        -
        pattern - to be matched
        -
        table - computed from the pattern that optimizes the search - If null, automatically computed.
        -
        start - position in source at which to start the search
        -
        Returns:
        -
        zero-based offset of first match; -1 if source == null - || pattern == null or no match found, ; start if - pattern.length == 0 and start <= source.length.
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static int search​(java.lang.String source,
        -                         java.lang.String pattern,
        -                         int[] table,
        -                         int start)
        -
        Searches the given String object for the given character pattern - returning the zero-based offset from given start position - at which the first match is detected.
        -
        -
        Parameters:
        -
        source - array to be searched
        -
        pattern - to be matched
        -
        table - computed from the pattern that optimizes the search
        -
        start - position in source at which to start the search
        -
        Returns:
        -
        zero-based offset of first match; -1 if source == null - || pattern == null or no match found, ; start if - pattern.length == 0 and start <= source.length.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LineGroupReader.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LineGroupReader.html deleted file mode 100644 index dccb919e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LineGroupReader.html +++ /dev/null @@ -1,474 +0,0 @@ - - - - - -LineGroupReader (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LineGroupReader

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.LineGroupReader
    • -
    -
  • -
-
-
    -
  • -
    -
    public class LineGroupReader
    -extends java.lang.Object
    -
    Uses a LineNumberReader and returns multiple consecutive lines which conform - to the specified group demarcation characteristics. Any exception - thrown while reading from the reader is handled internally.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LineGroupReader

        -
        public LineGroupReader​(java.io.LineNumberReader reader)
        -
        Default constructor for TestUtil usage. - Sections start at lines beginning with any non-space character. - SQL comment lines are ignored.
        -
        -
        Parameters:
        -
        reader - LineNumberReader
        -
        -
      • -
      - - - -
        -
      • -

        LineGroupReader

        -
        public LineGroupReader​(java.io.LineNumberReader reader,
        -                       java.lang.String[] sectionStarts)
        -
        Constructor for sections starting with specified strings.
        -
        -
        Parameters:
        -
        reader - LineNumberReader
        -
        sectionStarts - String[]
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        getSectionAsString

        -
        public java.lang.String getSectionAsString()
        -
      • -
      - - - -
        -
      • -

        getAsMap

        -
        public OrderedHashMap getAsMap()
        -
        Returns a map/list which contains the first line of each line group as - key and the rest of the lines as a String value.
        -
        -
        Returns:
        -
        OrderedHashMap
        -
        -
      • -
      - - - -
        -
      • -

        getStartLineNumber

        -
        public int getStartLineNumber()
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
      • -
      - - - -
        -
      • -

        convertToString

        -
        public static java.lang.String convertToString​(HsqlArrayList list,
        -                                               int offset)
        -
      • -
      - - - -
        -
      • -

        getStatementMap

        -
        public static OrderedHashMap getStatementMap​(java.lang.String path)
        -
      • -
      - - - -
        -
      • -

        getGroupReader

        -
        public static LineGroupReader getGroupReader​(java.lang.String path,
        -                                             java.lang.String[] starters)
        -
      • -
      - - - -
        -
      • -

        getGroupReader

        -
        public static LineGroupReader getGroupReader​(java.lang.String path)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LineReader.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LineReader.html deleted file mode 100644 index f93ff725..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LineReader.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - -LineReader (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LineReader

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.LineReader
    • -
    -
  • -
-
-
    -
  • -
    -
    public class LineReader
    -extends java.lang.Object
    -
    A converter for InputStream to return String objects using the given - charset for conversion. The readLine() method returns the next string - excluding carriage-return and line-feed characters. No other character is - excluded. A carriage-return followed by a line-feed is treated as a single - end-of-line marker. Otherwise, each carriage-return or line-feed is treated - as an end-of_line marker.
    -
    -
    Since:
    -
    2.0.1
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      LineReader​(java.io.InputStream stream, - java.nio.charset.Charset charset) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose() 
      java.lang.StringreadLine() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LineReader

        -
        public LineReader​(java.io.InputStream stream,
        -                  java.nio.charset.Charset charset)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        readLine

        -
        public java.lang.String readLine()
        -                          throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/List.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/List.html deleted file mode 100644 index 88071a9b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/List.html +++ /dev/null @@ -1,399 +0,0 @@ - - - - - -List (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface List<E>

-
-
-
- -
-
- -
-
-
    -
  • - -
    - -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongDeque.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongDeque.html deleted file mode 100644 index b966f33c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongDeque.html +++ /dev/null @@ -1,605 +0,0 @@ - - - - - -LongDeque (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LongDeque

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.LongDeque
    • -
    -
  • -
-
-
    -
  • -
    -
    public class LongDeque
    -extends java.lang.Object
    -
    A deque of long values. Implementation based on HsqlDeque class.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      LongDeque() 
      LongDeque​(int capacity) 
      -
    • -
    -
    - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LongDeque

        -
        public LongDeque()
        -
      • -
      - - - -
        -
      • -

        LongDeque

        -
        public LongDeque​(int capacity)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        public boolean isEmpty()
        -
      • -
      - - - -
        -
      • -

        getFirst

        -
        public long getFirst()
        -              throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        getLast

        -
        public long getLast()
        -             throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public long get​(int i)
        -         throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        removeFirst

        -
        public long removeFirst()
        -                 throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        removeLast

        -
        public long removeLast()
        -                throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        add

        -
        public boolean add​(long value)
        -
      • -
      - - - -
        -
      • -

        addLast

        -
        public boolean addLast​(long value)
        -
      • -
      - - - -
        -
      • -

        addFirst

        -
        public boolean addFirst​(long value)
        -
      • -
      - - - -
        -
      • -

        addAll

        -
        public int addAll​(LongDeque deque)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
      • -
      - - - -
        -
      • -

        zeroSize

        -
        public void zeroSize()
        -
      • -
      - - - -
        -
      • -

        indexOf

        -
        public int indexOf​(long value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public long remove​(int index)
        -
      • -
      - - - -
        -
      • -

        contains

        -
        public boolean contains​(long value)
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public void toArray​(int[] array)
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public void toArray​(long[] array)
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public long[] toArray()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyHashMap.html deleted file mode 100644 index 48a162d6..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyHashMap.html +++ /dev/null @@ -1,746 +0,0 @@ - - - - - -LongKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LongKeyHashMap<V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.LongKeyHashMap<V>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Long,​V>
    -
    -
    -
    public class LongKeyHashMap<V>
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Long,​V>
    -
    A Map of long primitives to Object values.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclear() -
      Clear the map completely.
      -
      booleancontainsKey​(long key) 
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<java.lang.Long,​V>>entrySet() 
      Vget​(long key) 
      Vget​(java.lang.Object key) 
      java.util.concurrent.locks.LockgetReadLock() 
      java.util.concurrent.locks.LockgetWriteLock() 
      booleanisEmpty() 
      Set<java.lang.Long>keySet() 
      long[]keysToArray​(long[] array) 
      Vput​(long key, - V value) 
      Vput​(java.lang.Long key, - V value) 
      voidputAll​(LongKeyHashMap other) 
      voidputAll​(Map<? extends java.lang.Long,​? extends V> other) 
      Vremove​(long key) 
      Vremove​(java.lang.Object key) 
      intsize() 
      Collection<V>values() 
      java.lang.Object[]valuesToArray() 
      <T> T[]valuesToArray​(T[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clone
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LongKeyHashMap

        -
        public LongKeyHashMap()
        -
      • -
      - - - -
        -
      • -

        LongKeyHashMap

        -
        public LongKeyHashMap​(int initialCapacity)
        -               throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getReadLock

        -
        public java.util.concurrent.locks.Lock getReadLock()
        -
      • -
      - - - -
        -
      • -

        getWriteLock

        -
        public java.util.concurrent.locks.Lock getWriteLock()
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(long key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(long key)
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(java.lang.Long key,
        -             V value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(long key,
        -             V value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(long key)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        public void clear()
        -
        Description copied from class: org.hsqldb.map.BaseHashMap
        -
        Clear the map completely.
        -
        -
        Specified by:
        -
        clear in interface Map<java.lang.Long,​V>
        -
        Overrides:
        -
        clear in class org.hsqldb.map.BaseHashMap
        -
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        public boolean isEmpty()
        -
        -
        Specified by:
        -
        isEmpty in interface Map<java.lang.Long,​V>
        -
        Overrides:
        -
        isEmpty in class org.hsqldb.map.BaseHashMap
        -
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
        -
        Specified by:
        -
        size in interface Map<java.lang.Long,​V>
        -
        Overrides:
        -
        size in class org.hsqldb.map.BaseHashMap
        -
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Long,​? extends V> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        keysToArray

        -
        public long[] keysToArray​(long[] array)
        -
      • -
      - - - -
        -
      • -

        valuesToArray

        -
        public java.lang.Object[] valuesToArray()
        -
      • -
      - - - - - -
        -
      • -

        valuesToArray

        -
        public <T> T[] valuesToArray​(T[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Long> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<V> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Long,​V>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Long,​V>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyIntValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyIntValueHashMap.html deleted file mode 100644 index 117fa36f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyIntValueHashMap.html +++ /dev/null @@ -1,719 +0,0 @@ - - - - - -LongKeyIntValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LongKeyIntValueHashMap

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.LongKeyIntValueHashMap
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Long,​java.lang.Integer>
    -
    -
    -
    public class LongKeyIntValueHashMap
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Long,​java.lang.Integer>
    -
    A Map of long primitives to int primitives.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(long key) 
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(int value) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<java.lang.Long,​java.lang.Integer>>entrySet() 
      intget​(long key) 
      intget​(long key, - int defaultValue) 
      booleanget​(long key, - int[] value) 
      java.lang.Integerget​(java.lang.Object key) 
      intgetLookup​(long key) 
      Set<java.lang.Long>keySet() 
      long[]keysToArray​(long[] array) 
      booleanput​(long key, - int value) 
      java.lang.Integerput​(java.lang.Long key, - java.lang.Integer value) 
      voidputAll​(LongKeyIntValueHashMap other) 
      voidputAll​(Map<? extends java.lang.Long,​? extends java.lang.Integer> other) 
      booleanremove​(long key) 
      java.lang.Integerremove​(java.lang.Object key) 
      Collection<java.lang.Integer>values() 
      int[]valuesToArray​(int[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LongKeyIntValueHashMap

        -
        public LongKeyIntValueHashMap()
        -
      • -
      - - - -
        -
      • -

        LongKeyIntValueHashMap

        -
        public LongKeyIntValueHashMap​(boolean minimize)
        -
      • -
      - - - -
        -
      • -

        LongKeyIntValueHashMap

        -
        public LongKeyIntValueHashMap​(int initialCapacity)
        -                       throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(long key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(int value)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public java.lang.Integer get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get​(long key)
        -        throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get​(long key,
        -               int defaultValue)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public boolean get​(long key,
        -                   int[] value)
        -
      • -
      - - - -
        -
      • -

        getLookup

        -
        public int getLookup​(long key)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public java.lang.Integer put​(java.lang.Long key,
        -                             java.lang.Integer value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        put

        -
        public boolean put​(long key,
        -                   int value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public java.lang.Integer remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(long key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Long,​? extends java.lang.Integer> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        keysToArray

        -
        public long[] keysToArray​(long[] array)
        -
      • -
      - - - -
        -
      • -

        valuesToArray

        -
        public int[] valuesToArray​(int[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Long> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<java.lang.Integer> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Long,​java.lang.Integer>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Long,​java.lang.Integer>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyLongValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyLongValueHashMap.html deleted file mode 100644 index 6058c62c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongKeyLongValueHashMap.html +++ /dev/null @@ -1,705 +0,0 @@ - - - - - -LongKeyLongValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LongKeyLongValueHashMap

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.LongKeyLongValueHashMap
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Long,​java.lang.Long>
    -
    -
    -
    public class LongKeyLongValueHashMap
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Long,​java.lang.Long>
    -
    A Map of long primitives to to long primitive.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(long key) 
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(long value) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<java.lang.Long,​java.lang.Long>>entrySet() 
      longget​(long key) 
      longget​(long key, - long defaultValue) 
      booleanget​(long key, - long[] value) 
      java.lang.Longget​(java.lang.Object key) 
      Set<java.lang.Long>keySet() 
      long[]keysToArray​(long[] array) 
      booleanput​(long key, - long value) 
      java.lang.Longput​(java.lang.Long key, - java.lang.Long value) 
      voidputAll​(IntKeyIntValueHashMap other) 
      voidputAll​(Map<? extends java.lang.Long,​? extends java.lang.Long> other) 
      booleanremove​(long key) 
      java.lang.Longremove​(java.lang.Object key) 
      Collection<java.lang.Long>values() 
      long[]valuesToArray​(long[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LongKeyLongValueHashMap

        -
        public LongKeyLongValueHashMap()
        -
      • -
      - - - -
        -
      • -

        LongKeyLongValueHashMap

        -
        public LongKeyLongValueHashMap​(int initialCapacity)
        -                        throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        LongKeyLongValueHashMap

        -
        public LongKeyLongValueHashMap​(boolean minimize)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(long key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(long value)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public java.lang.Long get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public long get​(long key)
        -         throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public long get​(long key,
        -                long defaultValue)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public boolean get​(long key,
        -                   long[] value)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public java.lang.Long put​(java.lang.Long key,
        -                          java.lang.Long value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        put

        -
        public boolean put​(long key,
        -                   long value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public java.lang.Long remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(long key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Long,​? extends java.lang.Long> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        keysToArray

        -
        public long[] keysToArray​(long[] array)
        -
      • -
      - - - -
        -
      • -

        valuesToArray

        -
        public long[] valuesToArray​(long[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Long> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<java.lang.Long> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Long,​java.lang.Long>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Long,​java.lang.Long>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongLookup.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongLookup.html deleted file mode 100644 index d74ff5cb..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongLookup.html +++ /dev/null @@ -1,458 +0,0 @@ - - - - - -LongLookup (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface LongLookup

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    DoubleIntIndex, DoubleLongIndex
    -
    -
    -
    public interface LongLookup
    -
    Interface for long to long lookup.
    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        add

        -
        int add​(long key,
        -        long value)
        -
      • -
      - - - -
        -
      • -

        addUnsorted

        -
        boolean addUnsorted​(long key,
        -                    long value)
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        long lookup​(long key)
        -     throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        lookup

        -
        long lookup​(long key,
        -            long def)
        -
      • -
      - - - -
        -
      • -

        getLongKey

        -
        long getLongKey​(int pos)
        -
      • -
      - - - -
        -
      • -

        getLongValue

        -
        long getLongValue​(int pos)
        -
      • -
      - - - -
        -
      • -

        setLongValue

        -
        void setLongValue​(int pos,
        -                  long newValue)
        -
      • -
      - - - -
        -
      • -

        getTotalValues

        -
        long getTotalValues()
        -
      • -
      - - - -
        -
      • -

        size

        -
        int size()
        -
      • -
      - - - -
        -
      • -

        sort

        -
        void sort()
        -
      • -
      - - - -
        -
      • -

        clear

        -
        void clear()
        -
      • -
      - - - - - - - -
        -
      • -

        addUnsorted

        -
        boolean addUnsorted​(LongLookup other)
        -
      • -
      - - - -
        -
      • -

        compactLookupAsIntervals

        -
        boolean compactLookupAsIntervals()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongValueHashMap.html deleted file mode 100644 index 0d96a656..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/LongValueHashMap.html +++ /dev/null @@ -1,530 +0,0 @@ - - - - - -LongValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class LongValueHashMap<K>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.LongValueHashMap<K>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    public class LongValueHashMap<K>
    -extends org.hsqldb.map.BaseHashMap
    -
    A Map of Object keys to long primitives.

    - - This class does not store null keys.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(java.lang.Object key) 
      Set<Map.Entry<K,​java.lang.Long>>entrySet() 
      longget​(java.lang.Object key) 
      longget​(java.lang.Object key, - int defaultValue) 
      booleanget​(java.lang.Object key, - long[] value) 
      java.lang.ObjectgetKey​(long value) 
      Set<K>keySet() 
      booleanput​(java.lang.Object key, - long value) 
      voidputAll​(LongValueHashMap t) 
      booleanremove​(java.lang.Object key) 
      Collection<java.lang.Long>values() 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LongValueHashMap

        -
        public LongValueHashMap()
        -
      • -
      - - - -
        -
      • -

        LongValueHashMap

        -
        public LongValueHashMap​(int initialCapacity)
        -                 throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        LongValueHashMap

        -
        public LongValueHashMap​(int initialCapacity,
        -                        ObjectComparator comparator)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        get

        -
        public long get​(java.lang.Object key)
        -         throws java.util.NoSuchElementException
        -
        -
        Throws:
        -
        java.util.NoSuchElementException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public long get​(java.lang.Object key,
        -                int defaultValue)
        -
      • -
      - - - -
        -
      • -

        get

        -
        public boolean get​(java.lang.Object key,
        -                   long[] value)
        -
      • -
      - - - -
        -
      • -

        getKey

        -
        public java.lang.Object getKey​(long value)
        -
      • -
      - - - -
        -
      • -

        put

        -
        public boolean put​(java.lang.Object key,
        -                   long value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object key)
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
      • -
      - - - - - - - -
        -
      • -

        keySet

        -
        public Set<K> keySet()
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<java.lang.Long> values()
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<K,​java.lang.Long>> entrySet()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Map.Entry.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Map.Entry.html deleted file mode 100644 index 72d0211f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Map.Entry.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - -Map.Entry (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface Map.Entry<K,​V>

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    MapEntry
    -
    -
    -
    Enclosing interface:
    -
    Map<K,​V>
    -
    -
    -
    public static interface Map.Entry<K,​V>
    -
    Interface for a key - value pair.
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKey

        -
        K getKey()
        -
      • -
      - - - -
        -
      • -

        getValue

        -
        V getValue()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Map.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Map.html deleted file mode 100644 index ac50a5d1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Map.html +++ /dev/null @@ -1,446 +0,0 @@ - - - - - -Map (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface Map<K,​V>

-
-
-
- -
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        size

        -
        int size()
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        boolean isEmpty()
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        boolean containsKey​(java.lang.Object key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        boolean containsValue​(java.lang.Object value)
        -
      • -
      - - - -
        -
      • -

        get

        -
        V get​(java.lang.Object key)
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        V put​(K key,
        -      V value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        V remove​(java.lang.Object key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        void putAll​(Map<? extends K,​? extends V> m)
        -
      • -
      - - - -
        -
      • -

        clear

        -
        void clear()
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        Set<K> keySet()
        -
      • -
      - - - - - - - - -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/MapEntry.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/MapEntry.html deleted file mode 100644 index f157290f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/MapEntry.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - -MapEntry (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class MapEntry<K,​V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.MapEntry<K,​V>
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map.Entry<K,​V>
    -
    -
    -
    public class MapEntry<K,​V>
    -extends java.lang.Object
    -implements Map.Entry<K,​V>
    -
    A key - value pair.
    -
    -
    Since:
    -
    2.6.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKey

        -
        public K getKey()
        -
        -
        Specified by:
        -
        getKey in interface Map.Entry<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        getValue

        -
        public V getValue()
        -
        -
        Specified by:
        -
        getValue in interface Map.Entry<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        equals

        -
        public boolean equals​(java.lang.Object o)
        -
        -
        Overrides:
        -
        equals in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class java.lang.Object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/MultiValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/MultiValueHashMap.html deleted file mode 100644 index 964ecde2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/MultiValueHashMap.html +++ /dev/null @@ -1,700 +0,0 @@ - - - - - -MultiValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class MultiValueHashMap<K,​V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.MultiValueHashMap<K,​V>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<K,​V>
    -
    -
    -
    public class MultiValueHashMap<K,​V>
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<K,​V>
    -
    A Map of Object keys to Object values which stores multiple values per - key. The getValuesIterator(K key) method returns an iterator covering the - values associated with the given key. The get(K key) method returns the first - value (if any) associated with the key.

    - - This class does not store null keys.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<K,​V>>entrySet() 
      Vget​(java.lang.Object key) -
      Returns one of the values associated with the given key.
      -
      Iterator<V>getValuesIterator​(java.lang.Object key) -
      Returns an iterator on all values associated with the key.
      -
      Set<K>keySet() 
      <T> T[]keysToArray​(T[] array) 
      Vput​(K key, - V value) 
      voidputAll​(Map<? extends K,​? extends V> m) 
      voidputAll​(MultiValueHashMap<K,​V> m) 
      Vremove​(java.lang.Object key) -
      Removes all values associated with the key.
      -
      booleanremove​(java.lang.Object key, - java.lang.Object value) -
      Removes the spacific value associated with the key.
      -
      intvalueCount​(java.lang.Object key) -
      Counts the values associated with the key.
      -
      Collection<V>values() 
      <T> T[]valuesToArray​(T[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        MultiValueHashMap

        -
        public MultiValueHashMap()
        -
      • -
      - - - -
        -
      • -

        MultiValueHashMap

        -
        public MultiValueHashMap​(int initialCapacity)
        -                  throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        MultiValueHashMap

        -
        public MultiValueHashMap​(int initialCapacity,
        -                         ObjectComparator comparator)
        -                  throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(java.lang.Object key)
        -
        Returns one of the values associated with the given key.
        -
        -
        Specified by:
        -
        get in interface Map<K,​V>
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        any value associated with the key, or null if none
        -
        -
      • -
      - - - -
        -
      • -

        getValuesIterator

        -
        public Iterator<V> getValuesIterator​(java.lang.Object key)
        -
        Returns an iterator on all values associated with the key.
        -
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        iterator on value associated with the key
        -
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(K key,
        -             V value)
        -
        -
        Specified by:
        -
        put in interface Map<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(java.lang.Object key)
        -
        Removes all values associated with the key.
        -
        -
        Specified by:
        -
        remove in interface Map<K,​V>
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        any value associated with the key, or null if none
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object key,
        -                      java.lang.Object value)
        -
        Removes the spacific value associated with the key.
        -
        -
        Parameters:
        -
        key - the key
        -
        value - the value
        -
        Returns:
        -
        the value associated with the key, or null if none
        -
        -
      • -
      - - - -
        -
      • -

        valueCount

        -
        public int valueCount​(java.lang.Object key)
        -
        Counts the values associated with the key.
        -
        -
        Parameters:
        -
        key - the key
        -
        Returns:
        -
        the count
        -
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends K,​? extends V> m)
        -
        -
        Specified by:
        -
        putAll in interface Map<K,​V>
        -
        -
      • -
      - - - - - - - - - -
        -
      • -

        keysToArray

        -
        public <T> T[] keysToArray​(T[] array)
        -
      • -
      - - - - - -
        -
      • -

        valuesToArray

        -
        public <T> T[] valuesToArray​(T[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<K> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<K,​V>
        -
        -
      • -
      - - - - - - - - -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Notified.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Notified.html deleted file mode 100644 index 92627629..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Notified.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - -Notified (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface Notified

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    Server, WebServer
    -
    -
    -
    public interface Notified
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        notify

        -
        void notify​(int id)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.DefaultComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.DefaultComparator.html deleted file mode 100644 index 50ee9b51..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.DefaultComparator.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - -ObjectComparator.DefaultComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ObjectComparator.DefaultComparator

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ObjectComparator.DefaultComparator
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    ObjectComparator
    -
    -
    -
    Enclosing interface:
    -
    ObjectComparator<T>
    -
    -
    -
    public static class ObjectComparator.DefaultComparator
    -extends java.lang.Object
    -implements ObjectComparator
    -
    Comparator that uses the equals and hash code methods of Objects.
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DefaultComparator

        -
        public DefaultComparator()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        equals

        -
        public boolean equals​(java.lang.Object a,
        -                      java.lang.Object b)
        -
        -
        Specified by:
        -
        equals in interface ObjectComparator
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode​(java.lang.Object a)
        -
        -
        Specified by:
        -
        hashCode in interface ObjectComparator
        -
        -
      • -
      - - - -
        -
      • -

        longKey

        -
        public long longKey​(java.lang.Object a)
        -
        -
        Specified by:
        -
        longKey in interface ObjectComparator
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.IdentityComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.IdentityComparator.html deleted file mode 100644 index b9e4b0b1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.IdentityComparator.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - -ObjectComparator.IdentityComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ObjectComparator.IdentityComparator

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ObjectComparator.IdentityComparator
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    ObjectComparator
    -
    -
    -
    Enclosing interface:
    -
    ObjectComparator<T>
    -
    -
    -
    public static class ObjectComparator.IdentityComparator
    -extends java.lang.Object
    -implements ObjectComparator
    -
    Comparator that uses identity for Object equality.
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        IdentityComparator

        -
        public IdentityComparator()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        equals

        -
        public boolean equals​(java.lang.Object a,
        -                      java.lang.Object b)
        -
        -
        Specified by:
        -
        equals in interface ObjectComparator
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode​(java.lang.Object a)
        -
        -
        Specified by:
        -
        hashCode in interface ObjectComparator
        -
        -
      • -
      - - - -
        -
      • -

        longKey

        -
        public long longKey​(java.lang.Object a)
        -
        -
        Specified by:
        -
        longKey in interface ObjectComparator
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.html deleted file mode 100644 index 8b75e1f9..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ObjectComparator.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - -ObjectComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface ObjectComparator<T>

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    ObjectComparator.DefaultComparator, ObjectComparator.IdentityComparator
    -
    -
    -
    public interface ObjectComparator<T>
    -
    Interface for equality comparison.

    - - The equals and hashCode methods of this interace are used instead of - the methods of the compared Objects.

    - - The DefaultComparator implmentation calls the Object's methods.

    - - The IdentityComparator implementation uses == instead of the equals - method of the Object.

    - - Updated for generics fredt@users.

    -
    -
    Since:
    -
    2.0
    -
    Author:
    -
    fredt@users
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - - - -
        -
      • -

        equals

        -
        boolean equals​(T a,
        -               T b)
        -
      • -
      - - - - - -
        -
      • -

        hashCode

        -
        int hashCode​(T a)
        -
      • -
      - - - - - -
        -
      • -

        longKey

        -
        long longKey​(T a)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedHashMap.html deleted file mode 100644 index c7b53fc0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedHashMap.html +++ /dev/null @@ -1,638 +0,0 @@ - - - - - -OrderedHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class OrderedHashMap<K,​V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • - -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<K,​V>
    -
    -
    -
    public class OrderedHashMap<K,​V>
    -extends HashMap<K,​V>
    -
    A Map which maintains the insertion order of the key/value pairs and allows - access by index. Iterators return the keys or values in the index order.

    - - This class does not store null keys.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OrderedHashMap

        -
        public OrderedHashMap()
        -
      • -
      - - - -
        -
      • -

        OrderedHashMap

        -
        public OrderedHashMap​(int initialCapacity)
        -               throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKeyAt

        -
        public K getKeyAt​(int index)
        -           throws java.lang.IndexOutOfBoundsException
        -
        Returns the key stored in the entry at index position.
        -
        -
        Parameters:
        -
        index - the index of the entry
        -
        Returns:
        -
        the value stored in the entry
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException - for invalid argument
        -
        -
      • -
      - - - -
        -
      • -

        getValueAt

        -
        public V getValueAt​(int index)
        -             throws java.lang.IndexOutOfBoundsException
        -
        Returns the value stored in the entry at index position.
        -
        -
        Parameters:
        -
        index - the index of the entry
        -
        Returns:
        -
        the value stored in the entry
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException - for invalid argument
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(int index)
        -      throws java.lang.IndexOutOfBoundsException
        -
        Same as getValueAt(index).
        -
        -
        Parameters:
        -
        index - the index of the entry
        -
        Returns:
        -
        the value stored in the entry
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException - for invalid argument
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<K,​V>
        -
        Overrides:
        -
        remove in class HashMap<K,​V>
        -
        -
      • -
      - - - -
        -
      • -

        removeEntry

        -
        public void removeEntry​(int index)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        public boolean add​(K key,
        -                   V value)
        -
      • -
      - - - - - -
        -
      • -

        setValueAt

        -
        public V setValueAt​(int index,
        -                    V value)
        -             throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        insert

        -
        public boolean insert​(int index,
        -                      K key,
        -                      V value)
        -               throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        set

        -
        public boolean set​(int index,
        -                   K key,
        -                   V value)
        -            throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        setKeyAt

        -
        public boolean setKeyAt​(int index,
        -                        K key)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        getIndex

        -
        public int getIndex​(K key)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedHashSet.html deleted file mode 100644 index faf03545..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedHashSet.html +++ /dev/null @@ -1,715 +0,0 @@ - - - - - -OrderedHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class OrderedHashSet<E>

-
-
-
    -
  • java.lang.Object
  • -
  • - -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Collection<E>, List<E>, Set<E>
    -
    -
    -
    public class OrderedHashSet<E>
    -extends HashSet<E>
    -implements List<E>, Set<E>
    -
    A list which is also a Set which maintains the inserted order of elements and - allows access by index. Iterators return the elements in the index order.

    - - This class does not store null elements.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OrderedHashSet

        -
        public OrderedHashSet()
        -
      • -
      - - - -
        -
      • -

        OrderedHashSet

        -
        public OrderedHashSet​(int initialCapacity)
        -
      • -
      - - - -
        -
      • -

        OrderedHashSet

        -
        public OrderedHashSet​(int initialCapacity,
        -                      ObjectComparator<E> comparator)
        -
      • -
      - - - -
        -
      • -

        OrderedHashSet

        -
        public OrderedHashSet​(java.lang.Object[] valueList)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        remove

        -
        public boolean remove​(java.lang.Object key)
        -
        Description copied from class: HashSet
        -
        returns true if removed
        -
        -
        Specified by:
        -
        remove in interface Collection<E>
        -
        Overrides:
        -
        remove in class HashSet<E>
        -
        Parameters:
        -
        key - Object to remove
        -
        Returns:
        -
        true if removed
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public E remove​(int index)
        -
        -
        Specified by:
        -
        remove in interface List<E>
        -
        -
      • -
      - - - -
        -
      • -

        removeEntry

        -
        public void removeEntry​(int index)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        insert

        -
        public boolean insert​(int index,
        -                      E key)
        -               throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        set

        -
        public E set​(int index,
        -             E key)
        -
        -
        Specified by:
        -
        set in interface List<E>
        -
        -
      • -
      - - - - - -
        -
      • -

        add

        -
        public void add​(int index,
        -                E key)
        -
        -
        Specified by:
        -
        add in interface List<E>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public E get​(int index)
        -
        -
        Specified by:
        -
        get in interface List<E>
        -
        -
      • -
      - - - -
        -
      • -

        toArray

        -
        public java.lang.Object[] toArray()
        -
        -
        Overrides:
        -
        toArray in class HashSet<E>
        -
        -
      • -
      - - - - - -
        -
      • -

        toArray

        -
        public <T> T[] toArray​(T[] array)
        -
        -
        Overrides:
        -
        toArray in class HashSet<E>
        -
        -
      • -
      - - - -
        -
      • -

        indexOf

        -
        public int indexOf​(java.lang.Object key)
        -
      • -
      - - - -
        -
      • -

        getIndex

        -
        public int getIndex​(java.lang.Object key)
        -
      • -
      - - - -
        -
      • -

        lastIndexOf

        -
        public int lastIndexOf​(java.lang.Object o)
        -
      • -
      - - - -
        -
      • -

        getLargestIndex

        -
        public int getLargestIndex​(OrderedHashSet<E> other)
        -
      • -
      - - - -
        -
      • -

        getSmallestIndex

        -
        public int getSmallestIndex​(OrderedHashSet<E> other)
        -
      • -
      - - - - - - - - - - - - - - -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedIntHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedIntHashSet.html deleted file mode 100644 index 27c2a6eb..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedIntHashSet.html +++ /dev/null @@ -1,504 +0,0 @@ - - - - - -OrderedIntHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class OrderedIntHashSet

-
-
-
    -
  • java.lang.Object
  • -
  • - -
  • -
-
-
    -
  • -
    -
    public class OrderedIntHashSet
    -extends IntHashSet
    -
    A list which is also a set of int primitives which maintains the insertion - order of the elements and allows access by index. Iterators return the keys - in the index order.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OrderedIntHashSet

        -
        public OrderedIntHashSet()
        -
      • -
      - - - -
        -
      • -

        OrderedIntHashSet

        -
        public OrderedIntHashSet​(int initialCapacity)
        -                  throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        OrderedIntHashSet

        -
        public OrderedIntHashSet​(int[] elements)
        -
      • -
      - - - -
        -
      • -

        OrderedIntHashSet

        -
        public OrderedIntHashSet​(int[] elementsA,
        -                         int[] elementsB)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        insert

        -
        public boolean insert​(int index,
        -                      int key)
        -               throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(int key)
        -
        -
        Overrides:
        -
        remove in class IntHashSet
        -
        -
      • -
      - - - -
        -
      • -

        removeEntry

        -
        public void removeEntry​(int index)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public int get​(int index)
        -
      • -
      - - - -
        -
      • -

        getIndex

        -
        public int getIndex​(int value)
        -
      • -
      - - - -
        -
      • -

        getOrderedStartMatchCount

        -
        public int getOrderedStartMatchCount​(int[] array)
        -
      • -
      - - - - -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedIntKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedIntKeyHashMap.html deleted file mode 100644 index 2c2011a0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedIntKeyHashMap.html +++ /dev/null @@ -1,559 +0,0 @@ - - - - - -OrderedIntKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class OrderedIntKeyHashMap<V>

-
-
-
    -
  • java.lang.Object
  • -
  • - -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Integer,​V>
    -
    -
    -
    public class OrderedIntKeyHashMap<V>
    -extends IntKeyHashMap<V>
    -implements Map<java.lang.Integer,​V>
    -
    A Map of int primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index. Iterators return the keys - or values in the index order.

    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OrderedIntKeyHashMap

        -
        public OrderedIntKeyHashMap()
        -
      • -
      - - - -
        -
      • -

        OrderedIntKeyHashMap

        -
        public OrderedIntKeyHashMap​(int initialCapacity)
        -                     throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKeyAt

        -
        public int getKeyAt​(int lookup,
        -                    int def)
        -
      • -
      - - - -
        -
      • -

        getValueAt

        -
        public java.lang.Object getValueAt​(int index)
        -
      • -
      - - - -
        -
      • -

        setValueAt

        -
        public java.lang.Object setValueAt​(int index,
        -                                   java.lang.Object value)
        -
      • -
      - - - - - -
        -
      • -

        set

        -
        public boolean set​(int index,
        -                   int key,
        -                   V value)
        -            throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        insert

        -
        public boolean insert​(int index,
        -                      int key,
        -                      V value)
        -               throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        setKeyAt

        -
        public boolean setKeyAt​(int index,
        -                        int key)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        getIndex

        -
        public int getIndex​(int key)
        -
      • -
      - - - - - - - -
        -
      • -

        removeEntry

        -
        public void removeEntry​(int index)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedLongHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedLongHashSet.html deleted file mode 100644 index fb575f51..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedLongHashSet.html +++ /dev/null @@ -1,530 +0,0 @@ - - - - - -OrderedLongHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class OrderedLongHashSet

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.OrderedLongHashSet
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    public class OrderedLongHashSet
    -extends org.hsqldb.map.BaseHashMap
    -
    A list which is also a set of long primitives which maintains the insertion - order of the elements and allows access by index. Iterators return the keys - or values in the index order.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OrderedLongHashSet

        -
        public OrderedLongHashSet()
        -
      • -
      - - - -
        -
      • -

        OrderedLongHashSet

        -
        public OrderedLongHashSet​(int initialCapacity)
        -                   throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        contains

        -
        public boolean contains​(long key)
        -
      • -
      - - - -
        -
      • -

        add

        -
        public boolean add​(long key)
        -
      • -
      - - - -
        -
      • -

        insert

        -
        public boolean insert​(int index,
        -                      long key)
        -               throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public boolean remove​(long key)
        -
      • -
      - - - -
        -
      • -

        removeEntry

        -
        public void removeEntry​(int index)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public long get​(int index)
        -
      • -
      - - - -
        -
      • -

        getIndex

        -
        public int getIndex​(long value)
        -
      • -
      - - - -
        -
      • -

        getStartMatchCount

        -
        public int getStartMatchCount​(long[] array)
        -
      • -
      - - - -
        -
      • -

        getOrderedStartMatchCount

        -
        public int getOrderedStartMatchCount​(long[] array)
        -
      • -
      - - - - - - - -
        -
      • -

        toArray

        -
        public long[] toArray()
        -
      • -
      - - - - -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedLongKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedLongKeyHashMap.html deleted file mode 100644 index 04975c49..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/OrderedLongKeyHashMap.html +++ /dev/null @@ -1,905 +0,0 @@ - - - - - -OrderedLongKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class OrderedLongKeyHashMap<V>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.map.BaseHashMap
    • -
    • -
        -
      • org.hsqldb.lib.OrderedLongKeyHashMap<V>
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Map<java.lang.Long,​V>
    -
    -
    -
    public class OrderedLongKeyHashMap<V>
    -extends org.hsqldb.map.BaseHashMap
    -implements Map<java.lang.Long,​V>
    -
    A Map of long primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index. Iterators return the keys - or values in the index order.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from interface org.hsqldb.lib.Map

        -Map.Entry<K,​V>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.map.BaseHashMap

        -ACCESS_MAX, emptyObjectArray
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleancontainsKey​(long key) 
      booleancontainsKey​(java.lang.Object key) 
      booleancontainsValue​(java.lang.Object value) 
      Set<Map.Entry<java.lang.Long,​V>>entrySet() 
      Vget​(long key) 
      Vget​(java.lang.Object key) 
      intgetIndex​(long key) 
      longgetKeyAt​(int index) 
      intgetLookup​(long key) 
      java.lang.ObjectgetSecondValueAt​(int index) 
      java.lang.ObjectgetThirdValueAt​(int index) 
      VgetValueAt​(int index) 
      booleaninsert​(int index, - long key, - V value) 
      Set<java.lang.Long>keySet() 
      long[]keysToArray​(long[] array) 
      Vput​(long key, - V value) 
      Vput​(java.lang.Long key, - V value) 
      voidputAll​(LongKeyHashMap other) 
      voidputAll​(Map<? extends java.lang.Long,​? extends V> other) 
      Vremove​(long key) 
      Vremove​(java.lang.Object key) 
      voidremoveEntry​(int index) 
      booleanset​(int index, - long key, - V value) 
      booleansetKeyAt​(int index, - long key) 
      java.lang.ObjectsetSecondValueAt​(int index, - java.lang.Object value) 
      java.lang.ObjectsetThirdValueAt​(int index, - java.lang.Object value) 
      java.lang.ObjectsetValueAt​(int index, - java.lang.Object value) 
      Collection<V>values() 
      java.lang.Object[]valuesToArray() 
      <T> T[]valuesToArray​(T[] array) 
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.map.BaseHashMap

        -clear, clone, isEmpty, size
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      - -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OrderedLongKeyHashMap

        -
        public OrderedLongKeyHashMap()
        -
      • -
      - - - -
        -
      • -

        OrderedLongKeyHashMap

        -
        public OrderedLongKeyHashMap​(int initialCapacity)
        -                      throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      - - - -
        -
      • -

        OrderedLongKeyHashMap

        -
        public OrderedLongKeyHashMap​(int initialCapacity,
        -                             boolean hasThirdValue)
        -                      throws java.lang.IllegalArgumentException
        -
        -
        Throws:
        -
        java.lang.IllegalArgumentException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(java.lang.Object key)
        -
        -
        Specified by:
        -
        containsKey in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        containsKey

        -
        public boolean containsKey​(long key)
        -
      • -
      - - - -
        -
      • -

        containsValue

        -
        public boolean containsValue​(java.lang.Object value)
        -
        -
        Specified by:
        -
        containsValue in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(java.lang.Object key)
        -
        -
        Specified by:
        -
        get in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        get

        -
        public V get​(long key)
        -
      • -
      - - - -
        -
      • -

        getKeyAt

        -
        public long getKeyAt​(int index)
        -
      • -
      - - - -
        -
      • -

        getValueAt

        -
        public V getValueAt​(int index)
        -
      • -
      - - - -
        -
      • -

        getSecondValueAt

        -
        public java.lang.Object getSecondValueAt​(int index)
        -
      • -
      - - - -
        -
      • -

        getThirdValueAt

        -
        public java.lang.Object getThirdValueAt​(int index)
        -
      • -
      - - - -
        -
      • -

        setValueAt

        -
        public java.lang.Object setValueAt​(int index,
        -                                   java.lang.Object value)
        -
      • -
      - - - -
        -
      • -

        setSecondValueAt

        -
        public java.lang.Object setSecondValueAt​(int index,
        -                                         java.lang.Object value)
        -
      • -
      - - - -
        -
      • -

        setThirdValueAt

        -
        public java.lang.Object setThirdValueAt​(int index,
        -                                        java.lang.Object value)
        -
      • -
      - - - - - -
        -
      • -

        insert

        -
        public boolean insert​(int index,
        -                      long key,
        -                      V value)
        -               throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - - - -
        -
      • -

        set

        -
        public boolean set​(int index,
        -                   long key,
        -                   V value)
        -            throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        setKeyAt

        -
        public boolean setKeyAt​(int index,
        -                        long key)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        getIndex

        -
        public int getIndex​(long key)
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(java.lang.Long key,
        -             V value)
        -
        -
        Specified by:
        -
        put in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - - - -
        -
      • -

        put

        -
        public V put​(long key,
        -             V value)
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(java.lang.Object key)
        -
        -
        Specified by:
        -
        remove in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public V remove​(long key)
        -
      • -
      - - - -
        -
      • -

        removeEntry

        -
        public void removeEntry​(int index)
        -                 throws java.lang.IndexOutOfBoundsException
        -
        -
        Throws:
        -
        java.lang.IndexOutOfBoundsException
        -
        -
      • -
      - - - -
        -
      • -

        getLookup

        -
        public int getLookup​(long key)
        -
      • -
      - - - -
        -
      • -

        putAll

        -
        public void putAll​(Map<? extends java.lang.Long,​? extends V> other)
        -
        -
        Specified by:
        -
        putAll in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - - - - - -
        -
      • -

        keysToArray

        -
        public long[] keysToArray​(long[] array)
        -
      • -
      - - - -
        -
      • -

        valuesToArray

        -
        public java.lang.Object[] valuesToArray()
        -
      • -
      - - - - - -
        -
      • -

        valuesToArray

        -
        public <T> T[] valuesToArray​(T[] array)
        -
      • -
      - - - -
        -
      • -

        keySet

        -
        public Set<java.lang.Long> keySet()
        -
        -
        Specified by:
        -
        keySet in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        values

        -
        public Collection<V> values()
        -
        -
        Specified by:
        -
        values in interface Map<java.lang.Long,​V>
        -
        -
      • -
      - - - -
        -
      • -

        entrySet

        -
        public Set<Map.Entry<java.lang.Long,​V>> entrySet()
        -
        -
        Specified by:
        -
        entrySet in interface Map<java.lang.Long,​V>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/PrimitiveIterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/PrimitiveIterator.html deleted file mode 100644 index 5852e66e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/PrimitiveIterator.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - -PrimitiveIterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface PrimitiveIterator<E>

-
-
-
-
    -
  • -
    -
    All Superinterfaces:
    -
    Iterator<E>
    -
    -
    -
    public interface PrimitiveIterator<E>
    -extends Iterator<E>
    -
    Marker interface for iterators supporting nextInt or nextLong methods.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReadWriteLockDummy.LockDummy.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReadWriteLockDummy.LockDummy.html deleted file mode 100644 index 0acb6b62..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReadWriteLockDummy.LockDummy.html +++ /dev/null @@ -1,413 +0,0 @@ - - - - - -ReadWriteLockDummy.LockDummy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ReadWriteLockDummy.LockDummy

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ReadWriteLockDummy.LockDummy
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.util.concurrent.locks.Lock
    -
    -
    -
    Enclosing class:
    -
    ReadWriteLockDummy
    -
    -
    -
    public static class ReadWriteLockDummy.LockDummy
    -extends java.lang.Object
    -implements java.util.concurrent.locks.Lock
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      LockDummy() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidlock() 
      voidlockInterruptibly() 
      java.util.concurrent.locks.ConditionnewCondition() 
      booleantryLock() 
      booleantryLock​(long time, - java.util.concurrent.TimeUnit unit) 
      voidunlock() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        LockDummy

        -
        public LockDummy()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        lock

        -
        public void lock()
        -
        -
        Specified by:
        -
        lock in interface java.util.concurrent.locks.Lock
        -
        -
      • -
      - - - -
        -
      • -

        lockInterruptibly

        -
        public void lockInterruptibly()
        -
        -
        Specified by:
        -
        lockInterruptibly in interface java.util.concurrent.locks.Lock
        -
        -
      • -
      - - - -
        -
      • -

        tryLock

        -
        public boolean tryLock()
        -
        -
        Specified by:
        -
        tryLock in interface java.util.concurrent.locks.Lock
        -
        -
      • -
      - - - -
        -
      • -

        tryLock

        -
        public boolean tryLock​(long time,
        -                       java.util.concurrent.TimeUnit unit)
        -
        -
        Specified by:
        -
        tryLock in interface java.util.concurrent.locks.Lock
        -
        -
      • -
      - - - -
        -
      • -

        unlock

        -
        public void unlock()
        -
        -
        Specified by:
        -
        unlock in interface java.util.concurrent.locks.Lock
        -
        -
      • -
      - - - -
        -
      • -

        newCondition

        -
        public java.util.concurrent.locks.Condition newCondition()
        -
        -
        Specified by:
        -
        newCondition in interface java.util.concurrent.locks.Lock
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReadWriteLockDummy.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReadWriteLockDummy.html deleted file mode 100644 index e3f6283a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReadWriteLockDummy.html +++ /dev/null @@ -1,358 +0,0 @@ - - - - - -ReadWriteLockDummy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ReadWriteLockDummy

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ReadWriteLockDummy
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.util.concurrent.locks.ReadWriteLock
    -
    -
    -
    public class ReadWriteLockDummy
    -extends java.lang.Object
    -implements java.util.concurrent.locks.ReadWriteLock
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ReadWriteLockDummy() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.util.concurrent.locks.LockreadLock() 
      java.util.concurrent.locks.LockwriteLock() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ReadWriteLockDummy

        -
        public ReadWriteLockDummy()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        readLock

        -
        public java.util.concurrent.locks.Lock readLock()
        -
        -
        Specified by:
        -
        readLock in interface java.util.concurrent.locks.ReadWriteLock
        -
        -
      • -
      - - - -
        -
      • -

        writeLock

        -
        public java.util.concurrent.locks.Lock writeLock()
        -
        -
        Specified by:
        -
        writeLock in interface java.util.concurrent.locks.ReadWriteLock
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReaderInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReaderInputStream.html deleted file mode 100644 index 41824c01..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ReaderInputStream.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - -ReaderInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ReaderInputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.InputStream
    • -
    • -
        -
      • org.hsqldb.lib.ReaderInputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.lang.AutoCloseable
    -
    -
    -
    public class ReaderInputStream
    -extends java.io.InputStream
    -
    This class is an part implementation of DataInput. It wraps a Reader object.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ReaderInputStream​(java.io.Reader reader) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intread() 
      -
        -
      • - - -

        Methods inherited from class java.io.InputStream

        -available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ReaderInputStream

        -
        public ReaderInputStream​(java.io.Reader reader)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        read

        -
        public int read()
        -         throws java.io.IOException
        -
        -
        Specified by:
        -
        read in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/RefCapablePropertyResourceBundle.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/RefCapablePropertyResourceBundle.html deleted file mode 100644 index fb5e7c9e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/RefCapablePropertyResourceBundle.html +++ /dev/null @@ -1,715 +0,0 @@ - - - - - -RefCapablePropertyResourceBundle (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class RefCapablePropertyResourceBundle

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.RefCapablePropertyResourceBundle
    • -
    -
  • -
-
-
    -
  • -
    -
    public class RefCapablePropertyResourceBundle
    -extends java.lang.Object
    -
    Just like PropertyResourceBundle, except keys mapped to nothing in the - properties file will load the final String value from a text file. - - The use case is where one wants to use a ResourceBundle for Strings, - but some of the Strings are long-- too long to maintain in a Java - .properties file. - By using this class, you can put each such long String in its own - separate file, yet all keys mapped to (non-empty) values in the - .properties file will behave just like regular PropertyResourceBundle - properties. - In this documentation, I call these values read in atomically from - other files referenced values, because the values are not directly - in the .properties file, but are "referenced" in the .properties file - by virtue of the empty value for the key. - - You use this class in the same way as you would traditionally use - ResourceBundle: -
    -  import org.hsqldb.util..RefCapablePropertyResourceBundle;
    -  ...
    -      RefCapablePropertyResourceBundle bundle =
    -              RefCapablePropertyResourceBundle.getBundle("subdir.xyz");
    -      System.out.println("Value for '1' = (" + bundle.getString("1") + ')');
    - 
    - - Just like PropertyResourceBundle, the .properties file and the - referenced files are read in from the classpath by a class loader, - according to the normal ResourceBundle rules. - To eliminate the need to prohibit the use of any strings in the .properties - values, and to enforce consistency, you must use the following rules - to when putting your referenced files into place. -

    - REFERENCED FILE DIRECTORY is a directory named with the base name of the - properties file, and in the same parent directory. So, the referenced - file directory /a/b/c/greentea is used to hold all reference - files for properties files /a/b/c/greentea_en_us.properties, - /a/b/c/greentea_de.properties, - /a/b/c/greentea.properties, etc. - (BTW, according to ResourceBundle rules, this resource should be looked - up with name "a.b.c.greentea", not "/a/b/c..." or "a/b/c"). - REFERENCED FILES themselves all have the base name of the property key, - with locale appendages exactly as the referring properties files - has, plus the suffix .text. -

    - So, if we have the following line in - /a/b/c/greentea_de.properties: -

    -     1: eins
    - 
    - then you must have a reference text file - /a/b/c/greentea/1_de.properties: -

    - In reference text files, - sequences of "\r", "\n" and "\r\n" are all translated to the line - delimiter for your platform (System property line.separator). - If one of those sequences exists at the very end of the file, it will be - eliminated (so, if you really want getString() to end with a line delimiter, - end your file with two of them). - (The file itself is never modified-- I'm talking about the value returned - by getString(String)). -

    - To prevent throwing at runtime due to unset variables, use a wrapper class - like SqltoolRB (use SqltoolRB.java as a template). - To prevent throwing at runtime due to unset System Properties, or - insufficient parameters passed to getString(String, String[]), set the - behavior values appropriately. -

    - Just like all Properties files, referenced files must use ISO-8859-1 - encoding, with unicode escapes for characters outside of ISO-8859-1 - character set. But, unlike Properties files, \ does not need to be - escaped for normal usage. -

    - The getString() methods with more than one parameter substitute for - "positional" parameters of the form "%{1}". - The getExpandedString() methods substitute for System Property names - of the form "${1}". - In both cases, you can interpose :+ and a string between the variable - name and the closing }. This works just like the Bourne shell - ${x:+y} feature. If "x" is set, then "y" is returned, and "y" may - contain references to the original variable without the curly braces. - In this file, I refer to the y text as the "conditional string". - One example of each type: -

    -     Out val = (${condlSysProp:+Prop condlSysProp is set to $condlSysProp.})
    -     Out val = (%{2:+Pos Var #2 is set to %2.})
    - OUTPUT if neither are set:
    -     Out val = ()
    -     Out val = ()
    - OUTPUT if condlSysProp=alpha and condlPLvar=beta:
    -     Out val = (Prop condlSysProp is set to alpha.)
    -     Out val = (Pos Var #2 is set to beta.)
    - 
    - This feature has the following limitations. -
      -
    • The conditional string may only contain the primary variable. -
    • Inner instances of the primary variable may not use curly braces, - and therefore the variable name must end at a word boundary. -
    - The conditional string may span newlines, and it is often very useful - to do so.
    -
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    PropertyResourceBundle, -ResourceBundle
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static RefCapablePropertyResourceBundlegetBundle​(java.lang.String baseName, - java.lang.ClassLoader loader, - java.lang.Class<? extends java.lang.Enum<?>> loaderClass) -
      Use like java.util.ResourceBundle.getBundle(String).
      -
      static RefCapablePropertyResourceBundlegetBundle​(java.lang.String baseName, - java.util.Locale locale, - java.lang.ClassLoader loader, - java.lang.Class<? extends java.lang.Enum<?>> loaderClass) -
      Use exactly like java.util.ResourceBundle.get(String, Locale, - ClassLoader).
      -
      java.lang.StringgetExpandedString​(java.lang.String key, - int behavior) -
      Same as getString(), but expands System Variables specified in property - values like ${sysvarname}.
      -
      java.lang.StringgetExpandedString​(java.lang.String key, - java.lang.String[] subs, - int missingPropertyBehavior, - int missingPosValueBehavior) 
      java.util.Enumeration<java.lang.String>getKeys() 
      java.lang.StringgetString​(java.lang.String key) -
      Returns value defined in this RefCapablePropertyResourceBundle's - .properties file, unless that value is empty.
      -
      java.lang.StringgetString​(java.lang.String key, - java.lang.String[] subs, - int behavior) 
      java.lang.StringposSubst​(java.lang.String s, - java.lang.String[] subs, - int behavior) -
      Replaces positional substitution patterns of the form %{\d} with - corresponding element of the given subs array.
      -
      static java.lang.StringtoNativeLs​(java.lang.String inString) 
      java.lang.StringtoString() -
      Just identifies this RefCapablePropertyResourceBundle instance.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        LS

        -
        public static final java.lang.String LS
        -
      • -
      - - - - - - - -
        -
      • -

        EMPTYSTRING_BEHAVIOR

        -
        public static final int EMPTYSTRING_BEHAVIOR
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - - -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getKeys

        -
        public java.util.Enumeration<java.lang.String> getKeys()
        -
      • -
      - - - -
        -
      • -

        getExpandedString

        -
        public java.lang.String getExpandedString​(java.lang.String key,
        -                                          int behavior)
        -
        Same as getString(), but expands System Variables specified in property - values like ${sysvarname}.
        -
        -
        Parameters:
        -
        key - String
        -
        behavior - int
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        posSubst

        -
        public java.lang.String posSubst​(java.lang.String s,
        -                                 java.lang.String[] subs,
        -                                 int behavior)
        -
        Replaces positional substitution patterns of the form %{\d} with - corresponding element of the given subs array. Note that %{\d} numbers - are 1-based, so we lok for subs[x-1].
        -
        -
        Parameters:
        -
        s - String
        -
        subs - String[]
        -
        behavior - int
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        getExpandedString

        -
        public java.lang.String getExpandedString​(java.lang.String key,
        -                                          java.lang.String[] subs,
        -                                          int missingPropertyBehavior,
        -                                          int missingPosValueBehavior)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String key,
        -                                  java.lang.String[] subs,
        -                                  int behavior)
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Just identifies this RefCapablePropertyResourceBundle instance.
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String key)
        -
        Returns value defined in this RefCapablePropertyResourceBundle's - .properties file, unless that value is empty. If the value in the - .properties file is empty, then this returns the entire contents of the - referenced text file.
        -
        -
        Parameters:
        -
        key - String
        -
        Returns:
        -
        String
        -
        See Also:
        -
        ResourceBundle.getString(String)
        -
        -
      • -
      - - - -
        -
      • -

        toNativeLs

        -
        public static java.lang.String toNativeLs​(java.lang.String inString)
        -
        -
        Parameters:
        -
        inString - Input string with \n definitively indicating desired - position for line separators.
        -
        Returns:
        -
        If platform's line-separator is \n, then just returns inString. - Otherwise returns a copy of inString, with all \n's - transformed to the platform's line separators.
        -
        -
      • -
      - - - -
        -
      • -

        getBundle

        -
        public static RefCapablePropertyResourceBundle getBundle​(java.lang.String baseName,
        -                                                         java.lang.ClassLoader loader,
        -                                                         java.lang.Class<? extends java.lang.Enum<?>> loaderClass)
        -
        Use like java.util.ResourceBundle.getBundle(String). - - ClassLoader is required for our getBundles()s, since it is impossible - to get the "caller's" ClassLoader without using JNI (i.e., with pure - Java).
        -
        -
        Parameters:
        -
        baseName - String
        -
        loader - ClassLoader
        -
        loaderClass - Class
        -
        Returns:
        -
        RefCapablePropertyResourceBundle
        -
        See Also:
        -
        ResourceBundle.getBundle(String)
        -
        -
      • -
      - - - -
        -
      • -

        getBundle

        -
        public static RefCapablePropertyResourceBundle getBundle​(java.lang.String baseName,
        -                                                         java.util.Locale locale,
        -                                                         java.lang.ClassLoader loader,
        -                                                         java.lang.Class<? extends java.lang.Enum<?>> loaderClass)
        -
        Use exactly like java.util.ResourceBundle.get(String, Locale, - ClassLoader).
        -
        -
        Parameters:
        -
        baseName - String
        -
        locale - Locale
        -
        loader - ClassLoader
        -
        loaderClass - Class
        -
        Returns:
        -
        RefCapablePropertyResourceBundle
        -
        See Also:
        -
        ResourceBundle.getBundle(String, Locale, ClassLoader)
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/RefCapableRBInterface.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/RefCapableRBInterface.html deleted file mode 100644 index 37fca355..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/RefCapableRBInterface.html +++ /dev/null @@ -1,486 +0,0 @@ - - - - - -RefCapableRBInterface (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface RefCapableRBInterface

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    RB
    -
    -
    -
    public interface RefCapableRBInterface
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethodDescription
      java.lang.StringgetExpandedString() 
      java.lang.StringgetExpandedString​(java.lang.String... strings) 
      java.lang.StringgetString() 
      java.lang.StringgetString​(int i1) 
      java.lang.StringgetString​(int i1, - int i2) 
      java.lang.StringgetString​(int i1, - int i2, - int i3) 
      java.lang.StringgetString​(int i1, - int i2, - java.lang.String s3) 
      java.lang.StringgetString​(int i1, - java.lang.String s2) 
      java.lang.StringgetString​(int i1, - java.lang.String s2, - int i3) 
      java.lang.StringgetString​(int i1, - java.lang.String s2, - java.lang.String s3) 
      java.lang.StringgetString​(java.lang.String... strings) 
      java.lang.StringgetString​(java.lang.String s1, - int i2) 
      java.lang.StringgetString​(java.lang.String s1, - int i2, - int i3) 
      java.lang.StringgetString​(java.lang.String s1, - int i2, - java.lang.String s3) 
      java.lang.StringgetString​(java.lang.String s1, - java.lang.String s2, - int i3) 
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getString

        -
        java.lang.String getString()
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(java.lang.String... strings)
        -
      • -
      - - - -
        -
      • -

        getExpandedString

        -
        java.lang.String getExpandedString()
        -
      • -
      - - - -
        -
      • -

        getExpandedString

        -
        java.lang.String getExpandedString​(java.lang.String... strings)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(int i1)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(int i1,
        -                           int i2)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(int i1,
        -                           int i2,
        -                           int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(int i1,
        -                           java.lang.String s2)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(java.lang.String s1,
        -                           int i2)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(int i1,
        -                           int i2,
        -                           java.lang.String s3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(int i1,
        -                           java.lang.String s2,
        -                           int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(java.lang.String s1,
        -                           int i2,
        -                           int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(int i1,
        -                           java.lang.String s2,
        -                           java.lang.String s3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(java.lang.String s1,
        -                           java.lang.String s2,
        -                           int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        java.lang.String getString​(java.lang.String s1,
        -                           int i2,
        -                           java.lang.String s3)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ScannerSearchAlgorithm.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ScannerSearchAlgorithm.html deleted file mode 100644 index d09a9417..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ScannerSearchAlgorithm.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - -ScannerSearchAlgorithm (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ScannerSearchAlgorithm

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ScannerSearchAlgorithm
    • -
    -
  • -
-
-
    -
  • -
    -
    public class ScannerSearchAlgorithm
    -extends java.lang.Object
    -
    Provides a string search facility using a Scanner.
    -
    -
    Since:
    -
    2.7.x
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static longsearch​(java.io.Reader reader, - char[] searchstr, - boolean literal) -
      the given reader for the given searchstr.
      -
      static longsearch​(java.io.Reader reader, - java.lang.String searchstr, - boolean literal) -
      the given reader for the given searchstr.
      -
      static longsearch​(java.io.Reader reader, - java.util.regex.Pattern pattern) -
      the given reader for the given pattern.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        SUGGESTED_MAX_LITERAL_SIZE

        -
        public static final int SUGGESTED_MAX_LITERAL_SIZE
        -
        is 1024. This is the size above which it may be better to use - KMPSearchAlgorithm.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        search

        -
        public static long search​(java.io.Reader reader,
        -                          char[] searchstr,
        -                          boolean literal)
        -
        the given reader for the given searchstr.
        -
        -
        Parameters:
        -
        reader - to search
        -
        searchstr - to find
        -
        literal - true to treat searchstr as a literal search - term; false to treat searchstr as a regular - expression.
        -
        Returns:
        -
        zero-based offset into stream at which searchstr is - found; -1 if not found, reader is null, or - searchstr is null; 0 if searchstr.length() == 0 - && literal == true.
        -
        Throws:
        -
        java.lang.IllegalStateException - if a Scanner illegal state - occurs
        -
        java.lang.IllegalArgumentException - if a Scanner illegal argument is - encountered.
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static long search​(java.io.Reader reader,
        -                          java.lang.String searchstr,
        -                          boolean literal)
        -                   throws java.lang.NullPointerException,
        -                          java.util.regex.PatternSyntaxException,
        -                          java.lang.IllegalStateException,
        -                          java.lang.IllegalArgumentException
        -
        the given reader for the given searchstr.
        -
        -
        Parameters:
        -
        reader - to search
        -
        searchstr - to find
        -
        literal - true to treat searchstr as a literal search - term; false to treat searchstr as a regular - expression.
        -
        Returns:
        -
        zero-based offset into stream at which searchstr is - found; -1 if not found, reader is null, or - searchstr is null; 0 if searchstr.length() == 0 - && literal == true.
        -
        Throws:
        -
        java.util.regex.PatternSyntaxException - if searchstr expression's syntax - is invalid
        -
        java.lang.IllegalStateException - if a Scanner illegal state - occurs
        -
        java.lang.IllegalArgumentException - if a Scanner illegal argument is - encountered.
        -
        java.lang.NullPointerException
        -
        -
      • -
      - - - -
        -
      • -

        search

        -
        public static long search​(java.io.Reader reader,
        -                          java.util.regex.Pattern pattern)
        -                   throws java.lang.IllegalStateException,
        -                          java.lang.IllegalArgumentException
        -
        the given reader for the given pattern.
        -
        -
        Parameters:
        -
        reader - to search
        -
        pattern - to find
        -
        Returns:
        -
        zero-based offset into stream at which searchstr is - found; -1 if not found;
        -
        Throws:
        -
        java.lang.NullPointerException - if reader is null or - pattern is null.
        -
        java.lang.IllegalStateException - if a Scanner illegal state - occurs
        -
        java.lang.IllegalArgumentException - if a Scanner illegal argument is - encountered.
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Set.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Set.html deleted file mode 100644 index 8f2f0ff2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/Set.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - -Set (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface Set<E>

-
-
-
-
    -
  • -
    -
    All Superinterfaces:
    -
    Collection<E>
    -
    -
    -
    All Known Implementing Classes:
    -
    HashSet, OrderedHashSet
    -
    -
    -
    public interface Set<E>
    -extends Collection<E>
    -
    Marker interface for a Collection that is a Set of values.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/SimpleLog.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/SimpleLog.html deleted file mode 100644 index aeb62af7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/SimpleLog.html +++ /dev/null @@ -1,588 +0,0 @@ - - - - - -SimpleLog (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class SimpleLog

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.SimpleLog
    • -
    -
  • -
-
-
    -
  • -
    -
    public class SimpleLog
    -extends java.lang.Object
    -
    Simple log for recording abnormal events in persistence

    - Log levels, LOG_NONE, LOG_ERROR, and LOG_NORMAL are currently supported.

    - LOG_ERROR corresponds to property value 1 and logs main database events plus - any major errors encountered in operation. - LOG_NORMAL corresponds to property value 2 and logs additional normal events - and minor errors.

    -
    -
    Since:
    -
    1.8.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      SimpleLog​(java.lang.String path, - int level, - boolean isSQL) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose() 
      voidflush() 
      intgetLevel() 
      java.io.PrintWritergetPrintWriter() 
      voidlogContext​(int atLevel, - java.lang.String message) 
      voidlogContext​(int atLevel, - java.lang.String prefix, - java.lang.String message, - java.lang.String suffix) 
      voidlogContext​(java.lang.Throwable t, - java.lang.String message, - int atLevel) 
      voidsetLevel​(int level) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        SimpleLog

        -
        public SimpleLog​(java.lang.String path,
        -                 int level,
        -                 boolean isSQL)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getLevel

        -
        public int getLevel()
        -
      • -
      - - - -
        -
      • -

        setLevel

        -
        public void setLevel​(int level)
        -
      • -
      - - - -
        -
      • -

        getPrintWriter

        -
        public java.io.PrintWriter getPrintWriter()
        -
      • -
      - - - -
        -
      • -

        logContext

        -
        public void logContext​(int atLevel,
        -                       java.lang.String message)
        -
      • -
      - - - -
        -
      • -

        logContext

        -
        public void logContext​(int atLevel,
        -                       java.lang.String prefix,
        -                       java.lang.String message,
        -                       java.lang.String suffix)
        -
      • -
      - - - -
        -
      • -

        logContext

        -
        public void logContext​(java.lang.Throwable t,
        -                       java.lang.String message,
        -                       int atLevel)
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StopWatch.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StopWatch.html deleted file mode 100644 index 03899cfd..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StopWatch.html +++ /dev/null @@ -1,628 +0,0 @@ - - - - - -StopWatch (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class StopWatch

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.StopWatch
    • -
    -
  • -
-
-
    -
  • -
    -
    public class StopWatch
    -extends java.lang.Object
    -
    Provides the programatic analog of a physical stop watch.

    - - The watch can be started, stopped and zeroed and can be queried for - elapsed running time. The watch accumulates elapsed time over starts - and stops such that only the time actually spent running is recorded. - If the watch is zeroed, then the accumulated time is discarded and - the watch starts again with zero accumulated time.

    - - Nanosecond support added by fredt@users

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      StopWatch() -
      Creates, zeros, and starts a new StopWatch
      -
      StopWatch​(boolean start) -
      Creates, zeros, and starts a new StopWatch
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      longcurrentElapsedNanos() -
      Retrieves the accumulated nanoseconds this object has spent running since - it was last started.
      -
      java.lang.StringcurrentElapsedNanosToMessage​(java.lang.String prefix) -
      Retrieves prefix + " in " + elapsedTime() + " ns."
      -
      longcurrentElapsedTime() -
      Retrieves the accumulated milliseconds this object has spent running since - it was last started.
      -
      java.lang.StringcurrentElapsedTimeToMessage​(java.lang.String prefix) -
      Retrieves prefix + " in " + elapsedTime() + " ms."
      -
      longelapsedNanos() -
      Retrieves the accumulated nanoseconds this object has spent running since - it was last zeroed.
      -
      java.lang.StringelapsedNanosToMessage​(java.lang.String prefix) -
      Retrieves prefix + " in " + elapsedNanos() + " ns."
      -
      longelapsedTime() -
      Retrieves the accumulated milliseconds this object has spent running since - it was last zeroed.
      -
      java.lang.StringelapsedTimeToMessage​(java.lang.String prefix) -
      Retrieves prefix + " in " + elapsedTime() + " ms."
      -
      voidmark() 
      voidstart() -
      Ensures that this object is in the running state.
      -
      voidstop() -
      Ensures that this object is in the stopped state.
      -
      java.lang.StringtoString() -
      Retrieves the internal state of this object, as a String.
      -
      voidzero() -
      Zeros accumulated running time and restarts this object.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StopWatch

        -
        public StopWatch()
        -
        Creates, zeros, and starts a new StopWatch
        -
      • -
      - - - -
        -
      • -

        StopWatch

        -
        public StopWatch​(boolean start)
        -
        Creates, zeros, and starts a new StopWatch
        -
        -
        Parameters:
        -
        start - boolean
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        elapsedTime

        -
        public long elapsedTime()
        -
        Retrieves the accumulated milliseconds this object has spent running since - it was last zeroed.
        -
        -
        Returns:
        -
        the accumulated milliseconds this object has spent running since - it was last zeroed.
        -
        -
      • -
      - - - -
        -
      • -

        elapsedNanos

        -
        public long elapsedNanos()
        -
        Retrieves the accumulated nanoseconds this object has spent running since - it was last zeroed.
        -
        -
        Returns:
        -
        the accumulated nanoseconds this object has spent running since - it was last zeroed.
        -
        -
      • -
      - - - -
        -
      • -

        currentElapsedTime

        -
        public long currentElapsedTime()
        -
        Retrieves the accumulated milliseconds this object has spent running since - it was last started.
        -
        -
        Returns:
        -
        the accumulated milliseconds this object has spent running since - it was last started.
        -
        -
      • -
      - - - -
        -
      • -

        currentElapsedNanos

        -
        public long currentElapsedNanos()
        -
        Retrieves the accumulated nanoseconds this object has spent running since - it was last started.
        -
        -
        Returns:
        -
        the accumulated nanoseconds this object has spent running since - it was last started.
        -
        -
      • -
      - - - -
        -
      • -

        zero

        -
        public void zero()
        -
        Zeros accumulated running time and restarts this object.
        -
      • -
      - - - -
        -
      • -

        start

        -
        public void start()
        -
        Ensures that this object is in the running state. If this object is not - running, then the call has the effect of setting the startTime - attribute to the current value of System.nanoTime() and setting - the running attribute to true.
        -
      • -
      - - - -
        -
      • -

        stop

        -
        public void stop()
        -
        Ensures that this object is in the stopped state. If this object is - in the running state, then this has the effect of adding to the - total attribute the elapsed time since the last transition - from stopped to running state and sets the running attribute - to false. If this object is not in the running state, this call has no - effect.
        -
      • -
      - - - -
        -
      • -

        mark

        -
        public void mark()
        -
      • -
      - - - -
        -
      • -

        elapsedTimeToMessage

        -
        public java.lang.String elapsedTimeToMessage​(java.lang.String prefix)
        -
        Retrieves prefix + " in " + elapsedTime() + " ms."
        -
        -
        Parameters:
        -
        prefix - The string to use as a prefix
        -
        Returns:
        -
        prefix + " in " + elapsedTime() + " ms."
        -
        -
      • -
      - - - -
        -
      • -

        elapsedNanosToMessage

        -
        public java.lang.String elapsedNanosToMessage​(java.lang.String prefix)
        -
        Retrieves prefix + " in " + elapsedNanos() + " ns."
        -
        -
        Parameters:
        -
        prefix - The string to use as a prefix
        -
        Returns:
        -
        prefix + " in " + elapsedNanos() + " ns."
        -
        -
      • -
      - - - -
        -
      • -

        currentElapsedTimeToMessage

        -
        public java.lang.String currentElapsedTimeToMessage​(java.lang.String prefix)
        -
        Retrieves prefix + " in " + elapsedTime() + " ms."
        -
        -
        Parameters:
        -
        prefix - The string to use as a prefix
        -
        Returns:
        -
        prefix + " in " + elapsedTime() + " ms."
        -
        -
      • -
      - - - -
        -
      • -

        currentElapsedNanosToMessage

        -
        public java.lang.String currentElapsedNanosToMessage​(java.lang.String prefix)
        -
        Retrieves prefix + " in " + elapsedTime() + " ns."
        -
        -
        Parameters:
        -
        prefix - The string to use as a prefix
        -
        Returns:
        -
        prefix + " in " + elapsedTime() + " ns."
        -
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        Retrieves the internal state of this object, as a String. - - The retrieved value is: - -
        -    super.toString() +
        -    "[running=" +
        -    running +
        -    ", startTime=" +
        -    startTime +
        -    ", total=" +
        -    total + "]";
        - 
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        the state of this object, as a String
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringComparator.html deleted file mode 100644 index 44b5f1cc..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringComparator.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - -StringComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class StringComparator

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.StringComparator
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, java.util.Comparator<java.lang.String>
    -
    -
    -
    public class StringComparator
    -extends java.lang.Object
    -implements java.util.Comparator<java.lang.String>, java.io.Serializable
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      StringComparator() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intcompare​(java.lang.String a, - java.lang.String b) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.util.Comparator

        -equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringComparator

        -
        public StringComparator()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        compare

        -
        public int compare​(java.lang.String a,
        -                   java.lang.String b)
        -
        -
        Specified by:
        -
        compare in interface java.util.Comparator<java.lang.String>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringConverter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringConverter.html deleted file mode 100644 index a3a329ef..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringConverter.html +++ /dev/null @@ -1,861 +0,0 @@ - - - - - -StringConverter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class StringConverter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.StringConverter
    • -
    -
  • -
-
-
    -
  • -
    -
    public class StringConverter
    -extends java.lang.Object
    -
    Collection of static methods for converting strings between different - formats and to and from byte arrays.

    - - Includes two methods based on Hypersonic code as indicated.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Thomas Mueller (Hypersonic SQL Group), Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      StringConverter() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.lang.StringbyteArrayToBitString​(byte[] bytes, - int bitCount) -
      Converts a byte array into a bit string
      -
      static java.lang.StringbyteArrayToHexString​(byte[] b) -
      Converts a byte array into a hexadecimal string
      -
      static java.lang.StringbyteArrayToSQLBitString​(byte[] bytes, - int bitCount) -
      Converts a byte array into an SQL binary string
      -
      static java.lang.StringbyteArrayToSQLHexString​(byte[] b) -
      Converts a byte array into an SQL hexadecimal string
      -
      static java.lang.StringbyteArrayToString​(byte[] b, - java.lang.String charset) 
      static intgetUTFSize​(java.lang.String s) 
      static byte[]hexStringToByteArray​(java.lang.String s) -
      Converts a hexadecimal string into a byte array
      -
      static java.lang.StringinputStreamToString​(java.io.InputStream is, - java.lang.String encoding) -
      Using an output stream, returns a String from an InputStream.
      -
      static java.lang.StringreadUTF​(byte[] bytearr, - int offset, - int length) 
      static java.lang.StringreadUTF​(byte[] bytearr, - int offset, - int length, - char[] buf) 
      static org.hsqldb.map.BitMapsqlBitStringToBitMap​(java.lang.String s) -
      Compacts a bit string into a BitMap
      -
      static voidstringToHtmlBytes​(HsqlByteArrayOutputStream b, - java.lang.String s) -
      Converts the string to an HTML representation in the ASCII character set - and appends it to a byte array output stream.
      -
      static voidstringToUnicodeBytes​(HsqlByteArrayOutputStream b, - java.lang.String s, - boolean doubleSingleQuotes) -
      Hsqldb specific encoding used only for log files.
      -
      static java.lang.StringstringToUnicodeEscaped​(java.lang.String s) 
      static intstringToUTFBytes​(java.lang.String str, - HsqlByteArrayOutputStream out) -
      Writes a string to the specified DataOutput using UTF-8 encoding in a - machine-independent manner.
      -
      static byte[]toBinaryUUID​(java.lang.String s) -
      Returns a byte[] representation in UUID form from a UUID string.
      -
      static voidtoJSONString​(java.lang.String s, - java.lang.StringBuilder sb) 
      static java.lang.StringtoQuotedString​(java.lang.String s, - char quoteChar, - boolean extraQuote) -
      Returns the quoted version of the string using the quotechar argument.
      -
      static java.lang.StringtoStringUUID​(byte[] b) -
      Returns a string representation in UUID form from a binary string.
      -
      static java.lang.StringunicodeEscapedToString​(java.lang.String s) 
      static java.lang.StringunicodeStringToString​(java.lang.String s) -
      Hsqldb specific decoding used only for log files.
      -
      static intwriteHexBytes​(byte[] o, - int from, - byte[] b) -
      Converts a byte array into hexadecimal characters which are written as - ASCII to the given output stream.
      -
      static intwriteUUIDHexBytes​(byte[] o, - int from, - byte[] b) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringConverter

        -
        public StringConverter()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        hexStringToByteArray

        -
        public static byte[] hexStringToByteArray​(java.lang.String s)
        -                                   throws java.io.IOException
        -
        Converts a hexadecimal string into a byte array
        -
        -
        Parameters:
        -
        s - hexadecimal string
        -
        Returns:
        -
        byte array for the hex string
        -
        Throws:
        -
        java.io.IOException - on error
        -
        -
      • -
      - - - -
        -
      • -

        sqlBitStringToBitMap

        -
        public static org.hsqldb.map.BitMap sqlBitStringToBitMap​(java.lang.String s)
        -                                                  throws java.io.IOException
        -
        Compacts a bit string into a BitMap
        -
        -
        Parameters:
        -
        s - bit string
        -
        Returns:
        -
        BitMap for the bit string
        -
        Throws:
        -
        java.io.IOException - on error
        -
        -
      • -
      - - - -
        -
      • -

        byteArrayToHexString

        -
        public static java.lang.String byteArrayToHexString​(byte[] b)
        -
        Converts a byte array into a hexadecimal string
        -
        -
        Parameters:
        -
        b - byte array
        -
        Returns:
        -
        hex string
        -
        -
      • -
      - - - -
        -
      • -

        byteArrayToSQLHexString

        -
        public static java.lang.String byteArrayToSQLHexString​(byte[] b)
        -
        Converts a byte array into an SQL hexadecimal string
        -
        -
        Parameters:
        -
        b - byte array
        -
        Returns:
        -
        hex string
        -
        -
      • -
      - - - -
        -
      • -

        byteArrayToBitString

        -
        public static java.lang.String byteArrayToBitString​(byte[] bytes,
        -                                                    int bitCount)
        -
        Converts a byte array into a bit string
        -
        -
        Parameters:
        -
        bytes - byte array
        -
        bitCount - number of bits
        -
        Returns:
        -
        hex string
        -
        -
      • -
      - - - -
        -
      • -

        byteArrayToSQLBitString

        -
        public static java.lang.String byteArrayToSQLBitString​(byte[] bytes,
        -                                                       int bitCount)
        -
        Converts a byte array into an SQL binary string
        -
        -
        Parameters:
        -
        bytes - byte array
        -
        bitCount - number of bits
        -
        Returns:
        -
        hex string
        -
        -
      • -
      - - - -
        -
      • -

        writeHexBytes

        -
        public static int writeHexBytes​(byte[] o,
        -                                int from,
        -                                byte[] b)
        -
        Converts a byte array into hexadecimal characters which are written as - ASCII to the given output stream.
        -
        -
        Parameters:
        -
        o - output array
        -
        from - offset into output array
        -
        b - input array
        -
        Returns:
        -
        written count
        -
        -
      • -
      - - - -
        -
      • -

        byteArrayToString

        -
        public static java.lang.String byteArrayToString​(byte[] b,
        -                                                 java.lang.String charset)
        -
      • -
      - - - -
        -
      • -

        stringToUnicodeBytes

        -
        public static void stringToUnicodeBytes​(HsqlByteArrayOutputStream b,
        -                                        java.lang.String s,
        -                                        boolean doubleSingleQuotes)
        -
        Hsqldb specific encoding used only for log files. The SQL statements that - need to be written to the log file (input) are Java Unicode strings. - input is converted into a 7bit escaped ASCII string (output)with the - following transformations. All characters outside the 0x20-7f range are - converted to a escape sequence and added to output. If a backslash - character is immediately followed by 'u', the backslash character is - converted to escape sequence and added to output. All the remaining - characters in input are added to output without conversion. The escape - sequence is backslash, letter u, xxxx, where xxxx is the hex - representation of the character code. (fredt@users)

        - - Method based on Hypersonic Code

        -
        -
        Parameters:
        -
        b - output stream to wite to
        -
        s - Java string
        -
        doubleSingleQuotes - boolean
        -
        -
      • -
      - - - -
        -
      • -

        unicodeStringToString

        -
        public static java.lang.String unicodeStringToString​(java.lang.String s)
        -
        Hsqldb specific decoding used only for log files. This method converts - the 7 bit escaped ASCII strings in a log file back into Java Unicode - strings. See stringToUnicodeBytes() above.

        - - Method based on Hypersonic Code

        -
        -
        Parameters:
        -
        s - encoded ASCII string in byte array
        -
        Returns:
        -
        Java string
        -
        -
      • -
      - - - -
        -
      • -

        readUTF

        -
        public static java.lang.String readUTF​(byte[] bytearr,
        -                                       int offset,
        -                                       int length)
        -                                throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        readUTF

        -
        public static java.lang.String readUTF​(byte[] bytearr,
        -                                       int offset,
        -                                       int length,
        -                                       char[] buf)
        -                                throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        stringToUTFBytes

        -
        public static int stringToUTFBytes​(java.lang.String str,
        -                                   HsqlByteArrayOutputStream out)
        -
        Writes a string to the specified DataOutput using UTF-8 encoding in a - machine-independent manner. -

        -
        -
        Parameters:
        -
        str - a string to be written.
        -
        out - destination to write to
        -
        Returns:
        -
        The number of bytes written out.
        -
        -
      • -
      - - - -
        -
      • -

        getUTFSize

        -
        public static int getUTFSize​(java.lang.String s)
        -
      • -
      - - - -
        -
      • -

        inputStreamToString

        -
        public static java.lang.String inputStreamToString​(java.io.InputStream is,
        -                                                   java.lang.String encoding)
        -                                            throws java.io.IOException
        -
        Using an output stream, returns a String from an InputStream.
        -
        -
        Parameters:
        -
        is - InputStream to read from
        -
        encoding - character encoding of the string
        -
        Returns:
        -
        a Java string
        -
        Throws:
        -
        java.io.IOException - on error
        -
        -
      • -
      - - - -
        -
      • -

        toQuotedString

        -
        public static java.lang.String toQuotedString​(java.lang.String s,
        -                                              char quoteChar,
        -                                              boolean extraQuote)
        -
        Returns the quoted version of the string using the quotechar argument. - doublequote argument indicates whether each instance of quotechar inside - the string is doubled.

        - - null string argument returns null. If the caller needs the literal - "NULL" it should created it itself

        -
        -
        Parameters:
        -
        s - Java string
        -
        quoteChar - character used for quoting
        -
        extraQuote - true if quoteChar itself should be repeated
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        stringToHtmlBytes

        -
        public static void stringToHtmlBytes​(HsqlByteArrayOutputStream b,
        -                                     java.lang.String s)
        -
        Converts the string to an HTML representation in the ASCII character set - and appends it to a byte array output stream.
        -
        -
        Parameters:
        -
        b - the output byte array output stream
        -
        s - the input string
        -
        -
      • -
      - - - -
        -
      • -

        toStringUUID

        -
        public static java.lang.String toStringUUID​(byte[] b)
        -
        Returns a string representation in UUID form from a binary string. - - UUID string is composed of 8-4-4-4-12 hexadecimal characters.
        -
        -
        Parameters:
        -
        b - the byte array
        -
        Returns:
        -
        UUID string form
        -
        -
      • -
      - - - -
        -
      • -

        writeUUIDHexBytes

        -
        public static int writeUUIDHexBytes​(byte[] o,
        -                                    int from,
        -                                    byte[] b)
        -
      • -
      - - - -
        -
      • -

        toBinaryUUID

        -
        public static byte[] toBinaryUUID​(java.lang.String s)
        -
        Returns a byte[] representation in UUID form from a UUID string.
        -
        -
        Parameters:
        -
        s - the UUID string
        -
        Returns:
        -
        byte array
        -
        -
      • -
      - - - -
        -
      • -

        stringToUnicodeEscaped

        -
        public static java.lang.String stringToUnicodeEscaped​(java.lang.String s)
        -
      • -
      - - - -
        -
      • -

        unicodeEscapedToString

        -
        public static java.lang.String unicodeEscapedToString​(java.lang.String s)
        -                                               throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        toJSONString

        -
        public static void toJSONString​(java.lang.String s,
        -                                java.lang.StringBuilder sb)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringInputStream.html deleted file mode 100644 index 3a6c71d4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringInputStream.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - -StringInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class StringInputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.InputStream
    • -
    • -
        -
      • org.hsqldb.lib.StringInputStream
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.lang.AutoCloseable
    -
    -
    -
    public class StringInputStream
    -extends java.io.InputStream
    -
    Minimal InputStream subclass to fetch bytes form a String.
    -
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      StringInputStream​(java.lang.String s) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intavailable() 
      intread() 
      -
        -
      • - - -

        Methods inherited from class java.io.InputStream

        -close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringInputStream

        -
        public StringInputStream​(java.lang.String s)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        read

        -
        public int read()
        -         throws java.io.IOException
        -
        -
        Specified by:
        -
        read in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        available

        -
        public int available()
        -              throws java.io.IOException
        -
        -
        Overrides:
        -
        available in class java.io.InputStream
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringUtil.html deleted file mode 100644 index e4ce03a7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/StringUtil.html +++ /dev/null @@ -1,668 +0,0 @@ - - - - - -StringUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class StringUtil

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.StringUtil
    • -
    -
  • -
-
-
    -
  • -
    -
    public class StringUtil
    -extends java.lang.Object
    -
    Provides a collection of convenience methods for processing and - creating objects with String value components.
    -
    -
    Since:
    -
    1.7.0
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      StringUtil() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.lang.StringarrayToString​(java.lang.Object array) -
      Builds a bracketed CSV list from the array
      -
      static java.lang.StringgetList​(int[] s, - java.lang.String separator, - java.lang.String quote) -
      Builds a CSV list from the specified int[], separator - String and quote String.
      -
      static java.lang.StringgetList​(long[] s, - java.lang.String separator, - java.lang.String quote) 
      static java.lang.StringgetList​(java.lang.String[][] s, - java.lang.String separator, - java.lang.String quote) -
      Builds a CSV list from the specified String[][], separator string and - quote string.
      -
      static java.lang.StringgetList​(java.lang.String[] s, - java.lang.String separator, - java.lang.String quote) -
      Builds a CSV list from the specified String[], separator string and - quote string.
      -
      static booleanisEmpty​(java.lang.String s) -
      Checks if text is empty (characters <= space)
      -
      static intrightTrimSize​(java.lang.String s) -
      Returns the size of substring that does not contain any trailing spaces
      -
      static intskipSpaces​(java.lang.String s, - int start) -
      Skips any spaces at or after start and returns the index of first - non-space character;
      -
      static java.lang.String[]split​(java.lang.String s, - java.lang.String separator) -
      Splits the string into an array, using the separator.
      -
      static java.lang.StringtoLowerSubset​(java.lang.String source, - char substitute) -
      Returns a string with non alphanumeric chars converted to the - substitute character.
      -
      static java.lang.StringtoPaddedString​(java.lang.String source, - int length, - char pad, - boolean trailing) 
      static java.lang.StringtoPaddedString​(java.lang.String source, - int length, - java.lang.String pad, - boolean trailing) 
      static java.lang.StringtoZeroPaddedString​(long value, - int precision, - int maxSize) -
      If necessary, adds zeros to the beginning of a value so that the total - length matches the given precision, otherwise trims the right digits.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        StringUtil

        -
        public StringUtil()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        toZeroPaddedString

        -
        public static java.lang.String toZeroPaddedString​(long value,
        -                                                  int precision,
        -                                                  int maxSize)
        -
        If necessary, adds zeros to the beginning of a value so that the total - length matches the given precision, otherwise trims the right digits. - Then if maxSize is smaller than precision, trims the right digits to - maxSize. Negative values are treated as positive
        -
        -
        Parameters:
        -
        value - long
        -
        precision - int
        -
        maxSize - int
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        toPaddedString

        -
        public static java.lang.String toPaddedString​(java.lang.String source,
        -                                              int length,
        -                                              char pad,
        -                                              boolean trailing)
        -
      • -
      - - - -
        -
      • -

        toPaddedString

        -
        public static java.lang.String toPaddedString​(java.lang.String source,
        -                                              int length,
        -                                              java.lang.String pad,
        -                                              boolean trailing)
        -
      • -
      - - - -
        -
      • -

        toLowerSubset

        -
        public static java.lang.String toLowerSubset​(java.lang.String source,
        -                                             char substitute)
        -
        Returns a string with non alphanumeric chars converted to the - substitute character. A digit first character is also converted. - By sqlbob@users
        -
        -
        Parameters:
        -
        source - string to convert
        -
        substitute - character to use
        -
        Returns:
        -
        converted string
        -
        -
      • -
      - - - -
        -
      • -

        arrayToString

        -
        public static java.lang.String arrayToString​(java.lang.Object array)
        -
        Builds a bracketed CSV list from the array
        -
        -
        Parameters:
        -
        array - an array of Objects
        -
        Returns:
        -
        string
        -
        -
      • -
      - - - -
        -
      • -

        getList

        -
        public static java.lang.String getList​(java.lang.String[] s,
        -                                       java.lang.String separator,
        -                                       java.lang.String quote)
        -
        Builds a CSV list from the specified String[], separator string and - quote string. - -
          -
        • All arguments are assumed to be non-null. -
        • Separates each list element with the value of the - separator argument. -
        • Prepends and appends each element with the value of the - quote argument. -
        • No attempt is made to escape the quote character sequence if it is - found internal to a list element. -
        -
        -
        Parameters:
        -
        separator - the String to use as the list element separator
        -
        quote - the String with which to quote the list elements
        -
        s - array of String objects
        -
        Returns:
        -
        a CSV list
        -
        -
      • -
      - - - -
        -
      • -

        getList

        -
        public static java.lang.String getList​(int[] s,
        -                                       java.lang.String separator,
        -                                       java.lang.String quote)
        -
        Builds a CSV list from the specified int[], separator - String and quote String. - -
          -
        • All arguments are assumed to be non-null. -
        • Separates each list element with the value of the - separator argument. -
        • Prepends and appends each element with the value of the - quote argument. -
        -
        -
        Parameters:
        -
        s - the array of int values
        -
        separator - the String to use as the separator
        -
        quote - the String with which to quote the list elements
        -
        Returns:
        -
        a CSV list
        -
        -
      • -
      - - - -
        -
      • -

        getList

        -
        public static java.lang.String getList​(long[] s,
        -                                       java.lang.String separator,
        -                                       java.lang.String quote)
        -
      • -
      - - - -
        -
      • -

        getList

        -
        public static java.lang.String getList​(java.lang.String[][] s,
        -                                       java.lang.String separator,
        -                                       java.lang.String quote)
        -
        Builds a CSV list from the specified String[][], separator string and - quote string. - -
          -
        • All arguments are assumed to be non-null. -
        • Uses only the first element in each subarray. -
        • Separates each list element with the value of the - separator argument. -
        • Prepends and appends each element with the value of the - quote argument. -
        • No attempt is made to escape the quote character sequence if it is - found internal to a list element. -
        -
        -
        Parameters:
        -
        separator - the String to use as the list element separator
        -
        quote - the String with which to quote the list elements
        -
        s - the array of String array objects
        -
        Returns:
        -
        a CSV list
        -
        -
      • -
      - - - -
        -
      • -

        isEmpty

        -
        public static boolean isEmpty​(java.lang.String s)
        -
        Checks if text is empty (characters <= space)
        -
        -
        Parameters:
        -
        s - java.lang.String
        -
        Returns:
        -
        boolean true if text is null or empty, false otherwise
        -
        -
      • -
      - - - -
        -
      • -

        rightTrimSize

        -
        public static int rightTrimSize​(java.lang.String s)
        -
        Returns the size of substring that does not contain any trailing spaces
        -
        -
        Parameters:
        -
        s - the string
        -
        Returns:
        -
        trimmed size
        -
        -
      • -
      - - - -
        -
      • -

        skipSpaces

        -
        public static int skipSpaces​(java.lang.String s,
        -                             int start)
        -
        Skips any spaces at or after start and returns the index of first - non-space character;
        -
        -
        Parameters:
        -
        s - the string
        -
        start - index to start
        -
        Returns:
        -
        index of first non-space
        -
        -
      • -
      - - - -
        -
      • -

        split

        -
        public static java.lang.String[] split​(java.lang.String s,
        -                                       java.lang.String separator)
        -
        Splits the string into an array, using the separator. If separator is - not found in the string, the whole string is returned in the array.
        -
        -
        Parameters:
        -
        s - the string
        -
        separator - the separator
        -
        Returns:
        -
        array of strings
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ThreadFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ThreadFactory.html deleted file mode 100644 index d307b452..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ThreadFactory.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - - -ThreadFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface ThreadFactory

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    HsqlTimer
    -
    -
    -
    public interface ThreadFactory
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        newThread

        -
        java.lang.Thread newThread​(java.lang.Runnable r)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ValidatingResourceBundle.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ValidatingResourceBundle.html deleted file mode 100644 index ea947684..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/ValidatingResourceBundle.html +++ /dev/null @@ -1,805 +0,0 @@ - - - - - -ValidatingResourceBundle (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ValidatingResourceBundle

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.ValidatingResourceBundle
    • -
    -
  • -
-
-
    -
  • -
    -
    public class ValidatingResourceBundle
    -extends java.lang.Object
    -
    Purpose of this class is to wrap a RefCapablePropertyResourceBundle to - reliably detect any possible use of a missing property key as soon as - this class is clinitted. - The reason for this is to allow us developers to detect all such errors - before end-users ever use this class. - - See SqltoolRB for an example implementation of this abstract class.
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ValidatingResourceBundle​(java.lang.String baseName, - java.lang.Class<? extends java.lang.Enum<?>> enumType) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.StringgetExpandedString​(java.lang.Enum<?> key) 
      java.lang.StringgetExpandedString​(java.lang.Enum<?> key, - java.lang.String... strings) 
      intgetMissingPosValueBehavior() 
      intgetMissingPropertyBehavior() 
      java.lang.StringgetString​(java.lang.Enum<?> key) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - int i1) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - int i1, - int i2) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - int i1, - int i2, - int i3) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - int i1, - int i2, - java.lang.String s3) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - int i1, - java.lang.String s2) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - int i1, - java.lang.String s2, - int i3) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - int i1, - java.lang.String s2, - java.lang.String s3) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - java.lang.String... strings) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - java.lang.String s1, - int i2) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - java.lang.String s1, - int i2, - int i3) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - java.lang.String s1, - int i2, - java.lang.String s3) 
      java.lang.StringgetString​(java.lang.Enum<?> key, - java.lang.String s1, - java.lang.String s2, - int i3) 
      static java.lang.StringresourceKeyFor​(java.lang.Enum<?> enumKey) 
      voidsetMissingPosValueBehavior​(int missingPosValueBehavior) -
      Set behavior for get*String(String, String[]) method when a positional - index (like %{4}) is used but no subs value was given for that index.
      -
      voidsetMissingPropertyBehavior​(int missingPropertyBehavior) -
      Set behavior for get*String*() method when a referred-to System Property - is not set.
      -
      voidvalidate() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ValidatingResourceBundle

        -
        public ValidatingResourceBundle​(java.lang.String baseName,
        -                                java.lang.Class<? extends java.lang.Enum<?>> enumType)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        resourceKeyFor

        -
        public static java.lang.String resourceKeyFor​(java.lang.Enum<?> enumKey)
        -
      • -
      - - - - - - - - - - - - - - - - - - - -
        -
      • -

        setMissingPropertyBehavior

        -
        public void setMissingPropertyBehavior​(int missingPropertyBehavior)
        -
        Set behavior for get*String*() method when a referred-to System Property - is not set. Set to one of -
          -
        • RefCapablePropertyResourceBundle.THROW_BEHAVIOR -
        • RefCapablePropertyResourceBundle.EMPTYSTRING_BEHAVIOR -
        • RefCapablePropertyResourceBundle.NOOP_BEHAVIOR -
        - The first value is the default.
        -
        -
        Parameters:
        -
        missingPropertyBehavior - int
        -
        -
      • -
      - - - -
        -
      • -

        setMissingPosValueBehavior

        -
        public void setMissingPosValueBehavior​(int missingPosValueBehavior)
        -
        Set behavior for get*String(String, String[]) method when a positional - index (like %{4}) is used but no subs value was given for that index. Set - to one of -
          -
        • RefCapablePropertyResourceBundle.THROW_BEHAVIOR -
        • RefCapablePropertyResourceBundle.EMPTYSTRING_BEHAVIOR -
        • RefCapablePropertyResourceBundle.NOOP_BEHAVIOR -
        - The first value is the default.
        -
        -
        Parameters:
        -
        missingPosValueBehavior - int
        -
        -
      • -
      - - - -
        -
      • -

        getMissingPropertyBehavior

        -
        public int getMissingPropertyBehavior()
        -
      • -
      - - - -
        -
      • -

        getMissingPosValueBehavior

        -
        public int getMissingPosValueBehavior()
        -
      • -
      - - - -
        -
      • -

        validate

        -
        public void validate()
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  int i1)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  int i1,
        -                                  int i2)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  int i1,
        -                                  int i2,
        -                                  int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  int i1,
        -                                  java.lang.String s2)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  java.lang.String s1,
        -                                  int i2)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  int i1,
        -                                  int i2,
        -                                  java.lang.String s3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  int i1,
        -                                  java.lang.String s2,
        -                                  int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  java.lang.String s1,
        -                                  int i2,
        -                                  int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  int i1,
        -                                  java.lang.String s2,
        -                                  java.lang.String s3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  java.lang.String s1,
        -                                  java.lang.String s2,
        -                                  int i3)
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.Enum<?> key,
        -                                  java.lang.String s1,
        -                                  int i2,
        -                                  java.lang.String s3)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/WrapperIterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/WrapperIterator.html deleted file mode 100644 index 3017fd44..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/WrapperIterator.html +++ /dev/null @@ -1,504 +0,0 @@ - - - - - -WrapperIterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class WrapperIterator<E>

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.WrapperIterator<E>
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Iterator<E>
    -
    -
    -
    public class WrapperIterator<E>
    -extends java.lang.Object
    -implements Iterator<E>
    -
    An Iterator that returns the elements of a specified array, or other - iterators etc. The collection of objects returned depends on the - constructor used.

    - - Based on similar Enumerator code by campbell-burnet@users

    -
    -
    Since:
    -
    HSQLDB 1.7.2
    -
    Author:
    -
    fred@users
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      WrapperIterator() -
      Constructor for an empty iterator.
      -
      WrapperIterator​(java.lang.Object element) -
      Constructor for a singleton object iterator
      -
      WrapperIterator​(java.lang.Object[] elements) -
      Constructor for all elements of the specified array.
      -
      WrapperIterator​(java.lang.Object[] elements, - boolean notNull) -
      Constructor for not-null elements of specified array.
      -
      WrapperIterator​(Iterator<E> it1, - Iterator<E> it2) -
      Constructor for a chained iterator that returns the elements of the two - specified iterators.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanhasNext() -
      Tests if this iterator contains more elements.
      -
      Enext() -
      Returns the next element.
      -
      intnextInt() 
      longnextLong() 
      voidremove() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        WrapperIterator

        -
        public WrapperIterator()
        -
        Constructor for an empty iterator.
        -
      • -
      - - - -
        -
      • -

        WrapperIterator

        -
        public WrapperIterator​(java.lang.Object[] elements)
        -
        Constructor for all elements of the specified array.
        -
        -
        Parameters:
        -
        elements - the array of objects to enumerate
        -
        -
      • -
      - - - -
        -
      • -

        WrapperIterator

        -
        public WrapperIterator​(java.lang.Object[] elements,
        -                       boolean notNull)
        -
        Constructor for not-null elements of specified array.
        -
        -
        Parameters:
        -
        elements - the array of objects to iterate
        -
        notNull - boolean
        -
        -
      • -
      - - - -
        -
      • -

        WrapperIterator

        -
        public WrapperIterator​(java.lang.Object element)
        -
        Constructor for a singleton object iterator
        -
        -
        Parameters:
        -
        element - the single object to iterate
        -
        -
      • -
      - - - -
        -
      • -

        WrapperIterator

        -
        public WrapperIterator​(Iterator<E> it1,
        -                       Iterator<E> it2)
        -
        Constructor for a chained iterator that returns the elements of the two - specified iterators.
        -
        -
        Parameters:
        -
        it1 - Iterator
        -
        it2 - Iterator
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        hasNext

        -
        public boolean hasNext()
        -
        Tests if this iterator contains more elements.

        -
        -
        Specified by:
        -
        hasNext in interface Iterator<E>
        -
        Returns:
        -
        true if this iterator contains more elements; - false otherwise.
        -
        -
      • -
      - - - -
        -
      • -

        next

        -
        public E next()
        -
        Returns the next element.
        -
        -
        Specified by:
        -
        next in interface Iterator<E>
        -
        Returns:
        -
        the next element
        -
        Throws:
        -
        java.util.NoSuchElementException - if there is no next element
        -
        -
      • -
      - - - -
        -
      • -

        nextInt

        -
        public int nextInt()
        -
        -
        Specified by:
        -
        nextInt in interface Iterator<E>
        -
        -
      • -
      - - - -
        -
      • -

        nextLong

        -
        public long nextLong()
        -
        -
        Specified by:
        -
        nextLong in interface Iterator<E>
        -
        -
      • -
      - - - -
        -
      • -

        remove

        -
        public void remove()
        -
        -
        Specified by:
        -
        remove in interface Iterator<E>
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AppendableException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AppendableException.html deleted file mode 100644 index ac1d8785..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AppendableException.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.AppendableException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.AppendableException

-
-
No usage of org.hsqldb.lib.AppendableException
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayCounter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayCounter.html deleted file mode 100644 index 3db6b028..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayCounter.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ArrayCounter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ArrayCounter

-
-
No usage of org.hsqldb.lib.ArrayCounter
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayListIdentity.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayListIdentity.html deleted file mode 100644 index 02986545..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayListIdentity.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ArrayListIdentity (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ArrayListIdentity

-
-
No usage of org.hsqldb.lib.ArrayListIdentity
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArraySort.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArraySort.html deleted file mode 100644 index 948b345a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArraySort.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ArraySort (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ArraySort

-
-
No usage of org.hsqldb.lib.ArraySort
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayUtil.html deleted file mode 100644 index 917dcd6a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ArrayUtil.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ArrayUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ArrayUtil

-
-
No usage of org.hsqldb.lib.ArrayUtil
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AsciiInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AsciiInputStream.html deleted file mode 100644 index 3fc62bf1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AsciiInputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.AsciiInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.AsciiInputStream

-
-
No usage of org.hsqldb.lib.AsciiInputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AsciiOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AsciiOutputStream.html deleted file mode 100644 index 49467a14..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/AsciiOutputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.AsciiOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.AsciiOutputStream

-
-
No usage of org.hsqldb.lib.AsciiOutputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/BasicTextJdkLogFormatter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/BasicTextJdkLogFormatter.html deleted file mode 100644 index fe485243..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/BasicTextJdkLogFormatter.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.BasicTextJdkLogFormatter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.BasicTextJdkLogFormatter

-
-
No usage of org.hsqldb.lib.BasicTextJdkLogFormatter
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CharArrayWriter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CharArrayWriter.html deleted file mode 100644 index b0300dcc..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CharArrayWriter.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.CharArrayWriter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.CharArrayWriter

-
-
No usage of org.hsqldb.lib.CharArrayWriter
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ClosableByteArrayOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ClosableByteArrayOutputStream.html deleted file mode 100644 index cc6e2a16..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ClosableByteArrayOutputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ClosableByteArrayOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ClosableByteArrayOutputStream

-
-
No usage of org.hsqldb.lib.ClosableByteArrayOutputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ClosableCharArrayWriter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ClosableCharArrayWriter.html deleted file mode 100644 index 3b2513d0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ClosableCharArrayWriter.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ClosableCharArrayWriter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ClosableCharArrayWriter

-
-
No usage of org.hsqldb.lib.ClosableCharArrayWriter
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Collection.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Collection.html deleted file mode 100644 index bda9bd59..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Collection.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.Collection (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.Collection

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CountUpDownLatch.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CountUpDownLatch.html deleted file mode 100644 index f22d7809..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CountUpDownLatch.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.CountUpDownLatch (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.CountUpDownLatch

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CountdownInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CountdownInputStream.html deleted file mode 100644 index 247cfb88..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/CountdownInputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.CountdownInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.CountdownInputStream

-
-
No usage of org.hsqldb.lib.CountdownInputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DataOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DataOutputStream.html deleted file mode 100644 index 4fef527a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DataOutputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.DataOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.DataOutputStream

-
-
No usage of org.hsqldb.lib.DataOutputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DoubleIntIndex.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DoubleIntIndex.html deleted file mode 100644 index 3c255f5e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DoubleIntIndex.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.DoubleIntIndex (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.DoubleIntIndex

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DoubleLongIndex.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DoubleLongIndex.html deleted file mode 100644 index edfff4f7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/DoubleLongIndex.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.DoubleLongIndex (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.DoubleLongIndex

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/EventLogInterface.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/EventLogInterface.html deleted file mode 100644 index 237a4f04..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/EventLogInterface.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.EventLogInterface (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.EventLogInterface

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccess.FileSync.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccess.FileSync.html deleted file mode 100644 index 4d4021d4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccess.FileSync.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.FileAccess.FileSync (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.FileAccess.FileSync

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccess.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccess.html deleted file mode 100644 index 675b6f30..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccess.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.FileAccess (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.FileAccess

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use FileAccess 
    PackageDescription
    org.hsqldb.lib -
    Contains shared classes used by other HyperSQL classes.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of FileAccess in org.hsqldb.lib

      - - - - - - - - - - - - - - - - - - - -
      Classes in org.hsqldb.lib that implement FileAccess 
      Modifier and TypeClassDescription
      class FileAccessRes 
      class FileUtil -
      A collection of file management methods.
      -
      - - - - - - - - - - - - - - -
      Methods in org.hsqldb.lib that return FileAccess 
      Modifier and TypeMethodDescription
      static FileAccessFileUtil.getFileAccess​(boolean isResource) 
      - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods in org.hsqldb.lib with parameters of type FileAccess 
      Modifier and TypeMethodDescription
      static voidFileArchiver.archive​(java.lang.String infilename, - java.lang.String outfilename, - FileAccess storage, - int compressionType) 
      static voidFileArchiver.copyFile​(java.lang.String infilename, - java.lang.String outfilename, - FileAccess storage) 
      static voidFileArchiver.unarchive​(java.lang.String infilename, - java.lang.String outfilename, - FileAccess storage, - int compressionType) 
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccessRes.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccessRes.html deleted file mode 100644 index 33b0db76..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileAccessRes.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.FileAccessRes (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.FileAccessRes

-
-
No usage of org.hsqldb.lib.FileAccessRes
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileArchiver.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileArchiver.html deleted file mode 100644 index d1d06ed5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileArchiver.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.FileArchiver (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.FileArchiver

-
-
No usage of org.hsqldb.lib.FileArchiver
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileUtil.FileSync.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileUtil.FileSync.html deleted file mode 100644 index 1aa69593..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileUtil.FileSync.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.FileUtil.FileSync (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.FileUtil.FileSync

-
-
No usage of org.hsqldb.lib.FileUtil.FileSync
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileUtil.html deleted file mode 100644 index 6dc8cbaa..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FileUtil.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.FileUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.FileUtil

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FilteredIterator.Filter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FilteredIterator.Filter.html deleted file mode 100644 index cf944ed4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FilteredIterator.Filter.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.FilteredIterator.Filter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.FilteredIterator.Filter

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FilteredIterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FilteredIterator.html deleted file mode 100644 index e3c7a188..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FilteredIterator.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.FilteredIterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.FilteredIterator

-
-
No usage of org.hsqldb.lib.FilteredIterator
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FrameworkLogger.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FrameworkLogger.html deleted file mode 100644 index d399918f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/FrameworkLogger.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.FrameworkLogger (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.FrameworkLogger

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use FrameworkLogger 
    PackageDescription
    org.hsqldb.lib -
    Contains shared classes used by other HyperSQL classes.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of FrameworkLogger in org.hsqldb.lib

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods in org.hsqldb.lib that return FrameworkLogger 
      Modifier and TypeMethodDescription
      static FrameworkLoggerFrameworkLogger.getLog​(java.lang.Class c) -
      User's entry-point into this logging system.
      -
      static FrameworkLoggerFrameworkLogger.getLog​(java.lang.Class c, - java.lang.String contextId) -
      This method just defers to the getLog(Class) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
      -
      static FrameworkLoggerFrameworkLogger.getLog​(java.lang.String s) -
      Alternative entry-point into this logging system, for cases where you - want to share a single logger instance among multiple classes, or you - want to use multiple logger instances from a single class.
      -
      static FrameworkLoggerFrameworkLogger.getLog​(java.lang.String baseId, - java.lang.String contextId) -
      This method just defers to the getLog(String) method unless default (no - local configuration) JDK logging is being used; In that case, this method - assures that the returned logger has an associated FileHander using the - supplied String identifier.
      -
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HashMap.html deleted file mode 100644 index 077eba48..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HashMap.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HashMap

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use HashMap 
    PackageDescription
    org.hsqldb.lib -
    Contains shared classes used by other HyperSQL classes.
    -
    -
  • -
  • - -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HashSet.html deleted file mode 100644 index 84d80d01..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HashSet.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HashSet

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use HashSet 
    PackageDescription
    org.hsqldb.lib -
    Contains shared classes used by other HyperSQL classes.
    -
    -
  • -
  • - -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlArrayHeap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlArrayHeap.html deleted file mode 100644 index efb6d699..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlArrayHeap.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlArrayHeap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlArrayHeap

-
-
No usage of org.hsqldb.lib.HsqlArrayHeap
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlArrayList.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlArrayList.html deleted file mode 100644 index 6d905c3d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlArrayList.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlArrayList (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlArrayList

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlByteArrayInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlByteArrayInputStream.html deleted file mode 100644 index 9761d955..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlByteArrayInputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlByteArrayInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlByteArrayInputStream

-
-
No usage of org.hsqldb.lib.HsqlByteArrayInputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlByteArrayOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlByteArrayOutputStream.html deleted file mode 100644 index c0372229..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlByteArrayOutputStream.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlByteArrayOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlByteArrayOutputStream

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlConsoleHandler.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlConsoleHandler.html deleted file mode 100644 index 70929a45..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlConsoleHandler.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlConsoleHandler (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlConsoleHandler

-
-
No usage of org.hsqldb.lib.HsqlConsoleHandler
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlDeque.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlDeque.html deleted file mode 100644 index 672ed2a5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlDeque.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlDeque (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlDeque

-
-
No usage of org.hsqldb.lib.HsqlDeque
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlHeap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlHeap.html deleted file mode 100644 index 041f8853..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlHeap.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.HsqlHeap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.HsqlHeap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlTaskQueue.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlTaskQueue.html deleted file mode 100644 index 23c8da04..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlTaskQueue.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlTaskQueue (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlTaskQueue

-
-
No usage of org.hsqldb.lib.HsqlTaskQueue
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlTimer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlTimer.html deleted file mode 100644 index 99322934..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/HsqlTimer.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.HsqlTimer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.HsqlTimer

-
-
No usage of org.hsqldb.lib.HsqlTimer
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InOutUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InOutUtil.html deleted file mode 100644 index eaf477ca..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InOutUtil.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.InOutUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.InOutUtil

-
-
No usage of org.hsqldb.lib.InOutUtil
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InputStreamInterface.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InputStreamInterface.html deleted file mode 100644 index d2a51fbf..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InputStreamInterface.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.InputStreamInterface (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.InputStreamInterface

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InputStreamWrapper.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InputStreamWrapper.html deleted file mode 100644 index 0b8fe5fe..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/InputStreamWrapper.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.InputStreamWrapper (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.InputStreamWrapper

-
-
No usage of org.hsqldb.lib.InputStreamWrapper
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntHashSet.html deleted file mode 100644 index 382aa412..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntHashSet.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.IntHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.IntHashSet

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntIndex.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntIndex.html deleted file mode 100644 index 0b040530..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntIndex.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.IntIndex (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.IntIndex

-
-
No usage of org.hsqldb.lib.IntIndex
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyHashMap.html deleted file mode 100644 index 0f33f75a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyHashMap.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.IntKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.IntKeyHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyHashMapConcurrent.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyHashMapConcurrent.html deleted file mode 100644 index 4a323cc7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyHashMapConcurrent.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.IntKeyHashMapConcurrent (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.IntKeyHashMapConcurrent

-
-
No usage of org.hsqldb.lib.IntKeyHashMapConcurrent
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyIntValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyIntValueHashMap.html deleted file mode 100644 index 14f799cd..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyIntValueHashMap.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.IntKeyIntValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.IntKeyIntValueHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyLongValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyLongValueHashMap.html deleted file mode 100644 index 04f7201b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntKeyLongValueHashMap.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.IntKeyLongValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.IntKeyLongValueHashMap

-
-
No usage of org.hsqldb.lib.IntKeyLongValueHashMap
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntLookup.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntLookup.html deleted file mode 100644 index 54ba48d7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntLookup.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.IntLookup (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.IntLookup

-
-
No usage of org.hsqldb.lib.IntLookup
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntValueHashMap.html deleted file mode 100644 index 979f8de5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/IntValueHashMap.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.IntValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.IntValueHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Iterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Iterator.html deleted file mode 100644 index 8ba77d07..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Iterator.html +++ /dev/null @@ -1,281 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.Iterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.Iterator

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/KMPSearchAlgorithm.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/KMPSearchAlgorithm.html deleted file mode 100644 index 442b6f2a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/KMPSearchAlgorithm.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.KMPSearchAlgorithm (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.KMPSearchAlgorithm

-
-
No usage of org.hsqldb.lib.KMPSearchAlgorithm
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LineGroupReader.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LineGroupReader.html deleted file mode 100644 index 423f1faa..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LineGroupReader.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.LineGroupReader (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.LineGroupReader

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LineReader.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LineReader.html deleted file mode 100644 index 578323ba..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LineReader.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.LineReader (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.LineReader

-
-
No usage of org.hsqldb.lib.LineReader
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/List.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/List.html deleted file mode 100644 index 978a2e3c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/List.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.List (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.List

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use List 
    PackageDescription
    org.hsqldb.lib -
    Contains shared classes used by other HyperSQL classes.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of List in org.hsqldb.lib

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Classes in org.hsqldb.lib that implement List 
      Modifier and TypeClassDescription
      class ArrayListIdentity<E> -
      Extends HsqlArrayList.
      -
      class HsqlArrayList<E> -
      Intended as an asynchronous alternative to Vector.
      -
      class HsqlDeque<E> -
      A List<E> that also implements Deque<E> and Queue<E> - and methods for usage as stack.
      -
      class OrderedHashSet<E> -
      A list which is also a Set which maintains the inserted order of elements and - allows access by index.
      -
      - - - - - - - - - - - - - - -
      Methods in org.hsqldb.lib that return List 
      Modifier and TypeMethodDescription
      List<E>HsqlDeque.subList​(int fromIndex, - int toIndex) 
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongDeque.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongDeque.html deleted file mode 100644 index d5f9993d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongDeque.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.LongDeque (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.LongDeque

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyHashMap.html deleted file mode 100644 index ba1c09b0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyHashMap.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.LongKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.LongKeyHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyIntValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyIntValueHashMap.html deleted file mode 100644 index c220927d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyIntValueHashMap.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.LongKeyIntValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.LongKeyIntValueHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyLongValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyLongValueHashMap.html deleted file mode 100644 index a1cb4790..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongKeyLongValueHashMap.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.LongKeyLongValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.LongKeyLongValueHashMap

-
-
No usage of org.hsqldb.lib.LongKeyLongValueHashMap
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongLookup.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongLookup.html deleted file mode 100644 index 3428c904..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongLookup.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.LongLookup (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.LongLookup

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongValueHashMap.html deleted file mode 100644 index 67852652..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/LongValueHashMap.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.LongValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.LongValueHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Map.Entry.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Map.Entry.html deleted file mode 100644 index b63d19bf..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Map.Entry.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.Map.Entry (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.Map.Entry

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Map.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Map.html deleted file mode 100644 index 0f96fd02..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Map.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.Map (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.Map

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use Map 
    PackageDescription
    org.hsqldb.lib -
    Contains shared classes used by other HyperSQL classes.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of Map in org.hsqldb.lib

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Classes in org.hsqldb.lib that implement Map 
      Modifier and TypeClassDescription
      class HashMap<K,​V> -
      This class does not store null keys.
      -
      class IntKeyHashMap<V> -
      A Map of int primitives to Object values.
      -
      class IntKeyHashMapConcurrent<V> -
      A Map of int primitives to Object values, suitable for thread-safe access.
      -
      class IntKeyIntValueHashMap -
      A Map of int primitive keys to int primitive values.
      -
      class IntKeyLongValueHashMap -
      A Map of int primitive keys to long primitive values.
      -
      class LongKeyHashMap<V> -
      A Map of long primitives to Object values.
      -
      class LongKeyIntValueHashMap -
      A Map of long primitives to int primitives.
      -
      class LongKeyLongValueHashMap -
      A Map of long primitives to to long primitive.
      -
      class MultiValueHashMap<K,​V> -
      A Map of Object keys to Object values which stores multiple values per - key.
      -
      class OrderedHashMap<K,​V> -
      A Map which maintains the insertion order of the key/value pairs and allows - access by index.
      -
      class OrderedIntKeyHashMap<V> -
      A Map of int primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index.
      -
      class OrderedLongKeyHashMap<V> -
      A Map of long primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index.
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods in org.hsqldb.lib with parameters of type Map 
      Modifier and TypeMethodDescription
      voidHashMap.putAll​(Map<? extends K,​? extends V> m) 
      voidIntKeyHashMap.putAll​(Map<? extends java.lang.Integer,​? extends V> other) 
      voidIntKeyHashMapConcurrent.putAll​(Map<? extends java.lang.Integer,​? extends V> other) 
      voidIntKeyIntValueHashMap.putAll​(Map<? extends java.lang.Integer,​? extends java.lang.Integer> other) 
      voidIntKeyLongValueHashMap.putAll​(Map<? extends java.lang.Integer,​? extends java.lang.Long> other) 
      voidIntValueHashMap.putAll​(Map<? extends K,​? extends java.lang.Integer> other) 
      voidLongKeyHashMap.putAll​(Map<? extends java.lang.Long,​? extends V> other) 
      voidLongKeyIntValueHashMap.putAll​(Map<? extends java.lang.Long,​? extends java.lang.Integer> other) 
      voidLongKeyLongValueHashMap.putAll​(Map<? extends java.lang.Long,​? extends java.lang.Long> other) 
      voidMap.putAll​(Map<? extends K,​? extends V> m) 
      voidMultiValueHashMap.putAll​(Map<? extends K,​? extends V> m) 
      voidOrderedLongKeyHashMap.putAll​(Map<? extends java.lang.Long,​? extends V> other) 
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/MapEntry.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/MapEntry.html deleted file mode 100644 index 1c31518b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/MapEntry.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.MapEntry (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.MapEntry

-
-
No usage of org.hsqldb.lib.MapEntry
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/MultiValueHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/MultiValueHashMap.html deleted file mode 100644 index 73c5c5f1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/MultiValueHashMap.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.MultiValueHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.MultiValueHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Notified.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Notified.html deleted file mode 100644 index 806c2086..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Notified.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.Notified (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.Notified

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use Notified 
    PackageDescription
    org.hsqldb.server -
    Contains the HyperSQL network listener classes.
    -
    -
  • -
  • - -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.DefaultComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.DefaultComparator.html deleted file mode 100644 index fed58acd..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.DefaultComparator.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ObjectComparator.DefaultComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ObjectComparator.DefaultComparator

-
-
No usage of org.hsqldb.lib.ObjectComparator.DefaultComparator
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.IdentityComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.IdentityComparator.html deleted file mode 100644 index fdc738c2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.IdentityComparator.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ObjectComparator.IdentityComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ObjectComparator.IdentityComparator

-
-
No usage of org.hsqldb.lib.ObjectComparator.IdentityComparator
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.html deleted file mode 100644 index 876f9289..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ObjectComparator.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.ObjectComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.ObjectComparator

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedHashMap.html deleted file mode 100644 index d0c8cd98..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedHashMap.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.OrderedHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.OrderedHashMap

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedHashSet.html deleted file mode 100644 index 5842f0bb..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedHashSet.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.OrderedHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.OrderedHashSet

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedIntHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedIntHashSet.html deleted file mode 100644 index be0b870b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedIntHashSet.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.OrderedIntHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.OrderedIntHashSet

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedIntKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedIntKeyHashMap.html deleted file mode 100644 index a1824df4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedIntKeyHashMap.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.OrderedIntKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.OrderedIntKeyHashMap

-
-
No usage of org.hsqldb.lib.OrderedIntKeyHashMap
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedLongHashSet.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedLongHashSet.html deleted file mode 100644 index 8f0c9957..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedLongHashSet.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.OrderedLongHashSet (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.OrderedLongHashSet

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedLongKeyHashMap.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedLongKeyHashMap.html deleted file mode 100644 index 1d1b7ec8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/OrderedLongKeyHashMap.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.OrderedLongKeyHashMap (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.OrderedLongKeyHashMap

-
-
No usage of org.hsqldb.lib.OrderedLongKeyHashMap
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/PrimitiveIterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/PrimitiveIterator.html deleted file mode 100644 index c36d8471..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/PrimitiveIterator.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.PrimitiveIterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.PrimitiveIterator

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReadWriteLockDummy.LockDummy.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReadWriteLockDummy.LockDummy.html deleted file mode 100644 index 97ddbbc2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReadWriteLockDummy.LockDummy.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ReadWriteLockDummy.LockDummy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ReadWriteLockDummy.LockDummy

-
-
No usage of org.hsqldb.lib.ReadWriteLockDummy.LockDummy
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReadWriteLockDummy.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReadWriteLockDummy.html deleted file mode 100644 index e7bf85c8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReadWriteLockDummy.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ReadWriteLockDummy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ReadWriteLockDummy

-
-
No usage of org.hsqldb.lib.ReadWriteLockDummy
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReaderInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReaderInputStream.html deleted file mode 100644 index a771d72f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ReaderInputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ReaderInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ReaderInputStream

-
-
No usage of org.hsqldb.lib.ReaderInputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/RefCapablePropertyResourceBundle.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/RefCapablePropertyResourceBundle.html deleted file mode 100644 index ddfc917a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/RefCapablePropertyResourceBundle.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.RefCapablePropertyResourceBundle (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.RefCapablePropertyResourceBundle

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/RefCapableRBInterface.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/RefCapableRBInterface.html deleted file mode 100644 index 6ce30970..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/RefCapableRBInterface.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.RefCapableRBInterface (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.RefCapableRBInterface

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ScannerSearchAlgorithm.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ScannerSearchAlgorithm.html deleted file mode 100644 index 3296bfc6..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ScannerSearchAlgorithm.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ScannerSearchAlgorithm (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ScannerSearchAlgorithm

-
-
No usage of org.hsqldb.lib.ScannerSearchAlgorithm
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Set.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Set.html deleted file mode 100644 index 0776d21d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/Set.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.Set (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.Set

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/SimpleLog.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/SimpleLog.html deleted file mode 100644 index 76187d69..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/SimpleLog.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.SimpleLog (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.SimpleLog

-
-
No usage of org.hsqldb.lib.SimpleLog
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StopWatch.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StopWatch.html deleted file mode 100644 index f85a2641..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StopWatch.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.StopWatch (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.StopWatch

-
-
No usage of org.hsqldb.lib.StopWatch
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringComparator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringComparator.html deleted file mode 100644 index d21b9049..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringComparator.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.StringComparator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.StringComparator

-
-
No usage of org.hsqldb.lib.StringComparator
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringConverter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringConverter.html deleted file mode 100644 index 0736a4d1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringConverter.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.StringConverter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.StringConverter

-
-
No usage of org.hsqldb.lib.StringConverter
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringInputStream.html deleted file mode 100644 index ad03a319..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringInputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.StringInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.StringInputStream

-
-
No usage of org.hsqldb.lib.StringInputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringUtil.html deleted file mode 100644 index 21b54217..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/StringUtil.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.StringUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.StringUtil

-
-
No usage of org.hsqldb.lib.StringUtil
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ThreadFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ThreadFactory.html deleted file mode 100644 index ec1a953a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ThreadFactory.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.ThreadFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.ThreadFactory

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ValidatingResourceBundle.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ValidatingResourceBundle.html deleted file mode 100644 index 3ac20996..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/ValidatingResourceBundle.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.ValidatingResourceBundle (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.ValidatingResourceBundle

-
-
No usage of org.hsqldb.lib.ValidatingResourceBundle
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/WrapperIterator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/WrapperIterator.html deleted file mode 100644 index bac0e3bf..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/class-use/WrapperIterator.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.WrapperIterator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.WrapperIterator

-
-
No usage of org.hsqldb.lib.WrapperIterator
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-summary.html deleted file mode 100644 index 19df2499..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-summary.html +++ /dev/null @@ -1,743 +0,0 @@ - - - - - -org.hsqldb.lib (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.lib

-
-
-
- - -
Contains shared classes used by other HyperSQL classes.
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    Collection<E> -
    A basic collection of values.
    -
    EventLogInterface 
    FileAccess -
    Interface for abstraction of file access.
    -
    FileAccess.FileSync 
    FilteredIterator.Filter<E> 
    HsqlHeap<E> -
    Provides the HyperSQL interface for Heap ADT implementations.
    -
    InputStreamInterface 
    IntLookup -
    Interface for int to int lookup.
    -
    Iterator<E> -
    Interface for HyperSQL iterators.
    -
    List<E> -
    Interface for List collections.
    -
    LongLookup -
    Interface for long to long lookup.
    -
    Map<K,​V> -
    Interface for collections of mapped key - value pairs.
    -
    Map.Entry<K,​V> -
    Interface for a key - value pair.
    -
    Notified 
    ObjectComparator<T> -
    Interface for equality comparison.
    -
    PrimitiveIterator<E> -
    Marker interface for iterators supporting nextInt or nextLong methods.
    -
    RefCapableRBInterface 
    Set<E> -
    Marker interface for a Collection that is a Set of values.
    -
    ThreadFactory 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    ArrayCounter -
    Collection of routines for counting the distribution of the values - in an int[] array.
    -
    ArrayListIdentity<E> -
    Extends HsqlArrayList.
    -
    ArraySort -
    FastQSorts the [l,r] partition (inclusive) of the specified array of - Rows, using the comparator.
    -
    ArrayUtil -
    Collection of static methods for operations on arrays
    -
    AsciiInputStream -
    An input stream that reads US-ASCII values from a Reader, in compliance - with the Java US_ASCII Charset encoder, including - - utf-16-surrogate-pairs.
    -
    AsciiOutputStream -
    An OutputStream that writes 7-bit US-ASCII values to a Writer, in compliance - with the Java US_ASCII Charset decoder.
    -
    BasicTextJdkLogFormatter -
    An implementation of java.util.logging.Formatter very close to - SimpleFormatter.
    -
    CharArrayWriter -
    A writer for char strings.
    -
    ClosableByteArrayOutputStream -
    Provides true Closable semantics ordinarily missing in a - ByteArrayOutputStream.
    -
    ClosableCharArrayWriter -
    Provides Closable semantics ordinarily missing in a - CharArrayWriter.
    -
    CountdownInputStream -
    Counts down from a specified value the number of bytes actually read - from the wrapped InputStream.
    -
    CountUpDownLatch -
    A variation on CountDownLatch to allow counting up as well - as down.
    -
    DataOutputStream -
    A wrapper for OutputStream
    -
    DoubleIntIndex -
    Maintains an ordered integer->integer lookup table, consisting of two - columns, one for keys, the other for values.
    -
    DoubleLongIndex -
    Maintains an ordered long->long lookup table, consisting of two - columns, one for keys, the other for values.
    -
    FileAccessRes 
    FileArchiver -
    Creates a direct, compressed or decompressed copy of a file.
    -
    FileUtil -
    A collection of file management methods.
    -
    FileUtil.FileSync 
    FilteredIterator<E> -
    An iterator with an added filter.
    -
    FrameworkLogger -
    A logging framework wrapper that supports java.util.logging and log4j.
    -
    HashMap<K,​V> -
    This class does not store null keys.
    -
    HashSet<E> -
    This class does not store null keys.
    -
    HsqlArrayHeap<E> -
    An HsqlHeap implementation backed by an array of objects and an - ObjectComparator.
    -
    HsqlArrayList<E> -
    Intended as an asynchronous alternative to Vector.
    -
    HsqlByteArrayInputStream -
    This class is a replacement for both java.io.ByteArrayInputStream - (without synchronization) and java.io.DataInputStream
    -
    HsqlByteArrayOutputStream -
    This class is a replacement for both java.io.ByteArrayOuputStream - (without synchronization) and java.io.DataOutputStream
    -
    HsqlConsoleHandler 
    HsqlDeque<E> -
    A List<E> that also implements Deque<E> and Queue<E> - and methods for usage as stack.
    -
    HsqlTaskQueue -
    Provides very simple queued execution of Runnable objects in a background - thread.
    -
    HsqlTimer -
    Facility to schedule tasks for future execution in a background thread.
    -
    InOutUtil -
    Input / Output utility
    -
    InputStreamWrapper 
    IntHashSet -
    A set of int primitives.
    -
    IntIndex -
    Maintains an ordered integer index.
    -
    IntKeyHashMap<V> -
    A Map of int primitives to Object values.
    -
    IntKeyHashMapConcurrent<V> -
    A Map of int primitives to Object values, suitable for thread-safe access.
    -
    IntKeyIntValueHashMap -
    A Map of int primitive keys to int primitive values.
    -
    IntKeyLongValueHashMap -
    A Map of int primitive keys to long primitive values.
    -
    IntValueHashMap<K> -
    A Map of Object keys to int primitive values.
    -
    KMPSearchAlgorithm -
    Implements the Knuth-Morris-Pratt string search algorithm for searching - streams or arrays of octets or characters.
    -
    LineGroupReader -
    Uses a LineNumberReader and returns multiple consecutive lines which conform - to the specified group demarcation characteristics.
    -
    LineReader -
    A converter for InputStream to return String objects using the given - charset for conversion.
    -
    LongDeque -
    A deque of long values.
    -
    LongKeyHashMap<V> -
    A Map of long primitives to Object values.
    -
    LongKeyIntValueHashMap -
    A Map of long primitives to int primitives.
    -
    LongKeyLongValueHashMap -
    A Map of long primitives to to long primitive.
    -
    LongValueHashMap<K> -
    A Map of Object keys to long primitives.
    -
    MapEntry<K,​V> -
    A key - value pair.
    -
    MultiValueHashMap<K,​V> -
    A Map of Object keys to Object values which stores multiple values per - key.
    -
    ObjectComparator.DefaultComparator -
    Comparator that uses the equals and hash code methods of Objects.
    -
    ObjectComparator.IdentityComparator -
    Comparator that uses identity for Object equality.
    -
    OrderedHashMap<K,​V> -
    A Map which maintains the insertion order of the key/value pairs and allows - access by index.
    -
    OrderedHashSet<E> -
    A list which is also a Set which maintains the inserted order of elements and - allows access by index.
    -
    OrderedIntHashSet -
    A list which is also a set of int primitives which maintains the insertion - order of the elements and allows access by index.
    -
    OrderedIntKeyHashMap<V> -
    A Map of int primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index.
    -
    OrderedLongHashSet -
    A list which is also a set of long primitives which maintains the insertion - order of the elements and allows access by index.
    -
    OrderedLongKeyHashMap<V> -
    A Map of long primitives to Object values which maintains the insertion order - of the key/value pairs and allows access by index.
    -
    ReaderInputStream -
    This class is an part implementation of DataInput.
    -
    ReadWriteLockDummy 
    ReadWriteLockDummy.LockDummy 
    RefCapablePropertyResourceBundle -
    Just like PropertyResourceBundle, except keys mapped to nothing in the - properties file will load the final String value from a text file.
    -
    ScannerSearchAlgorithm -
    Provides a string search facility using a Scanner.
    -
    SimpleLog -
    Simple log for recording abnormal events in persistence
    -
    StopWatch -
    Provides the programatic analog of a physical stop watch.
    -
    StringComparator 
    StringConverter -
    Collection of static methods for converting strings between different - formats and to and from byte arrays.
    -
    StringInputStream -
    Minimal InputStream subclass to fetch bytes form a String.
    -
    StringUtil -
    Provides a collection of convenience methods for processing and - creating objects with String value components.
    -
    ValidatingResourceBundle -
    Purpose of this class is to wrap a RefCapablePropertyResourceBundle to - reliably detect any possible use of a missing property key as soon as - this class is clinitted.
    -
    WrapperIterator<E> -
    An Iterator that returns the elements of a specified array, or other - iterators etc.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    AppendableException -
    Allows additional messages to be appended.
    -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-tree.html deleted file mode 100644 index 4e4fc0a1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-tree.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - -org.hsqldb.lib Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.lib

-Package Hierarchies: - -
-
-
-

Class Hierarchy

- -
-
-

Interface Hierarchy

- -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-use.html deleted file mode 100644 index 6721e8d2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/package-use.html +++ /dev/null @@ -1,473 +0,0 @@ - - - - - -Uses of Package org.hsqldb.lib (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.lib

-
-
-
    -
  • - - - - - - - - - - - - - - - - - - - - -
    Packages that use org.hsqldb.lib 
    PackageDescription
    org.hsqldb.lib -
    Contains shared classes used by other HyperSQL classes.
    -
    org.hsqldb.lib.tar -
    Contains the DbBackupMain class, for offline backing up HyperSQL databases.
    -
    org.hsqldb.server -
    Contains the HyperSQL network listener classes.
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Classes in org.hsqldb.lib used by org.hsqldb.lib 
    ClassDescription
    Collection -
    A basic collection of values.
    -
    CountUpDownLatch -
    A variation on CountDownLatch to allow counting up as well - as down.
    -
    DoubleIntIndex -
    Maintains an ordered integer->integer lookup table, consisting of two - columns, one for keys, the other for values.
    -
    DoubleLongIndex -
    Maintains an ordered long->long lookup table, consisting of two - columns, one for keys, the other for values.
    -
    EventLogInterface 
    FileAccess -
    Interface for abstraction of file access.
    -
    FileAccess.FileSync 
    FileUtil -
    A collection of file management methods.
    -
    FilteredIterator.Filter 
    FrameworkLogger -
    A logging framework wrapper that supports java.util.logging and log4j.
    -
    HashMap -
    This class does not store null keys.
    -
    HashSet -
    This class does not store null keys.
    -
    HsqlArrayList -
    Intended as an asynchronous alternative to Vector.
    -
    HsqlByteArrayOutputStream -
    This class is a replacement for both java.io.ByteArrayOuputStream - (without synchronization) and java.io.DataOutputStream
    -
    HsqlHeap -
    Provides the HyperSQL interface for Heap ADT implementations.
    -
    InputStreamInterface 
    IntHashSet -
    A set of int primitives.
    -
    IntKeyHashMap -
    A Map of int primitives to Object values.
    -
    IntKeyIntValueHashMap -
    A Map of int primitive keys to int primitive values.
    -
    IntValueHashMap -
    A Map of Object keys to int primitive values.
    -
    Iterator -
    Interface for HyperSQL iterators.
    -
    LineGroupReader -
    Uses a LineNumberReader and returns multiple consecutive lines which conform - to the specified group demarcation characteristics.
    -
    List -
    Interface for List collections.
    -
    LongDeque -
    A deque of long values.
    -
    LongKeyHashMap -
    A Map of long primitives to Object values.
    -
    LongKeyIntValueHashMap -
    A Map of long primitives to int primitives.
    -
    LongLookup -
    Interface for long to long lookup.
    -
    LongValueHashMap -
    A Map of Object keys to long primitives.
    -
    Map -
    Interface for collections of mapped key - value pairs.
    -
    Map.Entry -
    Interface for a key - value pair.
    -
    MultiValueHashMap -
    A Map of Object keys to Object values which stores multiple values per - key.
    -
    ObjectComparator -
    Interface for equality comparison.
    -
    OrderedHashMap -
    A Map which maintains the insertion order of the key/value pairs and allows - access by index.
    -
    OrderedHashSet -
    A list which is also a Set which maintains the inserted order of elements and - allows access by index.
    -
    OrderedIntHashSet -
    A list which is also a set of int primitives which maintains the insertion - order of the elements and allows access by index.
    -
    OrderedLongHashSet -
    A list which is also a set of long primitives which maintains the insertion - order of the elements and allows access by index.
    -
    PrimitiveIterator -
    Marker interface for iterators supporting nextInt or nextLong methods.
    -
    RefCapablePropertyResourceBundle -
    Just like PropertyResourceBundle, except keys mapped to nothing in the - properties file will load the final String value from a text file.
    -
    Set -
    Marker interface for a Collection that is a Set of values.
    -
    ThreadFactory 
    -
  • -
  • - - - - - - - - - - - - - - - - - - -
    Classes in org.hsqldb.lib used by org.hsqldb.lib.tar 
    ClassDescription
    InputStreamInterface 
    RefCapableRBInterface 
    -
  • -
  • - - - - - - - - - - - - - - -
    Classes in org.hsqldb.lib used by org.hsqldb.server 
    ClassDescription
    Notified 
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/DbBackup.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/DbBackup.html deleted file mode 100644 index bb5ff230..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/DbBackup.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - - -DbBackup (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DbBackup

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.DbBackup
    • -
    -
  • -
-
-
    -
  • -
    -
    public class DbBackup
    -extends java.lang.Object
    -
    Works with tar archives containing HyperSQL database instance backups. - Viz, creating, examining, or extracting these archives. -

    - This class provides OO Tar backup-creation control. - The extraction and listing features are implemented only in static fashion - in the Main method, which provides a consistent interface for all three - features from the command-line. -

    - For tar creation, the default behavior is to fail if the target archive - exists, and to abort if any database change is detected. - Use the JavaBean setters to changes this behavior. - See the main(String[]) method for details about command-line usage. -

    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com), Fred Toussi (fredt@users dot sourceforge.net)
    -
    See Also:
    -
    - The database backup section of the HyperSQL User Guide, -DbBackupMain.main(String[]), -setOverWrite(boolean), -setAbortUponModify(boolean)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      DbBackup​(java.io.File archiveFile, - java.lang.String dbPath) -
      Instantiate a DbBackup instance for creating a Database Instance backup.
      -
      DbBackup​(java.io.File archiveFile, - java.lang.String dbPath, - boolean script) -
      Used for SCRIPT backup
      -
      -
    • -
    -
    - -
    - -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DbBackup

        -
        public DbBackup​(java.io.File archiveFile,
        -                java.lang.String dbPath)
        -
        Instantiate a DbBackup instance for creating a Database Instance backup.

        - - Much validation is deferred until the write() method, to prevent problems - with files changing between the constructor and the write call.

        -
        -
        Parameters:
        -
        archiveFile - File
        -
        dbPath - String
        -
        -
      • -
      - - - -
        -
      • -

        DbBackup

        -
        public DbBackup​(java.io.File archiveFile,
        -                java.lang.String dbPath,
        -                boolean script)
        -
        Used for SCRIPT backup
        -
        -
        Parameters:
        -
        archiveFile - File
        -
        dbPath - String
        -
        script - boolean
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setStream

        -
        public void setStream​(java.lang.String fileExtension,
        -                      InputStreamInterface is)
        -
        Overrides file with stream.
        -
        -
        Parameters:
        -
        fileExtension - String
        -
        is - InputStreamInterface
        -
        -
      • -
      - - - -
        -
      • -

        setFileIgnore

        -
        public void setFileIgnore​(java.lang.String fileExtension)
        -
      • -
      - - - -
        -
      • -

        setOverWrite

        -
        public void setOverWrite​(boolean overWrite)
        -
        Defaults to false.

        - - If arg is false, then attempts to write a tar file that already exist - will abort.

        -
        -
        Parameters:
        -
        overWrite - boolean
        -
        -
      • -
      - - - -
        -
      • -

        setAbortUponModify

        -
        public void setAbortUponModify​(boolean abortUponModify)
        -
        Defaults to true.

        - - If true, then the write() method will validate that the database is - closed, and it will verify that no DB file changes between when we - start writing the tar, and when we finish.

        -
        -
        Parameters:
        -
        abortUponModify - boolean
        -
        -
      • -
      - - - -
        -
      • -

        getOverWrite

        -
        public boolean getOverWrite()
        -
      • -
      - - - -
        -
      • -

        getAbortUponModify

        -
        public boolean getAbortUponModify()
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write()
        -           throws java.io.IOException,
        -                  TarMalformatException
        -
        This method always backs up the .properties and .script files. It will - back up all of .backup, .data, and .log which exist.

        - - If abortUponModify is set, no tar file will be created, and this - method will throw.

        -
        -
        Throws:
        -
        java.io.IOException - for any of many possible I/O problems
        -
        TarMalformatException - if there is a problem writin the tar file
        -
        -
      • -
      - - - -
        -
      • -

        writeAsFiles

        -
        public void writeAsFiles()
        -                  throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/DbBackupMain.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/DbBackupMain.html deleted file mode 100644 index fcb48f06..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/DbBackupMain.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - -DbBackupMain (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DbBackupMain

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.DbBackupMain
    • -
    -
  • -
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      DbBackupMain() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidmain​(java.lang.String[] sa) -
      Command line invocation to create, examine, or extract HSQLDB database - backup tar archives.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DbBackupMain

        -
        public DbBackupMain()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] sa)
        -                 throws java.io.IOException,
        -                        TarMalformatException
        -
        Command line invocation to create, examine, or extract HSQLDB database - backup tar archives. -

        - This class stores tar entries as relative files without specifying - parent directories, in what is commonly referred to as tar bomb - format. - The set of files is small, with known extensions, and the potential - inconvenience of messing up the user's current directory is more than - compensated by making it easier for the user to restore to a new - database URL location at a peer level to the original. -

        - Automatically calculates buffer sizes based on the largest component - file (for "save" mode) or tar file size (for other modes). -

        - Run

        
        -     java -cp path/to/hsqldb.jar org.hsqldb.lib.tar.DbBackupMain
        - 
        for syntax help.
        -
        -
        Parameters:
        -
        sa - The arguments
        -
        Throws:
        -
        java.io.IOException - on read-write error
        -
        TarMalformatException - on tar file problems
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/PIFData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/PIFData.html deleted file mode 100644 index 6a4b5bc8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/PIFData.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - - -PIFData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class PIFData

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.util.AbstractMap<K,​V>
    • -
    • -
        -
      • java.util.HashMap<java.lang.String,​java.lang.String>
      • -
      • -
          -
        • org.hsqldb.lib.tar.PIFData
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.String>
    -
    -
    -
    public class PIFData
    -extends java.util.HashMap<java.lang.String,​java.lang.String>
    -
    Pax Interchange Format object constituted from an Input Stream. -

    - Right now, the only Pax property that we support directly is "size".

    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from class java.util.AbstractMap

        -java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • -
      -
        -
      • - - -

        Nested classes/interfaces inherited from interface java.util.Map

        -java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      PIFData​(java.io.InputStream stream) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.LonggetSize() -
      N.b.
      -
      -
        -
      • - - -

        Methods inherited from class java.util.HashMap

        -clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • -
      -
        -
      • - - -

        Methods inherited from class java.util.AbstractMap

        -equals, hashCode, toString
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -getClass, notify, notifyAll, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.util.Map

        -equals, hashCode
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getSize

        -
        public java.lang.Long getSize()
        -
        N.b. this is nothing to do with HashMap.size() or Map.size(). - This returns the value of the Pax "size" property.
        -
        -
        Returns:
        -
        Pax size
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/PIFGenerator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/PIFGenerator.html deleted file mode 100644 index c116c5f3..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/PIFGenerator.html +++ /dev/null @@ -1,490 +0,0 @@ - - - - - -PIFGenerator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class PIFGenerator

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.io.OutputStream
    • -
    • -
        -
      • java.io.ByteArrayOutputStream
      • -
      • -
          -
        • org.hsqldb.lib.tar.PIFGenerator
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    -
    -
    -
    public class PIFGenerator
    -extends java.io.ByteArrayOutputStream
    -
    Encapsulates Pax Interchange Format key-value pairs.
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      PIFGenerator​(int sequenceNum) -
      Construct a PIFGenerator object for a 'g' record.
      -
      PIFGenerator​(java.io.File file) -
      Construct a PIFGenerator object for a 'x' record.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidaddRecord​(java.lang.String key, - boolean b) -
      Convenience wrapper for addRecord(String, String).
      -
      voidaddRecord​(java.lang.String key, - int i) -
      Convenience wrapper for addRecord(String, String).
      -
      voidaddRecord​(java.lang.String key, - long l) -
      Convenience wrapper for addRecord(String, String).
      -
      voidaddRecord​(java.lang.String key, - java.lang.String value) -
      I guess the "initial length" field is supposed to be in units of - characters, not bytes?
      -
      java.lang.StringgetName() 
      -
        -
      • - - -

        Methods inherited from class java.io.ByteArrayOutputStream

        -close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
      • -
      -
        -
      • - - -

        Methods inherited from class java.io.OutputStream

        -flush, nullOutputStream, write
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        PIFGenerator

        -
        public PIFGenerator​(int sequenceNum)
        -
        Construct a PIFGenerator object for a 'g' record.
        -
        -
        Parameters:
        -
        sequenceNum - Index starts at 1 in each Tar file
        -
        -
      • -
      - - - -
        -
      • -

        PIFGenerator

        -
        public PIFGenerator​(java.io.File file)
        -
        Construct a PIFGenerator object for a 'x' record.
        -
        -
        Parameters:
        -
        file - Target file of the x record.
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getName

        -
        public java.lang.String getName()
        -
      • -
      - - - -
        -
      • -

        addRecord

        -
        public void addRecord​(java.lang.String key,
        -                      boolean b)
        -               throws TarMalformatException,
        -                      java.io.IOException
        -
        Convenience wrapper for addRecord(String, String). N.b. this writes - values exactly as either "true" or "false".
        -
        -
        Parameters:
        -
        key - String
        -
        b - boolean value
        -
        Throws:
        -
        TarMalformatException - if there is a problem writing the tar file
        -
        java.io.IOException - if there is an IO problem
        -
        See Also:
        -
        addRecord(String, String), -Boolean.toString(boolean)
        -
        -
      • -
      - - - -
        -
      • -

        addRecord

        -
        public void addRecord​(java.lang.String key,
        -                      int i)
        -               throws TarMalformatException,
        -                      java.io.IOException
        -
        Convenience wrapper for addRecord(String, String).
        -
        -
        Parameters:
        -
        key - String
        -
        i - int value
        -
        Throws:
        -
        TarMalformatException - if there is a problem writing the tar file
        -
        java.io.IOException - IOException if there is an IO problem
        -
        See Also:
        -
        addRecord(String, String)
        -
        -
      • -
      - - - -
        -
      • -

        addRecord

        -
        public void addRecord​(java.lang.String key,
        -                      long l)
        -               throws TarMalformatException,
        -                      java.io.IOException
        -
        Convenience wrapper for addRecord(String, String).
        -
        -
        Parameters:
        -
        key - String
        -
        l - long value
        -
        Throws:
        -
        TarMalformatException - if there is a problem writing the tar file
        -
        java.io.IOException - if there is an IO problem
        -
        See Also:
        -
        addRecord(String, String)
        -
        -
      • -
      - - - -
        -
      • -

        addRecord

        -
        public void addRecord​(java.lang.String key,
        -                      java.lang.String value)
        -               throws TarMalformatException,
        -                      java.io.IOException
        -
        I guess the "initial length" field is supposed to be in units of - characters, not bytes?
        -
        -
        Parameters:
        -
        key - String
        -
        value - String
        -
        Throws:
        -
        TarMalformatException - if there is a problem writing the tar file
        -
        java.io.IOException - if there is an IO problem
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/RB.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/RB.html deleted file mode 100644 index 3065ef74..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/RB.html +++ /dev/null @@ -1,1461 +0,0 @@ - - - - - -RB (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Enum RB

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.lang.Enum<RB>
    • -
    • -
        -
      • org.hsqldb.lib.tar.RB
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, java.lang.Comparable<RB>, RefCapableRBInterface
    -
    -
    -
    public enum RB
    -extends java.lang.Enum<RB>
    -implements RefCapableRBInterface
    -
    Resource Bundle for Tar classes -

    - Purpose of this class is to wrap a RefCapablePropertyResourceBundle to - reliably detect any possible use of a missing property key as soon as - this class is clinitted. - The reason for this is to allow us developers to detect all such errors - before end-users ever use this class. -

    - IMPORTANT: To add a new ResourceBundle element, add two new lines, one - like

    -    public static final int NEWKEYID = keyCounter++;
    - 
    and one line
    -      new Integer(KEY2), "key2",
    - 
    - Both should be inserted right after all of the other lines of the same type. - NEWKEYID is obviously a new constant which you will use in calling code - like RB.NEWKEYID.
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Enum Constant Detail

      - - - -
        -
      • -

        DbBackup_syntax

        -
        public static final RB DbBackup_syntax
        -
      • -
      - - - -
        -
      • -

        DbBackup_syntaxerr

        -
        public static final RB DbBackup_syntaxerr
        -
      • -
      - - - -
        -
      • -

        TarGenerator_syntax

        -
        public static final RB TarGenerator_syntax
        -
      • -
      - - - -
        -
      • -

        pad_block_write

        -
        public static final RB pad_block_write
        -
      • -
      - - - -
        -
      • -

        cleanup_rmfail

        -
        public static final RB cleanup_rmfail
        -
      • -
      - - - -
        -
      • -

        TarReader_syntax

        -
        public static final RB TarReader_syntax
        -
      • -
      - - - -
        -
      • -

        unsupported_entry_present

        -
        public static final RB unsupported_entry_present
        -
      • -
      - - - -
        -
      • -

        bpr_write

        -
        public static final RB bpr_write
        -
      • -
      - - - -
        -
      • -

        stream_buffer_report

        -
        public static final RB stream_buffer_report
        -
      • -
      - - - -
        -
      • -

        write_queue_report

        -
        public static final RB write_queue_report
        -
      • -
      - - - -
        -
      • -

        file_missing

        -
        public static final RB file_missing
        -
      • -
      - - - -
        -
      • -

        modified_property

        -
        public static final RB modified_property
        -
      • -
      - - - -
        -
      • -

        file_disappeared

        -
        public static final RB file_disappeared
        -
      • -
      - - - -
        -
      • -

        file_changed

        -
        public static final RB file_changed
        -
      • -
      - - - -
        -
      • -

        file_appeared

        -
        public static final RB file_appeared
        -
      • -
      - - - -
        -
      • -

        pif_malformat

        -
        public static final RB pif_malformat
        -
      • -
      - - - -
        -
      • -

        pif_malformat_size

        -
        public static final RB pif_malformat_size
        -
      • -
      - - - -
        -
      • -

        zero_write

        -
        public static final RB zero_write
        -
      • -
      - - - -
        -
      • -

        pif_toobig

        -
        public static final RB pif_toobig
        -
      • -
      - - - -
        -
      • -

        read_denied

        -
        public static final RB read_denied
        -
      • -
      - - - -
        -
      • -

        compression_unknown

        -
        public static final RB compression_unknown
        -
      • -
      - - - -
        -
      • -

        insufficient_read

        -
        public static final RB insufficient_read
        -
      • -
      - - - -
        -
      • -

        decompression_ranout

        -
        public static final RB decompression_ranout
        -
      • -
      - - - -
        -
      • -

        move_work_file

        -
        public static final RB move_work_file
        -
      • -
      - - - -
        -
      • -

        cant_overwrite

        -
        public static final RB cant_overwrite
        -
      • -
      - - - -
        -
      • -

        cant_write_dir

        -
        public static final RB cant_write_dir
        -
      • -
      - - - -
        -
      • -

        no_parent_dir

        -
        public static final RB no_parent_dir
        -
      • -
      - - - -
        -
      • -

        bad_block_write_len

        -
        public static final RB bad_block_write_len
        -
      • -
      - - - -
        -
      • -

        illegal_block_boundary

        -
        public static final RB illegal_block_boundary
        -
      • -
      - - - -
        -
      • -

        workfile_delete_fail

        -
        public static final RB workfile_delete_fail
        -
      • -
      - - - -
        -
      • -

        unsupported_ext

        -
        public static final RB unsupported_ext
        -
      • -
      - - - -
        -
      • -

        dest_exists

        -
        public static final RB dest_exists
        -
      • -
      - - - -
        -
      • -

        parent_not_dir

        -
        public static final RB parent_not_dir
        -
      • -
      - - - -
        -
      • -

        cant_write_parent

        -
        public static final RB cant_write_parent
        -
      • -
      - - - -
        -
      • -

        parent_create_fail

        -
        public static final RB parent_create_fail
        -
      • -
      - - - -
        -
      • -

        tar_field_toobig

        -
        public static final RB tar_field_toobig
        -
      • -
      - - - -
        -
      • -

        missing_supp_path

        -
        public static final RB missing_supp_path
        -
      • -
      - - - -
        -
      • -

        nonfile_entry

        -
        public static final RB nonfile_entry
        -
      • -
      - - - -
        -
      • -

        read_lt_1

        -
        public static final RB read_lt_1
        -
      • -
      - - - -
        -
      • -

        data_changed

        -
        public static final RB data_changed
        -
      • -
      - - - -
        -
      • -

        unexpected_header_key

        -
        public static final RB unexpected_header_key
        -
      • -
      - - - -
        -
      • -

        tarreader_syntaxerr

        -
        public static final RB tarreader_syntaxerr
        -
      • -
      - - - -
        -
      • -

        unsupported_mode

        -
        public static final RB unsupported_mode
        -
      • -
      - - - -
        -
      • -

        dir_x_conflict

        -
        public static final RB dir_x_conflict
        -
      • -
      - - - -
        -
      • -

        pif_unknown_datasize

        -
        public static final RB pif_unknown_datasize
        -
      • -
      - - - -
        -
      • -

        pif_data_toobig

        -
        public static final RB pif_data_toobig
        -
      • -
      - - - -
        -
      • -

        data_size_unknown

        -
        public static final RB data_size_unknown
        -
      • -
      - - - -
        -
      • -

        extraction_exists

        -
        public static final RB extraction_exists
        -
      • -
      - - - -
        -
      • -

        extraction_exists_notfile

        -
        public static final RB extraction_exists_notfile
        -
      • -
      - - - -
        -
      • -

        extraction_parent_not_dir

        -
        public static final RB extraction_parent_not_dir
        -
      • -
      - - - -
        -
      • -

        extraction_parent_not_writable

        -
        public static final RB extraction_parent_not_writable
        -
      • -
      - - - -
        -
      • -

        extraction_parent_mkfail

        -
        public static final RB extraction_parent_mkfail
        -
      • -
      - - - -
        -
      • -

        write_count_mismatch

        -
        public static final RB write_count_mismatch
        -
      • -
      - - - -
        -
      • -

        header_field_missing

        -
        public static final RB header_field_missing
        -
      • -
      - - - -
        -
      • -

        checksum_mismatch

        -
        public static final RB checksum_mismatch
        -
      • -
      - - - -
        -
      • -

        create_only_normal

        -
        public static final RB create_only_normal
        -
      • -
      - - - -
        -
      • -

        bad_header_value

        -
        public static final RB bad_header_value
        -
      • -
      - - - -
        -
      • -

        bad_numeric_header_value

        -
        public static final RB bad_numeric_header_value
        -
      • -
      - - - -
        -
      • -

        listing_format

        -
        public static final RB listing_format
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static RB[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (RB c : RB.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static RB valueOf​(java.lang.String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        -
        java.lang.NullPointerException - if the argument is null
        -
        -
      • -
      - - - - - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Enum<RB>
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String... strings)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - - - - - - - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(int i1,
        -                                  int i2,
        -                                  int i3)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(int i1,
        -                                  java.lang.String s2)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String s1,
        -                                  int i2)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(int i1,
        -                                  int i2,
        -                                  java.lang.String s3)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(int i1,
        -                                  java.lang.String s2,
        -                                  int i3)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String s1,
        -                                  int i2,
        -                                  int i3)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(int i1,
        -                                  java.lang.String s2,
        -                                  java.lang.String s3)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String s1,
        -                                  java.lang.String s2,
        -                                  int i3)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      - - - -
        -
      • -

        getString

        -
        public java.lang.String getString​(java.lang.String s1,
        -                                  int i2,
        -                                  java.lang.String s3)
        -
        -
        Specified by:
        -
        getString in interface RefCapableRBInterface
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileInputStream.html deleted file mode 100644 index 628fb04c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileInputStream.html +++ /dev/null @@ -1,551 +0,0 @@ - - - - - -TarFileInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TarFileInputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.TarFileInputStream
    • -
    -
  • -
-
-
    -
  • -
    -
    public class TarFileInputStream
    -extends java.lang.Object
    -
    Note that this class is not a java.io.FileInputStream, - because our goal is to greatly restrict the public methods of - FileInputStream, yet we must use public methods of the underlying - FileInputStream internally. Can't accomplish these goals in Java if we - subclass. -

    - This class is ignorant about Tar header fields, attributes and such. - It is concerned with reading and writing blocks of data in conformance with - Tar formatting, in a way convenient to those who want to get the header and - data blocks. -

    - Asymmetric to the Tar file writing side, the bufferBlocks setting here is - used only for to adjust read buffer size (for file data reads), so the user - can compromise between available memory and performance. Small buffer sizes - will always work, but will incur more reads; on the other hand, buffer sizes - larger than the largest component file is just a waste of memory. -

    - We assume the responsibility to manage the setting because the decision - should be based on available RAM more than anything else (therefore, we can't - set a good value automatically). -

    - As alluded to above, headers are read in separate reads, regardless of the - readBufferBlocks setting. readBufferBlocks is used for reading - file data. -

    - I have purposefully not implemented skip(), because, though I haven't tested - it, I believe our readBlock() and readBlocks() methods are at least as fast, - since we use the larges read buffer within limits the user has set. -

    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TarFileInputStream​(java.io.File sourceFile) -
      Convenience wrapper to use default readBufferBlocks and compressionType.
      -
      TarFileInputStream​(java.io.File sourceFile, - int compressionType) -
      Convenience wrapper to use default readBufferBlocks.
      -
      TarFileInputStream​(java.io.File sourceFile, - int compressionType, - int readBufferBlocks) -
      This class does no validation or enforcement of file naming conventions.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidclose() -
      Implements java.io.Closeable.
      -
      intgetReadBufferBlocks() 
      voidreadBlock() -
      readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file.
      -
      voidreadBlocks​(int blocks) -
      readBlocks(int) is the method that USERS of this class should use to - read file data from the tar file.
      -
      booleanreadNextHeaderBlock() -
      readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TarFileInputStream

        -
        public TarFileInputStream​(java.io.File sourceFile)
        -                   throws java.io.IOException
        -
        Convenience wrapper to use default readBufferBlocks and compressionType.
        -
        -
        Parameters:
        -
        sourceFile - File
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        TarFileInputStream(File, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        TarFileInputStream

        -
        public TarFileInputStream​(java.io.File sourceFile,
        -                          int compressionType)
        -                   throws java.io.IOException
        -
        Convenience wrapper to use default readBufferBlocks.
        -
        -
        Parameters:
        -
        sourceFile - File
        -
        compressionType - int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        TarFileInputStream(File, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        TarFileInputStream

        -
        public TarFileInputStream​(java.io.File sourceFile,
        -                          int compressionType,
        -                          int readBufferBlocks)
        -                   throws java.io.IOException
        -
        This class does no validation or enforcement of file naming conventions. - If desired, the caller should enforce extensions like "tar" and - "tar.gz" (and that they match the specified compression type). -

        - This object will automatically release its I/O resources when you get - false back from a readNextHeaderBlock() call. - If you abort before then, you must call the close() method like for a - normal InputStream. -

        -
        -
        Parameters:
        -
        sourceFile - File
        -
        compressionType - int
        -
        readBufferBlocks - int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        close(), -readNextHeaderBlock()
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getReadBufferBlocks

        -
        public int getReadBufferBlocks()
        -
      • -
      - - - -
        -
      • -

        readBlocks

        -
        public void readBlocks​(int blocks)
        -                throws java.io.IOException,
        -                       TarMalformatException
        -
        readBlocks(int) is the method that USERS of this class should use to - read file data from the tar file. - This method reads from the tar file and writes to the readBuffer array. -

        - This class and subclasses should read from the underlying readStream - ONLY WITH THIS METHOD. - That way we can be confident that bytesRead will always be accurate. -

        - This method is different from a typical Java byte array read command - in that when reading tar files

          -
        1. we always know ahead-of-time how many bytes we should read, and -
        2. we always want to read quantities of bytes in multiples of 512. -
        -
        -
        Parameters:
        -
        blocks - How many 512 blocks to read.
        -
        Throws:
        -
        java.io.IOException - for an I/O error on the underlying InputStream
        -
        TarMalformatException - if no I/O error occurred, but we failed to - read the exact number of bytes requested.
        -
        -
      • -
      - - - -
        -
      • -

        readBlock

        -
        public void readBlock()
        -               throws java.io.IOException,
        -                      TarMalformatException
        -
        readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file. -

        - readBlock() should be used when you know that the current block should - contain what you want. - E.g. you know that the very first block of a tar file should contain - a Tar Entry header block. -

        -
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        TarMalformatException - if malformed
        -
        See Also:
        -
        readNextHeaderBlock()
        -
        -
      • -
      - - - -
        -
      • -

        readNextHeaderBlock

        -
        public boolean readNextHeaderBlock()
        -                            throws java.io.IOException,
        -                                   TarMalformatException
        -
        readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file. - -

        readNextHeaderBlock continues working through the Tar File from the - current point until it finds a block with a non-0 first byte.

        -
        -
        Returns:
        -
        True if a header block was read and place at beginning of the - readBuffer array. False if EOF was encountered without finding - any blocks with first byte != 0. If false is returned, we have - automatically closed the this TarFileInputStream too.
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        TarMalformatException - if malformed
        -
        See Also:
        -
        readBlock()
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        Implements java.io.Closeable.
        -
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        Closeable
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileOutputStream.Compression.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileOutputStream.Compression.html deleted file mode 100644 index b2c6380d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileOutputStream.Compression.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - -TarFileOutputStream.Compression (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface TarFileOutputStream.Compression

-
-
-
-
    -
  • -
    -
    Enclosing class:
    -
    TarFileOutputStream
    -
    -
    -
    public static interface TarFileOutputStream.Compression
    -
  • -
-
-
- -
-
- -
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileOutputStream.html deleted file mode 100644 index b8a09cd0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarFileOutputStream.html +++ /dev/null @@ -1,762 +0,0 @@ - - - - - -TarFileOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TarFileOutputStream

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.TarFileOutputStream
    • -
    -
  • -
-
-
    -
  • -
    -
    public class TarFileOutputStream
    -extends java.lang.Object
    -
    Note that this class is not a java.io.FileOutputStream, - because our goal is to greatly restrict the public methods of - FileOutputStream, yet we must use public methods of the underlying - FileOutputStream internally. Can't accomplish these goals in Java if we - subclass. -

    - This class is ignorant about Tar header fields, attributes and such. - It is concerned with reading and writing blocks of data in conformance with - Tar formatting, in a way convenient to those who want to write the header - and data blocks. -

    - Users write file data by means of populating the provided, public byte array, - then calling the single write(int) method to write a portion of that array. - This design purposefully goes with efficiency, simplicity, and performance - over Java convention, which would not use public fields. -

    - At this time, we do not support appending. That would greatly decrease the - generality and simplicity of the our design, since appending is trivial - without compression and very difficult with compression. -

    - Users must finish tar file creation by using the finish() method. - Just like a normal OutputStream, if processing is aborted for any reason, - the close() method must be used to free up system resources. -

    - SECURITY NOTE - Due to pitiful lack of support for file security in Java before version 1.6, - this class will only explicitly set permissions if it is compiled for Java - 1.6. If it was not, and if your tar entries contain private data in files - with 0400 or similar, be aware that that file can be pretty much be - extracted by anybody with access to the tar file. -

    -
    -
    See Also:
    -
    finish(), -close()
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static booleandebug 
      byte[]writeBuffer 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TarFileOutputStream​(java.io.File targetFile) -
      Convenience wrapper to use default blocksPerRecord and compressionType.
      -
      TarFileOutputStream​(java.io.File targetFile, - int compressionType) -
      Convenience wrapper to use default blocksPerRecord.
      -
      TarFileOutputStream​(java.io.File targetFile, - int compressionType, - int blocksPerRecord) -
      This class does no validation or enforcement of file naming conventions.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidassertAtBlockBoundary() 
      intbytesLeftInBlock() 
      voidclose() -
      Implements java.io.Closeable.
      -
      voidfinish() -
      (Only) when this method returns successfully, the generated file will be - a valid tar file.
      -
      voidflush() -
      Implements java.io.Flushable.
      -
      longgetBytesWritten() 
      voidpadCurrentBlock() -
      Rounds out the current block to the next block boundary.
      -
      voidwrite​(byte[] byteArray, - int byteCount) -
      This class and subclasses should write to the underlying writeStream - ONLY WITH THIS METHOD.
      -
      voidwrite​(int byteCount) -
      The normal way to write file data (as opposed to header data or padding) - using this class.
      -
      voidwriteBlock​(byte[] block) -
      Write a user-specified 512-byte block.
      -
      voidwritePadBlock() -
      Writes a single zero'd block.
      -
      voidwritePadBlocks​(int blockCount) -
      Writes the specified quantity of zero'd blocks.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        debug

        -
        public static final boolean debug
        -
      • -
      - - - -
        -
      • -

        writeBuffer

        -
        public byte[] writeBuffer
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TarFileOutputStream

        -
        public TarFileOutputStream​(java.io.File targetFile)
        -                    throws java.io.IOException
        -
        Convenience wrapper to use default blocksPerRecord and compressionType.
        -
        -
        Parameters:
        -
        targetFile - File
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        TarFileOutputStream(File, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        TarFileOutputStream

        -
        public TarFileOutputStream​(java.io.File targetFile,
        -                           int compressionType)
        -                    throws java.io.IOException
        -
        Convenience wrapper to use default blocksPerRecord.
        -
        -
        Parameters:
        -
        targetFile - File
        -
        compressionType - int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        TarFileOutputStream(File, int, int)
        -
        -
      • -
      - - - -
        -
      • -

        TarFileOutputStream

        -
        public TarFileOutputStream​(java.io.File targetFile,
        -                           int compressionType,
        -                           int blocksPerRecord)
        -                    throws java.io.IOException
        -
        This class does no validation or enforcement of file naming conventions. - If desired, the caller should enforce extensions like "tar" and - "tar.gz" (and that they match the specified compression type). - - It also overwrites files without warning (just like FileOutputStream).
        -
        -
        Parameters:
        -
        targetFile - File
        -
        compressionType - int
        -
        blocksPerRecord - int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        write

        -
        public void write​(byte[] byteArray,
        -                  int byteCount)
        -           throws java.io.IOException
        -
        This class and subclasses should write to the underlying writeStream - ONLY WITH THIS METHOD. That way we can be confident that - bytesWritten will always be accurate.
        -
        -
        Parameters:
        -
        byteArray - byte[]
        -
        byteCount - int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write​(int byteCount)
        -           throws java.io.IOException
        -
        The normal way to write file data (as opposed to header data or padding) - using this class.
        -
        -
        Parameters:
        -
        byteCount - int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      - - - -
        -
      • -

        writeBlock

        -
        public void writeBlock​(byte[] block)
        -                throws java.io.IOException
        -
        Write a user-specified 512-byte block. For efficiency, write(int) should - be used when writing file body content.
        -
        -
        Parameters:
        -
        block - byte[]
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        write(int)
        -
        -
      • -
      - - - -
        -
      • -

        writePadBlocks

        -
        public void writePadBlocks​(int blockCount)
        -                    throws java.io.IOException
        -
        Writes the specified quantity of zero'd blocks.
        -
        -
        Parameters:
        -
        blockCount - int
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      - - - -
        -
      • -

        writePadBlock

        -
        public void writePadBlock()
        -                   throws java.io.IOException
        -
        Writes a single zero'd block.
        -
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      - - - -
        -
      • -

        bytesLeftInBlock

        -
        public int bytesLeftInBlock()
        -
      • -
      - - - -
        -
      • -

        assertAtBlockBoundary

        -
        public void assertAtBlockBoundary()
        -
        -
        Throws:
        -
        java.lang.IllegalStateException - if end of file not on a block boundary.
        -
        -
      • -
      - - - -
        -
      • -

        padCurrentBlock

        -
        public void padCurrentBlock()
        -                     throws java.io.IOException
        -
        Rounds out the current block to the next block boundary. If we are - currently at a block boundary, nothing is done.
        -
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        -
      • -
      - - - -
        -
      • -

        flush

        -
        public void flush()
        -           throws java.io.IOException
        -
        Implements java.io.Flushable.
        -
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        Flushable
        -
        -
      • -
      - - - -
        -
      • -

        close

        -
        public void close()
        -           throws java.io.IOException
        -
        Implements java.io.Closeable. -

        - IMPORTANT: This method deletes the work file after - closing it!

        -
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        Closeable
        -
        -
      • -
      - - - -
        -
      • -

        getBytesWritten

        -
        public long getBytesWritten()
        -
      • -
      - - - -
        -
      • -

        finish

        -
        public void finish()
        -            throws java.io.IOException
        -
        (Only) when this method returns successfully, the generated file will be - a valid tar file. - - This method always performs a close, so you never need to call the close - if your code makes it to this method. - (You do need to call close if processing is aborted before calling - finish()).
        -
        -
        Throws:
        -
        java.io.IOException - on failure
        -
        See Also:
        -
        close()
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarGenerator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarGenerator.html deleted file mode 100644 index 8a588689..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarGenerator.html +++ /dev/null @@ -1,501 +0,0 @@ - - - - - -TarGenerator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TarGenerator

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.TarGenerator
    • -
    -
  • -
-
-
    -
  • -
    -
    public class TarGenerator
    -extends java.lang.Object
    -
    Generates a tar archive from specified Files and InputStreams. - Modified by fredt for hot backup
    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TarGenerator​(java.io.File inFile, - boolean overWrite, - java.lang.Integer blocksPerRecord) -
      Compression is determined directly by the suffix of the file name in - the specified path.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      longgetPaxThreshold() 
      voidqueueEntry​(java.io.File file) 
      voidqueueEntry​(java.lang.String entryPath, - java.io.File file) 
      voidqueueEntry​(java.lang.String entryPath, - java.io.InputStream inStream, - int maxBytes) -
      This method does not support Pax Interchange Format, nor data sizes - greater than 2G.
      -
      voidqueueEntry​(java.lang.String entryPath, - InputStreamInterface is) 
      voidsetPaxThreshold​(long paxThreshold) -
      When data file is this size or greater, in bytes, a - Pix Interchange Format 'x' record will be created and used for the file - entry.
      -
      voidwrite() -
      This method does release all of the streams, even if there is a failure.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TarGenerator

        -
        public TarGenerator​(java.io.File inFile,
        -                    boolean overWrite,
        -                    java.lang.Integer blocksPerRecord)
        -             throws java.io.IOException
        -
        Compression is determined directly by the suffix of the file name in - the specified path.
        -
        -
        Parameters:
        -
        inFile - Absolute or relative (from user.dir) File for - tar file to be created. getName() Suffix must - indicate tar file and may indicate a compression - method.
        -
        overWrite - True to replace an existing file of same path.
        -
        blocksPerRecord - Null will use default tar value.
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setPaxThreshold

        -
        public void setPaxThreshold​(long paxThreshold)
        -
        When data file is this size or greater, in bytes, a - Pix Interchange Format 'x' record will be created and used for the file - entry. -

        - Limitation - At this time, PAX is only implemented for entries added as Files, - not entries added as Stream. -

        -
        -
        Parameters:
        -
        paxThreshold - long
        -
        -
      • -
      - - - -
        -
      • -

        getPaxThreshold

        -
        public long getPaxThreshold()
        -
        -
        Returns:
        -
        long
        -
        See Also:
        -
        setPaxThreshold(long)
        -
        -
      • -
      - - - - - - - -
        -
      • -

        queueEntry

        -
        public void queueEntry​(java.lang.String entryPath,
        -                       java.io.File file)
        -                throws java.io.FileNotFoundException,
        -                       TarMalformatException
        -
        -
        Throws:
        -
        java.io.FileNotFoundException
        -
        TarMalformatException
        -
        -
      • -
      - - - - - - - -
        -
      • -

        queueEntry

        -
        public void queueEntry​(java.lang.String entryPath,
        -                       java.io.InputStream inStream,
        -                       int maxBytes)
        -                throws java.io.IOException,
        -                       TarMalformatException
        -
        This method does not support Pax Interchange Format, nor data sizes - greater than 2G. -

        - This limitation may or may not be eliminated in the future. -

        -
        -
        Parameters:
        -
        entryPath - String
        -
        inStream - InputStream
        -
        maxBytes - int
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        TarMalformatException - if malformed
        -
        -
      • -
      - - - -
        -
      • -

        write

        -
        public void write()
        -           throws java.io.IOException,
        -                  TarMalformatException
        -
        This method does release all of the streams, even if there is a failure.
        -
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        TarMalformatException - if malformed
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarGeneratorMain.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarGeneratorMain.html deleted file mode 100644 index 9630c40e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarGeneratorMain.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - -TarGeneratorMain (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TarGeneratorMain

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.TarGeneratorMain
    • -
    -
  • -
-
-
    -
  • -
    -
    public class TarGeneratorMain
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TarGeneratorMain() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidmain​(java.lang.String[] sa) -
      Creates specified tar file to contain specified files, or stdin, using - default blocks-per-record and replacing tar file if it already exists.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TarGeneratorMain

        -
        public TarGeneratorMain()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] sa)
        -                 throws java.io.IOException,
        -                        TarMalformatException
        -
        Creates specified tar file to contain specified files, or stdin, using - default blocks-per-record and replacing tar file if it already exists.
        -
        -
        Parameters:
        -
        sa - arguments
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        TarMalformatException - if malformed
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarHeaderField.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarHeaderField.html deleted file mode 100644 index 75b145f2..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarHeaderField.html +++ /dev/null @@ -1,573 +0,0 @@ - - - - - -TarHeaderField (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Enum TarHeaderField

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.lang.Enum<TarHeaderField>
    • -
    • -
        -
      • org.hsqldb.lib.tar.TarHeaderField
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, java.lang.Comparable<TarHeaderField>
    -
    -
    -
    public enum TarHeaderField
    -extends java.lang.Enum<TarHeaderField>
    -
    Purely static structure defining our interface to the Tar Entry Header. - - The fields controlled here are fields for the individual tar file entries - in an archive. There is no such thing as a Header Field at the top archive - level. -

    - We use header field names as they are specified in the FreeBSD man page for - tar in section 5 (Solaris and Linux have no such page in section 5). - Where we use a constant, the constant name is just the FreeBSD field name - capitalized. - Since a single field is known as either "linkflag" or "typeflag", we are - going with the UStar name typeflag for this field. -

    - We purposefully define no variable for this list of fields, since - we DO NOT WANT TO access or change these values, due to application - goals or JVM limitations:

      -
    • gid -
    • uid -
    • linkname -
    • magic (UStar ID), -
    • magic version -
    • group name -
    • device major num -
    • device minor num -
    - Our application has no use for these, or Java has no ability to - work with them. -

    - This class will be very elegant when refactored as an enum with enumMap(s) - and using generics with auto-boxing instead of the ugly and non-validating - casts.

    -
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      intgetStart() 
      intgetStop() 
      static TarHeaderFieldvalueOf​(java.lang.String name) -
      Returns the enum constant of this type with the specified name.
      -
      static TarHeaderField[]values() -
      Returns an array containing the constants of this enum type, in -the order they are declared.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Enum

        -compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -getClass, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        values

        -
        public static TarHeaderField[] values()
        -
        Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
        -for (TarHeaderField c : TarHeaderField.values())
        -    System.out.println(c);
        -
        -
        -
        Returns:
        -
        an array containing the constants of this enum type, in the order they are declared
        -
        -
      • -
      - - - -
        -
      • -

        valueOf

        -
        public static TarHeaderField valueOf​(java.lang.String name)
        -
        Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
        -
        -
        Parameters:
        -
        name - the name of the enum constant to be returned.
        -
        Returns:
        -
        the enum constant with the specified name
        -
        Throws:
        -
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        -
        java.lang.NullPointerException - if the argument is null
        -
        -
      • -
      - - - -
        -
      • -

        getStart

        -
        public int getStart()
        -
      • -
      - - - -
        -
      • -

        getStop

        -
        public int getStop()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarMalformatException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarMalformatException.html deleted file mode 100644 index 050b5a1a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarMalformatException.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - -TarMalformatException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TarMalformatException

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.lang.Throwable
    • -
    • -
        -
      • java.lang.Exception
      • -
      • -
          -
        • org.hsqldb.lib.tar.TarMalformatException
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable
    -
    -
    -
    public class TarMalformatException
    -extends java.lang.Exception
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TarMalformatException​(java.lang.String s) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Throwable

        -addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TarMalformatException

        -
        public TarMalformatException​(java.lang.String s)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarReader.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarReader.html deleted file mode 100644 index 0bedaf7a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarReader.html +++ /dev/null @@ -1,458 +0,0 @@ - - - - - -TarReader (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TarReader

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.TarReader
    • -
    -
  • -
-
-
    -
  • -
    -
    public class TarReader
    -extends java.lang.Object
    -
    Reads a Tar file for reporting or extraction. - N.b. this is not a Reader in the java.io.Reader sense, - but in the sense of differentiating tar x and - tar t from tar c. -

    - SECURITY NOTE - Due to pitiful lack of support for file security in Java before version 1.6, - this class will only explicitly set permissions if it is compiled for Java - 1.6. If it was not, and if your tar entries contain private data in files - with 0400 or similar, be aware that they will be extracted with privs such - that they can be ready by anybody. -

    -
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static intEXTRACT_MODE -
      EXTRACT_MODE refuses to overwrite existing files.
      -
      static intLIST_MODE 
      static intOVERWRITE_MODE -
      OVERWRITE_MODE is just EXTRACT_MODE where we will silently overwrite - existing files upon extraction.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TarReader​(java.io.File inFile, - int mode, - java.lang.String[] patternStrings, - java.lang.Integer readBufferBlocks, - java.io.File inDir) -
      Compression is determined directly by the suffix of the file name in - the specified path.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidread() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - - - - - -
        -
      • -

        EXTRACT_MODE

        -
        public static final int EXTRACT_MODE
        -
        EXTRACT_MODE refuses to overwrite existing files.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        OVERWRITE_MODE

        -
        public static final int OVERWRITE_MODE
        -
        OVERWRITE_MODE is just EXTRACT_MODE where we will silently overwrite - existing files upon extraction.
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TarReader

        -
        public TarReader​(java.io.File inFile,
        -                 int mode,
        -                 java.lang.String[] patternStrings,
        -                 java.lang.Integer readBufferBlocks,
        -                 java.io.File inDir)
        -          throws java.io.IOException
        -
        Compression is determined directly by the suffix of the file name in - the specified path.
        -
        -
        Parameters:
        -
        inFile - Absolute or relative (from user.dir) path to - tar file to be read. Suffix may indicate - a compression method.
        -
        mode - Whether to list, extract-without-overwrite, or - extract-with-overwrite.
        -
        patternStrings - List of regular expressions to match against tar entry - names. If null, all entries will be listed or - extracted. If non-null, then only entries with names - which match will be extracted or listed.
        -
        readBufferBlocks - Null will use default tar value.
        -
        inDir - Directory that RELATIVE entries will be extracted - relative to. Defaults to current directory (user.dir). - Only used for extract modes and relative file entries.
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        java.lang.IllegalArgumentException - if any given pattern is an invalid - regular expression. Don't have to worry about this if - you call with null 'patterns' param.
        -
        See Also:
        -
        Pattern
        -
        -
      • -
      -
    • -
    -
    - -
    - -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarReaderMain.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarReaderMain.html deleted file mode 100644 index 8411a705..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/TarReaderMain.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - - -TarReaderMain (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TarReaderMain

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.lib.tar.TarReaderMain
    • -
    -
  • -
-
-
    -
  • -
    -
    public class TarReaderMain
    -extends java.lang.Object
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TarReaderMain() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidmain​(java.lang.String[] sa) -
      Reads a specified tar file or stdin in order to either list or extract - the file tar entries, depending on the first argument being "t" or "x", - using default read buffer blocks.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TarReaderMain

        -
        public TarReaderMain()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] sa)
        -                 throws java.io.IOException,
        -                        TarMalformatException
        -
        Reads a specified tar file or stdin in order to either list or extract - the file tar entries, depending on the first argument being "t" or "x", - using default read buffer blocks.
        -
        -
        Parameters:
        -
        sa - arguments
        -
        Throws:
        -
        java.io.IOException - on access failure
        -
        TarMalformatException - if malformed
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/DbBackup.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/DbBackup.html deleted file mode 100644 index 73b7de9a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/DbBackup.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.DbBackup (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.DbBackup

-
-
No usage of org.hsqldb.lib.tar.DbBackup
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/DbBackupMain.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/DbBackupMain.html deleted file mode 100644 index f29756ea..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/DbBackupMain.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.DbBackupMain (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.DbBackupMain

-
-
No usage of org.hsqldb.lib.tar.DbBackupMain
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/PIFData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/PIFData.html deleted file mode 100644 index 7d60156e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/PIFData.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.PIFData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.PIFData

-
-
No usage of org.hsqldb.lib.tar.PIFData
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/PIFGenerator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/PIFGenerator.html deleted file mode 100644 index 8ba2b739..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/PIFGenerator.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.PIFGenerator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.PIFGenerator

-
-
No usage of org.hsqldb.lib.tar.PIFGenerator
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/RB.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/RB.html deleted file mode 100644 index 5857447c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/RB.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.RB (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.RB

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use RB 
    PackageDescription
    org.hsqldb.lib.tar -
    Contains the DbBackupMain class, for offline backing up HyperSQL databases.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of RB in org.hsqldb.lib.tar

      - - - - - - - - - - - - - - - - - - - -
      Methods in org.hsqldb.lib.tar that return RB 
      Modifier and TypeMethodDescription
      static RBRB.valueOf​(java.lang.String name) -
      Returns the enum constant of this type with the specified name.
      -
      static RB[]RB.values() -
      Returns an array containing the constants of this enum type, in -the order they are declared.
      -
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileInputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileInputStream.html deleted file mode 100644 index 958b2df8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileInputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarFileInputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarFileInputStream

-
-
No usage of org.hsqldb.lib.tar.TarFileInputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileOutputStream.Compression.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileOutputStream.Compression.html deleted file mode 100644 index 55d897a8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileOutputStream.Compression.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.lib.tar.TarFileOutputStream.Compression (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.lib.tar.TarFileOutputStream.Compression

-
-
No usage of org.hsqldb.lib.tar.TarFileOutputStream.Compression
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileOutputStream.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileOutputStream.html deleted file mode 100644 index fc53bfcf..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarFileOutputStream.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarFileOutputStream (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarFileOutputStream

-
-
No usage of org.hsqldb.lib.tar.TarFileOutputStream
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarGenerator.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarGenerator.html deleted file mode 100644 index 3e28c6e8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarGenerator.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarGenerator (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarGenerator

-
-
No usage of org.hsqldb.lib.tar.TarGenerator
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarGeneratorMain.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarGeneratorMain.html deleted file mode 100644 index 366d922f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarGeneratorMain.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarGeneratorMain (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarGeneratorMain

-
-
No usage of org.hsqldb.lib.tar.TarGeneratorMain
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarHeaderField.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarHeaderField.html deleted file mode 100644 index 46761c4a..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarHeaderField.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarHeaderField (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarHeaderField

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarMalformatException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarMalformatException.html deleted file mode 100644 index 56ba488e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarMalformatException.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarMalformatException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarMalformatException

-
-
-
    -
  • - - - - - - - - - - - - -
    Packages that use TarMalformatException 
    PackageDescription
    org.hsqldb.lib.tar -
    Contains the DbBackupMain class, for offline backing up HyperSQL databases.
    -
    -
  • -
  • -
      -
    • -
      - - -

      Uses of TarMalformatException in org.hsqldb.lib.tar

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Methods in org.hsqldb.lib.tar that throw TarMalformatException 
      Modifier and TypeMethodDescription
      voidPIFGenerator.addRecord​(java.lang.String key, - boolean b) -
      Convenience wrapper for addRecord(String, String).
      -
      voidPIFGenerator.addRecord​(java.lang.String key, - int i) -
      Convenience wrapper for addRecord(String, String).
      -
      voidPIFGenerator.addRecord​(java.lang.String key, - long l) -
      Convenience wrapper for addRecord(String, String).
      -
      voidPIFGenerator.addRecord​(java.lang.String key, - java.lang.String value) -
      I guess the "initial length" field is supposed to be in units of - characters, not bytes?
      -
      static voidDbBackupMain.main​(java.lang.String[] sa) -
      Command line invocation to create, examine, or extract HSQLDB database - backup tar archives.
      -
      static voidTarGeneratorMain.main​(java.lang.String[] sa) -
      Creates specified tar file to contain specified files, or stdin, using - default blocks-per-record and replacing tar file if it already exists.
      -
      static voidTarReaderMain.main​(java.lang.String[] sa) -
      Reads a specified tar file or stdin in order to either list or extract - the file tar entries, depending on the first argument being "t" or "x", - using default read buffer blocks.
      -
      voidTarGenerator.queueEntry​(java.io.File file) 
      voidTarGenerator.queueEntry​(java.lang.String entryPath, - java.io.File file) 
      voidTarGenerator.queueEntry​(java.lang.String entryPath, - java.io.InputStream inStream, - int maxBytes) -
      This method does not support Pax Interchange Format, nor data sizes - greater than 2G.
      -
      voidTarGenerator.queueEntry​(java.lang.String entryPath, - InputStreamInterface is) 
      voidTarReader.read() 
      voidTarFileInputStream.readBlock() -
      readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file.
      -
      voidTarFileInputStream.readBlocks​(int blocks) -
      readBlocks(int) is the method that USERS of this class should use to - read file data from the tar file.
      -
      booleanTarFileInputStream.readNextHeaderBlock() -
      readBlock() and readNextHeaderBlock are the methods that USERS of this - class should use to read header blocks from the tar file.
      -
      voidDbBackup.write() -
      This method always backs up the .properties and .script files.
      -
      voidTarGenerator.write() -
      This method does release all of the streams, even if there is a failure.
      -
      - - - - - - - - - - - - -
      Constructors in org.hsqldb.lib.tar that throw TarMalformatException 
      ConstructorDescription
      PIFData​(java.io.InputStream stream) 
      -
      -
    • -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarReader.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarReader.html deleted file mode 100644 index e2969c99..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarReader.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarReader (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarReader

-
-
No usage of org.hsqldb.lib.tar.TarReader
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarReaderMain.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarReaderMain.html deleted file mode 100644 index 9995eae8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/class-use/TarReaderMain.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.lib.tar.TarReaderMain (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.lib.tar.TarReaderMain

-
-
No usage of org.hsqldb.lib.tar.TarReaderMain
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-summary.html deleted file mode 100644 index f7ebc998..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-summary.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - -org.hsqldb.lib.tar (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.lib.tar

-
-
-
- - -
Contains the DbBackupMain class, for offline backing up HyperSQL databases.

- - See - the database offline backup section of the HyperSQL User Guide

- - Also contains support classes for handling files in tar and pax format.

-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    TarFileOutputStream.Compression 
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    DbBackup -
    Works with tar archives containing HyperSQL database instance backups.
    -
    DbBackupMain -
    This class is used for offline backup of HyperSQL databases.
    -
    PIFData -
    Pax Interchange Format object constituted from an Input Stream.
    -
    PIFGenerator -
    Encapsulates Pax Interchange Format key-value pairs.
    -
    TarFileInputStream -
    Note that this class is not a java.io.FileInputStream, - because our goal is to greatly restrict the public methods of - FileInputStream, yet we must use public methods of the underlying - FileInputStream internally.
    -
    TarFileOutputStream -
    Note that this class is not a java.io.FileOutputStream, - because our goal is to greatly restrict the public methods of - FileOutputStream, yet we must use public methods of the underlying - FileOutputStream internally.
    -
    TarGenerator -
    Generates a tar archive from specified Files and InputStreams.
    -
    TarGeneratorMain 
    TarReader -
    Reads a Tar file for reporting or extraction.
    -
    TarReaderMain 
    -
  • -
  • - - - - - - - - - - - - - - - - -
    Enum Summary 
    EnumDescription
    RB -
    Resource Bundle for Tar classes
    -
    TarHeaderField -
    Purely static structure defining our interface to the Tar Entry Header.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    TarMalformatException 
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-tree.html deleted file mode 100644 index 973a5175..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-tree.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - -org.hsqldb.lib.tar Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.lib.tar

-Package Hierarchies: - -
-
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • java.util.AbstractMap<K,​V> (implements java.util.Map<K,​V>) -
        -
      • java.util.HashMap<K,​V> (implements java.lang.Cloneable, java.util.Map<K,​V>, java.io.Serializable) - -
      • -
      -
    • -
    • org.hsqldb.lib.tar.DbBackup
    • -
    • org.hsqldb.lib.tar.DbBackupMain
    • -
    • java.io.OutputStream (implements java.io.Closeable, java.io.Flushable) -
        -
      • java.io.ByteArrayOutputStream - -
      • -
      -
    • -
    • org.hsqldb.lib.tar.TarFileInputStream
    • -
    • org.hsqldb.lib.tar.TarFileOutputStream
    • -
    • org.hsqldb.lib.tar.TarGenerator
    • -
    • org.hsqldb.lib.tar.TarGeneratorMain
    • -
    • org.hsqldb.lib.tar.TarReader
    • -
    • org.hsqldb.lib.tar.TarReaderMain
    • -
    • java.lang.Throwable (implements java.io.Serializable) - -
    • -
    -
  • -
-
-
-

Interface Hierarchy

- -
-
-

Enum Hierarchy

-
    -
  • java.lang.Object -
      -
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) - -
    • -
    -
  • -
-
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-use.html deleted file mode 100644 index bb269397..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/lib/tar/package-use.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - -Uses of Package org.hsqldb.lib.tar (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.lib.tar

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlServerFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlServerFactory.html deleted file mode 100644 index f569b7b4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlServerFactory.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - -HsqlServerFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlServerFactory

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.server.HsqlServerFactory
    • -
    -
  • -
-
-
    -
  • -
    -
    public class HsqlServerFactory
    -extends java.lang.Object
    -
    HsqlServerFactory
    -
    -
    Since:
    -
    1.7.0
    -
    Author:
    -
    paul-h@users
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static HsqlSocketRequestHandlercreateHsqlServer​(java.lang.String dbFilePath, - boolean debugMessages, - boolean silentMode) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        createHsqlServer

        -
        public static HsqlSocketRequestHandler createHsqlServer​(java.lang.String dbFilePath,
        -                                                        boolean debugMessages,
        -                                                        boolean silentMode)
        -                                                 throws java.sql.SQLException
        -
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketFactory.html deleted file mode 100644 index 025767e5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketFactory.html +++ /dev/null @@ -1,454 +0,0 @@ - - - - - -HsqlSocketFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlSocketFactory

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.server.HsqlSocketFactory
    • -
    -
  • -
-
-
    -
  • -
    -
    Direct Known Subclasses:
    -
    HsqlSocketFactorySecure
    -
    -
    -
    public class HsqlSocketFactory
    -extends java.lang.Object
    -
    Base class for producing the Socket objects used by HSQLDB.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com), Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidconfigureSocket​(java.net.Socket socket) 
      java.net.ServerSocketcreateServerSocket​(int port) -
      Returns a server socket bound to the specified port.
      -
      java.net.ServerSocketcreateServerSocket​(int port, - java.lang.String address) -
      Returns a server socket bound to the specified port.
      -
      java.net.SocketcreateSocket​(java.lang.String host, - int port) -
      Creates a socket and connects it to the specified remote host at the - specified remote port.
      -
      java.net.SocketcreateSocket​(java.net.Socket socket, - java.lang.String host, - int port) -
      If socket argument is not null, returns it.
      -
      static HsqlSocketFactorygetInstance​(boolean tls) -
      Retrieves an HsqlSocketFactory whose subclass and attributes are - determined by the specified argument, tls.
      -
      booleanisSecure() -
      Retrieves whether this factory produces secure sockets.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getInstance

        -
        public static HsqlSocketFactory getInstance​(boolean tls)
        -                                     throws java.lang.Exception
        -
        Retrieves an HsqlSocketFactory whose subclass and attributes are - determined by the specified argument, tls.
        -
        -
        Parameters:
        -
        tls - whether to retrieve a factory producing SSL sockets
        -
        Returns:
        -
        a new factory
        -
        Throws:
        -
        java.lang.Exception - if the new factory cannot be constructed or is - of the wrong type
        -
        -
      • -
      - - - -
        -
      • -

        configureSocket

        -
        public void configureSocket​(java.net.Socket socket)
        -
      • -
      - - - -
        -
      • -

        createServerSocket

        -
        public java.net.ServerSocket createServerSocket​(int port)
        -                                         throws java.lang.Exception
        -
        Returns a server socket bound to the specified port. - The socket is configured with the socket options - given to this factory.
        -
        -
        Parameters:
        -
        port - the port to which to bind the ServerSocket
        -
        Returns:
        -
        the ServerSocket
        -
        Throws:
        -
        java.lang.Exception - if a network error occurs
        -
        -
      • -
      - - - -
        -
      • -

        createServerSocket

        -
        public java.net.ServerSocket createServerSocket​(int port,
        -                                                java.lang.String address)
        -                                         throws java.lang.Exception
        -
        Returns a server socket bound to the specified port. The socket is - configured with the socket options given to this factory.
        -
        -
        Parameters:
        -
        port - the port to which to bind the ServerSocket
        -
        address - String
        -
        Returns:
        -
        the ServerSocket
        -
        Throws:
        -
        java.lang.Exception - if a network error occurs
        -
        -
      • -
      - - - -
        -
      • -

        createSocket

        -
        public java.net.Socket createSocket​(java.net.Socket socket,
        -                                    java.lang.String host,
        -                                    int port)
        -                             throws java.lang.Exception
        -
        If socket argument is not null, returns it. If it is null, - creates a socket and connects it to the specified remote host at the - specified remote port. This socket is configured using the socket options - established for this factory.
        -
        -
        Parameters:
        -
        socket - the existing socket, can be null
        -
        host - the server host
        -
        port - the server port
        -
        Returns:
        -
        the socket
        -
        Throws:
        -
        java.lang.Exception - if a network error occurs
        -
        -
      • -
      - - - -
        -
      • -

        createSocket

        -
        public java.net.Socket createSocket​(java.lang.String host,
        -                                    int port)
        -                             throws java.lang.Exception
        -
        Creates a socket and connects it to the specified remote host at the - specified remote port. This socket is configured using the socket options - established for this factory.
        -
        -
        Parameters:
        -
        host - the server host
        -
        port - the server port
        -
        Returns:
        -
        the socket
        -
        Throws:
        -
        java.lang.Exception - if a network error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isSecure

        -
        public boolean isSecure()
        -
        Retrieves whether this factory produces secure sockets.
        -
        -
        Returns:
        -
        true if this factory produces secure sockets
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketFactorySecure.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketFactorySecure.html deleted file mode 100644 index f56f61cc..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketFactorySecure.html +++ /dev/null @@ -1,472 +0,0 @@ - - - - - -HsqlSocketFactorySecure (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class HsqlSocketFactorySecure

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.util.EventListener, javax.net.ssl.HandshakeCompletedListener
    -
    -
    -
    public final class HsqlSocketFactorySecure
    -extends HsqlSocketFactory
    -implements javax.net.ssl.HandshakeCompletedListener
    -
    The default secure socket factory implementation.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidconfigureSocket​(java.net.Socket socket) 
      java.net.ServerSocketcreateServerSocket​(int port) -
      Creates a secure server socket bound to the specified port.
      -
      java.net.ServerSocketcreateServerSocket​(int port, - java.lang.String address) -
      Creates a secure server socket bound to the specified port.
      -
      java.net.SocketcreateSocket​(java.lang.String host, - int port) -
      Creates a secure Socket and connects it to the specified remote host - at the specified remote port.
      -
      java.net.SocketcreateSocket​(java.net.Socket socket, - java.lang.String host, - int port) -
      if socket argument is not null, creates a secure Socket as a wrapper for - the normal, non-SSL socket.
      -
      voidhandshakeCompleted​(javax.net.ssl.HandshakeCompletedEvent evt) 
      booleanisSecure() -
      Retrieves whether this factory produces secure sockets.
      -
      - -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - - - - - -
        -
      • -

        createServerSocket

        -
        public java.net.ServerSocket createServerSocket​(int port)
        -                                         throws java.lang.Exception
        -
        Creates a secure server socket bound to the specified port. - The socket is configured with the socket options - given to this factory.
        -
        -
        Overrides:
        -
        createServerSocket in class HsqlSocketFactory
        -
        Parameters:
        -
        port - the port to which to bind the secure ServerSocket
        -
        Returns:
        -
        the secure ServerSocket
        -
        Throws:
        -
        java.lang.Exception - if a network or security provider error occurs
        -
        -
      • -
      - - - -
        -
      • -

        createServerSocket

        -
        public java.net.ServerSocket createServerSocket​(int port,
        -                                                java.lang.String address)
        -                                         throws java.lang.Exception
        -
        Creates a secure server socket bound to the specified port. - The socket is configured with the socket options - given to this factory.
        -
        -
        Overrides:
        -
        createServerSocket in class HsqlSocketFactory
        -
        Parameters:
        -
        port - the port to which to bind the secure ServerSocket
        -
        address - String
        -
        Returns:
        -
        the secure ServerSocket
        -
        Throws:
        -
        java.lang.Exception - if a network or security provider error occurs
        -
        -
      • -
      - - - -
        -
      • -

        createSocket

        -
        public java.net.Socket createSocket​(java.net.Socket socket,
        -                                    java.lang.String host,
        -                                    int port)
        -                             throws java.lang.Exception
        -
        if socket argument is not null, creates a secure Socket as a wrapper for - the normal, non-SSL socket. If the socket is null, create a new secure - socket. The secure socket is configured using the - socket options established for this factory.
        -
        -
        Overrides:
        -
        createSocket in class HsqlSocketFactory
        -
        Parameters:
        -
        socket - the existing socket
        -
        host - the server host
        -
        port - the server port
        -
        Returns:
        -
        the socket
        -
        Throws:
        -
        java.lang.Exception - if a network or security provider error occurs
        -
        -
      • -
      - - - -
        -
      • -

        createSocket

        -
        public java.net.Socket createSocket​(java.lang.String host,
        -                                    int port)
        -                             throws java.lang.Exception
        -
        Creates a secure Socket and connects it to the specified remote host - at the specified remote port. This socket is configured using the - socket options established for this factory.
        -
        -
        Overrides:
        -
        createSocket in class HsqlSocketFactory
        -
        Parameters:
        -
        host - the server host
        -
        port - the server port
        -
        Returns:
        -
        the socket
        -
        Throws:
        -
        java.lang.Exception - if a network or security provider error occurs
        -
        -
      • -
      - - - -
        -
      • -

        isSecure

        -
        public boolean isSecure()
        -
        Retrieves whether this factory produces secure sockets.
        -
        -
        Overrides:
        -
        isSecure in class HsqlSocketFactory
        -
        Returns:
        -
        true iff this factory creates secure sockets
        -
        -
      • -
      - - - -
        -
      • -

        handshakeCompleted

        -
        public void handshakeCompleted​(javax.net.ssl.HandshakeCompletedEvent evt)
        -
        -
        Specified by:
        -
        handshakeCompleted in interface javax.net.ssl.HandshakeCompletedListener
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketRequestHandler.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketRequestHandler.html deleted file mode 100644 index bdc1dfb8..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/HsqlSocketRequestHandler.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - -HsqlSocketRequestHandler (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface HsqlSocketRequestHandler

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    Server, WebServer
    -
    -
    -
    public interface HsqlSocketRequestHandler
    -
    Interface HsqlSocketRequestHandler
    -
    -
    Since:
    -
    1.7.0
    -
    Author:
    -
    paul-h@users
    -
    See Also:
    -
    Server
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        handleConnection

        -
        void handleConnection​(java.net.Socket socket)
        -
      • -
      - - - -
        -
      • -

        signalCloseAllServerConnections

        -
        void signalCloseAllServerConnections()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/OdbcUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/OdbcUtil.html deleted file mode 100644 index bdea350f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/OdbcUtil.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - -OdbcUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class OdbcUtil

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.server.OdbcUtil
    • -
    -
  • -
-
-
    -
  • -
    -
    public class OdbcUtil
    -extends java.lang.Object
    -
    Static values and methods to facilitate servicing ODBC clients.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      OdbcUtil() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static shortgetIdForColumn​(int colIndex, - org.hsqldb.result.ResultMetaData md) -
      Temporary hack.
      -
      static intgetTableOidForColumn​(int colIndex, - org.hsqldb.result.ResultMetaData md) 
      static java.lang.StringhexCharsToOctalOctets​(java.lang.String hexChars) 
      static voidmain​(java.lang.String[] sa) 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        OdbcUtil

        -
        public OdbcUtil()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getTableOidForColumn

        -
        public static int getTableOidForColumn​(int colIndex,
        -                                       org.hsqldb.result.ResultMetaData md)
        -
      • -
      - - - -
        -
      • -

        getIdForColumn

        -
        public static short getIdForColumn​(int colIndex,
        -                                   org.hsqldb.result.ResultMetaData md)
        -
        Temporary hack. - - This ID should stick with the table - column. Here, it will change based on user-specified column label. - The int has is also being truncated into a short.
        -
        -
        Parameters:
        -
        colIndex - int
        -
        md - ResultMetaData
        -
        Returns:
        -
        short
        -
        -
      • -
      - - - -
        -
      • -

        hexCharsToOctalOctets

        -
        public static java.lang.String hexCharsToOctalOctets​(java.lang.String hexChars)
        -
        -
        Parameters:
        -
        hexChars - A String containing an EVEN number of hex characters.
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] sa)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/PgType.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/PgType.html deleted file mode 100644 index 8397306c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/PgType.html +++ /dev/null @@ -1,1464 +0,0 @@ - - - - - -PgType (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class PgType

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.server.PgType
    • -
    -
  • -
-
-
    -
  • -
    -
    public class PgType
    -extends java.lang.Object
    -
    Postgres types.
    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
- -
-
- -
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/Server.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/Server.html deleted file mode 100644 index c7ffd475..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/Server.html +++ /dev/null @@ -1,1753 +0,0 @@ - - - - - -Server (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class Server

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.server.Server
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Notified, HsqlSocketRequestHandler
    -
    -
    -
    Direct Known Subclasses:
    -
    WebServer
    -
    -
    -
    public class Server
    -extends java.lang.Object
    -implements HsqlSocketRequestHandler, Notified
    -
    The HyperSQL hsql: and hsqls: protocol network database server.

    - - A Server object acts as a network database server and is one way of using - the client-server mode of HSQLDB Database Engine. Instances of this - class handle native HSQL protocol connections exclusively, allowing database - queries to be performed efficiently across the network. Server's direct - descendant, WebServer, handles HTTP protocol connections exclusively, - allowing HSQL protocol to be tunnelled over HTTP to avoid sandbox and - firewall issues, albeit less efficiently.

    - - There are a number of ways to configure and start a Server instance.

    - - When started from the command line or programatically via the main(String[]) - method, configuration occurs in three phases, with later phases overriding - properties set by previous phases: - -

      -
    1. Upon construction, a Server object is assigned a set of default - properties. - -
    2. If it exists, properties are loaded from a file named - 'server.properties' in the present working directory. - -
    3. The command line arguments (alternatively, the String[] passed to - main()) are parsed and used to further configure the Server's - properties. - -

    - - From the command line, the options are as follows: -

    - +-----------------+-------------+----------+------------------------------+
    - |    OPTION       |    TYPE     | DEFAULT  |         DESCRIPTION          |
    - +-----------------+-------------+----------+------------------------------|
    - | --help          |             |          | prints this message          |
    - | --address       | name|number | any      | server inet address          |
    - | --port          | number      | 9001/544 | port at which server listens |
    - | --database.i    | [type]spec  | 0=test   | path of database i           |
    - | --dbname.i      | alias       |          | url alias for database i     |
    - | --silent        | true|false  | true     | false => display all queries |
    - | --trace         | true|false  | false    | display JDBC trace messages  |
    - | --tls           | true|false  | false    | TLS/SSL (secure) sockets     |
    - | --no_system_exit| true|false  | false    | do not issue System.exit()   |
    - | --remote_open   | true|false  | false    | can open databases remotely  |
    - | --props         | filepath    |          | file path of properties file |
    - +-----------------+-------------+----------+------------------------------+
    - 
    - - The database.i and dbname.i options need further - explanation: - -
      -
    • Multiple databases can be served by each instance of the Server. - The value of i is currently limited to the range 0..9, - allowing up to 10 different databases. Any number is this range - can be used. - -
    • The value assigned to database.i is interpreted using the - format '[type]spec', where the optional type component - is one of 'file:', 'res:' or 'mem:' and the - spec component is interpreted in the context of the - type component.

      - - If omitted, the type component is taken to be - 'file:'.

      - - A full description of how - '[type]spec' values are interpreted appears in the overview for - JDBCConnection. - -

    • The value assigned to dbname.i is taken to be the key used to - look up the desired database instance and thus corresponds to the - <alias> component of the HSQLDB HSQL protocol database - connection url: - 'jdbc:hsqldb:hsql[s]://host[port][/<alias>]'. - -
    • The value of database.0 is special. If dbname.0 - is not specified, then this defaults to an empty string and - a connection is made to database.0 path when - the <alias> component of an HSQLDB HSQL protocol database - connection url is omitted. If a database key/value pair is - found in the properties when the main method is called, this - pair is supersedes the database.0 setting

      - - This behaviour allows the previous - database connection url format to work with essentially unchanged - semantics. - -

    • When the remote_open property is true, a connection attempt - to an unopened database results in the database being opened. The URL - for connection should include the property filepath to specify the path. - 'jdbc:hsqldb:hsql[s]://host[port]/<alias>;filepath=hsqldb:file:<database path>'. - the given alias and filepath value will be associated together. The - database user and password to start this connection must be valid. - If this form of connection is used again, after the database has been - opened, the filepath property is ignored. - -
    • Once an alias such as "mydb" has been associated with a path, it cannot - be reassigned to a different path. - -
    • If a database is closed with the SHUTDOWN command, its - alias is removed. It is then possible to connect to this database again - with a different (or the same) alias. - -
    • If the same database is connected to via two different - aliases, and then one of the is closed with the SHUTDOWN command, the - other is also closed.

      -

    - - From the 'server.properties' file, options can be set similarly, using a - slightly different format.

    - - Here is an example 'server.properties' file: - -

    - server.port=9001
    - server.database.0=test
    - server.dbname.0=...
    - ...
    - server.database.n=...
    - server.dbname.n=...
    - server.silent=true
    - 
    - - Starting with 1.7.2, Server has been refactored to become a simple JavaBean - with non-blocking start() and stop() service methods. It is possible to - configure a Server instance through the JavaBean API as well, but this - part of the public interface is still under review and will not be finalized - or documented fully until the final 1.7.2 release.

    - - Note:

    - - The 'no_system_exit' property is of particular interest.

    - - If a Server instance is to run embedded in, say, an application server, - such as when the JDBCDataSource or HsqlServerFactory classes are used, it - is typically necessary to avoid calling System.exit() when the Server - instance shuts down.

    - - By default, 'no_system_exit' is set: - -

      -
    1. true when a Server is started directly from the start() - method. - -
    2. false when a Server is started from the main(String[]) - method. -

    - - These values are natural to their context because the first case allows - the JVM to exit by default on Server shutdown when a Server instance is - started from a command line environment, whereas the second case prevents - a typically unwanted JVM exit on Server shutdown when a Server instance - is started as part of a larger framework.

    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      Server() -
      Creates a new Server instance handling HSQL protocol connections.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidcheckRunning​(boolean running) -
      Checks if this Server object is or is not running and throws if the - current state does not match the specified value.
      -
      java.lang.StringgetAddress() -
      Retrieves, in string form, this server's host address.
      -
      java.lang.StringgetDatabaseName​(int index, - boolean asconfigured) -
      Retrieves the url alias (network name) of the i'th database - that this Server hosts.
      -
      java.lang.StringgetDatabasePath​(int index, - boolean asconfigured) -
      Retrieves the HSQLDB path descriptor (uri) of the i'th - Database that this Server hosts.
      -
      java.lang.StringgetDatabaseType​(int index) 
      java.lang.StringgetDefaultWebPage() -
      Retrieves the name of the web page served when no page is specified.
      -
      java.io.PrintWritergetErrWriter() -
      Retrieves the PrintWriter to which server errors are printed.
      -
      java.lang.StringgetHelpString() -
      Retrieves a String object describing the command line and - properties options for this Server.
      -
      intgetLocalPort() -
      Retrieves this server socket's actual host port.
      -
      java.io.PrintWritergetLogWriter() -
      Retrieves the PrintWriter to which server messages are printed.
      -
      intgetPort() -
      Retrieves this server's host port as configured.
      -
      java.lang.StringgetProductName() -
      Retrieves this server's product name.
      -
      java.lang.StringgetProductVersion() -
      Retrieves the server's product version, as a String.
      -
      java.lang.StringgetProtocol() -
      Retrieves a string resresentaion of the network protocol - this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.
      -
      java.lang.ThrowablegetServerError() -
      Retrieves a Throwable indicating the last server error, if any.
      -
      java.lang.StringgetServerId() -
      Retrieves a String identifying this Server object.
      -
      java.lang.ThreadgetServerThread() -
      Returns thread object for "HSQLDB Server" thread
      -
      intgetState() -
      Retrieves current state of this server in numerically coded form.
      -
      java.lang.StringgetStateDescriptor() -
      Retrieves a character sequence describing this server's current state, - including the message of the last exception, if there is one and it - is still in context.
      -
      java.lang.StringgetWebRoot() -
      Retrieves the root context (directory) from which web content - is served.
      -
      voidhandleConnection​(java.net.Socket s) -
      Assigns the specified socket to a new connection handler and - starts the handler in a new Thread.
      -
      booleanisNoSystemExit() -
      Retrieves whether this server calls System.exit() when shutdown.
      -
      booleanisNotRunning() -
      Returns true if this server is not running
      -
      booleanisRestartOnShutdown() -
      Retrieves whether this server restarts on shutdown.
      -
      booleanisSilent() -
      Retrieves whether silent mode operation was requested in - the server properties.
      -
      booleanisTls() -
      Retrieves whether the use of secure sockets was requested in the - server properties.
      -
      booleanisTrace() -
      Retrieves whether JDBC trace messages are to go to System.out or the - DriverManger PrintStream/PrintWriter, if any.
      -
      static voidmain​(java.lang.String[] args) -
      Creates and starts a new Server.
      -
      voidnotify​(int id) -
      This is called from org.hsqldb.DatabaseManager when a database is - shutdown.
      -
      booleanputPropertiesFromFile​(java.lang.String path) -
      Attempts to put properties from the file - with the specified path.
      -
      booleanputPropertiesFromFile​(java.lang.String path, - java.lang.String extension) -
      Attempts to put properties from the file with given extension.
      -
      voidputPropertiesFromString​(java.lang.String s) -
      Puts properties from the supplied string argument.
      -
      voidsetAddress​(java.lang.String address) -
      Sets the InetAddress with which this server's ServerSocket will be - constructed.
      -
      voidsetDaemon​(boolean daemon) -
      No-op as deprecated.
      -
      voidsetDatabaseName​(int index, - java.lang.String name) -
      Sets the external name (url alias) of the i'th hosted database.
      -
      voidsetDatabasePath​(int index, - java.lang.String path) -
      Sets the path of the hosted database.
      -
      voidsetDefaultWebPage​(java.lang.String file) -
      Sets the name of the web page served when no page is specified.
      -
      voidsetErrWriter​(java.io.PrintWriter pw) -
      Sets the PrintWriter to which server errors are logged.
      -
      voidsetLogWriter​(java.io.PrintWriter pw) -
      Sets the PrintWriter to which server messages are logged.
      -
      voidsetNoSystemExit​(boolean noExit) -
      Sets whether this server calls System.exit() when shutdown.
      -
      voidsetPort​(int port) -
      Sets the server listen port.
      -
      voidsetProperties​(java.util.Properties props) -
      Sets server properties using the specified properties object
      -
      voidsetProperties​(org.hsqldb.persist.HsqlProperties props) -
      Sets server properties using the specified HsqlProperties object
      -
      voidsetRestartOnShutdown​(boolean restart) -
      Sets whether this server restarts on shutdown.
      -
      voidsetSilent​(boolean silent) -
      Sets silent mode operation
      -
      voidsetTls​(boolean tls) -
      Sets whether to use secure sockets
      -
      voidsetTrace​(boolean trace) -
      Sets whether trace messages go to System.out or the - DriverManger PrintStream/PrintWriter, if any.
      -
      voidsetWebRoot​(java.lang.String root) -
      Sets the path of the root directory from which web content is served.
      -
      voidshutdown() -
      External method to shut down this server.
      -
      voidshutdownCatalogs​(int shutdownMode) -
      Shuts down all the database served by this server.
      -
      voidshutdownWithCatalogs​(int shutdownMode) -
      Shuts down this server and all the database served by this server.
      -
      voidsignalCloseAllServerConnections() -
      Closes all connections to this Server.
      -
      intstart() -
      Starts this server synchronously.
      -
      intstop() -
      Stops this server asynchronously.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Server

        -
        public Server()
        -
        Creates a new Server instance handling HSQL protocol connections.
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getServerThread

        -
        public java.lang.Thread getServerThread()
        -
        Returns thread object for "HSQLDB Server" thread
        -
        -
        Returns:
        -
        thread
        -
        -
      • -
      - - - -
        -
      • -

        checkRunning

        -
        public void checkRunning​(boolean running)
        -
        Checks if this Server object is or is not running and throws if the - current state does not match the specified value.
        -
        -
        Parameters:
        -
        running - if true, ensure the server is running, else ensure the - server is not running
        -
        Throws:
        -
        org.hsqldb.HsqlException - if the supplied value does not match the - current running status
        -
        -
      • -
      - - - -
        -
      • -

        isNotRunning

        -
        public boolean isNotRunning()
        -
        Returns true if this server is not running
        -
        -
        Returns:
        -
        boolean
        -
        -
      • -
      - - - - - - - -
        -
      • -

        getAddress

        -
        public java.lang.String getAddress()
        -
        Retrieves, in string form, this server's host address.
        -
        -
        Returns:
        -
        this server's host address
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseName

        -
        public java.lang.String getDatabaseName​(int index,
        -                                        boolean asconfigured)
        -
        Retrieves the url alias (network name) of the i'th database - that this Server hosts.
        -
        -
        Parameters:
        -
        index - the index of the url alias upon which to report
        -
        asconfigured - if true, report the configured value, else - the live value
        -
        Returns:
        -
        the url alias component of the i'th database - that this Server hosts, or null if no such name exists.
        -
        -
      • -
      - - - -
        -
      • -

        getDatabasePath

        -
        public java.lang.String getDatabasePath​(int index,
        -                                        boolean asconfigured)
        -
        Retrieves the HSQLDB path descriptor (uri) of the i'th - Database that this Server hosts.
        -
        -
        Parameters:
        -
        index - the index of the uri upon which to report
        -
        asconfigured - if true, report the configured value, else - the live value
        -
        Returns:
        -
        the HSQLDB database path descriptor of the i'th database - that this Server hosts, or null if no such path descriptor - exists
        -
        -
      • -
      - - - -
        -
      • -

        getDatabaseType

        -
        public java.lang.String getDatabaseType​(int index)
        -
      • -
      - - - -
        -
      • -

        getDefaultWebPage

        -
        public java.lang.String getDefaultWebPage()
        -
        Retrieves the name of the web page served when no page is specified. - This attribute is relevant only when server protocol is HTTP(S).
        -
        -
        Returns:
        -
        the name of the web page served when no page is specified
        -
        -
      • -
      - - - -
        -
      • -

        getHelpString

        -
        public java.lang.String getHelpString()
        -
        Retrieves a String object describing the command line and - properties options for this Server.
        -
        -
        Returns:
        -
        the command line and properties options help for this Server
        -
        -
      • -
      - - - -
        -
      • -

        getErrWriter

        -
        public java.io.PrintWriter getErrWriter()
        -
        Retrieves the PrintWriter to which server errors are printed.
        -
        -
        Returns:
        -
        the PrintWriter to which server errors are printed.
        -
        -
      • -
      - - - -
        -
      • -

        getLogWriter

        -
        public java.io.PrintWriter getLogWriter()
        -
        Retrieves the PrintWriter to which server messages are printed.
        -
        -
        Returns:
        -
        the PrintWriter to which server messages are printed.
        -
        -
      • -
      - - - -
        -
      • -

        getPort

        -
        public int getPort()
        -
        Retrieves this server's host port as configured.
        -
        -
        Returns:
        -
        this server's host port as configured
        -
        -
      • -
      - - - -
        -
      • -

        getLocalPort

        -
        public int getLocalPort()
        -
        Retrieves this server socket's actual host port.
        -
        -
        Returns:
        -
        this server socket's actual host port
        -
        -
      • -
      - - - -
        -
      • -

        getProductName

        -
        public java.lang.String getProductName()
        -
        Retrieves this server's product name.

        - - Typically, this will be something like: "HSQLDB xxx server".

        -
        -
        Returns:
        -
        the product name of this server
        -
        -
      • -
      - - - -
        -
      • -

        getProductVersion

        -
        public java.lang.String getProductVersion()
        -
        Retrieves the server's product version, as a String.

        - - Typically, this will be something like: "1.x.x" or "2.x.x" and so on.

        -
        -
        Returns:
        -
        the product version of the server
        -
        -
      • -
      - - - -
        -
      • -

        getProtocol

        -
        public java.lang.String getProtocol()
        -
        Retrieves a string resresentaion of the network protocol - this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.
        -
        -
        Returns:
        -
        string representation of this server's protocol
        -
        -
      • -
      - - - -
        -
      • -

        getServerError

        -
        public java.lang.Throwable getServerError()
        -
        Retrieves a Throwable indicating the last server error, if any.

        -
        -
        Returns:
        -
        a Throwable indicating the last server error
        -
        -
      • -
      - - - -
        -
      • -

        getServerId

        -
        public java.lang.String getServerId()
        -
        Retrieves a String identifying this Server object.
        -
        -
        Returns:
        -
        a String identifying this Server object
        -
        -
      • -
      - - - -
        -
      • -

        getState

        -
        public int getState()
        -
        Retrieves current state of this server in numerically coded form.

        - - Typically, this will be one of: - -

          -
        1. ServerProperties.SERVER_STATE_ONLINE (1) -
        2. ServerProperties.SERVER_STATE_OPENING (4) -
        3. ServerProperties.SERVER_STATE_CLOSING (8) -
        4. ServerProperties.SERVER_STATE_SHUTDOWN (16) -
        -
        -
        Returns:
        -
        this server's state code.
        -
        -
      • -
      - - - -
        -
      • -

        getStateDescriptor

        -
        public java.lang.String getStateDescriptor()
        -
        Retrieves a character sequence describing this server's current state, - including the message of the last exception, if there is one and it - is still in context.
        -
        -
        Returns:
        -
        this server's state represented as a character sequence.
        -
        -
      • -
      - - - -
        -
      • -

        getWebRoot

        -
        public java.lang.String getWebRoot()
        -
        Retrieves the root context (directory) from which web content - is served. This property is relevant only when the server - protocol is HTTP(S). Although unlikely, it may be that in the future - other contexts, such as jar urls may be supported, so that pages can - be served from the contents of a jar or from the JVM class path.
        -
        -
        Returns:
        -
        the root context (directory) from which web content is served
        -
        -
      • -
      - - - -
        -
      • -

        handleConnection

        -
        public void handleConnection​(java.net.Socket s)
        -
        Assigns the specified socket to a new connection handler and - starts the handler in a new Thread.
        -
        -
        Specified by:
        -
        handleConnection in interface HsqlSocketRequestHandler
        -
        Parameters:
        -
        s - the socket to connect
        -
        -
      • -
      - - - -
        -
      • -

        isNoSystemExit

        -
        public boolean isNoSystemExit()
        -
        Retrieves whether this server calls System.exit() when shutdown.
        -
        -
        Returns:
        -
        true if this server does not call System.exit()
        -
        -
      • -
      - - - -
        -
      • -

        isRestartOnShutdown

        -
        public boolean isRestartOnShutdown()
        -
        Retrieves whether this server restarts on shutdown.
        -
        -
        Returns:
        -
        true this server restarts on shutdown
        -
        -
      • -
      - - - -
        -
      • -

        isSilent

        -
        public boolean isSilent()
        -
        Retrieves whether silent mode operation was requested in - the server properties.
        -
        -
        Returns:
        -
        if true, silent mode was requested, else trace messages - are to be printed
        -
        -
      • -
      - - - -
        -
      • -

        isTls

        -
        public boolean isTls()
        -
        Retrieves whether the use of secure sockets was requested in the - server properties.
        -
        -
        Returns:
        -
        if true, secure sockets are requested, else not
        -
        -
      • -
      - - - -
        -
      • -

        isTrace

        -
        public boolean isTrace()
        -
        Retrieves whether JDBC trace messages are to go to System.out or the - DriverManger PrintStream/PrintWriter, if any.
        -
        -
        Returns:
        -
        true if tracing is on (JDBC trace messages to system out)
        -
        -
      • -
      - - - -
        -
      • -

        putPropertiesFromFile

        -
        public boolean putPropertiesFromFile​(java.lang.String path)
        -
        Attempts to put properties from the file - with the specified path. The file - extension '.properties' is implicit and should not - be included in the path specification.
        -
        -
        Parameters:
        -
        path - the path of the desired properties file, without the - '.properties' file extension
        -
        Returns:
        -
        true if the indicated file was read successfully, else false
        -
        Throws:
        -
        org.hsqldb.HsqlException - if this server is running
        -
        -
      • -
      - - - -
        -
      • -

        putPropertiesFromFile

        -
        public boolean putPropertiesFromFile​(java.lang.String path,
        -                                     java.lang.String extension)
        -
        Attempts to put properties from the file with given extension.
        -
        -
        Parameters:
        -
        path - the path of the desired properties file.
        -
        extension - extension to add to path
        -
        Returns:
        -
        true if the indicated file was read successfully, else false
        -
        Throws:
        -
        org.hsqldb.HsqlException - if this server is running
        -
        -
      • -
      - - - -
        -
      • -

        putPropertiesFromString

        -
        public void putPropertiesFromString​(java.lang.String s)
        -
        Puts properties from the supplied string argument. The relevant - key value pairs are the same as those for the (web)server.properties - file format, except that the 'server.' prefix should not be specified.
        -
        -
        Parameters:
        -
        s - semicolon-delimited key=value pair string, - e.g. silent=false;port=8080;...
        -
        Throws:
        -
        org.hsqldb.HsqlException - if this server is running
        -
        -
      • -
      - - - -
        -
      • -

        setAddress

        -
        public void setAddress​(java.lang.String address)
        -
        Sets the InetAddress with which this server's ServerSocket will be - constructed. A null or empty string or the special value "0.0.0.0" - can be used to bypass explicit selection, causing the ServerSocket - to be constructed without specifying an InetAddress.
        -
        -
        Parameters:
        -
        address - A string representing the desired InetAddress as would - be retrieved by InetAddres.getByName(), or a null or empty string - or "0.0.0.0" to signify that the server socket should be constructed - using the signature that does not specify the InetAddress.
        -
        Throws:
        -
        org.hsqldb.HsqlException - if this server is running
        -
        -
      • -
      - - - -
        -
      • -

        setDatabaseName

        -
        public void setDatabaseName​(int index,
        -                            java.lang.String name)
        -
        Sets the external name (url alias) of the i'th hosted database.
        -
        -
        Parameters:
        -
        index - int
        -
        name - external name (url alias) of the i'th HSQLDB database - instance this server is to host.
        -
        -
      • -
      - - - -
        -
      • -

        setDatabasePath

        -
        public void setDatabasePath​(int index,
        -                            java.lang.String path)
        -
        Sets the path of the hosted database. The path always starts with the - catalog type. Examples of the path include: "file:mydir/mydb", - "mem:mymemdb", "res:org/mydomain/mydbs/settingsdb".
        -
        -
        Parameters:
        -
        index - int
        -
        path - The path of the i'th HSQLDB database instance this server is - to host.
        -
        -
      • -
      - - - -
        -
      • -

        setDefaultWebPage

        -
        public void setDefaultWebPage​(java.lang.String file)
        -
        Sets the name of the web page served when no page is specified.
        -
        -
        Parameters:
        -
        file - the name of the web page served when no page is specified
        -
        -
      • -
      - - - -
        -
      • -

        setPort

        -
        public void setPort​(int port)
        -
        Sets the server listen port.
        -
        -
        Parameters:
        -
        port - the port at which this server listens
        -
        -
      • -
      - - - -
        -
      • -

        setErrWriter

        -
        public void setErrWriter​(java.io.PrintWriter pw)
        -
        Sets the PrintWriter to which server errors are logged.

        - - Setting this attribute to null disables server error logging

        -
        -
        Parameters:
        -
        pw - the PrintWriter to which server messages are logged
        -
        -
      • -
      - - - -
        -
      • -

        setLogWriter

        -
        public void setLogWriter​(java.io.PrintWriter pw)
        -
        Sets the PrintWriter to which server messages are logged.

        - - Setting this attribute to null disables server message logging

        -
        -
        Parameters:
        -
        pw - the PrintWriter to which server messages are logged
        -
        -
      • -
      - - - -
        -
      • -

        setNoSystemExit

        -
        public void setNoSystemExit​(boolean noExit)
        -
        Sets whether this server calls System.exit() when shutdown.
        -
        -
        Parameters:
        -
        noExit - if true, System.exit() will not be called.
        -
        -
      • -
      - - - -
        -
      • -

        setRestartOnShutdown

        -
        public void setRestartOnShutdown​(boolean restart)
        -
        Sets whether this server restarts on shutdown.
        -
        -
        Parameters:
        -
        restart - if true, this server restarts on shutdown
        -
        -
      • -
      - - - -
        -
      • -

        setSilent

        -
        public void setSilent​(boolean silent)
        -
        Sets silent mode operation
        -
        -
        Parameters:
        -
        silent - if true, then silent mode, else trace messages - are to be printed
        -
        -
      • -
      - - - -
        -
      • -

        setTls

        -
        public void setTls​(boolean tls)
        -
        Sets whether to use secure sockets
        -
        -
        Parameters:
        -
        tls - true for secure sockets, else false
        -
        Throws:
        -
        org.hsqldb.HsqlException - if this server is running
        -
        -
      • -
      - - - -
        -
      • -

        setTrace

        -
        public void setTrace​(boolean trace)
        -
        Sets whether trace messages go to System.out or the - DriverManger PrintStream/PrintWriter, if any.
        -
        -
        Parameters:
        -
        trace - if true, route JDBC trace messages to System.out
        -
        -
      • -
      - - - -
        -
      • -

        setDaemon

        -
        public void setDaemon​(boolean daemon)
        -
        No-op as deprecated.
        -
        -
        Parameters:
        -
        daemon - ignored
        -
        -
      • -
      - - - -
        -
      • -

        setWebRoot

        -
        public void setWebRoot​(java.lang.String root)
        -
        Sets the path of the root directory from which web content is served.
        -
        -
        Parameters:
        -
        root - the root (context) directory from which web content - is served
        -
        -
      • -
      - - - -
        -
      • -

        setProperties

        -
        public void setProperties​(java.util.Properties props)
        -                   throws java.io.IOException,
        -                          ServerAcl.AclFormatException
        -
        Sets server properties using the specified properties object
        -
        -
        Parameters:
        -
        props - The object containing properties to set
        -
        Throws:
        -
        ServerAcl.AclFormatException - ACL list was requested but problem loading ACL.
        -
        java.io.IOException - ACL list was requested but I/O problem loading ACL.
        -
        -
      • -
      - - - -
        -
      • -

        setProperties

        -
        public void setProperties​(org.hsqldb.persist.HsqlProperties props)
        -                   throws java.io.IOException,
        -                          ServerAcl.AclFormatException
        -
        Sets server properties using the specified HsqlProperties object
        -
        -
        Parameters:
        -
        props - The HsqlProperties object containing properties to set
        -
        Throws:
        -
        ServerAcl.AclFormatException - ACL list was requested but problem loading ACL.
        -
        java.io.IOException - ACL list was requested but I/O problem loading ACL.
        -
        -
      • -
      - - - -
        -
      • -

        start

        -
        public int start()
        -
        Starts this server synchronously.

        - - This method waits for current state to change from - SERVER_STATE_OPENNING. In order to discover the success or failure - of this operation, server state must be polled or a subclass of Server - must be used that overrides the setState method to provide state - change notification.

        -
        -
        Returns:
        -
        the server state noted at entry to this method
        -
        -
      • -
      - - - -
        -
      • -

        stop

        -
        public int stop()
        -
        Stops this server asynchronously.

        - - This method returns immediately, regardless of current state. In order - to discover the success or failure of this operation, server state must - be polled or a subclass of Server must be used that overrides the - setState method to provide state change notification.

        -
        -
        Returns:
        -
        the server state noted at entry to this method
        -
        -
      • -
      - - - -
        -
      • -

        notify

        -
        public final void notify​(int id)
        -
        This is called from org.hsqldb.DatabaseManager when a database is - shutdown. This shuts the server down if it is the last database
        -
        -
        Specified by:
        -
        notify in interface Notified
        -
        Parameters:
        -
        id - database id
        -
        -
      • -
      - - - -
        -
      • -

        shutdownCatalogs

        -
        public void shutdownCatalogs​(int shutdownMode)
        -
        Shuts down all the database served by this server. As a consequence, - this server and any other server that is serving a subset of the - databases will be shutdown, unless the server was started with - server.remote_open property. - - The shutdownMode must be one of: - -
          -
        • org.hsqldb.Database.CLOSEMODE_IMMEDIATELY = 1 -
        • org.hsqldb.Database.CLOSEMODE_NORMAL = 2 -
        • org.hsqldb.Database.CLOSEMODE_COMPACT = 3 -
        • org.hsqldb.Database.CLOSEMODE_SCRIPT = 4 -
        -
        -
        Parameters:
        -
        shutdownMode - a value between 1-4, usually 2 for NORMAL.
        -
        -
      • -
      - - - -
        -
      • -

        shutdownWithCatalogs

        -
        public void shutdownWithCatalogs​(int shutdownMode)
        -
        Shuts down this server and all the database served by this server. As a - consequence, any other server that is serving a subset of the databases - will be shutdown, unless the server was started with server.remote_open - property. - - The shutdownMode must be one of: - -
          -
        • org.hsqldb.Database.CLOSEMODE_IMMEDIATELY = 1 -
        • org.hsqldb.Database.CLOSEMODE_NORMAL = 2 -
        • org.hsqldb.Database.CLOSEMODE_COMPACT = 3 -
        • org.hsqldb.Database.CLOSEMODE_SCRIPT = 4 -
        -
        -
        Parameters:
        -
        shutdownMode - a value between 1-4, usually 2 for NORMAL.
        -
        -
      • -
      - - - -
        -
      • -

        shutdown

        -
        public void shutdown()
        -
        External method to shut down this server.
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] args)
        -
        Creates and starts a new Server.

        - - Allows starting a Server via the command line interface.

        -
        -
        Parameters:
        -
        args - the command line arguments for the Server instance
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerAcl.AclFormatException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerAcl.AclFormatException.html deleted file mode 100644 index 4b441a00..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerAcl.AclFormatException.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - -ServerAcl.AclFormatException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ServerAcl.AclFormatException

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.lang.Throwable
    • -
    • -
        -
      • java.lang.Exception
      • -
      • -
          -
        • org.hsqldb.server.ServerAcl.AclFormatException
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable
    -
    -
    -
    Enclosing class:
    -
    ServerAcl
    -
    -
    -
    public static final class ServerAcl.AclFormatException
    -extends java.lang.Exception
    -
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      AclFormatException​(java.lang.String s) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      -
        -
      • - - -

        Methods inherited from class java.lang.Throwable

        -addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        AclFormatException

        -
        public AclFormatException​(java.lang.String s)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerAcl.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerAcl.html deleted file mode 100644 index b9d068d5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerAcl.html +++ /dev/null @@ -1,516 +0,0 @@ - - - - - -ServerAcl (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ServerAcl

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.server.ServerAcl
    • -
    -
  • -
-
-
    -
  • -
    -
    public final class ServerAcl
    -extends java.lang.Object
    -
    A list of ACL permit and deny entries with a permitAccess method - which tells whether candidate addresses are permitted or denied - by this ACL list. -

    - The ACL file is reloaded whenever a modification to it is detected. - If you copy in a file with an older file date, you will need to touch it. -

    - The public runtime method is permitAccess(). - The public setup method is the constructor. -

    - Each non-comment line in the ACL file must be a rule of the format: -

    
    -     {allow|deny} <ip_address>[/significant-bits]
    - 
    - For example -
    
    -     allow ahostname
    -     deny ahost.domain.com
    -     allow 127.0.0.1
    -     allow 2001:db8::/32
    - 
    - -

    - In order to detect bit specification mistakes, we require that - non-significant bits be zero in the values. - An undesirable consequence of this is, you can't use a specification like - the following to mean "all of the hosts on the same network as x.admc.com": -

    
    -     allow x.admc.com/24
    - 
    -
    -
    Since:
    -
    2.0.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    ServerAcl(File), -permitAccess(java.lang.String)
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ServerAcl​(java.io.File aclFile) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.lang.StringcolonNotation​(byte[] uba) 
      static java.lang.StringdottedNotation​(byte[] uba) 
      static voidmain​(java.lang.String[] sa) -
      Utility method that allows interactive testing of individual ACL records, - as well as the net effect of the ACL record list.
      -
      booleanpermitAccess​(byte[] addr) 
      booleanpermitAccess​(java.lang.String s) -
      Uses system network libraries to resolve the given String to an IP addr, - then determine whether this address is permitted or denied.
      -
      voidsetPrintWriter​(java.io.PrintWriter pw) 
      java.lang.StringtoString() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        dottedNotation

        -
        public static java.lang.String dottedNotation​(byte[] uba)
        -
        -
        Parameters:
        -
        uba - Unsigned byte array
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        colonNotation

        -
        public static java.lang.String colonNotation​(byte[] uba)
        -
        -
        Parameters:
        -
        uba - Unsigned byte array
        -
        Returns:
        -
        String
        -
        -
      • -
      - - - -
        -
      • -

        setPrintWriter

        -
        public void setPrintWriter​(java.io.PrintWriter pw)
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        permitAccess

        -
        public boolean permitAccess​(java.lang.String s)
        -
        Uses system network libraries to resolve the given String to an IP addr, - then determine whether this address is permitted or denied. Specified - name may be a numerical-based String like "1.2.3.4", a constant known to - the networking libraries, or a host name to be resolved by the systems - name resolution system. If the given String can't be resolved to an IP - addr, false is returned.
        -
        -
        Parameters:
        -
        s - String
        -
        Returns:
        -
        boolean
        -
        See Also:
        -
        permitAccess(byte[])
        -
        -
      • -
      - - - -
        -
      • -

        permitAccess

        -
        public boolean permitAccess​(byte[] addr)
        -
        -
        Parameters:
        -
        addr - byte[]
        -
        Returns:
        -
        true if access for the candidate address should be permitted, - false if access should be denied.
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] sa)
        -                 throws ServerAcl.AclFormatException,
        -                        java.io.IOException
        -
        Utility method that allows interactive testing of individual ACL records, - as well as the net effect of the ACL record list. Run "java -cp - path/to/hsqldb.jar org.hsqldb.server.ServerAcl --help" for Syntax help.
        -
        -
        Parameters:
        -
        sa - String[]
        -
        Throws:
        -
        ServerAcl.AclFormatException - when badly formatted
        -
        java.io.IOException - when io error
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerConfiguration.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerConfiguration.html deleted file mode 100644 index c92a91c5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerConfiguration.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - -ServerConfiguration (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ServerConfiguration

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.server.ServerConfiguration
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    ServerConstants
    -
    -
    -
    public final class ServerConfiguration
    -extends java.lang.Object
    -implements ServerConstants
    -
    Assists with Server and WebServer configuration tasks.
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getDefaultPort

        -
        public static int getDefaultPort​(int protocol,
        -                                 boolean isTls)
        -
        Retrieves the default port that a Server will try to use in the - absence of an explicitly specified one, given the specified - value for whether or not to use secure sockets.
        -
        -
        Parameters:
        -
        protocol - the protocol specifier code of the Server
        -
        isTls - if true, retrieve the default port when using secure - sockets, else the default port when using plain sockets
        -
        Returns:
        -
        the default port used in the absence of an explicit - specification.
        -
        -
      • -
      - - - -
        -
      • -

        getPropertiesFromFile

        -
        public static ServerProperties getPropertiesFromFile​(int protocol,
        -                                                     java.lang.String path,
        -                                                     java.lang.String extension)
        -
        Retrieves a new HsqlProperties object, if possible, loaded from the - specified file.
        -
        -
        Parameters:
        -
        protocol - int
        -
        path - the file's path, without the .properties extension (which is - added automatically)
        -
        extension - String
        -
        Returns:
        -
        a new properties object loaded from the specified file
        -
        -
      • -
      - - - -
        -
      • -

        listLocalInetAddressNames

        -
        public static java.lang.String[] listLocalInetAddressNames()
        -
        Retrieves an array of Strings naming the distinct, known to be valid local - InetAddress names for this machine. The process is to collect and - return the union of the following sets: - -
          -
        1. InetAddress.getAllByName(InetAddress.getLocalHost().getHostAddress()) -
        2. InetAddress.getAllByName(InetAddress.getLocalHost().getHostName()) -
        3. InetAddress.getAllByName(InetAddress.getByName(null).getHostAddress()) -
        4. InetAddress.getAllByName(InetAddress.getByName(null).getHostName()) -
        5. InetAddress.getByName("loopback").getHostAddress() -
        6. InetAddress.getByName("loopback").getHostname() -
        -
        -
        Returns:
        -
        the distinct, known to be valid local - InetAddress names for this machine
        -
        -
      • -
      - - - -
        -
      • -

        newDefaultProperties

        -
        public static ServerProperties newDefaultProperties​(int protocol)
        -
        Retrieves a new default properties object for a server of the specified - protocol
        -
        -
        Parameters:
        -
        protocol - int
        -
        Returns:
        -
        a new default properties object
        -
        -
      • -
      - - - -
        -
      • -

        translateAddressProperty

        -
        public static void translateAddressProperty​(org.hsqldb.persist.HsqlProperties p)
        -
        Translates null or zero length value for address key to the - special value ServerConstants.SC_DEFAULT_ADDRESS which causes - ServerSockets to be constructed without specifying an InetAddress.
        -
        -
        Parameters:
        -
        p - The properties object upon which to perform the translation
        -
        -
      • -
      - - - -
        -
      • -

        translateDefaultDatabaseProperty

        -
        public static void translateDefaultDatabaseProperty​(org.hsqldb.persist.HsqlProperties p)
        -
        Translates the legacy default database form: database=... - to the 1.7.2 form: database.0=...
        -
        -
        Parameters:
        -
        p - The properties object upon which to perform the translation
        -
        -
      • -
      - - - -
        -
      • -

        translateDefaultNoSystemExitProperty

        -
        public static void translateDefaultNoSystemExitProperty​(org.hsqldb.persist.HsqlProperties p)
        -
        Translates unspecified no_system_exit property to false, the default - typically required when a Server is started from the command line.
        -
        -
        Parameters:
        -
        p - The properties object upon which to perform the translation
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerConstants.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerConstants.html deleted file mode 100644 index 4193e8a3..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerConstants.html +++ /dev/null @@ -1,676 +0,0 @@ - - - - - -ServerConstants (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface ServerConstants

-
-
-
-
    -
  • -
    -
    All Known Implementing Classes:
    -
    ServerConfiguration
    -
    -
    -
    public interface ServerConstants
    -
    An enumeration of the property keys and default property values used by - HSQLDB servers
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
- -
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerProperties.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerProperties.html deleted file mode 100644 index 055c5072..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/ServerProperties.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - -ServerProperties (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ServerProperties

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.persist.HsqlProperties
    • -
    • -
        -
      • org.hsqldb.server.ServerProperties
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    public class ServerProperties
    -extends org.hsqldb.persist.HsqlProperties
    -
    A subclass HsqlProperties with functionality needed for the HSQLDB Server - implementations.

    - - A property object is checked once and all the errors are stored in - collections to be used - - Meta records specify accepted keys and policies for the expected values.

    - - Policy for defaults:

      -
    • If (non-null) default is specified for the Meta record, then - behavior is obvious. -
    • If pattern-type Meta record, then there is no default. - A value is required for the property. -
    • Otherwise null is specified for the Meta record and user must set - a value. -
    - - If a range is specified in the Meta record, then the value is checked - against the range.

    - - If a set of values specified in the Meta record, then the value is checked - against the set.

    -
    -
    Since:
    -
    1.9.0
    -
    Author:
    -
    Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from class org.hsqldb.persist.HsqlProperties

        -org.hsqldb.persist.HsqlProperties.PropertyMeta
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class org.hsqldb.persist.HsqlProperties

        -ANY_ERROR, NO_VALUE_FOR_KEY
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      ServerProperties​(int protocol, - java.io.File file) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidvalidate() -
      Validates according to Meta map, and sets System Properties for those - properties with names matching the requisite pattern.
      -
      -
        -
      • - - -

        Methods inherited from class org.hsqldb.persist.HsqlProperties

        -addProperties, addProperties, argArrayToProps, delimitedArgPairsToProps, getErrorKeys, getIntegerProperty, getIntegerProperty, getProperties, getProperty, getProperty, isEmpty, isPropertyTrue, isPropertyTrue, load, newMeta, newMeta, newMeta, newMeta, newMeta, propertiesFileExists, propertyNames, removeProperty, save, save, setFileName, setProperty, setProperty, setProperty, setPropertyIfNotExists, toString, validateProperty
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        ServerProperties

        -
        public ServerProperties​(int protocol,
        -                        java.io.File file)
        -                 throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        validate

        -
        public void validate()
        -
        Validates according to Meta map, and sets System Properties for those - properties with names matching the requisite pattern.
        -
        -
        Overrides:
        -
        validate in class org.hsqldb.persist.HsqlProperties
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/WebServer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/WebServer.html deleted file mode 100644 index 2ac54c96..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/WebServer.html +++ /dev/null @@ -1,533 +0,0 @@ - - - - - -WebServer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class WebServer

-
-
- -
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    Notified, HsqlSocketRequestHandler
    -
    -
    -
    public class WebServer
    -extends Server
    -
    The HyperSQL http: and https: protocol network database server.

    - - WebServer has two distinct functions:

    - - The primary function is to allow client/server access to HSQLDB databases - via the HTTP protocol. This protocol is less efficient than the HSQL - protocol used by the Server class and should be used only in situations - where sandboxes or firewalls between the client and the server do not - allow the use of the HSQL protocol. One example is client/server access by - an applet running in browsers on remote hosts and accessing the database - engine on the HTTP server from which the applet originated. From version - 1.7.2, HTTP database connections are persistent and support transactions. - Similar to HSQL connections, they should be explicitly closed to free the - server resources.

    - - The secondary function of WebServer is to act as a simple general purpose - HTTP server. It is aimed to support the minimum requirements set out by - the HTTP/1.0 standard. The HEAD and GET methods can be used to query and - retrieve static files from the HTTP server.

    - - Both the database server and HTTP server functions of WebServer can be - configured with the webserver.properties file. It contains entries for the - database server similar to those for the HSQL protocol Server class. In - addition, a list mapping different file endings to their mime types may be - included in this file. (fredt@users)

    - - From the command line, the options are as follows: -

    - +-----------------+-------------+----------+------------------------------+
    - |    OPTION       |    TYPE     | DEFAULT  |         DESCRIPTION          |
    - +-----------------+-------------+----------+------------------------------|
    - | --help          |             |          | prints this message          |
    - | --address       | name|number | any      | server inet address          |
    - | --port          | number      | 80       | port at which server listens |
    - | --database.i    | [type]spec  | 0=test   | path of database i           |
    - | --dbname.i      | alias       |          | url alias for database i     |
    - | --silent        | true|false  | true     | false => display all queries |
    - | --trace         | true|false  | false    | display JDBC trace messages  |
    - | --no_system_exit| true|false  | false    | do not issue System.exit()   |
    - +-----------------+-------------+----------+------------------------------+
    - 
    - - Example of the webserver.properties file: - -
    - server.port=80
    - server.database.0=test
    - server.dbname.0=...
    - ...
    - server.database.n=...
    - server.dbname.n=...
    - server.silent=true
    -
    - .htm=text/html
    - .html=text/html
    - .txt=text/plain
    - .gif=image/gif
    - .class=application/octet-stream
    - .jpg=image/jpeg
    - .jgep=image/jpeg
    - .zip=application/x-zip-compressed
    - 
    - -
      -
    • For server.root, use '/' as the separator, even for DOS/Windows. -
    • File extensions for mime types must be lowercase and start with '.' -
    -
    -
    Since:
    -
    1.7.2
    -
    Author:
    -
    Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        WebServer

        -
        public WebServer()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] args)
        -
        Starts a new WebServer.
        -
        -
        Parameters:
        -
        args - the "command line" parameters with which to start - the WebServer. "-?" will cause the command line arguments - help to be printed to the standard output
        -
        -
      • -
      - - - -
        -
      • -

        getDefaultWebPage

        -
        public java.lang.String getDefaultWebPage()
        -
        Retrieves the name of the web page served when no page is specified. - This attribute is relevant only when server protocol is HTTP(S).
        -
        -
        Overrides:
        -
        getDefaultWebPage in class Server
        -
        Returns:
        -
        the name of the web page served when no page is specified
        -
        -
      • -
      - - - -
        -
      • -

        getHelpString

        -
        public java.lang.String getHelpString()
        -
        Retrieves a String object describing the command line and - properties options for this Server.
        -
        -
        Overrides:
        -
        getHelpString in class Server
        -
        Returns:
        -
        the command line and properties options help for this Server
        -
        -
      • -
      - - - -
        -
      • -

        getProductName

        -
        public java.lang.String getProductName()
        -
        Retrieves this server's product name.

        - - Typically, this will be something like: "HSQLDB xxx server".

        -
        -
        Overrides:
        -
        getProductName in class Server
        -
        Returns:
        -
        the product name of this server
        -
        -
      • -
      - - - -
        -
      • -

        getProtocol

        -
        public java.lang.String getProtocol()
        -
        Retrieves a string representation of the network protocol - this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.
        -
        -
        Overrides:
        -
        getProtocol in class Server
        -
        Returns:
        -
        string representation of this server's protocol
        -
        -
      • -
      - - - -
        -
      • -

        getWebRoot

        -
        public java.lang.String getWebRoot()
        -
        Retrieves the root context (directory) from which web content - is served. This property is relevant only when the server - protocol is HTTP(S). Although unlikely, it may be that in the future - other contexts, such as jar urls may be supported, so that pages can - be served from the contents of a jar or from the JVM class path.
        -
        -
        Overrides:
        -
        getWebRoot in class Server
        -
        Returns:
        -
        the root context (directory) from which web content is served
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlServerFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlServerFactory.html deleted file mode 100644 index e7a1b07e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlServerFactory.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.HsqlServerFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.HsqlServerFactory

-
-
No usage of org.hsqldb.server.HsqlServerFactory
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketFactory.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketFactory.html deleted file mode 100644 index e100ee37..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketFactory.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.HsqlSocketFactory (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.HsqlSocketFactory

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketFactorySecure.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketFactorySecure.html deleted file mode 100644 index 6a8e5cb0..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketFactorySecure.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.HsqlSocketFactorySecure (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.HsqlSocketFactorySecure

-
-
No usage of org.hsqldb.server.HsqlSocketFactorySecure
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketRequestHandler.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketRequestHandler.html deleted file mode 100644 index 299bd6a1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/HsqlSocketRequestHandler.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.server.HsqlSocketRequestHandler (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.server.HsqlSocketRequestHandler

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/OdbcUtil.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/OdbcUtil.html deleted file mode 100644 index 71531ad4..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/OdbcUtil.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.OdbcUtil (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.OdbcUtil

-
-
No usage of org.hsqldb.server.OdbcUtil
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/PgType.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/PgType.html deleted file mode 100644 index 4a88fa15..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/PgType.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.PgType (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.PgType

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/Server.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/Server.html deleted file mode 100644 index f83313c6..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/Server.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.Server (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.Server

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerAcl.AclFormatException.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerAcl.AclFormatException.html deleted file mode 100644 index 9ac66f8b..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerAcl.AclFormatException.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.ServerAcl.AclFormatException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.ServerAcl.AclFormatException

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerAcl.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerAcl.html deleted file mode 100644 index e8880019..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerAcl.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.ServerAcl (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.ServerAcl

-
-
No usage of org.hsqldb.server.ServerAcl
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerConfiguration.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerConfiguration.html deleted file mode 100644 index 9eb8e67d..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerConfiguration.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.ServerConfiguration (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.ServerConfiguration

-
-
No usage of org.hsqldb.server.ServerConfiguration
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerConstants.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerConstants.html deleted file mode 100644 index 64b61f04..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerConstants.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.server.ServerConstants (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.server.ServerConstants

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerProperties.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerProperties.html deleted file mode 100644 index e3551136..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/ServerProperties.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.ServerProperties (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.ServerProperties

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/WebServer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/WebServer.html deleted file mode 100644 index c66c2c3e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/class-use/WebServer.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.server.WebServer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.server.WebServer

-
-
No usage of org.hsqldb.server.WebServer
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-summary.html deleted file mode 100644 index d1aa8674..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-summary.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - -org.hsqldb.server (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.server

-
-
-
- - -
Contains the HyperSQL network listener classes.

- - The Server class is the standard server.

- The WebServer class is the alternative server which uses the HTTP - protocol.

-
-
    -
  • - - - - - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    HsqlSocketRequestHandler -
    Interface HsqlSocketRequestHandler
    -
    ServerConstants -
    An enumeration of the property keys and default property values used by - HSQLDB servers
    -
    -
  • -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    HsqlServerFactory -
    HsqlServerFactory
    -
    HsqlSocketFactory -
    Base class for producing the Socket objects used by HSQLDB.
    -
    HsqlSocketFactorySecure -
    The default secure socket factory implementation.
    -
    OdbcUtil -
    Static values and methods to facilitate servicing ODBC clients.
    -
    PgType -
    Postgres types.
    -
    Server -
    The HyperSQL hsql: and hsqls: protocol network database server.
    -
    ServerAcl -
    A list of ACL permit and deny entries with a permitAccess method - which tells whether candidate addresses are permitted or denied - by this ACL list.
    -
    ServerConfiguration -
    Assists with Server and WebServer configuration tasks.
    -
    ServerProperties -
    A subclass HsqlProperties with functionality needed for the HSQLDB Server - implementations.
    -
    WebServer -
    The HyperSQL http: and https: protocol network database server.
    -
    -
  • -
  • - - - - - - - - - - - - -
    Exception Summary 
    ExceptionDescription
    ServerAcl.AclFormatException 
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-tree.html deleted file mode 100644 index c74ab674..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-tree.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - -org.hsqldb.server Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.server

-Package Hierarchies: - -
-
-
-

Class Hierarchy

- -
-
-

Interface Hierarchy

- -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-use.html deleted file mode 100644 index 2e0905c5..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/server/package-use.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - -Uses of Package org.hsqldb.server (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.server

-
-
- -
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/Trigger.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/Trigger.html deleted file mode 100644 index d3b5766f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/Trigger.html +++ /dev/null @@ -1,540 +0,0 @@ - - - - - -Trigger (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Interface Trigger

-
-
-
-
    -
  • -
    -
    public interface Trigger
    -
    The interface a HyperSQL TRIGGER must implement. The user-supplied class that - implements this must have a default constructor.

    - - Contents of oldRow[] and newRow[] in each type of trigger. - -

      -
    • - AFTER INSERT - oldRow[] contains single String object = "Statement-level". -
    • -
    • - AFTER UPDATE - oldRow[] contains single String object = "Statement-level". -
    • -
    • - AFTER DELETE - oldRow[] contains single String object = "Statement-level". -
    • -
    • - BEFORE INSERT FOR EACH ROW - newRow[] contains data about to be inserted and this can - be modified within the trigger such that modified data gets written to the - database. -
    • -
    • - AFTER INSERT FOR EACH ROW - newRow[] contains data just inserted into the table. -
    • -
    • - BEFORE UPDATE FOR EACH ROW - oldRow1[] contains currently stored data and not the data that is about to be - updated. -
    • -
    • - newRow[] contains the data that is about to be updated. -
    • -
    • - AFTER UPDATE FOR EACH ROW - oldRow1[] contains old stored data. - newRow[] contains the new data. -
    • -
    • - BEFORE DELETE FOR EACH ROW - oldRow1[] contains row data about to be deleted. -
    • -
    • - AFTER DELETE FOR EACH ROW - oldRow1[] contains row data that has been deleted. -
    • -
    - (List compiled by Andrew Knight quozzbat@users)
    -
    -
    Since:
    -
    1.7.0
    -
    Author:
    -
    Peter Hudson (peterhudson@users dot sourceforge.net)
    -
    -
  • -
-
-
- -
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        fire

        -
        void fire​(int type,
        -          java.lang.String trigName,
        -          java.lang.String tabName,
        -          java.lang.Object[] oldRow,
        -          java.lang.Object[] newRow)
        -
        The method invoked upon each triggered action. - -

        type contains the integer index id for trigger type, e.g. - TriggerDef.INSERT_AFTER - -

        For all triggers defined as default FOR EACH STATEMENT both - oldRow and newRow are null. - -

        For triggers defined as FOR EACH ROW, the following will apply: - -

        When UPDATE triggers are fired, oldRow contains the existing values - of the table row and newRow contains the new values. - -

        For INSERT triggers, oldRow is null and newRow contains the table row - to be inserted. For DELETE triggers, newRow is null and oldRow contains - the table row to be deleted. - -

        For error conditions, users can construct an HsqlException using one - of the static methods of org.hsqldb.error.Error with a predefined - SQL State from org.hsqldb.error.ErrorCode.

        -
        -
        Parameters:
        -
        type - the type as one of the int values defined in the interface
        -
        trigName - the name of the trigger
        -
        tabName - the name of the table upon which the triggered action is - occurring
        -
        oldRow - the old row
        -
        newRow - the new row
        -
        Throws:
        -
        org.hsqldb.HsqlException - the preferred type of exception thrown by the method
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/class-use/Trigger.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/class-use/Trigger.html deleted file mode 100644 index ce3ff40c..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/class-use/Trigger.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Interface org.hsqldb.trigger.Trigger (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Interface
org.hsqldb.trigger.Trigger

-
-
No usage of org.hsqldb.trigger.Trigger
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-summary.html deleted file mode 100644 index e56d0139..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-summary.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - -org.hsqldb.trigger (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.trigger

-
-
-
- - -
Contains the Trigger interface for Java language database triggers. -

- - The CREATE TRIGGER statement can specify a user-defined class that implements - the Trigger interface.

-
-
    -
  • - - - - - - - - - - - - -
    Interface Summary 
    InterfaceDescription
    Trigger -
    The interface a HyperSQL TRIGGER must implement.
    -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-tree.html deleted file mode 100644 index 07af2418..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-tree.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - -org.hsqldb.trigger Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.trigger

-Package Hierarchies: - -
-
-
-

Interface Hierarchy

- -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-use.html deleted file mode 100644 index 44437be1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/trigger/package-use.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Package org.hsqldb.trigger (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.trigger

-
-
No usage of org.hsqldb.trigger
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/CodeSwitcher.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/CodeSwitcher.html deleted file mode 100644 index 85d359c7..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/CodeSwitcher.html +++ /dev/null @@ -1,307 +0,0 @@ - - - - - -CodeSwitcher (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class CodeSwitcher

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.util.CodeSwitcher
    • -
    -
  • -
-
-
    -
  • -
    -
    public class CodeSwitcher
    -extends java.lang.Object
    -
    Modifies the source code to support different JDK or profile settings. -
    - Usage: java CodeSwitcher paths|{--pathlist=listfile} [{+|-}label...] [+][-]
    - If no labels are specified then all used
    - labels in the source code are shown.
    - Use +MODE to switch on the things labeld MODE
    - Use -MODE to switch off the things labeld MODE
    - Path: Any number of path or files may be
    - specified. Use . for the current directory
    - (including sub-directories).
    - Example: java CodeSwitcher +JAVA2 .
    - This example switches on code labeled JAVA2
    - in all *.java files in the current directory
    - and all subdirectories.
    - java CodeSwitcher + .
    - Adds test code to the code.
    - java CodeSwitcher - .
    - Removes test code from the code
    - 
    -
    -
    Since:
    -
    Hypersonic SQL
    -
    Author:
    -
    Thomas Mueller (Hypersonic SQL Group)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidmain​(java.lang.String[] a) 
      intsize() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] a)
        -
      • -
      - - - -
        -
      • -

        size

        -
        public int size()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/ConnectionSetting.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/ConnectionSetting.html deleted file mode 100644 index aa2c6d45..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/ConnectionSetting.html +++ /dev/null @@ -1,303 +0,0 @@ - - - - - -ConnectionSetting (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class ConnectionSetting

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.util.ConnectionSetting
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable
    -
    -
    -
    public class ConnectionSetting
    -extends java.lang.Object
    -implements java.io.Serializable
    -
    ConnectionSetting represents the various parameters of a data source - connection.
    -
    -
    Author:
    -
    lonbinder@users
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanequals​(java.lang.Object obj) 
      inthashCode() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -getClass, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        equals

        -
        public boolean equals​(java.lang.Object obj)
        -
        -
        Overrides:
        -
        equals in class java.lang.Object
        -
        -
      • -
      - - - -
        -
      • -

        hashCode

        -
        public int hashCode()
        -
        -
        Overrides:
        -
        hashCode in class java.lang.Object
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- -
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManager.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManager.html deleted file mode 100644 index 52fc5ce3..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManager.html +++ /dev/null @@ -1,678 +0,0 @@ - - - - - -DatabaseManager (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DatabaseManager

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.awt.Component
    • -
    • -
        -
      • java.awt.Container
      • -
      • -
          -
        • java.awt.Panel
        • -
        • -
            -
          • org.hsqldb.util.DatabaseManager
          • -
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
    -
    -
    -
    public class DatabaseManager
    -extends java.awt.Panel
    -implements java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.event.KeyListener
    -
    AWT Tool for manageing a JDBC database. -
    - 
    -             Usage: java DatabaseManagerSwing [--options]
    -             where options include:
    -              --driver <classname>  jdbc driver class
    -              --url <name>          jdbc url
    -              --user <name>         username used for connection
    -              --password <password> password for this user
    -              --urlid <urlid>       get connection info from RC file
    -              --rcfile <file>       use instead of default (with urlid)
    -              --dir <path>          default directory
    -              --script <file>       reads from script file
    - 
    -
    - - Originally in HypersonicSQL. Extended in various versions of HSQLDB.
    -
    -
    Since:
    -
    Hypersonic SQL
    -
    Author:
    -
    Thomas Mueller (Hypersonic SQL Group)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from class java.awt.Component

        -java.awt.Component.BaselineResizeBehavior
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class java.awt.Component

        -BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • -
      -
        -
      • - - -

        Fields inherited from interface java.awt.image.ImageObserver

        -ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      DatabaseManager() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidactionPerformed​(java.awt.event.ActionEvent ev) 
      voidconnect​(java.sql.Connection c) 
      voidinit() 
      voidkeyPressed​(java.awt.event.KeyEvent k) 
      voidkeyReleased​(java.awt.event.KeyEvent k) 
      voidkeyTyped​(java.awt.event.KeyEvent k) 
      voidmain() 
      static voidmain​(java.lang.String[] arg) -
      Run with --help switch for usage instructions.
      -
      static voidthreadedDBM() 
      voidwindowActivated​(java.awt.event.WindowEvent e) 
      voidwindowClosed​(java.awt.event.WindowEvent e) 
      voidwindowClosing​(java.awt.event.WindowEvent ev) 
      voidwindowDeactivated​(java.awt.event.WindowEvent e) 
      voidwindowDeiconified​(java.awt.event.WindowEvent e) 
      voidwindowIconified​(java.awt.event.WindowEvent e) 
      voidwindowOpened​(java.awt.event.WindowEvent e) 
      -
        -
      • - - -

        Methods inherited from class java.awt.Panel

        -addNotify, getAccessibleContext
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Container

        -add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Component

        -action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DatabaseManager

        -
        public DatabaseManager()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        connect

        -
        public void connect​(java.sql.Connection c)
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
      • -
      - - - -
        -
      • -

        threadedDBM

        -
        public static void threadedDBM()
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] arg)
        -
        Run with --help switch for usage instructions.
        -
        -
        Parameters:
        -
        arg - arguments
        -
        Throws:
        -
        java.lang.IllegalArgumentException - for the obvious reason
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public void main()
        -
      • -
      - - - -
        -
      • -

        keyPressed

        -
        public void keyPressed​(java.awt.event.KeyEvent k)
        -
        -
        Specified by:
        -
        keyPressed in interface java.awt.event.KeyListener
        -
        -
      • -
      - - - -
        -
      • -

        keyReleased

        -
        public void keyReleased​(java.awt.event.KeyEvent k)
        -
        -
        Specified by:
        -
        keyReleased in interface java.awt.event.KeyListener
        -
        -
      • -
      - - - -
        -
      • -

        keyTyped

        -
        public void keyTyped​(java.awt.event.KeyEvent k)
        -
        -
        Specified by:
        -
        keyTyped in interface java.awt.event.KeyListener
        -
        -
      • -
      - - - -
        -
      • -

        actionPerformed

        -
        public void actionPerformed​(java.awt.event.ActionEvent ev)
        -
        -
        Specified by:
        -
        actionPerformed in interface java.awt.event.ActionListener
        -
        -
      • -
      - - - -
        -
      • -

        windowActivated

        -
        public void windowActivated​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowActivated in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowDeactivated

        -
        public void windowDeactivated​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowDeactivated in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowClosed

        -
        public void windowClosed​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowClosed in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowClosing

        -
        public void windowClosing​(java.awt.event.WindowEvent ev)
        -
        -
        Specified by:
        -
        windowClosing in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowDeiconified

        -
        public void windowDeiconified​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowDeiconified in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowIconified

        -
        public void windowIconified​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowIconified in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowOpened

        -
        public void windowOpened​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowOpened in interface java.awt.event.WindowListener
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManagerSwing.DBMPrefs.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManagerSwing.DBMPrefs.html deleted file mode 100644 index c4626585..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManagerSwing.DBMPrefs.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - -DatabaseManagerSwing.DBMPrefs (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DatabaseManagerSwing.DBMPrefs

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.util.DatabaseManagerSwing.DBMPrefs
    • -
    -
  • -
-
-
    -
  • -
    -
    Enclosing class:
    -
    DatabaseManagerSwing
    -
    -
    -
    public static class DatabaseManagerSwing.DBMPrefs
    -extends java.lang.Object
    -
    Persisted User Preferences for DatabaseManagerSwing. - - These are settings for items in the View and Options pulldown menus, - plus Help/Show Tooltips.
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      java.io.FileprefsFile 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      DBMPrefs​(boolean isApplet) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidload() 
      voidstore() 
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        prefsFile

        -
        public java.io.File prefsFile
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DBMPrefs

        -
        public DBMPrefs​(boolean isApplet)
        -         throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        load

        -
        public void load()
        -          throws java.io.IOException
        -
        -
        Throws:
        -
        java.io.IOException
        -
        -
      • -
      - - - -
        -
      • -

        store

        -
        public void store()
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManagerSwing.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManagerSwing.html deleted file mode 100644 index e2edde96..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/DatabaseManagerSwing.html +++ /dev/null @@ -1,887 +0,0 @@ - - - - - -DatabaseManagerSwing (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class DatabaseManagerSwing

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.awt.Component
    • -
    • -
        -
      • java.awt.Container
      • -
      • -
          -
        • java.awt.Window
        • -
        • -
            -
          • java.awt.Frame
          • -
          • -
              -
            • javax.swing.JFrame
            • -
            • -
                -
              • org.hsqldb.util.DatabaseManagerSwing
              • -
              -
            • -
            -
          • -
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
    -
    -
    -
    public class DatabaseManagerSwing
    -extends javax.swing.JFrame
    -implements java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.event.KeyListener, java.awt.event.MouseListener
    -
    Swing Tool for managing a JDBC database. -
    - 
    -             Usage: java DatabaseManagerSwing [--options]
    -             where options include:
    -              --driver <classname>  jdbc driver class
    -              --url <name>          jdbc url
    -              --user <name>         username used for connection
    -              --password <password> password for this user
    -              --dir <path>          default directory
    -              --script <file>       reads from script file
    -              --urlid <urlid>       get connection info from RC file
    -              --rcfile <file>       use instead of default (with urlid)
    -              --noexit              Don't exit JVM
    - 
    - 
    - - Note that the sys-table switch will not work for Oracle, because Oracle - does not categorize their system tables correctly in the JDBC Metadata.
    -
    -
    Since:
    -
    1.7.0
    -
    Author:
    -
    dmarshall@users, Bob Preston (sqlbob@users dot sourceforge.net)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      - - - - - - - - - - - - -
      Nested Classes 
      Modifier and TypeClassDescription
      static class DatabaseManagerSwing.DBMPrefs -
      Persisted User Preferences for DatabaseManagerSwing.
      -
      -
        -
      • - - -

        Nested classes/interfaces inherited from class java.awt.Window

        -java.awt.Window.Type
      • -
      -
        -
      • - - -

        Nested classes/interfaces inherited from class java.awt.Component

        -java.awt.Component.BaselineResizeBehavior
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      -
        -
      • - - -

        Fields inherited from class java.awt.Frame

        -CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
      • -
      -
        -
      • - - -

        Fields inherited from class java.awt.Component

        -BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • -
      -
        -
      • - - -

        Fields inherited from interface java.awt.image.ImageObserver

        -ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • -
      -
        -
      • - - -

        Fields inherited from interface javax.swing.WindowConstants

        -DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
      • -
      -
    • -
    -
    - -
    - -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidactionPerformed​(java.awt.event.ActionEvent ev) 
      voidconnect​(java.sql.Connection c) -
      This stuff is all quick, except for the refreshTree().
      -
      voidhandlePopup​(java.awt.event.MouseEvent e) 
      voidkeyPressed​(java.awt.event.KeyEvent k) 
      voidkeyReleased​(java.awt.event.KeyEvent k) 
      voidkeyTyped​(java.awt.event.KeyEvent k) 
      voidmain() 
      static voidmain​(java.lang.String[] arg) -
      Run with --help switch for usage instructions.
      -
      voidmouseClicked​(java.awt.event.MouseEvent mouseEvent) 
      voidmouseEntered​(java.awt.event.MouseEvent mouseEvent) 
      voidmouseExited​(java.awt.event.MouseEvent mouseEvent) 
      voidmousePressed​(java.awt.event.MouseEvent e) 
      voidmouseReleased​(java.awt.event.MouseEvent e) 
      voidsetWaiting​(java.lang.String description) 
      voidstart() 
      voidstop() 
      voidwindowActivated​(java.awt.event.WindowEvent e) 
      voidwindowClosed​(java.awt.event.WindowEvent e) 
      voidwindowClosing​(java.awt.event.WindowEvent ev) 
      voidwindowDeactivated​(java.awt.event.WindowEvent e) 
      voidwindowDeiconified​(java.awt.event.WindowEvent e) 
      voidwindowIconified​(java.awt.event.WindowEvent e) 
      voidwindowOpened​(java.awt.event.WindowEvent e) 
      -
        -
      • - - -

        Methods inherited from class javax.swing.JFrame

        -getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Frame

        -addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Window

        -addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Container

        -add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Component

        -action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
        -
      • - - -

        Methods inherited from interface java.awt.MenuContainer

        -getFont, postEvent
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        DatabaseManagerSwing

        -
        public DatabaseManagerSwing()
        -
      • -
      - - - -
        -
      • -

        DatabaseManagerSwing

        -
        public DatabaseManagerSwing​(javax.swing.JFrame frameIn)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] arg)
        -
        Run with --help switch for usage instructions.
        -
        -
        Parameters:
        -
        arg - arguments
        -
        Throws:
        -
        java.lang.IllegalArgumentException - for the obvious reason
        -
        -
      • -
      - - - -
        -
      • -

        connect

        -
        public void connect​(java.sql.Connection c)
        -
        This stuff is all quick, except for the refreshTree(). This unit can be - kicked off in main Gui thread. The refreshTree will be backgrounded and - this method will return.
        -
        -
        Parameters:
        -
        c - Connection
        -
        -
      • -
      - - - -
        -
      • -

        main

        -
        public void main()
        -
      • -
      - - - -
        -
      • -

        keyPressed

        -
        public void keyPressed​(java.awt.event.KeyEvent k)
        -
        -
        Specified by:
        -
        keyPressed in interface java.awt.event.KeyListener
        -
        -
      • -
      - - - -
        -
      • -

        keyReleased

        -
        public void keyReleased​(java.awt.event.KeyEvent k)
        -
        -
        Specified by:
        -
        keyReleased in interface java.awt.event.KeyListener
        -
        -
      • -
      - - - -
        -
      • -

        keyTyped

        -
        public void keyTyped​(java.awt.event.KeyEvent k)
        -
        -
        Specified by:
        -
        keyTyped in interface java.awt.event.KeyListener
        -
        -
      • -
      - - - -
        -
      • -

        actionPerformed

        -
        public void actionPerformed​(java.awt.event.ActionEvent ev)
        -
        -
        Specified by:
        -
        actionPerformed in interface java.awt.event.ActionListener
        -
        -
      • -
      - - - -
        -
      • -

        windowActivated

        -
        public void windowActivated​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowActivated in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowDeactivated

        -
        public void windowDeactivated​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowDeactivated in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowClosed

        -
        public void windowClosed​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowClosed in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowDeiconified

        -
        public void windowDeiconified​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowDeiconified in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowIconified

        -
        public void windowIconified​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowIconified in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowOpened

        -
        public void windowOpened​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowOpened in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowClosing

        -
        public void windowClosing​(java.awt.event.WindowEvent ev)
        -
        -
        Specified by:
        -
        windowClosing in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        setWaiting

        -
        public void setWaiting​(java.lang.String description)
        -
      • -
      - - - -
        -
      • -

        start

        -
        public void start()
        -
      • -
      - - - -
        -
      • -

        stop

        -
        public void stop()
        -
      • -
      - - - -
        -
      • -

        mouseClicked

        -
        public final void mouseClicked​(java.awt.event.MouseEvent mouseEvent)
        -
        -
        Specified by:
        -
        mouseClicked in interface java.awt.event.MouseListener
        -
        -
      • -
      - - - -
        -
      • -

        mouseEntered

        -
        public final void mouseEntered​(java.awt.event.MouseEvent mouseEvent)
        -
        -
        Specified by:
        -
        mouseEntered in interface java.awt.event.MouseListener
        -
        -
      • -
      - - - -
        -
      • -

        mouseExited

        -
        public final void mouseExited​(java.awt.event.MouseEvent mouseEvent)
        -
        -
        Specified by:
        -
        mouseExited in interface java.awt.event.MouseListener
        -
        -
      • -
      - - - -
        -
      • -

        mousePressed

        -
        public final void mousePressed​(java.awt.event.MouseEvent e)
        -
        -
        Specified by:
        -
        mousePressed in interface java.awt.event.MouseListener
        -
        -
      • -
      - - - -
        -
      • -

        mouseReleased

        -
        public final void mouseReleased​(java.awt.event.MouseEvent e)
        -
        -
        Specified by:
        -
        mouseReleased in interface java.awt.event.MouseListener
        -
        -
      • -
      - - - -
        -
      • -

        handlePopup

        -
        public final void handlePopup​(java.awt.event.MouseEvent e)
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/MainInvoker.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/MainInvoker.html deleted file mode 100644 index 9fe5db20..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/MainInvoker.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - -MainInvoker (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class MainInvoker

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.util.MainInvoker
    • -
    -
  • -
-
-
    -
  • -
    -
    public class MainInvoker
    -extends java.lang.Object
    -
    Invokes the static main(String[]) method from each class specified. - - This class will System.exit() if any invocation fails.
    -
    -
    Since:
    -
    HSQLDB 1.8.0
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static java.lang.StringLS 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      MainInvoker() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidinvoke​(java.lang.String className, - java.lang.String[] args) -
      Invokes the static main(String[]) method from each specified class.
      -
      static voidmain​(java.lang.String[] sa) -
      Invokes the static main(String[]) method from each specified class.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        LS

        -
        public static final java.lang.String LS
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        MainInvoker

        -
        public MainInvoker()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] sa)
        -
        Invokes the static main(String[]) method from each specified class. - This method will System.exit() if any invocation fails. - - Note that multiple class invocations are delimited by empty-string - parameters. How the user supplies these empty strings is determined - entirely by the caller's environment. From Windows this can - generally be accomplished with double-quotes like "". From all - popular UNIX shells, this can be accomplished with single or - double-quotes: '' or "".
        -
        -
        Parameters:
        -
        sa - Run java org.hsqldb.util.MainInvoker --help for syntax help
        -
        -
      • -
      - - - -
        -
      • -

        invoke

        -
        public static void invoke​(java.lang.String className,
        -                          java.lang.String[] args)
        -                   throws java.lang.ClassNotFoundException,
        -                          java.lang.NoSuchMethodException,
        -                          java.lang.IllegalAccessException,
        -                          java.lang.reflect.InvocationTargetException
        -
        Invokes the static main(String[]) method from each specified class.
        -
        -
        Parameters:
        -
        className - String
        -
        args - String[]
        -
        Throws:
        -
        java.lang.ClassNotFoundException - if not found
        -
        java.lang.NoSuchMethodException - if not found
        -
        java.lang.IllegalAccessException - on no access
        -
        java.lang.reflect.InvocationTargetException - on invocation failure
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/RCData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/RCData.html deleted file mode 100644 index 637c0b4e..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/RCData.html +++ /dev/null @@ -1,814 +0,0 @@ - - - - - -RCData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class RCData

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • org.hsqldb.util.RCData
    • -
    -
  • -
-
-
    -
  • -
    -
    public class RCData
    -extends java.lang.Object
    -
    Manages all the details we need to connect up to JDBC database(s), - in a declarative way. -

    - The file src/org/hsqldb/sample/SqlFileEmbedder.java - in the HSQLDB distribution provides an example of how to use RCData for your - own programs.

    -
    -
    Author:
    -
    Blaine Simpson (blaine dot simpson at admc dot com)
    -
    See Also:
    -
    - The RC File section of the HyperSQL Utilities Guide
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      java.lang.Stringcharset 
      static java.lang.StringDEFAULT_JDBC_DRIVER 
      java.lang.Stringdriver 
      java.lang.Stringid 
      java.lang.Stringlibpath 
      java.lang.Stringpassword 
      java.lang.Stringti 
      java.lang.Stringtruststore 
      java.lang.Stringurl 
      java.lang.Stringusername 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      RCData​(java.io.File file, - java.lang.String dbKey) -
      Creates a RCDataObject by looking up the given key in the - given authentication file.
      -
      RCData​(java.lang.String id, - java.lang.String url, - java.lang.String username, - java.lang.String password, - java.lang.String driver, - java.lang.String charset, - java.lang.String truststore) -
      Convenience constructor for backward compatibility.
      -
      RCData​(java.lang.String id, - java.lang.String url, - java.lang.String username, - java.lang.String password, - java.lang.String driver, - java.lang.String charset, - java.lang.String truststore, - java.lang.String libpath) -
      Wrapper for unset Transaction Isolation.
      -
      RCData​(java.lang.String id, - java.lang.String url, - java.lang.String username, - java.lang.String password, - java.lang.String driver, - java.lang.String charset, - java.lang.String truststore, - java.lang.String libpath, - java.lang.String ti) -
      Creates a new RCData object.
      -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.lang.StringexpandSysPropVars​(java.lang.String inString) -
      Returns a copy of the given String with System property names in the - format ${system.property} replaced by the corresponding Java - System Properties.
      -
      java.sql.ConnectiongetConnection() -
      Gets a JDBC Connection using the data of this RCData object.
      -
      java.sql.ConnectiongetConnection​(java.lang.String curDriverIn, - java.lang.String curTrustStoreIn) -
      Gets a JDBC Connection using the data of this RCData object with - specified override elements
      -
      java.lang.StringgetDefaultJdbcDriverName() 
      voidsetDefaultJdbcDriver​(java.lang.String defaultJdbcDriverName) 
      static voidsetTI​(java.sql.Connection c, - java.lang.String tiString) -
      Set Transaction Isolation level on the specified JDBC Connection
      -
      static java.lang.StringtiToString​(int ti) -
      Return a String representation for the given numerical - java.sql.Connection Transaction level.
      -
      java.lang.StringtoString() -
      DISABLED DUE TO SECURITY CONCERNS.
      -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        DEFAULT_JDBC_DRIVER

        -
        public static final java.lang.String DEFAULT_JDBC_DRIVER
        -
        -
        See Also:
        -
        Constant Field Values
        -
        -
      • -
      - - - -
        -
      • -

        id

        -
        public java.lang.String id
        -
      • -
      - - - -
        -
      • -

        url

        -
        public java.lang.String url
        -
      • -
      - - - -
        -
      • -

        username

        -
        public java.lang.String username
        -
      • -
      - - - -
        -
      • -

        password

        -
        public java.lang.String password
        -
      • -
      - - - -
        -
      • -

        ti

        -
        public java.lang.String ti
        -
      • -
      - - - -
        -
      • -

        driver

        -
        public java.lang.String driver
        -
      • -
      - - - -
        -
      • -

        charset

        -
        public java.lang.String charset
        -
      • -
      - - - -
        -
      • -

        truststore

        -
        public java.lang.String truststore
        -
      • -
      - - - -
        -
      • -

        libpath

        -
        public java.lang.String libpath
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        RCData

        -
        public RCData​(java.io.File file,
        -              java.lang.String dbKey)
        -       throws java.lang.Exception
        -
        Creates a RCDataObject by looking up the given key in the - given authentication file.
        -
        -
        Parameters:
        -
        file - File containing the authentication information.
        -
        dbKey - Key to look up in the file. - If null, then will echo all urlids in the file to stdout. - (A rather ill-conceived design).
        -
        Throws:
        -
        java.lang.Exception - any exception
        -
        -
      • -
      - - - -
        -
      • -

        RCData

        -
        public RCData​(java.lang.String id,
        -              java.lang.String url,
        -              java.lang.String username,
        -              java.lang.String password,
        -              java.lang.String driver,
        -              java.lang.String charset,
        -              java.lang.String truststore)
        -       throws java.lang.Exception
        -
        Convenience constructor for backward compatibility.
        -
        -
        Throws:
        -
        java.lang.Exception
        -
        See Also:
        -
        RCData(String,String,String,String,String,String,String,String)
        -
        -
      • -
      - - - -
        -
      • -

        RCData

        -
        public RCData​(java.lang.String id,
        -              java.lang.String url,
        -              java.lang.String username,
        -              java.lang.String password,
        -              java.lang.String driver,
        -              java.lang.String charset,
        -              java.lang.String truststore,
        -              java.lang.String libpath)
        -       throws java.lang.Exception
        -
        Wrapper for unset Transaction Isolation.
        -
        -
        Throws:
        -
        java.lang.Exception
        -
        -
      • -
      - - - -
        -
      • -

        RCData

        -
        public RCData​(java.lang.String id,
        -              java.lang.String url,
        -              java.lang.String username,
        -              java.lang.String password,
        -              java.lang.String driver,
        -              java.lang.String charset,
        -              java.lang.String truststore,
        -              java.lang.String libpath,
        -              java.lang.String ti)
        -       throws java.lang.Exception
        -
        Creates a new RCData object. - -

        - The parameters driver, charset, truststore, and libpath are optional. - Setting these parameters to NULL will set them to their - default values.

        -
        -
        Parameters:
        -
        id - The identifier for these connection settings
        -
        url - The URL of the database to connect to
        -
        username - The username to log in as
        -
        password - The password of the username
        -
        driver - The JDBC driver to use
        -
        charset - The character set to use
        -
        truststore - The trust store to use
        -
        libpath - The JDBC library to add to CLASSPATH
        -
        ti - The transaction level
        -
        Throws:
        -
        java.lang.Exception - if the a non-optional parameter is set to NULL
        -
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        setDefaultJdbcDriver

        -
        public void setDefaultJdbcDriver​(java.lang.String defaultJdbcDriverName)
        -
      • -
      - - - -
        -
      • -

        getDefaultJdbcDriverName

        -
        public java.lang.String getDefaultJdbcDriverName()
        -
      • -
      - - - -
        -
      • -

        toString

        -
        public java.lang.String toString()
        -
        DISABLED DUE TO SECURITY CONCERNS. - Just for testing and debugging. - - N.b. this echoes passwords! - public void report() { - System.err.println("urlid: " + id + ", url: " + url + ", username: " - + username + ", password: " + password); - }
        -
        -
        Overrides:
        -
        toString in class java.lang.Object
        -
        Returns:
        -
        string representation
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection()
        -                                  throws java.sql.SQLException,
        -                                         java.net.MalformedURLException
        -
        Gets a JDBC Connection using the data of this RCData object.
        -
        -
        Returns:
        -
        New JDBC Connection
        -
        Throws:
        -
        java.sql.SQLException - on database access error
        -
        java.net.MalformedURLException - on malformed URL
        -
        -
      • -
      - - - -
        -
      • -

        getConnection

        -
        public java.sql.Connection getConnection​(java.lang.String curDriverIn,
        -                                         java.lang.String curTrustStoreIn)
        -                                  throws java.net.MalformedURLException,
        -                                         java.sql.SQLException
        -
        Gets a JDBC Connection using the data of this RCData object with - specified override elements
        -
        -
        Parameters:
        -
        curDriverIn - driver
        -
        curTrustStoreIn - trusted store
        -
        Returns:
        -
        New JDBC Connection
        -
        Throws:
        -
        java.net.MalformedURLException - on malformed URL
        -
        java.sql.SQLException - on database access error
        -
        -
      • -
      - - - -
        -
      • -

        expandSysPropVars

        -
        public static java.lang.String expandSysPropVars​(java.lang.String inString)
        -
        Returns a copy of the given String with System property names in the - format ${system.property} replaced by the corresponding Java - System Properties.
        -
        -
        Parameters:
        -
        inString - String
        -
        Returns:
        -
        formatted string
        -
        -
      • -
      - - - -
        -
      • -

        setTI

        -
        public static void setTI​(java.sql.Connection c,
        -                         java.lang.String tiString)
        -                  throws java.sql.SQLException
        -
        Set Transaction Isolation level on the specified JDBC Connection
        -
        -
        Throws:
        -
        java.sql.SQLException
        -
        -
      • -
      - - - -
        -
      • -

        tiToString

        -
        public static java.lang.String tiToString​(int ti)
        -
        Return a String representation for the given numerical - java.sql.Connection Transaction level. -

        - Database implementations are free to provide their own transaction - isolation levels, so you can't depend upon this method to much.

        -
        -
        Parameters:
        -
        ti - Transaction levle
        -
        Returns:
        -
        The string representation
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/TableSorter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/TableSorter.html deleted file mode 100644 index 5cc97502..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/TableSorter.html +++ /dev/null @@ -1,757 +0,0 @@ - - - - - -TableSorter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class TableSorter

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • javax.swing.table.AbstractTableModel
    • -
    • -
        -
      • org.hsqldb.util.TableSorter
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.io.Serializable, javax.swing.table.TableModel
    -
    -
    -
    public class TableSorter
    -extends javax.swing.table.AbstractTableModel
    -
    TableSorter is a decorator for TableModels; adding sorting - functionality to a supplied TableModel. TableSorter does - not store or copy the data in its TableModel; instead it maintains - a map from the row indexes of the view to the row indexes of the - model. As requests are made of the sorter (like getValueAt(row, col)) - they are passed to the underlying model after the row numbers - have been translated via the internal mapping array. This way, - the TableSorter appears to hold another copy of the table - with the rows in a different order. -

    - TableSorter registers itself as a listener to the underlying model, - just as the JTable itself would. Events recieved from the model - are examined, sometimes manipulated (typically widened), and then - passed on to the TableSorter's listeners (typically the JTable). - If a change to the model has invalidated the order of TableSorter's - rows, a note of this is made and the sorter will resort the - rows the next time a value is requested. -

    - When the tableHeader property is set, either by using the - setTableHeader() method or the two argument constructor, the - table header may be used as a complete UI for TableSorter. - The default renderer of the tableHeader is decorated with a renderer - that indicates the sorting status of each column. In addition, - a mouse listener is installed with the following behavior: -

      -
    • - Mouse-click: Clears the sorting status of all other columns - and advances the sorting status of that column through three - values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to - NOT_SORTED again). -
    • - SHIFT-mouse-click: Clears the sorting status of all other columns - and cycles the sorting status of the column through the same - three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}. -
    • - CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except - that the changes to the column do not cancel the statuses of columns - that are already sorting - giving a way to initiate a compound - sort. -
    -

    - This is a long overdue rewrite of a class of the same name that - first appeared in the swing table demos in 1997.

    -
    -
    Author:
    -
    Philip Milne, Brendon McLean, Dan van Enckevort, Parwinder Sekhon
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    - -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      TableSorter() 
      TableSorter​(javax.swing.table.TableModel tableModel) 
      TableSorter​(javax.swing.table.TableModel tableModel, - javax.swing.table.JTableHeader tableHeader) 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      java.lang.ClassgetColumnClass​(int column) 
      intgetColumnCount() 
      java.lang.StringgetColumnName​(int column) 
      intgetRowCount() 
      intgetSortingStatus​(int column) 
      javax.swing.table.JTableHeadergetTableHeader() 
      javax.swing.table.TableModelgetTableModel() 
      java.lang.ObjectgetValueAt​(int row, - int column) 
      booleanisCellEditable​(int row, - int column) 
      booleanisSorting() 
      intmodelIndex​(int viewIndex) 
      voidsetColumnComparator​(java.lang.Class type, - java.util.Comparator comparator) 
      voidsetSortingStatus​(int column, - int status) 
      voidsetTableHeader​(javax.swing.table.JTableHeader tableHeader) 
      voidsetTableModel​(javax.swing.table.TableModel tableModel) 
      voidsetValueAt​(java.lang.Object aValue, - int row, - int column) 
      -
        -
      • - - -

        Methods inherited from class javax.swing.table.AbstractTableModel

        -addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - - - - - - - - - - - - - -
        -
      • -

        COMPARABLE_COMPARATOR

        -
        public static final java.util.Comparator COMPARABLE_COMPARATOR
        -
      • -
      - - - -
        -
      • -

        LEXICAL_COMPARATOR

        -
        public static final java.util.Comparator LEXICAL_COMPARATOR
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        TableSorter

        -
        public TableSorter()
        -
      • -
      - - - -
        -
      • -

        TableSorter

        -
        public TableSorter​(javax.swing.table.TableModel tableModel)
        -
      • -
      - - - -
        -
      • -

        TableSorter

        -
        public TableSorter​(javax.swing.table.TableModel tableModel,
        -                   javax.swing.table.JTableHeader tableHeader)
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        getTableModel

        -
        public javax.swing.table.TableModel getTableModel()
        -
      • -
      - - - -
        -
      • -

        setTableModel

        -
        public void setTableModel​(javax.swing.table.TableModel tableModel)
        -
      • -
      - - - -
        -
      • -

        getTableHeader

        -
        public javax.swing.table.JTableHeader getTableHeader()
        -
      • -
      - - - -
        -
      • -

        setTableHeader

        -
        public void setTableHeader​(javax.swing.table.JTableHeader tableHeader)
        -
      • -
      - - - -
        -
      • -

        isSorting

        -
        public boolean isSorting()
        -
      • -
      - - - -
        -
      • -

        getSortingStatus

        -
        public int getSortingStatus​(int column)
        -
      • -
      - - - -
        -
      • -

        setSortingStatus

        -
        public void setSortingStatus​(int column,
        -                             int status)
        -
      • -
      - - - -
        -
      • -

        setColumnComparator

        -
        public void setColumnComparator​(java.lang.Class type,
        -                                java.util.Comparator comparator)
        -
      • -
      - - - -
        -
      • -

        modelIndex

        -
        public int modelIndex​(int viewIndex)
        -
      • -
      - - - -
        -
      • -

        getRowCount

        -
        public int getRowCount()
        -
      • -
      - - - -
        -
      • -

        getColumnCount

        -
        public int getColumnCount()
        -
      • -
      - - - -
        -
      • -

        getColumnName

        -
        public java.lang.String getColumnName​(int column)
        -
        -
        Specified by:
        -
        getColumnName in interface javax.swing.table.TableModel
        -
        Overrides:
        -
        getColumnName in class javax.swing.table.AbstractTableModel
        -
        -
      • -
      - - - -
        -
      • -

        getColumnClass

        -
        public java.lang.Class getColumnClass​(int column)
        -
        -
        Specified by:
        -
        getColumnClass in interface javax.swing.table.TableModel
        -
        Overrides:
        -
        getColumnClass in class javax.swing.table.AbstractTableModel
        -
        -
      • -
      - - - -
        -
      • -

        isCellEditable

        -
        public boolean isCellEditable​(int row,
        -                              int column)
        -
        -
        Specified by:
        -
        isCellEditable in interface javax.swing.table.TableModel
        -
        Overrides:
        -
        isCellEditable in class javax.swing.table.AbstractTableModel
        -
        -
      • -
      - - - -
        -
      • -

        getValueAt

        -
        public java.lang.Object getValueAt​(int row,
        -                                   int column)
        -
      • -
      - - - -
        -
      • -

        setValueAt

        -
        public void setValueAt​(java.lang.Object aValue,
        -                       int row,
        -                       int column)
        -
        -
        Specified by:
        -
        setValueAt in interface javax.swing.table.TableModel
        -
        Overrides:
        -
        setValueAt in class javax.swing.table.AbstractTableModel
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/Transfer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/Transfer.html deleted file mode 100644 index afbc1253..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/Transfer.html +++ /dev/null @@ -1,636 +0,0 @@ - - - - - -Transfer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
- -
-
-
Module org.hsqldb
- -

Class Transfer

-
-
-
    -
  • java.lang.Object
  • -
  • -
      -
    • java.awt.Component
    • -
    • -
        -
      • java.awt.Container
      • -
      • -
          -
        • java.awt.Panel
        • -
        • -
            -
          • org.hsqldb.util.Transfer
          • -
          -
        • -
        -
      • -
      -
    • -
    -
  • -
-
-
    -
  • -
    -
    All Implemented Interfaces:
    -
    java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
    -
    -
    -
    public class Transfer
    -extends java.awt.Panel
    -implements java.awt.event.WindowListener, java.awt.event.ActionListener, java.awt.event.ItemListener
    -
    Utility program (or applet) for transferring tables between different - databases via JDBC. Understands HSQLDB database particularly well.
    -
    -
    Since:
    -
    Hypersonic SQL
    -
    Author:
    -
    Thomas Mueller (Hypersonic SQL Group)
    -
    See Also:
    -
    Serialized Form
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Nested Class Summary

      -
        -
      • - - -

        Nested classes/interfaces inherited from class java.awt.Component

        -java.awt.Component.BaselineResizeBehavior
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Field Summary

      - - - - - - - - - - - - -
      Fields 
      Modifier and TypeFieldDescription
      static booleanTRACE 
      -
        -
      • - - -

        Fields inherited from class java.awt.Component

        -BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • -
      -
        -
      • - - -

        Fields inherited from interface java.awt.image.ImageObserver

        -ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Summary

      - - - - - - - - - - -
      Constructors 
      ConstructorDescription
      Transfer() 
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Summary

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidactionPerformed​(java.awt.event.ActionEvent ev) 
      voidinit() 
      voiditemStateChanged​(java.awt.event.ItemEvent e) 
      static voidmain​(java.lang.String[] arg) 
      voidtrace​(java.lang.String s) 
      voidwindowActivated​(java.awt.event.WindowEvent e) 
      voidwindowClosed​(java.awt.event.WindowEvent e) 
      voidwindowClosing​(java.awt.event.WindowEvent ev) 
      voidwindowDeactivated​(java.awt.event.WindowEvent e) 
      voidwindowDeiconified​(java.awt.event.WindowEvent e) 
      voidwindowIconified​(java.awt.event.WindowEvent e) 
      voidwindowOpened​(java.awt.event.WindowEvent e) 
      static voidwork​(java.lang.String[] arg) 
      -
        -
      • - - -

        Methods inherited from class java.awt.Panel

        -addNotify, getAccessibleContext
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Container

        -add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate
      • -
      -
        -
      • - - -

        Methods inherited from class java.awt.Component

        -action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • -
      -
        -
      • - - -

        Methods inherited from class java.lang.Object

        -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • -
      -
    • -
    -
    -
  • -
-
-
-
    -
  • - -
    -
      -
    • - - -

      Field Detail

      - - - -
        -
      • -

        TRACE

        -
        public static final boolean TRACE
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Constructor Detail

      - - - -
        -
      • -

        Transfer

        -
        public Transfer()
        -
      • -
      -
    • -
    -
    - -
    -
      -
    • - - -

      Method Detail

      - - - -
        -
      • -

        trace

        -
        public void trace​(java.lang.String s)
        -
      • -
      - - - -
        -
      • -

        init

        -
        public void init()
        -
      • -
      - - - -
        -
      • -

        work

        -
        public static void work​(java.lang.String[] arg)
        -
      • -
      - - - -
        -
      • -

        main

        -
        public static void main​(java.lang.String[] arg)
        -
      • -
      - - - -
        -
      • -

        itemStateChanged

        -
        public void itemStateChanged​(java.awt.event.ItemEvent e)
        -
        -
        Specified by:
        -
        itemStateChanged in interface java.awt.event.ItemListener
        -
        -
      • -
      - - - -
        -
      • -

        actionPerformed

        -
        public void actionPerformed​(java.awt.event.ActionEvent ev)
        -
        -
        Specified by:
        -
        actionPerformed in interface java.awt.event.ActionListener
        -
        -
      • -
      - - - -
        -
      • -

        windowActivated

        -
        public void windowActivated​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowActivated in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowDeactivated

        -
        public void windowDeactivated​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowDeactivated in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowClosed

        -
        public void windowClosed​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowClosed in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowClosing

        -
        public void windowClosing​(java.awt.event.WindowEvent ev)
        -
        -
        Specified by:
        -
        windowClosing in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowDeiconified

        -
        public void windowDeiconified​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowDeiconified in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowIconified

        -
        public void windowIconified​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowIconified in interface java.awt.event.WindowListener
        -
        -
      • -
      - - - -
        -
      • -

        windowOpened

        -
        public void windowOpened​(java.awt.event.WindowEvent e)
        -
        -
        Specified by:
        -
        windowOpened in interface java.awt.event.WindowListener
        -
        -
      • -
      -
    • -
    -
    -
  • -
-
-
-
- - - - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/CodeSwitcher.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/CodeSwitcher.html deleted file mode 100644 index 3ee01f47..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/CodeSwitcher.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.CodeSwitcher (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.CodeSwitcher

-
-
No usage of org.hsqldb.util.CodeSwitcher
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/ConnectionSetting.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/ConnectionSetting.html deleted file mode 100644 index 8cb20b20..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/ConnectionSetting.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.ConnectionSetting (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.ConnectionSetting

-
-
No usage of org.hsqldb.util.ConnectionSetting
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManager.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManager.html deleted file mode 100644 index 955ff6d1..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManager.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.DatabaseManager (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.DatabaseManager

-
-
No usage of org.hsqldb.util.DatabaseManager
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManagerSwing.DBMPrefs.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManagerSwing.DBMPrefs.html deleted file mode 100644 index fa855c09..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManagerSwing.DBMPrefs.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.DatabaseManagerSwing.DBMPrefs (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.DatabaseManagerSwing.DBMPrefs

-
-
No usage of org.hsqldb.util.DatabaseManagerSwing.DBMPrefs
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManagerSwing.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManagerSwing.html deleted file mode 100644 index ded02590..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/DatabaseManagerSwing.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.DatabaseManagerSwing (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.DatabaseManagerSwing

-
-
No usage of org.hsqldb.util.DatabaseManagerSwing
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/MainInvoker.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/MainInvoker.html deleted file mode 100644 index 25b60128..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/MainInvoker.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.MainInvoker (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.MainInvoker

-
-
No usage of org.hsqldb.util.MainInvoker
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/RCData.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/RCData.html deleted file mode 100644 index 494cf218..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/RCData.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.RCData (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.RCData

-
-
No usage of org.hsqldb.util.RCData
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/TableSorter.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/TableSorter.html deleted file mode 100644 index 7240a7df..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/TableSorter.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.TableSorter (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.TableSorter

-
-
No usage of org.hsqldb.util.TableSorter
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/Transfer.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/Transfer.html deleted file mode 100644 index fded10ea..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/class-use/Transfer.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.util.Transfer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Class
org.hsqldb.util.Transfer

-
-
No usage of org.hsqldb.util.Transfer
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-summary.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-summary.html deleted file mode 100644 index 5515429f..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-summary.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - -org.hsqldb.util (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-
Module org.hsqldb
-

Package org.hsqldb.util

-
-
-
- - -
Contains the HyperSQL utility classes.

- - The DatabaseManagerSwing is a GUI application for accessing HyperSQL - databases.

-
-
    -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Class Summary 
    ClassDescription
    CodeSwitcher -
    Modifies the source code to support different JDK or profile settings.
    -
    ConnectionSetting -
    ConnectionSetting represents the various parameters of a data source - connection.
    -
    DatabaseManager -
    AWT Tool for manageing a JDBC database.
    -
    DatabaseManagerSwing -
    Swing Tool for managing a JDBC database.
    -
    DatabaseManagerSwing.DBMPrefs -
    Persisted User Preferences for DatabaseManagerSwing.
    -
    MainInvoker -
    Invokes the static main(String[]) method from each class specified.
    -
    RCData -
    Manages all the details we need to connect up to JDBC database(s), - in a declarative way.
    -
    TableSorter -
    TableSorter is a decorator for TableModels; adding sorting - functionality to a supplied TableModel.
    -
    Transfer -
    Utility program (or applet) for transferring tables between different - databases via JDBC.
    -
    -
  • -
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-tree.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-tree.html deleted file mode 100644 index 9c23f8b6..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-tree.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - -org.hsqldb.util Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Hierarchy For Package org.hsqldb.util

-Package Hierarchies: - -
-
-
-

Class Hierarchy

-
    -
  • java.lang.Object -
      -
    • javax.swing.table.AbstractTableModel (implements java.io.Serializable, javax.swing.table.TableModel) - -
    • -
    • org.hsqldb.util.CodeSwitcher
    • -
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) -
        -
      • java.awt.Container -
          -
        • java.awt.Panel (implements javax.accessibility.Accessible) -
            -
          • org.hsqldb.util.DatabaseManager (implements java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.WindowListener)
          • -
          • org.hsqldb.util.Transfer (implements java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener)
          • -
          -
        • -
        • java.awt.Window (implements javax.accessibility.Accessible) -
            -
          • java.awt.Frame (implements java.awt.MenuContainer) -
              -
            • javax.swing.JFrame (implements javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants) -
                -
              • org.hsqldb.util.DatabaseManagerSwing (implements java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener)
              • -
              -
            • -
            -
          • -
          -
        • -
        -
      • -
      -
    • -
    • org.hsqldb.util.ConnectionSetting (implements java.io.Serializable)
    • -
    • org.hsqldb.util.DatabaseManagerSwing.DBMPrefs
    • -
    • org.hsqldb.util.MainInvoker
    • -
    • org.hsqldb.util.RCData
    • -
    -
  • -
-
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-use.html b/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-use.html deleted file mode 100644 index 9e60e018..00000000 --- a/database/hsqldb/doc/apidocs/org.hsqldb/org/hsqldb/util/package-use.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Package org.hsqldb.util (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
-
-

Uses of Package
org.hsqldb.util

-
-
No usage of org.hsqldb.util
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/overview-tree.html b/database/hsqldb/doc/apidocs/overview-tree.html deleted file mode 100644 index 300b9234..00000000 --- a/database/hsqldb/doc/apidocs/overview-tree.html +++ /dev/null @@ -1,495 +0,0 @@ - - - - - -Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
- -
-
- -
-
-

Class Hierarchy

- -
-
-

Interface Hierarchy

- -
-
-

Enum Hierarchy

-
    -
  • java.lang.Object -
      -
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) - -
    • -
    -
  • -
-
-
-
-
- -

Copyright © 2001 - 2022 HSQL Development Group.

-
- - diff --git a/database/hsqldb/doc/apidocs/package-search-index.js b/database/hsqldb/doc/apidocs/package-search-index.js deleted file mode 100644 index 97f34e52..00000000 --- a/database/hsqldb/doc/apidocs/package-search-index.js +++ /dev/null @@ -1 +0,0 @@ -packageSearchIndex = [{"l":"All Packages","url":"allpackages-index.html"},{"m":"org.hsqldb","l":"org.hsqldb.auth"},{"m":"org.hsqldb","l":"org.hsqldb.jdbc"},{"m":"org.hsqldb","l":"org.hsqldb.jdbc.pool"},{"m":"org.hsqldb","l":"org.hsqldb.lib"},{"m":"org.hsqldb","l":"org.hsqldb.lib.tar"},{"m":"org.hsqldb","l":"org.hsqldb.server"},{"m":"org.hsqldb","l":"org.hsqldb.trigger"},{"m":"org.hsqldb","l":"org.hsqldb.util"}] \ No newline at end of file diff --git a/database/hsqldb/doc/apidocs/package-search-index.zip b/database/hsqldb/doc/apidocs/package-search-index.zip deleted file mode 100644 index 69f904f2..00000000 Binary files a/database/hsqldb/doc/apidocs/package-search-index.zip and /dev/null differ diff --git a/database/hsqldb/doc/apidocs/resources/glass.png b/database/hsqldb/doc/apidocs/resources/glass.png deleted file mode 100644 index a7f591f4..00000000 Binary files a/database/hsqldb/doc/apidocs/resources/glass.png and /dev/null differ diff --git a/database/hsqldb/doc/apidocs/resources/x.png b/database/hsqldb/doc/apidocs/resources/x.png deleted file mode 100644 index 30548a75..00000000 Binary files a/database/hsqldb/doc/apidocs/resources/x.png and /dev/null differ diff --git a/database/hsqldb/doc/apidocs/script.js b/database/hsqldb/doc/apidocs/script.js deleted file mode 100644 index 7dc93c48..00000000 --- a/database/hsqldb/doc/apidocs/script.js +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -var moduleSearchIndex; -var packageSearchIndex; -var typeSearchIndex; -var memberSearchIndex; -var tagSearchIndex; -function loadScripts(doc, tag) { - createElem(doc, tag, 'jquery/jszip/dist/jszip.js'); - createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils.js'); - if (window.navigator.userAgent.indexOf('MSIE ') > 0 || window.navigator.userAgent.indexOf('Trident/') > 0 || - window.navigator.userAgent.indexOf('Edge/') > 0) { - createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils-ie.js'); - } - createElem(doc, tag, 'search.js'); - - $.get(pathtoroot + "module-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("module-search-index.json").async("text").then(function(content){ - moduleSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "package-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("package-search-index.json").async("text").then(function(content){ - packageSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "type-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("type-search-index.json").async("text").then(function(content){ - typeSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "member-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("member-search-index.json").async("text").then(function(content){ - memberSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "tag-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("tag-search-index.json").async("text").then(function(content){ - tagSearchIndex = JSON.parse(content); - }); - }); - }); - }); - if (!moduleSearchIndex) { - createElem(doc, tag, 'module-search-index.js'); - } - if (!packageSearchIndex) { - createElem(doc, tag, 'package-search-index.js'); - } - if (!typeSearchIndex) { - createElem(doc, tag, 'type-search-index.js'); - } - if (!memberSearchIndex) { - createElem(doc, tag, 'member-search-index.js'); - } - if (!tagSearchIndex) { - createElem(doc, tag, 'tag-search-index.js'); - } - $(window).resize(function() { - $('.navPadding').css('padding-top', $('.fixedNav').css("height")); - }); -} - -function createElem(doc, tag, path) { - var script = doc.createElement(tag); - var scriptElement = doc.getElementsByTagName(tag)[0]; - script.src = pathtoroot + path; - scriptElement.parentNode.insertBefore(script, scriptElement); -} - -function show(type) { - count = 0; - for (var key in data) { - var row = document.getElementById(key); - if ((data[key] & type) !== 0) { - row.style.display = ''; - row.className = (count++ % 2) ? rowColor : altColor; - } - else - row.style.display = 'none'; - } - updateTabs(type); -} - -function updateTabs(type) { - for (var value in tabs) { - var sNode = document.getElementById(tabs[value][0]); - var spanNode = sNode.firstChild; - if (value == type) { - sNode.className = activeTableTab; - spanNode.innerHTML = tabs[value][1]; - } - else { - sNode.className = tableTab; - spanNode.innerHTML = "" + tabs[value][1] + ""; - } - } -} - -function updateModuleFrame(pFrame, cFrame) { - top.packageFrame.location = pFrame; - top.classFrame.location = cFrame; -} diff --git a/database/hsqldb/doc/apidocs/search.js b/database/hsqldb/doc/apidocs/search.js deleted file mode 100644 index b773531b..00000000 --- a/database/hsqldb/doc/apidocs/search.js +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -var noResult = {l: "No results found"}; -var catModules = "Modules"; -var catPackages = "Packages"; -var catTypes = "Types"; -var catMembers = "Members"; -var catSearchTags = "SearchTags"; -var highlight = "$&"; -var camelCaseRegexp = ""; -var secondaryMatcher = ""; -function getHighlightedText(item) { - var ccMatcher = new RegExp(camelCaseRegexp); - var label = item.replace(ccMatcher, highlight); - if (label === item) { - label = item.replace(secondaryMatcher, highlight); - } - return label; -} -function getURLPrefix(ui) { - var urlPrefix=""; - if (useModuleDirectories) { - var slash = "/"; - if (ui.item.category === catModules) { - return ui.item.l + slash; - } else if (ui.item.category === catPackages && ui.item.m) { - return ui.item.m + slash; - } else if ((ui.item.category === catTypes && ui.item.p) || ui.item.category === catMembers) { - $.each(packageSearchIndex, function(index, item) { - if (ui.item.p == item.l) { - urlPrefix = item.m + slash; - } - }); - return urlPrefix; - } else { - return urlPrefix; - } - } - return urlPrefix; -} -var watermark = 'Search'; -$(function() { - $("#search").val(''); - $("#search").prop("disabled", false); - $("#reset").prop("disabled", false); - $("#search").val(watermark).addClass('watermark'); - $("#search").blur(function() { - if ($(this).val().length == 0) { - $(this).val(watermark).addClass('watermark'); - } - }); - $("#search").on('click keydown', function() { - if ($(this).val() == watermark) { - $(this).val('').removeClass('watermark'); - } - }); - $("#reset").click(function() { - $("#search").val(''); - $("#search").focus(); - }); - $("#search").focus(); - $("#search")[0].setSelectionRange(0, 0); -}); -$.widget("custom.catcomplete", $.ui.autocomplete, { - _create: function() { - this._super(); - this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); - }, - _renderMenu: function(ul, items) { - var rMenu = this, - currentCategory = ""; - rMenu.menu.bindings = $(); - $.each(items, function(index, item) { - var li; - if (item.l !== noResult.l && item.category !== currentCategory) { - ul.append("
  • " + item.category + "
  • "); - currentCategory = item.category; - } - li = rMenu._renderItemData(ul, item); - if (item.category) { - li.attr("aria-label", item.category + " : " + item.l); - li.attr("class", "resultItem"); - } else { - li.attr("aria-label", item.l); - li.attr("class", "resultItem"); - } - }); - }, - _renderItem: function(ul, item) { - var label = ""; - if (item.category === catModules) { - label = getHighlightedText(item.l); - } else if (item.category === catPackages) { - label = (item.m) - ? getHighlightedText(item.m + "/" + item.l) - : getHighlightedText(item.l); - } else if (item.category === catTypes) { - label = (item.p) - ? getHighlightedText(item.p + "." + item.l) - : getHighlightedText(item.l); - } else if (item.category === catMembers) { - label = getHighlightedText(item.p + "." + (item.c + "." + item.l)); - } else if (item.category === catSearchTags) { - label = getHighlightedText(item.l); - } else { - label = item.l; - } - var li = $("
  • ").appendTo(ul); - var div = $("
    ").appendTo(li); - if (item.category === catSearchTags) { - if (item.d) { - div.html(label + " (" + item.h + ")
    " - + item.d + "
    "); - } else { - div.html(label + " (" + item.h + ")"); - } - } else { - div.html(label); - } - return li; - } -}); -$(function() { - $("#search").catcomplete({ - minLength: 1, - delay: 100, - source: function(request, response) { - var result = new Array(); - var presult = new Array(); - var tresult = new Array(); - var mresult = new Array(); - var tgresult = new Array(); - var secondaryresult = new Array(); - var displayCount = 0; - var exactMatcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term) + "$", "i"); - camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join("([a-z0-9_$]*?)"); - var camelCaseMatcher = new RegExp("^" + camelCaseRegexp); - secondaryMatcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); - - // Return the nested innermost name from the specified object - function nestedName(e) { - return e.l.substring(e.l.lastIndexOf(".") + 1); - } - - function concatResults(a1, a2) { - a1 = a1.concat(a2); - a2.length = 0; - return a1; - } - - if (moduleSearchIndex) { - var mdleCount = 0; - $.each(moduleSearchIndex, function(index, item) { - item.category = catModules; - if (exactMatcher.test(item.l)) { - result.push(item); - mdleCount++; - } else if (camelCaseMatcher.test(item.l)) { - result.push(item); - } else if (secondaryMatcher.test(item.l)) { - secondaryresult.push(item); - } - }); - displayCount = mdleCount; - result = concatResults(result, secondaryresult); - } - if (packageSearchIndex) { - var pCount = 0; - var pkg = ""; - $.each(packageSearchIndex, function(index, item) { - item.category = catPackages; - pkg = (item.m) - ? (item.m + "/" + item.l) - : item.l; - if (exactMatcher.test(item.l)) { - presult.push(item); - pCount++; - } else if (camelCaseMatcher.test(pkg)) { - presult.push(item); - } else if (secondaryMatcher.test(pkg)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(presult, secondaryresult)); - displayCount = (pCount > displayCount) ? pCount : displayCount; - } - if (typeSearchIndex) { - var tCount = 0; - $.each(typeSearchIndex, function(index, item) { - item.category = catTypes; - var s = nestedName(item); - if (exactMatcher.test(s)) { - tresult.push(item); - tCount++; - } else if (camelCaseMatcher.test(s)) { - tresult.push(item); - } else if (secondaryMatcher.test(item.p + "." + item.l)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(tresult, secondaryresult)); - displayCount = (tCount > displayCount) ? tCount : displayCount; - } - if (memberSearchIndex) { - var mCount = 0; - $.each(memberSearchIndex, function(index, item) { - item.category = catMembers; - var s = nestedName(item); - if (exactMatcher.test(s)) { - mresult.push(item); - mCount++; - } else if (camelCaseMatcher.test(s)) { - mresult.push(item); - } else if (secondaryMatcher.test(item.c + "." + item.l)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(mresult, secondaryresult)); - displayCount = (mCount > displayCount) ? mCount : displayCount; - } - if (tagSearchIndex) { - var tgCount = 0; - $.each(tagSearchIndex, function(index, item) { - item.category = catSearchTags; - if (exactMatcher.test(item.l)) { - tgresult.push(item); - tgCount++; - } else if (secondaryMatcher.test(item.l)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(tgresult, secondaryresult)); - displayCount = (tgCount > displayCount) ? tgCount : displayCount; - } - displayCount = (displayCount > 500) ? displayCount : 500; - var counter = function() { - var count = {Modules: 0, Packages: 0, Types: 0, Members: 0, SearchTags: 0}; - var f = function(item) { - count[item.category] += 1; - return (count[item.category] <= displayCount); - }; - return f; - }(); - response(result.filter(counter)); - }, - response: function(event, ui) { - if (!ui.content.length) { - ui.content.push(noResult); - } else { - $("#search").empty(); - } - }, - autoFocus: true, - position: { - collision: "flip" - }, - select: function(event, ui) { - if (ui.item.l !== noResult.l) { - var url = getURLPrefix(ui); - if (ui.item.category === catModules) { - if (useModuleDirectories) { - url += "module-summary.html"; - } else { - url = ui.item.l + "-summary.html"; - } - } else if (ui.item.category === catPackages) { - if (ui.item.url) { - url = ui.item.url; - } else { - url += ui.item.l.replace(/\./g, '/') + "/package-summary.html"; - } - } else if (ui.item.category === catTypes) { - if (ui.item.url) { - url = ui.item.url; - } else if (ui.item.p === "") { - url += ui.item.l + ".html"; - } else { - url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html"; - } - } else if (ui.item.category === catMembers) { - if (ui.item.p === "") { - url += ui.item.c + ".html" + "#"; - } else { - url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#"; - } - if (ui.item.url) { - url += ui.item.url; - } else { - url += ui.item.l; - } - } else if (ui.item.category === catSearchTags) { - url += ui.item.u; - } - if (top !== window) { - parent.classFrame.location = pathtoroot + url; - } else { - window.location.href = pathtoroot + url; - } - $("#search").focus(); - } - } - }); -}); diff --git a/database/hsqldb/doc/apidocs/serialized-form.html b/database/hsqldb/doc/apidocs/serialized-form.html deleted file mode 100644 index 0fd59779..00000000 --- a/database/hsqldb/doc/apidocs/serialized-form.html +++ /dev/null @@ -1,1003 +0,0 @@ - - - - - -Serialized Form (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Serialized Form

    -
    -
    -
      -
    • -
      -

      Package org.hsqldb.auth

      - -
      -
    • -
    • -
      -

      Package org.hsqldb.jdbc

      -
        -
      • - - -

        Class org.hsqldb.jdbc.JDBCCommonDataSource extends java.lang.Object implements Serializable

        -
          -
        • -

          Serialized Fields

          -
            -
          • -

            connectionProps

            -
            java.util.Properties connectionProps
            -
          • -
          • -

            dataSourceName

            -
            java.lang.String dataSourceName
            -
            name of data source - informational
            -
          • -
          • -

            description

            -
            java.lang.String description
            -
            description of data source - informational
            -
          • -
          • -

            loginTimeout

            -
            int loginTimeout
            -
            login timeout
            -
          • -
          • -

            networkProtocol

            -
            java.lang.String networkProtocol
            -
            network protocol - informational
            -
          • -
          • -

            password

            -
            java.lang.String password
            -
            connection password
            -
          • -
          • -

            serverName

            -
            java.lang.String serverName
            -
            name of server - informational
            -
          • -
          • -

            url

            -
            java.lang.String url
            -
            database URL
            -
          • -
          • -

            user

            -
            java.lang.String user
            -
            connection user
            -
          • -
          -
        • -
        -
      • -
      • - - -

        Class org.hsqldb.jdbc.JDBCDataSource extends JDBCCommonDataSource implements Serializable

        -
      • -
      -
      -
    • -
    • -
      -

      Package org.hsqldb.jdbc.pool

      - -
      -
    • -
    • -
      -

      Package org.hsqldb.lib

      - -
      -
    • -
    • -
      -

      Package org.hsqldb.lib.tar

      -
        -
      • - - -

        Class org.hsqldb.lib.tar.PIFData extends java.util.HashMap<java.lang.String,​java.lang.String> implements Serializable

        -
        -
        serialVersionUID:
        -
        3086795680582315773L
        -
        -
          -
        • -

          Serialized Fields

          -
            -
          • -

            sizeObject

            -
            java.lang.Long sizeObject
            -
          • -
          -
        • -
        -
      • -
      • - - -

        Class org.hsqldb.lib.tar.TarMalformatException extends java.lang.Exception implements Serializable

        -
      • -
      • - - -

        Class org.hsqldb.lib.tar.TarReader.TarEntryHeader.MissingField extends java.lang.Exception implements Serializable

        - -
      • -
      -
      -
    • -
    • -
      -

      Package org.hsqldb.server

      - -
      -
    • -
    • -
      -

      Package org.hsqldb.util

      -
        -
      • - - -

        Class org.hsqldb.util.ConnectionSetting extends java.lang.Object implements Serializable

        -
          -
        • -

          Serialized Fields

          -
            -
          • -

            driver

            -
            java.lang.String driver
            -
          • -
          • -

            name

            -
            java.lang.String name
            -
          • -
          • -

            pw

            -
            java.lang.String pw
            -
          • -
          • -

            url

            -
            java.lang.String url
            -
          • -
          • -

            user

            -
            java.lang.String user
            -
          • -
          -
        • -
        -
      • -
      • - - -

        Class org.hsqldb.util.DatabaseManager extends java.awt.Panel implements Serializable

        -
          -
        • -

          Serialized Fields

          -
            -
          • -

            bHelp

            -
            boolean bHelp
            -
          • -
          • -

            butClear

            -
            java.awt.Button butClear
            -
          • -
          • -

            butExecute

            -
            java.awt.Button butExecute
            -
          • -
          • -

            cConn

            -
            java.sql.Connection cConn
            -
          • -
          • -

            dMeta

            -
            java.sql.DatabaseMetaData dMeta
            -
          • -
          • -

            fMain

            -
            java.awt.Frame fMain
            -
          • -
          • -

            gResult

            -
            org.hsqldb.util.Grid gResult
            -
          • -
          • -

            ifHuge

            -
            java.lang.String ifHuge
            -
          • -
          • -

            imgEmpty

            -
            java.awt.Image imgEmpty
            -
          • -
          • -

            iRecent

            -
            int iRecent
            -
          • -
          • -

            iResult

            -
            int iResult
            -
          • -
          • -

            lTime

            -
            long lTime
            -
          • -
          • -

            mRecent

            -
            java.awt.Menu mRecent
            -
          • -
          • -

            pResult

            -
            java.awt.Panel pResult
            -
          • -
          • -

            sRecent

            -
            java.lang.String[] sRecent
            -
          • -
          • -

            sStatement

            -
            java.sql.Statement sStatement
            -
          • -
          • -

            tTree

            -
            org.hsqldb.util.Tree tTree
            -
          • -
          • -

            txtCommand

            -
            java.awt.TextArea txtCommand
            -
          • -
          • -

            txtResult

            -
            java.awt.TextArea txtResult
            -
          • -
          -
        • -
        -
      • -
      • - - -

        Class org.hsqldb.util.DatabaseManagerSwing extends javax.swing.JFrame implements Serializable

        -
          -
        • -

          Serialized Fields

          -
            -
          • -

            alreadyHandled

            -
            java.awt.event.MouseEvent alreadyHandled
            -
          • -
          • -

            autoRefresh

            -
            boolean autoRefresh
            -
          • -
          • -

            bHelp

            -
            boolean bHelp
            -
          • -
          • -

            boxAutoCommit

            -
            javax.swing.JCheckBoxMenuItem boxAutoCommit
            -
          • -
          • -

            boxAutoRefresh

            -
            javax.swing.JCheckBoxMenuItem boxAutoRefresh
            -
          • -
          • -

            boxLogging

            -
            javax.swing.JCheckBoxMenuItem boxLogging
            -
          • -
          • -

            boxRowCounts

            -
            javax.swing.JCheckBoxMenuItem boxRowCounts
            -
          • -
          • -

            boxShowGrid

            -
            javax.swing.JCheckBoxMenuItem boxShowGrid
            -
          • -
          • -

            boxShowSchemas

            -
            javax.swing.JCheckBoxMenuItem boxShowSchemas
            -
          • -
          • -

            boxShowSys

            -
            javax.swing.JCheckBoxMenuItem boxShowSys
            -
          • -
          • -

            boxTooltips

            -
            javax.swing.JCheckBoxMenuItem boxTooltips
            -
          • -
          • -

            busyText

            -
            java.lang.String busyText
            -
          • -
          • -

            buttonUpdater

            -
            java.lang.Runnable buttonUpdater
            -
          • -
          • -

            buttonUpdaterThread

            -
            java.lang.Thread buttonUpdaterThread
            -
          • -
          • -

            cConn

            -
            java.sql.Connection cConn
            -
          • -
          • -

            currentLAF

            -
            java.lang.String currentLAF
            -
          • -
          • -

            disableButtonRunnable

            -
            java.lang.Runnable disableButtonRunnable
            -
          • -
          • -

            displayRowCounts

            -
            boolean displayRowCounts
            -
          • -
          • -

            dMeta

            -
            java.sql.DatabaseMetaData dMeta
            -
          • -
          • -

            enableButtonRunnable

            -
            java.lang.Runnable enableButtonRunnable
            -
          • -
          • -

            ewSplitPane

            -
            javax.swing.JSplitPane ewSplitPane
            -
          • -
          • -

            fMain

            -
            javax.swing.RootPaneContainer fMain
            -
          • -
          • -

            fMainCursor

            -
            java.awt.Cursor fMainCursor
            -
          • -
          • -

            gResult

            -
            org.hsqldb.util.GridSwing gResult
            -
          • -
          • -

            gResultTable

            -
            javax.swing.JTable gResultTable
            -
            I think this is used to store model info whether we're using Grid - output or not (this object is queried for data to display for - text output mode). - If so, the presentation-independent model part should be moved - to an appropriately-named class instead of storing pure data in - a Swing-specific class.
            -
          • -
          • -

            gridFormat

            -
            boolean gridFormat
            -
          • -
          • -

            gScrollPane

            -
            javax.swing.JScrollPane gScrollPane
            -
          • -
          • -

            iRecent

            -
            int iRecent
            -
          • -
          • -

            isOracle

            -
            boolean isOracle
            -
          • -
          • -

            jbuttonClear

            -
            javax.swing.JButton jbuttonClear
            -
          • -
          • -

            jbuttonExecute

            -
            javax.swing.JButton jbuttonExecute
            -
          • -
          • -

            jframe

            -
            javax.swing.JFrame jframe
            -
          • -
          • -

            jStatusLine

            -
            javax.swing.JLabel jStatusLine
            -
          • -
          • -

            localActionList

            -
            java.util.ArrayList<javax.swing.JMenuItem> localActionList
            -
          • -
          • -

            lTime

            -
            long lTime
            -
          • -
          • -

            mitemAbout

            -
            javax.swing.JMenuItem mitemAbout
            -
          • -
          • -

            mitemHelp

            -
            javax.swing.JMenuItem mitemHelp
            -
          • -
          • -

            mitemUpdateSchemas

            -
            javax.swing.JMenuItem mitemUpdateSchemas
            -
          • -
          • -

            mnuSchemas

            -
            javax.swing.JMenu mnuSchemas
            -
          • -
          • -

            mRecent

            -
            javax.swing.JMenu mRecent
            -
          • -
          • -

            nsSplitPane

            -
            javax.swing.JSplitPane nsSplitPane
            -
          • -
          • -

            prefs

            -
            DatabaseManagerSwing.DBMPrefs prefs
            -
          • -
          • -

            pResult

            -
            javax.swing.JPanel pResult
            -
          • -
          • -

            pStatus

            -
            javax.swing.JPanel pStatus
            -
          • -
          • -

            rbAllSchemas

            -
            javax.swing.JRadioButtonMenuItem rbAllSchemas
            -
          • -
          • -

            rbJavaLF

            -
            javax.swing.JRadioButtonMenuItem rbJavaLF
            -
          • -
          • -

            rbMotifLF

            -
            javax.swing.JRadioButtonMenuItem rbMotifLF
            -
          • -
          • -

            rbNativeLF

            -
            javax.swing.JRadioButtonMenuItem rbNativeLF
            -
          • -
          • -

            rootNode

            -
            javax.swing.tree.DefaultMutableTreeNode rootNode
            -
          • -
          • -

            rowConn

            -
            java.sql.Connection rowConn
            -
          • -
          • -

            schemaFilter

            -
            java.lang.String schemaFilter
            -
          • -
          • -

            schemaListListener

            -
            java.awt.event.ActionListener schemaListListener
            -
          • -
          • -

            showIndexDetails

            -
            boolean showIndexDetails
            -
          • -
          • -

            showSchemas

            -
            boolean showSchemas
            -
          • -
          • -

            showSys

            -
            boolean showSys
            -
          • -
          • -

            showTooltips

            -
            boolean showTooltips
            -
          • -
          • -

            sqlScriptBuffer

            -
            java.lang.String sqlScriptBuffer
            -
            Value of this variable only retained if huge input script read in.
            -
          • -
          • -

            sRecent

            -
            java.lang.String[] sRecent
            -
          • -
          • -

            sStatement

            -
            java.sql.Statement sStatement
            -
          • -
          • -

            tableModel

            -
            javax.swing.table.TableModel tableModel
            -
          • -
          • -

            tipMap

            -
            java.util.HashMap<javax.swing.AbstractButton,​java.lang.String> tipMap
            -
          • -
          • -

            treeModel

            -
            javax.swing.tree.DefaultTreeModel treeModel
            -
          • -
          • -

            treeRefreshRunnable

            -
            java.lang.Runnable treeRefreshRunnable
            -
          • -
          • -

            tScrollPane

            -
            javax.swing.JScrollPane tScrollPane
            -
          • -
          • -

            tTree

            -
            javax.swing.JTree tTree
            -
          • -
          • -

            txtCommand

            -
            javax.swing.JTextArea txtCommand
            -
          • -
          • -

            txtCommandCursor

            -
            java.awt.Cursor txtCommandCursor
            -
          • -
          • -

            txtCommandScroll

            -
            javax.swing.JScrollPane txtCommandScroll
            -
          • -
          • -

            txtResult

            -
            javax.swing.JTextArea txtResult
            -
          • -
          • -

            txtResultCursor

            -
            java.awt.Cursor txtResultCursor
            -
          • -
          • -

            txtResultScroll

            -
            javax.swing.JScrollPane txtResultScroll
            -
          • -
          • -

            waitCursor

            -
            java.awt.Cursor waitCursor
            -
            Wait Cursor
            -
          • -
          -
        • -
        -
      • -
      • - - -

        Class org.hsqldb.util.TableSorter extends javax.swing.table.AbstractTableModel implements Serializable

        -
          -
        • -

          Serialized Fields

          -
            -
          • -

            columnComparators

            -
            java.util.Map columnComparators
            -
          • -
          • -

            modelToView

            -
            int[] modelToView
            -
          • -
          • -

            mouseListener

            -
            java.awt.event.MouseListener mouseListener
            -
          • -
          • -

            sortingColumns

            -
            java.util.List sortingColumns
            -
          • -
          • -

            tableHeader

            -
            javax.swing.table.JTableHeader tableHeader
            -
          • -
          • -

            tableModel

            -
            javax.swing.table.TableModel tableModel
            -
          • -
          • -

            tableModelListener

            -
            javax.swing.event.TableModelListener tableModelListener
            -
          • -
          • -

            viewToModel

            -
            org.hsqldb.util.TableSorter.Row[] viewToModel
            -
          • -
          -
        • -
        -
      • -
      • - - -

        Class org.hsqldb.util.Transfer extends java.awt.Panel implements Serializable

        -
          -
        • -

          Serialized Fields

          -
            -
          • -

            bContinue

            -
            java.awt.Button bContinue
            -
          • -
          • -

            bStart

            -
            java.awt.Button bStart
            -
          • -
          • -

            cAlter

            -
            java.awt.Checkbox cAlter
            -
          • -
          • -

            cCreate

            -
            java.awt.Checkbox cCreate
            -
          • -
          • -

            cCreateIndex

            -
            java.awt.Checkbox cCreateIndex
            -
          • -
          • -

            cDelete

            -
            java.awt.Checkbox cDelete
            -
          • -
          • -

            cDrop

            -
            java.awt.Checkbox cDrop
            -
          • -
          • -

            cDropIndex

            -
            java.awt.Checkbox cDropIndex
            -
          • -
          • -

            cFKForced

            -
            java.awt.Checkbox cFKForced
            -
          • -
          • -

            cIdxForced

            -
            java.awt.Checkbox cIdxForced
            -
          • -
          • -

            cInsert

            -
            java.awt.Checkbox cInsert
            -
          • -
          • -

            cTransfer

            -
            java.awt.Checkbox cTransfer
            -
          • -
          • -

            CurrentAlter

            -
            int CurrentAlter
            -
          • -
          • -

            CurrentTransfer

            -
            int CurrentTransfer
            -
          • -
          • -

            fMain

            -
            java.awt.Frame fMain
            -
          • -
          • -

            iMaxRows

            -
            int iMaxRows
            -
          • -
          • -

            imgEmpty

            -
            java.awt.Image imgEmpty
            -
          • -
          • -

            iSelectionStep

            -
            int iSelectionStep
            -
          • -
          • -

            iTransferMode

            -
            int iTransferMode
            -
          • -
          • -

            lTable

            -
            java.awt.List lTable
            -
          • -
          • -

            sDestCatalog

            -
            java.lang.String sDestCatalog
            -
          • -
          • -

            sDestSchema

            -
            java.lang.String sDestSchema
            -
          • -
          • -

            sourceDb

            -
            org.hsqldb.util.DataAccessPoint sourceDb
            -
          • -
          • -

            sSourceCatalog

            -
            java.lang.String sSourceCatalog
            -
          • -
          • -

            sSourceSchemas

            -
            java.lang.String[] sSourceSchemas
            -
          • -
          • -

            targetDb

            -
            org.hsqldb.util.DataAccessPoint targetDb
            -
          • -
          • -

            tCurrent

            -
            org.hsqldb.util.TransferTable tCurrent
            -
          • -
          • -

            tDestAlter

            -
            java.awt.TextField tDestAlter
            -
          • -
          • -

            tDestCreate

            -
            java.awt.TextField tDestCreate
            -
          • -
          • -

            tDestCreateIndex

            -
            java.awt.TextField tDestCreateIndex
            -
          • -
          • -

            tDestDelete

            -
            java.awt.TextField tDestDelete
            -
          • -
          • -

            tDestDrop

            -
            java.awt.TextField tDestDrop
            -
          • -
          • -

            tDestDropIndex

            -
            java.awt.TextField tDestDropIndex
            -
          • -
          • -

            tDestInsert

            -
            java.awt.TextField tDestInsert
            -
          • -
          • -

            tDestTable

            -
            java.awt.TextField tDestTable
            -
          • -
          • -

            tMessage

            -
            java.awt.TextField tMessage
            -
          • -
          • -

            tSourceSelect

            -
            java.awt.TextField tSourceSelect
            -
          • -
          • -

            tSourceTable

            -
            java.awt.TextField tSourceTable
            -
          • -
          • -

            tTable

            -
            java.util.Vector tTable
            -
          • -
          -
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocs/type-search-index.js b/database/hsqldb/doc/apidocs/type-search-index.js deleted file mode 100644 index e5d11886..00000000 --- a/database/hsqldb/doc/apidocs/type-search-index.js +++ /dev/null @@ -1 +0,0 @@ -typeSearchIndex = [{"p":"org.hsqldb.server","l":"ServerAcl.AclFormatException"},{"l":"All Classes","url":"allclasses-index.html"},{"p":"org.hsqldb.lib","l":"AppendableException"},{"p":"org.hsqldb.lib","l":"ArrayCounter"},{"p":"org.hsqldb.lib","l":"ArrayListIdentity"},{"p":"org.hsqldb.lib","l":"ArraySort"},{"p":"org.hsqldb.lib","l":"ArrayUtil"},{"p":"org.hsqldb.lib","l":"AsciiInputStream"},{"p":"org.hsqldb.lib","l":"AsciiOutputStream"},{"p":"org.hsqldb.auth","l":"AuthBeanMultiplexer"},{"p":"org.hsqldb.auth","l":"AuthFunctionBean"},{"p":"org.hsqldb.auth","l":"AuthUtils"},{"p":"org.hsqldb.lib","l":"BasicTextJdkLogFormatter"},{"p":"org.hsqldb.lib","l":"CharArrayWriter"},{"p":"org.hsqldb.lib","l":"ClosableByteArrayOutputStream"},{"p":"org.hsqldb.lib","l":"ClosableCharArrayWriter"},{"p":"org.hsqldb.util","l":"CodeSwitcher"},{"p":"org.hsqldb.lib","l":"Collection"},{"p":"org.hsqldb.lib.tar","l":"TarFileOutputStream.Compression"},{"p":"org.hsqldb.util","l":"ConnectionSetting"},{"p":"org.hsqldb.lib","l":"CountdownInputStream"},{"p":"org.hsqldb.lib","l":"CountUpDownLatch"},{"p":"org.hsqldb.util","l":"DatabaseManager"},{"p":"org.hsqldb.util","l":"DatabaseManagerSwing"},{"p":"org.hsqldb.lib","l":"DataOutputStream"},{"p":"org.hsqldb.lib.tar","l":"DbBackup"},{"p":"org.hsqldb.lib.tar","l":"DbBackupMain"},{"p":"org.hsqldb.util","l":"DatabaseManagerSwing.DBMPrefs"},{"p":"org.hsqldb.lib","l":"ObjectComparator.DefaultComparator"},{"p":"org.hsqldb.auth","l":"DenyException"},{"p":"org.hsqldb.lib","l":"DoubleIntIndex"},{"p":"org.hsqldb.lib","l":"DoubleLongIndex"},{"p":"org.hsqldb.lib","l":"Map.Entry"},{"p":"org.hsqldb.lib","l":"EventLogInterface"},{"p":"org.hsqldb.lib","l":"FileAccess"},{"p":"org.hsqldb.lib","l":"FileAccessRes"},{"p":"org.hsqldb.lib","l":"FileArchiver"},{"p":"org.hsqldb.lib","l":"FileAccess.FileSync"},{"p":"org.hsqldb.lib","l":"FileUtil.FileSync"},{"p":"org.hsqldb.lib","l":"FileUtil"},{"p":"org.hsqldb.lib","l":"FilteredIterator.Filter"},{"p":"org.hsqldb.lib","l":"FilteredIterator"},{"p":"org.hsqldb.lib","l":"FrameworkLogger"},{"p":"org.hsqldb.lib","l":"HashMap"},{"p":"org.hsqldb.lib","l":"HashSet"},{"p":"org.hsqldb.lib","l":"HsqlArrayHeap"},{"p":"org.hsqldb.lib","l":"HsqlArrayList"},{"p":"org.hsqldb.lib","l":"HsqlByteArrayInputStream"},{"p":"org.hsqldb.lib","l":"HsqlByteArrayOutputStream"},{"p":"org.hsqldb.lib","l":"HsqlConsoleHandler"},{"p":"org.hsqldb.auth","l":"HsqldbSlaveAuthBean"},{"p":"org.hsqldb.lib","l":"HsqlDeque"},{"p":"org.hsqldb.lib","l":"HsqlHeap"},{"p":"org.hsqldb.server","l":"HsqlServerFactory"},{"p":"org.hsqldb.server","l":"HsqlSocketFactory"},{"p":"org.hsqldb.server","l":"HsqlSocketFactorySecure"},{"p":"org.hsqldb.server","l":"HsqlSocketRequestHandler"},{"p":"org.hsqldb.lib","l":"HsqlTaskQueue"},{"p":"org.hsqldb.lib","l":"HsqlTimer"},{"p":"org.hsqldb.lib","l":"ObjectComparator.IdentityComparator"},{"p":"org.hsqldb.lib","l":"InOutUtil"},{"p":"org.hsqldb.lib","l":"InputStreamInterface"},{"p":"org.hsqldb.lib","l":"InputStreamWrapper"},{"p":"org.hsqldb.lib","l":"IntHashSet"},{"p":"org.hsqldb.lib","l":"IntIndex"},{"p":"org.hsqldb.lib","l":"IntKeyHashMap"},{"p":"org.hsqldb.lib","l":"IntKeyHashMapConcurrent"},{"p":"org.hsqldb.lib","l":"IntKeyIntValueHashMap"},{"p":"org.hsqldb.lib","l":"IntKeyLongValueHashMap"},{"p":"org.hsqldb.lib","l":"IntLookup"},{"p":"org.hsqldb.lib","l":"IntValueHashMap"},{"p":"org.hsqldb.lib","l":"Iterator"},{"p":"org.hsqldb.auth","l":"JaasAuthBean"},{"p":"org.hsqldb.jdbc","l":"JDBCArray"},{"p":"org.hsqldb.jdbc","l":"JDBCArrayBasic"},{"p":"org.hsqldb.jdbc","l":"JDBCBlob"},{"p":"org.hsqldb.jdbc","l":"JDBCBlobClient"},{"p":"org.hsqldb.jdbc","l":"JDBCBlobFile"},{"p":"org.hsqldb.jdbc","l":"JDBCCallableStatement"},{"p":"org.hsqldb.jdbc","l":"JDBCClob"},{"p":"org.hsqldb.jdbc","l":"JDBCClobClient"},{"p":"org.hsqldb.jdbc","l":"JDBCClobFile"},{"p":"org.hsqldb.jdbc","l":"JDBCColumnMetaData"},{"p":"org.hsqldb.jdbc","l":"JDBCCommonDataSource"},{"p":"org.hsqldb.jdbc","l":"JDBCConnection"},{"p":"org.hsqldb.jdbc","l":"JDBCConnectionEventListener"},{"p":"org.hsqldb.jdbc","l":"JDBCDatabaseMetaData"},{"p":"org.hsqldb.jdbc","l":"JDBCDataSource"},{"p":"org.hsqldb.jdbc","l":"JDBCDataSourceFactory"},{"p":"org.hsqldb.jdbc","l":"JDBCDriver"},{"p":"org.hsqldb.jdbc","l":"JDBCNClob"},{"p":"org.hsqldb.jdbc","l":"JDBCParameterMetaData"},{"p":"org.hsqldb.jdbc","l":"JDBCPool"},{"p":"org.hsqldb.jdbc.pool","l":"JDBCPooledConnection"},{"p":"org.hsqldb.jdbc.pool","l":"JDBCPooledDataSource"},{"p":"org.hsqldb.jdbc","l":"JDBCPreparedStatement"},{"p":"org.hsqldb.jdbc","l":"JDBCResultSet"},{"p":"org.hsqldb.jdbc","l":"JDBCResultSetMetaData"},{"p":"org.hsqldb.jdbc","l":"JDBCRowId"},{"p":"org.hsqldb.jdbc","l":"JDBCSavepoint"},{"p":"org.hsqldb.jdbc","l":"JDBCSQLXML"},{"p":"org.hsqldb.jdbc","l":"JDBCStatement"},{"p":"org.hsqldb.jdbc","l":"JDBCUtil"},{"p":"org.hsqldb.jdbc.pool","l":"JDBCXAConnection"},{"p":"org.hsqldb.jdbc.pool","l":"JDBCXAConnectionWrapper"},{"p":"org.hsqldb.jdbc.pool","l":"JDBCXADataSource"},{"p":"org.hsqldb.jdbc.pool","l":"JDBCXAResource"},{"p":"org.hsqldb.jdbc.pool","l":"JDBCXID"},{"p":"org.hsqldb.lib","l":"KMPSearchAlgorithm"},{"p":"org.hsqldb.auth","l":"LdapAuthBean"},{"p":"org.hsqldb.auth","l":"LdapAuthBeanTester"},{"p":"org.hsqldb.lib","l":"LineGroupReader"},{"p":"org.hsqldb.lib","l":"LineReader"},{"p":"org.hsqldb.lib","l":"List"},{"p":"org.hsqldb.lib","l":"ReadWriteLockDummy.LockDummy"},{"p":"org.hsqldb.lib","l":"LongDeque"},{"p":"org.hsqldb.lib","l":"LongKeyHashMap"},{"p":"org.hsqldb.lib","l":"LongKeyIntValueHashMap"},{"p":"org.hsqldb.lib","l":"LongKeyLongValueHashMap"},{"p":"org.hsqldb.lib","l":"LongLookup"},{"p":"org.hsqldb.lib","l":"LongValueHashMap"},{"p":"org.hsqldb.util","l":"MainInvoker"},{"p":"org.hsqldb.lib","l":"Map"},{"p":"org.hsqldb.lib","l":"MapEntry"},{"p":"org.hsqldb.lib","l":"MultiValueHashMap"},{"p":"org.hsqldb.lib","l":"Notified"},{"p":"org.hsqldb.lib","l":"ObjectComparator"},{"p":"org.hsqldb.server","l":"OdbcUtil"},{"p":"org.hsqldb.lib","l":"OrderedHashMap"},{"p":"org.hsqldb.lib","l":"OrderedHashSet"},{"p":"org.hsqldb.lib","l":"OrderedIntHashSet"},{"p":"org.hsqldb.lib","l":"OrderedIntKeyHashMap"},{"p":"org.hsqldb.lib","l":"OrderedLongHashSet"},{"p":"org.hsqldb.lib","l":"OrderedLongKeyHashMap"},{"p":"org.hsqldb.server","l":"PgType"},{"p":"org.hsqldb.lib.tar","l":"PIFData"},{"p":"org.hsqldb.lib.tar","l":"PIFGenerator"},{"p":"org.hsqldb.lib","l":"PrimitiveIterator"},{"p":"org.hsqldb.lib.tar","l":"RB"},{"p":"org.hsqldb.util","l":"RCData"},{"p":"org.hsqldb.lib","l":"ReaderInputStream"},{"p":"org.hsqldb.lib","l":"ReadWriteLockDummy"},{"p":"org.hsqldb.lib","l":"RefCapablePropertyResourceBundle"},{"p":"org.hsqldb.lib","l":"RefCapableRBInterface"},{"p":"org.hsqldb.jdbc","l":"JDBCSQLXML.SAX2XMLStreamWriter"},{"p":"org.hsqldb.lib","l":"ScannerSearchAlgorithm"},{"p":"org.hsqldb.server","l":"Server"},{"p":"org.hsqldb.server","l":"ServerAcl"},{"p":"org.hsqldb.server","l":"ServerConfiguration"},{"p":"org.hsqldb.server","l":"ServerConstants"},{"p":"org.hsqldb.server","l":"ServerProperties"},{"p":"org.hsqldb.lib","l":"Set"},{"p":"org.hsqldb.lib","l":"SimpleLog"},{"p":"org.hsqldb.lib","l":"StopWatch"},{"p":"org.hsqldb.lib","l":"StringComparator"},{"p":"org.hsqldb.lib","l":"StringConverter"},{"p":"org.hsqldb.lib","l":"StringInputStream"},{"p":"org.hsqldb.lib","l":"StringUtil"},{"p":"org.hsqldb.util","l":"TableSorter"},{"p":"org.hsqldb.lib.tar","l":"TarFileInputStream"},{"p":"org.hsqldb.lib.tar","l":"TarFileOutputStream"},{"p":"org.hsqldb.lib.tar","l":"TarGenerator"},{"p":"org.hsqldb.lib.tar","l":"TarGeneratorMain"},{"p":"org.hsqldb.lib.tar","l":"TarHeaderField"},{"p":"org.hsqldb.lib.tar","l":"TarMalformatException"},{"p":"org.hsqldb.lib.tar","l":"TarReader"},{"p":"org.hsqldb.lib.tar","l":"TarReaderMain"},{"p":"org.hsqldb.lib","l":"ThreadFactory"},{"p":"org.hsqldb.util","l":"Transfer"},{"p":"org.hsqldb.trigger","l":"Trigger"},{"p":"org.hsqldb.auth","l":"JaasAuthBean.UPCallbackHandler"},{"p":"org.hsqldb.lib","l":"ValidatingResourceBundle"},{"p":"org.hsqldb.server","l":"WebServer"},{"p":"org.hsqldb.lib","l":"WrapperIterator"}] \ No newline at end of file diff --git a/database/hsqldb/doc/apidocs/type-search-index.zip b/database/hsqldb/doc/apidocs/type-search-index.zip deleted file mode 100644 index a0c6ecba..00000000 Binary files a/database/hsqldb/doc/apidocs/type-search-index.zip and /dev/null differ diff --git a/database/hsqldb/doc/apidocssqltool/allclasses-index.html b/database/hsqldb/doc/apidocssqltool/allclasses-index.html deleted file mode 100644 index f89c19fa..00000000 --- a/database/hsqldb/doc/apidocssqltool/allclasses-index.html +++ /dev/null @@ -1,209 +0,0 @@ - - - - - -All Classes (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    All Classes

    -
    -
    - -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/allclasses.html b/database/hsqldb/doc/apidocssqltool/allclasses.html deleted file mode 100644 index 43ac5930..00000000 --- a/database/hsqldb/doc/apidocssqltool/allclasses.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -All Classes (HSQLDB 2.7.2 API) - - - - - - - - - - - - -

    All Classes

    -
    - -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/allpackages-index.html b/database/hsqldb/doc/apidocssqltool/allpackages-index.html deleted file mode 100644 index fa989ac9..00000000 --- a/database/hsqldb/doc/apidocssqltool/allpackages-index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - -All Packages (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    All Packages

    -
    -
    -
      -
    • - - - - - - - - - - - - -
      Package Summary 
      PackageDescription
      org.hsqldb.cmdline -
      Contains the SqlTool command-line tool
      -
      -
    • -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/constant-values.html b/database/hsqldb/doc/apidocssqltool/constant-values.html deleted file mode 100644 index 1931c609..00000000 --- a/database/hsqldb/doc/apidocssqltool/constant-values.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - -Constant Field Values (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Constant Field Values

    -
    -

    Contents

    - -
    -
    -
    - - -
    -

    org.hsqldb.*

    - -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/deprecated-list.html b/database/hsqldb/doc/apidocssqltool/deprecated-list.html deleted file mode 100644 index 5fd90654..00000000 --- a/database/hsqldb/doc/apidocssqltool/deprecated-list.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Deprecated List (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Deprecated API

    -

    Contents

    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/element-list b/database/hsqldb/doc/apidocssqltool/element-list deleted file mode 100644 index 47c1b49a..00000000 --- a/database/hsqldb/doc/apidocssqltool/element-list +++ /dev/null @@ -1,2 +0,0 @@ -module:org.hsqldb.sqltool -org.hsqldb.cmdline diff --git a/database/hsqldb/doc/apidocssqltool/help-doc.html b/database/hsqldb/doc/apidocssqltool/help-doc.html deleted file mode 100644 index 916158d3..00000000 --- a/database/hsqldb/doc/apidocssqltool/help-doc.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - -API Help (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    How This API Document Is Organized

    -
    This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
    -
    -
    -
      -
    • -
      -

      Module

      -

      Each module has a page that contains a list of its packages, dependencies on other modules, and services, with a summary for each. These page may contain three categories:

      -
        -
      • Packages
      • -
      • Modules
      • -
      • Services
      • -
      -
      -
    • -
    • -
      -

      Package

      -

      Each package has a page that contains a list of its classes and interfaces, with a summary for each. These pages may contain six categories:

      -
        -
      • Interfaces
      • -
      • Classes
      • -
      • Enums
      • -
      • Exceptions
      • -
      • Errors
      • -
      • Annotation Types
      • -
      -
      -
    • -
    • -
      -

      Class or Interface

      -

      Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

      -
        -
      • Class Inheritance Diagram
      • -
      • Direct Subclasses
      • -
      • All Known Subinterfaces
      • -
      • All Known Implementing Classes
      • -
      • Class or Interface Declaration
      • -
      • Class or Interface Description
      • -
      -
      -
        -
      • Nested Class Summary
      • -
      • Field Summary
      • -
      • Property Summary
      • -
      • Constructor Summary
      • -
      • Method Summary
      • -
      -
      -
        -
      • Field Detail
      • -
      • Property Detail
      • -
      • Constructor Detail
      • -
      • Method Detail
      • -
      -

      Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

      -
      -
    • -
    • -
      -

      Annotation Type

      -

      Each annotation type has its own separate page with the following sections:

      -
        -
      • Annotation Type Declaration
      • -
      • Annotation Type Description
      • -
      • Required Element Summary
      • -
      • Optional Element Summary
      • -
      • Element Detail
      • -
      -
      -
    • -
    • -
      -

      Enum

      -

      Each enum has its own separate page with the following sections:

      -
        -
      • Enum Declaration
      • -
      • Enum Description
      • -
      • Enum Constant Summary
      • -
      • Enum Constant Detail
      • -
      -
      -
    • -
    • -
      -

      Use

      -

      Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its "Use" page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.

      -
      -
    • -
    • -
      -

      Tree (Class Hierarchy)

      -

      There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. Classes are organized by inheritance structure starting with java.lang.Object. Interfaces do not inherit from java.lang.Object.

      -
        -
      • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
      • -
      • When viewing a particular package, class or interface page, clicking on "Tree" displays the hierarchy for only that package.
      • -
      -
      -
    • -
    • -
      -

      Deprecated API

      -

      The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

      -
      -
    • -
    • -
      -

      Index

      -

      The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields, as well as lists of all packages and all classes.

      -
      -
    • -
    • -
      -

      All Classes

      -

      The All Classes link shows all classes and interfaces except non-static nested types.

      -
      -
    • -
    • -
      -

      Serialized Form

      -

      Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

      -
      -
    • -
    • -
      -

      Constant Field Values

      -

      The Constant Field Values page lists the static final fields and their values.

      -
      -
    • -
    • -
      -

      Search

      -

      You can search for definitions of modules, packages, types, fields, methods and other terms defined in the API, using some or all of the name. "Camel-case" abbreviations are supported: for example, "InpStr" will find "InputStream" and "InputStreamReader".

      -
      -
    • -
    -
    -This help file applies to API documentation generated by the standard doclet.
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/hsqldbs.png b/database/hsqldb/doc/apidocssqltool/hsqldbs.png deleted file mode 100644 index 4512b84f..00000000 Binary files a/database/hsqldb/doc/apidocssqltool/hsqldbs.png and /dev/null differ diff --git a/database/hsqldb/doc/apidocssqltool/index-all.html b/database/hsqldb/doc/apidocssqltool/index-all.html deleted file mode 100644 index 4b8cf6c5..00000000 --- a/database/hsqldb/doc/apidocssqltool/index-all.html +++ /dev/null @@ -1,952 +0,0 @@ - - - - - -Index (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    A B C D E F G H I J L M N O P Q R S T V 
    All Classes All Packages - - -

    A

    -
    -
    a_setting - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    aborting - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    addMacros(Map<String, Token>) - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    addUserVars(Map<String, String>) - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    append_empty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    arrayimp_jvmreq - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    arrayval_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    auto_unset_warning - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    autocommit_fetchfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    B

    -
    -
    bad_time_format - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    bang_command_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    bang_incomplete - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    binary_filefail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    binary_loadedbytesinto - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    binbuf_write - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    binbuffer_empty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    bitCharsToBytes(String) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Just a stub for now.
    -
    -
    boolean_bad - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    break_syntax - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    break_unsatisfied - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    buffer_empty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    buffer_executing - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    buffer_extrachars - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    buffer_help - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    buffer_instructions - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    buffer_restored - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    buffer_unknown - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    bufhist_unspecified - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    C

    -
    -
    c_setting - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    canDisplayType(int) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    This method is used to tell SqlFile whether this Sql Type must - ALWAYS be loaded to the binary buffer without displaying.
    -
    -
    causereport - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    closeReader() - Method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Close the reader.
    -
    -
    commandnum_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    committed - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    conndata_retrieval_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    connect_failure - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    connected_fallbackmsg - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    CONNECTERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    connection_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    continue_syntax - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    continue_unsatisfied - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    convertEscapes(String) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Translates user-supplied escapes into the traditionaly - corresponding binary characters.
    -
    -
    csv_coldelim_present - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    csv_quote_unterminated - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    D

    -
    -
    d_options - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    DEFAULT_RCFILE - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    deprecated_noop - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    describe_table_datatype - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    describe_table_name - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    describe_table_nonulls - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    describe_table_precision - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    describe_table_scale - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    describe_table_width - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    destfile_demand - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    desturl_nowrite - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    disconnect_failure - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    disconnect_success - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    disconnected_msg - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_bincol - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_colcount_mismatch - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_coldelim_present - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_constcols_nullcol - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_header_matchernonhead - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_header_none - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_header_nonswitched - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_header_noswitchmatch - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_header_noswitchtarg - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_import_summary - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_insertcol_mismatch - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_m_syntax - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_metadata_mismatch - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_nocolheader - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_nocolsleft - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_nullrep_present - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_options - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_q_nodblquote - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_recin_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_rejectfile_purgefail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_rejectfile_setupfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_rejectreport_purgefail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_rejectreport_setupfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_rowdelim_present - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_skipcols_missing - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_targetfile_demand - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsv_x_syntax - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dsvSafe(String) - Method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Validate that String is safe to write TO DSV file.
    -
    -
    dumpload_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    dumpload_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    E

    -
    -
    edit_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    editbuffer_contents - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    else_without_if - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    encode_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    end_noblock - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    errorat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    escapeHtml(String) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Escaping rules taken from 'Reserved Characters in HTML table at - http://www.w3schools.com/tags/ref_entities.asp
    -
    -
    exectime_report - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    exectime_reporting - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    execute() - Method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Process all the commands from the file or Reader associated with - "this" object.
    -
    -
    - - - -

    F

    -
    -
    file_appendfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    file_readfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    file_writefail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    file_wrotechars - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    FILEERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    - - - -

    G

    -
    -
    getBanner(Connection) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Returns a String report for the specified JDBC Connection.
    -
    -
    getConnection() - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    getCurrentSchema() - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    getExpandedString() - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getExpandedString(String...) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getMacros() - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    getString() - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(int) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(int, int) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(int, int, int) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(int, int, String) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(int, String) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(int, String, int) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(int, String, String) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(String...) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(String, int) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(String, int, int) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(String, int, String) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(String, String, int) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getString(Throwable) - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    getUserVars() - Method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Get a reference to the user variable map.
    -
    -
    - - - -

    H

    -
    -
    hexCharOctetsToBytes(String) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Convert a String to a byte array by interpreting every 2 characters as an - octal byte value.
    -
    -
    history_back - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    history_backto - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    history_none - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    history_number_req - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    history_unavailable - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    history_upto - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    html_mode - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    I

    -
    -
    ifwhile_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    illegal_at - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    import_col_dup - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    importDsv(URL, String) - Method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Name is self-explanatory.
    -
    -
    input_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    input_movedtobuffer - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    input_unterminated - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    INPUTERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    inputfile_closefail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    inputrec_modified - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    insertion_preparefail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    insertions_notcommitted - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    IOERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    - - - -

    J

    -
    -
    jdbc_established - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    L

    -
    -
    loadBinary(File) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Legacy function.
    -
    -
    loadBinary(URL) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Binary file load
    -
    -
    log_syntax - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    log_syntax_error - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    logical_unrecognized - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    LS - Static variable in class org.hsqldb.cmdline.SqlFile
    -
    -
    Platform-specific line separator
    -
    -
    LS - Static variable in class org.hsqldb.cmdline.SqlTool
    -
    -
    Platform-specific line separator
    -
    -
    LS - Static variable in class org.hsqldb.cmdline.SqlToolSprayer
    -
     
    -
    - - - -

    M

    -
    -
    macro_help - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    macro_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    macro_tip - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    macro_undefined - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    macrodef_empty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    macrodef_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    macrodef_semi - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    main(String[]) - Static method in class org.hsqldb.cmdline.SqlTool
    -
    -
    A static wrapper for objectMain, so that that method may be executed - as a Java "program".
    -
    -
    main(String[]) - Static method in class org.hsqldb.cmdline.SqlToolSprayer
    -
     
    -
    math_expr_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    metadata_fetch_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    metadata_fetch_failfor - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    N

    -
    -
    no_required_conn - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    no_timestamp_format - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    no_vendor_schemaspt - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    nobuffer_yet - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    none - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    noresult - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    null_assignment - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    O

    -
    -
    objectMain(String[]) - Static method in class org.hsqldb.cmdline.SqlTool
    -
    -
    Connect to a JDBC Database and execute the commands given on - stdin or in SQL file(s).
    -
    -
    org.hsqldb.cmdline - package org.hsqldb.cmdline
    -
    -
    Contains the SqlTool command-line tool
    -
    -
    org.hsqldb.sqltool - module org.hsqldb.sqltool
    -
     
    -
    outputfile_header - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    outputfile_nonetoclose - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    outputfile_reopening - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    P

    -
    -
    password_readfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    passwordFor_prompt - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pipeclose_failure - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_assign - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_block_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_block_unterminated - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_control - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_help - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_list_lengths - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_list_parens - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_malformat_specific - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_unknown - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    pl_unset_nomoreargs - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    plalias_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    plvar_nameempty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    plvar_nocolon - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    plvar_set_incomplete - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    plvar_tildedash_nomoreargs - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    plvar_undefined - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    plvar_unterminated - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    prepare_demandqm - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    primaryinput_accessfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    Q

    -
    -
    query_metadatafail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    R

    -
    -
    raw_empty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    raw_leadin - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    raw_movedtobuffer - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rawmode_prompt - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rcdata_driver_conflict - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rcdata_genfromvalues_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rcdata_inline_extravars - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rcdata_inlineurl_missing - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rcdata_password_visible - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    RCERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    read_convertfail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    read_partial - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    read_toobig - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    regex_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    reject_rpc - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rejectreport_bottom - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rejectreport_row - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rejectreport_top - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    remove_empty_vars_suggestset - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rollingback - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    row_update_multiple - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    row_update_singular - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rows_fetched - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rows_fetched_dsv - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rpc_autocommit_failure - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    rpc_commit_failure - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    S

    -
    -
    schemaname_retrieval_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    setAutoClose(boolean) - Method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Specify whether the supplied or generated input Reader should - automatically be closed by the execute() method.
    -
    -
    setConnection(Connection) - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    setContinueOnError(boolean) - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    setMaxHistoryLength(int) - Method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    special_b_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    special_d_like - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    special_d_unknown - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    special_extrachars - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    special_help - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    special_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    special_unknown - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    special_unspecified - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    sqlarray_badjvm - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SQLERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    SqlFile - Class in org.hsqldb.cmdline
    -
    -
    Encapsulation of SQL text and the environment under which it will be - executed with a JDBC Connection.
    -
    -
    SqlFile(File) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
    -
    Convenience wrapper for the SqlFile(File, String) constructor
    -
    -
    SqlFile(File, String) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
    -
    Convenience wrapper for the SqlFile(File, String, boolean) constructor
    -
    -
    SqlFile(File, String, boolean) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
    -
    Constructor for non-interactive usage with a SQL file, using the - specified encoding and sending normal output to stdout.
    -
    -
    SqlFile(Reader, String, PrintStream, String, boolean, File) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
    -
    Legacy constructor.
    -
    -
    SqlFile(Reader, String, PrintStream, String, boolean, URL) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
    -
    Instantiate a SqlFile instance for SQL input from 'reader'.
    -
    -
    SqlFile(String, boolean) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
    -
    Constructor for interactive usage with stdin/stdout
    -
    -
    SqlFile(URL) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
     
    -
    SqlFile(URL, String) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
     
    -
    SqlFile(URL, String, boolean) - Constructor for class org.hsqldb.cmdline.SqlFile
    -
     
    -
    SqlFile_banner - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    sqlfile_execute_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    sqlfile_name_demand - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SqlFile.BadSpecial - Exception in org.hsqldb.cmdline
    -
    -
    Utility nested Exception class for internal use only.
    -
    -
    sqlstatement_empty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    sqltempfile_fail - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SqlTool - Class in org.hsqldb.cmdline
    -
    -
    A command-line JDBC SQL tool supporting both interactive and - non-interactive usage.
    -
    -
    SqlTool() - Constructor for class org.hsqldb.cmdline.SqlTool
    -
     
    -
    SqlTool_abort_continue_mutuallyexclusive - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SqlTool_params_redundant - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SqlTool_syntax - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SqlTool_varset_badformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SqlTool.SqlToolException - Exception in org.hsqldb.cmdline
    -
     
    -
    SQLTOOLERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    SqlToolError - Exception in org.hsqldb.cmdline
    -
    -
    Exceptions thrown by the SqlTool system externally to SqlFile.
    -
    -
    SqlToolError() - Constructor for exception org.hsqldb.cmdline.SqlToolError
    -
     
    -
    SqlToolError(String) - Constructor for exception org.hsqldb.cmdline.SqlToolError
    -
     
    -
    SqlToolError(String, Throwable) - Constructor for exception org.hsqldb.cmdline.SqlToolError
    -
     
    -
    SqlToolError(Throwable) - Constructor for exception org.hsqldb.cmdline.SqlToolError
    -
     
    -
    SqltoolRB - Enum in org.hsqldb.cmdline
    -
    -
    Resource Bundle for SqlTool and associated classes.
    -
    -
    SqlToolSprayer - Class in org.hsqldb.cmdline
    -
    -
    Sql Tool Sprayer.
    -
    -
    SqlToolSprayer() - Constructor for class org.hsqldb.cmdline.SqlToolSprayer
    -
     
    -
    sqlTypeToString(int) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    Return a String representation of the specified java.sql.Types type.
    -
    -
    streamread_failure - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    streamToBytes(InputStream) - Static method in class org.hsqldb.cmdline.SqlFile
    -
    -
    As the name says...
    -
    -
    streamToString(InputStream, String) - Method in class org.hsqldb.cmdline.SqlFile
    -
    -
    As the name says...
    -
    -
    substitution_malformat - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    substitution_nomatch - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    substitution_syntax - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    suggest_j - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    SYNTAXERR_EXITVAL - Static variable in class org.hsqldb.cmdline.SqlTool
    -
     
    -
    sysprop_empty - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    sysprop_undefined - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    sysprop_unterminated - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    T

    -
    -
    time_bad - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    toPaddedString(String, int, char, boolean) - Static method in class org.hsqldb.cmdline.SqlFile
    -
     
    -
    toString() - Method in enum org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    transiso_report - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    - - - -

    V

    -
    -
    valueOf(String) - Static method in enum org.hsqldb.cmdline.SqltoolRB
    -
    -
    Returns the enum constant of this type with the specified name.
    -
    -
    values() - Static method in enum org.hsqldb.cmdline.SqltoolRB
    -
    -
    Returns an array containing the constants of this enum type, in -the order they are declared.
    -
    -
    var_infinite - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    varname_warning - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    vendor_derby_dr - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    vendor_derby_du - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    vendor_nosup_d - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    vendor_nosup_sysschemas - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    vendor_oracle_dS - org.hsqldb.cmdline.SqltoolRB
    -
     
    -
    -A B C D E F G H I J L M N O P Q R S T V 
    All Classes All Packages
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/index.html b/database/hsqldb/doc/apidocssqltool/index.html deleted file mode 100644 index 7ac5aff9..00000000 --- a/database/hsqldb/doc/apidocssqltool/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -HSQLDB 2.7.2 API - - - - - - - -
    - -

    org.hsqldb.sqltool/module-summary.html

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/javadoc.css b/database/hsqldb/doc/apidocssqltool/javadoc.css deleted file mode 100644 index 7345ff2b..00000000 --- a/database/hsqldb/doc/apidocssqltool/javadoc.css +++ /dev/null @@ -1,600 +0,0 @@ -/* Javadoc style sheet */ -/* -Overall document style -*/ - -@import url('resources/fonts/dejavu.css'); - -body { - background-color:#ffffff; - color:#353833; - font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; - font-size:14px; - margin:0; -} -a:link, a:visited { - text-decoration:none; - color:#4A6782; -} -a:hover, a:focus { - text-decoration:none; - color:#bb7a2a; -} -a:active { - text-decoration:none; - color:#4A6782; -} -a[name] { - color:#353833; -} -a[name]:hover { - text-decoration:none; - color:#353833; -} -pre { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; -} -h1 { - font-size:16px; -} -h2 { - font-size:15px; -} -h3 { - font-size:14px; - font-style:italic; -} -h4 { - font-size:13px; -} -h5 { - font-size:12px; -} -h6 { - font-size:11px; -} -ul { - list-style-type:disc; -} -code, tt { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; - margin-top:8px; - line-height:1.4em; -} -dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - padding-top:4px; -} -table tr td dt code { - font-family:'DejaVu Sans Mono', monospace; - font-size:14px; - vertical-align:top; - padding-top:4px; -} -sup { - font-size:8px; -} -/* -Document title and Copyright styles -*/ -.clear { - clear:both; - height:0px; - overflow:hidden; -} -.aboutLanguage { - float:right; - padding:0px 21px; - font-size:11px; - z-index:200; - margin-top:-9px; -} -.legalCopy { - margin-left:.5em; -} -.bar a, .bar a:link, .bar a:visited, .bar a:active { - color:#FFFFFF; - text-decoration:none; -} -.bar a:hover, .bar a:focus { - color:#bb7a2a; -} -.tab { - background-color:#0066FF; - color:#ffffff; - padding:8px; - width:5em; - font-weight:bold; -} -/* -Navigation bar styles -*/ -.bar { - background-color:#4D7A97; - color:#FFFFFF; - padding:.8em .5em .4em .8em; - height:auto;/*height:1.8em;*/ - font-size:11px; - margin:0; -} -.topNav { - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.bottomNav { - margin-top:10px; - background-color:#4D7A97; - color:#FFFFFF; - float:left; - padding:0; - width:100%; - clear:right; - height:2.8em; - padding-top:10px; - overflow:hidden; - font-size:12px; -} -.subNav { - background-color:#dee3e9; - float:left; - width:100%; - overflow:hidden; - font-size:12px; -} -.subNav div { - clear:left; - float:left; - padding:0 0 5px 6px; - text-transform:uppercase; -} -ul.navList, ul.subNavList { - float:left; - margin:0 25px 0 0; - padding:0; -} -ul.navList li{ - list-style:none; - float:left; - padding: 5px 6px; - text-transform:uppercase; -} -ul.subNavList li{ - list-style:none; - float:left; -} -.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { - color:#FFFFFF; - text-decoration:none; - text-transform:uppercase; -} -.topNav a:hover, .bottomNav a:hover { - text-decoration:none; - color:#bb7a2a; - text-transform:uppercase; -} -.navBarCell1Rev { - background-color:#F8981D; - color:#253441; - margin: auto 5px; -} -.skipNav { - position:absolute; - top:auto; - left:-9999px; - overflow:hidden; -} -/* -Page header and footer styles -*/ -.header, .footer { - clear:both; - margin:0 20px; - padding:5px 0 0 0; -} -.indexHeader { - margin:10px; - position:relative; -} -.indexHeader span{ - margin-right:15px; -} -.indexHeader h1 { - font-size:13px; -} -.title { - color:#2c4557; - margin:10px 0; -} -.subTitle { - margin:5px 0 0 0; -} -.header ul { - margin:0 0 15px 0; - padding:0; -} -.footer ul { - margin:20px 0 5px 0; -} -.header ul li, .footer ul li { - list-style:none; - font-size:13px; -} -/* -Heading styles -*/ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color:#dee3e9; - border:1px solid #d0d9e0; - margin:0 0 6px -8px; - padding:7px 5px; -} -ul.blockList ul.blockList li.blockList h3 { - padding:0; - margin:15px 0; -} -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} -/* -Page layout container styles -*/ -.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { - clear:both; - padding:10px 20px; - position:relative; -} -.indexContainer { - margin:10px; - position:relative; - font-size:12px; -} -.indexContainer h2 { - font-size:13px; - padding:0 0 3px 0; -} -.indexContainer ul { - margin:0; - padding:0; -} -.indexContainer ul li { - list-style:none; - padding-top:2px; -} -.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { - font-size:12px; - font-weight:bold; - margin:10px 0 0 0; - color:#4E4E4E; -} -.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { - margin:5px 0 10px 0px; - font-size:14px; - font-family:'DejaVu Sans Mono',monospace; -} -.serializedFormContainer dl.nameValue dt { - margin-left:1px; - font-size:1.1em; - display:inline; - font-weight:bold; -} -.serializedFormContainer dl.nameValue dd { - margin:0 0 0 1px; - font-size:1.1em; - display:inline; -} -/* -List styles -*/ -ul.horizontal li { - display:inline; - font-size:0.9em; -} -ul.inheritance { - margin:0; - padding:0; -} -ul.inheritance li { - display:inline; - list-style:none; -} -ul.inheritance li ul.inheritance { - margin-left:15px; - padding-left:15px; - padding-top:1px; -} -ul.blockList, ul.blockListLast { - margin:10px 0 10px 0; - padding:0; -} -ul.blockList li.blockList, ul.blockListLast li.blockList { - list-style:none; - margin-bottom:15px; - line-height:1.4; -} -ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { - padding:0px 20px 5px 10px; - border:1px solid #ededed; - background-color:#f8f8f8; -} -ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { - padding:0 0 5px 8px; - background-color:#ffffff; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - margin-left:0; - padding-left:0; - padding-bottom:15px; - border:none; -} -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - list-style:none; - border-bottom:none; - padding-bottom:0; -} -table tr td dl, table tr td dl dt, table tr td dl dd { - margin-top:0; - margin-bottom:1px; -} -/* -Table styles -*/ -.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { - width:100%; - border-left:1px solid #EEE; - border-right:1px solid #EEE; - border-bottom:1px solid #EEE; -} -.overviewSummary, .memberSummary { - padding:0px; -} -.overviewSummary caption, .memberSummary caption, .typeSummary caption, -.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { - position:relative; - text-align:left; - background-repeat:no-repeat; - color:#253441; - font-weight:bold; - clear:none; - overflow:hidden; - padding:0px; - padding-top:10px; - padding-left:1px; - margin:0px; - white-space:pre; -} -.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, -.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, -.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, -.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, -.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, -.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, -.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, -.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { - color:#FFFFFF; -} -.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, -.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - padding-bottom:7px; - display:inline-block; - float:left; - background-color:#F8981D; - border: none; - height:16px; -} -.memberSummary caption span.activeTableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#F8981D; - height:16px; -} -.memberSummary caption span.tableTab span { - white-space:nowrap; - padding-top:5px; - padding-left:12px; - padding-right:12px; - margin-right:3px; - display:inline-block; - float:left; - background-color:#4D7A97; - height:16px; -} -.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { - padding-top:0px; - padding-left:0px; - padding-right:0px; - background-image:none; - float:none; - display:inline; -} -.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, -.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { - display:none; - width:5px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .activeTableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - float:left; - background-color:#F8981D; -} -.memberSummary .tableTab .tabEnd { - display:none; - width:5px; - margin-right:3px; - position:relative; - background-color:#4D7A97; - float:left; - -} -.overviewSummary td, .memberSummary td, .typeSummary td, -.useSummary td, .constantsSummary td, .deprecatedSummary td { - text-align:left; - padding:0px 0px 12px 10px; -} -th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, -td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ - vertical-align:top; - padding-right:0px; - padding-top:8px; - padding-bottom:3px; -} -th.colFirst, th.colLast, th.colOne, .constantsSummary th { - background:#dee3e9; - text-align:left; - padding:8px 3px 3px 7px; -} -td.colFirst, th.colFirst { - white-space:nowrap; - font-size:13px; -} -td.colLast, th.colLast { - font-size:13px; -} -td.colOne, th.colOne { - font-size:13px; -} -.overviewSummary td.colFirst, .overviewSummary th.colFirst, -.useSummary td.colFirst, .useSummary th.colFirst, -.overviewSummary td.colOne, .overviewSummary th.colOne, -.memberSummary td.colFirst, .memberSummary th.colFirst, -.memberSummary td.colOne, .memberSummary th.colOne, -.typeSummary td.colFirst{ - width:25%; - vertical-align:top; -} -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} -.tableSubHeadingColor { - background-color:#EEEEFF; -} -.altColor { - background-color:#FFFFFF; -} -.rowColor { - background-color:#EEEEEF; -} -/* -Content styles -*/ -.description pre { - margin-top:0; -} -.deprecatedContent { - margin:0; - padding:10px 0; -} -.docSummary { - padding:0; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - font-style:normal; -} - -div.block { - font-size:14px; - font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; -} - -td.colLast div { - padding-top:0px; -} - - -td.colLast a { - padding-bottom:3px; -} -/* -Formatting effect styles -*/ -.sourceLineNo { - color:green; - padding:0 30px 0 0; -} -h1.hidden { - visibility:hidden; - overflow:hidden; - font-size:10px; -} -.block { - display:block; - margin:3px 10px 2px 0px; - color:#474747; -} -.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, -.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, -.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { - font-weight:bold; -} -.deprecationComment, .emphasizedPhrase, .interfaceName { - font-style:italic; -} - -div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase, -div.block div.block span.interfaceName { - font-style:normal; -} - -div.contentContainer ul.blockList li.blockList h2{ - padding-bottom:0px; -} - -/* HyperSQL Javadoc styles */ -DIV.ReleaseSpecificDocumentation { - color: #006A00; - background-color: #EEEEFF; - border: none; - padding-top: 5px; - padding-right: 10px; - padding-bottom: 5px; - padding-left: 10px; -} - -DIV.ReleaseSpecificDocumentation h1 { - margin-top: 0px; - margin-left: 0px; - margin-right: 0px; - padding-top: 14px; - padding-right: 0px; - padding-bottom: 15px; - padding-left: 50px; - background: url(hsqldbs.png) #E6E6FF no-repeat left center; - border: none; - font-size: 14px; - -} - diff --git a/database/hsqldb/doc/apidocssqltool/jquery/external/jquery/jquery.js b/database/hsqldb/doc/apidocssqltool/jquery/external/jquery/jquery.js deleted file mode 100644 index 50937333..00000000 --- a/database/hsqldb/doc/apidocssqltool/jquery/external/jquery/jquery.js +++ /dev/null @@ -1,10872 +0,0 @@ -/*! - * jQuery JavaScript Library v3.5.1 - * https://jquery.com/ - * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2020-05-04T22:49Z - */ -( function( global, factory ) { - - "use strict"; - - if ( typeof module === "object" && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var flat = arr.flat ? function( array ) { - return arr.flat.call( array ); -} : function( array ) { - return arr.concat.apply( [], array ); -}; - - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - -var document = window.document; - - - - var preservedScriptAttributes = { - type: true, - src: true, - nonce: true, - noModule: true - }; - - function DOMEval( code, node, doc ) { - doc = doc || document; - - var i, val, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - - // Support: Firefox 64+, Edge 18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.5.1", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - even: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return ( i + 1 ) % 2; - } ) ); - }, - - odd: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return i % 2; - } ) ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - copy = options[ name ]; - - // Prevent Object.prototype pollution - // Prevent never-ending loop - if ( name === "__proto__" || target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - src = target[ name ]; - - // Ensure proper type for the source value - if ( copyIsArray && !Array.isArray( src ) ) { - clone = []; - } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { - clone = {}; - } else { - clone = src; - } - copyIsArray = false; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a provided context; falls back to the global one - // if not specified. - globalEval: function( code, options, doc ) { - DOMEval( code, { nonce: options && options.nonce }, doc ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return flat( ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.5 - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://js.foundation/ - * - * Date: 2020-03-14 - */ -( function( window ) { -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - nonnativeSelectorCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ( {} ).hasOwnProperty, - arr = [], - pop = arr.pop, - pushNative = arr.push, - push = arr.push, - slice = arr.slice, - - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[ i ] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + - "ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram - identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + - "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - - // "Attribute values must be CSS identifiers [capture 5] - // or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + - whitespace + "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + - whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + - "*" ), - rdescend = new RegExp( whitespace + "|>" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + - "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rhtml = /HTML$/i, - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), - funescape = function( escape, nonHex ) { - var high = "0x" + escape.slice( 1 ) - 0x10000; - - return nonHex ? - - // Strip the backslash prefix from a non-hex escape sequence - nonHex : - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + - ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - inDisabledFieldset = addCombinator( - function( elem ) { - return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - ( arr = slice.call( preferredDoc.childNodes ) ), - preferredDoc.childNodes - ); - - // Support: Android<4.0 - // Detect silently failing push.apply - // eslint-disable-next-line no-unused-expressions - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - pushNative.apply( target, slice.call( els ) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - - // Can't trust NodeList.length - while ( ( target[ j++ ] = els[ i++ ] ) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - setDocument( context ); - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { - - // ID selector - if ( ( m = match[ 1 ] ) ) { - - // Document context - if ( nodeType === 9 ) { - if ( ( elem = context.getElementById( m ) ) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && ( elem = newContext.getElementById( m ) ) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[ 2 ] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && - - // Support: IE 8 only - // Exclude object elements - ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { - - newSelector = selector; - newContext = context; - - // qSA considers elements outside a scoping root when evaluating child or - // descendant combinators, which is not what we want. - // In such cases, we work around the behavior by prefixing every selector in the - // list with an ID selector referencing the scope context. - // The technique has to be used as well when a leading combinator is used - // as such selectors are not recognized by querySelectorAll. - // Thanks to Andrew Dupont for this technique. - if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - - // We can use :scope instead of the ID hack if the browser - // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { - - // Capture the context ID, setting it first if necessary - if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", ( nid = expando ) ); - } - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + - toSelector( groups[ i ] ); - } - newSelector = groups.join( "," ); - } - - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - nonnativeSelectorCache( selector, true ); - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return ( cache[ key + " " ] = value ); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement( "fieldset" ); - - try { - return !!fn( el ); - } catch ( e ) { - return false; - } finally { - - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split( "|" ), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[ i ] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( ( cur = cur.nextSibling ) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return ( name === "input" || name === "button" ) && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction( function( argument ) { - argument = +argument; - return markFunction( function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ ( j = matchIndexes[ i ] ) ] ) { - seed[ j ] = !( matches[ j ] = seed[ j ] ); - } - } - } ); - } ); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var namespace = elem.namespaceURI, - docElem = ( elem.ownerDocument || elem ).documentElement; - - // Support: IE <=8 - // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes - // https://bugs.jquery.com/ticket/4833 - return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, - // Safari 4 - 5 only, Opera <=11.6 - 12.x only - // IE/Edge & older browsers don't support the :scope pseudo-class. - // Support: Safari 6.0 only - // Safari 6.0 supports :scope but it's an alias of :root there. - support.scope = assert( function( el ) { - docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); - return typeof el.querySelectorAll !== "undefined" && - !el.querySelectorAll( ":scope fieldset div" ).length; - } ); - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert( function( el ) { - el.className = "i"; - return !el.getAttribute( "className" ); - } ); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert( function( el ) { - el.appendChild( document.createComment( "" ) ); - return !el.getElementsByTagName( "*" ).length; - } ); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - } ); - - // ID filter and find - if ( support.getById ) { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute( "id" ) === attrId; - }; - }; - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode( "id" ); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( ( elem = elems[ i++ ] ) ) { - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find[ "TAG" ] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { - - var input; - - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Firefox <=3.6 - 5 only - // Old Firefox doesn't throw on a badly-escaped identifier. - el.querySelectorAll( "\\\f" ); - rbuggyQSA.push( "[\\r\\n\\f]" ); - } ); - - assert( function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll( "[name=d]" ).length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: Opera 10 - 11 only - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll( "*,:x" ); - rbuggyQSA.push( ",.*:" ); - } ); - } - - if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector ) ) ) ) { - - assert( function( el ) { - - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - } ); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); - } : - function( a, b ) { - if ( b ) { - while ( ( b = b.parentNode ) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { - - // Choose the first element that is related to our preferred document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( a == document || a.ownerDocument == preferredDoc && - contains( preferredDoc, a ) ) { - return -1; - } - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( b == document || b.ownerDocument == preferredDoc && - contains( preferredDoc, b ) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - return a == document ? -1 : - b == document ? 1 : - /* eslint-enable eqeqeq */ - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( ( cur = cur.parentNode ) ) { - ap.unshift( cur ); - } - cur = b; - while ( ( cur = cur.parentNode ) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[ i ] === bp[ i ] ) { - i++; - } - - return i ? - - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[ i ], bp[ i ] ) : - - // Otherwise nodes in our document sort first - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - ap[ i ] == preferredDoc ? -1 : - bp[ i ] == preferredDoc ? 1 : - /* eslint-enable eqeqeq */ - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - setDocument( elem ); - - if ( support.matchesSelector && documentIsHTML && - !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch ( e ) { - nonnativeSelectorCache( expr, true ); - } - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( context.ownerDocument || context ) != document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( elem.ownerDocument || elem ) != document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[ 1 ] = match[ 1 ].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || - match[ 5 ] || "" ).replace( runescape, funescape ); - - if ( match[ 2 ] === "~=" ) { - match[ 3 ] = " " + match[ 3 ] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[ 1 ] = match[ 1 ].toLowerCase(); - - if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { - - // nth-* requires argument - if ( !match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[ 4 ] = +( match[ 4 ] ? - match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); - match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - - // other types prohibit arguments - } else if ( match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[ 6 ] && match[ 2 ]; - - if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[ 3 ] ) { - match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - - // Get excess from tokenize (recursively) - ( excess = tokenize( unquoted, true ) ) && - - // advance to the next closing parenthesis - ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { - - // excess is a negative index - match[ 0 ] = match[ 0 ].slice( 0, excess ); - match[ 2 ] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { - return true; - } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - ( pattern = new RegExp( "(^|" + whitespace + - ")" + className + "(" + whitespace + "|$)" ) ) && classCache( - className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); - } ); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - /* eslint-disable max-len */ - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - /* eslint-enable max-len */ - - }; - }, - - "CHILD": function( type, what, _argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, _context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( ( node = node[ dir ] ) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( ( node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - - // Use previously-cached element index if available - if ( useCache ) { - - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - - // Use the same loop as above to seek `elem` from the start - while ( ( node = ++nodeIndex && node && node[ dir ] || - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || - ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction( function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[ i ] ); - seed[ idx ] = !( matches[ idx ] = matched[ i ] ); - } - } ) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - - // Potentially complex pseudos - "not": markFunction( function( selector ) { - - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction( function( seed, matches, _context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( ( elem = unmatched[ i ] ) ) { - seed[ i ] = !( matches[ i ] = elem ); - } - } - } ) : - function( elem, _context, xml ) { - input[ 0 ] = elem; - matcher( input, null, xml, results ); - - // Don't keep the element (issue #299) - input[ 0 ] = null; - return !results.pop(); - }; - } ), - - "has": markFunction( function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - } ), - - "contains": markFunction( function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; - }; - } ), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - - // lang value must be a valid identifier - if ( !ridentifier.test( lang || "" ) ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( ( elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); - return false; - }; - } ), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && - ( !document.hasFocus || document.hasFocus() ) && - !!( elem.type || elem.href || ~elem.tabIndex ); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return ( nodeName === "input" && !!elem.checked ) || - ( nodeName === "option" && !!elem.selected ); - }, - - "selected": function( elem ) { - - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - // eslint-disable-next-line no-unused-expressions - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos[ "empty" ]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( ( attr = elem.getAttribute( "type" ) ) == null || - attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo( function() { - return [ 0 ]; - } ), - - "last": createPositionalPseudo( function( _matchIndexes, length ) { - return [ length - 1 ]; - } ), - - "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - } ), - - "even": createPositionalPseudo( function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "odd": createPositionalPseudo( function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? - argument + length : - argument > length ? - length : - argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ) - } -}; - -Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || ( match = rcomma.exec( soFar ) ) ) { - if ( match ) { - - // Don't consume trailing commas as valid - soFar = soFar.slice( match[ 0 ].length ) || soFar; - } - groups.push( ( tokens = [] ) ); - } - - matched = false; - - // Combinators - if ( ( match = rcombinators.exec( soFar ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - - // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || - ( match = preFilters[ type ]( match ) ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[ i ].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || - ( outerCache[ elem.uniqueID ] = {} ); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( ( oldCache = uniqueCache[ key ] ) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return ( newCache[ 2 ] = oldCache[ 2 ] ); - } else { - - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[ i ]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[ 0 ]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[ i ], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( ( elem = unmatched[ i ] ) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( - selector || "*", - context.nodeType ? [ context ] : context, - [] - ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( ( elem = temp[ i ] ) ) { - matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) ) { - - // Restore matcherIn since elem is not yet a final match - temp.push( ( matcherIn[ i ] = elem ) ); - } - } - postFinder( null, ( matcherOut = [] ), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { - - seed[ temp ] = !( results[ temp ] = elem ); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - } ); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[ 0 ].type ], - implicitRelative = leadingRelative || Expr.relative[ " " ], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - ( checkContext = context ).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[ j ].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens - .slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), - - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), - len = elems.length; - - if ( outermost ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - outermostContext = context == document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( !context && elem.ownerDocument != document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( ( matcher = elementMatchers[ j++ ] ) ) { - if ( matcher( elem, context || document, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - - // They will have gone through all possible matchers - if ( ( elem = !matcher && elem ) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( ( matcher = setMatchers[ j++ ] ) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !( unmatched[ i ] || setMatched[ i ] ) ) { - setMatched[ i ] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[ i ] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( - selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) - ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( ( selector = compiled.selector || selector ) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[ 0 ] = match[ 0 ].slice( 0 ); - if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - - context = ( Expr.find[ "ID" ]( token.matches[ 0 ] - .replace( runescape, funescape ), context ) || [] )[ 0 ]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[ i ]; - - // Abort if we hit a combinator - if ( Expr.relative[ ( type = token.type ) ] ) { - break; - } - if ( ( find = Expr.find[ type ] ) ) { - - // Search, expanding context for leading sibling combinators - if ( ( seed = find( - token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || - context - ) ) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert( function( el ) { - - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; -} ); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert( function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute( "href" ) === "#"; -} ) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - } ); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert( function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -} ) ) { - addHandle( "value", function( elem, _name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - } ); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert( function( el ) { - return el.getAttribute( "disabled" ) == null; -} ) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; - } - } ); -} - -return Sizzle; - -} )( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -}; -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, _i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, _i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, _i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( elem.contentDocument != null && - - // Support: IE 11+ - // elements with no `data` attribute has an object - // `contentDocument` with a `null` prototype. - getProto( elem.contentDocument ) ) { - - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( _i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the master Deferred - master = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return master.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); - } - - return master.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, _key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( _all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var documentElement = document.documentElement; - - - - var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); - }, - composed = { composed: true }; - - // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only - // Check attachment across shadow DOM boundaries when possible (gh-3504) - // Support: iOS 10.0-10.2 only - // Early iOS 10 versions support `attachShadow` but not `getRootNode`, - // leading to errors. We need to check for `getRootNode`. - if ( documentElement.getRootNode ) { - isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; - }; - } -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - isAttached( elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = elem.nodeType && - ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // Support: IE <=9 only - // IE <=9 replaces "; - support.option = !!div.lastChild; -} )(); - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
    " ], - col: [ 2, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { - - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var notAsync, result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); - this[ type ](); - result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - return result.value; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { - - // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - delegateType: delegateType - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px"; - tr.style.height = "1px"; - trChild.style.height = "9px"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( - dataPriv.get( cur, "events" ) || Object.create( null ) - )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script - if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( "\r\n"; - -// inject VBScript -document.write(IEBinaryToArray_ByteStr_Script); - -global.JSZipUtils._getBinaryFromXHR = function (xhr) { - var binary = xhr.responseBody; - var byteMapping = {}; - for ( var i = 0; i < 256; i++ ) { - for ( var j = 0; j < 256; j++ ) { - byteMapping[ String.fromCharCode( i + (j << 8) ) ] = - String.fromCharCode(i) + String.fromCharCode(j); - } - } - var rawBytes = IEBinaryToArray_ByteStr(binary); - var lastChr = IEBinaryToArray_ByteStr_Last(binary); - return rawBytes.replace(/[\s\S]/g, function( match ) { - return byteMapping[match]; - }) + lastChr; -}; - -// enforcing Stuk's coding style -// vim: set shiftwidth=4 softtabstop=4: - -},{}]},{},[1]) -; diff --git a/database/hsqldb/doc/apidocssqltool/jquery/jszip-utils/dist/jszip-utils-ie.min.js b/database/hsqldb/doc/apidocssqltool/jquery/jszip-utils/dist/jszip-utils-ie.min.js deleted file mode 100644 index 93d8bc8e..00000000 --- a/database/hsqldb/doc/apidocssqltool/jquery/jszip-utils/dist/jszip-utils-ie.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - -JSZipUtils - A collection of cross-browser utilities to go along with JSZip. - - -(c) 2014 Stuart Knightley, David Duponchel -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. - -*/ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n";document.write(b),a.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); diff --git a/database/hsqldb/doc/apidocssqltool/jquery/jszip-utils/dist/jszip-utils.js b/database/hsqldb/doc/apidocssqltool/jquery/jszip-utils/dist/jszip-utils.js deleted file mode 100644 index 775895ec..00000000 --- a/database/hsqldb/doc/apidocssqltool/jquery/jszip-utils/dist/jszip-utils.js +++ /dev/null @@ -1,118 +0,0 @@ -/*! - -JSZipUtils - A collection of cross-browser utilities to go along with JSZip. - - -(c) 2014 Stuart Knightley, David Duponchel -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. - -*/ -!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSZipUtils=e():"undefined"!=typeof global?global.JSZipUtils=e():"undefined"!=typeof self&&(self.JSZipUtils=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o - -(c) 2014 Stuart Knightley, David Duponchel -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. - -*/ -!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZipUtils=a():"undefined"!=typeof global?global.JSZipUtils=a():"undefined"!=typeof self&&(self.JSZipUtils=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/master/LICENSE -*/ - -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64; - enc4 = remainingBytes > 2 ? (chr3 & 63) : 64; - - output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4)); - - } - - return output.join(""); -}; - -// public method for decoding -exports.decode = function(input) { - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0, resultIndex = 0; - - var dataUrlPrefix = "data:"; - - if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) { - // This is a common error: people give a data url - // (data:image/png;base64,iVBOR...) with a {base64: true} and - // wonders why things don't work. - // We can detect that the string input looks like a data url but we - // *can't* be sure it is one: removing everything up to the comma would - // be too dangerous. - throw new Error("Invalid base64 input, it looks like a data url."); - } - - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - var totalLength = input.length * 3 / 4; - if(input.charAt(input.length - 1) === _keyStr.charAt(64)) { - totalLength--; - } - if(input.charAt(input.length - 2) === _keyStr.charAt(64)) { - totalLength--; - } - if (totalLength % 1 !== 0) { - // totalLength is not an integer, the length does not match a valid - // base64 content. That can happen if: - // - the input is not a base64 content - // - the input is *almost* a base64 content, with a extra chars at the - // beginning or at the end - // - the input uses a base64 variant (base64url for example) - throw new Error("Invalid base64 input, bad content length."); - } - var output; - if (support.uint8array) { - output = new Uint8Array(totalLength|0); - } else { - output = new Array(totalLength|0); - } - - while (i < input.length) { - - enc1 = _keyStr.indexOf(input.charAt(i++)); - enc2 = _keyStr.indexOf(input.charAt(i++)); - enc3 = _keyStr.indexOf(input.charAt(i++)); - enc4 = _keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output[resultIndex++] = chr1; - - if (enc3 !== 64) { - output[resultIndex++] = chr2; - } - if (enc4 !== 64) { - output[resultIndex++] = chr3; - } - - } - - return output; -}; - -},{"./support":30,"./utils":32}],2:[function(require,module,exports){ -'use strict'; - -var external = require("./external"); -var DataWorker = require('./stream/DataWorker'); -var Crc32Probe = require('./stream/Crc32Probe'); -var DataLengthProbe = require('./stream/DataLengthProbe'); - -/** - * Represent a compressed object, with everything needed to decompress it. - * @constructor - * @param {number} compressedSize the size of the data compressed. - * @param {number} uncompressedSize the size of the data after decompression. - * @param {number} crc32 the crc32 of the decompressed file. - * @param {object} compression the type of compression, see lib/compressions.js. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data. - */ -function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) { - this.compressedSize = compressedSize; - this.uncompressedSize = uncompressedSize; - this.crc32 = crc32; - this.compression = compression; - this.compressedContent = data; -} - -CompressedObject.prototype = { - /** - * Create a worker to get the uncompressed content. - * @return {GenericWorker} the worker. - */ - getContentWorker: function () { - var worker = new DataWorker(external.Promise.resolve(this.compressedContent)) - .pipe(this.compression.uncompressWorker()) - .pipe(new DataLengthProbe("data_length")); - - var that = this; - worker.on("end", function () { - if (this.streamInfo['data_length'] !== that.uncompressedSize) { - throw new Error("Bug : uncompressed data size mismatch"); - } - }); - return worker; - }, - /** - * Create a worker to get the compressed content. - * @return {GenericWorker} the worker. - */ - getCompressedWorker: function () { - return new DataWorker(external.Promise.resolve(this.compressedContent)) - .withStreamInfo("compressedSize", this.compressedSize) - .withStreamInfo("uncompressedSize", this.uncompressedSize) - .withStreamInfo("crc32", this.crc32) - .withStreamInfo("compression", this.compression) - ; - } -}; - -/** - * Chain the given worker with other workers to compress the content with the - * given compression. - * @param {GenericWorker} uncompressedWorker the worker to pipe. - * @param {Object} compression the compression object. - * @param {Object} compressionOptions the options to use when compressing. - * @return {GenericWorker} the new worker compressing the content. - */ -CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) { - return uncompressedWorker - .pipe(new Crc32Probe()) - .pipe(new DataLengthProbe("uncompressedSize")) - .pipe(compression.compressWorker(compressionOptions)) - .pipe(new DataLengthProbe("compressedSize")) - .withStreamInfo("compression", compression); -}; - -module.exports = CompressedObject; - -},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(require,module,exports){ -'use strict'; - -var GenericWorker = require("./stream/GenericWorker"); - -exports.STORE = { - magic: "\x00\x00", - compressWorker : function (compressionOptions) { - return new GenericWorker("STORE compression"); - }, - uncompressWorker : function () { - return new GenericWorker("STORE decompression"); - } -}; -exports.DEFLATE = require('./flate'); - -},{"./flate":7,"./stream/GenericWorker":28}],4:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); - -/** - * The following functions come from pako, from pako/lib/zlib/crc32.js - * released under the MIT license, see pako https://github.com/nodeca/pako/ - */ - -// Use ordinary array, since untyped makes no boost here -function makeTable() { - var c, table = []; - - for(var n =0; n < 256; n++){ - c = n; - for(var k =0; k < 8; k++){ - c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; -} - -// Create table on load. Just 255 signed longs. Not a problem. -var crcTable = makeTable(); - - -function crc32(crc, buf, len, pos) { - var t = crcTable, end = pos + len; - - crc = crc ^ (-1); - - for (var i = pos; i < end; i++ ) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - -// That's all for the pako functions. - -/** - * Compute the crc32 of a string. - * This is almost the same as the function crc32, but for strings. Using the - * same function for the two use cases leads to horrible performances. - * @param {Number} crc the starting value of the crc. - * @param {String} str the string to use. - * @param {Number} len the length of the string. - * @param {Number} pos the starting position for the crc32 computation. - * @return {Number} the computed crc32. - */ -function crc32str(crc, str, len, pos) { - var t = crcTable, end = pos + len; - - crc = crc ^ (-1); - - for (var i = pos; i < end; i++ ) { - crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - -module.exports = function crc32wrapper(input, crc) { - if (typeof input === "undefined" || !input.length) { - return 0; - } - - var isArray = utils.getTypeOf(input) !== "string"; - - if(isArray) { - return crc32(crc|0, input, input.length, 0); - } else { - return crc32str(crc|0, input, input.length, 0); - } -}; - -},{"./utils":32}],5:[function(require,module,exports){ -'use strict'; -exports.base64 = false; -exports.binary = false; -exports.dir = false; -exports.createFolders = true; -exports.date = null; -exports.compression = null; -exports.compressionOptions = null; -exports.comment = null; -exports.unixPermissions = null; -exports.dosPermissions = null; - -},{}],6:[function(require,module,exports){ -/* global Promise */ -'use strict'; - -// load the global object first: -// - it should be better integrated in the system (unhandledRejection in node) -// - the environment may have a custom Promise implementation (see zone.js) -var ES6Promise = null; -if (typeof Promise !== "undefined") { - ES6Promise = Promise; -} else { - ES6Promise = require("lie"); -} - -/** - * Let the user use/change some implementations. - */ -module.exports = { - Promise: ES6Promise -}; - -},{"lie":37}],7:[function(require,module,exports){ -'use strict'; -var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); - -var pako = require("pako"); -var utils = require("./utils"); -var GenericWorker = require("./stream/GenericWorker"); - -var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array"; - -exports.magic = "\x08\x00"; - -/** - * Create a worker that uses pako to inflate/deflate. - * @constructor - * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate". - * @param {Object} options the options to use when (de)compressing. - */ -function FlateWorker(action, options) { - GenericWorker.call(this, "FlateWorker/" + action); - - this._pako = null; - this._pakoAction = action; - this._pakoOptions = options; - // the `meta` object from the last chunk received - // this allow this worker to pass around metadata - this.meta = {}; -} - -utils.inherits(FlateWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -FlateWorker.prototype.processChunk = function (chunk) { - this.meta = chunk.meta; - if (this._pako === null) { - this._createPako(); - } - this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); -}; - -/** - * @see GenericWorker.flush - */ -FlateWorker.prototype.flush = function () { - GenericWorker.prototype.flush.call(this); - if (this._pako === null) { - this._createPako(); - } - this._pako.push([], true); -}; -/** - * @see GenericWorker.cleanUp - */ -FlateWorker.prototype.cleanUp = function () { - GenericWorker.prototype.cleanUp.call(this); - this._pako = null; -}; - -/** - * Create the _pako object. - * TODO: lazy-loading this object isn't the best solution but it's the - * quickest. The best solution is to lazy-load the worker list. See also the - * issue #446. - */ -FlateWorker.prototype._createPako = function () { - this._pako = new pako[this._pakoAction]({ - raw: true, - level: this._pakoOptions.level || -1 // default compression - }); - var self = this; - this._pako.onData = function(data) { - self.push({ - data : data, - meta : self.meta - }); - }; -}; - -exports.compressWorker = function (compressionOptions) { - return new FlateWorker("Deflate", compressionOptions); -}; -exports.uncompressWorker = function () { - return new FlateWorker("Inflate", {}); -}; - -},{"./stream/GenericWorker":28,"./utils":32,"pako":38}],8:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var GenericWorker = require('../stream/GenericWorker'); -var utf8 = require('../utf8'); -var crc32 = require('../crc32'); -var signature = require('../signature'); - -/** - * Transform an integer into a string in hexadecimal. - * @private - * @param {number} dec the number to convert. - * @param {number} bytes the number of bytes to generate. - * @returns {string} the result. - */ -var decToHex = function(dec, bytes) { - var hex = "", i; - for (i = 0; i < bytes; i++) { - hex += String.fromCharCode(dec & 0xff); - dec = dec >>> 8; - } - return hex; -}; - -/** - * Generate the UNIX part of the external file attributes. - * @param {Object} unixPermissions the unix permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute : - * - * TTTTsstrwxrwxrwx0000000000ADVSHR - * ^^^^____________________________ file type, see zipinfo.c (UNX_*) - * ^^^_________________________ setuid, setgid, sticky - * ^^^^^^^^^________________ permissions - * ^^^^^^^^^^______ not used ? - * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only - */ -var generateUnixExternalFileAttr = function (unixPermissions, isDir) { - - var result = unixPermissions; - if (!unixPermissions) { - // I can't use octal values in strict mode, hence the hexa. - // 040775 => 0x41fd - // 0100664 => 0x81b4 - result = isDir ? 0x41fd : 0x81b4; - } - return (result & 0xFFFF) << 16; -}; - -/** - * Generate the DOS part of the external file attributes. - * @param {Object} dosPermissions the dos permissions or null. - * @param {Boolean} isDir true if the entry is a directory, false otherwise. - * @return {Number} a 32 bit integer. - * - * Bit 0 Read-Only - * Bit 1 Hidden - * Bit 2 System - * Bit 3 Volume Label - * Bit 4 Directory - * Bit 5 Archive - */ -var generateDosExternalFileAttr = function (dosPermissions, isDir) { - - // the dir flag is already set for compatibility - return (dosPermissions || 0) & 0x3F; -}; - -/** - * Generate the various parts used in the construction of the final zip file. - * @param {Object} streamInfo the hash with information about the compressed file. - * @param {Boolean} streamedContent is the content streamed ? - * @param {Boolean} streamingEnded is the stream finished ? - * @param {number} offset the current offset from the start of the zip file. - * @param {String} platform let's pretend we are this platform (change platform dependents fields) - * @param {Function} encodeFileName the function to encode the file name / comment. - * @return {Object} the zip parts. - */ -var generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) { - var file = streamInfo['file'], - compression = streamInfo['compression'], - useCustomEncoding = encodeFileName !== utf8.utf8encode, - encodedFileName = utils.transformTo("string", encodeFileName(file.name)), - utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), - comment = file.comment, - encodedComment = utils.transformTo("string", encodeFileName(comment)), - utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), - useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, - useUTF8ForComment = utfEncodedComment.length !== comment.length, - dosTime, - dosDate, - extraFields = "", - unicodePathExtraField = "", - unicodeCommentExtraField = "", - dir = file.dir, - date = file.date; - - - var dataInfo = { - crc32 : 0, - compressedSize : 0, - uncompressedSize : 0 - }; - - // if the content is streamed, the sizes/crc32 are only available AFTER - // the end of the stream. - if (!streamedContent || streamingEnded) { - dataInfo.crc32 = streamInfo['crc32']; - dataInfo.compressedSize = streamInfo['compressedSize']; - dataInfo.uncompressedSize = streamInfo['uncompressedSize']; - } - - var bitflag = 0; - if (streamedContent) { - // Bit 3: the sizes/crc32 are set to zero in the local header. - // The correct values are put in the data descriptor immediately - // following the compressed data. - bitflag |= 0x0008; - } - if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) { - // Bit 11: Language encoding flag (EFS). - bitflag |= 0x0800; - } - - - var extFileAttr = 0; - var versionMadeBy = 0; - if (dir) { - // dos or unix, we set the dos dir flag - extFileAttr |= 0x00010; - } - if(platform === "UNIX") { - versionMadeBy = 0x031E; // UNIX, version 3.0 - extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); - } else { // DOS or other, fallback to DOS - versionMadeBy = 0x0014; // DOS, version 2.0 - extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); - } - - // date - // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html - // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html - - dosTime = date.getUTCHours(); - dosTime = dosTime << 6; - dosTime = dosTime | date.getUTCMinutes(); - dosTime = dosTime << 5; - dosTime = dosTime | date.getUTCSeconds() / 2; - - dosDate = date.getUTCFullYear() - 1980; - dosDate = dosDate << 4; - dosDate = dosDate | (date.getUTCMonth() + 1); - dosDate = dosDate << 5; - dosDate = dosDate | date.getUTCDate(); - - if (useUTF8ForFileName) { - // set the unicode path extra field. unzip needs at least one extra - // field to correctly handle unicode path, so using the path is as good - // as any other information. This could improve the situation with - // other archive managers too. - // This field is usually used without the utf8 flag, with a non - // unicode path in the header (winrar, winzip). This helps (a bit) - // with the messy Windows' default compressed folders feature but - // breaks on p7zip which doesn't seek the unicode path extra field. - // So for now, UTF-8 everywhere ! - unicodePathExtraField = - // Version - decToHex(1, 1) + - // NameCRC32 - decToHex(crc32(encodedFileName), 4) + - // UnicodeName - utfEncodedFileName; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x70" + - // size - decToHex(unicodePathExtraField.length, 2) + - // content - unicodePathExtraField; - } - - if(useUTF8ForComment) { - - unicodeCommentExtraField = - // Version - decToHex(1, 1) + - // CommentCRC32 - decToHex(crc32(encodedComment), 4) + - // UnicodeName - utfEncodedComment; - - extraFields += - // Info-ZIP Unicode Path Extra Field - "\x75\x63" + - // size - decToHex(unicodeCommentExtraField.length, 2) + - // content - unicodeCommentExtraField; - } - - var header = ""; - - // version needed to extract - header += "\x0A\x00"; - // general purpose bit flag - header += decToHex(bitflag, 2); - // compression method - header += compression.magic; - // last mod file time - header += decToHex(dosTime, 2); - // last mod file date - header += decToHex(dosDate, 2); - // crc-32 - header += decToHex(dataInfo.crc32, 4); - // compressed size - header += decToHex(dataInfo.compressedSize, 4); - // uncompressed size - header += decToHex(dataInfo.uncompressedSize, 4); - // file name length - header += decToHex(encodedFileName.length, 2); - // extra field length - header += decToHex(extraFields.length, 2); - - - var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields; - - var dirRecord = signature.CENTRAL_FILE_HEADER + - // version made by (00: DOS) - decToHex(versionMadeBy, 2) + - // file header (common to file and central directory) - header + - // file comment length - decToHex(encodedComment.length, 2) + - // disk number start - "\x00\x00" + - // internal file attributes TODO - "\x00\x00" + - // external file attributes - decToHex(extFileAttr, 4) + - // relative offset of local header - decToHex(offset, 4) + - // file name - encodedFileName + - // extra field - extraFields + - // file comment - encodedComment; - - return { - fileRecord: fileRecord, - dirRecord: dirRecord - }; -}; - -/** - * Generate the EOCD record. - * @param {Number} entriesCount the number of entries in the zip file. - * @param {Number} centralDirLength the length (in bytes) of the central dir. - * @param {Number} localDirLength the length (in bytes) of the local dir. - * @param {String} comment the zip file comment as a binary string. - * @param {Function} encodeFileName the function to encode the comment. - * @return {String} the EOCD record. - */ -var generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) { - var dirEnd = ""; - var encodedComment = utils.transformTo("string", encodeFileName(comment)); - - // end of central dir signature - dirEnd = signature.CENTRAL_DIRECTORY_END + - // number of this disk - "\x00\x00" + - // number of the disk with the start of the central directory - "\x00\x00" + - // total number of entries in the central directory on this disk - decToHex(entriesCount, 2) + - // total number of entries in the central directory - decToHex(entriesCount, 2) + - // size of the central directory 4 bytes - decToHex(centralDirLength, 4) + - // offset of start of central directory with respect to the starting disk number - decToHex(localDirLength, 4) + - // .ZIP file comment length - decToHex(encodedComment.length, 2) + - // .ZIP file comment - encodedComment; - - return dirEnd; -}; - -/** - * Generate data descriptors for a file entry. - * @param {Object} streamInfo the hash generated by a worker, containing information - * on the file entry. - * @return {String} the data descriptors. - */ -var generateDataDescriptors = function (streamInfo) { - var descriptor = ""; - descriptor = signature.DATA_DESCRIPTOR + - // crc-32 4 bytes - decToHex(streamInfo['crc32'], 4) + - // compressed size 4 bytes - decToHex(streamInfo['compressedSize'], 4) + - // uncompressed size 4 bytes - decToHex(streamInfo['uncompressedSize'], 4); - - return descriptor; -}; - - -/** - * A worker to concatenate other workers to create a zip file. - * @param {Boolean} streamFiles `true` to stream the content of the files, - * `false` to accumulate it. - * @param {String} comment the comment to use. - * @param {String} platform the platform to use, "UNIX" or "DOS". - * @param {Function} encodeFileName the function to encode file names and comments. - */ -function ZipFileWorker(streamFiles, comment, platform, encodeFileName) { - GenericWorker.call(this, "ZipFileWorker"); - // The number of bytes written so far. This doesn't count accumulated chunks. - this.bytesWritten = 0; - // The comment of the zip file - this.zipComment = comment; - // The platform "generating" the zip file. - this.zipPlatform = platform; - // the function to encode file names and comments. - this.encodeFileName = encodeFileName; - // Should we stream the content of the files ? - this.streamFiles = streamFiles; - // If `streamFiles` is false, we will need to accumulate the content of the - // files to calculate sizes / crc32 (and write them *before* the content). - // This boolean indicates if we are accumulating chunks (it will change a lot - // during the lifetime of this worker). - this.accumulate = false; - // The buffer receiving chunks when accumulating content. - this.contentBuffer = []; - // The list of generated directory records. - this.dirRecords = []; - // The offset (in bytes) from the beginning of the zip file for the current source. - this.currentSourceOffset = 0; - // The total number of entries in this zip file. - this.entriesCount = 0; - // the name of the file currently being added, null when handling the end of the zip file. - // Used for the emitted metadata. - this.currentFile = null; - - - - this._sources = []; -} -utils.inherits(ZipFileWorker, GenericWorker); - -/** - * @see GenericWorker.push - */ -ZipFileWorker.prototype.push = function (chunk) { - - var currentFilePercent = chunk.meta.percent || 0; - var entriesCount = this.entriesCount; - var remainingFiles = this._sources.length; - - if(this.accumulate) { - this.contentBuffer.push(chunk); - } else { - this.bytesWritten += chunk.data.length; - - GenericWorker.prototype.push.call(this, { - data : chunk.data, - meta : { - currentFile : this.currentFile, - percent : entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100 - } - }); - } -}; - -/** - * The worker started a new source (an other worker). - * @param {Object} streamInfo the streamInfo object from the new source. - */ -ZipFileWorker.prototype.openedSource = function (streamInfo) { - this.currentSourceOffset = this.bytesWritten; - this.currentFile = streamInfo['file'].name; - - var streamedContent = this.streamFiles && !streamInfo['file'].dir; - - // don't stream folders (because they don't have any content) - if(streamedContent) { - var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - this.push({ - data : record.fileRecord, - meta : {percent:0} - }); - } else { - // we need to wait for the whole file before pushing anything - this.accumulate = true; - } -}; - -/** - * The worker finished a source (an other worker). - * @param {Object} streamInfo the streamInfo object from the finished source. - */ -ZipFileWorker.prototype.closedSource = function (streamInfo) { - this.accumulate = false; - var streamedContent = this.streamFiles && !streamInfo['file'].dir; - var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); - - this.dirRecords.push(record.dirRecord); - if(streamedContent) { - // after the streamed file, we put data descriptors - this.push({ - data : generateDataDescriptors(streamInfo), - meta : {percent:100} - }); - } else { - // the content wasn't streamed, we need to push everything now - // first the file record, then the content - this.push({ - data : record.fileRecord, - meta : {percent:0} - }); - while(this.contentBuffer.length) { - this.push(this.contentBuffer.shift()); - } - } - this.currentFile = null; -}; - -/** - * @see GenericWorker.flush - */ -ZipFileWorker.prototype.flush = function () { - - var localDirLength = this.bytesWritten; - for(var i = 0; i < this.dirRecords.length; i++) { - this.push({ - data : this.dirRecords[i], - meta : {percent:100} - }); - } - var centralDirLength = this.bytesWritten - localDirLength; - - var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName); - - this.push({ - data : dirEnd, - meta : {percent:100} - }); -}; - -/** - * Prepare the next source to be read. - */ -ZipFileWorker.prototype.prepareNextSource = function () { - this.previous = this._sources.shift(); - this.openedSource(this.previous.streamInfo); - if (this.isPaused) { - this.previous.pause(); - } else { - this.previous.resume(); - } -}; - -/** - * @see GenericWorker.registerPrevious - */ -ZipFileWorker.prototype.registerPrevious = function (previous) { - this._sources.push(previous); - var self = this; - - previous.on('data', function (chunk) { - self.processChunk(chunk); - }); - previous.on('end', function () { - self.closedSource(self.previous.streamInfo); - if(self._sources.length) { - self.prepareNextSource(); - } else { - self.end(); - } - }); - previous.on('error', function (e) { - self.error(e); - }); - return this; -}; - -/** - * @see GenericWorker.resume - */ -ZipFileWorker.prototype.resume = function () { - if(!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if (!this.previous && this._sources.length) { - this.prepareNextSource(); - return true; - } - if (!this.previous && !this._sources.length && !this.generatedError) { - this.end(); - return true; - } -}; - -/** - * @see GenericWorker.error - */ -ZipFileWorker.prototype.error = function (e) { - var sources = this._sources; - if(!GenericWorker.prototype.error.call(this, e)) { - return false; - } - for(var i = 0; i < sources.length; i++) { - try { - sources[i].error(e); - } catch(e) { - // the `error` exploded, nothing to do - } - } - return true; -}; - -/** - * @see GenericWorker.lock - */ -ZipFileWorker.prototype.lock = function () { - GenericWorker.prototype.lock.call(this); - var sources = this._sources; - for(var i = 0; i < sources.length; i++) { - sources[i].lock(); - } -}; - -module.exports = ZipFileWorker; - -},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(require,module,exports){ -'use strict'; - -var compressions = require('../compressions'); -var ZipFileWorker = require('./ZipFileWorker'); - -/** - * Find the compression to use. - * @param {String} fileCompression the compression defined at the file level, if any. - * @param {String} zipCompression the compression defined at the load() level. - * @return {Object} the compression object to use. - */ -var getCompression = function (fileCompression, zipCompression) { - - var compressionName = fileCompression || zipCompression; - var compression = compressions[compressionName]; - if (!compression) { - throw new Error(compressionName + " is not a valid compression method !"); - } - return compression; -}; - -/** - * Create a worker to generate a zip file. - * @param {JSZip} zip the JSZip instance at the right root level. - * @param {Object} options to generate the zip file. - * @param {String} comment the comment to use. - */ -exports.generateWorker = function (zip, options, comment) { - - var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName); - var entriesCount = 0; - try { - - zip.forEach(function (relativePath, file) { - entriesCount++; - var compression = getCompression(file.options.compression, options.compression); - var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; - var dir = file.dir, date = file.date; - - file._compressWorker(compression, compressionOptions) - .withStreamInfo("file", { - name : relativePath, - dir : dir, - date : date, - comment : file.comment || "", - unixPermissions : file.unixPermissions, - dosPermissions : file.dosPermissions - }) - .pipe(zipFileWorker); - }); - zipFileWorker.entriesCount = entriesCount; - } catch (e) { - zipFileWorker.error(e); - } - - return zipFileWorker; -}; - -},{"../compressions":3,"./ZipFileWorker":8}],10:[function(require,module,exports){ -'use strict'; - -/** - * Representation a of zip file in js - * @constructor - */ -function JSZip() { - // if this constructor is used without `new`, it adds `new` before itself: - if(!(this instanceof JSZip)) { - return new JSZip(); - } - - if(arguments.length) { - throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); - } - - // object containing the files : - // { - // "folder/" : {...}, - // "folder/data.txt" : {...} - // } - // NOTE: we use a null prototype because we do not - // want filenames like "toString" coming from a zip file - // to overwrite methods and attributes in a normal Object. - this.files = Object.create(null); - - this.comment = null; - - // Where we are in the hierarchy - this.root = ""; - this.clone = function() { - var newObj = new JSZip(); - for (var i in this) { - if (typeof this[i] !== "function") { - newObj[i] = this[i]; - } - } - return newObj; - }; -} -JSZip.prototype = require('./object'); -JSZip.prototype.loadAsync = require('./load'); -JSZip.support = require('./support'); -JSZip.defaults = require('./defaults'); - -// TODO find a better way to handle this version, -// a require('package.json').version doesn't work with webpack, see #327 -JSZip.version = "3.7.1"; - -JSZip.loadAsync = function (content, options) { - return new JSZip().loadAsync(content, options); -}; - -JSZip.external = require("./external"); -module.exports = JSZip; - -},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(require,module,exports){ -'use strict'; -var utils = require('./utils'); -var external = require("./external"); -var utf8 = require('./utf8'); -var ZipEntries = require('./zipEntries'); -var Crc32Probe = require('./stream/Crc32Probe'); -var nodejsUtils = require("./nodejsUtils"); - -/** - * Check the CRC32 of an entry. - * @param {ZipEntry} zipEntry the zip entry to check. - * @return {Promise} the result. - */ -function checkEntryCRC32(zipEntry) { - return new external.Promise(function (resolve, reject) { - var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); - worker.on("error", function (e) { - reject(e); - }) - .on("end", function () { - if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { - reject(new Error("Corrupted zip : CRC32 mismatch")); - } else { - resolve(); - } - }) - .resume(); - }); -} - -module.exports = function (data, options) { - var zip = this; - options = utils.extend(options || {}, { - base64: false, - checkCRC32: false, - optimizedBinaryString: false, - createFolders: false, - decodeFileName: utf8.utf8decode - }); - - if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { - return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")); - } - - return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) - .then(function (data) { - var zipEntries = new ZipEntries(options); - zipEntries.load(data); - return zipEntries; - }).then(function checkCRC32(zipEntries) { - var promises = [external.Promise.resolve(zipEntries)]; - var files = zipEntries.files; - if (options.checkCRC32) { - for (var i = 0; i < files.length; i++) { - promises.push(checkEntryCRC32(files[i])); - } - } - return external.Promise.all(promises); - }).then(function addFiles(results) { - var zipEntries = results.shift(); - var files = zipEntries.files; - for (var i = 0; i < files.length; i++) { - var input = files[i]; - zip.file(input.fileNameStr, input.decompressed, { - binary: true, - optimizedBinaryString: true, - date: input.date, - dir: input.dir, - comment: input.fileCommentStr.length ? input.fileCommentStr : null, - unixPermissions: input.unixPermissions, - dosPermissions: input.dosPermissions, - createFolders: options.createFolders - }); - } - if (zipEntries.zipComment.length) { - zip.comment = zipEntries.zipComment; - } - - return zip; - }); -}; - -},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(require,module,exports){ -"use strict"; - -var utils = require('../utils'); -var GenericWorker = require('../stream/GenericWorker'); - -/** - * A worker that use a nodejs stream as source. - * @constructor - * @param {String} filename the name of the file entry for this stream. - * @param {Readable} stream the nodejs stream. - */ -function NodejsStreamInputAdapter(filename, stream) { - GenericWorker.call(this, "Nodejs stream input adapter for " + filename); - this._upstreamEnded = false; - this._bindStream(stream); -} - -utils.inherits(NodejsStreamInputAdapter, GenericWorker); - -/** - * Prepare the stream and bind the callbacks on it. - * Do this ASAP on node 0.10 ! A lazy binding doesn't always work. - * @param {Stream} stream the nodejs stream to use. - */ -NodejsStreamInputAdapter.prototype._bindStream = function (stream) { - var self = this; - this._stream = stream; - stream.pause(); - stream - .on("data", function (chunk) { - self.push({ - data: chunk, - meta : { - percent : 0 - } - }); - }) - .on("error", function (e) { - if(self.isPaused) { - this.generatedError = e; - } else { - self.error(e); - } - }) - .on("end", function () { - if(self.isPaused) { - self._upstreamEnded = true; - } else { - self.end(); - } - }); -}; -NodejsStreamInputAdapter.prototype.pause = function () { - if(!GenericWorker.prototype.pause.call(this)) { - return false; - } - this._stream.pause(); - return true; -}; -NodejsStreamInputAdapter.prototype.resume = function () { - if(!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if(this._upstreamEnded) { - this.end(); - } else { - this._stream.resume(); - } - - return true; -}; - -module.exports = NodejsStreamInputAdapter; - -},{"../stream/GenericWorker":28,"../utils":32}],13:[function(require,module,exports){ -'use strict'; - -var Readable = require('readable-stream').Readable; - -var utils = require('../utils'); -utils.inherits(NodejsStreamOutputAdapter, Readable); - -/** -* A nodejs stream using a worker as source. -* @see the SourceWrapper in http://nodejs.org/api/stream.html -* @constructor -* @param {StreamHelper} helper the helper wrapping the worker -* @param {Object} options the nodejs stream options -* @param {Function} updateCb the update callback. -*/ -function NodejsStreamOutputAdapter(helper, options, updateCb) { - Readable.call(this, options); - this._helper = helper; - - var self = this; - helper.on("data", function (data, meta) { - if (!self.push(data)) { - self._helper.pause(); - } - if(updateCb) { - updateCb(meta); - } - }) - .on("error", function(e) { - self.emit('error', e); - }) - .on("end", function () { - self.push(null); - }); -} - - -NodejsStreamOutputAdapter.prototype._read = function() { - this._helper.resume(); -}; - -module.exports = NodejsStreamOutputAdapter; - -},{"../utils":32,"readable-stream":16}],14:[function(require,module,exports){ -'use strict'; - -module.exports = { - /** - * True if this is running in Nodejs, will be undefined in a browser. - * In a browser, browserify won't include this file and the whole module - * will be resolved an empty object. - */ - isNode : typeof Buffer !== "undefined", - /** - * Create a new nodejs Buffer from an existing content. - * @param {Object} data the data to pass to the constructor. - * @param {String} encoding the encoding to use. - * @return {Buffer} a new Buffer. - */ - newBufferFrom: function(data, encoding) { - if (Buffer.from && Buffer.from !== Uint8Array.from) { - return Buffer.from(data, encoding); - } else { - if (typeof data === "number") { - // Safeguard for old Node.js versions. On newer versions, - // Buffer.from(number) / Buffer(number, encoding) already throw. - throw new Error("The \"data\" argument must not be a number"); - } - return new Buffer(data, encoding); - } - }, - /** - * Create a new nodejs Buffer with the specified size. - * @param {Integer} size the size of the buffer. - * @return {Buffer} a new Buffer. - */ - allocBuffer: function (size) { - if (Buffer.alloc) { - return Buffer.alloc(size); - } else { - var buf = new Buffer(size); - buf.fill(0); - return buf; - } - }, - /** - * Find out if an object is a Buffer. - * @param {Object} b the object to test. - * @return {Boolean} true if the object is a Buffer, false otherwise. - */ - isBuffer : function(b){ - return Buffer.isBuffer(b); - }, - - isStream : function (obj) { - return obj && - typeof obj.on === "function" && - typeof obj.pause === "function" && - typeof obj.resume === "function"; - } -}; - -},{}],15:[function(require,module,exports){ -'use strict'; -var utf8 = require('./utf8'); -var utils = require('./utils'); -var GenericWorker = require('./stream/GenericWorker'); -var StreamHelper = require('./stream/StreamHelper'); -var defaults = require('./defaults'); -var CompressedObject = require('./compressedObject'); -var ZipObject = require('./zipObject'); -var generate = require("./generate"); -var nodejsUtils = require("./nodejsUtils"); -var NodejsStreamInputAdapter = require("./nodejs/NodejsStreamInputAdapter"); - - -/** - * Add a file in the current folder. - * @private - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file - * @param {Object} originalOptions the options of the file - * @return {Object} the new file. - */ -var fileAdd = function(name, data, originalOptions) { - // be sure sub folders exist - var dataType = utils.getTypeOf(data), - parent; - - - /* - * Correct options. - */ - - var o = utils.extend(originalOptions || {}, defaults); - o.date = o.date || new Date(); - if (o.compression !== null) { - o.compression = o.compression.toUpperCase(); - } - - if (typeof o.unixPermissions === "string") { - o.unixPermissions = parseInt(o.unixPermissions, 8); - } - - // UNX_IFDIR 0040000 see zipinfo.c - if (o.unixPermissions && (o.unixPermissions & 0x4000)) { - o.dir = true; - } - // Bit 4 Directory - if (o.dosPermissions && (o.dosPermissions & 0x0010)) { - o.dir = true; - } - - if (o.dir) { - name = forceTrailingSlash(name); - } - if (o.createFolders && (parent = parentFolder(name))) { - folderAdd.call(this, parent, true); - } - - var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false; - if (!originalOptions || typeof originalOptions.binary === "undefined") { - o.binary = !isUnicodeString; - } - - - var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0; - - if (isCompressedEmpty || o.dir || !data || data.length === 0) { - o.base64 = false; - o.binary = true; - data = ""; - o.compression = "STORE"; - dataType = "string"; - } - - /* - * Convert content to fit. - */ - - var zipObjectContent = null; - if (data instanceof CompressedObject || data instanceof GenericWorker) { - zipObjectContent = data; - } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { - zipObjectContent = new NodejsStreamInputAdapter(name, data); - } else { - zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64); - } - - var object = new ZipObject(name, zipObjectContent, o); - this.files[name] = object; - /* - TODO: we can't throw an exception because we have async promises - (we can have a promise of a Date() for example) but returning a - promise is useless because file(name, data) returns the JSZip - object for chaining. Should we break that to allow the user - to catch the error ? - - return external.Promise.resolve(zipObjectContent) - .then(function () { - return object; - }); - */ -}; - -/** - * Find the parent folder of the path. - * @private - * @param {string} path the path to use - * @return {string} the parent folder, or "" - */ -var parentFolder = function (path) { - if (path.slice(-1) === '/') { - path = path.substring(0, path.length - 1); - } - var lastSlash = path.lastIndexOf('/'); - return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; -}; - -/** - * Returns the path with a slash at the end. - * @private - * @param {String} path the path to check. - * @return {String} the path with a trailing slash. - */ -var forceTrailingSlash = function(path) { - // Check the name ends with a / - if (path.slice(-1) !== "/") { - path += "/"; // IE doesn't like substr(-1) - } - return path; -}; - -/** - * Add a (sub) folder in the current folder. - * @private - * @param {string} name the folder's name - * @param {boolean=} [createFolders] If true, automatically create sub - * folders. Defaults to false. - * @return {Object} the new folder. - */ -var folderAdd = function(name, createFolders) { - createFolders = (typeof createFolders !== 'undefined') ? createFolders : defaults.createFolders; - - name = forceTrailingSlash(name); - - // Does this folder already exist? - if (!this.files[name]) { - fileAdd.call(this, name, null, { - dir: true, - createFolders: createFolders - }); - } - return this.files[name]; -}; - -/** -* Cross-window, cross-Node-context regular expression detection -* @param {Object} object Anything -* @return {Boolean} true if the object is a regular expression, -* false otherwise -*/ -function isRegExp(object) { - return Object.prototype.toString.call(object) === "[object RegExp]"; -} - -// return the actual prototype of JSZip -var out = { - /** - * @see loadAsync - */ - load: function() { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, - - - /** - * Call a callback function for each entry at this folder level. - * @param {Function} cb the callback function: - * function (relativePath, file) {...} - * It takes 2 arguments : the relative path and the file. - */ - forEach: function(cb) { - var filename, relativePath, file; - /* jshint ignore:start */ - // ignore warning about unwanted properties because this.files is a null prototype object - for (filename in this.files) { - file = this.files[filename]; - relativePath = filename.slice(this.root.length, filename.length); - if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root - cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn... - } - } - /* jshint ignore:end */ - }, - - /** - * Filter nested files/folders with the specified function. - * @param {Function} search the predicate to use : - * function (relativePath, file) {...} - * It takes 2 arguments : the relative path and the file. - * @return {Array} An array of matching elements. - */ - filter: function(search) { - var result = []; - this.forEach(function (relativePath, entry) { - if (search(relativePath, entry)) { // the file matches the function - result.push(entry); - } - - }); - return result; - }, - - /** - * Add a file to the zip file, or search a file. - * @param {string|RegExp} name The name of the file to add (if data is defined), - * the name of the file to find (if no data) or a regex to match files. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded - * @param {Object} o File options - * @return {JSZip|Object|Array} this JSZip object (when adding a file), - * a file (when searching by string) or an array of files (when searching by regex). - */ - file: function(name, data, o) { - if (arguments.length === 1) { - if (isRegExp(name)) { - var regexp = name; - return this.filter(function(relativePath, file) { - return !file.dir && regexp.test(relativePath); - }); - } - else { // text - var obj = this.files[this.root + name]; - if (obj && !obj.dir) { - return obj; - } else { - return null; - } - } - } - else { // more than one argument : we have data ! - name = this.root + name; - fileAdd.call(this, name, data, o); - } - return this; - }, - - /** - * Add a directory to the zip file, or search. - * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. - * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. - */ - folder: function(arg) { - if (!arg) { - return this; - } - - if (isRegExp(arg)) { - return this.filter(function(relativePath, file) { - return file.dir && arg.test(relativePath); - }); - } - - // else, name is a new folder - var name = this.root + arg; - var newFolder = folderAdd.call(this, name); - - // Allow chaining by returning a new object with this folder as the root - var ret = this.clone(); - ret.root = newFolder.name; - return ret; - }, - - /** - * Delete a file, or a directory and all sub-files, from the zip - * @param {string} name the name of the file to delete - * @return {JSZip} this JSZip object - */ - remove: function(name) { - name = this.root + name; - var file = this.files[name]; - if (!file) { - // Look for any folders - if (name.slice(-1) !== "/") { - name += "/"; - } - file = this.files[name]; - } - - if (file && !file.dir) { - // file - delete this.files[name]; - } else { - // maybe a folder, delete recursively - var kids = this.filter(function(relativePath, file) { - return file.name.slice(0, name.length) === name; - }); - for (var i = 0; i < kids.length; i++) { - delete this.files[kids[i].name]; - } - } - - return this; - }, - - /** - * Generate the complete zip file - * @param {Object} options the options to generate the zip file : - * - compression, "STORE" by default. - * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. - * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file - */ - generate: function(options) { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); - }, - - /** - * Generate the complete zip file as an internal stream. - * @param {Object} options the options to generate the zip file : - * - compression, "STORE" by default. - * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. - * @return {StreamHelper} the streamed zip file. - */ - generateInternalStream: function(options) { - var worker, opts = {}; - try { - opts = utils.extend(options || {}, { - streamFiles: false, - compression: "STORE", - compressionOptions : null, - type: "", - platform: "DOS", - comment: null, - mimeType: 'application/zip', - encodeFileName: utf8.utf8encode - }); - - opts.type = opts.type.toLowerCase(); - opts.compression = opts.compression.toUpperCase(); - - // "binarystring" is preferred but the internals use "string". - if(opts.type === "binarystring") { - opts.type = "string"; - } - - if (!opts.type) { - throw new Error("No output type specified."); - } - - utils.checkSupport(opts.type); - - // accept nodejs `process.platform` - if( - opts.platform === 'darwin' || - opts.platform === 'freebsd' || - opts.platform === 'linux' || - opts.platform === 'sunos' - ) { - opts.platform = "UNIX"; - } - if (opts.platform === 'win32') { - opts.platform = "DOS"; - } - - var comment = opts.comment || this.comment || ""; - worker = generate.generateWorker(this, opts, comment); - } catch (e) { - worker = new GenericWorker("error"); - worker.error(e); - } - return new StreamHelper(worker, opts.type || "string", opts.mimeType); - }, - /** - * Generate the complete zip file asynchronously. - * @see generateInternalStream - */ - generateAsync: function(options, onUpdate) { - return this.generateInternalStream(options).accumulate(onUpdate); - }, - /** - * Generate the complete zip file asynchronously. - * @see generateInternalStream - */ - generateNodeStream: function(options, onUpdate) { - options = options || {}; - if (!options.type) { - options.type = "nodebuffer"; - } - return this.generateInternalStream(options).toNodejsStream(onUpdate); - } -}; -module.exports = out; - -},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(require,module,exports){ -/* - * This file is used by module bundlers (browserify/webpack/etc) when - * including a stream implementation. We use "readable-stream" to get a - * consistent behavior between nodejs versions but bundlers often have a shim - * for "stream". Using this shim greatly improve the compatibility and greatly - * reduce the final size of the bundle (only one stream implementation, not - * two). - */ -module.exports = require("stream"); - -},{"stream":undefined}],17:[function(require,module,exports){ -'use strict'; -var DataReader = require('./DataReader'); -var utils = require('../utils'); - -function ArrayReader(data) { - DataReader.call(this, data); - for(var i = 0; i < this.data.length; i++) { - data[i] = data[i] & 0xFF; - } -} -utils.inherits(ArrayReader, DataReader); -/** - * @see DataReader.byteAt - */ -ArrayReader.prototype.byteAt = function(i) { - return this.data[this.zero + i]; -}; -/** - * @see DataReader.lastIndexOfSignature - */ -ArrayReader.prototype.lastIndexOfSignature = function(sig) { - var sig0 = sig.charCodeAt(0), - sig1 = sig.charCodeAt(1), - sig2 = sig.charCodeAt(2), - sig3 = sig.charCodeAt(3); - for (var i = this.length - 4; i >= 0; --i) { - if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { - return i - this.zero; - } - } - - return -1; -}; -/** - * @see DataReader.readAndCheckSignature - */ -ArrayReader.prototype.readAndCheckSignature = function (sig) { - var sig0 = sig.charCodeAt(0), - sig1 = sig.charCodeAt(1), - sig2 = sig.charCodeAt(2), - sig3 = sig.charCodeAt(3), - data = this.readData(4); - return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3]; -}; -/** - * @see DataReader.readData - */ -ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if(size === 0) { - return []; - } - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = ArrayReader; - -},{"../utils":32,"./DataReader":18}],18:[function(require,module,exports){ -'use strict'; -var utils = require('../utils'); - -function DataReader(data) { - this.data = data; // type : see implementation - this.length = data.length; - this.index = 0; - this.zero = 0; -} -DataReader.prototype = { - /** - * Check that the offset will not go too far. - * @param {string} offset the additional offset to check. - * @throws {Error} an Error if the offset is out of bounds. - */ - checkOffset: function(offset) { - this.checkIndex(this.index + offset); - }, - /** - * Check that the specified index will not be too far. - * @param {string} newIndex the index to check. - * @throws {Error} an Error if the index is out of bounds. - */ - checkIndex: function(newIndex) { - if (this.length < this.zero + newIndex || newIndex < 0) { - throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); - } - }, - /** - * Change the index. - * @param {number} newIndex The new index. - * @throws {Error} if the new index is out of the data. - */ - setIndex: function(newIndex) { - this.checkIndex(newIndex); - this.index = newIndex; - }, - /** - * Skip the next n bytes. - * @param {number} n the number of bytes to skip. - * @throws {Error} if the new index is out of the data. - */ - skip: function(n) { - this.setIndex(this.index + n); - }, - /** - * Get the byte at the specified index. - * @param {number} i the index to use. - * @return {number} a byte. - */ - byteAt: function(i) { - // see implementations - }, - /** - * Get the next number with a given byte size. - * @param {number} size the number of bytes to read. - * @return {number} the corresponding number. - */ - readInt: function(size) { - var result = 0, - i; - this.checkOffset(size); - for (i = this.index + size - 1; i >= this.index; i--) { - result = (result << 8) + this.byteAt(i); - } - this.index += size; - return result; - }, - /** - * Get the next string with a given byte size. - * @param {number} size the number of bytes to read. - * @return {string} the corresponding string. - */ - readString: function(size) { - return utils.transformTo("string", this.readData(size)); - }, - /** - * Get raw data without conversion, bytes. - * @param {number} size the number of bytes to read. - * @return {Object} the raw data, implementation specific. - */ - readData: function(size) { - // see implementations - }, - /** - * Find the last occurrence of a zip signature (4 bytes). - * @param {string} sig the signature to find. - * @return {number} the index of the last occurrence, -1 if not found. - */ - lastIndexOfSignature: function(sig) { - // see implementations - }, - /** - * Read the signature (4 bytes) at the current position and compare it with sig. - * @param {string} sig the expected signature - * @return {boolean} true if the signature matches, false otherwise. - */ - readAndCheckSignature: function(sig) { - // see implementations - }, - /** - * Get the next date. - * @return {Date} the date. - */ - readDate: function() { - var dostime = this.readInt(4); - return new Date(Date.UTC( - ((dostime >> 25) & 0x7f) + 1980, // year - ((dostime >> 21) & 0x0f) - 1, // month - (dostime >> 16) & 0x1f, // day - (dostime >> 11) & 0x1f, // hour - (dostime >> 5) & 0x3f, // minute - (dostime & 0x1f) << 1)); // second - } -}; -module.exports = DataReader; - -},{"../utils":32}],19:[function(require,module,exports){ -'use strict'; -var Uint8ArrayReader = require('./Uint8ArrayReader'); -var utils = require('../utils'); - -function NodeBufferReader(data) { - Uint8ArrayReader.call(this, data); -} -utils.inherits(NodeBufferReader, Uint8ArrayReader); - -/** - * @see DataReader.readData - */ -NodeBufferReader.prototype.readData = function(size) { - this.checkOffset(size); - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = NodeBufferReader; - -},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(require,module,exports){ -'use strict'; -var DataReader = require('./DataReader'); -var utils = require('../utils'); - -function StringReader(data) { - DataReader.call(this, data); -} -utils.inherits(StringReader, DataReader); -/** - * @see DataReader.byteAt - */ -StringReader.prototype.byteAt = function(i) { - return this.data.charCodeAt(this.zero + i); -}; -/** - * @see DataReader.lastIndexOfSignature - */ -StringReader.prototype.lastIndexOfSignature = function(sig) { - return this.data.lastIndexOf(sig) - this.zero; -}; -/** - * @see DataReader.readAndCheckSignature - */ -StringReader.prototype.readAndCheckSignature = function (sig) { - var data = this.readData(4); - return sig === data; -}; -/** - * @see DataReader.readData - */ -StringReader.prototype.readData = function(size) { - this.checkOffset(size); - // this will work because the constructor applied the "& 0xff" mask. - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = StringReader; - -},{"../utils":32,"./DataReader":18}],21:[function(require,module,exports){ -'use strict'; -var ArrayReader = require('./ArrayReader'); -var utils = require('../utils'); - -function Uint8ArrayReader(data) { - ArrayReader.call(this, data); -} -utils.inherits(Uint8ArrayReader, ArrayReader); -/** - * @see DataReader.readData - */ -Uint8ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if(size === 0) { - // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. - return new Uint8Array(0); - } - var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; -}; -module.exports = Uint8ArrayReader; - -},{"../utils":32,"./ArrayReader":17}],22:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var support = require('../support'); -var ArrayReader = require('./ArrayReader'); -var StringReader = require('./StringReader'); -var NodeBufferReader = require('./NodeBufferReader'); -var Uint8ArrayReader = require('./Uint8ArrayReader'); - -/** - * Create a reader adapted to the data. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read. - * @return {DataReader} the data reader. - */ -module.exports = function (data) { - var type = utils.getTypeOf(data); - utils.checkSupport(type); - if (type === "string" && !support.uint8array) { - return new StringReader(data); - } - if (type === "nodebuffer") { - return new NodeBufferReader(data); - } - if (support.uint8array) { - return new Uint8ArrayReader(utils.transformTo("uint8array", data)); - } - return new ArrayReader(utils.transformTo("array", data)); -}; - -},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(require,module,exports){ -'use strict'; -exports.LOCAL_FILE_HEADER = "PK\x03\x04"; -exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; -exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; -exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; -exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; -exports.DATA_DESCRIPTOR = "PK\x07\x08"; - -},{}],24:[function(require,module,exports){ -'use strict'; - -var GenericWorker = require('./GenericWorker'); -var utils = require('../utils'); - -/** - * A worker which convert chunks to a specified type. - * @constructor - * @param {String} destType the destination type. - */ -function ConvertWorker(destType) { - GenericWorker.call(this, "ConvertWorker to " + destType); - this.destType = destType; -} -utils.inherits(ConvertWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -ConvertWorker.prototype.processChunk = function (chunk) { - this.push({ - data : utils.transformTo(this.destType, chunk.data), - meta : chunk.meta - }); -}; -module.exports = ConvertWorker; - -},{"../utils":32,"./GenericWorker":28}],25:[function(require,module,exports){ -'use strict'; - -var GenericWorker = require('./GenericWorker'); -var crc32 = require('../crc32'); -var utils = require('../utils'); - -/** - * A worker which calculate the crc32 of the data flowing through. - * @constructor - */ -function Crc32Probe() { - GenericWorker.call(this, "Crc32Probe"); - this.withStreamInfo("crc32", 0); -} -utils.inherits(Crc32Probe, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -Crc32Probe.prototype.processChunk = function (chunk) { - this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0); - this.push(chunk); -}; -module.exports = Crc32Probe; - -},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var GenericWorker = require('./GenericWorker'); - -/** - * A worker which calculate the total length of the data flowing through. - * @constructor - * @param {String} propName the name used to expose the length - */ -function DataLengthProbe(propName) { - GenericWorker.call(this, "DataLengthProbe for " + propName); - this.propName = propName; - this.withStreamInfo(propName, 0); -} -utils.inherits(DataLengthProbe, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -DataLengthProbe.prototype.processChunk = function (chunk) { - if(chunk) { - var length = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = length + chunk.data.length; - } - GenericWorker.prototype.processChunk.call(this, chunk); -}; -module.exports = DataLengthProbe; - - -},{"../utils":32,"./GenericWorker":28}],27:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var GenericWorker = require('./GenericWorker'); - -// the size of the generated chunks -// TODO expose this as a public variable -var DEFAULT_BLOCK_SIZE = 16 * 1024; - -/** - * A worker that reads a content and emits chunks. - * @constructor - * @param {Promise} dataP the promise of the data to split - */ -function DataWorker(dataP) { - GenericWorker.call(this, "DataWorker"); - var self = this; - this.dataIsReady = false; - this.index = 0; - this.max = 0; - this.data = null; - this.type = ""; - - this._tickScheduled = false; - - dataP.then(function (data) { - self.dataIsReady = true; - self.data = data; - self.max = data && data.length || 0; - self.type = utils.getTypeOf(data); - if(!self.isPaused) { - self._tickAndRepeat(); - } - }, function (e) { - self.error(e); - }); -} - -utils.inherits(DataWorker, GenericWorker); - -/** - * @see GenericWorker.cleanUp - */ -DataWorker.prototype.cleanUp = function () { - GenericWorker.prototype.cleanUp.call(this); - this.data = null; -}; - -/** - * @see GenericWorker.resume - */ -DataWorker.prototype.resume = function () { - if(!GenericWorker.prototype.resume.call(this)) { - return false; - } - - if (!this._tickScheduled && this.dataIsReady) { - this._tickScheduled = true; - utils.delay(this._tickAndRepeat, [], this); - } - return true; -}; - -/** - * Trigger a tick a schedule an other call to this function. - */ -DataWorker.prototype._tickAndRepeat = function() { - this._tickScheduled = false; - if(this.isPaused || this.isFinished) { - return; - } - this._tick(); - if(!this.isFinished) { - utils.delay(this._tickAndRepeat, [], this); - this._tickScheduled = true; - } -}; - -/** - * Read and push a chunk. - */ -DataWorker.prototype._tick = function() { - - if(this.isPaused || this.isFinished) { - return false; - } - - var size = DEFAULT_BLOCK_SIZE; - var data = null, nextIndex = Math.min(this.max, this.index + size); - if (this.index >= this.max) { - // EOF - return this.end(); - } else { - switch(this.type) { - case "string": - data = this.data.substring(this.index, nextIndex); - break; - case "uint8array": - data = this.data.subarray(this.index, nextIndex); - break; - case "array": - case "nodebuffer": - data = this.data.slice(this.index, nextIndex); - break; - } - this.index = nextIndex; - return this.push({ - data : data, - meta : { - percent : this.max ? this.index / this.max * 100 : 0 - } - }); - } -}; - -module.exports = DataWorker; - -},{"../utils":32,"./GenericWorker":28}],28:[function(require,module,exports){ -'use strict'; - -/** - * A worker that does nothing but passing chunks to the next one. This is like - * a nodejs stream but with some differences. On the good side : - * - it works on IE 6-9 without any issue / polyfill - * - it weights less than the full dependencies bundled with browserify - * - it forwards errors (no need to declare an error handler EVERYWHERE) - * - * A chunk is an object with 2 attributes : `meta` and `data`. The former is an - * object containing anything (`percent` for example), see each worker for more - * details. The latter is the real data (String, Uint8Array, etc). - * - * @constructor - * @param {String} name the name of the stream (mainly used for debugging purposes) - */ -function GenericWorker(name) { - // the name of the worker - this.name = name || "default"; - // an object containing metadata about the workers chain - this.streamInfo = {}; - // an error which happened when the worker was paused - this.generatedError = null; - // an object containing metadata to be merged by this worker into the general metadata - this.extraStreamInfo = {}; - // true if the stream is paused (and should not do anything), false otherwise - this.isPaused = true; - // true if the stream is finished (and should not do anything), false otherwise - this.isFinished = false; - // true if the stream is locked to prevent further structure updates (pipe), false otherwise - this.isLocked = false; - // the event listeners - this._listeners = { - 'data':[], - 'end':[], - 'error':[] - }; - // the previous worker, if any - this.previous = null; -} - -GenericWorker.prototype = { - /** - * Push a chunk to the next workers. - * @param {Object} chunk the chunk to push - */ - push : function (chunk) { - this.emit("data", chunk); - }, - /** - * End the stream. - * @return {Boolean} true if this call ended the worker, false otherwise. - */ - end : function () { - if (this.isFinished) { - return false; - } - - this.flush(); - try { - this.emit("end"); - this.cleanUp(); - this.isFinished = true; - } catch (e) { - this.emit("error", e); - } - return true; - }, - /** - * End the stream with an error. - * @param {Error} e the error which caused the premature end. - * @return {Boolean} true if this call ended the worker with an error, false otherwise. - */ - error : function (e) { - if (this.isFinished) { - return false; - } - - if(this.isPaused) { - this.generatedError = e; - } else { - this.isFinished = true; - - this.emit("error", e); - - // in the workers chain exploded in the middle of the chain, - // the error event will go downward but we also need to notify - // workers upward that there has been an error. - if(this.previous) { - this.previous.error(e); - } - - this.cleanUp(); - } - return true; - }, - /** - * Add a callback on an event. - * @param {String} name the name of the event (data, end, error) - * @param {Function} listener the function to call when the event is triggered - * @return {GenericWorker} the current object for chainability - */ - on : function (name, listener) { - this._listeners[name].push(listener); - return this; - }, - /** - * Clean any references when a worker is ending. - */ - cleanUp : function () { - this.streamInfo = this.generatedError = this.extraStreamInfo = null; - this._listeners = []; - }, - /** - * Trigger an event. This will call registered callback with the provided arg. - * @param {String} name the name of the event (data, end, error) - * @param {Object} arg the argument to call the callback with. - */ - emit : function (name, arg) { - if (this._listeners[name]) { - for(var i = 0; i < this._listeners[name].length; i++) { - this._listeners[name][i].call(this, arg); - } - } - }, - /** - * Chain a worker with an other. - * @param {Worker} next the worker receiving events from the current one. - * @return {worker} the next worker for chainability - */ - pipe : function (next) { - return next.registerPrevious(this); - }, - /** - * Same as `pipe` in the other direction. - * Using an API with `pipe(next)` is very easy. - * Implementing the API with the point of view of the next one registering - * a source is easier, see the ZipFileWorker. - * @param {Worker} previous the previous worker, sending events to this one - * @return {Worker} the current worker for chainability - */ - registerPrevious : function (previous) { - if (this.isLocked) { - throw new Error("The stream '" + this + "' has already been used."); - } - - // sharing the streamInfo... - this.streamInfo = previous.streamInfo; - // ... and adding our own bits - this.mergeStreamInfo(); - this.previous = previous; - var self = this; - previous.on('data', function (chunk) { - self.processChunk(chunk); - }); - previous.on('end', function () { - self.end(); - }); - previous.on('error', function (e) { - self.error(e); - }); - return this; - }, - /** - * Pause the stream so it doesn't send events anymore. - * @return {Boolean} true if this call paused the worker, false otherwise. - */ - pause : function () { - if(this.isPaused || this.isFinished) { - return false; - } - this.isPaused = true; - - if(this.previous) { - this.previous.pause(); - } - return true; - }, - /** - * Resume a paused stream. - * @return {Boolean} true if this call resumed the worker, false otherwise. - */ - resume : function () { - if(!this.isPaused || this.isFinished) { - return false; - } - this.isPaused = false; - - // if true, the worker tried to resume but failed - var withError = false; - if(this.generatedError) { - this.error(this.generatedError); - withError = true; - } - if(this.previous) { - this.previous.resume(); - } - - return !withError; - }, - /** - * Flush any remaining bytes as the stream is ending. - */ - flush : function () {}, - /** - * Process a chunk. This is usually the method overridden. - * @param {Object} chunk the chunk to process. - */ - processChunk : function(chunk) { - this.push(chunk); - }, - /** - * Add a key/value to be added in the workers chain streamInfo once activated. - * @param {String} key the key to use - * @param {Object} value the associated value - * @return {Worker} the current worker for chainability - */ - withStreamInfo : function (key, value) { - this.extraStreamInfo[key] = value; - this.mergeStreamInfo(); - return this; - }, - /** - * Merge this worker's streamInfo into the chain's streamInfo. - */ - mergeStreamInfo : function () { - for(var key in this.extraStreamInfo) { - if (!this.extraStreamInfo.hasOwnProperty(key)) { - continue; - } - this.streamInfo[key] = this.extraStreamInfo[key]; - } - }, - - /** - * Lock the stream to prevent further updates on the workers chain. - * After calling this method, all calls to pipe will fail. - */ - lock: function () { - if (this.isLocked) { - throw new Error("The stream '" + this + "' has already been used."); - } - this.isLocked = true; - if (this.previous) { - this.previous.lock(); - } - }, - - /** - * - * Pretty print the workers chain. - */ - toString : function () { - var me = "Worker " + this.name; - if (this.previous) { - return this.previous + " -> " + me; - } else { - return me; - } - } -}; - -module.exports = GenericWorker; - -},{}],29:[function(require,module,exports){ -'use strict'; - -var utils = require('../utils'); -var ConvertWorker = require('./ConvertWorker'); -var GenericWorker = require('./GenericWorker'); -var base64 = require('../base64'); -var support = require("../support"); -var external = require("../external"); - -var NodejsStreamOutputAdapter = null; -if (support.nodestream) { - try { - NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter'); - } catch(e) {} -} - -/** - * Apply the final transformation of the data. If the user wants a Blob for - * example, it's easier to work with an U8intArray and finally do the - * ArrayBuffer/Blob conversion. - * @param {String} type the name of the final type - * @param {String|Uint8Array|Buffer} content the content to transform - * @param {String} mimeType the mime type of the content, if applicable. - * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format. - */ -function transformZipOutput(type, content, mimeType) { - switch(type) { - case "blob" : - return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType); - case "base64" : - return base64.encode(content); - default : - return utils.transformTo(type, content); - } -} - -/** - * Concatenate an array of data of the given type. - * @param {String} type the type of the data in the given array. - * @param {Array} dataArray the array containing the data chunks to concatenate - * @return {String|Uint8Array|Buffer} the concatenated data - * @throws Error if the asked type is unsupported - */ -function concat (type, dataArray) { - var i, index = 0, res = null, totalLength = 0; - for(i = 0; i < dataArray.length; i++) { - totalLength += dataArray[i].length; - } - switch(type) { - case "string": - return dataArray.join(""); - case "array": - return Array.prototype.concat.apply([], dataArray); - case "uint8array": - res = new Uint8Array(totalLength); - for(i = 0; i < dataArray.length; i++) { - res.set(dataArray[i], index); - index += dataArray[i].length; - } - return res; - case "nodebuffer": - return Buffer.concat(dataArray); - default: - throw new Error("concat : unsupported type '" + type + "'"); - } -} - -/** - * Listen a StreamHelper, accumulate its content and concatenate it into a - * complete block. - * @param {StreamHelper} helper the helper to use. - * @param {Function} updateCallback a callback called on each update. Called - * with one arg : - * - the metadata linked to the update received. - * @return Promise the promise for the accumulation. - */ -function accumulate(helper, updateCallback) { - return new external.Promise(function (resolve, reject){ - var dataArray = []; - var chunkType = helper._internalType, - resultType = helper._outputType, - mimeType = helper._mimeType; - helper - .on('data', function (data, meta) { - dataArray.push(data); - if(updateCallback) { - updateCallback(meta); - } - }) - .on('error', function(err) { - dataArray = []; - reject(err); - }) - .on('end', function (){ - try { - var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); - resolve(result); - } catch (e) { - reject(e); - } - dataArray = []; - }) - .resume(); - }); -} - -/** - * An helper to easily use workers outside of JSZip. - * @constructor - * @param {Worker} worker the worker to wrap - * @param {String} outputType the type of data expected by the use - * @param {String} mimeType the mime type of the content, if applicable. - */ -function StreamHelper(worker, outputType, mimeType) { - var internalType = outputType; - switch(outputType) { - case "blob": - case "arraybuffer": - internalType = "uint8array"; - break; - case "base64": - internalType = "string"; - break; - } - - try { - // the type used internally - this._internalType = internalType; - // the type used to output results - this._outputType = outputType; - // the mime type - this._mimeType = mimeType; - utils.checkSupport(internalType); - this._worker = worker.pipe(new ConvertWorker(internalType)); - // the last workers can be rewired without issues but we need to - // prevent any updates on previous workers. - worker.lock(); - } catch(e) { - this._worker = new GenericWorker("error"); - this._worker.error(e); - } -} - -StreamHelper.prototype = { - /** - * Listen a StreamHelper, accumulate its content and concatenate it into a - * complete block. - * @param {Function} updateCb the update callback. - * @return Promise the promise for the accumulation. - */ - accumulate : function (updateCb) { - return accumulate(this, updateCb); - }, - /** - * Add a listener on an event triggered on a stream. - * @param {String} evt the name of the event - * @param {Function} fn the listener - * @return {StreamHelper} the current helper. - */ - on : function (evt, fn) { - var self = this; - - if(evt === "data") { - this._worker.on(evt, function (chunk) { - fn.call(self, chunk.data, chunk.meta); - }); - } else { - this._worker.on(evt, function () { - utils.delay(fn, arguments, self); - }); - } - return this; - }, - /** - * Resume the flow of chunks. - * @return {StreamHelper} the current helper. - */ - resume : function () { - utils.delay(this._worker.resume, [], this._worker); - return this; - }, - /** - * Pause the flow of chunks. - * @return {StreamHelper} the current helper. - */ - pause : function () { - this._worker.pause(); - return this; - }, - /** - * Return a nodejs stream for this helper. - * @param {Function} updateCb the update callback. - * @return {NodejsStreamOutputAdapter} the nodejs stream. - */ - toNodejsStream : function (updateCb) { - utils.checkSupport("nodestream"); - if (this._outputType !== "nodebuffer") { - // an object stream containing blob/arraybuffer/uint8array/string - // is strange and I don't know if it would be useful. - // I you find this comment and have a good usecase, please open a - // bug report ! - throw new Error(this._outputType + " is not supported by this method"); - } - - return new NodejsStreamOutputAdapter(this, { - objectMode : this._outputType !== "nodebuffer" - }, updateCb); - } -}; - - -module.exports = StreamHelper; - -},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(require,module,exports){ -'use strict'; - -exports.base64 = true; -exports.array = true; -exports.string = true; -exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; -exports.nodebuffer = typeof Buffer !== "undefined"; -// contains true if JSZip can read/generate Uint8Array, false otherwise. -exports.uint8array = typeof Uint8Array !== "undefined"; - -if (typeof ArrayBuffer === "undefined") { - exports.blob = false; -} -else { - var buffer = new ArrayBuffer(0); - try { - exports.blob = new Blob([buffer], { - type: "application/zip" - }).size === 0; - } - catch (e) { - try { - var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; - var builder = new Builder(); - builder.append(buffer); - exports.blob = builder.getBlob('application/zip').size === 0; - } - catch (e) { - exports.blob = false; - } - } -} - -try { - exports.nodestream = !!require('readable-stream').Readable; -} catch(e) { - exports.nodestream = false; -} - -},{"readable-stream":16}],31:[function(require,module,exports){ -'use strict'; - -var utils = require('./utils'); -var support = require('./support'); -var nodejsUtils = require('./nodejsUtils'); -var GenericWorker = require('./stream/GenericWorker'); - -/** - * The following functions come from pako, from pako/lib/utils/strings - * released under the MIT license, see pako https://github.com/nodeca/pako/ - */ - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new Array(256); -for (var i=0; i<256; i++) { - _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); -} -_utf8len[254]=_utf8len[254]=1; // Invalid sequence start - -// convert string to array (typed, when possible) -var string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { - c2 = str.charCodeAt(m_pos+1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - if (support.uint8array) { - buf = new Uint8Array(buf_len); - } else { - buf = new Array(buf_len); - } - - // convert - for (i=0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { - c2 = str.charCodeAt(m_pos+1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -var utf8border = function(buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max-1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Fuckup - very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means vuffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; - -// convert array to string -var buf2string = function (buf) { - var str, i, out, c, c_len; - var len = buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len*2); - - for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - // shrinkBuf(utf16buf, out) - if (utf16buf.length !== out) { - if(utf16buf.subarray) { - utf16buf = utf16buf.subarray(0, out); - } else { - utf16buf.length = out; - } - } - - // return String.fromCharCode.apply(null, utf16buf); - return utils.applyFromCharCode(utf16buf); -}; - - -// That's all for the pako functions. - - -/** - * Transform a javascript string into an array (typed if possible) of bytes, - * UTF-8 encoded. - * @param {String} str the string to encode - * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. - */ -exports.utf8encode = function utf8encode(str) { - if (support.nodebuffer) { - return nodejsUtils.newBufferFrom(str, "utf-8"); - } - - return string2buf(str); -}; - - -/** - * Transform a bytes array (or a representation) representing an UTF-8 encoded - * string into a javascript string. - * @param {Array|Uint8Array|Buffer} buf the data de decode - * @return {String} the decoded string. - */ -exports.utf8decode = function utf8decode(buf) { - if (support.nodebuffer) { - return utils.transformTo("nodebuffer", buf).toString("utf-8"); - } - - buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); - - return buf2string(buf); -}; - -/** - * A worker to decode utf8 encoded binary chunks into string chunks. - * @constructor - */ -function Utf8DecodeWorker() { - GenericWorker.call(this, "utf-8 decode"); - // the last bytes if a chunk didn't end with a complete codepoint. - this.leftOver = null; -} -utils.inherits(Utf8DecodeWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -Utf8DecodeWorker.prototype.processChunk = function (chunk) { - - var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data); - - // 1st step, re-use what's left of the previous chunk - if (this.leftOver && this.leftOver.length) { - if(support.uint8array) { - var previousData = data; - data = new Uint8Array(previousData.length + this.leftOver.length); - data.set(this.leftOver, 0); - data.set(previousData, this.leftOver.length); - } else { - data = this.leftOver.concat(data); - } - this.leftOver = null; - } - - var nextBoundary = utf8border(data); - var usableData = data; - if (nextBoundary !== data.length) { - if (support.uint8array) { - usableData = data.subarray(0, nextBoundary); - this.leftOver = data.subarray(nextBoundary, data.length); - } else { - usableData = data.slice(0, nextBoundary); - this.leftOver = data.slice(nextBoundary, data.length); - } - } - - this.push({ - data : exports.utf8decode(usableData), - meta : chunk.meta - }); -}; - -/** - * @see GenericWorker.flush - */ -Utf8DecodeWorker.prototype.flush = function () { - if(this.leftOver && this.leftOver.length) { - this.push({ - data : exports.utf8decode(this.leftOver), - meta : {} - }); - this.leftOver = null; - } -}; -exports.Utf8DecodeWorker = Utf8DecodeWorker; - -/** - * A worker to endcode string chunks into utf8 encoded binary chunks. - * @constructor - */ -function Utf8EncodeWorker() { - GenericWorker.call(this, "utf-8 encode"); -} -utils.inherits(Utf8EncodeWorker, GenericWorker); - -/** - * @see GenericWorker.processChunk - */ -Utf8EncodeWorker.prototype.processChunk = function (chunk) { - this.push({ - data : exports.utf8encode(chunk.data), - meta : chunk.meta - }); -}; -exports.Utf8EncodeWorker = Utf8EncodeWorker; - -},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(require,module,exports){ -'use strict'; - -var support = require('./support'); -var base64 = require('./base64'); -var nodejsUtils = require('./nodejsUtils'); -var setImmediate = require('set-immediate-shim'); -var external = require("./external"); - - -/** - * Convert a string that pass as a "binary string": it should represent a byte - * array but may have > 255 char codes. Be sure to take only the first byte - * and returns the byte array. - * @param {String} str the string to transform. - * @return {Array|Uint8Array} the string in a binary format. - */ -function string2binary(str) { - var result = null; - if (support.uint8array) { - result = new Uint8Array(str.length); - } else { - result = new Array(str.length); - } - return stringToArrayLike(str, result); -} - -/** - * Create a new blob with the given content and the given type. - * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use - * an Uint8Array because the stock browser of android 4 won't accept it (it - * will be silently converted to a string, "[object Uint8Array]"). - * - * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge: - * when a large amount of Array is used to create the Blob, the amount of - * memory consumed is nearly 100 times the original data amount. - * - * @param {String} type the mime type of the blob. - * @return {Blob} the created blob. - */ -exports.newBlob = function(part, type) { - exports.checkSupport("blob"); - - try { - // Blob constructor - return new Blob([part], { - type: type - }); - } - catch (e) { - - try { - // deprecated, browser only, old way - var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; - var builder = new Builder(); - builder.append(part); - return builder.getBlob(type); - } - catch (e) { - - // well, fuck ?! - throw new Error("Bug : can't construct the Blob."); - } - } - - -}; -/** - * The identity function. - * @param {Object} input the input. - * @return {Object} the same input. - */ -function identity(input) { - return input; -} - -/** - * Fill in an array with a string. - * @param {String} str the string to use. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. - */ -function stringToArrayLike(str, array) { - for (var i = 0; i < str.length; ++i) { - array[i] = str.charCodeAt(i) & 0xFF; - } - return array; -} - -/** - * An helper for the function arrayLikeToString. - * This contains static information and functions that - * can be optimized by the browser JIT compiler. - */ -var arrayToStringHelper = { - /** - * Transform an array of int into a string, chunk by chunk. - * See the performances notes on arrayLikeToString. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @param {String} type the type of the array. - * @param {Integer} chunk the chunk size. - * @return {String} the resulting string. - * @throws Error if the chunk is too big for the stack. - */ - stringifyByChunk: function(array, type, chunk) { - var result = [], k = 0, len = array.length; - // shortcut - if (len <= chunk) { - return String.fromCharCode.apply(null, array); - } - while (k < len) { - if (type === "array" || type === "nodebuffer") { - result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); - } - else { - result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); - } - k += chunk; - } - return result.join(""); - }, - /** - * Call String.fromCharCode on every item in the array. - * This is the naive implementation, which generate A LOT of intermediate string. - * This should be used when everything else fail. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @return {String} the result. - */ - stringifyByChar: function(array){ - var resultStr = ""; - for(var i = 0; i < array.length; i++) { - resultStr += String.fromCharCode(array[i]); - } - return resultStr; - }, - applyCanBeUsed : { - /** - * true if the browser accepts to use String.fromCharCode on Uint8Array - */ - uint8array : (function () { - try { - return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1; - } catch (e) { - return false; - } - })(), - /** - * true if the browser accepts to use String.fromCharCode on nodejs Buffer. - */ - nodebuffer : (function () { - try { - return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1; - } catch (e) { - return false; - } - })() - } -}; - -/** - * Transform an array-like object to a string. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. - * @return {String} the result. - */ -function arrayLikeToString(array) { - // Performances notes : - // -------------------- - // String.fromCharCode.apply(null, array) is the fastest, see - // see http://jsperf.com/converting-a-uint8array-to-a-string/2 - // but the stack is limited (and we can get huge arrays !). - // - // result += String.fromCharCode(array[i]); generate too many strings ! - // - // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 - // TODO : we now have workers that split the work. Do we still need that ? - var chunk = 65536, - type = exports.getTypeOf(array), - canUseApply = true; - if (type === "uint8array") { - canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array; - } else if (type === "nodebuffer") { - canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer; - } - - if (canUseApply) { - while (chunk > 1) { - try { - return arrayToStringHelper.stringifyByChunk(array, type, chunk); - } catch (e) { - chunk = Math.floor(chunk / 2); - } - } - } - - // no apply or chunk error : slow and painful algorithm - // default browser on android 4.* - return arrayToStringHelper.stringifyByChar(array); -} - -exports.applyFromCharCode = arrayLikeToString; - - -/** - * Copy the data from an array-like to an other array-like. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. - * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. - * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. - */ -function arrayLikeToArrayLike(arrayFrom, arrayTo) { - for (var i = 0; i < arrayFrom.length; i++) { - arrayTo[i] = arrayFrom[i]; - } - return arrayTo; -} - -// a matrix containing functions to transform everything into everything. -var transform = {}; - -// string to ? -transform["string"] = { - "string": identity, - "array": function(input) { - return stringToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return transform["string"]["uint8array"](input).buffer; - }, - "uint8array": function(input) { - return stringToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": function(input) { - return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length)); - } -}; - -// array to ? -transform["array"] = { - "string": arrayLikeToString, - "array": identity, - "arraybuffer": function(input) { - return (new Uint8Array(input)).buffer; - }, - "uint8array": function(input) { - return new Uint8Array(input); - }, - "nodebuffer": function(input) { - return nodejsUtils.newBufferFrom(input); - } -}; - -// arraybuffer to ? -transform["arraybuffer"] = { - "string": function(input) { - return arrayLikeToString(new Uint8Array(input)); - }, - "array": function(input) { - return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); - }, - "arraybuffer": identity, - "uint8array": function(input) { - return new Uint8Array(input); - }, - "nodebuffer": function(input) { - return nodejsUtils.newBufferFrom(new Uint8Array(input)); - } -}; - -// uint8array to ? -transform["uint8array"] = { - "string": arrayLikeToString, - "array": function(input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return input.buffer; - }, - "uint8array": identity, - "nodebuffer": function(input) { - return nodejsUtils.newBufferFrom(input); - } -}; - -// nodebuffer to ? -transform["nodebuffer"] = { - "string": arrayLikeToString, - "array": function(input) { - return arrayLikeToArrayLike(input, new Array(input.length)); - }, - "arraybuffer": function(input) { - return transform["nodebuffer"]["uint8array"](input).buffer; - }, - "uint8array": function(input) { - return arrayLikeToArrayLike(input, new Uint8Array(input.length)); - }, - "nodebuffer": identity -}; - -/** - * Transform an input into any type. - * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. - * If no output type is specified, the unmodified input will be returned. - * @param {String} outputType the output type. - * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. - * @throws {Error} an Error if the browser doesn't support the requested output type. - */ -exports.transformTo = function(outputType, input) { - if (!input) { - // undefined, null, etc - // an empty string won't harm. - input = ""; - } - if (!outputType) { - return input; - } - exports.checkSupport(outputType); - var inputType = exports.getTypeOf(input); - var result = transform[inputType][outputType](input); - return result; -}; - -/** - * Return the type of the input. - * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. - * @param {Object} input the input to identify. - * @return {String} the (lowercase) type of the input. - */ -exports.getTypeOf = function(input) { - if (typeof input === "string") { - return "string"; - } - if (Object.prototype.toString.call(input) === "[object Array]") { - return "array"; - } - if (support.nodebuffer && nodejsUtils.isBuffer(input)) { - return "nodebuffer"; - } - if (support.uint8array && input instanceof Uint8Array) { - return "uint8array"; - } - if (support.arraybuffer && input instanceof ArrayBuffer) { - return "arraybuffer"; - } -}; - -/** - * Throw an exception if the type is not supported. - * @param {String} type the type to check. - * @throws {Error} an Error if the browser doesn't support the requested type. - */ -exports.checkSupport = function(type) { - var supported = support[type.toLowerCase()]; - if (!supported) { - throw new Error(type + " is not supported by this platform"); - } -}; - -exports.MAX_VALUE_16BITS = 65535; -exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 - -/** - * Prettify a string read as binary. - * @param {string} str the string to prettify. - * @return {string} a pretty string. - */ -exports.pretty = function(str) { - var res = '', - code, i; - for (i = 0; i < (str || "").length; i++) { - code = str.charCodeAt(i); - res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); - } - return res; -}; - -/** - * Defer the call of a function. - * @param {Function} callback the function to call asynchronously. - * @param {Array} args the arguments to give to the callback. - */ -exports.delay = function(callback, args, self) { - setImmediate(function () { - callback.apply(self || null, args || []); - }); -}; - -/** - * Extends a prototype with an other, without calling a constructor with - * side effects. Inspired by nodejs' `utils.inherits` - * @param {Function} ctor the constructor to augment - * @param {Function} superCtor the parent constructor to use - */ -exports.inherits = function (ctor, superCtor) { - var Obj = function() {}; - Obj.prototype = superCtor.prototype; - ctor.prototype = new Obj(); -}; - -/** - * Merge the objects passed as parameters into a new one. - * @private - * @param {...Object} var_args All objects to merge. - * @return {Object} a new object with the data of the others. - */ -exports.extend = function() { - var result = {}, i, attr; - for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers - for (attr in arguments[i]) { - if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { - result[attr] = arguments[i][attr]; - } - } - } - return result; -}; - -/** - * Transform arbitrary content into a Promise. - * @param {String} name a name for the content being processed. - * @param {Object} inputData the content to process. - * @param {Boolean} isBinary true if the content is not an unicode string - * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character. - * @param {Boolean} isBase64 true if the string content is encoded with base64. - * @return {Promise} a promise in a format usable by JSZip. - */ -exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) { - - // if inputData is already a promise, this flatten it. - var promise = external.Promise.resolve(inputData).then(function(data) { - - - var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1); - - if (isBlob && typeof FileReader !== "undefined") { - return new external.Promise(function (resolve, reject) { - var reader = new FileReader(); - - reader.onload = function(e) { - resolve(e.target.result); - }; - reader.onerror = function(e) { - reject(e.target.error); - }; - reader.readAsArrayBuffer(data); - }); - } else { - return data; - } - }); - - return promise.then(function(data) { - var dataType = exports.getTypeOf(data); - - if (!dataType) { - return external.Promise.reject( - new Error("Can't read the data of '" + name + "'. Is it " + - "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?") - ); - } - // special case : it's way easier to work with Uint8Array than with ArrayBuffer - if (dataType === "arraybuffer") { - data = exports.transformTo("uint8array", data); - } else if (dataType === "string") { - if (isBase64) { - data = base64.decode(data); - } - else if (isBinary) { - // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask - if (isOptimizedBinaryString !== true) { - // this is a string, not in a base64 format. - // Be sure that this is a correct "binary string" - data = string2binary(data); - } - } - } - return data; - }); -}; - -},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(require,module,exports){ -'use strict'; -var readerFor = require('./reader/readerFor'); -var utils = require('./utils'); -var sig = require('./signature'); -var ZipEntry = require('./zipEntry'); -var utf8 = require('./utf8'); -var support = require('./support'); -// class ZipEntries {{{ -/** - * All the entries in the zip file. - * @constructor - * @param {Object} loadOptions Options for loading the stream. - */ -function ZipEntries(loadOptions) { - this.files = []; - this.loadOptions = loadOptions; -} -ZipEntries.prototype = { - /** - * Check that the reader is on the specified signature. - * @param {string} expectedSignature the expected signature. - * @throws {Error} if it is an other signature. - */ - checkSignature: function(expectedSignature) { - if (!this.reader.readAndCheckSignature(expectedSignature)) { - this.reader.index -= 4; - var signature = this.reader.readString(4); - throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); - } - }, - /** - * Check if the given signature is at the given index. - * @param {number} askedIndex the index to check. - * @param {string} expectedSignature the signature to expect. - * @return {boolean} true if the signature is here, false otherwise. - */ - isSignature: function(askedIndex, expectedSignature) { - var currentIndex = this.reader.index; - this.reader.setIndex(askedIndex); - var signature = this.reader.readString(4); - var result = signature === expectedSignature; - this.reader.setIndex(currentIndex); - return result; - }, - /** - * Read the end of the central directory. - */ - readBlockEndOfCentral: function() { - this.diskNumber = this.reader.readInt(2); - this.diskWithCentralDirStart = this.reader.readInt(2); - this.centralDirRecordsOnThisDisk = this.reader.readInt(2); - this.centralDirRecords = this.reader.readInt(2); - this.centralDirSize = this.reader.readInt(4); - this.centralDirOffset = this.reader.readInt(4); - - this.zipCommentLength = this.reader.readInt(2); - // warning : the encoding depends of the system locale - // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. - // On a windows machine, this field is encoded with the localized windows code page. - var zipComment = this.reader.readData(this.zipCommentLength); - var decodeParamType = support.uint8array ? "uint8array" : "array"; - // To get consistent behavior with the generation part, we will assume that - // this is utf8 encoded unless specified otherwise. - var decodeContent = utils.transformTo(decodeParamType, zipComment); - this.zipComment = this.loadOptions.decodeFileName(decodeContent); - }, - /** - * Read the end of the Zip 64 central directory. - * Not merged with the method readEndOfCentral : - * The end of central can coexist with its Zip64 brother, - * I don't want to read the wrong number of bytes ! - */ - readBlockZip64EndOfCentral: function() { - this.zip64EndOfCentralSize = this.reader.readInt(8); - this.reader.skip(4); - // this.versionMadeBy = this.reader.readString(2); - // this.versionNeeded = this.reader.readInt(2); - this.diskNumber = this.reader.readInt(4); - this.diskWithCentralDirStart = this.reader.readInt(4); - this.centralDirRecordsOnThisDisk = this.reader.readInt(8); - this.centralDirRecords = this.reader.readInt(8); - this.centralDirSize = this.reader.readInt(8); - this.centralDirOffset = this.reader.readInt(8); - - this.zip64ExtensibleData = {}; - var extraDataSize = this.zip64EndOfCentralSize - 44, - index = 0, - extraFieldId, - extraFieldLength, - extraFieldValue; - while (index < extraDataSize) { - extraFieldId = this.reader.readInt(2); - extraFieldLength = this.reader.readInt(4); - extraFieldValue = this.reader.readData(extraFieldLength); - this.zip64ExtensibleData[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - }, - /** - * Read the end of the Zip 64 central directory locator. - */ - readBlockZip64EndOfCentralLocator: function() { - this.diskWithZip64CentralDirStart = this.reader.readInt(4); - this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); - this.disksCount = this.reader.readInt(4); - if (this.disksCount > 1) { - throw new Error("Multi-volumes zip are not supported"); - } - }, - /** - * Read the local files, based on the offset read in the central part. - */ - readLocalFiles: function() { - var i, file; - for (i = 0; i < this.files.length; i++) { - file = this.files[i]; - this.reader.setIndex(file.localHeaderOffset); - this.checkSignature(sig.LOCAL_FILE_HEADER); - file.readLocalPart(this.reader); - file.handleUTF8(); - file.processAttributes(); - } - }, - /** - * Read the central directory. - */ - readCentralDir: function() { - var file; - - this.reader.setIndex(this.centralDirOffset); - while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)) { - file = new ZipEntry({ - zip64: this.zip64 - }, this.loadOptions); - file.readCentralPart(this.reader); - this.files.push(file); - } - - if (this.centralDirRecords !== this.files.length) { - if (this.centralDirRecords !== 0 && this.files.length === 0) { - // We expected some records but couldn't find ANY. - // This is really suspicious, as if something went wrong. - throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); - } else { - // We found some records but not all. - // Something is wrong but we got something for the user: no error here. - // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length); - } - } - }, - /** - * Read the end of central directory. - */ - readEndOfCentral: function() { - var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); - if (offset < 0) { - // Check if the content is a truncated zip or complete garbage. - // A "LOCAL_FILE_HEADER" is not required at the beginning (auto - // extractible zip for example) but it can give a good hint. - // If an ajax request was used without responseType, we will also - // get unreadable data. - var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER); - - if (isGarbage) { - throw new Error("Can't find end of central directory : is this a zip file ? " + - "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); - } else { - throw new Error("Corrupted zip: can't find end of central directory"); - } - - } - this.reader.setIndex(offset); - var endOfCentralDirOffset = offset; - this.checkSignature(sig.CENTRAL_DIRECTORY_END); - this.readBlockEndOfCentral(); - - - /* extract from the zip spec : - 4) If one of the fields in the end of central directory - record is too small to hold required data, the field - should be set to -1 (0xFFFF or 0xFFFFFFFF) and the - ZIP64 format record should be created. - 5) The end of central directory record and the - Zip64 end of central directory locator record must - reside on the same disk when splitting or spanning - an archive. - */ - if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { - this.zip64 = true; - - /* - Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from - the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents - all numbers as 64-bit double precision IEEE 754 floating point numbers. - So, we have 53bits for integers and bitwise operations treat everything as 32bits. - see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators - and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 - */ - - // should look for a zip64 EOCD locator - offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - if (offset < 0) { - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); - } - this.reader.setIndex(offset); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); - this.readBlockZip64EndOfCentralLocator(); - - // now the zip64 EOCD record - if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) { - // console.warn("ZIP64 end of central directory not where expected."); - this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - if (this.relativeOffsetEndOfZip64CentralDir < 0) { - throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); - } - } - this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); - this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); - this.readBlockZip64EndOfCentral(); - } - - var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize; - if (this.zip64) { - expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator - expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize; - } - - var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset; - - if (extraBytes > 0) { - // console.warn(extraBytes, "extra bytes at beginning or within zipfile"); - if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) { - // The offsets seem wrong, but we have something at the specified offset. - // So… we keep it. - } else { - // the offset is wrong, update the "zero" of the reader - // this happens if data has been prepended (crx files for example) - this.reader.zero = extraBytes; - } - } else if (extraBytes < 0) { - throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes."); - } - }, - prepareReader: function(data) { - this.reader = readerFor(data); - }, - /** - * Read a zip file and create ZipEntries. - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. - */ - load: function(data) { - this.prepareReader(data); - this.readEndOfCentral(); - this.readCentralDir(); - this.readLocalFiles(); - } -}; -// }}} end of ZipEntries -module.exports = ZipEntries; - -},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(require,module,exports){ -'use strict'; -var readerFor = require('./reader/readerFor'); -var utils = require('./utils'); -var CompressedObject = require('./compressedObject'); -var crc32fn = require('./crc32'); -var utf8 = require('./utf8'); -var compressions = require('./compressions'); -var support = require('./support'); - -var MADE_BY_DOS = 0x00; -var MADE_BY_UNIX = 0x03; - -/** - * Find a compression registered in JSZip. - * @param {string} compressionMethod the method magic to find. - * @return {Object|null} the JSZip compression object, null if none found. - */ -var findCompression = function(compressionMethod) { - for (var method in compressions) { - if (!compressions.hasOwnProperty(method)) { - continue; - } - if (compressions[method].magic === compressionMethod) { - return compressions[method]; - } - } - return null; -}; - -// class ZipEntry {{{ -/** - * An entry in the zip file. - * @constructor - * @param {Object} options Options of the current file. - * @param {Object} loadOptions Options for loading the stream. - */ -function ZipEntry(options, loadOptions) { - this.options = options; - this.loadOptions = loadOptions; -} -ZipEntry.prototype = { - /** - * say if the file is encrypted. - * @return {boolean} true if the file is encrypted, false otherwise. - */ - isEncrypted: function() { - // bit 1 is set - return (this.bitFlag & 0x0001) === 0x0001; - }, - /** - * say if the file has utf-8 filename/comment. - * @return {boolean} true if the filename/comment is in utf-8, false otherwise. - */ - useUTF8: function() { - // bit 11 is set - return (this.bitFlag & 0x0800) === 0x0800; - }, - /** - * Read the local part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readLocalPart: function(reader) { - var compression, localExtraFieldsLength; - - // we already know everything from the central dir ! - // If the central dir data are false, we are doomed. - // On the bright side, the local part is scary : zip64, data descriptors, both, etc. - // The less data we get here, the more reliable this should be. - // Let's skip the whole header and dash to the data ! - reader.skip(22); - // in some zip created on windows, the filename stored in the central dir contains \ instead of /. - // Strangely, the filename here is OK. - // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes - // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... - // Search "unzip mismatching "local" filename continuing with "central" filename version" on - // the internet. - // - // I think I see the logic here : the central directory is used to display - // content and the local directory is used to extract the files. Mixing / and \ - // may be used to display \ to windows users and use / when extracting the files. - // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 - this.fileNameLength = reader.readInt(2); - localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir - // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding. - this.fileName = reader.readData(this.fileNameLength); - reader.skip(localExtraFieldsLength); - - if (this.compressedSize === -1 || this.uncompressedSize === -1) { - throw new Error("Bug or corrupted zip : didn't get enough information from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)"); - } - - compression = findCompression(this.compressionMethod); - if (compression === null) { // no compression found - throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")"); - } - this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize)); - }, - - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readCentralPart: function(reader) { - this.versionMadeBy = reader.readInt(2); - reader.skip(2); - // this.versionNeeded = reader.readInt(2); - this.bitFlag = reader.readInt(2); - this.compressionMethod = reader.readString(2); - this.date = reader.readDate(); - this.crc32 = reader.readInt(4); - this.compressedSize = reader.readInt(4); - this.uncompressedSize = reader.readInt(4); - var fileNameLength = reader.readInt(2); - this.extraFieldsLength = reader.readInt(2); - this.fileCommentLength = reader.readInt(2); - this.diskNumberStart = reader.readInt(2); - this.internalFileAttributes = reader.readInt(2); - this.externalFileAttributes = reader.readInt(4); - this.localHeaderOffset = reader.readInt(4); - - if (this.isEncrypted()) { - throw new Error("Encrypted zip are not supported"); - } - - // will be read in the local part, see the comments there - reader.skip(fileNameLength); - this.readExtraFields(reader); - this.parseZIP64ExtraField(reader); - this.fileComment = reader.readData(this.fileCommentLength); - }, - - /** - * Parse the external file attributes and get the unix/dos permissions. - */ - processAttributes: function () { - this.unixPermissions = null; - this.dosPermissions = null; - var madeBy = this.versionMadeBy >> 8; - - // Check if we have the DOS directory flag set. - // We look for it in the DOS and UNIX permissions - // but some unknown platform could set it as a compatibility flag. - this.dir = this.externalFileAttributes & 0x0010 ? true : false; - - if(madeBy === MADE_BY_DOS) { - // first 6 bits (0 to 5) - this.dosPermissions = this.externalFileAttributes & 0x3F; - } - - if(madeBy === MADE_BY_UNIX) { - this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF; - // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8); - } - - // fail safe : if the name ends with a / it probably means a folder - if (!this.dir && this.fileNameStr.slice(-1) === '/') { - this.dir = true; - } - }, - - /** - * Parse the ZIP64 extra field and merge the info in the current ZipEntry. - * @param {DataReader} reader the reader to use. - */ - parseZIP64ExtraField: function(reader) { - - if (!this.extraFields[0x0001]) { - return; - } - - // should be something, preparing the extra reader - var extraReader = readerFor(this.extraFields[0x0001].value); - - // I really hope that these 64bits integer can fit in 32 bits integer, because js - // won't let us have more. - if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { - this.uncompressedSize = extraReader.readInt(8); - } - if (this.compressedSize === utils.MAX_VALUE_32BITS) { - this.compressedSize = extraReader.readInt(8); - } - if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { - this.localHeaderOffset = extraReader.readInt(8); - } - if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { - this.diskNumberStart = extraReader.readInt(4); - } - }, - /** - * Read the central part of a zip file and add the info in this object. - * @param {DataReader} reader the reader to use. - */ - readExtraFields: function(reader) { - var end = reader.index + this.extraFieldsLength, - extraFieldId, - extraFieldLength, - extraFieldValue; - - if (!this.extraFields) { - this.extraFields = {}; - } - - while (reader.index + 4 < end) { - extraFieldId = reader.readInt(2); - extraFieldLength = reader.readInt(2); - extraFieldValue = reader.readData(extraFieldLength); - - this.extraFields[extraFieldId] = { - id: extraFieldId, - length: extraFieldLength, - value: extraFieldValue - }; - } - - reader.setIndex(end); - }, - /** - * Apply an UTF8 transformation if needed. - */ - handleUTF8: function() { - var decodeParamType = support.uint8array ? "uint8array" : "array"; - if (this.useUTF8()) { - this.fileNameStr = utf8.utf8decode(this.fileName); - this.fileCommentStr = utf8.utf8decode(this.fileComment); - } else { - var upath = this.findExtraFieldUnicodePath(); - if (upath !== null) { - this.fileNameStr = upath; - } else { - // ASCII text or unsupported code page - var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName); - this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray); - } - - var ucomment = this.findExtraFieldUnicodeComment(); - if (ucomment !== null) { - this.fileCommentStr = ucomment; - } else { - // ASCII text or unsupported code page - var commentByteArray = utils.transformTo(decodeParamType, this.fileComment); - this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray); - } - } - }, - - /** - * Find the unicode path declared in the extra field, if any. - * @return {String} the unicode path, null otherwise. - */ - findExtraFieldUnicodePath: function() { - var upathField = this.extraFields[0x7075]; - if (upathField) { - var extraReader = readerFor(upathField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the filename changed, this field is out of date. - if (crc32fn(this.fileName) !== extraReader.readInt(4)) { - return null; - } - - return utf8.utf8decode(extraReader.readData(upathField.length - 5)); - } - return null; - }, - - /** - * Find the unicode comment declared in the extra field, if any. - * @return {String} the unicode comment, null otherwise. - */ - findExtraFieldUnicodeComment: function() { - var ucommentField = this.extraFields[0x6375]; - if (ucommentField) { - var extraReader = readerFor(ucommentField.value); - - // wrong version - if (extraReader.readInt(1) !== 1) { - return null; - } - - // the crc of the comment changed, this field is out of date. - if (crc32fn(this.fileComment) !== extraReader.readInt(4)) { - return null; - } - - return utf8.utf8decode(extraReader.readData(ucommentField.length - 5)); - } - return null; - } -}; -module.exports = ZipEntry; - -},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(require,module,exports){ -'use strict'; - -var StreamHelper = require('./stream/StreamHelper'); -var DataWorker = require('./stream/DataWorker'); -var utf8 = require('./utf8'); -var CompressedObject = require('./compressedObject'); -var GenericWorker = require('./stream/GenericWorker'); - -/** - * A simple object representing a file in the zip file. - * @constructor - * @param {string} name the name of the file - * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data - * @param {Object} options the options of the file - */ -var ZipObject = function(name, data, options) { - this.name = name; - this.dir = options.dir; - this.date = options.date; - this.comment = options.comment; - this.unixPermissions = options.unixPermissions; - this.dosPermissions = options.dosPermissions; - - this._data = data; - this._dataBinary = options.binary; - // keep only the compression - this.options = { - compression : options.compression, - compressionOptions : options.compressionOptions - }; -}; - -ZipObject.prototype = { - /** - * Create an internal stream for the content of this object. - * @param {String} type the type of each chunk. - * @return StreamHelper the stream. - */ - internalStream: function (type) { - var result = null, outputType = "string"; - try { - if (!type) { - throw new Error("No output type specified."); - } - outputType = type.toLowerCase(); - var askUnicodeString = outputType === "string" || outputType === "text"; - if (outputType === "binarystring" || outputType === "text") { - outputType = "string"; - } - result = this._decompressWorker(); - - var isUnicodeString = !this._dataBinary; - - if (isUnicodeString && !askUnicodeString) { - result = result.pipe(new utf8.Utf8EncodeWorker()); - } - if (!isUnicodeString && askUnicodeString) { - result = result.pipe(new utf8.Utf8DecodeWorker()); - } - } catch (e) { - result = new GenericWorker("error"); - result.error(e); - } - - return new StreamHelper(result, outputType, ""); - }, - - /** - * Prepare the content in the asked type. - * @param {String} type the type of the result. - * @param {Function} onUpdate a function to call on each internal update. - * @return Promise the promise of the result. - */ - async: function (type, onUpdate) { - return this.internalStream(type).accumulate(onUpdate); - }, - - /** - * Prepare the content as a nodejs stream. - * @param {String} type the type of each chunk. - * @param {Function} onUpdate a function to call on each internal update. - * @return Stream the stream. - */ - nodeStream: function (type, onUpdate) { - return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate); - }, - - /** - * Return a worker for the compressed content. - * @private - * @param {Object} compression the compression object to use. - * @param {Object} compressionOptions the options to use when compressing. - * @return Worker the worker. - */ - _compressWorker: function (compression, compressionOptions) { - if ( - this._data instanceof CompressedObject && - this._data.compression.magic === compression.magic - ) { - return this._data.getCompressedWorker(); - } else { - var result = this._decompressWorker(); - if(!this._dataBinary) { - result = result.pipe(new utf8.Utf8EncodeWorker()); - } - return CompressedObject.createWorkerFrom(result, compression, compressionOptions); - } - }, - /** - * Return a worker for the decompressed content. - * @private - * @return Worker the worker. - */ - _decompressWorker : function () { - if (this._data instanceof CompressedObject) { - return this._data.getContentWorker(); - } else if (this._data instanceof GenericWorker) { - return this._data; - } else { - return new DataWorker(this._data); - } - } -}; - -var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"]; -var removedFn = function () { - throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); -}; - -for(var i = 0; i < removedMethods.length; i++) { - ZipObject.prototype[removedMethods[i]] = removedFn; -} -module.exports = ZipObject; - -},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(require,module,exports){ -(function (global){ -'use strict'; -var Mutation = global.MutationObserver || global.WebKitMutationObserver; - -var scheduleDrain; - -{ - if (Mutation) { - var called = 0; - var observer = new Mutation(nextTick); - var element = global.document.createTextNode(''); - observer.observe(element, { - characterData: true - }); - scheduleDrain = function () { - element.data = (called = ++called % 2); - }; - } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') { - var channel = new global.MessageChannel(); - channel.port1.onmessage = nextTick; - scheduleDrain = function () { - channel.port2.postMessage(0); - }; - } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) { - scheduleDrain = function () { - - // Create a - - - - - - - - - -
    - -
    -
    -
    -

    Module org.hsqldb.sqltool

    -
    -
    -
      -
    • -
        -
      • - - - - -

        Packages

        - - - - - - - - - - - - -
        Exports 
        PackageDescription
        org.hsqldb.cmdline -
        Contains the SqlTool command-line tool
        -
        -
      • -
      -
    • -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlFile.BadSpecial.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlFile.BadSpecial.html deleted file mode 100644 index 2b9d3d31..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlFile.BadSpecial.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - -SqlFile.BadSpecial (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - -

    Class SqlFile.BadSpecial

    -
    -
    -
      -
    • java.lang.Object
    • -
    • -
        -
      • java.lang.Throwable
      • -
      • -
          -
        • java.lang.Exception
        • -
        • -
            -
          • org.hsqldb.cmdline.libclone.AppendableException
          • -
          • -
              -
            • org.hsqldb.cmdline.SqlFile.BadSpecial
            • -
            -
          • -
          -
        • -
        -
      • -
      -
    • -
    -
    -
      -
    • -
      -
      All Implemented Interfaces:
      -
      java.io.Serializable
      -
      -
      -
      Enclosing class:
      -
      SqlFile
      -
      -
      -
      public static class SqlFile.BadSpecial
      -extends org.hsqldb.cmdline.libclone.AppendableException
      -
      Utility nested Exception class for internal use only. - - Do not instantiate with null message.
      -
      -
      See Also:
      -
      Serialized Form
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Field Summary

        -
          -
        • - - -

          Fields inherited from class org.hsqldb.cmdline.libclone.AppendableException

          -appendages, LS
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Summary

        -
          -
        • - - -

          Methods inherited from class org.hsqldb.cmdline.libclone.AppendableException

          -appendMessage, getMessage
        • -
        -
          -
        • - - -

          Methods inherited from class java.lang.Throwable

          -addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
        • -
        -
          -
        • - - -

          Methods inherited from class java.lang.Object

          -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlFile.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlFile.html deleted file mode 100644 index 6bac74ba..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlFile.html +++ /dev/null @@ -1,1289 +0,0 @@ - - - - - -SqlFile (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - -

    Class SqlFile

    -
    -
    -
      -
    • java.lang.Object
    • -
    • -
        -
      • org.hsqldb.cmdline.SqlFile
      • -
      -
    • -
    -
    -
      -
    • -
      -
      public class SqlFile
      -extends java.lang.Object
      -
      Encapsulation of SQL text and the environment under which it will be - executed with a JDBC Connection. - 'SqlInputStream' would be a more precise name, but the content we are - talking about here is what is colloqially known as the contents of - "SQL file"s. -

      - The file src/org/hsqldb/sample/SqlFileEmbedder.java - in the HSQLDB distribution provides an example for using SqlFile to - execute SQL files directly from your own Java classes. -

      - The complexities of passing userVars and macros maps are to facilitate - strong scoping (among blocks and nested scripts). -

      - Some implementation comments and variable names use keywords based - on the following definitions.

        -
      • COMMAND = Statement || SpecialCommand || BufferCommand -
      • Statement = SQL statement like "SQL Statement;" -
      • SpecialCommand = Special Command like "\x arg..." -
      • BufferCommand = Editing/buffer command like ":s/this/that/" -
      -

      - When entering SQL statements, you are always "appending" to the - "immediate" command (not the "buffer", which is a different thing). - All you can do to the immediate command is append new lines to it, - execute it, or save it to buffer. - When you are entering a buffer edit command like ":s/this/that/", - your immediate command is the buffer-edit-command. The buffer - is the command string that you are editing. - The buffer usually contains either an exact copy of the last command - executed or sent to buffer by entering a blank line, - but BUFFER commands can change the contents of the buffer. -

      - In general, the special commands mirror those of Postgresql's psql, - but SqlFile handles command editing very differently than Postgresql - does, in part because of Java's lack of support for raw tty I/O. - The \p special command, in particular, is very different from psql's. -

      - Buffer commands are unique to SQLFile. The ":" commands allow - you to edit the buffer and to execute the buffer. -

      - \d commands are very poorly supported for Mysql because - (a) Mysql lacks most of the most basic JDBC support elements, and - the most basic role and schema features, and - (b) to access the Mysql data dictionary, one must change the database - instance (to do that would require work to restore the original state - and could have disastrous effects upon transactions). -

      - The process*() methods, other than processBuffHist() ALWAYS execute - on "buffer", and expect it to contain the method specific prefix - (if any). -

      - The input/output Reader/Stream are generally managed by the caller. - An exception is that the input reader may be closed automatically or on - demand by the user, since in some cases this class builds the Reader. - There is no corresponding functionality for output since the user always - has control over that object (which may be null or System.out).

      -
      -
      Author:
      -
      Blaine Simpson (blaine dot simpson at admc dot com)
      -
      See Also:
      -
      - The SqlTool chapter of the - HyperSQL Utilities Guide
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Nested Class Summary

        - - - - - - - - - - - - -
        Nested Classes 
        Modifier and TypeClassDescription
        static class SqlFile.BadSpecial -
        Utility nested Exception class for internal use only.
        -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Field Summary

        - - - - - - - - - - - - -
        Fields 
        Modifier and TypeFieldDescription
        static java.lang.StringLS -
        Platform-specific line separator
        -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Constructor Summary

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Constructors 
        ConstructorDescription
        SqlFile​(java.io.File inputFile) -
        Convenience wrapper for the SqlFile(File, String) constructor
        -
        SqlFile​(java.io.File inputFile, - java.lang.String encoding) -
        Convenience wrapper for the SqlFile(File, String, boolean) constructor
        -
        SqlFile​(java.io.File inputFile, - java.lang.String encoding, - boolean interactive) -
        Constructor for non-interactive usage with a SQL file, using the - specified encoding and sending normal output to stdout.
        -
        SqlFile​(java.io.Reader reader, - java.lang.String inputStreamLabel, - java.io.PrintStream psStd, - java.lang.String encoding, - boolean interactive, - java.io.File atBaseFile) -
        Legacy constructor.
        -
        SqlFile​(java.io.Reader reader, - java.lang.String inputStreamLabel, - java.io.PrintStream psStd, - java.lang.String encoding, - boolean interactive, - java.net.URL atBase) -
        Instantiate a SqlFile instance for SQL input from 'reader'.
        -
        SqlFile​(java.lang.String encoding, - boolean interactive) -
        Constructor for interactive usage with stdin/stdout
        -
        SqlFile​(java.net.URL inputUrl) 
        SqlFile​(java.net.URL inputUrl, - java.lang.String encoding) 
        SqlFile​(java.net.URL inputUrl, - java.lang.String encoding, - boolean interactive) 
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Summary

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        All Methods Static Methods Instance Methods Concrete Methods 
        Modifier and TypeMethodDescription
        voidaddMacros​(java.util.Map<java.lang.String,​org.hsqldb.cmdline.sqltool.Token> newMacros) 
        voidaddUserVars​(java.util.Map<java.lang.String,​java.lang.String> newUserVars) 
        static byte[]bitCharsToBytes​(java.lang.String hexChars) -
        Just a stub for now.
        -
        static booleancanDisplayType​(int i) -
        This method is used to tell SqlFile whether this Sql Type must - ALWAYS be loaded to the binary buffer without displaying.
        -
        voidcloseReader() -
        Close the reader.
        -
        static java.lang.StringconvertEscapes​(java.lang.String inString) -
        Translates user-supplied escapes into the traditionaly - corresponding binary characters.
        -
        voiddsvSafe​(java.lang.String s) -
        Validate that String is safe to write TO DSV file.
        -
        static java.lang.StringescapeHtml​(java.lang.String s) -
        Escaping rules taken from 'Reserved Characters in HTML table at - http://www.w3schools.com/tags/ref_entities.asp
        -
        voidexecute() -
        Process all the commands from the file or Reader associated with - "this" object.
        -
        static java.lang.StringgetBanner​(java.sql.Connection c) -
        Returns a String report for the specified JDBC Connection.
        -
        java.sql.ConnectiongetConnection() 
        java.lang.StringgetCurrentSchema() 
        java.util.Map<java.lang.String,​org.hsqldb.cmdline.sqltool.Token>getMacros() 
        java.util.Map<java.lang.String,​java.lang.String>getUserVars() -
        Get a reference to the user variable map.
        -
        static byte[]hexCharOctetsToBytes​(java.lang.String hexChars) -
        Convert a String to a byte array by interpreting every 2 characters as an - octal byte value.
        -
        voidimportDsv​(java.net.URL fileUrl, - java.lang.String skipPrefix) -
        Name is self-explanatory.
        -
        static byte[]loadBinary​(java.io.File binFile) -
        Legacy function.
        -
        static byte[]loadBinary​(java.net.URL binUrl) -
        Binary file load
        -
        voidsetAutoClose​(boolean autoClose) -
        Specify whether the supplied or generated input Reader should - automatically be closed by the execute() method.
        -
        voidsetConnection​(java.sql.Connection jdbcConn) 
        voidsetContinueOnError​(boolean continueOnError) 
        voidsetMaxHistoryLength​(int maxHistoryLength) 
        static java.lang.StringsqlTypeToString​(int i) -
        Return a String representation of the specified java.sql.Types type.
        -
        static byte[]streamToBytes​(java.io.InputStream is) -
        As the name says...
        -
        java.lang.StringstreamToString​(java.io.InputStream is, - java.lang.String cs) -
        As the name says...
        -
        static java.lang.StringtoPaddedString​(java.lang.String source, - int length, - char pad, - boolean trailing) 
        -
          -
        • - - -

          Methods inherited from class java.lang.Object

          -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Field Detail

        - - - -
          -
        • -

          LS

          -
          public static final java.lang.String LS
          -
          Platform-specific line separator
          -
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Constructor Detail

        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.io.File inputFile)
          -        throws java.io.IOException
          -
          Convenience wrapper for the SqlFile(File, String) constructor
          -
          -
          Parameters:
          -
          inputFile - input file
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          See Also:
          -
          SqlFile(File, String)
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.net.URL inputUrl)
          -        throws java.io.IOException
          -
          -
          Throws:
          -
          java.io.IOException
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.io.File inputFile,
          -               java.lang.String encoding)
          -        throws java.io.IOException
          -
          Convenience wrapper for the SqlFile(File, String, boolean) constructor
          -
          -
          Parameters:
          -
          inputFile - the input File
          -
          encoding - is applied to both the given File and other files read - in or written out. Null will use your env+JVM settings.
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          See Also:
          -
          SqlFile(File, String, boolean)
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.net.URL inputUrl,
          -               java.lang.String encoding)
          -        throws java.io.IOException
          -
          -
          Throws:
          -
          java.io.IOException
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.io.File inputFile,
          -               java.lang.String encoding,
          -               boolean interactive)
          -        throws java.io.IOException
          -
          Constructor for non-interactive usage with a SQL file, using the - specified encoding and sending normal output to stdout.
          -
          -
          Parameters:
          -
          inputFile - the input File
          -
          encoding - is applied to the given File and other files - read in or written out. Null will use your env+JVM settings.
          -
          interactive - If true, prompts are printed, the interactive - Special commands are enabled, and - continueOnError defaults to true.
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          See Also:
          -
          SqlFile(Reader, String, PrintStream, String, boolean, File)
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.net.URL inputUrl,
          -               java.lang.String encoding,
          -               boolean interactive)
          -        throws java.io.IOException
          -
          -
          Throws:
          -
          java.io.IOException
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.lang.String encoding,
          -               boolean interactive)
          -        throws java.io.IOException
          -
          Constructor for interactive usage with stdin/stdout
          -
          -
          Parameters:
          -
          encoding - is applied to other files read in or written out (but - not to stdin or stdout). - Null will use your env+JVM settings.
          -
          interactive - If true, prompts are printed, the interactive - Special commands are enabled, and - continueOnError defaults to true.
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          See Also:
          -
          SqlFile(Reader, String, PrintStream, String, boolean, File)
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.io.Reader reader,
          -               java.lang.String inputStreamLabel,
          -               java.io.PrintStream psStd,
          -               java.lang.String encoding,
          -               boolean interactive,
          -               java.io.File atBaseFile)
          -        throws java.io.IOException
          -
          Legacy constructor. See following constructor for documentation.
          -
          -
          Throws:
          -
          java.io.IOException
          -
          -
        • -
        - - - -
          -
        • -

          SqlFile

          -
          public SqlFile​(java.io.Reader reader,
          -               java.lang.String inputStreamLabel,
          -               java.io.PrintStream psStd,
          -               java.lang.String encoding,
          -               boolean interactive,
          -               java.net.URL atBase)
          -        throws java.io.IOException
          -
          Instantiate a SqlFile instance for SQL input from 'reader'. - - After any needed customization, the SQL can be executed by the - execute method. -

          - Most Special Commands and many Buffer commands are only for - interactive use. -

          - This program never writes to an error stream (stderr or alternative). - All meta messages and error messages are written using the logging - facility. -

          -
          -
          Parameters:
          -
          reader - Source for the SQL to be executed. - Caller is responsible for setting up encoding. - (the 'encoding' parameter will NOT be applied - to this reader).
          -
          inputStreamLabel - the lable
          -
          psStd - PrintStream for normal output. - If null, normal output will be discarded. - Caller is responsible for settingup encoding - (the 'encoding' parameter will NOT be applied - to this stream).
          -
          encoding - the encoding
          -
          interactive - If true, prompts are printed, the interactive - Special commands are enabled, and - continueOnError defaults to true.
          -
          atBase - the base dir
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          See Also:
          -
          execute()
          -
          -
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Detail

        - - - -
          -
        • -

          setConnection

          -
          public void setConnection​(java.sql.Connection jdbcConn)
          -
        • -
        - - - -
          -
        • -

          getConnection

          -
          public java.sql.Connection getConnection()
          -
        • -
        - - - -
          -
        • -

          setContinueOnError

          -
          public void setContinueOnError​(boolean continueOnError)
          -
        • -
        - - - -
          -
        • -

          setMaxHistoryLength

          -
          public void setMaxHistoryLength​(int maxHistoryLength)
          -
        • -
        - - - -
          -
        • -

          addMacros

          -
          public void addMacros​(java.util.Map<java.lang.String,​org.hsqldb.cmdline.sqltool.Token> newMacros)
          -
        • -
        - - - -
          -
        • -

          addUserVars

          -
          public void addUserVars​(java.util.Map<java.lang.String,​java.lang.String> newUserVars)
          -
        • -
        - - - -
          -
        • -

          getUserVars

          -
          public java.util.Map<java.lang.String,​java.lang.String> getUserVars()
          -
          Get a reference to the user variable map. - - Since you are getting a reference to the private map used inside this - class, update this map with great caution and attention to lifecycle - handling of the variable map.
          -
          -
          Returns:
          -
          user variable map
          -
          -
        • -
        - - - -
          -
        • -

          getMacros

          -
          public java.util.Map<java.lang.String,​org.hsqldb.cmdline.sqltool.Token> getMacros()
          -
        • -
        - - - -
          -
        • -

          setAutoClose

          -
          public void setAutoClose​(boolean autoClose)
          -
          Specify whether the supplied or generated input Reader should - automatically be closed by the execute() method. -

          - execute() will close the Reader by default (i.e. 'autoClose' defaults - to true). - You may want to set this to false if you want to stop execution with - \q or similar, then continue using the Reader or underlying Stream. -

          - The caller is always responsible for closing the output object (if any) - used by SqlFile.

          -
          -
          Parameters:
          -
          autoClose - boolean
          -
          -
        • -
        - - - -
          -
        • -

          execute

          -
          public void execute()
          -             throws SqlToolError,
          -                    java.sql.SQLException
          -
          Process all the commands from the file or Reader associated with - "this" object. - SQL commands in the content get executed against the current JDBC - data source connection.
          -
          -
          Throws:
          -
          java.sql.SQLException - thrown by JDBC driver. - Only possible if in "\c false" mode.
          -
          SqlToolError - all other errors. - This includes QuitNow, BreakException, - ContinueException for recursive calls only.
          -
          -
        • -
        - - - -
          -
        • -

          closeReader

          -
          public void closeReader()
          -
          Close the reader. - - The execute method will run this automatically, by default.
          -
        • -
        - - - - - - - -
          -
        • -

          streamToString

          -
          public java.lang.String streamToString​(java.io.InputStream is,
          -                                       java.lang.String cs)
          -                                throws java.io.IOException
          -
          As the name says... - - This method always closes the input stream.
          -
          -
          Parameters:
          -
          is - InputStream
          -
          cs - String
          -
          Returns:
          -
          String
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          -
        • -
        - - - -
          -
        • -

          streamToBytes

          -
          public static byte[] streamToBytes​(java.io.InputStream is)
          -                            throws java.io.IOException
          -
          As the name says...
          -
          -
          Parameters:
          -
          is - input
          -
          Returns:
          -
          byte[]
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          -
        • -
        - - - -
          -
        • -

          loadBinary

          -
          public static byte[] loadBinary​(java.io.File binFile)
          -                         throws java.io.IOException
          -
          Legacy function. - See following function for documentation.
          -
          -
          Throws:
          -
          java.io.IOException
          -
          -
        • -
        - - - -
          -
        • -

          loadBinary

          -
          public static byte[] loadBinary​(java.net.URL binUrl)
          -                         throws java.io.IOException
          -
          Binary file load
          -
          -
          Parameters:
          -
          binUrl - url
          -
          Returns:
          -
          The bytes which are the content of the file
          -
          Throws:
          -
          java.io.IOException - on read errors
          -
          -
        • -
        - - - -
          -
        • -

          canDisplayType

          -
          public static boolean canDisplayType​(int i)
          -
          This method is used to tell SqlFile whether this Sql Type must - ALWAYS be loaded to the binary buffer without displaying. -

          - N.b.: If this returns "true" for a type, then the user can never - "see" values for these columns. - Therefore, if a type may-or-may-not-be displayable, better to return - false here and let the user choose. - In general, if there is a toString() operator for this Sql Type - then return false, since the JDBC driver should know how to make the - value displayable. -

          -
          -
          Parameters:
          -
          i - JDBC type number
          -
          Returns:
          -
          boolean
          -
          See Also:
          -
          http://java.sun.com/docs/books/tutorial/jdbc/basics/retrieving.html - The table on this page lists the most common SqlTypes, all of which - must implement toString(), -Types
          -
          -
        • -
        - - - -
          -
        • -

          sqlTypeToString

          -
          public static java.lang.String sqlTypeToString​(int i)
          -
          Return a String representation of the specified java.sql.Types type.
          -
          -
          Parameters:
          -
          i - int
          -
          Returns:
          -
          String
          -
          -
        • -
        - - - -
          -
        • -

          dsvSafe

          -
          public void dsvSafe​(java.lang.String s)
          -             throws SqlToolError
          -
          Validate that String is safe to write TO DSV file.
          -
          -
          Parameters:
          -
          s - String
          -
          Throws:
          -
          SqlToolError - if validation fails.
          -
          -
        • -
        - - - -
          -
        • -

          convertEscapes

          -
          public static java.lang.String convertEscapes​(java.lang.String inString)
          -
          Translates user-supplied escapes into the traditionaly - corresponding binary characters. - - Allowed sequences: -
            -
          • \0\d+ (an octal digit) -
          • \[0-9]\d* (a decimal digit) -
          • \[Xx][0-9]{2} (a hex digit) -
          • \n Newline (Ctrl-J) -
          • \r Carriage return (Ctrl-M) -
          • \t Horizontal tab (Ctrl-I) -
          • \f Form feed (Ctrl-L) -
          - - Java 1.4 String methods will make this into a 1 or 2 line task.
          -
          -
          Parameters:
          -
          inString - input string
          -
          Returns:
          -
          converted string
          -
          -
        • -
        - - - -
          -
        • -

          importDsv

          -
          public void importDsv​(java.net.URL fileUrl,
          -                      java.lang.String skipPrefix)
          -               throws SqlToolError
          -
          Name is self-explanatory.
          -
          -
          Parameters:
          -
          fileUrl - String
          -
          skipPrefix - String
          -
          Throws:
          -
          SqlToolError - Would prefer to throw an internal exception, - but we want this method to have external - visibility.
          -
          -
        • -
        - - - -
          -
        • -

          hexCharOctetsToBytes

          -
          public static byte[] hexCharOctetsToBytes​(java.lang.String hexChars)
          -
          Convert a String to a byte array by interpreting every 2 characters as an - octal byte value.
          -
          -
          Parameters:
          -
          hexChars - String
          -
          Returns:
          -
          byte[]
          -
          -
        • -
        - - - -
          -
        • -

          bitCharsToBytes

          -
          public static byte[] bitCharsToBytes​(java.lang.String hexChars)
          -
          Just a stub for now.
          -
          -
          Parameters:
          -
          hexChars - String
          -
          Returns:
          -
          byte[]
          -
          -
        • -
        - - - -
          -
        • -

          getBanner

          -
          public static java.lang.String getBanner​(java.sql.Connection c)
          -
          Returns a String report for the specified JDBC Connection. For databases - with poor JDBC support, you won't get much detail.
          -
          -
          Parameters:
          -
          c - Connection
          -
          Returns:
          -
          String
          -
          -
        • -
        - - - -
          -
        • -

          escapeHtml

          -
          public static java.lang.String escapeHtml​(java.lang.String s)
          -
          Escaping rules taken from 'Reserved Characters in HTML table at - http://www.w3schools.com/tags/ref_entities.asp
          -
          -
          Parameters:
          -
          s - String
          -
          Returns:
          -
          String
          -
          -
        • -
        - - - -
          -
        • -

          toPaddedString

          -
          public static java.lang.String toPaddedString​(java.lang.String source,
          -                                              int length,
          -                                              char pad,
          -                                              boolean trailing)
          -
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - - - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlTool.SqlToolException.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlTool.SqlToolException.html deleted file mode 100644 index 71a8809b..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlTool.SqlToolException.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - - -SqlTool.SqlToolException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - -

    Class SqlTool.SqlToolException

    -
    -
    -
      -
    • java.lang.Object
    • -
    • -
        -
      • java.lang.Throwable
      • -
      • -
          -
        • java.lang.Exception
        • -
        • -
            -
          • org.hsqldb.cmdline.SqlTool.SqlToolException
          • -
          -
        • -
        -
      • -
      -
    • -
    -
    -
      -
    • -
      -
      All Implemented Interfaces:
      -
      java.io.Serializable
      -
      -
      -
      Enclosing class:
      -
      SqlTool
      -
      -
      -
      public static class SqlTool.SqlToolException
      -extends java.lang.Exception
      -
      -
      See Also:
      -
      Serialized Form
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Method Summary

        -
          -
        • - - -

          Methods inherited from class java.lang.Throwable

          -addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
        • -
        -
          -
        • - - -

          Methods inherited from class java.lang.Object

          -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlTool.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlTool.html deleted file mode 100644 index edeefc54..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlTool.html +++ /dev/null @@ -1,606 +0,0 @@ - - - - - -SqlTool (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - -

    Class SqlTool

    -
    -
    -
      -
    • java.lang.Object
    • -
    • -
        -
      • org.hsqldb.cmdline.SqlTool
      • -
      -
    • -
    -
    -
      -
    • -
      -
      public class SqlTool
      -extends java.lang.Object
      -
      A command-line JDBC SQL tool supporting both interactive and - non-interactive usage. -

      - See JavaDocs for the main method for syntax of how to run from the - command-line. -

      - Programmatic users will usually want to use the objectMain(String[]) method - if they want arguments and behavior exactly like command-line SqlTool. - But in many cases, you will have better control and efficiency by using - the SqlFile class directly. The file - src/org/hsqldb/sample/SqlFileEmbedder.java - in the HSQLDB distribution provides an example for this latter strategy.

      -
      -
      Author:
      -
      Blaine Simpson (blaine dot simpson at admc dot com)
      -
      See Also:
      -
      - The SqlTool chapter of the - HyperSQL Utilities Guide, -main(String[]), -objectMain(String[]), -SqlFile
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Nested Class Summary

        - - - - - - - - - - - - -
        Nested Classes 
        Modifier and TypeClassDescription
        static class SqlTool.SqlToolException 
        -
      • -
      -
      - -
      - -
      - -
      -
        -
      • - - -

        Constructor Summary

        - - - - - - - - - - -
        Constructors 
        ConstructorDescription
        SqlTool() 
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Summary

        - - - - - - - - - - - - - - - - - -
        All Methods Static Methods Concrete Methods 
        Modifier and TypeMethodDescription
        static voidmain​(java.lang.String[] args) -
        A static wrapper for objectMain, so that that method may be executed - as a Java "program".
        -
        static voidobjectMain​(java.lang.String[] arg) -
        Connect to a JDBC Database and execute the commands given on - stdin or in SQL file(s).
        -
        -
          -
        • - - -

          Methods inherited from class java.lang.Object

          -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Field Detail

        - - - -
          -
        • -

          DEFAULT_RCFILE

          -
          public static final java.lang.String DEFAULT_RCFILE
          -
        • -
        - - - -
          -
        • -

          SQLTOOLERR_EXITVAL

          -
          public static final int SQLTOOLERR_EXITVAL
          -
          -
          See Also:
          -
          Constant Field Values
          -
          -
        • -
        - - - -
          -
        • -

          SYNTAXERR_EXITVAL

          -
          public static final int SYNTAXERR_EXITVAL
          -
          -
          See Also:
          -
          Constant Field Values
          -
          -
        • -
        - - - - - - - - - - - - - - - - - - - -
          -
        • -

          INPUTERR_EXITVAL

          -
          public static final int INPUTERR_EXITVAL
          -
          -
          See Also:
          -
          Constant Field Values
          -
          -
        • -
        - - - -
          -
        • -

          CONNECTERR_EXITVAL

          -
          public static final int CONNECTERR_EXITVAL
          -
          -
          See Also:
          -
          Constant Field Values
          -
          -
        • -
        - - - -
          -
        • -

          LS

          -
          public static final java.lang.String LS
          -
          Platform-specific line separator
          -
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Constructor Detail

        - - - -
          -
        • -

          SqlTool

          -
          public SqlTool()
          -
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Detail

        - - - -
          -
        • -

          main

          -
          public static void main​(java.lang.String[] args)
          -
          A static wrapper for objectMain, so that that method may be executed - as a Java "program". -

          - Throws only RuntimeExceptions or Errors, because this method is intended - to System.exit() for all but disastrous system problems, for which - the inconvenience of a stack trace would be the least of your worries. -

          - If you don't want SqlTool to System.exit(), then use the method - objectMain() instead of this method.

          -
          -
          Parameters:
          -
          args - arguments
          -
          See Also:
          -
          objectMain(String[])
          -
          -
        • -
        - - - -
          -
        • -

          objectMain

          -
          public static void objectMain​(java.lang.String[] arg)
          -                       throws SqlTool.SqlToolException
          -
          Connect to a JDBC Database and execute the commands given on - stdin or in SQL file(s). -

          - This method is changed for HSQLDB 1.8.0.8 and later to never - System.exit(). - Developers may catch Throwables to handle all fatal situations.

          -
          -
          Parameters:
          -
          arg - Run "java... org.hsqldb.cmdline.SqlTool --help" for syntax.
          -
          Throws:
          -
          SqlTool.SqlToolException - Upon any fatal error, with useful - reason as the exception's message.
          -
          -
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - - - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlToolError.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlToolError.html deleted file mode 100644 index 7001ccca..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlToolError.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - -SqlToolError (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - -

    Class SqlToolError

    -
    -
    -
      -
    • java.lang.Object
    • -
    • -
        -
      • java.lang.Throwable
      • -
      • -
          -
        • java.lang.Exception
        • -
        • -
            -
          • org.hsqldb.cmdline.libclone.AppendableException
          • -
          • -
              -
            • org.hsqldb.cmdline.SqlToolError
            • -
            -
          • -
          -
        • -
        -
      • -
      -
    • -
    -
    -
      -
    • -
      -
      All Implemented Interfaces:
      -
      java.io.Serializable
      -
      -
      -
      public class SqlToolError
      -extends org.hsqldb.cmdline.libclone.AppendableException
      -
      Exceptions thrown by the SqlTool system externally to SqlFile. - (As opposed to the nested Exceptions within those classes). - This class is misnamed, because it is not only errors. - When there is time, this file and class should be renamed. -

      - This class has a misleading name and should really be renamed. - It is Java Exception, not a Java Error. -

      -
      -
      See Also:
      -
      Serialized Form
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Field Summary

        -
          -
        • - - -

          Fields inherited from class org.hsqldb.cmdline.libclone.AppendableException

          -appendages, LS
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Constructor Summary

        - - - - - - - - - - - - - - - - - - - - - - -
        Constructors 
        ConstructorDescription
        SqlToolError() 
        SqlToolError​(java.lang.String s) 
        SqlToolError​(java.lang.String string, - java.lang.Throwable cause) 
        SqlToolError​(java.lang.Throwable cause) 
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Summary

        -
          -
        • - - -

          Methods inherited from class org.hsqldb.cmdline.libclone.AppendableException

          -appendMessage, getMessage
        • -
        -
          -
        • - - -

          Methods inherited from class java.lang.Throwable

          -addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
        • -
        -
          -
        • - - -

          Methods inherited from class java.lang.Object

          -equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Constructor Detail

        - - - -
          -
        • -

          SqlToolError

          -
          public SqlToolError​(java.lang.Throwable cause)
          -
        • -
        - - - -
          -
        • -

          SqlToolError

          -
          public SqlToolError()
          -
        • -
        - - - -
          -
        • -

          SqlToolError

          -
          public SqlToolError​(java.lang.String s)
          -
        • -
        - - - -
          -
        • -

          SqlToolError

          -
          public SqlToolError​(java.lang.String string,
          -                    java.lang.Throwable cause)
          -
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlToolSprayer.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlToolSprayer.html deleted file mode 100644 index 84377679..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqlToolSprayer.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - -SqlToolSprayer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - -

    Class SqlToolSprayer

    -
    -
    -
      -
    • java.lang.Object
    • -
    • -
        -
      • org.hsqldb.cmdline.SqlToolSprayer
      • -
      -
    • -
    -
    -
      -
    • -
      -
      public class SqlToolSprayer
      -extends java.lang.Object
      -
      Sql Tool Sprayer. - Invokes SqlTool.objectMain() multiple times with the same SQL. - Invokes for multiple urlids and/or retries. - - See JavaDocs for the main method for syntax of how to run. - - System properties used if set: -
        -
      • sqltoolsprayer.period (in ms.)
      • -
      • sqltoolsprayer.maxtime (in ms.)
      • -
      • sqltoolsprayer.rcfile (filepath)
      • -
      -
      -
      Author:
      -
      Blaine Simpson (blaine dot simpson at admc dot com)
      -
      See Also:
      -
      main(String[])
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Field Summary

        - - - - - - - - - - - - -
        Fields 
        Modifier and TypeFieldDescription
        static java.lang.StringLS 
        -
      • -
      -
      - -
      -
        -
      • - - -

        Constructor Summary

        - - - - - - - - - - -
        Constructors 
        ConstructorDescription
        SqlToolSprayer() 
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Summary

        - - - - - - - - - - - - -
        All Methods Static Methods Concrete Methods 
        Modifier and TypeMethodDescription
        static voidmain​(java.lang.String[] sa) 
        -
          -
        • - - -

          Methods inherited from class java.lang.Object

          -equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Field Detail

        - - - -
          -
        • -

          LS

          -
          public static final java.lang.String LS
          -
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Constructor Detail

        - - - -
          -
        • -

          SqlToolSprayer

          -
          public SqlToolSprayer()
          -
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Detail

        - - - -
          -
        • -

          main

          -
          public static void main​(java.lang.String[] sa)
          -
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - - - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqltoolRB.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqltoolRB.html deleted file mode 100644 index d1882bf9..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/SqltoolRB.html +++ /dev/null @@ -1,3519 +0,0 @@ - - - - - -SqltoolRB (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - -

    Enum SqltoolRB

    -
    -
    -
      -
    • java.lang.Object
    • -
    • -
        -
      • java.lang.Enum<SqltoolRB>
      • -
      • -
          -
        • org.hsqldb.cmdline.SqltoolRB
        • -
        -
      • -
      -
    • -
    -
    -
      -
    • -
      -
      All Implemented Interfaces:
      -
      java.io.Serializable, java.lang.Comparable<SqltoolRB>, org.hsqldb.cmdline.libclone.RefCapableRBInterface
      -
      -
      -
      public enum SqltoolRB
      -extends java.lang.Enum<SqltoolRB>
      -implements org.hsqldb.cmdline.libclone.RefCapableRBInterface
      -
      Resource Bundle for SqlTool and associated classes. - - Purpose of this class is to wrap a RefCapablePropertyResourceBundle to - reliably detect any possible use of a missing property key as soon as - this class is clinitted. - The reason for this is to allow us developers to detect all such errors - before end-users ever use this class.
      -
    • -
    -
    -
    - -
    -
    -
      -
    • - -
      -
        -
      • - - -

        Enum Constant Detail

        - - - -
          -
        • -

          SqlTool_syntax

          -
          public static final SqltoolRB SqlTool_syntax
          -
        • -
        - - - -
          -
        • -

          passwordFor_prompt

          -
          public static final SqltoolRB passwordFor_prompt
          -
        • -
        - - - -
          -
        • -

          SqlTool_varset_badformat

          -
          public static final SqltoolRB SqlTool_varset_badformat
          -
        • -
        - - - -
          -
        • -

          SqlTool_abort_continue_mutuallyexclusive

          -
          public static final SqltoolRB SqlTool_abort_continue_mutuallyexclusive
          -
        • -
        - - - -
          -
        • -

          sqltempfile_fail

          -
          public static final SqltoolRB sqltempfile_fail
          -
        • -
        - - - -
          -
        • -

          rcdata_inlineurl_missing

          -
          public static final SqltoolRB rcdata_inlineurl_missing
          -
        • -
        - - - -
          -
        • -

          rcdata_inline_extravars

          -
          public static final SqltoolRB rcdata_inline_extravars
          -
        • -
        - - - -
          -
        • -

          rcdata_driver_conflict

          -
          public static final SqltoolRB rcdata_driver_conflict
          -
        • -
        - - - -
          -
        • -

          rcdata_password_visible

          -
          public static final SqltoolRB rcdata_password_visible
          -
        • -
        - - - -
          -
        • -

          password_readfail

          -
          public static final SqltoolRB password_readfail
          -
        • -
        - - - -
          -
        • -

          connection_fail

          -
          public static final SqltoolRB connection_fail
          -
        • -
        - - - -
          -
        • -

          rcdata_genfromvalues_fail

          -
          public static final SqltoolRB rcdata_genfromvalues_fail
          -
        • -
        - - - -
          -
        • -

          conndata_retrieval_fail

          -
          public static final SqltoolRB conndata_retrieval_fail
          -
        • -
        - - - -
          -
        • -

          jdbc_established

          -
          public static final SqltoolRB jdbc_established
          -
        • -
        - - - -
          -
        • -

          SqlTool_params_redundant

          -
          public static final SqltoolRB SqlTool_params_redundant
          -
        • -
        - - - -
          -
        • -

          SqlFile_banner

          -
          public static final SqltoolRB SqlFile_banner
          -
        • -
        - - - -
          -
        • -

          buffer_help

          -
          public static final SqltoolRB buffer_help
          -
        • -
        - - - -
          -
        • -

          special_help

          -
          public static final SqltoolRB special_help
          -
        • -
        - - - -
          -
        • -

          pl_help

          -
          public static final SqltoolRB pl_help
          -
        • -
        - - - -
          -
        • -

          pl_control

          -
          public static final SqltoolRB pl_control
          -
        • -
        - - - -
          -
        • -

          pl_assign

          -
          public static final SqltoolRB pl_assign
          -
        • -
        - - - -
          -
        • -

          dsv_options

          -
          public static final SqltoolRB dsv_options
          -
        • -
        - - - -
          -
        • -

          d_options

          -
          public static final SqltoolRB d_options
          -
        • -
        - - - -
          -
        • -

          raw_leadin

          -
          public static final SqltoolRB raw_leadin
          -
        • -
        - - - -
          -
        • -

          errorat

          -
          public static final SqltoolRB errorat
          -
        • -
        - - - -
          -
        • -

          rejectreport_top

          -
          public static final SqltoolRB rejectreport_top
          -
        • -
        - - - -
          -
        • -

          rejectreport_row

          -
          public static final SqltoolRB rejectreport_row
          -
        • -
        - - - -
          -
        • -

          rejectreport_bottom

          -
          public static final SqltoolRB rejectreport_bottom
          -
        • -
        - - - -
          -
        • -

          macro_help

          -
          public static final SqltoolRB macro_help
          -
        • -
        - - - -
          -
        • -

          rawmode_prompt

          -
          public static final SqltoolRB rawmode_prompt
          -
        • -
        - - - -
          -
        • -

          raw_movedtobuffer

          -
          public static final SqltoolRB raw_movedtobuffer
          -
        • -
        - - - -
          -
        • -

          input_movedtobuffer

          -
          public static final SqltoolRB input_movedtobuffer
          -
        • -
        - - - -
          -
        • -

          sqlstatement_empty

          -
          public static final SqltoolRB sqlstatement_empty
          -
        • -
        - - - -
          -
        • -

          causereport

          -
          public static final SqltoolRB causereport
          -
        • -
        - - - -
          -
        • -

          break_unsatisfied

          -
          public static final SqltoolRB break_unsatisfied
          -
        • -
        - - - -
          -
        • -

          continue_unsatisfied

          -
          public static final SqltoolRB continue_unsatisfied
          -
        • -
        - - - -
          -
        • -

          primaryinput_accessfail

          -
          public static final SqltoolRB primaryinput_accessfail
          -
        • -
        - - - -
          -
        • -

          input_unterminated

          -
          public static final SqltoolRB input_unterminated
          -
        • -
        - - - -
          -
        • -

          plvar_set_incomplete

          -
          public static final SqltoolRB plvar_set_incomplete
          -
        • -
        - - - -
          -
        • -

          aborting

          -
          public static final SqltoolRB aborting
          -
        • -
        - - - -
          -
        • -

          rollingback

          -
          public static final SqltoolRB rollingback
          -
        • -
        - - - -
          -
        • -

          special_unspecified

          -
          public static final SqltoolRB special_unspecified
          -
        • -
        - - - -
          -
        • -

          bufhist_unspecified

          -
          public static final SqltoolRB bufhist_unspecified
          -
        • -
        - - - -
          -
        • -

          buffer_executing

          -
          public static final SqltoolRB buffer_executing
          -
        • -
        - - - -
          -
        • -

          nobuffer_yet

          -
          public static final SqltoolRB nobuffer_yet
          -
        • -
        - - - -
          -
        • -

          commandnum_malformat

          -
          public static final SqltoolRB commandnum_malformat
          -
        • -
        - - - -
          -
        • -

          buffer_restored

          -
          public static final SqltoolRB buffer_restored
          -
        • -
        - - - -
          -
        • -

          substitution_malformat

          -
          public static final SqltoolRB substitution_malformat
          -
        • -
        - - - -
          -
        • -

          substitution_nomatch

          -
          public static final SqltoolRB substitution_nomatch
          -
        • -
        - - - -
          -
        • -

          substitution_syntax

          -
          public static final SqltoolRB substitution_syntax
          -
        • -
        - - - -
          -
        • -

          buffer_unknown

          -
          public static final SqltoolRB buffer_unknown
          -
        • -
        - - - -
          -
        • -

          special_extrachars

          -
          public static final SqltoolRB special_extrachars
          -
        • -
        - - - -
          -
        • -

          buffer_extrachars

          -
          public static final SqltoolRB buffer_extrachars
          -
        • -
        - - - -
          -
        • -

          special_malformat

          -
          public static final SqltoolRB special_malformat
          -
        • -
        - - - -
          -
        • -

          html_mode

          -
          public static final SqltoolRB html_mode
          -
        • -
        - - - -
          -
        • -

          dsv_targetfile_demand

          -
          public static final SqltoolRB dsv_targetfile_demand
          -
        • -
        - - - -
          -
        • -

          file_wrotechars

          -
          public static final SqltoolRB file_wrotechars
          -
        • -
        - - - -
          -
        • -

          file_writefail

          -
          public static final SqltoolRB file_writefail
          -
        • -
        - - - -
          -
        • -

          special_d_like

          -
          public static final SqltoolRB special_d_like
          -
        • -
        - - - -
          -
        • -

          outputfile_nonetoclose

          -
          public static final SqltoolRB outputfile_nonetoclose
          -
        • -
        - - - -
          -
        • -

          outputfile_reopening

          -
          public static final SqltoolRB outputfile_reopening
          -
        • -
        - - - -
          -
        • -

          outputfile_header

          -
          public static final SqltoolRB outputfile_header
          -
        • -
        - - - -
          -
        • -

          destfile_demand

          -
          public static final SqltoolRB destfile_demand
          -
        • -
        - - - -
          -
        • -

          buffer_empty

          -
          public static final SqltoolRB buffer_empty
          -
        • -
        - - - -
          -
        • -

          file_appendfail

          -
          public static final SqltoolRB file_appendfail
          -
        • -
        - - - -
          -
        • -

          sqlfile_name_demand

          -
          public static final SqltoolRB sqlfile_name_demand
          -
        • -
        - - - -
          -
        • -

          sqlfile_execute_fail

          -
          public static final SqltoolRB sqlfile_execute_fail
          -
        • -
        - - - -
          -
        • -

          a_setting

          -
          public static final SqltoolRB a_setting
          -
        • -
        - - - -
          -
        • -

          committed

          -
          public static final SqltoolRB committed
          -
        • -
        - - - -
          -
        • -

          special_b_malformat

          -
          public static final SqltoolRB special_b_malformat
          -
        • -
        - - - -
          -
        • -

          binary_loadedbytesinto

          -
          public static final SqltoolRB binary_loadedbytesinto
          -
        • -
        - - - -
          -
        • -

          binary_filefail

          -
          public static final SqltoolRB binary_filefail
          -
        • -
        - - - -
          -
        • -

          c_setting

          -
          public static final SqltoolRB c_setting
          -
        • -
        - - - -
          -
        • -

          bang_incomplete

          -
          public static final SqltoolRB bang_incomplete
          -
        • -
        - - - -
          -
        • -

          bang_command_fail

          -
          public static final SqltoolRB bang_command_fail
          -
        • -
        - - - -
          -
        • -

          special_unknown

          -
          public static final SqltoolRB special_unknown
          -
        • -
        - - - -
          -
        • -

          dsv_m_syntax

          -
          public static final SqltoolRB dsv_m_syntax
          -
        • -
        - - - -
          -
        • -

          dsv_x_syntax

          -
          public static final SqltoolRB dsv_x_syntax
          -
        • -
        - - - -
          -
        • -

          raw_empty

          -
          public static final SqltoolRB raw_empty
          -
        • -
        - - - -
          -
        • -

          dsv_nocolsleft

          -
          public static final SqltoolRB dsv_nocolsleft
          -
        • -
        - - - -
          -
        • -

          dsv_skipcols_missing

          -
          public static final SqltoolRB dsv_skipcols_missing
          -
        • -
        - - - -
          -
        • -

          plalias_malformat

          -
          public static final SqltoolRB plalias_malformat
          -
        • -
        - - - -
          -
        • -

          plvar_undefined

          -
          public static final SqltoolRB plvar_undefined
          -
        • -
        - - - -
          -
        • -

          sysprop_empty

          -
          public static final SqltoolRB sysprop_empty
          -
        • -
        - - - -
          -
        • -

          sysprop_unterminated

          -
          public static final SqltoolRB sysprop_unterminated
          -
        • -
        - - - -
          -
        • -

          sysprop_undefined

          -
          public static final SqltoolRB sysprop_undefined
          -
        • -
        - - - -
          -
        • -

          var_infinite

          -
          public static final SqltoolRB var_infinite
          -
        • -
        - - - -
          -
        • -

          plvar_nameempty

          -
          public static final SqltoolRB plvar_nameempty
          -
        • -
        - - - -
          -
        • -

          plvar_unterminated

          -
          public static final SqltoolRB plvar_unterminated
          -
        • -
        - - - -
          -
        • -

          pl_malformat

          -
          public static final SqltoolRB pl_malformat
          -
        • -
        - - - -
          -
        • -

          deprecated_noop

          -
          public static final SqltoolRB deprecated_noop
          -
        • -
        - - - -
          -
        • -

          end_noblock

          -
          public static final SqltoolRB end_noblock
          -
        • -
        - - - -
          -
        • -

          continue_syntax

          -
          public static final SqltoolRB continue_syntax
          -
        • -
        - - - -
          -
        • -

          break_syntax

          -
          public static final SqltoolRB break_syntax
          -
        • -
        - - - -
          -
        • -

          pl_list_parens

          -
          public static final SqltoolRB pl_list_parens
          -
        • -
        - - - -
          -
        • -

          pl_list_lengths

          -
          public static final SqltoolRB pl_list_lengths
          -
        • -
        - - - -
          -
        • -

          dumpload_malformat

          -
          public static final SqltoolRB dumpload_malformat
          -
        • -
        - - - -
          -
        • -

          plvar_nocolon

          -
          public static final SqltoolRB plvar_nocolon
          -
        • -
        - - - -
          -
        • -

          plvar_tildedash_nomoreargs

          -
          public static final SqltoolRB plvar_tildedash_nomoreargs
          -
        • -
        - - - -
          -
        • -

          dumpload_fail

          -
          public static final SqltoolRB dumpload_fail
          -
        • -
        - - - -
          -
        • -

          pl_malformat_specific

          -
          public static final SqltoolRB pl_malformat_specific
          -
        • -
        - - - -
          -
        • -

          pl_block_fail

          -
          public static final SqltoolRB pl_block_fail
          -
        • -
        - - - -
          -
        • -

          ifwhile_malformat

          -
          public static final SqltoolRB ifwhile_malformat
          -
        • -
        - - - -
          -
        • -

          pl_unknown

          -
          public static final SqltoolRB pl_unknown
          -
        • -
        - - - -
          -
        • -

          pl_block_unterminated

          -
          public static final SqltoolRB pl_block_unterminated
          -
        • -
        - - - -
          -
        • -

          vendor_oracle_dS

          -
          public static final SqltoolRB vendor_oracle_dS
          -
        • -
        - - - -
          -
        • -

          vendor_derby_dr

          -
          public static final SqltoolRB vendor_derby_dr
          -
        • -
        - - - -
          -
        • -

          vendor_nosup_d

          -
          public static final SqltoolRB vendor_nosup_d
          -
        • -
        - - - -
          -
        • -

          vendor_derby_du

          -
          public static final SqltoolRB vendor_derby_du
          -
        • -
        - - - -
          -
        • -

          special_d_unknown

          -
          public static final SqltoolRB special_d_unknown
          -
        • -
        - - - -
          -
        • -

          metadata_fetch_fail

          -
          public static final SqltoolRB metadata_fetch_fail
          -
        • -
        - - - -
          -
        • -

          metadata_fetch_failfor

          -
          public static final SqltoolRB metadata_fetch_failfor
          -
        • -
        - - - -
          -
        • -

          prepare_demandqm

          -
          public static final SqltoolRB prepare_demandqm
          -
        • -
        - - - -
          -
        • -

          binbuffer_empty

          -
          public static final SqltoolRB binbuffer_empty
          -
        • -
        - - - -
          -
        • -

          vendor_nosup_sysschemas

          -
          public static final SqltoolRB vendor_nosup_sysschemas
          -
        • -
        - - - -
          -
        • -

          noresult

          -
          public static final SqltoolRB noresult
          -
        • -
        - - - -
          -
        • -

          dsv_bincol

          -
          public static final SqltoolRB dsv_bincol
          -
        • -
        - - - -
          -
        • -

          binbuf_write

          -
          public static final SqltoolRB binbuf_write
          -
        • -
        - - - -
          -
        • -

          rows_fetched

          -
          public static final SqltoolRB rows_fetched
          -
        • -
        - - - -
          -
        • -

          rows_fetched_dsv

          -
          public static final SqltoolRB rows_fetched_dsv
          -
        • -
        - - - -
          -
        • -

          row_update_singular

          -
          public static final SqltoolRB row_update_singular
          -
        • -
        - - - -
          -
        • -

          row_update_multiple

          -
          public static final SqltoolRB row_update_multiple
          -
        • -
        - - - -
          -
        • -

          history_unavailable

          -
          public static final SqltoolRB history_unavailable
          -
        • -
        - - - -
          -
        • -

          history_none

          -
          public static final SqltoolRB history_none
          -
        • -
        - - - -
          -
        • -

          editbuffer_contents

          -
          public static final SqltoolRB editbuffer_contents
          -
        • -
        - - - -
          -
        • -

          buffer_instructions

          -
          public static final SqltoolRB buffer_instructions
          -
        • -
        - - - -
          -
        • -

          history_number_req

          -
          public static final SqltoolRB history_number_req
          -
        • -
        - - - -
          -
        • -

          history_backto

          -
          public static final SqltoolRB history_backto
          -
        • -
        - - - -
          -
        • -

          history_upto

          -
          public static final SqltoolRB history_upto
          -
        • -
        - - - -
          -
        • -

          history_back

          -
          public static final SqltoolRB history_back
          -
        • -
        - - - -
          -
        • -

          describe_table_name

          -
          public static final SqltoolRB describe_table_name
          -
        • -
        - - - -
          -
        • -

          describe_table_datatype

          -
          public static final SqltoolRB describe_table_datatype
          -
        • -
        - - - -
          -
        • -

          describe_table_width

          -
          public static final SqltoolRB describe_table_width
          -
        • -
        - - - -
          -
        • -

          describe_table_nonulls

          -
          public static final SqltoolRB describe_table_nonulls
          -
        • -
        - - - -
          -
        • -

          describe_table_precision

          -
          public static final SqltoolRB describe_table_precision
          -
        • -
        - - - -
          -
        • -

          describe_table_scale

          -
          public static final SqltoolRB describe_table_scale
          -
        • -
        - - - -
          -
        • -

          logical_unrecognized

          -
          public static final SqltoolRB logical_unrecognized
          -
        • -
        - - - -
          -
        • -

          read_toobig

          -
          public static final SqltoolRB read_toobig
          -
        • -
        - - - -
          -
        • -

          read_partial

          -
          public static final SqltoolRB read_partial
          -
        • -
        - - - -
          -
        • -

          read_convertfail

          -
          public static final SqltoolRB read_convertfail
          -
        • -
        - - - -
          -
        • -

          dsv_coldelim_present

          -
          public static final SqltoolRB dsv_coldelim_present
          -
        • -
        - - - -
          -
        • -

          dsv_rowdelim_present

          -
          public static final SqltoolRB dsv_rowdelim_present
          -
        • -
        - - - -
          -
        • -

          dsv_nullrep_present

          -
          public static final SqltoolRB dsv_nullrep_present
          -
        • -
        - - - -
          -
        • -

          dsv_constcols_nullcol

          -
          public static final SqltoolRB dsv_constcols_nullcol
          -
        • -
        - - - -
          -
        • -

          file_readfail

          -
          public static final SqltoolRB file_readfail
          -
        • -
        - - - -
          -
        • -

          inputfile_closefail

          -
          public static final SqltoolRB inputfile_closefail
          -
        • -
        - - - -
          -
        • -

          dsv_header_none

          -
          public static final SqltoolRB dsv_header_none
          -
        • -
        - - - -
          -
        • -

          dsv_header_noswitchtarg

          -
          public static final SqltoolRB dsv_header_noswitchtarg
          -
        • -
        - - - -
          -
        • -

          dsv_header_noswitchmatch

          -
          public static final SqltoolRB dsv_header_noswitchmatch
          -
        • -
        - - - -
          -
        • -

          dsv_header_nonswitched

          -
          public static final SqltoolRB dsv_header_nonswitched
          -
        • -
        - - - -
          -
        • -

          dsv_nocolheader

          -
          public static final SqltoolRB dsv_nocolheader
          -
        • -
        - - - -
          -
        • -

          dsv_metadata_mismatch

          -
          public static final SqltoolRB dsv_metadata_mismatch
          -
        • -
        - - - -
          -
        • -

          query_metadatafail

          -
          public static final SqltoolRB query_metadatafail
          -
        • -
        - - - -
          -
        • -

          dsv_rejectfile_setupfail

          -
          public static final SqltoolRB dsv_rejectfile_setupfail
          -
        • -
        - - - -
          -
        • -

          dsv_rejectreport_setupfail

          -
          public static final SqltoolRB dsv_rejectreport_setupfail
          -
        • -
        - - - -
          -
        • -

          none

          -
          public static final SqltoolRB none
          -
        • -
        - - - -
          -
        • -

          insertion_preparefail

          -
          public static final SqltoolRB insertion_preparefail
          -
        • -
        - - - -
          -
        • -

          dsv_header_matchernonhead

          -
          public static final SqltoolRB dsv_header_matchernonhead
          -
        • -
        - - - -
          -
        • -

          dsv_colcount_mismatch

          -
          public static final SqltoolRB dsv_colcount_mismatch
          -
        • -
        - - - -
          -
        • -

          dsv_insertcol_mismatch

          -
          public static final SqltoolRB dsv_insertcol_mismatch
          -
        • -
        - - - -
          -
        • -

          time_bad

          -
          public static final SqltoolRB time_bad
          -
        • -
        - - - -
          -
        • -

          boolean_bad

          -
          public static final SqltoolRB boolean_bad
          -
        • -
        - - - -
          -
        • -

          inputrec_modified

          -
          public static final SqltoolRB inputrec_modified
          -
        • -
        - - - -
          -
        • -

          dsv_recin_fail

          -
          public static final SqltoolRB dsv_recin_fail
          -
        • -
        - - - -
          -
        • -

          dsv_import_summary

          -
          public static final SqltoolRB dsv_import_summary
          -
        • -
        - - - -
          -
        • -

          insertions_notcommitted

          -
          public static final SqltoolRB insertions_notcommitted
          -
        • -
        - - - -
          -
        • -

          autocommit_fetchfail

          -
          public static final SqltoolRB autocommit_fetchfail
          -
        • -
        - - - -
          -
        • -

          dsv_rejectfile_purgefail

          -
          public static final SqltoolRB dsv_rejectfile_purgefail
          -
        • -
        - - - -
          -
        • -

          dsv_rejectreport_purgefail

          -
          public static final SqltoolRB dsv_rejectreport_purgefail
          -
        • -
        - - - -
          -
        • -

          edit_malformat

          -
          public static final SqltoolRB edit_malformat
          -
        • -
        - - - -
          -
        • -

          input_malformat

          -
          public static final SqltoolRB input_malformat
          -
        • -
        - - - -
          -
        • -

          append_empty

          -
          public static final SqltoolRB append_empty
          -
        • -
        - - - -
          -
        • -

          transiso_report

          -
          public static final SqltoolRB transiso_report
          -
        • -
        - - - -
          -
        • -

          exectime_reporting

          -
          public static final SqltoolRB exectime_reporting
          -
        • -
        - - - -
          -
        • -

          exectime_report

          -
          public static final SqltoolRB exectime_report
          -
        • -
        - - - -
          -
        • -

          regex_malformat

          -
          public static final SqltoolRB regex_malformat
          -
        • -
        - - - -
          -
        • -

          encode_fail

          -
          public static final SqltoolRB encode_fail
          -
        • -
        - - - -
          -
        • -

          macro_tip

          -
          public static final SqltoolRB macro_tip
          -
        • -
        - - - -
          -
        • -

          macrodef_malformat

          -
          public static final SqltoolRB macrodef_malformat
          -
        • -
        - - - -
          -
        • -

          macrodef_empty

          -
          public static final SqltoolRB macrodef_empty
          -
        • -
        - - - -
          -
        • -

          macrodef_semi

          -
          public static final SqltoolRB macrodef_semi
          -
        • -
        - - - -
          -
        • -

          macro_malformat

          -
          public static final SqltoolRB macro_malformat
          -
        • -
        - - - -
          -
        • -

          macro_undefined

          -
          public static final SqltoolRB macro_undefined
          -
        • -
        - - - -
          -
        • -

          log_syntax

          -
          public static final SqltoolRB log_syntax
          -
        • -
        - - - -
          -
        • -

          log_syntax_error

          -
          public static final SqltoolRB log_syntax_error
          -
        • -
        - - - -
          -
        • -

          reject_rpc

          -
          public static final SqltoolRB reject_rpc
          -
        • -
        - - - -
          -
        • -

          rpc_autocommit_failure

          -
          public static final SqltoolRB rpc_autocommit_failure
          -
        • -
        - - - -
          -
        • -

          rpc_commit_failure

          -
          public static final SqltoolRB rpc_commit_failure
          -
        • -
        - - - -
          -
        • -

          disconnect_success

          -
          public static final SqltoolRB disconnect_success
          -
        • -
        - - - -
          -
        • -

          disconnect_failure

          -
          public static final SqltoolRB disconnect_failure
          -
        • -
        - - - -
          -
        • -

          no_required_conn

          -
          public static final SqltoolRB no_required_conn
          -
        • -
        - - - -
          -
        • -

          disconnected_msg

          -
          public static final SqltoolRB disconnected_msg
          -
        • -
        - - - -
          -
        • -

          connected_fallbackmsg

          -
          public static final SqltoolRB connected_fallbackmsg
          -
        • -
        - - - -
          -
        • -

          no_vendor_schemaspt

          -
          public static final SqltoolRB no_vendor_schemaspt
          -
        • -
        - - - -
          -
        • -

          schemaname_retrieval_fail

          -
          public static final SqltoolRB schemaname_retrieval_fail
          -
        • -
        - - - -
          -
        • -

          remove_empty_vars_suggestset

          -
          public static final SqltoolRB remove_empty_vars_suggestset
          -
        • -
        - - - -
          -
        • -

          auto_unset_warning

          -
          public static final SqltoolRB auto_unset_warning
          -
        • -
        - - - -
          -
        • -

          pl_unset_nomoreargs

          -
          public static final SqltoolRB pl_unset_nomoreargs
          -
        • -
        - - - -
          -
        • -

          dsv_q_nodblquote

          -
          public static final SqltoolRB dsv_q_nodblquote
          -
        • -
        - - - -
          -
        • -

          connect_failure

          -
          public static final SqltoolRB connect_failure
          -
        • -
        - - - -
          -
        • -

          streamread_failure

          -
          public static final SqltoolRB streamread_failure
          -
        • -
        - - - -
          -
        • -

          illegal_at

          -
          public static final SqltoolRB illegal_at
          -
        • -
        - - - -
          -
        • -

          suggest_j

          -
          public static final SqltoolRB suggest_j
          -
        • -
        - - - -
          -
        • -

          pipeclose_failure

          -
          public static final SqltoolRB pipeclose_failure
          -
        • -
        - - - -
          -
        • -

          arrayimp_jvmreq

          -
          public static final SqltoolRB arrayimp_jvmreq
          -
        • -
        - - - -
          -
        • -

          arrayval_malformat

          -
          public static final SqltoolRB arrayval_malformat
          -
        • -
        - - - -
          -
        • -

          sqlarray_badjvm

          -
          public static final SqltoolRB sqlarray_badjvm
          -
        • -
        - - - -
          -
        • -

          csv_coldelim_present

          -
          public static final SqltoolRB csv_coldelim_present
          -
        • -
        - - - -
          -
        • -

          csv_quote_unterminated

          -
          public static final SqltoolRB csv_quote_unterminated
          -
        • -
        - - - -
          -
        • -

          math_expr_fail

          -
          public static final SqltoolRB math_expr_fail
          -
        • -
        - - - -
          -
        • -

          varname_warning

          -
          public static final SqltoolRB varname_warning
          -
        • -
        - - - -
          -
        • -

          null_assignment

          -
          public static final SqltoolRB null_assignment
          -
        • -
        - - - -
          -
        • -

          bad_time_format

          -
          public static final SqltoolRB bad_time_format
          -
        • -
        - - - -
          -
        • -

          no_timestamp_format

          -
          public static final SqltoolRB no_timestamp_format
          -
        • -
        - - - -
          -
        • -

          else_without_if

          -
          public static final SqltoolRB else_without_if
          -
        • -
        - - - -
          -
        • -

          import_col_dup

          -
          public static final SqltoolRB import_col_dup
          -
        • -
        - - - -
          -
        • -

          desturl_nowrite

          -
          public static final SqltoolRB desturl_nowrite
          -
        • -
        -
      • -
      -
      - -
      -
        -
      • - - -

        Method Detail

        - - - -
          -
        • -

          values

          -
          public static SqltoolRB[] values()
          -
          Returns an array containing the constants of this enum type, in -the order they are declared. This method may be used to iterate -over the constants as follows: -
          -for (SqltoolRB c : SqltoolRB.values())
          -    System.out.println(c);
          -
          -
          -
          Returns:
          -
          an array containing the constants of this enum type, in the order they are declared
          -
          -
        • -
        - - - -
          -
        • -

          valueOf

          -
          public static SqltoolRB valueOf​(java.lang.String name)
          -
          Returns the enum constant of this type with the specified name. -The string must match exactly an identifier used to declare an -enum constant in this type. (Extraneous whitespace characters are -not permitted.)
          -
          -
          Parameters:
          -
          name - the name of the enum constant to be returned.
          -
          Returns:
          -
          the enum constant with the specified name
          -
          Throws:
          -
          java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
          -
          java.lang.NullPointerException - if the argument is null
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString()
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          toString

          -
          public java.lang.String toString()
          -
          -
          Overrides:
          -
          toString in class java.lang.Enum<SqltoolRB>
          -
          -
        • -
        - - - -
          -
        • -

          getExpandedString

          -
          public java.lang.String getExpandedString()
          -
          -
          Specified by:
          -
          getExpandedString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getExpandedString

          -
          public java.lang.String getExpandedString​(java.lang.String... strings)
          -
          -
          Specified by:
          -
          getExpandedString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(java.lang.Throwable t)
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(java.lang.String... strings)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(int i1)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(int i1,
          -                                  int i2)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(int i1,
          -                                  int i2,
          -                                  int i3)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(int i1,
          -                                  java.lang.String s2)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(java.lang.String s1,
          -                                  int i2)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(int i1,
          -                                  int i2,
          -                                  java.lang.String s3)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(int i1,
          -                                  java.lang.String s2,
          -                                  int i3)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(java.lang.String s1,
          -                                  int i2,
          -                                  int i3)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(int i1,
          -                                  java.lang.String s2,
          -                                  java.lang.String s3)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(java.lang.String s1,
          -                                  java.lang.String s2,
          -                                  int i3)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        - - - -
          -
        • -

          getString

          -
          public java.lang.String getString​(java.lang.String s1,
          -                                  int i2,
          -                                  java.lang.String s3)
          -
          -
          Specified by:
          -
          getString in interface org.hsqldb.cmdline.libclone.RefCapableRBInterface
          -
          -
        • -
        -
      • -
      -
      -
    • -
    -
    -
    -
    - - - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlFile.BadSpecial.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlFile.BadSpecial.html deleted file mode 100644 index 4b2ac07a..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlFile.BadSpecial.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - -Uses of Class org.hsqldb.cmdline.SqlFile.BadSpecial (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Class
    org.hsqldb.cmdline.SqlFile.BadSpecial

    -
    -
    - -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlFile.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlFile.html deleted file mode 100644 index 0889629e..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlFile.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.cmdline.SqlFile (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Class
    org.hsqldb.cmdline.SqlFile

    -
    -
    No usage of org.hsqldb.cmdline.SqlFile
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlTool.SqlToolException.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlTool.SqlToolException.html deleted file mode 100644 index 542e1ebe..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlTool.SqlToolException.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - -Uses of Class org.hsqldb.cmdline.SqlTool.SqlToolException (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Class
    org.hsqldb.cmdline.SqlTool.SqlToolException

    -
    -
    - -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlTool.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlTool.html deleted file mode 100644 index fc8d628d..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlTool.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.cmdline.SqlTool (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Class
    org.hsqldb.cmdline.SqlTool

    -
    -
    No usage of org.hsqldb.cmdline.SqlTool
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlToolError.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlToolError.html deleted file mode 100644 index 63318181..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlToolError.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - -Uses of Class org.hsqldb.cmdline.SqlToolError (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Class
    org.hsqldb.cmdline.SqlToolError

    -
    -
    -
      -
    • -
        -
      • -
        - - -

        Uses of SqlToolError in org.hsqldb.cmdline

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Methods in org.hsqldb.cmdline that throw SqlToolError 
        Modifier and TypeMethodDescription
        voidSqlFile.dsvSafe​(java.lang.String s) -
        Validate that String is safe to write TO DSV file.
        -
        voidSqlFile.execute() -
        Process all the commands from the file or Reader associated with - "this" object.
        -
        java.lang.StringSqlFile.getCurrentSchema() 
        voidSqlFile.importDsv​(java.net.URL fileUrl, - java.lang.String skipPrefix) -
        Name is self-explanatory.
        -
        -
        -
      • -
      -
    • -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlToolSprayer.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlToolSprayer.html deleted file mode 100644 index 2e24055c..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqlToolSprayer.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Uses of Class org.hsqldb.cmdline.SqlToolSprayer (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Class
    org.hsqldb.cmdline.SqlToolSprayer

    -
    -
    No usage of org.hsqldb.cmdline.SqlToolSprayer
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqltoolRB.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqltoolRB.html deleted file mode 100644 index c3c3190f..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/class-use/SqltoolRB.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - -Uses of Class org.hsqldb.cmdline.SqltoolRB (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Class
    org.hsqldb.cmdline.SqltoolRB

    -
    -
    -
      -
    • - -
    • -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-summary.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-summary.html deleted file mode 100644 index 18157200..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-summary.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - -org.hsqldb.cmdline (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    - -

    Package org.hsqldb.cmdline

    -
    -
    -
    - - -
    Contains the SqlTool command-line tool
    -
    -
      -
    • - - - - - - - - - - - - - - - - - - - - -
      Class Summary 
      ClassDescription
      SqlFile -
      Encapsulation of SQL text and the environment under which it will be - executed with a JDBC Connection.
      -
      SqlTool -
      A command-line JDBC SQL tool supporting both interactive and - non-interactive usage.
      -
      SqlToolSprayer -
      Sql Tool Sprayer.
      -
      -
    • -
    • - - - - - - - - - - - - -
      Enum Summary 
      EnumDescription
      SqltoolRB -
      Resource Bundle for SqlTool and associated classes.
      -
      -
    • -
    • - - - - - - - - - - - - - - - - - - - - -
      Exception Summary 
      ExceptionDescription
      SqlFile.BadSpecial -
      Utility nested Exception class for internal use only.
      -
      SqlTool.SqlToolException 
      SqlToolError -
      Exceptions thrown by the SqlTool system externally to SqlFile.
      -
      -
    • -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-tree.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-tree.html deleted file mode 100644 index 4891c8c3..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-tree.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - -org.hsqldb.cmdline Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Hierarchy For Package org.hsqldb.cmdline

    -
    -
    -
    -

    Class Hierarchy

    - -
    -
    -

    Enum Hierarchy

    -
      -
    • java.lang.Object -
        -
      • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) -
          -
        • org.hsqldb.cmdline.SqltoolRB (implements org.hsqldb.cmdline.libclone.RefCapableRBInterface)
        • -
        -
      • -
      -
    • -
    -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-use.html b/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-use.html deleted file mode 100644 index acfa9e0e..00000000 --- a/database/hsqldb/doc/apidocssqltool/org.hsqldb.sqltool/org/hsqldb/cmdline/package-use.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - -Uses of Package org.hsqldb.cmdline (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Uses of Package
    org.hsqldb.cmdline

    -
    -
    - -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/overview-tree.html b/database/hsqldb/doc/apidocssqltool/overview-tree.html deleted file mode 100644 index bc4f7ba9..00000000 --- a/database/hsqldb/doc/apidocssqltool/overview-tree.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - -Class Hierarchy (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Hierarchy For All Packages

    -Package Hierarchies: - -
    -
    -
    -

    Class Hierarchy

    - -
    -
    -

    Enum Hierarchy

    -
      -
    • java.lang.Object -
        -
      • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable) -
          -
        • org.hsqldb.cmdline.SqltoolRB (implements org.hsqldb.cmdline.libclone.RefCapableRBInterface)
        • -
        -
      • -
      -
    • -
    -
    -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/package-search-index.js b/database/hsqldb/doc/apidocssqltool/package-search-index.js deleted file mode 100644 index 8c58c68b..00000000 --- a/database/hsqldb/doc/apidocssqltool/package-search-index.js +++ /dev/null @@ -1 +0,0 @@ -packageSearchIndex = [{"l":"All Packages","url":"allpackages-index.html"},{"m":"org.hsqldb.sqltool","l":"org.hsqldb.cmdline"}] \ No newline at end of file diff --git a/database/hsqldb/doc/apidocssqltool/package-search-index.zip b/database/hsqldb/doc/apidocssqltool/package-search-index.zip deleted file mode 100644 index 3cf2724c..00000000 Binary files a/database/hsqldb/doc/apidocssqltool/package-search-index.zip and /dev/null differ diff --git a/database/hsqldb/doc/apidocssqltool/resources/glass.png b/database/hsqldb/doc/apidocssqltool/resources/glass.png deleted file mode 100644 index a7f591f4..00000000 Binary files a/database/hsqldb/doc/apidocssqltool/resources/glass.png and /dev/null differ diff --git a/database/hsqldb/doc/apidocssqltool/resources/x.png b/database/hsqldb/doc/apidocssqltool/resources/x.png deleted file mode 100644 index 30548a75..00000000 Binary files a/database/hsqldb/doc/apidocssqltool/resources/x.png and /dev/null differ diff --git a/database/hsqldb/doc/apidocssqltool/script.js b/database/hsqldb/doc/apidocssqltool/script.js deleted file mode 100644 index 7dc93c48..00000000 --- a/database/hsqldb/doc/apidocssqltool/script.js +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -var moduleSearchIndex; -var packageSearchIndex; -var typeSearchIndex; -var memberSearchIndex; -var tagSearchIndex; -function loadScripts(doc, tag) { - createElem(doc, tag, 'jquery/jszip/dist/jszip.js'); - createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils.js'); - if (window.navigator.userAgent.indexOf('MSIE ') > 0 || window.navigator.userAgent.indexOf('Trident/') > 0 || - window.navigator.userAgent.indexOf('Edge/') > 0) { - createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils-ie.js'); - } - createElem(doc, tag, 'search.js'); - - $.get(pathtoroot + "module-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("module-search-index.json").async("text").then(function(content){ - moduleSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "package-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("package-search-index.json").async("text").then(function(content){ - packageSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "type-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("type-search-index.json").async("text").then(function(content){ - typeSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "member-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("member-search-index.json").async("text").then(function(content){ - memberSearchIndex = JSON.parse(content); - }); - }); - }); - }); - $.get(pathtoroot + "tag-search-index.zip") - .done(function() { - JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) { - JSZip.loadAsync(data).then(function(zip){ - zip.file("tag-search-index.json").async("text").then(function(content){ - tagSearchIndex = JSON.parse(content); - }); - }); - }); - }); - if (!moduleSearchIndex) { - createElem(doc, tag, 'module-search-index.js'); - } - if (!packageSearchIndex) { - createElem(doc, tag, 'package-search-index.js'); - } - if (!typeSearchIndex) { - createElem(doc, tag, 'type-search-index.js'); - } - if (!memberSearchIndex) { - createElem(doc, tag, 'member-search-index.js'); - } - if (!tagSearchIndex) { - createElem(doc, tag, 'tag-search-index.js'); - } - $(window).resize(function() { - $('.navPadding').css('padding-top', $('.fixedNav').css("height")); - }); -} - -function createElem(doc, tag, path) { - var script = doc.createElement(tag); - var scriptElement = doc.getElementsByTagName(tag)[0]; - script.src = pathtoroot + path; - scriptElement.parentNode.insertBefore(script, scriptElement); -} - -function show(type) { - count = 0; - for (var key in data) { - var row = document.getElementById(key); - if ((data[key] & type) !== 0) { - row.style.display = ''; - row.className = (count++ % 2) ? rowColor : altColor; - } - else - row.style.display = 'none'; - } - updateTabs(type); -} - -function updateTabs(type) { - for (var value in tabs) { - var sNode = document.getElementById(tabs[value][0]); - var spanNode = sNode.firstChild; - if (value == type) { - sNode.className = activeTableTab; - spanNode.innerHTML = tabs[value][1]; - } - else { - sNode.className = tableTab; - spanNode.innerHTML = "" + tabs[value][1] + ""; - } - } -} - -function updateModuleFrame(pFrame, cFrame) { - top.packageFrame.location = pFrame; - top.classFrame.location = cFrame; -} diff --git a/database/hsqldb/doc/apidocssqltool/search.js b/database/hsqldb/doc/apidocssqltool/search.js deleted file mode 100644 index b773531b..00000000 --- a/database/hsqldb/doc/apidocssqltool/search.js +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -var noResult = {l: "No results found"}; -var catModules = "Modules"; -var catPackages = "Packages"; -var catTypes = "Types"; -var catMembers = "Members"; -var catSearchTags = "SearchTags"; -var highlight = "$&"; -var camelCaseRegexp = ""; -var secondaryMatcher = ""; -function getHighlightedText(item) { - var ccMatcher = new RegExp(camelCaseRegexp); - var label = item.replace(ccMatcher, highlight); - if (label === item) { - label = item.replace(secondaryMatcher, highlight); - } - return label; -} -function getURLPrefix(ui) { - var urlPrefix=""; - if (useModuleDirectories) { - var slash = "/"; - if (ui.item.category === catModules) { - return ui.item.l + slash; - } else if (ui.item.category === catPackages && ui.item.m) { - return ui.item.m + slash; - } else if ((ui.item.category === catTypes && ui.item.p) || ui.item.category === catMembers) { - $.each(packageSearchIndex, function(index, item) { - if (ui.item.p == item.l) { - urlPrefix = item.m + slash; - } - }); - return urlPrefix; - } else { - return urlPrefix; - } - } - return urlPrefix; -} -var watermark = 'Search'; -$(function() { - $("#search").val(''); - $("#search").prop("disabled", false); - $("#reset").prop("disabled", false); - $("#search").val(watermark).addClass('watermark'); - $("#search").blur(function() { - if ($(this).val().length == 0) { - $(this).val(watermark).addClass('watermark'); - } - }); - $("#search").on('click keydown', function() { - if ($(this).val() == watermark) { - $(this).val('').removeClass('watermark'); - } - }); - $("#reset").click(function() { - $("#search").val(''); - $("#search").focus(); - }); - $("#search").focus(); - $("#search")[0].setSelectionRange(0, 0); -}); -$.widget("custom.catcomplete", $.ui.autocomplete, { - _create: function() { - this._super(); - this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); - }, - _renderMenu: function(ul, items) { - var rMenu = this, - currentCategory = ""; - rMenu.menu.bindings = $(); - $.each(items, function(index, item) { - var li; - if (item.l !== noResult.l && item.category !== currentCategory) { - ul.append("
  • " + item.category + "
  • "); - currentCategory = item.category; - } - li = rMenu._renderItemData(ul, item); - if (item.category) { - li.attr("aria-label", item.category + " : " + item.l); - li.attr("class", "resultItem"); - } else { - li.attr("aria-label", item.l); - li.attr("class", "resultItem"); - } - }); - }, - _renderItem: function(ul, item) { - var label = ""; - if (item.category === catModules) { - label = getHighlightedText(item.l); - } else if (item.category === catPackages) { - label = (item.m) - ? getHighlightedText(item.m + "/" + item.l) - : getHighlightedText(item.l); - } else if (item.category === catTypes) { - label = (item.p) - ? getHighlightedText(item.p + "." + item.l) - : getHighlightedText(item.l); - } else if (item.category === catMembers) { - label = getHighlightedText(item.p + "." + (item.c + "." + item.l)); - } else if (item.category === catSearchTags) { - label = getHighlightedText(item.l); - } else { - label = item.l; - } - var li = $("
  • ").appendTo(ul); - var div = $("
    ").appendTo(li); - if (item.category === catSearchTags) { - if (item.d) { - div.html(label + " (" + item.h + ")
    " - + item.d + "
    "); - } else { - div.html(label + " (" + item.h + ")"); - } - } else { - div.html(label); - } - return li; - } -}); -$(function() { - $("#search").catcomplete({ - minLength: 1, - delay: 100, - source: function(request, response) { - var result = new Array(); - var presult = new Array(); - var tresult = new Array(); - var mresult = new Array(); - var tgresult = new Array(); - var secondaryresult = new Array(); - var displayCount = 0; - var exactMatcher = new RegExp("^" + $.ui.autocomplete.escapeRegex(request.term) + "$", "i"); - camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join("([a-z0-9_$]*?)"); - var camelCaseMatcher = new RegExp("^" + camelCaseRegexp); - secondaryMatcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); - - // Return the nested innermost name from the specified object - function nestedName(e) { - return e.l.substring(e.l.lastIndexOf(".") + 1); - } - - function concatResults(a1, a2) { - a1 = a1.concat(a2); - a2.length = 0; - return a1; - } - - if (moduleSearchIndex) { - var mdleCount = 0; - $.each(moduleSearchIndex, function(index, item) { - item.category = catModules; - if (exactMatcher.test(item.l)) { - result.push(item); - mdleCount++; - } else if (camelCaseMatcher.test(item.l)) { - result.push(item); - } else if (secondaryMatcher.test(item.l)) { - secondaryresult.push(item); - } - }); - displayCount = mdleCount; - result = concatResults(result, secondaryresult); - } - if (packageSearchIndex) { - var pCount = 0; - var pkg = ""; - $.each(packageSearchIndex, function(index, item) { - item.category = catPackages; - pkg = (item.m) - ? (item.m + "/" + item.l) - : item.l; - if (exactMatcher.test(item.l)) { - presult.push(item); - pCount++; - } else if (camelCaseMatcher.test(pkg)) { - presult.push(item); - } else if (secondaryMatcher.test(pkg)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(presult, secondaryresult)); - displayCount = (pCount > displayCount) ? pCount : displayCount; - } - if (typeSearchIndex) { - var tCount = 0; - $.each(typeSearchIndex, function(index, item) { - item.category = catTypes; - var s = nestedName(item); - if (exactMatcher.test(s)) { - tresult.push(item); - tCount++; - } else if (camelCaseMatcher.test(s)) { - tresult.push(item); - } else if (secondaryMatcher.test(item.p + "." + item.l)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(tresult, secondaryresult)); - displayCount = (tCount > displayCount) ? tCount : displayCount; - } - if (memberSearchIndex) { - var mCount = 0; - $.each(memberSearchIndex, function(index, item) { - item.category = catMembers; - var s = nestedName(item); - if (exactMatcher.test(s)) { - mresult.push(item); - mCount++; - } else if (camelCaseMatcher.test(s)) { - mresult.push(item); - } else if (secondaryMatcher.test(item.c + "." + item.l)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(mresult, secondaryresult)); - displayCount = (mCount > displayCount) ? mCount : displayCount; - } - if (tagSearchIndex) { - var tgCount = 0; - $.each(tagSearchIndex, function(index, item) { - item.category = catSearchTags; - if (exactMatcher.test(item.l)) { - tgresult.push(item); - tgCount++; - } else if (secondaryMatcher.test(item.l)) { - secondaryresult.push(item); - } - }); - result = result.concat(concatResults(tgresult, secondaryresult)); - displayCount = (tgCount > displayCount) ? tgCount : displayCount; - } - displayCount = (displayCount > 500) ? displayCount : 500; - var counter = function() { - var count = {Modules: 0, Packages: 0, Types: 0, Members: 0, SearchTags: 0}; - var f = function(item) { - count[item.category] += 1; - return (count[item.category] <= displayCount); - }; - return f; - }(); - response(result.filter(counter)); - }, - response: function(event, ui) { - if (!ui.content.length) { - ui.content.push(noResult); - } else { - $("#search").empty(); - } - }, - autoFocus: true, - position: { - collision: "flip" - }, - select: function(event, ui) { - if (ui.item.l !== noResult.l) { - var url = getURLPrefix(ui); - if (ui.item.category === catModules) { - if (useModuleDirectories) { - url += "module-summary.html"; - } else { - url = ui.item.l + "-summary.html"; - } - } else if (ui.item.category === catPackages) { - if (ui.item.url) { - url = ui.item.url; - } else { - url += ui.item.l.replace(/\./g, '/') + "/package-summary.html"; - } - } else if (ui.item.category === catTypes) { - if (ui.item.url) { - url = ui.item.url; - } else if (ui.item.p === "") { - url += ui.item.l + ".html"; - } else { - url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html"; - } - } else if (ui.item.category === catMembers) { - if (ui.item.p === "") { - url += ui.item.c + ".html" + "#"; - } else { - url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#"; - } - if (ui.item.url) { - url += ui.item.url; - } else { - url += ui.item.l; - } - } else if (ui.item.category === catSearchTags) { - url += ui.item.u; - } - if (top !== window) { - parent.classFrame.location = pathtoroot + url; - } else { - window.location.href = pathtoroot + url; - } - $("#search").focus(); - } - } - }); -}); diff --git a/database/hsqldb/doc/apidocssqltool/serialized-form.html b/database/hsqldb/doc/apidocssqltool/serialized-form.html deleted file mode 100644 index 208b2d19..00000000 --- a/database/hsqldb/doc/apidocssqltool/serialized-form.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - -Serialized Form (HSQLDB 2.7.2 API) - - - - - - - - - - - - - - -
    - -
    -
    -
    -

    Serialized Form

    -
    -
    - -
    -
    -
    - -

    Copyright © 2001 - 2022 HSQL Development Group.

    -
    - - diff --git a/database/hsqldb/doc/apidocssqltool/type-search-index.js b/database/hsqldb/doc/apidocssqltool/type-search-index.js deleted file mode 100644 index e52e5da0..00000000 --- a/database/hsqldb/doc/apidocssqltool/type-search-index.js +++ /dev/null @@ -1 +0,0 @@ -typeSearchIndex = [{"l":"All Classes","url":"allclasses-index.html"},{"p":"org.hsqldb.cmdline","l":"SqlFile.BadSpecial"},{"p":"org.hsqldb.cmdline","l":"SqlFile"},{"p":"org.hsqldb.cmdline","l":"SqlTool"},{"p":"org.hsqldb.cmdline","l":"SqlToolError"},{"p":"org.hsqldb.cmdline","l":"SqlTool.SqlToolException"},{"p":"org.hsqldb.cmdline","l":"SqltoolRB"},{"p":"org.hsqldb.cmdline","l":"SqlToolSprayer"}] \ No newline at end of file diff --git a/database/hsqldb/doc/apidocssqltool/type-search-index.zip b/database/hsqldb/doc/apidocssqltool/type-search-index.zip deleted file mode 100644 index de5c1213..00000000 Binary files a/database/hsqldb/doc/apidocssqltool/type-search-index.zip and /dev/null differ diff --git a/database/hsqldb/doc/branding-frag.xhtml b/database/hsqldb/doc/branding-frag.xhtml deleted file mode 100644 index 5f30c342..00000000 --- a/database/hsqldb/doc/branding-frag.xhtml +++ /dev/null @@ -1,5 +0,0 @@ - - -
    - -
    diff --git a/database/hsqldb/doc/changelist_2_0.txt b/database/hsqldb/doc/changelist_2_0.txt deleted file mode 100644 index b86a10c3..00000000 --- a/database/hsqldb/doc/changelist_2_0.txt +++ /dev/null @@ -1,535 +0,0 @@ -March 2023 - version 2.7.2 -== version 2.7.2 is a release with minor enhancements and corrections - -20 Oct 2022 - version 2.7.1 --- version 2.7.1 jar requires JRE 11 or later - tested up to Java 17 --- version 2.7.1 alternative jar requires JRE 8 or later --- CVE-2022-41853 disallow calling java methods - setting the hsqldb.method_class_names is required for accessing java methods --- enhancements to RECURSIVE CTE's - -30 May 2022 - version 2.7.0 --- version 2.7.0 jar requires JRE 11 or later - tested up to Java 17 --- version 2.7.0 alternative jar requires JRE 8 or later --- added support for JSON constructor functions --- added support for microsecond precision CURRENT_TIMESTAMP and similar functions --- added support for GRANT and REVOKE on all objects in a schema --- added support for CSV file data import and export --- added support for regional time zones such as 'America/New_York' in conversions --- added SET DATABASE SQL MAX RECURSIVE (sql.max_recursive) setting --- changed the default for SET DATABASE SQL SYS INDEX NAMES (sql.sys_index_names) to true --- changed the properties reported by JDBC DatabaseMetaDat::getClientInfoProperties() method --- improved JDBC DatabaseMetaDat::getTablePrivileges() method to cover fine-grained privileges --- improved error messages for SQL settings statements --- improved documentation --- added some minor enhancements --- fixed a number of reported regressions and bugs (see tracker) - -21 October 2021 - version 2.6.1 --- version 2.6.1 is a bug fix release --- added sql.lowercase_ident property for extra compatibility with PostgreSQL and MySQL unquoted identifier names --- fixed an issue with performance of large updates in mvcc transaction mode --- fixed an issue with query timeout settings --- fixed a number of minor issues and regressions - -21 March 2021 - version 2.6.0 --- Version 2.6.0 marks the 20th anniversary of HyperSQL. --- The project maintainer would like to thank core developers Blaine Simpson, Campbell Burnet and Robert Preston for their contribution over many years, --- and all developers and users who contributed code, made useful suggestions, or reported issues. --- version 2.6.0 main jar contains the module org.hsqldb and can be used as a Java module --- version 2.6.0 jar requires JRE 11 or later - tested up to Java 16 RC --- version 2.6.0 alternative jar requires JRE 8 or later --- version 2.3.9 jar can be compiled with Java 6 (or 7) for JRE 6 and 7 and fully compatible with 2.6.0 except for the new JDBC features --- The DatabaseManager class is no longer included in the Jars. Use DatabaseManagerSwing instead. --- added support for additional REGEXP_ functions. --- added support for adding extra columns to FOREIGN KEY indexes; see ALTER CONSTRAINT in the Guide --- added support for RECURSIVE_TABLE in WITH RECURSIVE queries --- added system role SCRIPT_OPS for export / import of database structure and data --- added extensive features to the collection classes in org.hsqldb.lib (maps, lists, queues etc.) which can also be used in user apps --- improved MySQL syntax support for ENUM --- fixed a number of regression in 2.5.1, e.g. use of MODULE for LOCAL TEMPORARY tables, truncated microsecond precision of java.sql.Timestamp values --- fixed several minor issues --- removed all use of Java (up to JDK 16) deprecated methods --- revamped Ant and Gradle builds, now updated to latest Gradle - -24 June 2020 - version 2.5.1 --- version 2.5.1 jar requires JRE 8 or later - tested up to Java 14 --- version 2.5.1 can be compiled with Java 9 or later as org.hsqldb Java module jar --- version 2.3.8 jar can be compiled with Java 6 (or 7) for JRE 6 and 7 and fully compatible with 2.5.1 except for the new JDBC features --- added support for GROUPING SETS, ROLLUP and CUBE grouping operations --- added support for PERFORM CHECK ALL TABLE INDEX to check all CACHED table data and indexes --- added support for use of PostgreSQL ODBC driver to access a HyperSQL Server --- added support for calling stored procedures with INTERVAL parameters via JDBC CallableStatement --- added support for TRANSACTION_UTC, ASCIISTR UNISTR functions --- added support for reuse of memory space for lobs in mem: databases --- changed behaviour of WITH RECURSIVE with UNION ALL for compatibility with other systems --- improved role-based, row-level data access control with more complex filter expressions that can be applied to separate actions --- improved MySQL syntax support in the ON DUPLICATE KEY UPDATE clause --- improved loading of text files with null or empty fields into TEXT tables with columns defined as NOT NULL with DEFAULT --- many minor enhancements --- fixed issue with ALTER COLUMN data type modification between SMALLINT and INTEGER in CACHED tables --- fixed an issue (regression) in some server shutdown cases --- fixed an issue (regression) in some cases when JDBC connection timeout is used --- fixed several minor issues --- changed and improved how file spaces are set up for existing cached tables --- removed legacy support for opening version 1.8 databases --- removed legacy support for non-incremental internal backup of the .data file - -- 1 June 2019 - version 2.5.0 --- version 2.5.0 jar requires JRE 8 or later - tested up to Java 12 --- version 2.5.0 can be compiled with Java 9 or later as org.hsqldb Java module jar --- version 2.3.7 is released as a separate jar for JRE 6 and 7 and fully compatible except for the new JDBC features --- added Temporal System-Versioned tables feature --- added offline distributed database feature based on System-Versioned tables --- added role-based, row-level data access control --- added new properties, memory_lobs and hsqldb_tx_interrupt_rollback --- changed effect of Thread interrupts by user application in in-process database, transaction is rolled back if hsqldb_tx_interrupt_rollback is true --- changed return type of the UUID() function to UUID; the SYS_GUID() function will continue to return a BINARY(16) value. --- improved reporting of line number in compile error messages for routines --- improved syntax compatibility modes --- fixed issue with formatting of some TIMESTAMP nanoseconds returned by the TO_TIMESTAMP function --- fixed issue with TIMESTAMPDIFF with TIMESTAMP WITH TIME ZONE --- fixed issue with IN (UNNEST(NUMERIC ARRAY)) --- fixed issue with transaction size reported in INFORMATION_SCHEMA.SYSTEM_SESSIONS --- fixed issue with storing plus or minus infinity DOUBLE values --- fixed issue with CREATE DOMAIN ... COLLATE not persisting --- fixed issue with CREATE TYPE with custom COLLATION --- fixed an issue with multiple FOR loops in SQL routines --- fixed several minor issues --- changed calls to Java methods deprecated in JDK 9 - 12 --- removed Java 5 code switch and build options - -20 May 2018 - version 2.4.1 --- version 2.4.1 jar requires JRE 8 or later --- version 2.3.6 is released as a separate jar for JRE 1.6 and fully compatible except for the new JDBC features --- added support for EXPLAIN REFERENCES FROM | TO object statement --- added support for HEX, UNHEX, TO_BASE64 and FROM_BASE64 functions --- added support for deployment in docker containers that do not support file rename --- added support for generated keys in update and merge --- improved CHECKPOINT DEFRAG to allow very large data files --- fixed issue with some temp table queries --- fixed issue with some SELECT ... INTO in routines --- fixed issue with parsing some TEXT TABLE source files --- fixed issue with auto-generated identity values in MERGE statements --- fixed issue for WITH named non-recursive subqueries in routines --- fixed issue with some WITH recursive queries --- fixed issue with duplicate values in UNNEST used with IN predicates --- fixed issue with WHEN clause in Java TRIGGER declarations --- fixed several issues with implementation of JAVA 8 JDBC method --- fixed some issues with transaction management --- fixed several minor bugs - -9 April 2017 - version 2.4.0 --- version 2.4.0 jar requires JRE 8 --- version 2.3.5 is released as a separate jar for JRE 1.6 and fully compatible except for the new JDBC features --- added support for new JAVA 8 JDBC methods to ResultSet and Statement classes --- added support for several functions SINH COSH TANH NEXT_DAY DATEPART DATENAME EOMONTH NEWID SYS_GUID --- added support for execution of DDL statements concurrently with other transactions --- added support for table spaces for CACHED tables, which helps file space reuse after dropping tables or mass deletes --- improved support for WITH named subqueries in routines, allowing parameters to be referenced --- improved support for WITH RECURSIVE named subqueries to be used in other subqueries --- improved support for UUID in ResultSet to return a Java UUID with getObject() --- improved support for UUID in PreparedStatement setObject() with VARCHAR parameters --- improved use of allow_empty_batch connection property --- improved field param setting of DATEADD DATEDIFF TIMESTAMPADD TIMESTAMPDIFF functions --- improved ORA, MSS and MYS syntax compatibility modes for type names and functions --- fixed issue with cancel() method of java.sql.Statement with in-process connections --- fixed issue with the timeout setting of java.sql.Statement --- fixed issue with duplicate row with INSERT followed by UPDATE and ROLLBACK in MEMORY tables --- fixed issue with dropping indexes and constraints in MEMORY tables --- fixed issue with queries on DECIMAL or NUMERIC columns containing very large values --- fixed issue with ResultSet when calling next() multiple times was not followed by a get(...) call --- fixed issue with temp table indexes --- core code refactor of iterator for rows of tables and results --- fixed several minor bugs - -16 May 2016 - version 2.3.4 --- added support for storing live Java Objects in mem: databases with sql.live_object connection property --- added support for UUID data type --- added support for CREATE SYSNONYM FOR, for tables, views and sequences --- added support for ON UPDATE CURRENT_TIMESTAMP for auto updated TIMESTAMP columns --- added REGEXP_REPLACE function --- added support for PERIOD and CONTAINS, EQUALS, PRECEDES and SUCCEEDS predicates in SQL --- added support for UTF-16 text source files for TEXT tables --- added support for the cancel() method of JDBC Statement and PreparedStatement --- added support for END STATEMENT to end long-running statements --- added support for CallableStatement parameter reference by name --- added date range checks to setDate and setTimestamp methods in PreparedStatement --- added support for lowercase patterns for TO_DATE etc. --- added support for VARCHAR string literals with sql.char_literal property --- improved MYS syntax mode for INSERT, REPLACE and ON DUPLICATE KEY UPDATE --- improved DB2 syntax mode for queries --- extensive review and improvement of transaction management in muti-threaded access --- fixed issue with user application Thread.interrupt disabling in-process database session --- fixed regression with interaction of FK constraints with ON DELETE CASCADE and NO ACTION --- fixed regression with opening database with CACHED table with files_readonly --- fixed issue with SEQUENCE increment in multi-row inserts --- fixed issue with incorrect results in multiple LEFT JOIN with NATURAL or USING --- fixed issue with ClobInputStream --- fixed issue with missing references to views used in routines --- fixed issue with .lobs file space reuse at CHECKPOINT --- fixed issue with readonly session blocking in MVLOCKS mode --- fixed several minor bugs - -28 June 2015 - version 2.3.3 --- extensive review and improvement of concurrent updates --- fixed an issue with CHECKPOINT DEFRAG that could cause minor inconsistencies --- fixed a rarely occuring error immediately after CHECKPOINT --- fixed regression with comparison of TIMESTAMP values when one value is WITH TIME ZONE and the other WITHOUT --- fixed reporting of DISTINCT and DOMAIN types in JDBC DatabaseMetaData getColumns results --- fixed issue with new FK constraints, existing rows are now checked --- fixed restrictions with FK constraints with NO ACTION, all valid outcomes are now allowed --- fixed regression in 2.3.2, multiple rows with partial null values could not be inserted in UNIQUE indexes --- fixed issue with removal of IDENTITY when using ALTER COLUMN --- fixed issue with getExportedKeys reporting wrong DEFERABILITY --- fixed issue with CURRENT VALUE FOR usage --- fixed issue with LIKE with parametric escape character --- fixed an issue with CACHED table persistence --- fixed issue with TEMP table with ON COMMIT PRESERVE ROWS and RESULT MEMORY ROWS setting --- fixed several minor bugs --- improved usage of DECLARE CURSOR and DECLARE TABLE in SQL routines --- improved ORA, PGS, MSS and MYS syntax compatibility modes for CREATE TABLE and other statements --- added support for MYS syntax INSERT IGNORE, REPLACE and ON DUPLICATE KEY UPDATE --- added support for ALTER CONSTRAINT RENAME TO --- added support for LIMIT in DELETE and UPDATE statements --- added support for DELETE in MERGE statement - -12 February 2014 - version 2.3.2 --- fixed several minor issues --- fixed bug with incomplete rollback of MVCC transaction that inserts and updates the same row --- fixed issue with parsing of long BIT strings in SQL --- fixed issue with SQL triggers when columns were added or dropped from a table with SQL triggers --- fixed issue with an index added to a TEMP table with ON COMMIT PRESERVE ROWS and containing data --- added URL property hsqldb.digest which can be used with alternative secure hash algorithms for passwords --- changed the class used for offline backup and restore to org.hsqldb.lib.tar.DbBackupMain --- extended the scope of SET DATABASE SQL REFERENCES TRUE to catch ambiguity with identical table aliases --- extended support for the DEFAULT keyword used in INSERT and UPDATE to apply to columns with no default --- improved support for recursive queries --- improved ORA and MYS syntax compatibility modes - -08 October 2013 - version 2.3.1 --- fixed several minor issues --- fixed bug with some queries using ORDER BY DESC on indexed columns used in conditions --- fixed issue with NPE is some complex subqueries --- improved JDBCPool to be created with DataSourceFactory --- added support for LIKE with parametric escape character --- added support for routine SIGNAL messages using variables - -08 July 2013 - version 2.3.0 --- improved data exception error messages -05 July svn 5259 snapshot 52 --- added connection property, close_result -30 June - svn 5256 snapshot 51 --- added INSTR function -15 May - svn 5241 snapshot --- added support for backup of database as set of files BACKUP DATABASE TO AS FILES -12 April - svn 5228 snapshot --- added TIMESTAMP_WITH_ZONE function --- fixed issue with AT
  • The values of IS_GRANTABLE have the following meanings:
    - * - * YES : The privilege being described was granted - * WITH GRANT OPTION and is thus grantable.
    - * NO : The privilege being described was not granted - * WITH GRANT OPTION and is thus not grantable. - * - * - * @return Table - */ - Table USAGE_PRIVILEGES(Session session, PersistentStore store) { - - Table t = sysTables[USAGE_PRIVILEGES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[USAGE_PRIVILEGES]); - - addColumn(t, "GRANTOR", SQL_IDENTIFIER); // not null - addColumn(t, "GRANTEE", SQL_IDENTIFIER); // not null - addColumn(t, "OBJECT_CATALOG", SQL_IDENTIFIER); - addColumn(t, "OBJECT_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "OBJECT_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "OBJECT_TYPE", CHARACTER_DATA); // not null - addColumn(t, "PRIVILEGE_TYPE", CHARACTER_DATA); - addColumn(t, "IS_GRANTABLE", YES_OR_NO); // not null - - // order: COLUMN_NAME, PRIVILEGE - // for unique: GRANTEE, GRANTOR, TABLE_NAME, TABLE_SCHEM, TABLE_CAT - // false PK, as TABLE_SCHEM and/or TABLE_CAT may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[USAGE_PRIVILEGES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 3, 4, 5, 6, 7 - }, false); - - return t; - } - - // - Object[] row; - - // - final int grantor = 0; - final int grantee = 1; - final int object_catalog = 2; - final int object_schema = 3; - final int object_name = 4; - final int object_type = 5; - final int privilege_type = 6; - final int is_grantable = 7; - - // - Iterator objects = - new WrapperIterator(database.schemaManager - .databaseObjectIterator(SchemaObject.SEQUENCE), database - .schemaManager.databaseObjectIterator(SchemaObject.COLLATION)); - - objects = new WrapperIterator( - objects, - database.schemaManager.databaseObjectIterator( - SchemaObject.CHARSET)); - objects = new WrapperIterator( - objects, - database.schemaManager.databaseObjectIterator( - SchemaObject.DOMAIN)); - - // TYPE objects are covered in separate UDT_PRIVILEGES view - OrderedHashSet grantees = - session.getGrantee().getGranteeAndAllRolesWithPublic(); - - while (objects.hasNext()) { - SchemaObject object = (SchemaObject) objects.next(); - - for (int i = 0; i < grantees.size(); i++) { - Grantee granteeObject = (Grantee) grantees.get(i); - OrderedHashSet rights = - granteeObject.getAllDirectPrivileges(object); - OrderedHashSet grants = - granteeObject.getAllGrantedPrivileges(object); - - if (!grants.isEmpty()) { - grants.addAll(rights); - - rights = grants; - } - - for (int j = 0; j < rights.size(); j++) { - Right right = (Right) rights.get(j); - Right grantableRight = right.getGrantableRights(); - - row = t.getEmptyRowData(); - row[grantor] = right.getGrantor().getName().name; - row[grantee] = right.getGrantee().getName().name; - row[object_catalog] = database.getCatalogName().name; - row[object_schema] = object.getSchemaName().name; - row[object_name] = object.getName().name; - row[object_type] = - SchemaObjectSet.getName(object.getName().type); - row[privilege_type] = Tokens.T_USAGE; - row[is_grantable] = - right.getGrantee() == object.getOwner() - || grantableRight.isFull() ? Tokens.T_YES - : Tokens.T_NO; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) {} - } - } - } - - return t; - } - - /** - * SQL:2008 VIEW

    - * - * The USER_DEFINED_TYPES view has one row for each user defined type. - * Only DICTINCT TYPE user defined types are currently supported.

    - * - * Definition: - * - *

    -     *      VIEW_CATALOG    VARCHAR NULL,
    -     *      VIEW_SCHEMA     VARCHAR NULL,
    -     *      VIEW_NAME       VARCHAR NOT NULL,
    -     *      TABLE_CATALOG   VARCHAR NULL,
    -     *      TABLE_SCHEMA    VARCHAR NULL,
    -     *      TABLE_NAME      VARCHAR NOT NULL,
    -     *      COLUMN_NAME     VARCHAR NOT NULL,
    -     * 
    - * - * Description: - * - *
      - *
    1. The values of VIEW_CATALOG, VIEW_SCHEMA, and VIEW_NAME are the - * catalog name, schema name, and identifier, - * respectively, of the view being described. - * - *
    2. The values of TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, and - * COLUMN_NAME are the catalog name, schema name, - * table name, and column name, respectively, of a column - * of a table that is explicitly or implicitly referenced in the - * <query expression> of the view being described. - *
    3. Referenced routines are reported only if the user or one of its roles is - * the authorization (owner) of the referenced ROUTINE - *
    - * - * @return Table - */ - Table USER_DEFINED_TYPES(Session session, PersistentStore store) { - - Table t = sysTables[USER_DEFINED_TYPES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[USER_DEFINED_TYPES]); - - addColumn(t, "USER_DEFINED_TYPE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "USER_DEFINED_TYPE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "USER_DEFINED_TYPE_NAME", SQL_IDENTIFIER); - addColumn(t, "USER_DEFINED_TYPE_CATEGORY", SQL_IDENTIFIER); - addColumn(t, "IS_INSTANTIABLE", YES_OR_NO); - addColumn(t, "IS_FINAL", YES_OR_NO); - addColumn(t, "ORDERING_FORM", SQL_IDENTIFIER); - addColumn(t, "ORDERING_CATEGORY", SQL_IDENTIFIER); - addColumn(t, "ORDERING_ROUTINE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "ORDERING_ROUTINE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "ORDERING_ROUTINE_NAME", SQL_IDENTIFIER); - addColumn(t, "REFERENCE_TYPE", SQL_IDENTIFIER); - addColumn(t, "DATA_TYPE", CHARACTER_DATA); - addColumn(t, "CHARACTER_MAXIMUM_LENGTH", CARDINAL_NUMBER); - addColumn(t, "CHARACTER_OCTET_LENGTH", CARDINAL_NUMBER); - addColumn(t, "CHARACTER_SET_CATALOG", SQL_IDENTIFIER); - addColumn(t, "CHARACTER_SET_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "CHARACTER_SET_NAME", SQL_IDENTIFIER); - addColumn(t, "COLLATION_CATALOG", SQL_IDENTIFIER); - addColumn(t, "COLLATION_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "COLLATION_NAME", SQL_IDENTIFIER); - addColumn(t, "NUMERIC_PRECISION", CARDINAL_NUMBER); - addColumn(t, "NUMERIC_PRECISION_RADIX", CARDINAL_NUMBER); - addColumn(t, "NUMERIC_SCALE", CARDINAL_NUMBER); - addColumn(t, "DATETIME_PRECISION", CARDINAL_NUMBER); - addColumn(t, "INTERVAL_TYPE", CHARACTER_DATA); - addColumn(t, "INTERVAL_PRECISION", CARDINAL_NUMBER); - addColumn(t, "SOURCE_DTD_IDENTIFIER", CHARACTER_DATA); - addColumn(t, "REF_DTD_IDENTIFIER", CHARACTER_DATA); - addColumn(t, "DECLARED_DATA_TYPE", CHARACTER_DATA); - addColumn(t, "DECLARED_NUMERIC_PRECISION", CARDINAL_NUMBER); - addColumn(t, "DECLARED_NUMERIC_SCALE", CARDINAL_NUMBER); - addColumn(t, "MAXIMUM_CARDINALITY", CARDINAL_NUMBER); - addColumn(t, "EXTERNAL_NAME", CHARACTER_DATA); - addColumn(t, "EXTERNAL_LANGUAGE", CHARACTER_DATA); - addColumn(t, "JAVA_INTERFACE", CHARACTER_DATA); - - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[USER_DEFINED_TYPES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 4, 5, 6 - }, false); - - return t; - } - - final int user_defined_type_catalog = 0; - final int user_defined_type_schema = 1; - final int user_defined_type_name = 2; - final int user_defined_type_category = 3; - final int is_instantiable = 4; - final int is_final = 5; - final int ordering_form = 6; - final int ordering_category = 7; - final int ordering_routine_catalog = 8; - final int ordering_routine_schema = 9; - final int ordering_routine_name = 10; - final int reference_type = 11; - final int data_type = 12; - final int character_maximum_length = 13; - final int character_octet_length = 14; - final int character_set_catalog = 15; - final int character_set_schema = 16; - final int character_set_name = 17; - final int collation_catalog = 18; - final int collation_schema = 19; - final int collation_name = 20; - final int numeric_precision = 21; - final int numeric_precision_radix = 22; - final int numeric_scale = 23; - final int datetime_precision = 24; - final int interval_type = 25; - final int interval_precision = 26; - final int source_dtd_identifier = 27; - final int ref_dtd_identifier = 28; - final int declared_data_type = 29; - final int declared_numeric_precision = 30; - final int declared_numeric_scale = 31; - final int maximum_cardinality = 32; - - // - Iterator it = - database.schemaManager.databaseObjectIterator(SchemaObject.TYPE); - - while (it.hasNext()) { - Type type = (Type) it.next(); - - if (!type.isDistinctType()) { - continue; - } - - Object[] row = t.getEmptyRowData(); - - row[user_defined_type_catalog] = database.getCatalogName().name; - row[user_defined_type_schema] = type.getSchemaName().name; - row[user_defined_type_name] = type.getName().name; - row[data_type] = type.getFullNameString(); - row[user_defined_type_category] = "DISTINCT"; - row[is_instantiable] = "YES"; - row[is_final] = "YES"; - row[ordering_form] = "FULL"; - - // common type block - if (type.isCharacterType()) { - row[character_maximum_length] = - ValuePool.getLong(type.precision); - row[character_octet_length] = ValuePool.getLong(type.precision - * 2); - row[character_set_catalog] = database.getCatalogName().name; - row[character_set_schema] = - type.getCharacterSet().getSchemaName().name; - row[character_set_name] = - type.getCharacterSet().getName().name; - row[collation_catalog] = database.getCatalogName().name; - row[collation_schema] = - type.getCollation().getSchemaName().name; - row[collation_name] = type.getCollation().getName().name; - } else if (type.isNumberType()) { - row[numeric_precision] = ValuePool.getLong( - ((NumberType) type).getNumericPrecisionInRadix()); - row[declared_numeric_precision] = ValuePool.getLong( - ((NumberType) type).getNumericPrecisionInRadix()); - - if (type.isExactNumberType()) { - row[numeric_scale] = row[declared_numeric_scale] = - ValuePool.getLong(type.scale); - } - - row[numeric_precision_radix] = - ValuePool.getLong(type.getPrecisionRadix()); - } else if (type.isBooleanType()) {} - else if (type.isDateTimeType()) { - row[datetime_precision] = ValuePool.getLong(type.scale); - } else if (type.isIntervalType()) { - row[data_type] = "INTERVAL"; - row[interval_type] = IntervalType.getQualifier(type.typeCode); - row[interval_precision] = ValuePool.getLong(type.precision); - row[datetime_precision] = ValuePool.getLong(type.scale); - } else if (type.isBinaryType()) { - row[character_maximum_length] = - ValuePool.getLong(type.precision); - row[character_octet_length] = - ValuePool.getLong(type.precision); - } else if (type.isBitType()) { - row[character_maximum_length] = - ValuePool.getLong(type.precision); - row[character_octet_length] = - ValuePool.getLong(type.precision); - } else if (type.isArrayType()) { - row[maximum_cardinality] = - ValuePool.getLong(type.arrayLimitCardinality()); - row[data_type] = "ARRAY"; - } - - // end common block - row[source_dtd_identifier] = type.getDefinition(); - row[declared_data_type] = row[data_type]; - - t.insertSys(session, store, row); - } - - return t; - } - - /** - * SQL:2008 VIEW

    - * - * The VIEW_COLUMN_USAGE view has one row for each column of a - * table that is explicitly or implicitly referenced in the - * <query expression> of the view being described.

    - * - * Definition: - * - *

    -     *      VIEW_CATALOG    VARCHAR NULL,
    -     *      VIEW_SCHEMA     VARCHAR NULL,
    -     *      VIEW_NAME       VARCHAR NOT NULL,
    -     *      TABLE_CATALOG   VARCHAR NULL,
    -     *      TABLE_SCHEMA    VARCHAR NULL,
    -     *      TABLE_NAME      VARCHAR NOT NULL,
    -     *      COLUMN_NAME     VARCHAR NOT NULL,
    -     * 
    - * - * Description: - * - *
      - *
    1. The values of VIEW_CATALOG, VIEW_SCHEMA, and VIEW_NAME are the - * catalog name, schema name, and identifier, - * respectively, of the view being described. - * - *
    2. The values of TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, and - * COLUMN_NAME are the catalog name, schema name, - * table name, and column name, respectively, of a column - * of a table that is explicitly or implicitly referenced in the - * <query expression> of the view being described. - *
    3. Referenced routines are reported only if the user or one of its roles is - * the authorization (owner) of the referenced ROUTINE - *
    - * - * @return Table - */ - Table VIEW_COLUMN_USAGE(Session session, PersistentStore store) { - - Table t = sysTables[VIEW_COLUMN_USAGE]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[VIEW_COLUMN_USAGE]); - - addColumn(t, "VIEW_CATALOG", SQL_IDENTIFIER); - addColumn(t, "VIEW_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "VIEW_NAME", SQL_IDENTIFIER); - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); - - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[VIEW_COLUMN_USAGE].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 3, 4, 5, 6 - }, false); - - return t; - } - - // Calculated column values - String viewCatalog; - String viewSchema; - String viewName; - - // Intermediate holders - Iterator tables; - View view; - Table table; - Object[] row; - Iterator iterator; - - // Column number mappings - final int view_catalog = 0; - final int view_schema = 1; - final int view_name = 2; - final int table_catalog = 3; - final int table_schema = 4; - final int table_name = 5; - final int column_name = 6; - - // Initialization - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (table.isView() - && session.getGrantee().isFullyAccessibleByRole( - table.getName())) { - - // - } else { - continue; - } - - viewCatalog = database.getCatalogName().name; - viewSchema = table.getSchemaName().name; - viewName = table.getName().name; - view = (View) table; - - OrderedHashSet references = view.getReferences(); - - iterator = references.iterator(); - - while (iterator.hasNext()) { - HsqlName refName = (HsqlName) iterator.next(); - - if (refName.type != SchemaObject.COLUMN) { - continue; - } - - row = t.getEmptyRowData(); - row[view_catalog] = viewCatalog; - row[view_schema] = viewSchema; - row[view_name] = viewName; - row[table_catalog] = viewCatalog; - row[table_schema] = refName.parent.schema.name; - row[table_name] = refName.parent.name; - row[column_name] = refName.name; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) {} - } - } - - return t; - } - - /** - * SQL:2011 VIEW

    - * - * The VIEW_PERIOD_USAGE view has one row for each period contained in the - * <query expression> of a view.

    - * - * Definition - * - *

    -     *      VIEW_CATALOG    VARCHAR NOT NULL,
    -     *      VIEW_SCHEMA     VARCHAR NOT NULL,
    -     *      VIEW_NAME       VARCHAR NOT NULL,
    -     *      TABLE_CATALOG   VARCHAR NOT NULL,
    -     *      TABLE_SCHEMA    VARCHAR NOT NULL,
    -     *      TABLE_NAME      VARCHAR NOT NULL,
    -     *      PERIOD_NAME     VARCHAR NOT NULL,
    -     * 
    - * - * Description: - * - *
      - *
    1. The values of VIEW_CATALOG, VIEW_SCHEMA, and VIEW_NAME are the - * catalog name, schema name, and identifier, - * respectively, of the view being described. - * - *
    2. The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are the - * catalog name, schema name, and identifier, - * respectively, of a table containing the period that is referenced in - * the <query expression> of the view being described. - *
    3. Referenced periods are reported only if the user or one of its roles is - * the authorization (owner) of the containing TABLE - *
    - * - * @return Table - */ - Table VIEW_PERIOD_USAGE(Session session, PersistentStore store) { - - Table t = sysTables[VIEW_PERIOD_USAGE]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[VIEW_PERIOD_USAGE]); - - addColumn(t, "VIEW_CATALOG", SQL_IDENTIFIER); - addColumn(t, "VIEW_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "VIEW_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "PERIOD_NAME", SQL_IDENTIFIER); // not null - - // false PK, as VIEW_CATALOG, VIEW_SCHEMA, TABLE_CATALOG, and/or - // TABLE_SCHEMA may be NULL - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[VIEW_PERIOD_USAGE].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 3, 4, 5, 6 - }, false); - - return t; - } - - // Column number mappings - final int view_catalog = 0; - final int view_schema = 1; - final int view_name = 2; - final int table_catalog = 3; - final int table_schema = 4; - final int table_name = 5; - final int period_name = 6; - - // - Iterator tables; - Table table; - Object[] row; - - // Initialization - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (!table.isView()) { - continue; - } - - OrderedHashSet references = table.getReferences(); - - for (int i = 0; i < references.size(); i++) { - HsqlName refName = (HsqlName) references.get(i); - - if (refName.type != SchemaObject.PERIOD) { - continue; - } - - if (!session.getGrantee().isFullyAccessibleByRole(refName)) { - continue; - } - - row = t.getEmptyRowData(); - row[view_catalog] = database.getCatalogName().name; - row[view_schema] = table.getSchemaName().name; - row[view_name] = table.getName().name; - row[table_catalog] = database.getCatalogName().name; - row[table_schema] = refName.schema.name; - row[table_name] = refName.parent.name; - row[period_name] = refName.name; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) {} - } - } - - return t; - } - - /** - * SQL:2008 VIEW

    - * - * The VIEW_ROUTINE_USAGE view has one row for each SQL-invoked - * routine identified as the subject routine of either a <routine - * invocation>, a <method reference>, a <method invocation>, - * or a <static method invocation> contained in a <view - * definition>.

    - * - * Definition - * - *

    -     *      TABLE_CATALOG       VARCHAR NULL,
    -     *      TABLE_SCHEMA        VARCHAR NULL,
    -     *      TABLE_NAME          VARCHAR NOT NULL,
    -     *      SPECIFIC_CATALOG    VARCHAR NULL,
    -     *      SPECIFIC_SCHEMA     VARCHAR NULL,
    -     *      SPECIFIC_NAME       VARCHAR NOT NULL,
    -     * 
    - * - * Description - * - *
      - *
    1. The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are the - * catalog name, schema name, and identifier, - * respectively, of the viewed table being described. - * - *
    2. The values of SPECIFIC_CATALOG, SPECIFIC_SCHEMA, and SPECIFIC_NAME are - * the catalog name, schema name, and identifier, - * respectively, of the specific name of R. - *
    3. Referenced routines are reported only if the user or one of its roles is - * the authorization (owner) of the referenced ROUTINE. - *
    - * - * @return Table - */ - Table VIEW_ROUTINE_USAGE(Session session, PersistentStore store) { - - Table t = sysTables[VIEW_ROUTINE_USAGE]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[VIEW_ROUTINE_USAGE]); - - addColumn(t, "VIEW_CATALOG", SQL_IDENTIFIER); - addColumn(t, "VIEW_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "VIEW_NAME", SQL_IDENTIFIER); - addColumn(t, "SPECIFIC_CATALOG", SQL_IDENTIFIER); - addColumn(t, "SPECIFIC_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "SPECIFIC_NAME", SQL_IDENTIFIER); - - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[VIEW_ROUTINE_USAGE].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 3, 4, 5 - }, false); - - return t; - } - - // Intermediate holders - Iterator tables; - Table table; - Object[] row; - - // Column number mappings - final int view_catalog = 0; - final int view_schema = 1; - final int view_name = 2; - final int specific_catalog = 3; - final int specific_schema = 4; - final int specific_name = 5; - - // Initialization - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (!table.isView()) { - continue; - } - - OrderedHashSet set = table.getReferences(); - - for (int i = 0; i < set.size(); i++) { - HsqlName refName = (HsqlName) set.get(i); - - if (refName.type != SchemaObject.SPECIFIC_ROUTINE) { - continue; - } - - if (!session.getGrantee().isFullyAccessibleByRole(refName)) { - continue; - } - - row = t.getEmptyRowData(); - row[view_catalog] = database.getCatalogName().name; - row[view_schema] = table.getSchemaName().name; - row[view_name] = table.getName().name; - row[specific_catalog] = database.getCatalogName().name; - row[specific_schema] = refName.schema.name; - row[specific_name] = refName.name; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) {} - } - } - - return t; - } - - /** - * SQL:2008 VIEW

    - * - * The VIEW_TABLE_USAGE view has one row for each table identified - * by a <table name> simply contained in a <table reference> - * that is contained in the <query expression> of a view.

    - * - * Definition - * - *

    -     *      VIEW_CATALOG    VARCHAR NULL,
    -     *      VIEW_SCHEMA     VARCHAR NULL,
    -     *      VIEW_NAME       VARCHAR NULL,
    -     *      TABLE_CATALOG   VARCHAR NULL,
    -     *      TABLE_SCHEMA    VARCHAR NULL,
    -     *      TABLE_NAME      VARCHAR NULL,
    -     * 
    - * - * Description: - * - *
      - *
    1. The values of VIEW_CATALOG, VIEW_SCHEMA, and VIEW_NAME are the - * catalog name, schema name, and identifier, - * respectively, of the view being described. - * - *
    2. The values of TABLE_CATALOG, TABLE_SCHEMA, and TABLE_NAME are the - * catalog name, schema name, and identifier, - * respectively, of a table identified by a <table name> - * simply contained in a <table reference> that is contained in - * the <query expression> of the view being described. - *
    3. Referenced tables are reported only if the user or one of its roles is - * the authorization (owner) of the referenced TABLE - *
    - * - * @return Table - */ - Table VIEW_TABLE_USAGE(Session session, PersistentStore store) { - - Table t = sysTables[VIEW_TABLE_USAGE]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[VIEW_TABLE_USAGE]); - - addColumn(t, "VIEW_CATALOG", SQL_IDENTIFIER); - addColumn(t, "VIEW_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "VIEW_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - - // false PK, as VIEW_CATALOG, VIEW_SCHEMA, TABLE_CATALOG, and/or - // TABLE_SCHEMA may be NULL - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[VIEW_TABLE_USAGE].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 3, 4, 5 - }, false); - - return t; - } - - // Column number mappings - final int view_catalog = 0; - final int view_schema = 1; - final int view_name = 2; - final int table_catalog = 3; - final int table_schema = 4; - final int table_name = 5; - - // - Iterator tables; - Table table; - Object[] row; - - // Initialization - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (!table.isView()) { - continue; - } - - OrderedHashSet references = table.getReferences(); - - for (int i = 0; i < references.size(); i++) { - HsqlName refName = (HsqlName) references.get(i); - - if (refName.type != SchemaObject.TABLE - && refName.type != SchemaObject.VIEW) { - continue; - } - - if (!session.getGrantee().isFullyAccessibleByRole(refName)) { - continue; - } - - row = t.getEmptyRowData(); - row[view_catalog] = database.getCatalogName().name; - row[view_schema] = table.getSchemaName().name; - row[view_name] = table.getName().name; - row[table_catalog] = database.getCatalogName().name; - row[table_schema] = refName.schema.name; - row[table_name] = refName.name; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) {} - } - } - - return t; - } - - /** - * SQL:2008 VIEW

    - * - * The VIEWS view contains one row for each VIEW definition.

    - * - * Each row is a description of the query expression that defines its view, - * with the following columns: - * - *

    -     *      TABLE_CATALOG    VARCHAR     name of view's defining catalog.
    -     *      TABLE_SCHEMA     VARCHAR     name of view's defining schema.
    -     *      TABLE_NAME       VARCHAR     the simple name of the view.
    -     *      VIEW_DEFINITION  VARCHAR     the character representation of the
    -     *                                   <query expression> contained in the
    -     *                                   corresponding <view descriptor>.
    -     *      CHECK_OPTION     VARCHAR     {"CASCADED" | "LOCAL" | "NONE"}
    -     *      IS_UPDATABLE     VARCHAR     {"YES" | "NO"}
    -     *      INSERTABLE_INTO VARCHAR      {"YES" | "NO"}
    -     *      IS_TRIGGER_UPDATABLE        VARCHAR  {"YES" | "NO"}
    -     *      IS_TRIGGER_DELETEABLE       VARCHAR  {"YES" | "NO"}
    -     *      IS_TRIGGER_INSERTABLE_INTO  VARCHAR  {"YES" | "NO"}
    -     * 

    - * - * @return a tabular description of the text source of all - * View objects accessible to - * the user. - */ - Table VIEWS(Session session, PersistentStore store) { - - Table t = sysTables[VIEWS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[VIEWS]); - - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "VIEW_DEFINITION", CHARACTER_DATA); // not null - addColumn(t, "CHECK_OPTION", CHARACTER_DATA); // not null - addColumn(t, "IS_UPDATABLE", YES_OR_NO); // not null - addColumn(t, "INSERTABLE_INTO", YES_OR_NO); // not null - addColumn(t, "IS_TRIGGER_UPDATABLE", YES_OR_NO); // not null - addColumn(t, "IS_TRIGGER_DELETABLE", YES_OR_NO); // not null - addColumn(t, "IS_TRIGGER_INSERTABLE_INTO", YES_OR_NO); // not null - - // order TABLE_NAME - // added for unique: TABLE_SCHEMA, TABLE_CATALOG - // false PK, as TABLE_SCHEMA and/or TABLE_CATALOG may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[VIEWS].name, false, SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 1, 2, 0 - }, false); - - return t; - } - - Iterator tables; - Table table; - Object[] row; - final int table_catalog = 0; - final int table_schema = 1; - final int table_name = 2; - final int view_definition = 3; - final int check_option = 4; - final int is_updatable = 5; - final int insertable_into = 6; - final int is_trigger_updatable = 7; - final int is_trigger_deletable = 8; - final int is_trigger_insertable_into = 9; - - tables = allTables(); - - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (!table.isView() - && table.getSchemaName() - != SqlInvariants.INFORMATION_SCHEMA_HSQLNAME) { - continue; - } - - if (!session.getGrantee().isAccessible(table)) { - continue; - } - - row = t.getEmptyRowData(); - row[table_catalog] = database.getCatalogName().name; - row[table_schema] = table.getSchemaName().name; - row[table_name] = table.getName().name; - - String check = Tokens.T_NONE; - - if (table instanceof View) { - if (session.getGrantee().isFullyAccessibleByRole( - table.getName())) { - row[view_definition] = ((View) table).getStatement(); - } - - switch (((View) table).getCheckOption()) { - - case SchemaObject.ViewCheckModes.CHECK_NONE : - break; - - case SchemaObject.ViewCheckModes.CHECK_LOCAL : - check = Tokens.T_LOCAL; - break; - - case SchemaObject.ViewCheckModes.CHECK_CASCADE : - check = Tokens.T_CASCADED; - break; - } - } - - row[check_option] = check; - row[is_updatable] = table.isUpdatable() ? Tokens.T_YES - : Tokens.T_NO; - row[insertable_into] = table.isInsertable() ? Tokens.T_YES - : Tokens.T_NO; - row[is_trigger_updatable] = table.isTriggerUpdatable() - ? Tokens.T_YES - : Tokens.T_NO; - row[is_trigger_deletable] = table.isTriggerDeletable() - ? Tokens.T_YES - : Tokens.T_NO; - row[is_trigger_insertable_into] = table.isTriggerInsertable() - ? Tokens.T_YES - : Tokens.T_NO; - - t.insertSys(session, store, row); - } - - return t; - } - -//------------------------------------------------------------------------------ -// SQL SCHEMATA BASE TABLES - - /** - * ROLE_AUTHORIZATION_DESCRIPTORS

    - * - * Contains a representation of all role authorization descriptors.

    - * Definition - * - *

    -     *      ROLE_NAME     VARCHAR     name of role.
    -     *      GRANTEE       VARCHAR     name of grantee.
    -     *      GRANTOR       VARCHAR     name of grantor.
    -     *      IS_GRANTABLE  VARCHAR     YES or NO
    -     * 
    - * - * Description - * - *
      - *
    1. The value of ROLE_NAME is the <role name> of some - * <role granted> by the <grant role statement> or - * the <role name> of a <role definition>. - * - *
    2. The value of GRANTEE is an <authorization identifier>, - * possibly PUBLIC, or <role name> specified as a - * <grantee> contained in a <grant role statement>, - * or the <authorization identifier> of the current - * SQLsession when the <role definition> is executed. - * - *
    3. The value of GRANTOR is the <authorization identifier> - * of the user or role who granted the role identified by - * ROLE_NAME to the user or role identified by the value of - * GRANTEE. - * - *
    4. The values of IS_GRANTABLE have the following meanings:
      - * - * YES : The described role is grantable.
      - * NO : The described role is not grantable. - *
    - * - * @return Table - */ - Table ROLE_AUTHORIZATION_DESCRIPTORS(Session session, - PersistentStore store) { - - Table t = sysTables[ROLE_AUTHORIZATION_DESCRIPTORS]; - - if (t == null) { - t = createBlankTable( - sysTableHsqlNames[ROLE_AUTHORIZATION_DESCRIPTORS]); - - addColumn(t, "ROLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "GRANTEE", SQL_IDENTIFIER); // not null - addColumn(t, "GRANTOR", SQL_IDENTIFIER); // not null - addColumn(t, "IS_GRANTABLE", YES_OR_NO); // not null - - // true PK - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[ROLE_AUTHORIZATION_DESCRIPTORS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1 - }, true); - - return t; - } - - // Intermediate holders - String grantorName = SqlInvariants.SYSTEM_AUTHORIZATION_NAME; - Iterator grantees; - Grantee granteeObject; - String granteeName; - Iterator roles; - String isGrantable; - Object[] row; - - // Column number mappings - final int role_name = 0; - final int grantee = 1; - final int grantor = 2; - final int is_grantable = 3; - - // Initialization - grantees = session.getGrantee().visibleGrantees().iterator(); - - // - while (grantees.hasNext()) { - granteeObject = (Grantee) grantees.next(); - granteeName = granteeObject.getName().getNameString(); - roles = granteeObject.getDirectRolesWithPublic().iterator(); - isGrantable = granteeObject.isAdmin() ? Tokens.T_YES - : Tokens.T_NO; - - while (roles.hasNext()) { - Grantee role = (Grantee) roles.next(); - - row = t.getEmptyRowData(); - row[role_name] = role.getName().getNameString(); - row[grantee] = granteeName; - row[grantor] = grantorName; - row[is_grantable] = isGrantable; - - t.insertSys(session, store, row); - } - } - - return t; - } -} diff --git a/database/hsqldb/src/org/hsqldb/dbinfo/DatabaseInformationMain.java b/database/hsqldb/src/org/hsqldb/dbinfo/DatabaseInformationMain.java deleted file mode 100644 index ffd74185..00000000 --- a/database/hsqldb/src/org/hsqldb/dbinfo/DatabaseInformationMain.java +++ /dev/null @@ -1,3742 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.dbinfo; - -import org.hsqldb.ColumnSchema; -import org.hsqldb.Constraint; -import org.hsqldb.Database; -import org.hsqldb.HsqlException; -import org.hsqldb.HsqlNameManager; -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.NumberSequence; -import org.hsqldb.Routine; -import org.hsqldb.RoutineSchema; -import org.hsqldb.SchemaObject; -import org.hsqldb.Session; -import org.hsqldb.SqlInvariants; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.Tokens; -import org.hsqldb.TypeInvariants; -import org.hsqldb.index.Index; -import org.hsqldb.lib.HashSet; -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.OrderedHashSet; -import org.hsqldb.lib.WrapperIterator; -import org.hsqldb.map.ValuePool; -import org.hsqldb.persist.HsqlDatabaseProperties; -import org.hsqldb.persist.HsqlProperties; -import org.hsqldb.persist.HsqlProperties.PropertyMeta; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.rights.GrantConstants; -import org.hsqldb.rights.Grantee; -import org.hsqldb.rights.GranteeManager; -import org.hsqldb.rights.Right; -import org.hsqldb.rights.User; -import org.hsqldb.types.Charset; -import org.hsqldb.types.DateTimeType; -import org.hsqldb.types.IntervalType; -import org.hsqldb.types.NumberType; -import org.hsqldb.types.Type; -import org.hsqldb.types.Types; - -// fredt@users - 1.7.2 - structural modifications to allow inheritance -// campbell-burnet@users - 1.7.2 - 20020225 -// - factored out all reusable code into DIXXX support classes -// - completed Fred's work on allowing inheritance -// campbell-burnet@users - 1.7.2 - 20020304 - bug fixes, refinements, better java docs -// fredt@users - 1.8.0 - updated to report latest enhancements and changes -// campbell-burnet@users 20051207 - patch 1.8.x initial JDBC 4.0 support work -// Revision 1.9 2006/07/12 11:36:59 boucherb -// - JDBC 4.0, Mustang b87: support for new DatabaseMetaData.getColumns() IS_AUTOINCREMENT result column -// - minor javadoc and code comment updates - -/** - * Provides definitions for a few of the SQL Standard Schemata views that are - * supported by HSQLDB.

    - * - * Provides definitions for some of HSQLDB's additional system view. - * - * The views supported in this class are mainly those that are needed - * to build the ResultSet objects that are returned by JDBC DatabaseMetaData - * calls.

    - * - * The definitions for the rest of SQL standard and HSQLDB specific system views - * are provided by DatabaseInformationFull, which extends this class.

    - * - * Produces a collection of views that form the system data dictionary.

    - * - * Implementations use a group of arrays of equal size to store various - * attributes or cached instances of system tables.

    - * - * Two fixed static lists of reserved table names are kept in String[] and - * HsqlName[] forms. These are shared by all implementations of - * DatabaseInformtion.

    - * - * Each implementation keeps a lookup set of names for those tables whose - * contents are never cached (nonCachedTablesSet).

    - * - * An instance of this class uses three lists named sysTablexxxx for caching - * system tables.

    - * - * sysTableSessionDependent indicates which tables contain data that is - * dependent on the user rights of the User associated with the Session.

    - * - * sysTableSessions contains the Session with whose rights each cached table - * was built.

    - * - * sysTables contains the cached tables.

    - * - * At the time of instantiation, which is part of the Database.open() method - * invocation, an empty table is created and placed in sysTables with calls to - * generateTable(int) for each name in sysTableNames. Some of these - * table entries may be null if an implementation does not produce them.

    - * - * Calls to setStore(String, Session) return a cached table if various - * caching rules are met (see below), or it will delete all rows of the table - * and rebuild the contents via generateTable(int).

    - * - * generateTable(int) calls the appropriate single method for each table. - * These methods either build and return an empty table (if sysTables - * contains null for the table slot) or populate the table with up-to-date - * rows.

    - * - * Rules for caching are applied as follows:

    - * - * If a table has non-cached contents, its contents are cleared and - * rebuilt.

    - * - * For the rest of the tables, if the table has not been built for the Session - * object or it is out of date, the table contents are cleared and rebuilt.

    - * - * (fredt@users)

    - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.7.2 - */ -class DatabaseInformationMain extends DatabaseInformation { - - static Type CARDINAL_NUMBER = TypeInvariants.CARDINAL_NUMBER; - static Type YES_OR_NO = TypeInvariants.YES_OR_NO; - static Type CHARACTER_DATA = TypeInvariants.CHARACTER_DATA; - static Type SQL_IDENTIFIER = TypeInvariants.SQL_IDENTIFIER; - static Type TIME_STAMP = TypeInvariants.TIME_STAMP; - - /** The HsqlNames of the system tables. */ - protected static final HsqlName[] sysTableHsqlNames; - - /** true if the contents of a cached system table depends on the session */ - protected static final boolean[] sysTableSessionDependent = - new boolean[sysTableNames.length]; - - /** Set: { names of system tables that are not to be cached } */ - protected static final HashSet nonCachedTablesSet; - - /** The table types HSQLDB supports. */ - protected static final String[] tableTypes = new String[] { - "GLOBAL TEMPORARY", "SYSTEM TABLE", "TABLE", "VIEW" - }; - - /* Provides naming support. */ - static { - synchronized (DatabaseInformationMain.class) { - nonCachedTablesSet = new HashSet(); - sysTableHsqlNames = new HsqlName[sysTableNames.length]; - - for (int i = 0; i < sysTableNames.length; i++) { - sysTableHsqlNames[i] = - HsqlNameManager.newInfoSchemaTableName(sysTableNames[i]); - sysTableHsqlNames[i].schema = - SqlInvariants.INFORMATION_SCHEMA_HSQLNAME; - sysTableSessionDependent[i] = true; - } - - // build the set of non-cached tables - nonCachedTablesSet.add("SYSTEM_CACHEINFO"); - nonCachedTablesSet.add("SYSTEM_SESSIONINFO"); - nonCachedTablesSet.add("SYSTEM_SESSIONS"); - nonCachedTablesSet.add("SYSTEM_PROPERTIES"); - nonCachedTablesSet.add("SYSTEM_SEQUENCES"); - nonCachedTablesSet.add("SYSTEM_INDEXSTATS"); - nonCachedTablesSet.add("SYSTEM_TABLESTATS"); - } - } - - /** cache of system tables */ - protected final Table[] sysTables = new Table[sysTableNames.length]; - - /** - * Constructs a table producer which provides system tables - * for the specified Database object.

    - * - * Note: before 1.7.2 Alpha N, it was important to observe that - * by specifying an instance of this class or one of its descendants to - * handle system table production, the new set of builtin permissions - * and aliases would overwrite those of an existing database, meaning that - * metadata reporting might have been rendered less secure if the same - * database were then opened again using a lower numbered system table - * producer instance (i.e. one in a 1.7.1 or earlier distribution). - * As of 1.7.2 Alpha N, system-generated permissions and aliases are no - * longer recorded in the checkpoint script, obsoleting this issue. - * Checkpointing of system-generated grants and aliases was removed - * because their existence is very close to a core requirement for correct - * operation and they are reintroduced to the system at each startup. - * In a future release, it may even be an exception condition to attempt - * to remove or alter system-generated grants and aliases, - * respectively.

    - * - * @param db the Database object for which this object - * produces system tables - */ - DatabaseInformationMain(Database db) { - - super(db); - - Session session = db.sessionManager.getSysSession(); - - init(session); - } - - protected final void addColumn(Table t, String name, Type type) { - - HsqlName cn; - ColumnSchema c; - - cn = HsqlNameManager.newInfoSchemaColumnName(name, t.getName()); - c = new ColumnSchema(cn, type, true, false, null); - - t.addColumn(c); - } - - /** - * Retrieves an enumeration over all of the tables in this database. - * This means all user tables, views, system tables, system views, - * including temporary and text tables.

    - * - * @return an enumeration over all of the tables in this database - */ - protected final Iterator allTables() { - - return new WrapperIterator( - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE), - new WrapperIterator(sysTables, true)); - } - - /** - * Retrieves the system table corresponding to the specified - * tableIndex value.

    - * - * @param tableIndex int value identifying the system table to generate - * @return the system table corresponding to the specified tableIndex value - */ - protected Table generateTable(Session session, PersistentStore store, - int tableIndex) { - -// Please note that this class produces non-null tables for -// just those absolutely essential to the JDBC 1 spec and the -// HSQLDB core. Also, all table producing methods except -// SYSTEM_PROCEDURES() and SYSTEM_PROCEDURECOLUMNS() are declared final; -// this class produces only an empty table for each, as per previous -// DatabaseInformation implementations, whereas -// DatabaseInformationFull produces comprehensive content for -// them). -// -// This break down of inheritance allows DatabaseInformation and -// DatabaseInformationMain (this class) to be made as small as possible -// while still meeting their mandates: -// -// 1.) DatabaseInformation prevents use of reserved system table names -// for user tables and views, meaning that even under highly -// constrained use cases where the notion of DatabaseMetaData can -// be discarded (i.e. the engine operates in a distribution where -// DatabaseInformationMain/Full and JDBCDatabaseMetaData have been -// dropped from the JAR), it is still impossible to produce a -// database which will be incompatible in terms of system table <=> -// user table name clashes, if/when imported into a more -// capable operating environment. -// -// 2.) DatabaseInformationMain builds on DatabaseInformation, providing -// at minimum what is needed for comprehensive operation under -// JDK 1.1/JDBC 1 and provides, at minimum, what was provided under -// earlier implementations. -// -// 3.) descendants of DatabaseInformationMain (such as the current -// DatabaseInformationFull) need not (and indeed: now cannot) -// override most of the DatabaseInformationMain table producing -// methods, as for the most part they are expected to be already -// fully comprehensive, security aware and accessible to all users. - switch (tableIndex) { - - case SYSTEM_BESTROWIDENTIFIER : - return SYSTEM_BESTROWIDENTIFIER(session, store); - - case SYSTEM_COLUMNS : - return SYSTEM_COLUMNS(session, store); - - case SYSTEM_CONNECTION_PROPERTIES : - return SYSTEM_CONNECTION_PROPERTIES(session, store); - - case SYSTEM_CROSSREFERENCE : - return SYSTEM_CROSSREFERENCE(session, store); - - case SYSTEM_INDEXINFO : - return SYSTEM_INDEXINFO(session, store); - - case SYSTEM_PRIMARYKEYS : - return SYSTEM_PRIMARYKEYS(session, store); - - case SYSTEM_PROCEDURECOLUMNS : - return SYSTEM_PROCEDURECOLUMNS(session, store); - - case SYSTEM_PROCEDURES : - return SYSTEM_PROCEDURES(session, store); - - case SYSTEM_SCHEMAS : - return SYSTEM_SCHEMAS(session, store); - - case SYSTEM_SEQUENCES : - return SYSTEM_SEQUENCES(session, store); - - case SYSTEM_TABLES : - return SYSTEM_TABLES(session, store); - - case SYSTEM_TABLETYPES : - return SYSTEM_TABLETYPES(session, store); - - case SYSTEM_TYPEINFO : - return SYSTEM_TYPEINFO(session, store); - - case SYSTEM_USERS : - return SYSTEM_USERS(session, store); - - case SYSTEM_UDTATTRIBUTES : - return SYSTEM_UDTATTRIBUTES(session, store); - - case SYSTEM_UDTS : - return SYSTEM_UDTS(session, store); - - case SYSTEM_VERSIONCOLUMNS : - return SYSTEM_VERSIONCOLUMNS(session, store); - - case COLUMN_PRIVILEGES : - return COLUMN_PRIVILEGES(session, store); - - case SEQUENCES : - return SEQUENCES(session, store); - - case TABLE_PRIVILEGES : - return TABLE_PRIVILEGES(session, store); - - case INFORMATION_SCHEMA_CATALOG_NAME : - return INFORMATION_SCHEMA_CATALOG_NAME(session, store); - - default : - return null; - } - } - - /** - * One time initialisation of instance attributes - * at construction time. - * - */ - protected final void init(Session session) { - - // flag the Session-dependent cached tables - Table t; - - for (int i = 0; i < sysTables.length; i++) { - t = sysTables[i] = generateTable(session, null, i); - - if (t != null) { - t.setDataReadOnly(true); - } - } - - GranteeManager gm = database.getGranteeManager(); - Right right = new Right(); - - right.set(GrantConstants.SELECT, null); - - for (int i = 0; i < sysTableHsqlNames.length; i++) { - if (sysTables[i] != null) { - gm.grantSystemToPublic(sysTables[i], right); - } - } - - right = Right.fullRights; - - gm.grantSystemToPublic(Charset.SQL_CHARACTER, right); - gm.grantSystemToPublic(Charset.SQL_IDENTIFIER_CHARSET, right); - gm.grantSystemToPublic(Charset.SQL_TEXT, right); - gm.grantSystemToPublic(TypeInvariants.SQL_IDENTIFIER, right); - gm.grantSystemToPublic(TypeInvariants.YES_OR_NO, right); - gm.grantSystemToPublic(TypeInvariants.TIME_STAMP, right); - gm.grantSystemToPublic(TypeInvariants.CARDINAL_NUMBER, right); - gm.grantSystemToPublic(TypeInvariants.CHARACTER_DATA, right); - } - - /** - * Retrieves whether any form of SQL access is allowed against the - * the specified table w.r.t the database access rights - * assigned to current Session object's User.

    - * - * @return true if the table is accessible, else false - * @param object the schmea object for which to check accessibility - */ - private boolean isAccessible(Session session, SchemaObject object) { - return session.getGrantee().isAccessible(object); - } - - /** - * Creates a new primoidal system table with the specified name.

    - * - * @return a new system table - * @param name of the table - */ - protected final Table createBlankTable(HsqlName name) { - - return new Table(database, name, TableBase.INFO_SCHEMA_TABLE); - } - - /** - * Retrieves the system Table object corresponding to - * the given name and session arguments.

    - * - * @param session the Session object requesting the table - * @param name a String identifying the desired table - * database access error occurs - * @return a system table corresponding to the name and - * session arguments - */ - public final Table getSystemTable(Session session, String name) { - - Table t; - int tableIndex; - - if (!isSystemTable(name)) { - return null; - } - - tableIndex = getSysTableID(name); - t = sysTables[tableIndex]; - - // fredt - any system table that is not supported will be null here - if (t == null) { - return t; - } - - // At the time of opening the database, no content is needed. - // However, table structure is required at this - // point to allow processing logged View defn's against system - // tables - if (!withContent) { - return t; - } - - return t; - } - - public boolean isNonCachedTable(String name) { - return nonCachedTablesSet.contains(name); - } - - public final void setStore(Session session, Table table, - PersistentStore store) { - - long dbscts = database.schemaManager.getSchemaChangeTimestamp(); - - if (store.getTimestamp() == dbscts - && !isNonCachedTable(table.getName().name)) { - return; - } - - // fredt - clear the contents of table and generate - store.removeAll(); - store.setTimestamp(dbscts); - - int tableIndex = getSysTableID(table.getName().name); - - generateTable(session, store, tableIndex); - } - - /** - * Retrieves a Table object describing the optimal - * set of visible columns that uniquely identifies a row - * for each accessible table defined within this database.

    - * - * Each row describes a single column of the best row identifier column - * set for a particular table. Each row has the following - * columns: - * - *

    -     * SCOPE          SMALLINT  scope of applicability
    -     * COLUMN_NAME    VARCHAR   simple name of the column
    -     * DATA_TYPE      SMALLINT  SQL data type from Types
    -     * TYPE_NAME      VARCHAR   canonical type name
    -     * COLUMN_SIZE    INTEGER   precision
    -     * BUFFER_LENGTH  INTEGER   transfer size in bytes, if definitely known
    -     * DECIMAL_DIGITS SMALLINT  scale  - fixed # of decimal digits
    -     * PSEUDO_COLUMN  SMALLINT  is this a pseudo column like an Oracle ROWID?
    -     * TABLE_CAT      VARCHAR   table catalog
    -     * TABLE_SCHEM    VARCHAR   simple name of table schema
    -     * TABLE_NAME     VARCHAR   simple table name
    -     * NULLABLE       SMALLINT  is column nullable?
    -     * IN_KEY         BOOLEAN   column belongs to a primary or alternate key?
    -     * 

    - * - * Notes:

    - * - * JDBCDatabaseMetaData.getBestRowIdentifier uses its - * nullable parameter to filter the rows of this table in the following - * manner:

    - * - * If the nullable parameter is false, then rows are reported - * only if, in addition to satisfying the other specified filter values, - * the IN_KEY column value is TRUE. If the nullable parameter is - * true, then the IN_KEY column value is ignored.

    - * - * There is not yet infrastructure in place to make some of the ranking - * decisions described below, and it is anticipated that mechanisms - * upon which cost decisions could be based will change significantly over - * the next few releases. Hence, in the interest of simplicity and of not - * making overly complex dependency on features that will almost certainly - * change significantly in the near future, the current implementation, - * while perfectly adequate for all but the most demanding or exacting - * purposes, is actually sub-optimal in the strictest sense.

    - * - * A description of the current implementation follows:

    - * - * DEFINTIONS:

    - * - * Alternate key - * - *

      - *
    • An attribute of a table that, by virtue of its having a set of - * columns that are both the full set of columns participating in a - * unique constraint or index and are all not null, yields the same - * selectability characteristic that would obtained by declaring a - * primary key on those same columns. - *

    - * - * Column set performance ranking - * - *

      - *
    • The ranking of the expected average performance w.r.t a subset of - * a table's columns used to select and/or compare rows, as taken in - * relation to all other distinct candidate subsets under - * consideration. This can be estimated by comparing each candidate - * subset in terms of total column count, relative performance of - * comparisons amongst the domains of the columns and differences - * in other costs involved in the execution plans generated using - * each subset under consideration for row selection/comparison. - *

    - * - * - * Rules:

    - * - * Given the above definitions, the rules currently in effect for reporting - * best row identifier are as follows, in order of precedence: - * - *

      - *
    1. if the table under consideration has a primary key constraint, then - * the columns of the primary key are reported, with no consideration - * given to the column set performance ranking over the set of - * candidate keys. Each row has its IN_KEY column set to TRUE. - * - *
    2. if 1.) does not hold, then if there exits one or more alternate - * keys, then the columns of the alternate key with the lowest column - * count are reported, with no consideration given to the column set - * performance ranking over the set of candidate keys. If there - * exists a tie for lowest column count, then the columns of the - * first such key encountered are reported. - * Each row has its IN_KEY column set to TRUE. - * - *
    3. if both 1.) and 2.) do not hold, then, if possible, a unique - * constraint/index is selected from the set of unique - * constraints/indices containing at least one column having - * a not null constraint, with no consideration given to the - * column set performance ranking over the set of all such - * candidate column sets. If there exists a tie for lowest non-zero - * count of columns having a not null constraint, then the columns - * of the first such encountered candidate set are reported. Each - * row has its IN_KEY column set to FALSE. - * - *
    4. Finally, if the set of candidate column sets in 3.) is the empty, - * then no column set is reported for the table under consideration. - *

    - * - * The scope reported for a best row identifier column set is determined - * thus: - * - *

      - *
    1. if the database containing the table under consideration is in - * read-only mode or the table under consideration is GLOBAL TEMPORARY - * (a TEMP or TEMP TEXT table, in HSQLDB parlance), then the scope - * is reported as - * java.sql.DatabaseMetaData.bestRowSession. - * - *
    2. if 1.) does not hold, then the scope is reported as - * java.sql.DatabaseMetaData.bestRowTemporary. - *

    - * - * @return a Table object describing the optimal - * set of visible columns that uniquely identifies a row - * for each accessible table defined within this database - */ - final Table SYSTEM_BESTROWIDENTIFIER(Session session, - PersistentStore store) { - - Table t = sysTables[SYSTEM_BESTROWIDENTIFIER]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_BESTROWIDENTIFIER]); - - addColumn(t, "SCOPE", Type.SQL_SMALLINT); // not null - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_SIZE", Type.SQL_INTEGER); - addColumn(t, "BUFFER_LENGTH", Type.SQL_INTEGER); - addColumn(t, "DECIMAL_DIGITS", Type.SQL_SMALLINT); - addColumn(t, "PSEUDO_COLUMN", Type.SQL_SMALLINT); // not null - addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "NULLABLE", Type.SQL_SMALLINT); // not null - addColumn(t, "IN_KEY", Type.SQL_BOOLEAN); // not null - - // order: SCOPE - // for unique: TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME - // false PK, as TABLE_CAT and/or TABLE_SCHEM may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_BESTROWIDENTIFIER].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 8, 9, 10, 1 - }, false); - - return t; - } - - // calculated column values - Integer scope; // { temp, transaction, session } - Integer pseudo; - - //------------------------------------------- - // required for restriction of results via - // DatabaseMetaData filter parameters, but - // not actually required to be included in - // DatabaseMetaData.getBestRowIdentifier() - // result set - //------------------------------------------- - String tableCatalog; // table catalog - String tableSchema; // table schema - String tableName; // table name - Boolean inKey; // column participates in PK or AK? - - //------------------------------------------- - /* - * @todo - Maybe include: - backing index (constraint) name? - * - column sequence in index (constraint)? - */ - - //------------------------------------------- - // Intermediate holders - Iterator tables; - Table table; - DITableInfo ti; - int[] cols; - Object[] row; - HsqlProperties p; - - // Column number mappings - final int iscope = 0; - final int icolumn_name = 1; - final int idata_type = 2; - final int itype_name = 3; - final int icolumn_size = 4; - final int ibuffer_length = 5; - final int idecimal_digits = 6; - final int ipseudo_column = 7; - final int itable_cat = 8; - final int itable_schem = 9; - final int itable_name = 10; - final int inullable = 11; - final int iinKey = 12; - - // Initialization - ti = new DITableInfo(); - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - boolean translateTTI = database.sqlTranslateTTI; - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - /* @todo - requires access to the actual columns */ - if (table.isView() || !isAccessible(session, table)) { - continue; - } - - cols = table.getBestRowIdentifiers(); - - if (cols == null) { - continue; - } - - ti.setTable(table); - - inKey = table.isBestRowIdentifiersStrict() ? Boolean.TRUE - : Boolean.FALSE; - tableCatalog = table.getCatalogName().name; - tableSchema = table.getSchemaName().name; - tableName = table.getName().name; - - Type[] types = table.getColumnTypes(); - - scope = ti.getBRIScope(); - pseudo = ti.getBRIPseudo(); - - for (int i = 0; i < cols.length; i++) { - ColumnSchema column = table.getColumn(i); - Type type = types[i]; - - if (translateTTI) { - if (type.isIntervalType()) { - type = ((IntervalType) type).getCharacterType(); - } - } - - row = t.getEmptyRowData(); - row[iscope] = scope; - row[icolumn_name] = column.getName().name; - row[idata_type] = ValuePool.getInt(type.getJDBCTypeCode()); - row[itype_name] = type.getNameString(); - row[icolumn_size] = ValuePool.getInt(type.getJDBCPrecision()); - row[ibuffer_length] = null; - row[idecimal_digits] = type.acceptsScale() - ? ValuePool.getInt(type.getJDBCScale()) - : null; - row[ipseudo_column] = pseudo; - row[itable_cat] = tableCatalog; - row[itable_schem] = tableSchema; - row[itable_name] = tableName; - row[inullable] = ValuePool.getInt(column.getNullability()); - row[iinKey] = inKey; - - t.insertSys(session, store, row); - } - } - - return t; - } - - /** - * Retrieves a Table object describing the - * visible columns of all accessible tables defined - * within this database.

    - * - * Each row is a column description with the following columns: - * - *

    -     * TABLE_CAT         VARCHAR   table catalog
    -     * TABLE_SCHEM       VARCHAR   table schema
    -     * TABLE_NAME        VARCHAR   table name
    -     * COLUMN_NAME       VARCHAR   column name
    -     * DATA_TYPE         SMALLINT  SQL type from DITypes
    -     * TYPE_NAME         VARCHAR   canonical type name
    -     * COLUMN_SIZE       INTEGER   column size (length/precision)
    -     * BUFFER_LENGTH     INTEGER   transfer size in bytes, if definitely known
    -     * DECIMAL_DIGITS    INTEGER   # of fractional digits (scale)
    -     * NUM_PREC_RADIX    INTEGER   Radix
    -     * NULLABLE          INTEGER   is NULL allowed? (from DatabaseMetaData)
    -     * REMARKS           VARCHAR   comment describing column
    -     * COLUMN_DEF        VARCHAR   default value (possibly expression) for the
    -     *                             column, which should be interpreted as a
    -     *                             string when the value is enclosed in quotes
    -     *                             (may be null)
    -     * SQL_DATA_TYPE     VARCHAR   type code as expected in the SQL CLI SQLDA
    -     * SQL_DATETIME_SUB  INTEGER   the SQL CLI subtype for DATETIME types
    -     * CHAR_OCTET_LENGTH INTEGER   for char types, max # of chars/bytes in column
    -     * ORDINAL_POSITION  INTEGER   1-based index of column in table
    -     * IS_NULLABLE       VARCHAR   is column nullable? ("YES"|"NO"|""}
    -     * SCOPE_CATLOG      VARCHAR   catalog of REF attribute scope table
    -     * SCOPE_SCHEMA      VARCHAR   schema of REF attribute scope table
    -     * SCOPE_TABLE       VARCHAR   name of REF attribute scope table
    -     * SOURCE_DATA_TYPE  SMALLINT  source type of REF attribute
    -     * TYPE_SUB          INTEGER   HSQLDB data subtype code
    -     * 

    - * - * @return a Table object describing the - * visible columns of all accessible - * tables defined within this database. - */ - final Table SYSTEM_COLUMNS(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_COLUMNS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_COLUMNS]); - - addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); // 0 - addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); // 1 - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_SIZE", Type.SQL_INTEGER); // 6 - addColumn(t, "BUFFER_LENGTH", Type.SQL_INTEGER); // 7 - addColumn(t, "DECIMAL_DIGITS", Type.SQL_INTEGER); // 8 - addColumn(t, "NUM_PREC_RADIX", Type.SQL_INTEGER); // 9 - addColumn(t, "NULLABLE", Type.SQL_INTEGER); // not null - addColumn(t, "REMARKS", CHARACTER_DATA); // 11 - addColumn(t, "COLUMN_DEF", CHARACTER_DATA); // 12 - addColumn(t, "SQL_DATA_TYPE", Type.SQL_INTEGER); // 13 - addColumn(t, "SQL_DATETIME_SUB", Type.SQL_INTEGER); // 14 - addColumn(t, "CHAR_OCTET_LENGTH", Type.SQL_INTEGER); // 15 - addColumn(t, "ORDINAL_POSITION", Type.SQL_INTEGER); // not null - addColumn(t, "IS_NULLABLE", YES_OR_NO); // not null - addColumn(t, "SCOPE_CATALOG", SQL_IDENTIFIER); // 18 - addColumn(t, "SCOPE_SCHEMA", SQL_IDENTIFIER); // 19 - addColumn(t, "SCOPE_TABLE", SQL_IDENTIFIER); // 20 - addColumn(t, "SOURCE_DATA_TYPE", Type.SQL_SMALLINT); // 21 - - // ---------------------------------------------------------------- - // JDBC 4.0 - added Mustang b86 - // ---------------------------------------------------------------- - addColumn(t, "IS_AUTOINCREMENT", YES_OR_NO); // 22 - - // ---------------------------------------------------------------- - // JDBC 4.1 - // ---------------------------------------------------------------- - addColumn(t, "IS_GENERATEDCOLUMN", YES_OR_NO); // 23 - - // order: TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION - // added for unique: TABLE_CAT - // false PK, as TABLE_SCHEM and/or TABLE_CAT may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_COLUMNS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 16 - }, false); - - return t; - } - - // calculated column values - String tableCatalog; - String tableSchema; - String tableName; - - // intermediate holders - int columnCount; - Iterator tables; - Table table; - Object[] row; - DITableInfo ti; - - // column number mappings - final int itable_cat = 0; - final int itable_schem = 1; - final int itable_name = 2; - final int icolumn_name = 3; - final int idata_type = 4; - final int itype_name = 5; - final int icolumn_size = 6; - final int ibuffer_length = 7; - final int idecimal_digits = 8; - final int inum_prec_radix = 9; - final int inullable = 10; - final int iremark = 11; - final int icolumn_def = 12; - final int isql_data_type = 13; - final int isql_datetime_sub = 14; - final int ichar_octet_length = 15; - final int iordinal_position = 16; - final int iis_nullable = 17; - final int iscope_cat = 18; - final int iscope_schem = 19; - final int iscope_table = 20; - final int isource_data_type = 21; - - // JDBC 4.0 - final int iis_autoinc = 22; - - // JDBC 4.1 - final int iis_generated = 23; - - // Initialization - tables = allTables(); - ti = new DITableInfo(); - - boolean translateTTI = database.sqlTranslateTTI; - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - /* requires access to the actual columns */ - OrderedHashSet colNameSet = - session.getGrantee().getColumnsForAllPrivileges(table); - - if (!isAccessible(session, table)) { - continue; - } - - ti.setTable(table); - - tableCatalog = table.getCatalogName().name; - tableSchema = table.getSchemaName().name; - tableName = table.getName().name; - columnCount = table.getColumnCount(); - - for (int i = 0; i < columnCount; i++) { - ColumnSchema column = table.getColumn(i); - Type type = column.getDataType(); - - if (!colNameSet.contains(column.getName())) { - continue; - } - - if (translateTTI) { - if (type.isIntervalType()) { - type = ((IntervalType) type).getCharacterType(); - } - } - - row = t.getEmptyRowData(); - - // - row[itable_cat] = tableCatalog; - row[itable_schem] = tableSchema; - row[itable_name] = tableName; - row[icolumn_name] = column.getName().name; - row[idata_type] = ValuePool.getInt(type.getJDBCTypeCode()); - row[itype_name] = type.getNameString(); - row[icolumn_size] = ValuePool.INTEGER_0; - row[ichar_octet_length] = ValuePool.INTEGER_0; - - if (type.isArrayType()) { - row[itype_name] = type.getDefinition(); - } - - if (type.isCharacterType()) { - row[icolumn_size] = - ValuePool.getInt(type.getJDBCPrecision()); - - // this is length not octet_length, for character columns - row[ichar_octet_length] = - ValuePool.getInt(type.getJDBCPrecision()); - } - - if (type.isBinaryType()) { - row[icolumn_size] = - ValuePool.getInt(type.getJDBCPrecision()); - row[ichar_octet_length] = - ValuePool.getInt(type.getJDBCPrecision()); - } - - if (type.isNumberType()) { - row[icolumn_size] = ValuePool.getInt( - ((NumberType) type).getNumericPrecisionInRadix()); - row[inum_prec_radix] = - ValuePool.getInt(type.getPrecisionRadix()); - - if (type.isExactNumberType()) { - row[idecimal_digits] = ValuePool.getLong(type.scale); - } - } - - if (type.isDateTimeType()) { - int size = column.getDataType().displaySize(); - - row[icolumn_size] = ValuePool.getInt(size); - row[isql_datetime_sub] = ValuePool.getInt( - ((DateTimeType) type).getSqlDateTimeSub()); - } - - row[inullable] = ValuePool.getInt(column.getNullability()); - row[iremark] = ti.getColRemarks(i); - row[icolumn_def] = column.getDefaultSQL(); - row[isql_data_type] = ValuePool.getInt(type.typeCode); - row[iordinal_position] = ValuePool.getInt(i + 1); - row[iis_nullable] = column.isNullable() ? "YES" - : "NO"; - - if (type.isDistinctType() || type.isDomainType()) { - row[itype_name] = type.getTypeDefinition(); - row[isource_data_type] = row[idata_type]; - } - - // JDBC 4.0 - row[iis_autoinc] = column.isIdentity() ? "YES" - : "NO"; - row[iis_generated] = column.isGenerated() ? "YES" - : "NO"; - - t.insertSys(session, store, row); - } - } - - return t; - } - - /** - * Retrieves a Table object describing, for each - * accessible referencing and referenced table, how the referencing - * tables import, for the purposes of referential integrity, - * the columns of the referenced tables.

    - * - * Each row is a foreign key column description with the following - * columns: - * - *

    -     * PKTABLE_CAT   VARCHAR   referenced table catalog
    -     * PKTABLE_SCHEM VARCHAR   referenced table schema
    -     * PKTABLE_NAME  VARCHAR   referenced table name
    -     * PKCOLUMN_NAME VARCHAR   referenced column name
    -     * FKTABLE_CAT   VARCHAR   referencing table catalog
    -     * FKTABLE_SCHEM VARCHAR   referencing table schema
    -     * FKTABLE_NAME  VARCHAR   referencing table name
    -     * FKCOLUMN_NAME VARCHAR   referencing column
    -     * KEY_SEQ       SMALLINT  sequence number within foreign key
    -     * UPDATE_RULE   SMALLINT
    -     *    { Cascade | Set Null | Set Default | Restrict (No Action)}?
    -     * DELETE_RULE   SMALLINT
    -     *    { Cascade | Set Null | Set Default | Restrict (No Action)}?
    -     * FK_NAME       VARCHAR   foreign key constraint name
    -     * PK_NAME       VARCHAR   primary key or unique constraint name
    -     * DEFERRABILITY SMALLINT
    -     *    { initially deferred | initially immediate | not deferrable }
    -     * 

    - * - * @return a Table object describing how accessible tables - * import other accessible tables' primary key and/or unique - * constraint columns - */ - final Table SYSTEM_CROSSREFERENCE(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_CROSSREFERENCE]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_CROSSREFERENCE]); - - addColumn(t, "PKTABLE_CAT", SQL_IDENTIFIER); - addColumn(t, "PKTABLE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "PKTABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "PKCOLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "FKTABLE_CAT", SQL_IDENTIFIER); - addColumn(t, "FKTABLE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "FKTABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "FKCOLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "KEY_SEQ", Type.SQL_SMALLINT); // not null - addColumn(t, "UPDATE_RULE", Type.SQL_SMALLINT); // not null - addColumn(t, "DELETE_RULE", Type.SQL_SMALLINT); // not null - addColumn(t, "FK_NAME", SQL_IDENTIFIER); - addColumn(t, "PK_NAME", SQL_IDENTIFIER); - addColumn(t, "DEFERRABILITY", Type.SQL_SMALLINT); // not null - - // order: FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and KEY_SEQ - // added for unique: FK_NAME - // false PK, as FKTABLE_CAT, FKTABLE_SCHEM and/or FK_NAME - // may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_CROSSREFERENCE].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 4, 5, 6, 8, 11 - }, false); - - return t; - } - - // calculated column values - String pkTableCatalog; - String pkTableSchema; - String pkTableName; - String pkColumnName; - String fkTableCatalog; - String fkTableSchema; - String fkTableName; - String fkColumnName; - Integer keySequence; - Integer updateRule; - Integer deleteRule; - String fkName; - String pkName; - Integer deferrability; - - // Intermediate holders - Iterator tables; - Table table; - Table fkTable; - Table pkTable; - int columnCount; - int[] mainCols; - int[] refCols; - Constraint[] constraints; - Constraint constraint; - int constraintCount; - HsqlArrayList fkConstraintsList; - Object[] row; - - // column number mappings - final int ipk_table_cat = 0; - final int ipk_table_schem = 1; - final int ipk_table_name = 2; - final int ipk_column_name = 3; - final int ifk_table_cat = 4; - final int ifk_table_schem = 5; - final int ifk_table_name = 6; - final int ifk_column_name = 7; - final int ikey_seq = 8; - final int iupdate_rule = 9; - final int idelete_rule = 10; - final int ifk_name = 11; - final int ipk_name = 12; - final int ideferrability = 13; - - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - // We must consider all the constraints in all the user tables, since - // this is where reference relationships are recorded. However, we - // are only concerned with Constraint.FOREIGN_KEY constraints here - // because their corresponing Constraint.MAIN entries are essentially - // duplicate data recorded in the referenced rather than the - // referencing table. Also, we skip constraints where either - // the referenced, referencing or both tables are not accessible - // relative to the session of the calling context - fkConstraintsList = new HsqlArrayList(); - - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (table.isView() || !isAccessible(session, table)) { - continue; - } - - constraints = table.getConstraints(); - constraintCount = constraints.length; - - for (int i = 0; i < constraintCount; i++) { - constraint = constraints[i]; - - if (constraint.getConstraintType() == SchemaObject - .ConstraintTypes - .FOREIGN_KEY && isAccessible(session, constraint - .getRef())) { - fkConstraintsList.add(constraint); - } - } - } - - // Now that we have all of the desired constraints, we need to - // process them, generating one row in our ouput table for each - // imported/exported column pair of each constraint. - // Do it. - for (int i = 0; i < fkConstraintsList.size(); i++) { - constraint = (Constraint) fkConstraintsList.get(i); - pkTable = constraint.getMain(); - pkTableName = pkTable.getName().name; - fkTable = constraint.getRef(); - fkTableName = fkTable.getName().name; - pkTableCatalog = pkTable.getCatalogName().name; - pkTableSchema = pkTable.getSchemaName().name; - fkTableCatalog = fkTable.getCatalogName().name; - fkTableSchema = fkTable.getSchemaName().name; - mainCols = constraint.getMainColumns(); - refCols = constraint.getRefColumns(); - columnCount = refCols.length; - fkName = constraint.getRefName().name; - pkName = constraint.getUniqueName().name; - deferrability = ValuePool.getInt(constraint.getDeferability()); - - //pkName = constraint.getMainIndex().getName().name; - deleteRule = ValuePool.getInt(constraint.getDeleteAction()); - updateRule = ValuePool.getInt(constraint.getUpdateAction()); - - for (int j = 0; j < columnCount; j++) { - keySequence = ValuePool.getInt(j + 1); - pkColumnName = pkTable.getColumn(mainCols[j]).getNameString(); - fkColumnName = fkTable.getColumn(refCols[j]).getNameString(); - row = t.getEmptyRowData(); - row[ipk_table_cat] = pkTableCatalog; - row[ipk_table_schem] = pkTableSchema; - row[ipk_table_name] = pkTableName; - row[ipk_column_name] = pkColumnName; - row[ifk_table_cat] = fkTableCatalog; - row[ifk_table_schem] = fkTableSchema; - row[ifk_table_name] = fkTableName; - row[ifk_column_name] = fkColumnName; - row[ikey_seq] = keySequence; - row[iupdate_rule] = updateRule; - row[idelete_rule] = deleteRule; - row[ifk_name] = fkName; - row[ipk_name] = pkName; - row[ideferrability] = deferrability; - - t.insertSys(session, store, row); - } - } - - return t; - } - - /** - * Retrieves a Table object describing the visible - * Index objects for each accessible table defined - * within this database.

    - * - * Each row is an index column description with the following - * columns: - * - *

    -     * TABLE_CAT        VARCHAR   table's catalog
    -     * TABLE_SCHEM      VARCHAR   simple name of table's schema
    -     * TABLE_NAME       VARCHAR   simple name of the table using the index
    -     * NON_UNIQUE       BOOLEAN   can index values be non-unique?
    -     * INDEX_QUALIFIER  VARCHAR   catalog in which the index is defined
    -     * INDEX_NAME       VARCHAR   simple name of the index
    -     * TYPE             SMALLINT  index type: { Clustered | Hashed | Other }
    -     * ORDINAL_POSITION SMALLINT  column sequence number within index
    -     * COLUMN_NAME      VARCHAR   simple column name
    -     * ASC_OR_DESC      VARCHAR   col. sort sequence: {"A" (Asc) | "D" (Desc)}
    -     * CARDINALITY      BIGINT    # of unique values in index (not implemented)
    -     * PAGES            BIGINT    index page use (not implemented)
    -     * FILTER_CONDITION VARCHAR   filter condition, if any (not implemented)
    -     * // HSQLDB-extension
    -     * ROW_CARDINALITY  INTEGER   total # of rows in index (not implemented)
    -     * 

    - * - * CARDINALITY and PAGES columns are BIGINT instead of INT since 2.4.0 - * - * @return a Table object describing the visible - * Index objects for each accessible - * table defined within this database. - */ - final Table SYSTEM_INDEXINFO(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_INDEXINFO]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_INDEXINFO]); - - // JDBC - addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // NOT NULL - addColumn(t, "NON_UNIQUE", Type.SQL_BOOLEAN); // NOT NULL - addColumn(t, "INDEX_QUALIFIER", SQL_IDENTIFIER); - addColumn(t, "INDEX_NAME", SQL_IDENTIFIER); - addColumn(t, "TYPE", Type.SQL_SMALLINT); // NOT NULL - addColumn(t, "ORDINAL_POSITION", Type.SQL_SMALLINT); // NOT NULL - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); - addColumn(t, "ASC_OR_DESC", CHARACTER_DATA); - addColumn(t, "CARDINALITY", CARDINAL_NUMBER); - addColumn(t, "PAGES", CARDINAL_NUMBER); - addColumn(t, "FILTER_CONDITION", CHARACTER_DATA); - - // HSQLDB extension - addColumn(t, "ROW_CARDINALITY", Type.SQL_INTEGER); - - // order: NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. - // added for unique: INDEX_QUALIFIER, TABLE_NAME - // false PK, as INDEX_QUALIFIER may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_INDEXINFO].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 3, 4, 5, 7, 8 - }, false); - - return t; - } - - // calculated column values - String tableCatalog; - String tableSchema; - String tableName; - Boolean nonUnique; - String indexQualifier; - String indexName; - Integer indexType; - - //Integer ordinalPosition; - //String columnName; - //String ascOrDesc; - Integer cardinality; - Integer pages; - String filterCondition; - Integer rowCardinality; - - // Intermediate holders - Iterator tables; - Table table; - int indexCount; - int[] cols; - int col; - int colCount; - Object[] row; - - // column number mappings - final int itable_cat = 0; - final int itable_schem = 1; - final int itable_name = 2; - final int inon_unique = 3; - final int iindex_qualifier = 4; - final int iindex_name = 5; - final int itype = 6; - final int iordinal_position = 7; - final int icolumn_name = 8; - final int iasc_or_desc = 9; - final int icardinality = 10; - final int ipages = 11; - final int ifilter_condition = 12; - final int irow_cardinality = 13; - - // Initialization - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (table.isView() || !isAccessible(session, table)) { - continue; - } - - tableCatalog = table.getCatalogName().name; - tableSchema = table.getSchemaName().name; - tableName = table.getName().name; - - // not supported yet - filterCondition = null; - - // different cat for index not supported yet - indexQualifier = tableCatalog; - indexCount = table.getIndexCount(); - - // process all of the visible indices for this table - for (int i = 0; i < indexCount; i++) { - Index index = table.getIndex(i); - - colCount = table.getIndex(i).getColumnCount(); - - if (colCount < 1) { - continue; - } - - indexName = index.getName().name; - nonUnique = index.isUnique() ? Boolean.FALSE - : Boolean.TRUE; - cardinality = null; - pages = ValuePool.INTEGER_0; - rowCardinality = null; - cols = index.getColumns(); - indexType = ValuePool.getInt(3); - - for (int k = 0; k < colCount; k++) { - col = cols[k]; - row = t.getEmptyRowData(); - row[itable_cat] = tableCatalog; - row[itable_schem] = tableSchema; - row[itable_name] = tableName; - row[inon_unique] = nonUnique; - row[iindex_qualifier] = indexQualifier; - row[iindex_name] = indexName; - row[itype] = indexType; - row[iordinal_position] = ValuePool.getInt(k + 1); - row[icolumn_name] = - table.getColumn(cols[k]).getName().name; - row[iasc_or_desc] = "A"; - row[icardinality] = cardinality; - row[ipages] = pages; - row[irow_cardinality] = rowCardinality; - row[ifilter_condition] = filterCondition; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) { - - // when set database sql sys index names true and a user - // index duplicates a constraint index! - row[iindex_name] = indexName + "*"; - - t.insertSys(session, store, row); - } - } - } - } - - return t; - } - - /** - * Retrieves a Table object describing the visible - * primary key columns of each accessible table defined within - * this database.

    - * - * Each row is a PRIMARY KEY column description with the following - * columns: - * - *

    -     * TABLE_CAT   VARCHAR   table catalog
    -     * TABLE_SCHEM VARCHAR   table schema
    -     * TABLE_NAME  VARCHAR   table name
    -     * COLUMN_NAME VARCHAR   column name
    -     * KEY_SEQ     SMALLINT  sequence number within primary key
    -     * PK_NAME     VARCHAR   primary key constraint name
    -     * 

    - * - * @return a Table object describing the visible - * primary key columns of each accessible table - * defined within this database. - */ - final Table SYSTEM_PRIMARYKEYS(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_PRIMARYKEYS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_PRIMARYKEYS]); - - addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "KEY_SEQ", Type.SQL_SMALLINT); // not null - addColumn(t, "PK_NAME", SQL_IDENTIFIER); - - // order: COLUMN_NAME - // added for unique: TABLE_NAME, TABLE_SCHEM, TABLE_CAT - // false PK, as TABLE_SCHEM and/or TABLE_CAT may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_PRIMARYKEYS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 3, 2, 1, 0 - }, false); - - return t; - } - - // calculated column values - String tableCatalog; - String tableSchema; - String tableName; - - //String columnName; - //Integer keySequence; - String primaryKeyName; - - // Intermediate holders - Iterator tables; - Table table; - Object[] row; - Constraint constraint; - int[] cols; - int colCount; - - // column number mappings - final int itable_cat = 0; - final int itable_schem = 1; - final int itable_name = 2; - final int icolumn_name = 3; - final int ikey_seq = 4; - final int ipk_name = 5; - - // Initialization - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (table.isView() || !isAccessible(session, table) - || !table.hasPrimaryKey()) { - continue; - } - - constraint = table.getPrimaryConstraint(); - tableCatalog = table.getCatalogName().name; - tableSchema = table.getSchemaName().name; - tableName = table.getName().name; - primaryKeyName = constraint.getName().name; - cols = constraint.getMainColumns(); - colCount = cols.length; - - for (int j = 0; j < colCount; j++) { - row = t.getEmptyRowData(); - row[itable_cat] = tableCatalog; - row[itable_schem] = tableSchema; - row[itable_name] = tableName; - row[icolumn_name] = table.getColumn(cols[j]).getName().name; - row[ikey_seq] = ValuePool.getInt(j + 1); - row[ipk_name] = primaryKeyName; - - t.insertSys(session, store, row); - } - } - - return t; - } - - /** - * Retrieves a Table object describing the - * return, parameter and result columns of the accessible - * routines defined within this database.

    - * - * Each row is a procedure column description with the following - * columns: - * - *

    -     * PROCEDURE_CAT   VARCHAR   routine catalog
    -     * PROCEDURE_SCHEM VARCHAR   routine schema
    -     * PROCEDURE_NAME  VARCHAR   routine name
    -     * COLUMN_NAME     VARCHAR   column/parameter name
    -     * COLUMN_TYPE     SMALLINT  kind of column/parameter
    -     * DATA_TYPE       SMALLINT  SQL type from DITypes
    -     * TYPE_NAME       VARCHAR   SQL type name
    -     * PRECISION       INTEGER   precision (length) of type
    -     * LENGTH          INTEGER   transfer size, in bytes, if definitely known
    -     *                           (roughly equivalent to BUFFER_SIZE for table
    -     *                           columns)
    -     * SCALE           SMALLINT  scale
    -     * RADIX           SMALLINT  radix
    -     * NULLABLE        SMALLINT  can column contain NULL?
    -     * REMARKS         VARCHAR   explanatory comment on column
    -     * // JDBC 4.0
    -     * COLUMN_DEF        VARCHAR The default column value.
    -     *                           The string NULL (not enclosed in quotes)
    -     *                           - If NULL was specified as the default value
    -     *                           TRUNCATE (not enclosed in quotes)
    -     *                           - If the specified default value cannot be
    -     *                           represented without truncation
    -     *                           NULL
    -     *                           - If a default value was not specified
    -     * SQL_DATA_TYPE     INTEGER CLI type list from SQL 2003 Table 37,
    -     *                           tables 6-9 Annex A1, and/or addendums in other
    -     *                           documents, such as:
    -     *                           SQL 2003 Part 9: Management of External Data (SQL/MED) : DATALINK
    -     *                           SQL 2003 Part 14: XML-Related Specifications (SQL/XML) : XML
    -     * SQL_DATETIME_SUB  INTEGER SQL 2003 CLI datetime/interval subcode.
    -     * CHAR_OCTET_LENGTH INTEGER The maximum length of binary and character
    -     *                           based columns.  For any other datatype the
    -     *                           returned value is a NULL
    -     * ORDINAL_POSITION  INTEGER The ordinal position, starting from 1, for the
    -     *                           input and output parameters for a procedure.
    -     *                           A value of 0 is returned if this row describes
    -     *                           the procedure's return value.
    -     * IS_NULLABLE       VARCHAR ISO rules are used to determine the nullability
    -     *                           for a column.
    -     *
    -     *                           YES (enclosed in quotes)  --- if the column can include NULLs
    -     *                           NO  (enclosed in quotes)  --- if the column cannot include NULLs
    -     *                           empty string              --- if the nullability for the column is unknown
    -     *
    -     * SPECIFIC_NAME     VARCHAR The name which uniquely identifies this
    -     *                           procedure within its schema.
    -     *                           Typically (but not restricted to) a
    -     *                           fully qualified Java Method name and
    -     *                           signature
    -     * // HSQLDB extension
    -     * JDBC_SEQ          INTEGER The JDBC-specified order within
    -     *                           runs of PROCEDURE_SCHEM, PROCEDURE_NAME,
    -     *                           SPECIFIC_NAME, which is:
    -     *
    -     *                           return value (0), if any, first, followed
    -     *                           by the parameter descriptions in call order
    -     *                           (1..n1), followed by the result column
    -     *                           descriptions in column number order
    -     *                           (n1 + 1..n1 + n2)
    -     * 

    - * - * @return a Table object describing the - * return, parameter and result columns - * of the accessible routines defined - * within this database. - */ - Table SYSTEM_PROCEDURECOLUMNS(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_PROCEDURECOLUMNS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_PROCEDURECOLUMNS]); - - // ---------------------------------------------------------------- - // required - // ---------------------------------------------------------------- - addColumn(t, "PROCEDURE_CAT", SQL_IDENTIFIER); // 0 - addColumn(t, "PROCEDURE_SCHEM", SQL_IDENTIFIER); // 1 - addColumn(t, "PROCEDURE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_TYPE", Type.SQL_SMALLINT); // not null - addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "PRECISION", Type.SQL_INTEGER); // 7 - addColumn(t, "LENGTH", Type.SQL_INTEGER); // 8 - addColumn(t, "SCALE", Type.SQL_SMALLINT); // 9 - addColumn(t, "RADIX", Type.SQL_SMALLINT); // 10 - addColumn(t, "NULLABLE", Type.SQL_SMALLINT); // not null - addColumn(t, "REMARKS", CHARACTER_DATA); // 12 - - // ---------------------------------------------------------------- - // JDBC 4.0 - // ---------------------------------------------------------------- - addColumn(t, "COLUMN_DEF", CHARACTER_DATA); // 13 - addColumn(t, "SQL_DATA_TYPE", Type.SQL_INTEGER); // 14 - addColumn(t, "SQL_DATETIME_SUB", Type.SQL_INTEGER); // 15 - addColumn(t, "CHAR_OCTET_LENGTH", Type.SQL_INTEGER); // 16 - addColumn(t, "ORDINAL_POSITION", Type.SQL_INTEGER); // 17 - addColumn(t, "IS_NULLABLE", CHARACTER_DATA); // 18 - addColumn(t, "SPECIFIC_NAME", SQL_IDENTIFIER); // 19 - - // order: PROCEDURE_SCHEM, PROCEDURE_NAME, SPECIFIC_NAME, ORDINAL_POSITION - // - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_PROCEDURECOLUMNS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 19, 17 - }, false); - - return t; - } - - // column number mappings - final int specific_cat = 0; - final int specific_schem = 1; - final int procedure_name = 2; - final int parameter_name = 3; - final int parameter_mode = 4; - final int data_type_sql_id = 5; - final int data_type = 6; - final int numeric_precision = 7; - final int byte_length = 8; - final int numeric_scale = 9; - final int numeric_precision_radix = 10; - final int nullable = 11; - final int remark = 12; - final int default_val = 13; - final int sql_data_type = 14; - final int sql_datetime_sub = 15; - final int character_octet_length = 16; - final int ordinal_position = 17; - final int is_nullable = 18; - final int specific_name = 19; - - // intermediate holders - int columnCount; - Iterator routines; - RoutineSchema routineSchema; - Routine routine; - Object[] row; - Type type; - - // Initialization - boolean translateTTI = database.sqlTranslateTTI; - - routines = database.schemaManager.databaseObjectIterator( - SchemaObject.ROUTINE); - - while (routines.hasNext()) { - routineSchema = (RoutineSchema) routines.next(); - - if (!isAccessible(session, routineSchema)) { - continue; - } - - Routine[] specifics = routineSchema.getSpecificRoutines(); - - for (int i = 0; i < specifics.length; i++) { - routine = specifics[i]; - columnCount = routine.getParameterCount(); - - for (int j = 0; j < columnCount; j++) { - ColumnSchema column = routine.getParameter(j); - - row = t.getEmptyRowData(); - type = column.getDataType(); - - if (translateTTI) { - if (type.isIntervalType()) { - type = ((IntervalType) type).getCharacterType(); - } - } - - row[specific_cat] = database.getCatalogName().name; - row[specific_schem] = routine.getSchemaName().name; - row[specific_name] = routine.getSpecificName().name; - row[procedure_name] = routine.getName().name; - - HsqlName colName = column.getName(); - String colString = (colName == null) ? "" - : colName.name; - - row[parameter_name] = colString; - row[ordinal_position] = ValuePool.getInt(j + 1); - row[parameter_mode] = - ValuePool.getInt(column.getParameterMode()); - row[data_type] = type.getFullNameString(); - row[data_type_sql_id] = - ValuePool.getInt(type.getJDBCTypeCode()); - row[numeric_precision] = ValuePool.INTEGER_0; - row[character_octet_length] = ValuePool.INTEGER_0; - - if (type.isCharacterType()) { - row[numeric_precision] = - ValuePool.getInt(type.getJDBCPrecision()); - - // this is length not octet_length, for character columns - row[character_octet_length] = - ValuePool.getInt(type.getJDBCPrecision()); - } - - if (type.isBinaryType()) { - row[numeric_precision] = - ValuePool.getInt(type.getJDBCPrecision()); - row[character_octet_length] = - ValuePool.getInt(type.getJDBCPrecision()); - } - - if (type.isNumberType()) { - row[numeric_precision] = ValuePool.getInt( - ((NumberType) type).getNumericPrecisionInRadix()); - row[numeric_precision_radix] = - ValuePool.getLong(type.getPrecisionRadix()); - - if (type.isExactNumberType()) { - row[numeric_scale] = ValuePool.getLong(type.scale); - } - } - - if (type.isDateTimeType()) { - int size = column.getDataType().displaySize(); - - row[numeric_precision] = ValuePool.getInt(size); - } - - row[sql_data_type] = - ValuePool.getInt(column.getDataType().typeCode); - row[nullable] = ValuePool.getInt(column.getNullability()); - row[is_nullable] = column.isNullable() ? "YES" - : "NO"; - - t.insertSys(session, store, row); - } - } - } - - return t; - } - - /** - * Retrieves a Table object describing the accessible - * routines (both functions and procedures) defined within this database.

    - * - * Each row is a procedure description with the following - * columns: - * - *

    -     * PROCEDURE_CAT     VARCHAR   catalog in which routine is defined
    -     * PROCEDURE_SCHEM   VARCHAR   schema in which routine is defined
    -     * PROCEDURE_NAME    VARCHAR   simple routine identifier
    -     * COL_4             INTEGER   unused
    -     * COL_5             INTEGER   unused
    -     * COL_6             INTEGER   unused
    -     * REMARKS           VARCHAR   explanatory comment on the routine
    -     * PROCEDURE_TYPE    SMALLINT  { Unknown | No Result | Returns Result }
    -     * // JDBC 4.0
    -     * SPECIFIC_NAME     VARCHAR   The name which uniquely identifies this
    -     *                             procedure within its schema.
    -     *                             typically (but not restricted to) a
    -     *                             fully qualified Java Method name
    -     *                             and signature.
    -     * // HSQLDB extension
    -     * FUNCTION_RETURN   INTEGER   { Returns Value = 1 | Returns Table = 2)
    -     *
    -     * 

    - * - * @return a Table object describing the accessible - * routines defined within the this database - */ - Table SYSTEM_PROCEDURES(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_PROCEDURES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_PROCEDURES]); - - // ---------------------------------------------------------------- - // required - // ---------------------------------------------------------------- - addColumn(t, "PROCEDURE_CAT", SQL_IDENTIFIER); // 0 - addColumn(t, "PROCEDURE_SCHEM", SQL_IDENTIFIER); // 1 - addColumn(t, "PROCEDURE_NAME", SQL_IDENTIFIER); // 2 - addColumn(t, "COL_4", Type.SQL_INTEGER); // 3 - addColumn(t, "COL_5", Type.SQL_INTEGER); // 4 - addColumn(t, "COL_6", Type.SQL_INTEGER); // 5 - addColumn(t, "REMARKS", CHARACTER_DATA); // 6 - - // basically: function (returns result), procedure (no return value) - // or unknown (say, a trigger callout routine) - addColumn(t, "PROCEDURE_TYPE", Type.SQL_SMALLINT); // 7 - - // ---------------------------------------------------------------- - // JDBC 4.0 - // ---------------------------------------------------------------- - addColumn(t, "SPECIFIC_NAME", SQL_IDENTIFIER); // 8 - addColumn(t, "FUNCTION_TYPE", Type.SQL_INTEGER); // 9 - - // ---------------------------------------------------------------- - // order: PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME, SPECIFIC_NAME - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_PROCEDURES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 8 - }, false); - - return t; - } - - // - final int procedure_catalog = 0; - final int procedure_schema = 1; - final int procedure_name = 2; - final int col_4 = 3; - final int col_5 = 4; - final int col_6 = 5; - final int remarks = 6; - final int procedure_type = 7; - final int specific_name = 8; - final int function_type = 9; - - // - Iterator it = database.schemaManager.databaseObjectIterator( - SchemaObject.SPECIFIC_ROUTINE); - - while (it.hasNext()) { - Routine routine = (Routine) it.next(); - Object[] row = t.getEmptyRowData(); - - if (!isAccessible(session, routine)) { - continue; - } - - row[procedure_catalog] = row[procedure_catalog] = - database.getCatalogName().name; - row[procedure_schema] = routine.getSchemaName().name; - row[procedure_name] = routine.getName().name; - row[remarks] = routine.getName().comment; - row[procedure_type] = routine.isProcedure() ? ValuePool.INTEGER_1 - : ValuePool.INTEGER_2; - row[specific_name] = routine.getSpecificName().name; - row[function_type] = routine.returnsTable() ? ValuePool.INTEGER_2 - : ValuePool.INTEGER_1; - - t.insertSys(session, store, row); - } - - return t; - } - - /** - * getClientInfoProperties - * - * @return Result - *

      - *
    • NAME String : The name of the client info property
      - *
    • MAX_LEN int : The maximum length of the value for the property
      - *
    • DEFAULT_VALUE String : The default value of the property
      - *
    • DESCRIPTION String : A description of the property. This will typically - * contain information as to where this property is - * stored in the database. - *
    - */ - final Table SYSTEM_CONNECTION_PROPERTIES(Session session, - PersistentStore store) { - - Table t = sysTables[SYSTEM_CONNECTION_PROPERTIES]; - - if (t == null) { - t = createBlankTable( - sysTableHsqlNames[SYSTEM_CONNECTION_PROPERTIES]); - - addColumn(t, "NAME", SQL_IDENTIFIER); - addColumn(t, "MAX_LEN", Type.SQL_INTEGER); - addColumn(t, "DEFAULT_VALUE", SQL_IDENTIFIER); // not null - addColumn(t, "DESCRIPTION", SQL_IDENTIFIER); // not null - - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_CONNECTION_PROPERTIES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[]{ 0 }, true); - - return t; - } - - Object[] row; - - // column number mappings - final int iname = 0; - final int imax_len = 1; - final int idefault_value = 2; - final int idescription = 3; - Iterator it = HsqlDatabaseProperties.getUrlUserConnectionProperties(); - - while (it.hasNext()) { - PropertyMeta meta = (PropertyMeta) it.next(); - int propType = meta.propType; - - row = t.getEmptyRowData(); - - Object def = meta.propDefaultValue; - - row[iname] = meta.propName; - row[imax_len] = ValuePool.getInt(8); - row[idefault_value] = def == null ? null - : def.toString(); - row[idescription] = "see HyperSQL guide"; - - t.insertSys(session, store, row); - } - - return t; - } - - /** - * Inserts a set of procedure description rows into the Table - * object specified by the t argument.

    - * - * @param t the table into which the specified rows will eventually - * be inserted - * @param l the list of procedure name aliases to which the specified column - * values apply - * @param cat the procedure catalog name - * @param schem the procedure schema name - * @param pName the base (non-alias) procedure name - * @param ip the procedure input parameter count - * @param op the procedure output parameter count - * @param rs the procedure result column count - * @param remark a human-readable remark regarding the procedure - * @param pType the procedure type code, indicating whether it is a - * function, procedure, or uncatagorized (i.e. returns - * a value, does not return a value, or it is unknown - * if it returns a value) - * @param specificName the specific name of the procedure - * (typically but not limited to a - * fully qualified Java Method name and signature) - * @param origin origin of the procedure, e.g. - * (["BUILTIN" | "USER DEFINED"] "ROUTINE" | "TRIGGER") | "ALIAS", etc. - * - */ - protected void addProcRows(Session session, Table t, HsqlArrayList l, - String cat, String schem, String pName, - Integer ip, Integer op, Integer rs, - String remark, Integer pType, - String specificName, String origin) { - - PersistentStore store = t.getRowStore(session); - - // column number mappings - final int icat = 0; - final int ischem = 1; - final int ipname = 2; - final int iinput_parms = 3; - final int ioutput_parms = 4; - final int iresult_sets = 5; - final int iremark = 6; - final int iptype = 7; - final int isn = 8; - final int iporigin = 9; - Object[] row = t.getEmptyRowData(); - - row[icat] = cat; - row[ischem] = schem; - row[ipname] = pName; - row[iinput_parms] = ip; - row[ioutput_parms] = op; - row[iresult_sets] = rs; - row[iremark] = remark; - row[iptype] = pType; - row[iporigin] = origin; - row[isn] = specificName; - - t.insertSys(session, store, row); - - if (l != null) { - int size = l.size(); - - for (int i = 0; i < size; i++) { - row = t.getEmptyRowData(); - pName = (String) l.get(i); - row[icat] = cat; - row[ischem] = schem; - row[ipname] = pName; - row[iinput_parms] = ip; - row[ioutput_parms] = op; - row[iresult_sets] = rs; - row[iremark] = remark; - row[iptype] = pType; - row[iporigin] = "ALIAS"; - row[isn] = specificName; - - t.insertSys(session, store, row); - } - } - } - - /** - * Inserts a set of procedure column description rows into the - * Table specified by the t argument. - * - *

    - * - * @param t the table in which the rows are to be inserted - * @param l the list of procedure name aliases to which the specified - * column values apply - * @param cat the procedure's catalog name - * @param schem the procedure's schema name - * @param pName the procedure's simple base (non-alias) name - * @param cName the procedure column name - * @param cType the column type (return, parameter, result) - * @param dType the column's data type code - * @param tName the column's canonical data type name - * @param prec the column's precision - * @param len the column's buffer length - * @param scale the column's scale (decimal digits) - * @param radix the column's numeric precision radix - * @param nullability the column's java.sql.DatbaseMetaData nullabiliy code - * @param remark a human-readable remark regarding the column - * @param colDefault String - * @param sqlDataType helper value to back JDBC contract sort order - * @param sqlDateTimeSub Integer - * @param charOctetLength Integer - * @param ordinalPosition Integer - * @param isNullable String - * @param specificName the specific name of the procedure (typically but - * not limited to a fully qualified Java Method name and signature) - */ - protected void addPColRows(Session session, Table t, HsqlArrayList l, - String cat, String schem, String pName, - String cName, Integer cType, Integer dType, - String tName, Integer prec, Integer len, - Integer scale, Integer radix, - Integer nullability, String remark, - String colDefault, Integer sqlDataType, - Integer sqlDateTimeSub, - Integer charOctetLength, - Integer ordinalPosition, String isNullable, - String specificName) { - - PersistentStore store = t.getRowStore(session); - - // column number mappings - final int icat = 0; - final int ischem = 1; - final int iname = 2; - final int icol_name = 3; - final int icol_type = 4; - final int idata_type = 5; - final int itype_name = 6; - final int iprec = 7; - final int ilength = 8; - final int iscale = 9; - final int iradix = 10; - final int inullable = 11; - final int iremark = 12; - - // JDBC 4.0 - final int icol_default = 13; - final int isql_data_type = 14; - final int isql_datetime_sub = 15; - final int ichar_octet_len = 16; - final int iordinal_position = 17; - final int iis_nullable = 18; - final int ispecific_name = 19; - - // initialization - Object[] row = t.getEmptyRowData(); - - // Do it. - row[icat] = cat; - row[ischem] = schem; - row[iname] = pName; - row[icol_name] = cName; - row[icol_type] = cType; - row[idata_type] = dType; - row[itype_name] = tName; - row[iprec] = prec; - row[ilength] = len; - row[iscale] = scale; - row[iradix] = radix; - row[inullable] = nullability; - row[iremark] = remark; - - // JDBC 4.0 - row[icol_default] = colDefault; - row[isql_data_type] = sqlDataType; - row[isql_datetime_sub] = sqlDateTimeSub; - row[ichar_octet_len] = charOctetLength; - row[iordinal_position] = ordinalPosition; - row[iis_nullable] = isNullable; - row[ispecific_name] = specificName; - - t.insertSys(session, store, row); - - if (l != null) { - int size = l.size(); - - for (int i = 0; i < size; i++) { - row = t.getEmptyRowData(); - pName = (String) l.get(i); - row[icat] = cat; - row[ischem] = schem; - row[iname] = pName; - row[icol_name] = cName; - row[icol_type] = cType; - row[idata_type] = dType; - row[itype_name] = tName; - row[iprec] = prec; - row[ilength] = len; - row[iscale] = scale; - row[iradix] = radix; - row[inullable] = nullability; - row[iremark] = remark; - - // JDBC 4.0 - row[icol_default] = colDefault; - row[isql_data_type] = sqlDataType; - row[isql_datetime_sub] = sqlDateTimeSub; - row[ichar_octet_len] = charOctetLength; - row[iordinal_position] = ordinalPosition; - row[iis_nullable] = isNullable; - row[ispecific_name] = specificName; - - t.insertSys(session, store, row); - } - } - } - - /** - * Retrieves a Table object describing the accessible schemas - * defined within this database.

    - * - * Each row is a schema description with the following - * columns: - * - *

    -     * TABLE_SCHEM      VARCHAR   simple schema name
    -     * TABLE_CATALOG    VARCHAR   catalog in which schema is defined
    -     * IS_DEFAULT       BOOLEAN   is the schema the default for new sessions
    -     * 

    - * - * @return table containing information about schemas defined - * within this database - */ - final Table SYSTEM_SCHEMAS(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_SCHEMAS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_SCHEMAS]); - - addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); // not null - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "IS_DEFAULT", Type.SQL_BOOLEAN); - - // order: TABLE_SCHEM - // true PK, as rows never have null TABLE_SCHEM - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_SCHEMAS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[]{ 0 }, true); - - return t; - } - - Object[] row; - - // Initialization - SchemaObject[] schemas = database.schemaManager.getAllSchemas(); - HsqlName defschema = database.schemaManager.getDefaultSchemaHsqlName(); - - // Do it. - for (int i = 0; i < schemas.length; i++) { - row = t.getEmptyRowData(); - - HsqlName schema = schemas[i].getName(); - - if (!session.getGrantee().hasSchemaUpdateOrGrantRights(schema)) { - continue; - } - - row[0] = schema.getNameString(); - row[1] = database.getCatalogName().name; - row[2] = schema.equals(defschema) ? Boolean.TRUE - : Boolean.FALSE; - - t.insertSys(session, store, row); - } - - return t; - } - - /** - * Retrieves a Table object describing the accessible - * tables defined within this database.

    - * - * Each row is a table description with the following columns: - * - *

    -     * TABLE_CAT                 VARCHAR   table catalog
    -     * TABLE_SCHEM               VARCHAR   table schema
    -     * TABLE_NAME                VARCHAR   table name
    -     * TABLE_TYPE                VARCHAR   {"TABLE" | "VIEW" |
    -     *                                      "SYSTEM TABLE" | "GLOBAL TEMPORARY"}
    -     * REMARKS                   VARCHAR   comment on the table.
    -     * TYPE_CAT                  VARCHAR   table type catalog (not implemented).
    -     * TYPE_SCHEM                VARCHAR   table type schema (not implemented).
    -     * TYPE_NAME                 VARCHAR   table type name (not implemented).
    -     * SELF_REFERENCING_COL_NAME VARCHAR   designated "identifier" column of
    -     *                                     typed table (not implemented).
    -     * REF_GENERATION            VARCHAR   {"SYSTEM" | "USER" |
    -     *                                      "DERIVED" | NULL } (not implemented)
    -     * HSQLDB_TYPE               VARCHAR   HSQLDB-specific type:
    -     *                                     {"MEMORY" | "CACHED" | "TEXT" | ...}
    -     * READ_ONLY                 BOOLEAN   TRUE if table is read-only,
    -     *                                     else FALSE.
    -     * COMMIT_ACTION             VARCHAR   "PRESERVE" or "DELETE" for temp tables,
    -     *                                     else NULL
    -     * 

    - * - * @return a Table object describing the accessible - * tables defined within this database - */ - final Table SYSTEM_TABLES(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_TABLES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_TABLES]); - - // ------------------------------------------------------------- - // required - // ------------------------------------------------------------- - addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "TABLE_TYPE", CHARACTER_DATA); // not null - addColumn(t, "REMARKS", CHARACTER_DATA); - - // ------------------------------------------------------------- - // JDBC 3.0 - // ------------------------------------------------------------- - addColumn(t, "TYPE_CAT", SQL_IDENTIFIER); - addColumn(t, "TYPE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); - addColumn(t, "SELF_REFERENCING_COL_NAME", SQL_IDENTIFIER); - addColumn(t, "REF_GENERATION", CHARACTER_DATA); - - // ------------------------------------------------------------- - // extended - // ------------------------------------------------------------ - addColumn(t, "HSQLDB_TYPE", SQL_IDENTIFIER); - addColumn(t, "READ_ONLY", Type.SQL_BOOLEAN); // not null - addColumn(t, "COMMIT_ACTION", CHARACTER_DATA); // not null - - // ------------------------------------------------------------ - // order TABLE_TYPE, TABLE_SCHEM and TABLE_NAME - // added for unique: TABLE_CAT - // false PK, as TABLE_SCHEM and/or TABLE_CAT may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_TABLES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 3, 1, 2, 0 - }, false); - - return t; - } - - // intermediate holders - Iterator tables; - Table table; - Object[] row; - HsqlName accessKey; - DITableInfo ti; - - // column number mappings - // JDBC 1 - final int itable_cat = 0; - final int itable_schem = 1; - final int itable_name = 2; - final int itable_type = 3; - final int iremark = 4; - - // JDBC 3.0 - final int itype_cat = 5; - final int itype_schem = 6; - final int itype_name = 7; - final int isref_cname = 8; - final int iref_gen = 9; - - // hsqldb ext - final int ihsqldb_type = 10; - final int iread_only = 11; - final int icommit_action = 12; - - // Initialization - tables = allTables(); - ti = new DITableInfo(); - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (!isAccessible(session, table)) { - continue; - } - - ti.setTable(table); - - row = t.getEmptyRowData(); - row[itable_cat] = database.getCatalogName().name; - row[itable_schem] = table.getSchemaName().name; - row[itable_name] = table.getName().name; - row[itable_type] = ti.getJDBCStandardType(); - row[iremark] = ti.getRemark(); - row[ihsqldb_type] = ti.getHsqlType(); - row[iread_only] = table.isDataReadOnly() ? Boolean.TRUE - : Boolean.FALSE; - row[icommit_action] = table.isTemp() - ? (table.onCommitPreserve() ? "PRESERVE" - : "DELETE") - : null; - - t.insertSys(session, store, row); - } - - return t; - } - - /** - * Retrieves a Table object describing the table types - * available in this database.

    - * - * In general, the range of values that may be commonly encountered across - * most DBMS implementations is: - * - *

      - *
    • "TABLE" - *
    • "VIEW" - *
    • "SYSTEM TABLE" - *
    • "GLOBAL TEMPORARY" - *
    • "LOCAL TEMPORARY" - *
    • "ALIAS" - *
    • "SYNONYM" - *

    - * - * This method reports the following from the range above: - * - *

      - *
    • "TABLE" (HSQLDB MEMORY, CACHED and TEXT tables) - *
    • "VIEW" (Views) - *
    • "SYSTEM TABLE" (INFORMATION_SCHEMA views) - *
    • "GLOBAL TEMPORAR" (GLOBAL TEMORARY and TEMP TEXT tables) - *
    • "LOCAL TEMPORARY" (the session-declared LOCAL TEMPORARY tables) - *

    - * - * @return a Table object describing the table types - * available in this database - */ - Table SYSTEM_TABLETYPES(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_TABLETYPES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_TABLETYPES]); - - addColumn(t, "TABLE_TYPE", SQL_IDENTIFIER); // not null - - // order: TABLE_TYPE - // true PK - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_TABLETYPES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[]{ 0 }, true); - - return t; - } - - Object[] row; - - for (int i = 0; i < tableTypes.length; i++) { - row = t.getEmptyRowData(); - row[0] = tableTypes[i]; - - t.insertSys(session, store, row); - } - - return t; - } - - /** - * Retrieves a Table object describing the - * result expected by the JDBC DatabaseMetaData interface implementation - * for system-defined SQL types supported as table columns. - * - *

    -     * TYPE_NAME          VARCHAR   the canonical name for DDL statements.
    -     * DATA_TYPE          SMALLINT  data type code from DITypes.
    -     * PRECISION          INTEGER   max column size.
    -     *                              number  : max precision.
    -     *                              character  : max characters.
    -     *                              datetime  : max chars incl. frac. component.
    -     * LITERAL_PREFIX     VARCHAR   char(s) prefixing literal of this type.
    -     * LITERAL_SUFFIX     VARCHAR   char(s) terminating literal of this type.
    -     * CREATE_PARAMS      VARCHAR   Localized syntax-order list of domain
    -     *                              create parameter keywords.
    -     *                              - for human consumption only
    -     * NULLABLE           SMALLINT  {No Nulls | Nullable | Unknown}
    -     * CASE_SENSITIVE     BOOLEAN   case-sensitive in collations/comparisons?
    -     * SEARCHABLE         SMALLINT  {None | Char (Only WHERE .. LIKE) |
    -     *                               Basic (Except WHERE .. LIKE) |
    -     *                               Searchable (All forms)}
    -     * UNSIGNED_ATTRIBUTE BOOLEAN   {TRUE  (unsigned) | FALSE (signed) |
    -     *                               NULL (non-numeric or not applicable)}
    -     * FIXED_PREC_SCALE   BOOLEAN   {TRUE (fixed) | FALSE (variable) |
    -     *                               NULL (non-numeric or not applicable)}
    -     * AUTO_INCREMENT     BOOLEAN   automatic unique value generated for
    -     *                              inserts and updates when no value or
    -     *                              NULL specified?
    -     * LOCAL_TYPE_NAME    VARCHAR   localized name of data type;
    -     *                              - NULL if not supported.
    -     *                              - for human consumption only
    -     * MINIMUM_SCALE      SMALLINT  minimum scale supported.
    -     * MAXIMUM_SCALE      SMALLINT  maximum scale supported.
    -     * SQL_DATA_TYPE      INTEGER   value expected in SQL CLI SQL_DESC_TYPE
    -     *                              field of the SQLDA.
    -     * SQL_DATETIME_SUB   INTEGER   SQL CLI datetime/interval subcode.
    -     * NUM_PREC_RADIX     INTEGER   numeric base w.r.t # of digits reported in
    -     *                              PRECISION column (typically 10).
    -     * 

    - * - * @return a Table object describing the - * system-defined SQL types supported as table columns - */ - final Table SYSTEM_TYPEINFO(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_TYPEINFO]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_TYPEINFO]); - - //------------------------------------------- - // required by JDBC: - // ------------------------------------------ - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); - addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); - addColumn(t, "PRECISION", Type.SQL_INTEGER); - addColumn(t, "LITERAL_PREFIX", CHARACTER_DATA); - addColumn(t, "LITERAL_SUFFIX", CHARACTER_DATA); - addColumn(t, "CREATE_PARAMS", CHARACTER_DATA); - addColumn(t, "NULLABLE", Type.SQL_SMALLINT); - addColumn(t, "CASE_SENSITIVE", Type.SQL_BOOLEAN); - addColumn(t, "SEARCHABLE", Type.SQL_INTEGER); - addColumn(t, "UNSIGNED_ATTRIBUTE", Type.SQL_BOOLEAN); - addColumn(t, "FIXED_PREC_SCALE", Type.SQL_BOOLEAN); - addColumn(t, "AUTO_INCREMENT", Type.SQL_BOOLEAN); - addColumn(t, "LOCAL_TYPE_NAME", SQL_IDENTIFIER); - addColumn(t, "MINIMUM_SCALE", Type.SQL_SMALLINT); - addColumn(t, "MAXIMUM_SCALE", Type.SQL_SMALLINT); - addColumn(t, "SQL_DATA_TYPE", Type.SQL_INTEGER); - addColumn(t, "SQL_DATETIME_SUB", Type.SQL_INTEGER); - addColumn(t, "NUM_PREC_RADIX", Type.SQL_INTEGER); - - //------------------------------------------- - // SQL CLI / ODBC - not in JDBC spec - // ------------------------------------------ - addColumn(t, "INTERVAL_PRECISION", Type.SQL_INTEGER); - - // order: DATA_TYPE, TYPE_NAME - // true primary key - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_TYPEINFO].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 1, 0 - }, true); - - return t; - } - - //----------------------------------------- - // Same as SYSTEM_TYPEINFO - //----------------------------------------- - final int itype_name = 0; - final int idata_type = 1; - final int iprecision = 2; - final int iliteral_prefix = 3; - final int iliteral_suffix = 4; - final int icreate_params = 5; - final int inullable = 6; - final int icase_sensitive = 7; - final int isearchable = 8; - final int iunsigned_attribute = 9; - final int ifixed_prec_scale = 10; - final int iauto_increment = 11; - final int ilocal_type_name = 12; - final int iminimum_scale = 13; - final int imaximum_scale = 14; - final int isql_data_type = 15; - final int isql_datetime_sub = 16; - final int inum_prec_radix = 17; - - //------------------------------------------ - // Extensions - //------------------------------------------ - // not in JDBC, but in SQL CLI SQLDA / ODBC - //------------------------------------------ - final int iinterval_precision = 18; - Object[] row; - Iterator it = Type.typeNames.keySet().iterator(); - boolean translateTTI = database.sqlTranslateTTI; - - while (it.hasNext()) { - String typeName = (String) it.next(); - int typeCode = Type.typeNames.get(typeName); - Type type = Type.getDefaultType(typeCode); - - if (type == null) { - continue; - } - - if (translateTTI) { - if (type.isIntervalType()) { - type = ((IntervalType) type).getCharacterType(); - } - } - - row = t.getEmptyRowData(); - row[itype_name] = typeName; - row[idata_type] = ValuePool.getInt(type.getJDBCTypeCode()); - - long maxPrecision = type.getMaxPrecision(); - - row[iprecision] = maxPrecision > Integer.MAX_VALUE - ? ValuePool.INTEGER_MAX - : ValuePool.getInt((int) maxPrecision); - - if (type.isBinaryType() || type.isCharacterType() - || type.isDateTimeType() || type.isIntervalType()) { - row[iliteral_prefix] = "'"; - row[iliteral_suffix] = "'"; - } - - if (type.acceptsPrecision() && type.acceptsScale()) { - row[icreate_params] = "PRECISION,SCALE"; - } else if (type.acceptsPrecision()) { - row[icreate_params] = type.isNumberType() ? "PRECISION" - : "LENGTH"; - } else if (type.acceptsScale()) { - row[icreate_params] = "SCALE"; - } - - row[inullable] = ValuePool.INTEGER_1; - row[icase_sensitive] = - type.isCharacterType() - && type.getCollation().isCaseSensitive() ? Boolean.TRUE - : Boolean.FALSE; - - if (type.isLobType()) { - row[isearchable] = ValuePool.INTEGER_0; - } else if (type.isCharacterType() - || (type.isBinaryType() && !type.isBitType())) { - row[isearchable] = ValuePool.getInt(3); - } else { - row[isearchable] = ValuePool.getInt(2); - } - - row[iunsigned_attribute] = Boolean.FALSE; - row[ifixed_prec_scale] = - type.typeCode == Types.SQL_NUMERIC - || type.typeCode == Types.SQL_DECIMAL ? Boolean.TRUE - : Boolean.FALSE; - row[iauto_increment] = type.isIntegralType() ? Boolean.TRUE - : Boolean.FALSE; - row[ilocal_type_name] = null; - row[iminimum_scale] = ValuePool.INTEGER_0; - row[imaximum_scale] = ValuePool.getInt(type.getMaxScale()); - row[isql_data_type] = null; - row[isql_datetime_sub] = null; - row[inum_prec_radix] = ValuePool.getInt(type.getPrecisionRadix()); - - //------------------------------------------ - if (type.isIntervalType()) { - row[iinterval_precision] = null; - } - - t.insertSys(session, store, row); - } - - row = t.getEmptyRowData(); - row[itype_name] = "DISTINCT"; - row[idata_type] = ValuePool.getInt(Types.DISTINCT); - - return t; - } - - /** - * Retrieves a Table object describing the accessible - * attributes of the accessible user-defined type (UDT) objects - * defined within this database.

    - * - * This description does not contain inherited attributes.

    - * - * Each row is a user-defined type attributes description with the - * following columns: - * - *

    -     * TYPE_CAT          VARCHAR   type catalog
    -     * TYPE_SCHEM        VARCHAR   type schema
    -     * TYPE_NAME         VARCHAR   type name
    -     * ATTR_NAME         VARCHAR   attribute name
    -     * DATA_TYPE         SMALLINT  attribute's SQL type from DITypes
    -     * ATTR_TYPE_NAME    VARCHAR   UDT: fully qualified type name
    -     *                            REF: fully qualified type name of target type of
    -     *                            the reference type.
    -     * ATTR_SIZE         INTEGER   column size.
    -     *                            char or date types  : maximum number of characters;
    -     *                            numeric or decimal types  : precision.
    -     * DECIMAL_DIGITS    INTEGER   # of fractional digits (scale) of number type
    -     * NUM_PREC_RADIX    INTEGER   Radix of number type
    -     * NULLABLE          INTEGER   whether NULL is allowed
    -     * REMARKS           VARCHAR   comment describing attribute
    -     * ATTR_DEF          VARCHAR   default attribute value
    -     * SQL_DATA_TYPE     INTEGER   expected value of SQL CLI SQL_DESC_TYPE in the SQLDA
    -     * SQL_DATETIME_SUB  INTEGER   DATETIME/INTERVAL  : datetime/interval subcode
    -     * CHAR_OCTET_LENGTH INTEGER   for char types:  max bytes in column
    -     * ORDINAL_POSITION  INTEGER   index of column in table (starting at 1)
    -     * IS_NULLABLE       VARCHAR   "NO"  : strictly no NULL values;
    -     *                             "YES"  : maybe NULL values;
    -     *                             ""  : unknown.
    -     * SCOPE_CATALOG     VARCHAR   catalog of REF attribute scope table or NULL
    -     * SCOPE_SCHEMA      VARCHAR   schema of REF attribute scope table or NULL
    -     * SCOPE_TABLE       VARCHAR   name of REF attribute scope table or NULL
    -     * SOURCE_DATA_TYPE  SMALLINT  For DISTINCT or user-generated REF DATA_TYPE:
    -     *                            source SQL type from DITypes
    -     *                            For other DATA_TYPE values:  NULL
    -     * 
    - * - * Note: Currently, neither the HSQLDB engine or the JDBC driver - * support UDTs, so an empty table is returned.

    - * @return a Table object describing the accessible - * attrubutes of the accessible user-defined type - * (UDT) objects defined within this database - * @throws HsqlException if an error occurs while producing the table - */ - Table SYSTEM_UDTATTRIBUTES(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_UDTATTRIBUTES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_UDTATTRIBUTES]); - - addColumn(t, "TYPE_CAT", SQL_IDENTIFIER); - addColumn(t, "TYPE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "ATTR_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null - addColumn(t, "ATTR_TYPE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "ATTR_SIZE", Type.SQL_INTEGER); - addColumn(t, "DECIMAL_DIGITS", Type.SQL_INTEGER); - addColumn(t, "NUM_PREC_RADIX", Type.SQL_INTEGER); - addColumn(t, "NULLABLE", Type.SQL_INTEGER); - addColumn(t, "REMARKS", CHARACTER_DATA); - addColumn(t, "ATTR_DEF", CHARACTER_DATA); - addColumn(t, "SQL_DATA_TYPE", Type.SQL_INTEGER); - addColumn(t, "SQL_DATETIME_SUB", Type.SQL_INTEGER); - addColumn(t, "CHAR_OCTET_LENGTH", Type.SQL_INTEGER); - addColumn(t, "ORDINAL_POSITION", Type.SQL_INTEGER); // not null - addColumn(t, "IS_NULLABLE", YES_OR_NO); // not null - addColumn(t, "SCOPE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "SCOPE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "SCOPE_TABLE", SQL_IDENTIFIER); - addColumn(t, "SOURCE_DATA_TYPE", Type.SQL_SMALLINT); - t.createPrimaryKey(); - - return t; - } - - return t; - } - - /** - * Retrieves a Table object describing the accessible - * user-defined types defined in this database.

    - * - * Schema-specific UDTs may have type JAVA_OBJECT, STRUCT, or DISTINCT. - * - *

    Each row is a UDT description with the following columns: - *

      - *
    1. TYPE_CAT VARCHAR : the type's catalog - *
    2. TYPE_SCHEM VARCHAR : type's schema - *
    3. TYPE_NAME VARCHAR : type name - *
    4. CLASS_NAME VARCHAR : Java class name - *
    5. DATA_TYPE VARCHAR : - * type value defined in DITypes; - * one of JAVA_OBJECT, STRUCT, or - * DISTINCT - *
    6. REMARKS VARCHAR : - * explanatory comment on the type - *
    7. BASE_TYPESMALLINT : - * type code of the source type of a DISTINCT type or the - * type that implements the user-generated reference type of the - * SELF_REFERENCING_COLUMN of a structured type as defined in - * DITypes (null if DATA_TYPE is not DISTINCT or not - * STRUCT with REFERENCE_GENERATION = USER_DEFINED) - * - *

    - * - * @return a Table object describing the accessible - * user-defined types defined in this database - */ - Table SYSTEM_UDTS(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_UDTS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_UDTS]); - - addColumn(t, "TYPE_CAT", SQL_IDENTIFIER); - addColumn(t, "TYPE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); - addColumn(t, "CLASS_NAME", CHARACTER_DATA); - addColumn(t, "DATA_TYPE", Type.SQL_INTEGER); - addColumn(t, "REMARKS", CHARACTER_DATA); - addColumn(t, "BASE_TYPE", Type.SQL_SMALLINT); - - // - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_UDTS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, null, false); - - return t; - } - - boolean translateTTI = database.sqlTranslateTTI; - - // column number mappings - final int type_catalog = 0; - final int type_schema = 1; - final int type_name = 2; - final int class_name = 3; - final int data_type = 4; - final int remarks = 5; - final int base_type = 6; - Iterator it = - database.schemaManager.databaseObjectIterator(SchemaObject.TYPE); - - while (it.hasNext()) { - Type distinct = (Type) it.next(); - - if (!distinct.isDistinctType()) { - continue; - } - - Object[] data = t.getEmptyRowData(); - Type type = distinct; - - if (translateTTI) { - if (type.isIntervalType()) { - type = ((IntervalType) type).getCharacterType(); - } - } - - data[type_catalog] = database.getCatalogName().name; - data[type_schema] = distinct.getSchemaName().name; - data[type_name] = distinct.getName().name; - data[class_name] = type.getJDBCClassName(); - data[data_type] = ValuePool.getInt(Types.DISTINCT); - data[remarks] = null; - data[base_type] = ValuePool.getInt(type.getJDBCTypeCode()); - - t.insertSys(session, store, data); - } - - return t; - } - - /** - * Retrieves a Table object describing the accessible - * columns that are automatically updated when any value in a row - * is updated.

    - * - * Each row is a version column description with the following columns: - * - *

      - *
    1. SCOPE SMALLINT : is not used - *
    2. COLUMN_NAME VARCHAR : column name - *
    3. DATA_TYPE SMALLINT : - * SQL data type from java.sql.Types - *
    4. TYPE_NAME SMALLINT : - * Data source dependent type name - *
    5. COLUMN_SIZE INTEGER : precision - *
    6. BUFFER_LENGTH INTEGER : - * length of column value in bytes - *
    7. DECIMAL_DIGITS SMALLINT : scale - *
    8. PSEUDO_COLUMN SMALLINT : - * is this a pseudo column like an Oracle ROWID:
      - * (as defined in java.sql.DatabaseMetadata) - *
        - *
      • versionColumnUnknown - may or may not be - * pseudo column - *
      • versionColumnNotPseudo - is NOT a pseudo column - *
      • versionColumnPseudo - is a pseudo column - *
      - *

    - * - * Note: - * Lists TIMESTAMP columns defined with ON UPDATE CURRENT_TIMESTAMP and the - * columns of SYSTEM_TIME periods. Columns defined as GENERATED AS IDENTITY, - * SEQUENCE, or an expression are not returned as they are not always - * automatically updated when other columns in a row are updated. - * - * @return a Table object describing the columns - * that are automatically updated when any value - * in a row is updated - */ - Table SYSTEM_VERSIONCOLUMNS(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_VERSIONCOLUMNS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS]); - - // ---------------------------------------------------------------- - // required by DatabaseMetaData.getVersionColumns result set - // ---------------------------------------------------------------- - addColumn(t, "SCOPE", Type.SQL_INTEGER); - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "DATA_TYPE", Type.SQL_SMALLINT); // not null - addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_SIZE", Type.SQL_SMALLINT); - addColumn(t, "BUFFER_LENGTH", Type.SQL_INTEGER); - addColumn(t, "DECIMAL_DIGITS", Type.SQL_SMALLINT); - addColumn(t, "PSEUDO_COLUMN", Type.SQL_SMALLINT); // not null - - // ----------------------------------------------------------------- - // required by DatabaseMetaData.getVersionColumns filter parameters - // ----------------------------------------------------------------- - addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - - // ----------------------------------------------------------------- - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_VERSIONCOLUMNS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, null, false); - - return t; - } - - // column number mappings - final int scope = 0; - final int column_name = 1; - final int data_type = 2; - final int type_name = 3; - final int column_size = 4; - final int buffer_length = 5; - final int decimal_digits = 6; - final int pseudo_column = 7; - final int table_catalog = 8; - final int table_schema = 9; - final int table_name = 10; - - // - Iterator tables; - Table table; - Object[] row; - - tables = - database.schemaManager.databaseObjectIterator(SchemaObject.TABLE); - - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (table.isView() - || !session.getGrantee().isFullyAccessibleByRole( - table.getName())) { - continue; - } - - if (table.getSystemPeriod() == null && !table.hasUpdatedColumn()) { - continue; - } - - HsqlName name = table.getName(); - - for (int i = 0; i < table.getColumnCount(); i++) { - ColumnSchema column = table.getColumn(i); - - if (!column.isSystemPeriod() && !column.isAutoUpdate()) { - continue; - } - - row = t.getEmptyRowData(); - row[scope] = Integer.valueOf(0); - row[column_name] = column.getNameString(); - row[data_type] = - Integer.valueOf(column.getDataType().getJDBCTypeCode()); - row[type_name] = column.getDataType().getNameString(); - row[column_size] = - Integer.valueOf(column.getDataType().displaySize()); - row[buffer_length] = Integer.valueOf(0); - row[decimal_digits] = - Integer.valueOf(column.getDataType().scale); - row[pseudo_column] = Integer.valueOf(1); - row[table_catalog] = database.getCatalogName().name; - row[table_schema] = name.schema.name; - row[table_name] = name.name; - - t.insertSys(session, store, row); - } - } - - return t; - } - - /** - * Retrieves a Table object describing the - * visible Users defined within this database. - * @return table containing information about the users defined within - * this database - */ - Table SYSTEM_USERS(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_USERS]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_USERS]); - - addColumn(t, "USER_NAME", SQL_IDENTIFIER); - addColumn(t, "ADMIN", Type.SQL_BOOLEAN); - addColumn(t, "INITIAL_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "AUTHENTICATION", SQL_IDENTIFIER); - addColumn(t, "PASSWORD_DIGEST", SQL_IDENTIFIER); - - // order: USER - // true PK - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_USERS].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[]{ 0 }, true); - - return t; - } - - // Intermediate holders - HsqlArrayList users; - User user; - Object[] row; - HsqlName initialSchema; - - // Initialization - users = database.getUserManager().listVisibleUsers(session); - - // Do it. - for (int i = 0; i < users.size(); i++) { - row = t.getEmptyRowData(); - user = (User) users.get(i); - initialSchema = user.getInitialSchema(); - row[0] = user.getName().getNameString(); - row[1] = user.isAdmin() ? Boolean.TRUE - : Boolean.FALSE; - row[2] = ((initialSchema == null) ? null - : initialSchema.name); - row[3] = user.isLocalOnly ? Tokens.T_LOCAL - : user.isExternalOnly - ? Tokens.T_EXTERNAL - : Tokens.T_ANY; - row[4] = user.getPasswordDigest(); - - t.insertSys(session, store, row); - } - - return t; - } - -// ----------------------------------------------------------------------------- -// SQL SCHEMATA VIEWS -// limited to views used in JDBC DatabaseMetaData - - /** - * Retrieves a Table object describing the visible - * access rights for all visible columns of all accessible - * tables defined within this database.

    - * - * Each row is a column privilege description with the following - * columns: - * - *

    -     * TABLE_CAT    VARCHAR   table catalog
    -     * TABLE_SCHEM  VARCHAR   table schema
    -     * TABLE_NAME   VARCHAR   table name
    -     * COLUMN_NAME  VARCHAR   column name
    -     * GRANTOR      VARCHAR   grantor of access
    -     * GRANTEE      VARCHAR   grantee of access
    -     * PRIVILEGE    VARCHAR   name of access
    -     * IS_GRANTABLE VARCHAR   grantable?: "YES" - grant to others, else "NO"
    -     * 
    - * - * Note: From 1.9.0, HSQLDB supports column level - * privileges.

    - * - * @return a Table object describing the visible - * access rights for all visible columns of - * all accessible tables defined within this - * database - */ - final Table COLUMN_PRIVILEGES(Session session, PersistentStore store) { - - Table t = sysTables[COLUMN_PRIVILEGES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[COLUMN_PRIVILEGES]); - - addColumn(t, "GRANTOR", SQL_IDENTIFIER); // not null - addColumn(t, "GRANTEE", SQL_IDENTIFIER); // not null - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "PRIVILEGE_TYPE", CHARACTER_DATA); // not null - addColumn(t, "IS_GRANTABLE", YES_OR_NO); // not null - - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[COLUMN_PRIVILEGES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 2, 3, 4, 5, 6, 1, 0 - }, false); - - return t; - } - -// calculated column values - String tableCatalog; - String tableSchema; - String tableName; - Grantee granteeObject; - -// intermediate holders - User user; - Iterator tables; - Table table; - Object[] row; - -// column number mappings - final int grantor = 0; - final int grantee = 1; - final int table_catalog = 2; - final int table_schema = 3; - final int table_name = 4; - final int column_name = 5; - final int privilege_type = 6; - final int is_grantable = 7; - - // enumerations - OrderedHashSet grantees = - session.getGrantee().getGranteeAndAllRolesWithPublic(); - -// Initialization - tables = allTables(); - - while (tables.hasNext()) { - table = (Table) tables.next(); - tableName = table.getName().name; - tableCatalog = database.getCatalogName().name; - tableSchema = table.getSchemaName().name; - - for (int i = 0; i < grantees.size(); i++) { - granteeObject = (Grantee) grantees.get(i); - - OrderedHashSet rights = - granteeObject.getAllDirectPrivileges(table); - OrderedHashSet grants = - granteeObject.getAllGrantedPrivileges(table); - - if (!grants.isEmpty()) { - grants.addAll(rights); - - rights = grants; - } - - for (int j = 0; j < rights.size(); j++) { - Right right = (Right) rights.get(j); - Right grantableRight = right.getGrantableRights(); - - for (int k = 0; k < Right.tablePrivilegeTypes.length; - k++) { - OrderedHashSet columnList = - right.getColumnsForPrivilege( - table, Right.tablePrivilegeTypes[k]); - OrderedHashSet grantableList = - grantableRight.getColumnsForPrivilege(table, - Right.tablePrivilegeTypes[k]); - - for (int l = 0; l < columnList.size(); l++) { - HsqlName fullName = ((HsqlName) columnList.get(l)); - - row = t.getEmptyRowData(); - row[grantor] = right.getGrantor().getName().name; - row[grantee] = right.getGrantee().getName().name; - row[table_catalog] = tableCatalog; - row[table_schema] = tableSchema; - row[table_name] = tableName; - row[column_name] = fullName.name; - row[privilege_type] = Right.tablePrivilegeNames[k]; - row[is_grantable] = - right.getGrantee() == table.getOwner() - || grantableList.contains(fullName) ? "YES" - : "NO"; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) {} - } - } - } - } - } - - return t; - } - - /** - * The SEQUENCES view has one row for each external sequence - * generator.

    - * - * Definition: - * - *

    -     *
    -     *      SEQUENCE_CATALOG     VARCHAR NULL,
    -     *      SEQUENCE_SCHEMA      VARCHAR NULL,
    -     *      SEQUENCE_NAME        VARCHAR NOT NULL,
    -     *      DATA_TYPE            CHARACTER_DATA
    -     *      NUMERIC_PRECISION    CARDINAL_NUMBER
    -     *      NUMERIC_PRECISION_RADIX CARDINAL_NUMBER
    -     *      NUMERIC_SCALE        CARDINAL_NUMBER
    -     *      START_VALUE          VARCHAR NOT NULL,
    -     *      MINIMUM_VALUE        VARCHAR NOT NULL,
    -     *      MAXIMUM_VALUE        VARCHAR NOT NULL,
    -     *      INCREMENT            VARCHAR NOT NULL,
    -     *      CYCLE_OPTION         VARCHAR {'YES', 'NO'},
    -     *      DECLARED_DATA_TYPE   CHARACTER_DATA
    -     *      DECLARED_NUMERIC_PRECISION CARDINAL_NUMBER
    -     *      DECLARED_NUMERIC_SCALE     CARDINAL_NUMBER
    -     *      START_WITH           VARCHAR NOT NULL,
    -     *      NEXT_VALUE           VARCHAR NOT NULL,
    -     *
    -     * 
    - * - * DESCRIPTION: - * - *
      - *
    1. The values of SEQUENCE_CATALOG, SEQUENCE_SCHEMA, and - * SEQUENCE_NAME are the catalog name, unqualified schema name, - * and qualified identifier, respectively, of the sequence generator - * being described. - * - *
    2. The values of SEQUENCE_CATALOG, SEQUENCE_SCHEMA, SEQUENCE_NAME, and - * DTD_IDENTIFIER are the values of OBJECT_CATALOG, OBJECT_SCHEMA, - * OBJECT_NAME, and DTD_IDENTIFIER, respectively, of the row in - * DATA_TYPE_DESCRIPTOR (not yet implemented) that describes the data - * type of the sequence generator. - * - *
    3. The values of MAXIMUM_VALUE, MINIMUM_VALUE, and INCREMENT are the - * character representations of maximum value, minimum value, - * and increment, respectively, of the sequence generator being - * described. - * - *
    4. The values of CYCLE_OPTION have the following meanings:
      - * - * YES : The cycle option of the sequence generator - * is CYCLE.
      - * NO : The cycle option of the sequence generator is - * NO CYCLE. - * - *
    5. The value of START_WITH is HSQLDB-specific (not in the SQL 200n - * spec). It is the character representation of the START WITH value. - * - *
    6. The value of NEXT_VALUE is HSQLDB-specific (not in the SQL 200n)

      - * This is the character representation of the value that - * would be generated by NEXT VALUE FOR when this sequence - * is materialized in an SQL statement.

      - *

    - * - * @return Table - */ - final Table SEQUENCES(Session session, PersistentStore store) { - - Table t = sysTables[SEQUENCES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SEQUENCES]); - - addColumn(t, "SEQUENCE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "SEQUENCE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "SEQUENCE_NAME", SQL_IDENTIFIER); - addColumn(t, "DATA_TYPE", CHARACTER_DATA); - addColumn(t, "NUMERIC_PRECISION", CARDINAL_NUMBER); - addColumn(t, "NUMERIC_PRECISION_RADIX", CARDINAL_NUMBER); - addColumn(t, "NUMERIC_SCALE", CARDINAL_NUMBER); - addColumn(t, "START_VALUE", CHARACTER_DATA); - addColumn(t, "MINIMUM_VALUE", CHARACTER_DATA); - addColumn(t, "MAXIMUM_VALUE", CHARACTER_DATA); - addColumn(t, "INCREMENT", CHARACTER_DATA); - addColumn(t, "CYCLE_OPTION", YES_OR_NO); - addColumn(t, "DECLARED_DATA_TYPE", CHARACTER_DATA); - addColumn(t, "DECLARED_NUMERIC_PRECISION", CARDINAL_NUMBER); - addColumn(t, "DECLARED_NUMERIC_SCALE", CARDINAL_NUMBER); - - // HSQLDB-specific - addColumn(t, "START_WITH", CHARACTER_DATA); - addColumn(t, "NEXT_VALUE", CHARACTER_DATA); - - // order SEQUENCE_CATALOG, SEQUENCE_SCHEMA, SEQUENCE_NAME - // false PK, as CATALOG may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SEQUENCES].name, false, SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2 - }, false); - - return t; - } - - // - final int sequence_catalog = 0; - final int sequence_schema = 1; - final int sequence_name = 2; - final int data_type = 3; - final int numeric_precision = 4; - final int numeric_precision_radix = 5; - final int numeric_scale = 6; - final int start_value = 7; - final int minimum_value = 8; - final int maximum_value = 9; - final int increment = 10; - final int cycle_option = 11; - final int declared_data_type = 12; - final int declared_numeric_precision = 13; - final int declared_numeric_scale = 14; - final int start_with = 15; - final int next_value = 16; - - // - Iterator it; - Object[] row; - NumberSequence sequence; - - it = database.schemaManager.databaseObjectIterator( - SchemaObject.SEQUENCE); - - while (it.hasNext()) { - sequence = (NumberSequence) it.next(); - - if (!isAccessible(session, sequence)) { - continue; - } - - row = t.getEmptyRowData(); - - NumberType type = (NumberType) sequence.getDataType(); - int radix = - (type.typeCode == Types.SQL_NUMERIC || type.typeCode == Types - .SQL_DECIMAL) ? 10 - : 2; - - row[sequence_catalog] = database.getCatalogName().name; - row[sequence_schema] = sequence.getSchemaName().name; - row[sequence_name] = sequence.getName().name; - row[data_type] = sequence.getDataType().getFullNameString(); - row[numeric_precision] = ValuePool.getInt(type.getPrecision()); - row[numeric_precision_radix] = ValuePool.getInt(radix); - row[numeric_scale] = ValuePool.INTEGER_0; - row[start_value] = String.valueOf(sequence.getStartValue()); - row[minimum_value] = String.valueOf(sequence.getMinValue()); - row[maximum_value] = String.valueOf(sequence.getMaxValue()); - row[increment] = String.valueOf(sequence.getIncrement()); - row[cycle_option] = sequence.isCycle() ? "YES" - : "NO"; - row[declared_data_type] = row[data_type]; - row[declared_numeric_precision] = row[numeric_precision]; - row[declared_numeric_scale] = row[numeric_scale]; - row[start_with] = String.valueOf(sequence.getStartValue()); - row[next_value] = String.valueOf(sequence.peek()); - - t.insertSys(session, store, row); - } - - return t; - } - - final Table SYSTEM_SEQUENCES(Session session, PersistentStore store) { - - Table t = sysTables[SYSTEM_SEQUENCES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[SYSTEM_SEQUENCES]); - - addColumn(t, "SEQUENCE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "SEQUENCE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "SEQUENCE_NAME", SQL_IDENTIFIER); - addColumn(t, "DATA_TYPE", CHARACTER_DATA); - addColumn(t, "NUMERIC_PRECISION", CARDINAL_NUMBER); - addColumn(t, "NUMERIC_PRECISION_RADIX", CARDINAL_NUMBER); - addColumn(t, "NUMERIC_SCALE", CARDINAL_NUMBER); - addColumn(t, "MAXIMUM_VALUE", CHARACTER_DATA); - addColumn(t, "MINIMUM_VALUE", CHARACTER_DATA); - addColumn(t, "INCREMENT", CHARACTER_DATA); - addColumn(t, "CYCLE_OPTION", YES_OR_NO); - addColumn(t, "DECLARED_DATA_TYPE", CHARACTER_DATA); - addColumn(t, "DECLARED_NUMERIC_PRECISION", CARDINAL_NUMBER); - addColumn(t, "DECLARED_NUMERIC_SCALE", CARDINAL_NUMBER); - - // HSQLDB-specific - addColumn(t, "START_WITH", CHARACTER_DATA); - addColumn(t, "NEXT_VALUE", CHARACTER_DATA); - - // order SEQUENCE_CATALOG, SEQUENCE_SCHEMA, SEQUENCE_NAME - // false PK, as CATALOG may be null - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[SYSTEM_SEQUENCES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2 - }, false); - - return t; - } - - // - final int sequence_catalog = 0; - final int sequence_schema = 1; - final int sequence_name = 2; - final int data_type = 3; - final int numeric_precision = 4; - final int numeric_precision_radix = 5; - final int numeric_scale = 6; - final int maximum_value = 7; - final int minimum_value = 8; - final int increment = 9; - final int cycle_option = 10; - final int declared_data_type = 11; - final int declared_numeric_precision = 12; - final int declared_numeric_scale = 13; - final int start_with = 14; - final int next_value = 15; - - // - Iterator it; - Object[] row; - NumberSequence sequence; - - it = database.schemaManager.databaseObjectIterator( - SchemaObject.SEQUENCE); - - while (it.hasNext()) { - sequence = (NumberSequence) it.next(); - - if (!isAccessible(session, sequence)) { - continue; - } - - row = t.getEmptyRowData(); - - NumberType type = (NumberType) sequence.getDataType(); - int radix = - (type.typeCode == Types.SQL_NUMERIC || type.typeCode == Types - .SQL_DECIMAL) ? 10 - : 2; - - row[sequence_catalog] = database.getCatalogName().name; - row[sequence_schema] = sequence.getSchemaName().name; - row[sequence_name] = sequence.getName().name; - row[data_type] = sequence.getDataType().getFullNameString(); - row[numeric_precision] = ValuePool.getInt(type.getPrecision()); - row[numeric_precision_radix] = ValuePool.getInt(radix); - row[numeric_scale] = ValuePool.INTEGER_0; - row[maximum_value] = String.valueOf(sequence.getMaxValue()); - row[minimum_value] = String.valueOf(sequence.getMinValue()); - row[increment] = String.valueOf(sequence.getIncrement()); - row[cycle_option] = sequence.isCycle() ? "YES" - : "NO"; - row[declared_data_type] = row[data_type]; - row[declared_numeric_precision] = row[numeric_precision]; - row[declared_numeric_scale] = row[numeric_scale]; - row[start_with] = String.valueOf(sequence.getStartValue()); - row[next_value] = String.valueOf(sequence.peek()); - - t.insertSys(session, store, row); - } - - return t; - } - -/* - WHERE ( GRANTEE IN ( 'PUBLIC', CURRENT_USER ) - OR GRANTEE IN ( SELECT ROLE_NAME FROM ENABLED_ROLES ) - OR GRANTOR = CURRENT_USER - OR GRANTOR IN ( SELECT ROLE_NAME FROM ENABLED_ROLES ) ) - -*/ - -/** - * The TABLE_PRIVILEGES view has one row for each visible access - * right for each accessible table defined within this database.

    - * - * Each row is a table privilege description with the following columns: - * - *

    -     * GRANTOR      VARCHAR   grantor of access
    -     * GRANTEE      VARCHAR   grantee of access
    -     * TABLE_CATALOG    VARCHAR   table catalog
    -     * TABLE_SCHEMA  VARCHAR   table schema
    -     * TABLE_NAME   VARCHAR   table name
    -     * PRIVILEGE_TYPE    VARCHAR   { "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "REFERENCES" | "TRIGGER" }
    -     * IS_GRANTABLE VARCHAR   { "YES" | "NO" }
    -     * WITH_HIERARCHY   { "YES" | "NO" }
    -     * 
    - * - * @return a Table object describing the visible - * access rights for each accessible table - * defined within this database - */ - final Table TABLE_PRIVILEGES(Session session, PersistentStore store) { - - Table t = sysTables[TABLE_PRIVILEGES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[TABLE_PRIVILEGES]); - - addColumn(t, "GRANTOR", SQL_IDENTIFIER); // not null - addColumn(t, "GRANTEE", SQL_IDENTIFIER); // not null - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null - addColumn(t, "PRIVILEGE_TYPE", CHARACTER_DATA); // not null - addColumn(t, "IS_GRANTABLE", YES_OR_NO); // not null - addColumn(t, "WITH_HIERARCHY", YES_OR_NO); - - // - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[TABLE_PRIVILEGES].name, false, - SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, 3, 4, 5, 6 - }, false); - - return t; - } - - // calculated column values - String tableCatalog; - String tableSchema; - String tableName; - Grantee granteeObject; - String privilege; - - // intermediate holders - Iterator tables; - Table table; - Object[] row; - - // column number mappings - final int grantor = 0; - final int grantee = 1; - final int table_catalog = 2; - final int table_schema = 3; - final int table_name = 4; - final int privilege_type = 5; - final int is_grantable = 6; - final int with_hierarchy = 7; - OrderedHashSet grantees = - session.getGrantee().getGranteeAndAllRolesWithPublic(); - - tables = allTables(); - - while (tables.hasNext()) { - table = (Table) tables.next(); - tableName = table.getName().name; - tableCatalog = table.getCatalogName().name; - tableSchema = table.getSchemaName().name; - - for (int i = 0; i < grantees.size(); i++) { - granteeObject = (Grantee) grantees.get(i); - - OrderedHashSet rights = - granteeObject.getAllDirectPrivileges(table); - OrderedHashSet grants = - granteeObject.getAllGrantedPrivileges(table); - - if (!grants.isEmpty()) { - grants.addAll(rights); - - rights = grants; - } - - for (int j = 0; j < rights.size(); j++) { - Right right = (Right) rights.get(j); - Right grantableRight = right.getGrantableRights(); - - for (int k = 0; k < Right.tablePrivilegeTypes.length; - k++) { - if (!right.canAccess(Right.tablePrivilegeTypes[k])) { - continue; - } - - privilege = Right.tablePrivilegeNames[k]; - row = t.getEmptyRowData(); - row[grantor] = right.getGrantor().getName().name; - row[grantee] = right.getGrantee().getName().name; - row[table_catalog] = tableCatalog; - row[table_schema] = tableSchema; - row[table_name] = tableName; - row[privilege_type] = privilege; - row[is_grantable] = - right.getGrantee() == table.getOwner() - || grantableRight.canAccess( - Right.tablePrivilegeTypes[k]) ? "YES" - : "NO"; - row[with_hierarchy] = "NO"; - - try { - t.insertSys(session, store, row); - } catch (HsqlException e) {} - } - } - } - } - - return t; - } - - Table TABLES(Session session, PersistentStore store) { - - Table t = sysTables[TABLES]; - - if (t == null) { - t = createBlankTable(sysTableHsqlNames[TABLES]); - - addColumn(t, "TABLE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "TABLE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); - addColumn(t, "TABLE_TYPE", CHARACTER_DATA); - addColumn(t, "SELF_REFERENCING_COLUMN_NAME", SQL_IDENTIFIER); - addColumn(t, "REFERENCE_GENERATION", CHARACTER_DATA); - addColumn(t, "USER_DEFINED_TYPE_CATALOG", SQL_IDENTIFIER); - addColumn(t, "USER_DEFINED_TYPE_SCHEMA", SQL_IDENTIFIER); - addColumn(t, "USER_DEFINED_TYPE_NAME", SQL_IDENTIFIER); - addColumn(t, "IS_INSERTABLE_INTO", YES_OR_NO); - addColumn(t, "IS_TYPED", YES_OR_NO); - addColumn(t, "COMMIT_ACTION", CHARACTER_DATA); - - // - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[TABLES].name, false, SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[] { - 0, 1, 2, - }, false); - - return t; - } - - // intermediate holders - Iterator tables; - Table table; - Object[] row; - final int table_catalog = 0; - final int table_schema = 1; - final int table_name = 2; - final int table_type = 3; - final int self_referencing_column_name = 4; - final int reference_generation = 5; - final int user_defined_type_catalog = 6; - final int user_defined_type_schema = 7; - final int user_defined_type_name = 8; - final int is_insertable_into = 9; - final int is_typed = 10; - final int commit_action = 11; - - // Initialization - tables = allTables(); - - // Do it. - while (tables.hasNext()) { - table = (Table) tables.next(); - - if (!isAccessible(session, table)) { - continue; - } - - row = t.getEmptyRowData(); - row[table_catalog] = database.getCatalogName().name; - row[table_schema] = table.getSchemaName().name; - row[table_name] = table.getName().name; - - switch (table.getTableType()) { - - case TableBase.INFO_SCHEMA_TABLE : - case TableBase.VIEW_TABLE : - row[table_type] = "VIEW"; - row[is_insertable_into] = table.isInsertable() - ? Tokens.T_YES - : Tokens.T_NO; - break; - - case TableBase.TEMP_TABLE : - case TableBase.TEMP_TEXT_TABLE : - row[table_type] = "GLOBAL TEMPORARY"; - row[is_insertable_into] = "YES"; - break; - - default : - if (table.isSystemVersioned()) { - row[table_type] = "SYSTEM_VERSIONED"; - } else { - row[table_type] = "BASE TABLE"; - } - - row[is_insertable_into] = table.isInsertable() - ? Tokens.T_YES - : Tokens.T_NO; - break; - } - - row[self_referencing_column_name] = null; - row[reference_generation] = null; - row[user_defined_type_catalog] = null; - row[user_defined_type_schema] = null; - row[user_defined_type_name] = null; - row[is_typed] = "NO"; - row[commit_action] = table.isTemp() - ? (table.onCommitPreserve() ? "PRESERVE" - : "DELETE") - : null; - - t.insertSys(session, store, row); - } - - return t; - } - -// ----------------------------------------------------------------------------- -// SQL SCHEMATA BASE TABLE - - /** - * Retrieves a Table object naming the accessible catalogs - * defined within this database.

    - * - * Each row is a catalog name description with the following column: - * - *

    -     * TABLE_CAT   VARCHAR   catalog name
    -     * 

    - * - * @return a Table object naming the accessible - * catalogs defined within this database - */ - final Table INFORMATION_SCHEMA_CATALOG_NAME(Session session, - PersistentStore store) { - - Table t = sysTables[INFORMATION_SCHEMA_CATALOG_NAME]; - - if (t == null) { - t = createBlankTable( - sysTableHsqlNames[INFORMATION_SCHEMA_CATALOG_NAME]); - - addColumn(t, "CATALOG_NAME", SQL_IDENTIFIER); // not null - - // order: TABLE_CAT - // true PK - HsqlName name = HsqlNameManager.newInfoSchemaObjectName( - sysTableHsqlNames[INFORMATION_SCHEMA_CATALOG_NAME].name, - false, SchemaObject.INDEX); - - t.createPrimaryKeyConstraint(name, new int[]{ 0 }, true); - - return t; - } - - Object[] row = t.getEmptyRowData(); - - row[0] = database.getCatalogName().name; - - t.insertSys(session, store, row); - - return t; - } -} diff --git a/database/hsqldb/src/org/hsqldb/error/Error.java b/database/hsqldb/src/org/hsqldb/error/Error.java deleted file mode 100644 index 885d8927..00000000 --- a/database/hsqldb/src/org/hsqldb/error/Error.java +++ /dev/null @@ -1,324 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.error; - -import java.lang.reflect.Field; - -import org.hsqldb.HsqlException; -import org.hsqldb.lib.StringUtil; -import org.hsqldb.resources.ResourceBundleHandler; -import org.hsqldb.result.Result; - -/** - * Contains static factory methods to produce instances of HsqlException - * - * @author Loic Lefevre - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public final class Error { - - // - public static boolean TRACE = false; - public static boolean TRACESYSTEMOUT = false; - - // - private static final String defaultMessage = "S1000 General error"; - private static final String errPropsName = "sql-state-messages"; - private static final int bundleHandle = - ResourceBundleHandler.getBundleHandle(errPropsName, null); - private static final String MESSAGE_TAG = "$$"; - private static final int SQL_STATE_DIGITS = 5; - private static final int SQL_CODE_DIGITS = 4; - private static final int ERROR_CODE_BASE = 11; - - public static RuntimeException runtimeError(int code, String add) { - - HsqlException e = error(code, add); - - return new RuntimeException(e.getMessage()); - } - - public static HsqlException error(int code, String add) { - return error((Throwable) null, code, add); - } - - public static HsqlException error(Throwable t, int code, String add) { - - String s = getMessage(code); - - if (add != null) { - s += ": " + add; - } - - return new HsqlException(t, s.substring(SQL_STATE_DIGITS + 1), - s.substring(0, SQL_STATE_DIGITS), -code); - } - - public static HsqlException parseError(int code, String add, - int lineNumber) { - - String s = getMessage(code); - - if (add != null) { - s = s + ": " + add; - } - - if (lineNumber > 1) { - add = getMessage(ErrorCode.M_parse_line); - s = s + " :" + add + lineNumber; - } - - return new HsqlException(null, s.substring(SQL_STATE_DIGITS + 1), - s.substring(0, SQL_STATE_DIGITS), -code); - } - - public static HsqlException error(int code) { - return error(null, code, 0, null); - } - - public static HsqlException error(int code, Throwable t) { - - String message = getMessage(code, 0, null); - - return new HsqlException(t, message.substring(0, SQL_STATE_DIGITS), - -code); - } - - /** - * Compose error message by inserting the strings in the add parameters - * in placeholders within the error message. The message string contains - * $$ markers for each context variable. Context variables are supplied in - * the add parameters. - * - * @param code main error code - * @param subCode sub error code (if 0 then no subMessage!) - * @param add optional parameters - * - * @return an HsqlException - */ - public static HsqlException error(Throwable t, int code, int subCode, - final String[] add) { - - String message = getMessage(code, subCode, add); - int sqlCode = subCode < ERROR_CODE_BASE ? code - : subCode; - - return new HsqlException(t, message.substring(SQL_STATE_DIGITS + 1), - message.substring(0, SQL_STATE_DIGITS), - -sqlCode); - } - - public static HsqlException parseError(int code, int subCode, - int lineNumber, - final String[] add) { - - String message = getMessage(code, subCode, add); - - if (lineNumber > 1) { - String sub = getMessage(ErrorCode.M_parse_line); - - message = message + " :" + sub + lineNumber; - } - - int sqlCode = subCode < ERROR_CODE_BASE ? code - : subCode; - - return new HsqlException(null, - message.substring(SQL_STATE_DIGITS + 1), - message.substring(0, SQL_STATE_DIGITS), - -sqlCode); - } - - public static HsqlException error(int code, int code2) { - return error(code, getMessage(code2)); - } - - /** - * For SIGNAL and RESIGNAL - * @see HsqlException#HsqlException(Throwable,String, String, int) - * @return an HsqlException - */ - public static HsqlException error(String message, String sqlState) { - - int code = getCode(sqlState); - - if (code < 1000) { - code = ErrorCode.X_45000; - } - - if (message == null) { - message = getMessage(code); - } - - return new HsqlException(null, message, sqlState, code); - } - - /** - * Compose error message by inserting the strings in the add variables - * in placeholders within the error message. The message string contains - * $$ markers for each context variable. Context variables are supplied in - * the add parameter. (by Loic Lefevre) - * - * @param message message string - * @param add optional parameters - * - * @return an HsqlException - */ - private static String insertStrings(String message, String[] add) { - - StringBuilder sb = new StringBuilder(message.length() + 32); - int lastIndex = 0; - int escIndex = message.length(); - - // removed test: i < add.length - // because if mainErrorMessage is equal to "blabla $$" - // then the statement escIndex = mainErrorMessage.length(); - // is never reached! ??? - for (int i = 0; i < add.length; i++) { - escIndex = message.indexOf(MESSAGE_TAG, lastIndex); - - if (escIndex == -1) { - break; - } - - sb.append(message, lastIndex, escIndex); - sb.append(add[i] == null ? "null exception message" - : add[i]); - - lastIndex = escIndex + MESSAGE_TAG.length(); - } - - escIndex = message.length(); - - sb.append(message, lastIndex, escIndex); - - return sb.toString(); - } - - /** - * Returns the error message given the error code.

    - * This method is be used when throwing exception other - * than HsqlException. - * - * @param errorCode the error code associated to the error message - * @return the error message associated with the error code - */ - public static String getMessage(final int errorCode) { - return getMessage(errorCode, 0, null); - } - - /** - * Returns the error SQL STATE sting given the error code.

    - * This method is be used when throwing exception based on other exceptions. - * - * @param errorCode the error code associated to the error message - * @return the error message associated with the error code - */ - public static String getStateString(final int errorCode) { - return getMessage(errorCode, 0, null).substring(0, SQL_STATE_DIGITS); - } - - /** - * Returns the error message given the error code.

    - * This method is used - * when throwing exception other than HsqlException. - * - * @param code the code for the error message - * @param subCode the code for the addon message - * @param add value(s) to use to replace the placeholer(s) - * @return the error message associated with the error code - */ - public static String getMessage(final int code, int subCode, - final String[] add) { - - String message = getResourceString(code); - - if (subCode != 0) { - message += ' ' + getResourceString(subCode); - } - - if (add != null) { - message = insertStrings(message, add); - } - - return message; - } - - private static String getResourceString(int code) { - - String key = StringUtil.toZeroPaddedString(code, SQL_CODE_DIGITS, - SQL_CODE_DIGITS); - String string = ResourceBundleHandler.getString(bundleHandle, key); - - if (string == null) { - string = defaultMessage; - } - - return string; - } - - public static HsqlException error(final Result result) { - return new HsqlException(result); - } - - /** - * Used to print messages to System.out - * - * - * @param message message to print - */ - public static void printSystemOut(String message) { - - if (TRACESYSTEMOUT) { - System.out.println(message); - } - } - - public static int getCode(String sqlState) { - - try { - Field[] fields = ErrorCode.class.getDeclaredFields(); - - for (int i = 0; i < fields.length; i++) { - String name = fields[i].getName(); - - if (name.length() == 7 && name.endsWith(sqlState)) { - return fields[i].getInt(ErrorCode.class); - } - } - } catch (IllegalAccessException e) {} - - return -1; - } -} diff --git a/database/hsqldb/src/org/hsqldb/error/ErrorCode.java b/database/hsqldb/src/org/hsqldb/error/ErrorCode.java deleted file mode 100644 index 5cef580a..00000000 --- a/database/hsqldb/src/org/hsqldb/error/ErrorCode.java +++ /dev/null @@ -1,702 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.error; - -/** - * SQL error codes. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public interface ErrorCode { - - // neutral placeholder strings - int TOKEN_REQUIRED = 1; // $$ required: $$ - int CONSTRAINT = 2; // $$ table: $$ - int COLUMN_CONSTRAINT = 3; // $$ table: $$ column: $$ - int FK_CONSTRAINT = 4; // $$ table: $$ value: $$ - - // - int M_ERROR_IN_BINARY_SCRIPT_1 = 21; // \u0020table $$ row count error : $$ read, needed $$ - int M_ERROR_IN_BINARY_SCRIPT_2 = 22; // \u0020 wrong data for insert operation - int M_DatabaseManager_getDatabase = 23; // attempt to connect while db opening /closing - int M_parse_line = 24; // \u0020line:\u0020 - int M_DatabaseScriptReader_read = 25; // \u0020line: $$ $$ - int M_Message_Pair = 26; // \u0020$$ $$ - int M_LOAD_SAVE_PROPERTIES = 27; // \u0020$$.properties $$ - int M_HsqlProperties_load = 28; // properties name is null or empty - - // - int M_TEXT_SOURCE_FIELD_ERROR = 41; // S1000 Error in text source field - int M_TextCache_opening_file_error = 42; // openning file: $$ error: $$ - int M_TextCache_closing_file_error = 43; // closing file: $$ error: $$ - int M_TextCache_purging_file_error = 44; // purging file: $$ error: $$ - - // - int M_DataFileCache_makeRow = 51; // error $$ reading row - file $$ - int M_DataFileCache_open = 52; // error $$ opening file - file $$ - int M_DataFileCache_close = 53; // error $$ closing file - file $$ - - // - int M_SERVER_OPEN_SERVER_SOCKET_1 = 61; // Invalid address : $$\nTry one of: $$ - int M_SERVER_OPEN_SERVER_SOCKET_2 = 62; // Invalid address : $$ - int M_SERVER_SECURE_VERIFY_1 = 63; // Server certificate has no Common Name - int M_SERVER_SECURE_VERIFY_2 = 64; // Server certificate has empty Common Name - int M_SERVER_SECURE_VERIFY_3 = 65; // Certificate Common Name[$$] does not match host name[$$] - - // - int M_RS_EMPTY = 70; // ResultSet is empty - int M_RS_BEFORE_FIRST = 71; // ResultSet is positioned before first row - int M_RS_AFTER_LAST = 72; // ResultSet is positioned after last row - - // - int M_INVALID_LIMIT = 81; // ; in LIMIT, OFFSET or FETCH - - // SQLSTATE definitions - // successful completion - int S_00000 = 0; // successful completion - - // - int U_S0500 = 201; // unsupported internal operation - int X_S0501 = 301; // no file name specified for source // TEXT_TABLE_SOURCE_FILENAME = 172 - int X_S0502 = 302; // no value specified for field // TEXT_TABLE_SOURCE_VALUE_MISSING= 173 - int X_S0503 = 303; // zero-length separator // TEXT_TABLE_SOURCE_SEPARATOR = 174 - int X_S0504 = 304; // length of text quote character must be 1 - int X_S0521 = 320; // operation is not allowed on text table with data - int X_S0522 = 321; // invalid statement - text table required - int X_S0531 = 331; // text file encode / decode error: - int X_S0532 = 332; // UTF-16 encoding string required - - // HSQLDB authentication - int PASSWORD_COMPLEXITY = 391; // S1000 password complexity - - // HSQLDB Server - int SERVER_TRANSFER_CORRUPTED = 401; // S1000 Transfer corrupted - int SERVER_DATABASE_DISCONNECTED = 402; // S0504 database disconnected - int SERVER_VERSIONS_INCOMPATIBLE = 403; // S0504 HSQLDB server version is '$$' \ client version '$$' is not compatible. - int SERVER_UNKNOWN_CLIENT = 404; // S0504 Network client is not a HSQLDB JDBC driver - int SERVER_HTTP_NOT_HSQL_PROTOCOL = 405; // S0504 Client using HSQLDB http protocol instead of hsql - int SERVER_INCOMPLETE_HANDSHAKE_READ = 406; // S0504 Incomplete read of handshaking bytes - int SERVER_NO_DATABASE = 407; // S1000 no valid database paths - - // - // HSQLDB JDBC - int JDBC_COLUMN_NOT_FOUND = 421; // S1000 Column not found - int JDBC_INPUTSTREAM_ERROR = 422; // S1000 InputStream error - int JDBC_INVALID_ARGUMENT = 423; // S1OO0 Invalid argument in JDBC call - int JDBC_PARAMETER_NOT_SET = 424; // S1000 Parameter not set - int JDBC_CONNECTION_NATIVE_SQL = 425; // S1000 Unknown JDBC escape sequence: { - - // HSQLDB non-core and file errors - int LOCK_FILE_ACQUISITION_FAILURE = 451; // S1000 Database lock acquisition failure - int FILE_IO_ERROR = 452; // S1000 File input/output error - int WRONG_DATABASE_FILE_VERSION = 453; // S1000 unsupported database file version - int DATA_FILE_BACKUP_MISMATCH = 454; // S1000 Data file modified, no backup - int DATABASE_IS_READONLY = 455; // S1000 The database is in read only mode - int DATA_IS_READONLY = 456; // S1000 The table data is read only - int ACCESS_IS_DENIED = 457; // S1000 Access is denied - int GENERAL_ERROR = 458; // S1000 General error - int DATABASE_IS_MEMORY_ONLY = 459; // S1000 Database is memory only - int OUT_OF_MEMORY = 460; // S1000 Out of Memory - int ERROR_IN_SCRIPT_FILE = 461; // S1000 error in script file - int UNSUPPORTED_FILENAME_SUFFIX = 462; // S1000 Unsupported suffix in file name '$$'. (Supported suffixes: $$) - int COMPRESSION_SUFFIX_MISMATCH = 463; // S1000 Mismatch between specified compression mode '$$' and file name '$$' - int DATABASE_IS_NON_FILE = 464; // S1000 Database is non-file type - int DATABASE_NOT_EXISTS = 465; // S1000 Database does not exist - int DATA_FILE_ERROR = 466; // S1000 Data File input/output error - int GENERAL_IO_ERROR = 467; // S1000 IO error - int DATA_FILE_IS_FULL = 468; // S1000 Data file size limit is reached - int DATA_FILE_IN_USE = 469; // S1000 Data file is in use - int BACKUP_ERROR = 470; // S1000 Backup error - int DATA_CACHE_IS_FULL = 471; // S1000 Data cache size limit is reached - int ERROR_IN_LOG_FILE = 472; // S1000 problem with log file - - // HSQLDB Text tables - int TEXT_TABLE_UNKNOWN_DATA_SOURCE = 481; // S1000 The table's data source for has not been defined - int TEXT_TABLE_SOURCE = 482; // S1000 Invalid TEXT table source string - int TEXT_FILE = 483; // S1000 bad TEXT table source file - line number: $$ $$ - int TEXT_FILE_IO = 484; // S1000 TEXT table source file - IO error: - int TEXT_STRING_HAS_NEWLINE = 485; // S1000 end-of-line characters not allowed - int TEXT_TABLE_HEADER = 486; // S1000 Header not allowed or too long - int TEXT_SOURCE_EXISTS = 487; // S1000 Text source file already exists - int TEXT_SOURCE_NO_END_SEPARATOR = 488; // S1000 No end sep. - - // warning - int W_01000 = 1000; // warning - generic - int W_01001 = 1001; // cursor operation conflict - 200x - int W_01002 = 1002; // disconnect error - 200x - int W_01003 = 1003; // null value eliminated in set function - 200x - int W_01004 = 1004; // string data, right truncation - 200x - int W_01005 = 1005; // insufficient item descriptor areas - 200x - int W_01006 = 1006; // privilege not revoked - 200x - int W_01007 = 1007; // privilege not granted - 200x - int W_01009 = 1009; // search condition too long for information schema - 200x - int W_0100A = 1010; // query expression too long for information schema - 200x - int W_0100B = 1011; // default value too long for information schema - 200x - int W_0100C = 1012; // result sets returned - 200x - int W_0100D = 1013; // additional result sets returned - 200x - int W_0100E = 1014; // attempt to return too many result sets - 200x - int W_0100F = 1015; // statement too long for information schema - 200x - int W_01011 = 1016; // SQL-Java path too long for information schema - int W_0102F = 1017; // array data, right truncation - 200x - - // no data - 200x - int N_02000 = 1100; // no data - generic - int N_02001 = 1101; // no data: no additional result sets returned - - // dynamic SQL error - 200x - int X_07000 = 1200; // dynamic SQL error - int X_07001 = 1201; // dynamic SQL error: using clause does not match dynamic parameter specifications - int X_07002 = 1202; // dynamic SQL error: using clause does not match target specifications - int X_07003 = 1203; // dynamic SQL error: cursor specification cannot be executed - int X_07004 = 1204; // dynamic SQL error: using clause required for dynamic parameters - int X_07005 = 1205; // dynamic SQL error: prepared statement not a cursor specification - int X_07006 = 1206; // dynamic SQL error: restricted data type attribute violation - int X_07007 = 1207; // dynamic SQL error: using clause required for result fields - int X_07008 = 1208; // dynamic SQL error: invalid descriptor count - int X_07009 = 1209; // dynamic SQL error: invalid descriptor index - int X_0700B = 1211; // dynamic SQL error: data type transform function violation - int X_0700C = 1212; // dynamic SQL error: undefined DATA value - int X_0700D = 1213; // dynamic SQL error: invalid DATA target - int X_0700E = 1214; // dynamic SQL error: invalid LEVEL value - int X_0700F = 1215; // dynamic SQL error: invalid DATETIME_INTERVAL_CODE - - // HSQLDB - int X_07501 = 1251; // statement is closed - int X_07502 = 1252; // statement is invalid - int X_07503 = 1253; // statement does not generate a row count - int X_07504 = 1254; // statement does not generate a result set - int X_07505 = 1255; // statement is in batch mode - int X_07506 = 1256; // statement is not in batch mode - - // connection exception - 200x - int X_08000 = 1300; // connection exception - int X_08001 = 1301; // connection exception: SQL-client unable to establish SQL-connection - int X_08002 = 1302; // connection exception: connection name in use - int X_08003 = 1303; // connection exception: connection does not exist - int X_08004 = 1304; // connection exception: SQL-server rejected establishment of SQL-connection - int X_08006 = 1305; // connection exception: connection failure - int X_08007 = 1306; // connection exception: transaction resolution unknown - - // HSQLDB connection - int X_08501 = 1351; // connection exception: timed out - int X_08502 = 1352; // warning: unsupported client info - int X_08503 = 1353; // connection exception: closed - - // triggered action exception - 200x - int X_09000 = 1400; // triggered action exception - - // feature not supported - 200x - int X_0A000 = 1500; // feature not supported - int X_0A001 = 1501; // feature not supported: multiple server transactions - - // HSQLDB feature not supported - int X_0A501 = 1551; // feature not supported: - - // invalid target type specification - 200x - int X_0D000 = 1600; // invalid target type specification - - // invalid schema name list specification - 200x - int X_0E000 = 1700; // invalid schema name list specification - - // locator exception - 2003 - int X_0F000 = 1800; // locator exception - int X_0F001 = 1801; // locator exception: invalid specification - - // HSQLDB locator - int X_0F502 = 1852; // lob is no longer valid - int X_0F503 = 1853; // lob stream is closed - - // resignal when handler not active - xxxx - int X_0K000 = 1900; // resignal when handler not active - - // invalid grantor - 2003 - int X_0L000 = 2000; // invalid grantor - - // HSQLDB - int X_0L501 = 2051; // invalid grantor - lacks CREATE_SCHEMA privilege - - // invalid SQL-invoked procedure reference - 2003 - int X_0M000 = 2100; // invalid SQL-invoked procedure reference - - // invalid role specification - 2003 - int X_0P000 = 2200; // invalid role specification - - // HSQLDB - int X_0P501 = 2251; // invalid role specification - circular grant - int X_0P502 = 2252; // invalid role specification - already granted - int X_0P503 = 2253; // invalid role specification - does not have role - - // invalid transform group name specification - 2003 - int X_0S000 = 2300; // invalid transform group name specification - - // target table disagrees with cursor specification - 2003 - int X_0T000 = 2400; // target table disagrees with cursor specification - - // attempt to assign to non-updatable column - 2003 - int X_0U000 = 2500; // attempt to assign to non-updatable column - - // attempt to assign to ordering column - 2003 - int X_0V000 = 2600; // attempt to assign to ordering column - - // prohibited statement encountered during trigger execution - 2003 - int X_0W000 = 2700; // prohibited statement encountered during trigger execution - - // invalid foreign server specification - xxxx - int X_0X000 = 2800; // invalid foreign server specification - - // pass-through specific condition - xxxx - int X_0Y000 = 2900; // pass-through specific condition - int X_0Y001 = 2901; // pass-through specific condition: invalid cursor option - int X_0Y002 = 2902; // pass-through specific condition: invalid cursor allocation - - // diagnostics exception - 2003 - int X_0Z000 = 3000; // diagnostics exception - int X_0Z001 = 3001; // diagnostics exception: maximum number of stacked diagnostics areas exceeded - - // 04-PSM - xxxx - int X_0Z002 = 3003; // diagnostics exception: stacked diagnostics accessed without active handler - - // 04-PSM - 2003 - int X_20000 = 3100; // case not found for case statement - - // cardinality violation - 2003 - int X_21000 = 3201; // cardinality violation - - // data exception - xxxx - int X_22000 = 3400; // data exception - generic - int X_22001 = 3401; // data exception: string data, right truncation - 200x - int X_22002 = 3402; // data exception: null value, no indicator parameter - 200x - int X_22003 = 3403; // data exception: numeric value out of range - 200x - int X_22004 = 3404; // data exception: null value not allowed - 200x - int X_22005 = 3405; // data exception: error in assignment - 200x - int X_22006 = 3406; // data exception: invalid interval format - 200x - int X_22007 = 3407; // data exception: invalid datetime format - 200x - int X_22008 = 3408; // data exception: datetime field overflow - 200x - int X_22009 = 3409; // data exception: invalid time zone displacement value - 200x - int X_2200B = 3410; // data exception: escape character conflict - 200x - int X_2200C = 3411; // data exception: invalid use of escape character - 200x - int X_2200D = 3412; // data exception: invalid escape octet - 200x - int X_2200E = 3413; // data exception: null value in array target - 200x - int X_2200F = 3414; // data exception: zero-length character string - 200x - int X_2200G = 3415; // data exception: most specific type mismatch - 200x - int X_2200H = 3416; // data exception: sequence generator limit exceeded - 200x - int X_2200J = 3417; // data exception: nonidentical notations with the same name - xxxx - int X_2200K = 3418; // data exception: nonidentical unparsed entities with the same name - xxxx - int X_2200L = 3419; // data exception: not an XML document - xxxx - int X_2200M = 3420; // data exception: invalid XML document - xxxx - int X_2200N = 3421; // data exception: invalid XML content - xxxx - int X_2200P = 3422; // data exception: interval value out of range - 200x - int X_2200Q = 3423; // data exception: multiset value overflow - 200x - int X_2200R = 3424; // data exception: XML value overflow - xxxx - int X_2200S = 3425; // data exception: invalid comment - xxxx - int X_2200T = 3426; // data exception: invalid processing instruction - xxxx - int X_2200U = 3427; // data exception: not an XQuery document node - xxxx - int X_2200V = 3428; // data exception: invalid XQuery context item - xxxx - int X_2200W = 3429; // data exception: XQuery serialization error - xxxx - int X_22010 = 3430; // data exception: invalid indicator parameter value - 200x - int X_22011 = 3431; // data exception: substring error - 200x - int X_22012 = 3432; // data exception: division by zero - 200x - int X_22013 = 3433; // data exception: invalid preceding or following size in window function - 200x - int X_22014 = 3434; // data exception: invalid argument for NTILE function - 200x - int X_22015 = 3435; // data exception: interval field overflow - 200x - int X_22016 = 3436; // data exception: invalid argument for NTH_VALUE function - 200x - int X_22017 = 3437; // data exception: invalid data specified for datalink - xxxx - int X_22018 = 3438; // data exception: invalid character value for cast - 200x - int X_22019 = 3439; // data exception: invalid escape character - 200x - int X_2201A = 3440; // data exception: null argument passed to datalink constructor - int X_2201B = 3441; // data exception: invalid regular expression - 200x - int X_2201C = 3442; // data exception: null row not permitted in table - 200x - int X_2201D = 3443; // data exception: datalink value exceeds maximum length - int X_2201E = 3444; // data exception: invalid argument for natural logarithm - 200x - int X_2201F = 3445; // data exception: invalid argument for power function - 200x - int X_2201G = 3446; // data exception: invalid argument for width bucket function - 200x - int X_2201J = 3447; // data exception: XQuery sequence cannot be validated - int X_2201S = 3448; // data exception: invalid XQuery regular expression - 200x - int X_2201T = 3449; // data exception: invalid XQuery option flag - 200x - int X_2201U = 3450; // data exception: attempt to replace a zero-length string - 200x - int X_2201V = 3451; // data exception: invalid XQuery replacement string - 200x - int X_2201W = 3452; // data exception: invalid row count in fetch first clause - 200x - int X_2201X = 3453; // data exception: invalid row count in result offset clause - 200x - int X_22021 = 3454; // data exception: character not in repertoire - 200x - int X_22022 = 3455; // data exception: indicator overflow - 200x - int X_22023 = 3456; // data exception: invalid parameter value - 200x - int X_22024 = 3457; // data exception: unterminated C string - 200x - int X_22025 = 3458; // data exception: invalid escape sequence - 200x - int X_22026 = 3459; // data exception: string data, length mismatch - 200x - int X_22027 = 3460; // data exception: trim error - 200x - int X_22029 = 3461; // data exception: noncharacter in UCS string - 200x - int X_22020 = 3462; // data exception: invalid period value - 200x - - // HSQLDB data exception - int X_22501 = 3471; // value cannot be converted to target type - int X_22511 = 3472; // invalid function argument - int X_22521 = 3473; // object serialization failure - int X_22522 = 3474; // query execution reached limit of recursion - - // 04-PSM - xxxx - int X_2202A = 3488; // data exception: null value in field reference - int X_2202D = 3489; // data exception: null value substituted for mutator subject parameter - 200x - int X_2202E = 3490; // data exception: array element error - int X_2202F = 3491; // data exception: array data, right truncation - 200x - int X_2202G = 3492; // data exception: invalid repeat argument in a sample clause - 200x - int X_2202H = 3493; // data exception: invalid sample size - 200x - - // integrity constraint violation - xxxx - int X_23000 = 3500; // integrity constraint violation - 200x - int X_23001 = 3501; // integrity constraint violation: restrict violation - 200x - int X_23502 = 10; // integrity constraint violation: NOT NULL check constraint - int X_23503 = 177; // integrity constraint violation: foreign key no parent - int X_23504 = 8; // integrity constraint violation: foreign key no action - int X_23505 = 104; // integrity constraint violation: unique constraint or index - int X_23513 = 157; // integrity constraint violation: check constraint - - // invalid cursor state - xxxx - int X_24000 = 3600; // invalid cursor state - 2003 - int X_24501 = 3601; // invalid cursor state: identified cursor is not open - int X_24502 = 3602; // invalid cursor state: identified cursor is already open - int X_24504 = 3603; // invalid cursor state: identifier cursor not positioned on row in UPDATE, DELETE, SET, or GET statement - int X_24513 = 3604; // invalid cursor state: cannot FETCH NEXT, PRIOR, CURRENT, or RELATIVE, cursor position is unknown - int X_24514 = 3605; // invalid cursor state: cursor disabled by previous error - int X_24515 = 3606; // invalid cursor state: all column must be set before insert - int X_24521 = 3621; // invalid cursor state: row has been modified outside the cursor - - // invalid transaction state - 200x - int X_25000 = 3700; // invalid transaction state - int X_25001 = 3701; // invalid transaction state: active SQL-transaction - int X_25002 = 3702; // invalid transaction state: branch transaction already active - int X_25003 = 3703; // invalid transaction state: inappropriate access mode for branch transaction - int X_25004 = 3704; // invalid transaction state: inappropriate isolation level for branch transaction - int X_25005 = 3705; // invalid transaction state: no active SQL-transaction for branch transaction - int X_25006 = 3706; // invalid transaction state: read-only SQL-transaction - int X_25007 = 3707; // invalid transaction state: schema and data statement mixing not supported - int X_25008 = 3708; // invalid transaction state: held cursor requires same isolation level - - // invalid SQL statement name - 2003 - int X_26000 = 3800; // invalid SQL statement name - - // triggered data change violation - 2003 - int X_27000 = 3900; // triggered data change violation - - // invalid authorization specification - 2003 - int X_28000 = 4000; // invalid authorization specification - - // HSQLDB invalid authorization specification - int X_28501 = 4001; // invalid authorization specification - not found - int X_28502 = 4002; // invalid authorization specification - system identifier - int X_28503 = 4003; // invalid authorization specification - already exists - - // syntax error or access rule violation in direct statement - int X_2A000 = 4100; // syntax error or access rule violation in direct statement - - // dependent privilege descriptors still exist - int X_2B000 = 4200; // dependent privilege descriptors still exist - - // invalid character set name - int X_2C000 = 4300; // invalid character set name - - // invalid transaction termination - int X_2D000 = 4400; // invalid transaction termination - int X_2D522 = 4401; // invalid transaction termination: COMMIT and ROLLBACK not allowed in ATOMIC compound statement - - // invalid connection name - int X_2E000 = 4500; //invalid connection name - - // SQL routine exception - int X_2F000 = 4600; // SQL routine exception - int X_2F002 = 4602; // SQL routine exception: modifying SQL-data not permitted - int X_2F003 = 4603; // SQL routine exception: prohibited SQL-statement attempted - int X_2F004 = 4604; // SQL routine exception: reading SQL-data not permitted - int X_2F005 = 4605; // SQL routine exception: function did not execute return statement - - // invalid collation name - int X_2H000 = 4650; // invalid collation name - - // invalid SQL statement identifier - int X_30000 = 4660; // invalid SQL statement identifier - - // invalid SQL descriptor name - int X_33000 = 4670; // invalid SQL descriptor name - - // invalid cursor name - int X_34000 = 4680; // invalid cursor name - - // invalid condition number - int X_35000 = 4690; // invalid condition number - - // cursor sensitivity exception - 200x - int X_36000 = 4700; // cursor sensitivity exception - int X_36001 = 4701; // cursor sensitivity exception: request rejected - int X_36002 = 4702; // cursor sensitivity exception: request failed - - // cursor compatibility warnings - int W_36501 = 4711; // cursor sensitivity mismatch - int W_36502 = 4712; // cursor updatability mismatch - int W_36503 = 4713; // cursor holdability mismatch - - // syntax error or access rule violation in dynamic statement - xxxx - int X_37000 = 4790; // syntax error or access rule violation in dynamic statement - - // external routine exception - 2003 - int X_38000 = 4800; // external routine exception - int X_38001 = 4801; // external routine exception: containing SQL not permitted - int X_38002 = 4802; // external routine exception: modifying SQL-data not permitted - int X_38003 = 4803; // external routine exception: prohibited SQL-statement attempted - int X_38004 = 4804; // external routine exception: reading SQL-data not permitted - - // external routine invocation exception - 200x - int X_39000 = 4810; // external routine invocation exception - int X_39004 = 4811; // external routine invocation exception: null value not allowed - - // savepoint exception - 200x - int X_3B000 = 4820; // savepoint exception - int X_3B001 = 4821; // savepoint exception: invalid specification - int X_3B002 = 4822; // savepoint exception: too many - - // ambiguous cursor name - 200x - int X_3C000 = 4830; // ambiguous cursor name - - // invalid catalog name - 200x - int X_3D000 = 4840; // invalid catalog name - - // invalid schema name - 200x - int X_3F000 = 4850; // invalid schema name - - // transaction rollback - 200x - int X_40000 = 4860; // transaction rollback - generic - int X_40001 = 4861; // serialization failure - int X_40002 = 4862; // integrity constraint violation - int X_40003 = 4863; // statement completion unknown - int X_40004 = 4864; // triggered action exception - - // HSQLDB internal tx management - int X_40501 = 4871; // MVCC transaction data change conflict - int X_40502 = 4872; // statement execution aborted: timeout reached - - // syntax error or access rule violation - xxxx - int X_42000 = 5000; // syntax error or access rule violation - generic - 200x - - // HSQLDB database object names - int X_42501 = 5501; // user lacks privilege or object not found - int X_42502 = 5502; // dependent objects exist - int X_42503 = 5503; // system object cannot be modified - int X_42504 = 5504; // object name already exists - int X_42505 = 5505; // invalid schema name - name mismatch - int X_42506 = 5506; // invalid catalog name - int X_42507 = 5507; // admin rights required - int X_42508 = 5508; // label not found - int X_42509 = 5509; // type not found or user lacks privilege - int X_42510 = 5510; // name too long - - // generated columns - int X_42512 = 5512; // invalid expression in CHECK or GENERATED clause - int X_42513 = 5513; // assignment to generated column - - // period columns - int X_42516 = 5516; // invalid period column name or type - int X_42517 = 5517; // operation not allowed - generated or period column - int X_42518 = 5518; // operation not allowed - system versioning - - // constraint definition issues - int X_42520 = 5520; // SET NULL requires nullable column - int X_42521 = 5521; // SET DEFAULT requires column default expression for - int X_42522 = 5522; // a UNIQUE constraint already exists on the set of columns - int X_42523 = 5523; // table has no primary key - int X_42524 = 5524; // constraint definition not allowed - int X_42525 = 5525; // identity definition not allowed - int X_42526 = 5526; // column is in primary key - int X_42527 = 5527; // column is in constraint - int X_42528 = 5528; // a FOREIGN KEY constraint already exists on the set of columns - int X_42529 = 5529; // a UNIQUE constraint does not exist on referenced columns - int X_42530 = 5530; // primary key definition not allowed - int X_42531 = 5531; // default expression needed - int X_42532 = 5532; // primary key already exist - int X_42533 = 5533; // is referenced by FOREIGN KEY constraint - int X_42534 = 5534; // column of LOB or ARRAY type cannot be used in operation - - // other definition issues - int X_42535 = 5535; // not an identity column - int X_42536 = 5536; // column is referenced in - int X_42537 = 5537; // cannot use WITH CHECK option for read-only view - int X_42538 = 5538; // TRIGGER definition not compatible with table - int X_42539 = 5539; // cannot drop a user that is currently connected - - // DML - int X_42541 = 5541; // requires DEFAULT keyword - int X_42542 = 5542; // requires OVERRIDING clause - int X_42543 = 5543; // requires either DEFAULT keyword or OVERRIDING clause - int X_42544 = 5544; // DEFAULT keyword cannot be used as column has no DEFAULT - int X_42545 = 5545; // INSERT, UPDATE, DELETE or TRUNCATE not permitted for table or view - int X_42546 = 5546; // number of target columns does not match that of query expression - int X_42547 = 5547; // merge when matched already used - int X_42548 = 5548; // merge when not matched already used - int X_42549 = 5549; // LIMIT, OFFSET or FETCH already used - - // - int X_42551 = 5551; // too many identifier parts - int X_42555 = 5555; // invalid property name - int X_42556 = 5556; // invalid property value - - // HSQLDB type conversion - int X_42561 = 5561; // incompatible data type in conversion - int X_42562 = 5562; // incompatible data types in combination - int X_42563 = 5563; // incompatible data type in operation - int X_42564 = 5564; // row column count mismatch - int X_42565 = 5565; // row expression not allowed - int X_42566 = 5566; // interval qualifier missing or not valid - int X_42567 = 5567; // data type cast needed for parameter or null literal - int X_42568 = 5568; // data type of expression is not boolean - int X_42569 = 5569; // quoted identifier required - int X_42570 = 5570; // concatenation exceeds maximum type length - - // - int X_42571 = 5571; // NULL literal not allowed - int X_42572 = 5572; // invalid GROUP BY expression - int X_42573 = 5573; // invalid HAVING expression - int X_42574 = 5574; // expression not in aggregate or GROUP BY columns - int X_42575 = 5575; // parameter marker not allowed - int X_42576 = 5576; // invalid ORDER BY expression - int X_42577 = 5577; // duplicate name in column list - int X_42578 = 5578; // duplicate column name in derived table - int X_42579 = 5579; // duplicate update of column - int X_42580 = 5580; // ambiguous column reference - - // lexical elements - int X_42581 = 5581; // unexpected token - int X_42582 = 5582; // unknown token - int X_42583 = 5583; // malformed quoted identifier - int X_42584 = 5584; // malformed string - int X_42585 = 5585; // malformed numeric constant - int X_42586 = 5586; // malformed unicode string - int X_42587 = 5587; // malformed binary string - int X_42588 = 5588; // malformed bit string - int X_42589 = 5589; // malformed comment - int X_42590 = 5590; // unexpected end of statement - - // other - int X_42591 = 5591; // needs column or cannot drop sole column of table - int X_42592 = 5592; // precision or scale out of range - int X_42593 = 5593; // column count mismatch in column name list - int X_42594 = 5594; // column count mismatch in UNION, INTERSECT, EXCEPT operation - int X_42595 = 5595; // invalid privilege specified - ALL PRIVILEGES required - int X_42596 = 5596; // schema qualifier does not match enclosing create schema statement. - int X_42597 = 5597; // number out of the valid range for sequence generator - int X_42598 = 5598; // sequence expression cannot be specified in this context - int X_42599 = 5599; // length must be specified in type definition - - // HSQLDB - PSM definition - int X_42601 = 5601; // repeat handler declaration - int X_42602 = 5602; // invalid statement in routine - int X_42603 = 5603; // dynamic parameter or variable required as INOUT or OUT argument - int X_42604 = 5604; // incompatible declaration attributes - int X_42605 = 5605; // routine signature already exists - int X_42606 = 5606; // routine variable name already exists - int X_42607 = 5607; // invalid SQLSTATE value - int X_42608 = 5608; // wrong or missing data impact clause in declaration - int X_42609 = 5609; // routine signature not found for - int X_42610 = 5610; // wrong arguments for AGGREGATE function - int X_42611 = 5611; // type incompatible with declared return type - int X_42612 = 5612; // SQL exception already used - int X_42613 = 5613; // wildcard character * not allowed in routine, view or trigger definition - int X_42614 = 5614; // duplicate parameter name - - // with check option violation - 200x - int X_44000 = 5700; // with check option violation - - // 04-PSM - // unhandled user-defined exception - 200x - int X_45000 = 5800; // unhandled user-defined exception - - // SQL/JRT - int X_46000 = 6000; // Java execution / Java DDL - generic - int X_46001 = 6001; // invalid URL - int X_46002 = 6002; // invalid JAR name - int X_46003 = 6003; // invalid class deletion - int X_46005 = 6004; // invalid replacement - int X_4600A = 6007; // attempt to replace uninstalled JAR - int X_4600B = 6008; // attempt to remove uninstalled JAR - int X_4600C = 6009; // invalid JAR removal - int X_4600D = 6010; // invalid path - int X_4600E = 6011; // self-referencing path - int X_46102 = 6012; // invalid JAR name in path - int X_46103 = 6013; // unresolved class or method name - - // HSQLDB - SQL/JRT - int X_46511 = 6021; // declared parameter types do not match method signature - - // Unknown Error: Catch-All - xxxx - int X_99000 = 6500; // Unknown Error: Catch-All - int X_99099 = 6501; // Error converting vendor code to SQL state code - - // FDW-specific condition - xxxx - int X_HV000 = 6600; // FDW-specific condition - generic - int X_HV001 = 6601; // memory allocation error - int X_HV002 = 6602; // dynamic parameter value needed - int X_HV004 = 6603; // invalid data type - int X_HV005 = 6604; // column name not found - int X_HV006 = 6605; // invalid data type descriptors - int X_HV007 = 6606; // invalid column name - int X_HV008 = 6607; // invalid column number - int X_HV009 = 6608; // invalid use of null pointer - int X_HV00A = 6609; // invalid string format - int X_HV00B = 6610; // invalid handle - int X_HV00C = 6611; // invalid option index - int X_HV00D = 6612; // invalid option name - int X_HV00J = 6613; // option name not found - int X_HV00K = 6614; // reply handle - int X_HV00L = 6615; // unable to create execution - int X_HV00M = 6616; // unable to create reply - int X_HV00N = 6617; // unable to establish connection - int X_HV00P = 6618; // no schemas - int X_HV00Q = 6619; // schema not found - int X_HV00R = 6620; // table not found - int X_HV010 = 6621; // function sequence error - int X_HV014 = 6622; // limit on number of handles exceeded - int X_HV021 = 6623; // inconsistent descriptor information - int X_HV024 = 6624; // invalid attribute value - int X_HV090 = 6625; // invalid string length or buffer length - int X_HV091 = 6626; // invalid descriptor field identifier - - // datalink exception - 200x - int X_HW000 = 6700; // datalink exception - generic - int X_HW001 = 6701; // external file not linked - int X_HW002 = 6702; // external file already linked - int X_HW003 = 6703; // referenced file does not exist - int X_HW004 = 6704; // invalid write token - int X_HW005 = 6705; // invalid datalink construction - int X_HW006 = 6706; // invalid write permission for update - int X_HW007 = 6707; // referenced file not valid - - // CLI-specific condition - 200x - int X_HY093 = 6800; // CLI-specific condition: invalid datalink value -} diff --git a/database/hsqldb/src/org/hsqldb/index/Index.java b/database/hsqldb/src/org/hsqldb/index/Index.java deleted file mode 100644 index 5d5c63a7..00000000 --- a/database/hsqldb/src/org/hsqldb/index/Index.java +++ /dev/null @@ -1,283 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.index; - -import org.hsqldb.RangeVariable.RangeVariableConditions; -import org.hsqldb.Row; -import org.hsqldb.SchemaObject; -import org.hsqldb.Session; -import org.hsqldb.TableBase; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.types.Type; - -/** - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public interface Index extends SchemaObject { - - int INDEX_NONE = 0; - int INDEX_NON_UNIQUE = 1; - int INDEX_UNIQUE = 2; - - // - double minimumSelectivity = 16; - double cachedFactor = 8; - int probeDepth = 4; - - // - Index[] emptyArray = new Index[]{}; - IndexUse[] emptyUseArray = new IndexUse[]{}; - - IndexUse[] asArray(); - - int getPosition(); - - void setPosition(int position); - - long getPersistenceId(); - - /** - * Returns the count of visible columns used - */ - int getColumnCount(); - - /** - * Is this a PRIMARY_KEY index? - */ - boolean isPrimaryKey(); - - /** - * Is this a UNIQUE index? - */ - boolean isUnique(); - - /** - * Does this index belong to a constraint? - */ - boolean isConstraint(); - - /** - * Returns the array containing column indexes for index - * - * @return int[] - */ - int[] getColumns(); - - /** - * Returns the array containing column indexes for index - * - * @return Type[] - */ - Type[] getColumnTypes(); - - /** - * Returns the array containing desc column flags - * - * @return boolean[] - */ - boolean[] getColumnDesc(); - - /** - * Returns the array containing 0, 1, .. column indexes - * - * @return int[] - */ - int[] getDefaultColumnMap(); - - /** - * Returns a value indicating the order of different types of index in - * the list of indexes for a table. The position of the groups of Indexes - * in the list in ascending order is as follows: - * - * primary key index - * unique constraint indexes - * autogenerated foreign key indexes for FK's that reference this table or - * tables created before this table - * user created indexes (CREATE INDEX) - * autogenerated foreign key indexes for FK's that reference tables created - * after this table - * - * Among a group of indexes, the order is based on the order of creation - * of the index. - * - * @return ordinal value - */ - int getIndexOrderValue(); - - boolean isForward(); - - void setTable(TableBase table); - - TableBase getTable(); - - void setClustered(boolean clustered); - - boolean isClustered(); - - /** - * Returns the node count. - */ - long size(Session session, PersistentStore store); - - long sizeUnique(PersistentStore store); - - double[] searchCost(Session session, PersistentStore store); - - boolean isEmpty(PersistentStore store); - - /** - * Insert a node into the index - */ - void insert(Session session, PersistentStore store, Row row); - - void delete(Session session, PersistentStore store, Row row); - - boolean existsParent(Session session, PersistentStore store, - Object[] rowdata, int[] rowColMap); - - /** - * Return the first node equal to the indexdata object. The rowdata has the - * same column mapping as this index. - * - * @param session session object - * @param store store object - * @param rowdata Object[] - * @param matchCount count of columns to match - * @param distinctCount int - * @param compareType int - * @param reversed boolean - * @param map boolean[] - * @return iterator - */ - RowIterator findFirstRow(Session session, PersistentStore store, - Object[] rowdata, int matchCount, - int distinctCount, int compareType, - boolean reversed, boolean[] map); - - /** - * Return the first node equal to the rowdata object. - * The rowdata has the same column mapping as this table. - * - * @param session session object - * @param store store object - * @param rowdata array containing table row data - * @return iterator - */ - RowIterator findFirstRow(Session session, PersistentStore store, - Object[] rowdata); - - /** - * Return the first node equal to the rowdata object. The rowdata has the - * column mapping provided in rowColMap. - * - * @param session session object - * @param store store object - * @param rowdata array containing table row data - * @param rowColMap int[] - * @return iterator - */ - RowIterator findFirstRow(Session session, PersistentStore store, - Object[] rowdata, int[] rowColMap); - - /** - * Finds the first node where the data is not null. - * - * @return iterator - * @param session Session - * @param store PersistentStore - */ - RowIterator findFirstRowNotNull(Session session, PersistentStore store); - - RowIterator firstRow(PersistentStore store); - - /** - * Returns the row for the first node of the index - * - * @return Iterator for first row - */ - RowIterator firstRow(Session session, PersistentStore store, - RangeVariableConditions[] conditions, - int distinctCount, boolean[] map); - - /** - * Returns the row for the last node of the index - * - * @return last row - * @param session Session - * @param store PersistentStore - * @param distinctCount int - * @param usedColumnCheck boolean[] - */ - RowIterator lastRow(Session session, PersistentStore store, - int distinctCount, boolean[] usedColumnCheck); - - /** - * Compares two table rows based on the columns of this index. The rowColMap - * parameter specifies which columns of the other table are to be compared - * with the colIndex columns of this index. The rowColMap can cover all or - * only some columns of this index. - * - * @param session Session - * @param a row from another table - * @param b a full row in this table - * @param rowColMap column indexes in the other table - * @return comparison result, -1,0,+1 - */ - int compareRowNonUnique(Session session, Object[] a, Object[] b, - int[] rowColMap); - - int compareRowNonUnique(Session session, Object[] a, Object[] b, - int[] rowColMap, int fieldCount); - - /** - * As above but use the index column data - */ - int compareRowNonUnique(Session session, Object[] a, Object[] b, - int fieldcount); - - int compareRow(Session session, Object[] a, Object[] b); - - class IndexUse { - - public Index index; - public int columnCount; - - public IndexUse(Index index, int columnCount) { - this.index = index; - this.columnCount = columnCount; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/index/IndexAVL.java b/database/hsqldb/src/org/hsqldb/index/IndexAVL.java deleted file mode 100644 index 19535416..00000000 --- a/database/hsqldb/src/org/hsqldb/index/IndexAVL.java +++ /dev/null @@ -1,1943 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.index; - -import org.hsqldb.Constraint; -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.OpTypes; -import org.hsqldb.RangeVariable.RangeVariableConditions; -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.SchemaObject; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.Tokens; -import org.hsqldb.TransactionManager; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.OrderedHashSet; -import org.hsqldb.navigator.RangeIterator; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.rights.Grantee; -import org.hsqldb.types.DateTimeType; -import org.hsqldb.types.TimestampData; -import org.hsqldb.types.Type; - -// fredt@users 20020221 - patch 513005 by sqlbob@users - corrections -// fredt@users - patch 1.8.0 - reworked the interface and comparison methods -// fredt@users - patch 1.8.0 - improved reliability for cached indexes -// fredt@users - patch 1.9.0 - iterators and concurrency -// fredt@users - patch 2.0.0 - enhanced selection and iterators - -/** - * Implementation of an AVL tree with parent pointers in nodes. Subclasses - * of Node implement the tree node objects for memory or disk storage. An - * Index has a root Node that is linked with other nodes using Java Object - * references or file pointers, depending on Node implementation.

    - * An Index object also holds information on table columns (in the form of int - * indexes) that are covered by it.

    - * - * New class derived from Hypersonic SQL code and enhanced in HSQLDB.

    - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since Hypersonic SQL - */ -public class IndexAVL implements Index { - - // fields - private final long persistenceId; - protected final HsqlName name; - private final boolean[] colCheck; - final int[] colIndex; - private final int[] defaultColMap; - final Type[] colTypes; - private final boolean[] colDesc; - private final boolean[] nullsLast; - final boolean isSimpleOrder; - final boolean isSimple; - protected final boolean isPK; // PK with or without columns - protected final boolean isUnique; // DDL uniqueness - protected final boolean isConstraint; - private final boolean isForward; - private boolean isClustered; - protected TableBase table; - int position; - private IndexUse[] asArray; - - // - Object[] nullData; - - /** - * Constructor declaration - * - * @param name HsqlName of the index - * @param id persistnece id - * @param table table of the index - * @param columns array of column indexes - * @param descending boolean[] - * @param nullsLast boolean[] - * @param colTypes array of column types - * @param pk if index is for a primary key - * @param unique is this a unique index - * @param constraint does this index belonging to a constraint - * @param forward is this an auto-index for an FK that refers to a table - * defined after this table - */ - public IndexAVL(HsqlName name, long id, TableBase table, int[] columns, - boolean[] descending, boolean[] nullsLast, - Type[] colTypes, boolean pk, boolean unique, - boolean constraint, boolean forward) { - - this.persistenceId = id; - this.name = name; - this.colIndex = columns; - this.colTypes = colTypes; - this.colDesc = descending == null ? new boolean[columns.length] - : descending; - this.nullsLast = nullsLast == null ? new boolean[columns.length] - : nullsLast; - this.isPK = pk; - this.isUnique = unique; - this.isConstraint = constraint; - this.isForward = forward; - this.table = table; - this.colCheck = table.getNewColumnCheckList(); - this.asArray = new IndexUse[]{ new IndexUse(this, colIndex.length) }; - - ArrayUtil.intIndexesToBooleanArray(colIndex, colCheck); - - this.defaultColMap = new int[columns.length]; - - ArrayUtil.fillSequence(defaultColMap); - - boolean simpleOrder = colIndex.length > 0; - - for (int i = 0; i < colDesc.length; i++) { - if (this.colDesc[i] || this.nullsLast[i]) { - simpleOrder = false; - } - } - - isSimpleOrder = simpleOrder; - isSimple = isSimpleOrder && colIndex.length == 1; - nullData = new Object[colIndex.length]; - } - - // SchemaObject implementation - public int getType() { - return SchemaObject.INDEX; - } - - public HsqlName getName() { - return name; - } - - public HsqlName getSchemaName() { - return name.schema; - } - - public HsqlName getCatalogName() { - return name.schema.schema; - } - - public Grantee getOwner() { - return name.schema.owner; - } - - public OrderedHashSet getReferences() { - return new OrderedHashSet(); - } - - public OrderedHashSet getComponents() { - return null; - } - - public void compile(Session session, SchemaObject parentObject) {} - - public String getSQL() { - - StringBuilder sb = new StringBuilder(128); - - sb.append(Tokens.T_CREATE).append(' '); - - if (isUnique()) { - sb.append(Tokens.T_UNIQUE).append(' '); - } - - sb.append(Tokens.T_INDEX).append(' '); - sb.append(getName().statementName); - sb.append(' ').append(Tokens.T_ON).append(' '); - sb.append(((Table) table).getName().getSchemaQualifiedStatementName()); - sb.append(((Table) table).getColumnListSQL(colIndex, colIndex.length)); - - return sb.toString(); - } - - public long getChangeTimestamp() { - return 0; - } - - // IndexInterface - public IndexUse[] asArray() { - return asArray; - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - public long getPersistenceId() { - return persistenceId; - } - - /** - * Returns the count of visible columns used - */ - public int getColumnCount() { - return colIndex.length; - } - - /** - * Is this a PRIMARY_KEY index? - */ - public boolean isPrimaryKey() { - return isPK; - } - - /** - * Is this a UNIQUE index? - */ - public boolean isUnique() { - return isUnique; - } - - /** - * Does this index belong to a constraint? - */ - public boolean isConstraint() { - return isConstraint; - } - - /** - * Returns the array containing column indexes for index - */ - public int[] getColumns() { - return colIndex; - } - - /** - * Returns the array containing column indexes for index - */ - public Type[] getColumnTypes() { - return colTypes; - } - - public boolean[] getColumnDesc() { - return colDesc; - } - - public int[] getDefaultColumnMap() { - return this.defaultColMap; - } - - /** - * Returns a value indicating the order of different types of index in - * the list of indexes for a table. The position of the groups of Indexes - * in the list in ascending order is as follows: - * - * primary key index - * unique constraint indexes - * autogenerated foreign key indexes for FK's that reference this table or - * tables created before this table - * user created indexes (CREATE INDEX) - * autogenerated foreign key indexes for FK's that reference tables created - * after this table - * - * Among a group of indexes, the order is based on the order of creation - * of the index. - * - * @return ordinal value - */ - public int getIndexOrderValue() { - - if (isPK) { - return 0; - } - - if (isConstraint) { - return isForward ? 4 - : isUnique ? 0 - : 1; - } else { - return 2; - } - } - - public boolean isForward() { - return isForward; - } - - public void setTable(TableBase table) { - this.table = table; - } - - public TableBase getTable() { - return table; - } - - public void setClustered(boolean clustered) { - isClustered = clustered; - } - - public boolean isClustered() { - return isClustered; - } - - /** - * Returns the node count. - */ - public long size(Session session, PersistentStore store) { - - long count = 0; - RowIterator it = firstRow(session, store, null, 0, null); - - while (it.next()) { - count++; - } - - return count; - } - - public long sizeUnique(PersistentStore store) { - return store.elementCountUnique(this); - } - - public double[] searchCost(Session session, PersistentStore store) { - - boolean probeDeeper = false; - int counter = 1; - double[] changes = new double[colIndex.length]; - int depth = 0; - int[] depths = new int[1]; - - store.readLock(); - - try { - NodeAVL node = getAccessor(store); - NodeAVL temp = node; - - if (node == null) { - return changes; - } - - while (true) { - node = temp; - temp = node.getLeft(store); - - if (temp == null) { - break; - } - - if (depth == Index.probeDepth) { - probeDeeper = true; - - break; - } - - depth++; - } - - while (true) { - temp = next(store, node, depth, probeDepth, depths); - depth = depths[0]; - - if (temp == null) { - break; - } - - compareRowForChange(session, node.getData(store), - temp.getData(store), changes); - - node = temp; - - counter++; - } - - if (probeDeeper) { - double[] factors = new double[colIndex.length]; - int extras = probeFactor(session, store, factors, true) - + probeFactor(session, store, factors, false); - - for (int i = 0; i < colIndex.length; i++) { - factors[i] /= 2.0; - - for (int j = 0; j < factors[i]; j++) { - changes[i] *= 2; - } - } - } - - long rowCount = store.elementCount(); - - for (int i = 0; i < colIndex.length; i++) { - if (changes[i] == 0) { - changes[i] = 1; - } - - changes[i] = rowCount / changes[i]; - - if (changes[i] < 2) { - changes[i] = 2; - } - } - -/* - StringBuilder s = new StringBuilder(); - - s.append("count " + rowCount + " columns " + colIndex.length - + " selectivity " + changes[0]); - System.out.println(s); -*/ - return changes; - } finally { - store.readUnlock(); - } - } - - int probeFactor(Session session, PersistentStore store, double[] changes, - boolean left) { - - int depth = 0; - NodeAVL x = getAccessor(store); - NodeAVL n = x; - - if (x == null) { - return 0; - } - - while (n != null) { - x = n; - n = left ? x.getLeft(store) - : x.getRight(store); - - depth++; - - if (depth > probeDepth && n != null) { - compareRowForChange(session, x.getData(store), - n.getData(store), changes); - } - } - - return depth - probeDepth; - } - - public boolean isEmpty(PersistentStore store) { - - store.readLock(); - - try { - return getAccessor(store) == null; - } finally { - store.readUnlock(); - } - } - - /** - * Removes all links between memory nodes - */ - public void unlinkNodes(PersistentStore store, NodeAVL primaryRoot) { - - NodeAVL x = primaryRoot; - NodeAVL l = x; - - while (l != null) { - x = l; - l = x.getLeft(null); - } - - while (x != null) { - NodeAVL n = nextUnlink(store, x); - - x = n; - } - } - - private NodeAVL nextUnlink(PersistentStore store, NodeAVL x) { - - NodeAVL temp = x.getRight(null); - - if (temp != null) { - x = temp; - temp = x.getLeft(null); - - while (temp != null) { - x = temp; - temp = x.getLeft(null); - } - - return x; - } - - temp = x; - x = x.getParent(null); - - while (x != null && x.isRight(store, temp)) { - x.nRight = null; - - temp.getRow(null).destroy(); - temp.delete(); - - // - temp = x; - x = x.getParent(null); - } - - if (x != null) { - x.nLeft = null; - } - - temp.getRow(null).destroy(); - temp.delete(); - - return x; - } - - /** - * Compares two table rows based on the columns of this index. The rowColMap - * parameter specifies which columns of the other table are to be compared - * with the colIndex columns of this index. The rowColMap can cover all or - * only some columns of this index. - * - * @param session Session - * @param a row from another table - * @param rowColMap column indexes in the other table - * @param b a full row in this table - * @return comparison result, -1,0,+1 - */ - public int compareRowNonUnique(Session session, Object[] a, Object[] b, - int[] rowColMap) { - - int fieldcount = rowColMap.length; - - for (int j = 0; j < fieldcount; j++) { - int i = colTypes[j].compare(session, a[colIndex[j]], - b[rowColMap[j]]); - - if (i != 0) { - return i; - } - } - - return 0; - } - - public int compareRowNonUnique(Session session, Object[] a, Object[] b, - int[] rowColMap, int fieldCount) { - - for (int j = 0; j < fieldCount; j++) { - int i = colTypes[j].compare(session, a[colIndex[j]], - b[rowColMap[j]]); - - if (i != 0) { - return i; - } - } - - return 0; - } - - /** - * As above but use the index column data - */ - public int compareRowNonUnique(Session session, Object[] a, Object[] b, - int fieldCount) { - - for (int j = 0; j < fieldCount; j++) { - int i = colTypes[j].compare(session, a[colIndex[j]], - b[colIndex[j]]); - - if (i != 0) { - return i; - } - } - - return 0; - } - - public void compareRowForChange(Session session, Object[] a, Object[] b, - double[] changes) { - - int c = 0; - - for (int j = 0; j < colIndex.length; j++) { - if (c == 0) { - c = colTypes[j].compare(session, a[colIndex[j]], - b[colIndex[j]]); - } - - if (c != 0) { - changes[j]++; - } - } - } - - public int compareRow(Session session, Object[] a, Object[] b) { - - for (int j = 0; j < colIndex.length; j++) { - int i = colTypes[j].compare(session, a[colIndex[j]], - b[colIndex[j]]); - - if (i != 0) { - if (isSimpleOrder) { - return i; - } - - boolean nulls = a[colIndex[j]] == null - || b[colIndex[j]] == null; - - if (colDesc[j] && !nulls) { - i = -i; - } - - if (nullsLast[j] && nulls) { - i = -i; - } - - return i; - } - } - - return 0; - } - - /** - * Compare two rows of the table for inserting rows into unique indexes - * Supports descending columns. - * - * @param session Session - * @param newRow data - * @param existingRow data - * @param useRowId boolean - * @param start int - * @return comparison result, -1,0,+1 - */ - int compareRowForInsertOrDelete(Session session, Row newRow, - Row existingRow, boolean useRowId, - int start) { - - Object[] a = newRow.getData(); - Object[] b = existingRow.getData(); - - for (int j = start; j < colIndex.length; j++) { - int i = colTypes[j].compare(session, a[colIndex[j]], - b[colIndex[j]]); - - if (i != 0) { - if (isSimpleOrder) { - return i; - } - - boolean nulls = a[colIndex[j]] == null - || b[colIndex[j]] == null; - - if (colDesc[j] && !nulls) { - i = -i; - } - - if (nullsLast[j] && nulls) { - i = -i; - } - - return i; - } - } - - // versioned rows are ordered by timestamp and row id - if (start == 0 && table.isSystemVersioned) { - TimestampData newVersion = newRow.getSystemEndVersion(); - TimestampData existingVersion = existingRow.getSystemEndVersion(); - int compare = Type.SQL_TIMESTAMP_WITH_TIME_ZONE.compare(session, - newVersion, existingVersion); - - if (compare == 0) { - if (newVersion.getSeconds() - != DateTimeType.epochLimitSeconds) { - useRowId = true; - } - } else { - return compare; - } - } - - if (useRowId) { - long diff = newRow.getPos() - existingRow.getPos(); - - return diff == 0L ? 0 - : diff > 0L ? 1 - : -1; - } - - return 0; - } - - int compareObject(Session session, Object[] a, Object[] b, - int[] rowColMap, int position, int opType) { - return colTypes[position].compare(session, a[colIndex[position]], - b[rowColMap[position]], opType); - } - - boolean hasNulls(Session session, Object[] rowData) { - - boolean uniqueNulls = session == null - || session.database.sqlUniqueNulls; - boolean compareId = false; - - for (int j = 0; j < colIndex.length; j++) { - if (rowData[colIndex[j]] == null) { - compareId = true; - - if (uniqueNulls) { - break; - } - } else if (!uniqueNulls) { - compareId = false; - - break; - } - } - - return compareId; - } - - /** - * Insert a node into the index - */ - public void insert(Session session, PersistentStore store, Row row) { - - NodeAVL n; - NodeAVL x; - boolean isleft = true; - int compare = -1; - boolean compareRowId = !isUnique || hasNulls(session, row.getData()); - - n = getAccessor(store); - x = n; - - if (n == null) { - store.setAccessor(this, ((RowAVL) row).getNode(position)); - - return; - } - - while (true) { - Row currentRow = n.getRow(store); - - compare = compareRowForInsertOrDelete(session, row, currentRow, - compareRowId, 0); - - // after the first match and check, all compares are with row id - if (compare == 0 && session != null && !compareRowId - && session.database.txManager.isMVRows()) { - if (!isEqualReadable(session, store, n)) { - compareRowId = true; - compare = compareRowForInsertOrDelete(session, row, - currentRow, - compareRowId, - colIndex.length); - } - } - - if (compare == 0) { - Constraint c = null; - - if (isConstraint) { - c = ((Table) table).getUniqueConstraintForIndex(this); - } - - if (c == null) { - throw Error.error(ErrorCode.X_23505, name.statementName); - } else { - throw c.getException(row.getData()); - } - } - - isleft = compare < 0; - x = n; - n = x.child(store, isleft); - - if (n == null) { - break; - } - } - - x = x.set(store, isleft, ((RowAVL) row).getNode(position)); - - balance(store, x, isleft); - } - - public void delete(Session session, PersistentStore store, Row row) { - - row = (Row) store.get(row, false); - - NodeAVL x = ((RowAVL) row).getNode(position); - - if (x == null) { - return; - } - - NodeAVL n; - - if (x.getLeft(store) == null) { - n = x.getRight(store); - } else if (x.getRight(store) == null) { - n = x.getLeft(store); - } else { - NodeAVL d = x; - - x = x.getLeft(store); - - while (true) { - NodeAVL temp = x.getRight(store); - - if (temp == null) { - break; - } - - x = temp; - } - - // x will be replaced with n later - n = x.getLeft(store); - - // swap d and x - int b = x.getBalance(store); - - x = x.setBalance(store, d.getBalance(store)); - d = d.setBalance(store, b); - - // set x.parent - NodeAVL xp = x.getParent(store); - NodeAVL dp = d.getParent(store); - - if (d.isRoot(store)) { - store.setAccessor(this, x); - } - - x = x.setParent(store, dp); - - if (dp != null) { - if (dp.isRight(store, d)) { - dp = dp.setRight(store, x); - } else { - dp = dp.setLeft(store, x); - } - } - - // relink d.parent, x.left, x.right - if (d.equals(xp)) { - d = d.setParent(store, x); - - if (d.isLeft(store, x)) { - x = x.setLeft(store, d); - - NodeAVL dr = d.getRight(store); - - x = x.setRight(store, dr); - } else { - x = x.setRight(store, d); - - NodeAVL dl = d.getLeft(store); - - x = x.setLeft(store, dl); - } - } else { - d = d.setParent(store, xp); - xp = xp.setRight(store, d); - - NodeAVL dl = d.getLeft(store); - NodeAVL dr = d.getRight(store); - - x = x.setLeft(store, dl); - x = x.setRight(store, dr); - } - - x.getRight(store).setParent(store, x); - x.getLeft(store).setParent(store, x); - - // set d.left, d.right - d = d.setLeft(store, n); - - if (n != null) { - n = n.setParent(store, d); - } - - d = d.setRight(store, null); - x = d; - } - - boolean isleft = x.isFromLeft(store); - - x.replace(store, this, n); - - n = x.getParent(store); - - x.delete(); - - while (n != null) { - x = n; - - int sign = isleft ? 1 - : -1; - - switch (x.getBalance(store) * sign) { - - case -1 : - x = x.setBalance(store, 0); - break; - - case 0 : - x = x.setBalance(store, sign); - - return; - - case 1 : - NodeAVL r = x.child(store, !isleft); - int b = r.getBalance(store); - - if (b * sign >= 0) { - x.replace(store, this, r); - - NodeAVL child = r.child(store, isleft); - - x = x.set(store, !isleft, child); - r = r.set(store, isleft, x); - - if (b == 0) { - x = x.setBalance(store, sign); - r = r.setBalance(store, -sign); - - return; - } - - x = x.setBalance(store, 0); - r = r.setBalance(store, 0); - x = r; - } else { - NodeAVL l = r.child(store, isleft); - - x.replace(store, this, l); - - b = l.getBalance(store); - r = r.set(store, isleft, l.child(store, !isleft)); - l = l.set(store, !isleft, r); - x = x.set(store, !isleft, l.child(store, isleft)); - l = l.set(store, isleft, x); - x = x.setBalance(store, (b == sign) ? -sign - : 0); - r = r.setBalance(store, (b == -sign) ? sign - : 0); - l = l.setBalance(store, 0); - x = l; - } - } - - isleft = x.isFromLeft(store); - n = x.getParent(store); - } - } - - public boolean existsParent(Session session, PersistentStore store, - Object[] rowdata, int[] rowColMap) { - - NodeAVL node = findNode(session, store, rowdata, rowColMap, - rowColMap.length, OpTypes.EQUAL, - TransactionManager.ACTION_REF, false); - - return node != null; - } - - /** - * Return the first node equal to the indexdata object. The rowdata has the - * same column mapping as this index. - * - * @param session session object - * @param store store object - * @param rowdata array containing index column data - * @param matchCount count of columns to match - * @param distinctCount int - * @param compareType int - * @param reversed boolean - * @param map boolean[] - * @return iterator - */ - public RowIterator findFirstRow(Session session, PersistentStore store, - Object[] rowdata, int matchCount, - int distinctCount, int compareType, - boolean reversed, boolean[] map) { - - NodeAVL node = findNode(session, store, rowdata, defaultColMap, - matchCount, compareType, - TransactionManager.ACTION_READ, reversed); - - if (node == null) { - return RangeIterator.emptyRowIterator; - } - - return new IndexRowIterator(session, store, this, node, distinctCount, - false, reversed); - } - - /** - * Return the first node equal to the rowdata object. - * The rowdata has the same column mapping as this table. - * - * @param session session object - * @param store store object - * @param rowdata array containing table row data - * @return iterator - */ - public RowIterator findFirstRow(Session session, PersistentStore store, - Object[] rowdata) { - - NodeAVL node = findNode(session, store, rowdata, colIndex, - colIndex.length, OpTypes.EQUAL, - TransactionManager.ACTION_READ, false); - - if (node == null) { - return RangeIterator.emptyRowIterator; - } - - return new IndexRowIterator(session, store, this, node, 0, false, - false); - } - - /** - * Return the first node equal to the rowdata object. The rowdata has the - * column mapping provided in rowColMap. - * - * @param session session object - * @param store store object - * @param rowdata array containing table row data - * @param rowColMap int[] - * @return iterator - */ - public RowIterator findFirstRow(Session session, PersistentStore store, - Object[] rowdata, int[] rowColMap) { - - NodeAVL node = findNode(session, store, rowdata, rowColMap, - rowColMap.length, OpTypes.EQUAL, - TransactionManager.ACTION_READ, false); - - if (node == null) { - return RangeIterator.emptyRowIterator; - } - - return new IndexRowIterator(session, store, this, node, 0, false, - false); - } - - /** - * Finds the first node where the data is not null. - * - * @return iterator - * @param session Session - * @param store PersistentStore - */ - public RowIterator findFirstRowNotNull(Session session, - PersistentStore store) { - - NodeAVL node = findNode(session, store, nullData, this.defaultColMap, - 1, OpTypes.NOT, - TransactionManager.ACTION_READ, false); - - if (node == null) { - return RangeIterator.emptyRowIterator; - } - - return new IndexRowIterator(session, store, this, node, 0, false, - false); - } - - /** - * Returns the row for the first node of the index - * - * @return Iterator for first row - */ - public RowIterator firstRow(Session session, PersistentStore store, - RangeVariableConditions[] conditions, - int distinctCount, boolean[] map) { - - store.readLock(); - - try { - NodeAVL x = getAccessor(store); - NodeAVL l = x; - - while (l != null) { - x = l; - l = x.getLeft(store); - } - - while (session != null && x != null) { - Row row = x.getRow(store); - - if (store.canRead(session, row, - TransactionManager.ACTION_READ, null)) { - break; - } - - x = next(store, x); - } - - if (x == null) { - return RangeIterator.emptyRowIterator; - } - - return new IndexRowIterator(session, store, this, x, - distinctCount, false, false); - } finally { - store.readUnlock(); - } - } - - public RowIterator firstRow(PersistentStore store) { - - store.readLock(); - - try { - NodeAVL x = getAccessor(store); - NodeAVL l = x; - - while (l != null) { - x = l; - l = x.getLeft(store); - } - - if (x == null) { - return RangeIterator.emptyRowIterator; - } - - return new IndexRowIterator(null, store, this, x, 0, false, false); - } finally { - store.readUnlock(); - } - } - - /** - * Returns the row for the last node of the index - * - * @return last row - */ - public RowIterator lastRow(Session session, PersistentStore store, - int distinctCount, boolean[] map) { - - store.readLock(); - - try { - NodeAVL x = getAccessor(store); - NodeAVL l = x; - - while (l != null) { - x = l; - l = x.getRight(store); - } - - while (session != null && x != null) { - Row row = x.getRow(store); - - if (store.canRead(session, row, - TransactionManager.ACTION_READ, null)) { - break; - } - - x = last(store, x); - } - - if (x == null) { - return RangeIterator.emptyRowIterator; - } - - return new IndexRowIterator(session, store, this, x, - distinctCount, false, true); - } finally { - store.readUnlock(); - } - } - - /** - * Returns the node after the given one - */ - NodeAVL next(Session session, PersistentStore store, NodeAVL x, - int distinctCount) { - - if (x == null) { - return null; - } - - if (distinctCount != 0) { - return findDistinctNode(session, store, x, distinctCount, false); - } - - while (true) { - x = next(store, x); - - if (x == null) { - return x; - } - - if (session == null) { - return x; - } - - Row row = x.getRow(store); - - if (store.canRead(session, row, TransactionManager.ACTION_READ, - null)) { - return x; - } - } - } - - NodeAVL last(Session session, PersistentStore store, NodeAVL x, - int distinctCount) { - - if (x == null) { - return null; - } - - if (distinctCount != 0) { - return findDistinctNode(session, store, x, distinctCount, true); - } - - while (true) { - x = last(store, x); - - if (x == null) { - return x; - } - - if (session == null) { - return x; - } - - Row row = x.getRow(store); - - if (store.canRead(session, row, TransactionManager.ACTION_READ, - null)) { - return x; - } - } - } - - NodeAVL next(PersistentStore store, NodeAVL x) { - - if (x == null) { - return null; - } - - RowAVL row = x.getRow(store); - - x = row.getNode(position); - - NodeAVL temp = x.getRight(store); - - if (temp != null) { - x = temp; - temp = x.getLeft(store); - - while (temp != null) { - x = temp; - temp = x.getLeft(store); - } - - return x; - } - - temp = x; - x = x.getParent(store); - - while (x != null && x.isRight(store, temp)) { - temp = x; - x = x.getParent(store); - } - - return x; - } - - NodeAVL next(PersistentStore store, NodeAVL x, int depth, int maxDepth, - int[] depths) { - - NodeAVL temp = depth == maxDepth ? null - : x.getRight(store); - - if (temp != null) { - depth++; - - x = temp; - temp = depth == maxDepth ? null - : x.getLeft(store); - - while (temp != null) { - depth++; - - x = temp; - - if (depth == maxDepth) { - temp = null; - } else { - temp = x.getLeft(store); - } - } - - depths[0] = depth; - - return x; - } - - temp = x; - x = x.getParent(store); - - depth--; - - while (x != null && x.isRight(store, temp)) { - temp = x; - x = x.getParent(store); - - depth--; - } - - depths[0] = depth; - - return x; - } - - NodeAVL last(PersistentStore store, NodeAVL x) { - - if (x == null) { - return null; - } - - RowAVL row = x.getRow(store); - - x = row.getNode(position); - - NodeAVL temp = x.getLeft(store); - - if (temp != null) { - x = temp; - temp = x.getRight(store); - - while (temp != null) { - x = temp; - temp = x.getRight(store); - } - - return x; - } - - temp = x; - x = x.getParent(store); - - while (x != null && x.isLeft(store, temp)) { - temp = x; - x = x.getParent(store); - } - - return x; - } - - boolean isEqualReadable(Session session, PersistentStore store, - NodeAVL node) { - - NodeAVL c = node; - Object[] data; - Object[] nodeData; - Row row; - - row = node.getRow(store); - - if (store.canRead(session, row, TransactionManager.ACTION_DUP, null)) { - if (row.isCurrentSystemVersion()) { - return true; - } - } - - data = node.getData(store); - - while (true) { - c = last(store, c); - - if (c == null) { - break; - } - - nodeData = c.getData(store); - - if (compareRow(session, data, nodeData) == 0) { - row = c.getRow(store); - - if (store.canRead(session, row, TransactionManager.ACTION_DUP, - null)) { - if (row.isCurrentSystemVersion()) { - return true; - } - } - - continue; - } - - break; - } - - c = node; - - while (true) { - c = next(store, c); - - if (c == null) { - break; - } - - nodeData = c.getData(store); - - if (compareRow(session, data, nodeData) == 0) { - row = c.getRow(store); - - if (store.canRead(session, row, TransactionManager.ACTION_DUP, - null)) { - if (row.isCurrentSystemVersion()) { - return true; - } - } - - continue; - } - - break; - } - - return false; - } - - /** - * Finds a match with a row from a different table - * - * @param session Session - * @param store PersistentStore - * @param rowdata array containing data for the index columns - * @param rowColMap map of the data to columns - * @param fieldCount int - * @param compareType int - * @param readMode int - * @param reversed boolean - * @return matching node or null - */ - NodeAVL findNode(Session session, PersistentStore store, Object[] rowdata, - int[] rowColMap, int fieldCount, int compareType, - int readMode, boolean reversed) { - - store.readLock(); - - try { - NodeAVL x = getAccessor(store); - NodeAVL n = null; - NodeAVL result = null; - Row currentRow = null; - - if (compareType != OpTypes.EQUAL - && compareType != OpTypes.IS_NULL) { - fieldCount--; - - if (compareType == OpTypes.SMALLER - || compareType == OpTypes.SMALLER_EQUAL - || compareType == OpTypes.MAX) { - reversed = true; - } - } - - while (x != null) { - currentRow = x.getRow(store); - - int i = 0; - - if (fieldCount > 0) { - i = compareRowNonUnique(session, currentRow.getData(), - rowdata, rowColMap, fieldCount); - } - - if (i == 0) { - switch (compareType) { - - case OpTypes.MAX : - case OpTypes.IS_NULL : - case OpTypes.EQUAL : { - result = x; - - if (reversed) { - n = x.getRight(store); - } else { - n = x.getLeft(store); - } - - break; - } - case OpTypes.NOT : - case OpTypes.GREATER : { - i = compareObject(session, currentRow.getData(), - rowdata, rowColMap, fieldCount, - compareType); - - if (i <= 0) { - n = x.getRight(store); - } else { - result = x; - n = x.getLeft(store); - } - - break; - } - case OpTypes.GREATER_EQUAL_PRE : - case OpTypes.GREATER_EQUAL : { - i = compareObject(session, currentRow.getData(), - rowdata, rowColMap, fieldCount, - compareType); - - if (i < 0) { - n = x.getRight(store); - } else { - result = x; - n = x.getLeft(store); - } - - break; - } - case OpTypes.SMALLER : { - i = compareObject(session, currentRow.getData(), - rowdata, rowColMap, fieldCount, - compareType); - - if (i < 0) { - result = x; - n = x.getRight(store); - } else { - n = x.getLeft(store); - } - - break; - } - case OpTypes.SMALLER_EQUAL : { - i = compareObject(session, currentRow.getData(), - rowdata, rowColMap, fieldCount, - compareType); - - if (i <= 0) { - result = x; - n = x.getRight(store); - } else { - n = x.getLeft(store); - } - - break; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, - "Index"); - } - } else if (i < 0) { - n = x.getRight(store); - } else if (i > 0) { - n = x.getLeft(store); - } - - if (n == null) { - break; - } - - x = n; - } - - // MVCC 190 - if (session == null) { - return result; - } - - while (result != null) { - currentRow = result.getRow(store); - - if (store.canRead(session, currentRow, readMode, colIndex)) { - break; - } - - result = reversed ? last(store, result) - : next(store, result); - - if (result == null) { - break; - } - - currentRow = result.getRow(store); - - if (fieldCount > 0 - && compareRowNonUnique( - session, currentRow.getData(), rowdata, rowColMap, - fieldCount) != 0) { - result = null; - - break; - } - } - - return result; - } finally { - store.readUnlock(); - } - } - - NodeAVL findDistinctNode(Session session, PersistentStore store, - NodeAVL node, int fieldCount, boolean reversed) { - - store.readLock(); - - try { - NodeAVL x = getAccessor(store); - NodeAVL n = null; - NodeAVL result = null; - Row currentRow = null; - Object[] rowData = node.getData(store); - - while (x != null) { - currentRow = x.getRow(store); - - int i = 0; - - i = compareRowNonUnique(session, currentRow.getData(), - rowData, colIndex, fieldCount); - - if (reversed) { - if (i < 0) { - result = x; - n = x.getRight(store); - } else { - n = x.getLeft(store); - } - } else { - if (i <= 0) { - n = x.getRight(store); - } else { - result = x; - n = x.getLeft(store); - } - } - - if (n == null) { - break; - } - - x = n; - } - - // MVCC 190 - if (session == null) { - return result; - } - - while (result != null) { - currentRow = result.getRow(store); - - if (store.canRead(session, currentRow, - TransactionManager.ACTION_READ, colIndex)) { - break; - } - - result = reversed ? last(store, result) - : next(store, result); - } - - return result; - } finally { - store.readUnlock(); - } - } - - /** - * Balances part of the tree after an alteration to the index. - */ - void balance(PersistentStore store, NodeAVL x, boolean isleft) { - - while (true) { - int sign = isleft ? 1 - : -1; - - switch (x.getBalance(store) * sign) { - - case 1 : - x = x.setBalance(store, 0); - - return; - - case 0 : - x = x.setBalance(store, -sign); - break; - - case -1 : - NodeAVL l = x.child(store, isleft); - - if (l.getBalance(store) == -sign) { - x.replace(store, this, l); - - x = x.set(store, isleft, l.child(store, !isleft)); - l = l.set(store, !isleft, x); - x = x.setBalance(store, 0); - l = l.setBalance(store, 0); - } else { - NodeAVL r = l.child(store, !isleft); - - x.replace(store, this, r); - - l = l.set(store, !isleft, r.child(store, isleft)); - r = r.set(store, isleft, l); - x = x.set(store, isleft, r.child(store, !isleft)); - r = r.set(store, !isleft, x); - - int rb = r.getBalance(store); - - x = x.setBalance(store, (rb == -sign) ? sign - : 0); - l = l.setBalance(store, (rb == sign) ? -sign - : 0); - r = r.setBalance(store, 0); - } - - return; - } - - if (x.isRoot(store)) { - return; - } - - isleft = x.isFromLeft(store); - x = x.getParent(store); - } - } - - NodeAVL getAccessor(PersistentStore store) { - - NodeAVL node = (NodeAVL) store.getAccessor(this); - - return node; - } - - RowIterator getIterator(Session session, PersistentStore store, NodeAVL x, - boolean single, boolean reversed) { - - if (x == null) { - return RangeIterator.emptyRowIterator; - } else { - IndexRowIterator it = new IndexRowIterator(session, store, this, - x, 0, single, reversed); - - return it; - } - } - - public static final class IndexRowIterator implements RowIterator { - - final Session session; - final PersistentStore store; - final IndexAVL index; - NodeAVL nextnode; - Row lastrow; - int distinctCount; - boolean single; - boolean reversed; - - /** - * When session == null, rows from all sessions are returned - */ - public IndexRowIterator(Session session, PersistentStore store, - IndexAVL index, NodeAVL node, - int distinctCount, boolean single, - boolean reversed) { - - this.session = session; - this.store = store; - this.index = index; - this.distinctCount = distinctCount; - this.single = single; - this.reversed = reversed; - - if (index == null) { - return; - } - - nextnode = node; - } - - public Object getField(int col) { - - if (lastrow == null) { - return null; - } - - return lastrow.getData()[col]; - } - - public boolean next() { - - getNextRow(); - - return lastrow != null; - } - - public Row getCurrentRow() { - return lastrow; - } - - public Object[] getCurrent() { - - if (lastrow == null) { - return null; - } - - return lastrow.getData(); - } - - private Row getNextRow() { - - if (nextnode == null) { - release(); - - lastrow = null; - - return null; - } - - NodeAVL lastnode = nextnode; - - if (single) { - nextnode = null; - } else { - store.readLock(); - - try { - while (true) { - if (reversed) { - nextnode = index.last(session, store, nextnode, - distinctCount); - } else { - nextnode = index.next(session, store, nextnode, - distinctCount); - } - - if (nextnode == null) { - break; - } - - Row row = nextnode.getRow(store); - - if (session == null - || store.canRead( - session, row, - TransactionManager.ACTION_READ, null)) { - break; - } - } - } finally { - store.readUnlock(); - } - } - - lastrow = lastnode.getRow(store); - - return lastrow; - } - - public void removeCurrent() { - store.delete(session, lastrow); - store.remove(lastrow); - } - - public void release() {} - - public long getRowId() { - return lastrow.getPos(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/index/IndexAVLCheck.java b/database/hsqldb/src/org/hsqldb/index/IndexAVLCheck.java deleted file mode 100644 index afad7087..00000000 --- a/database/hsqldb/src/org/hsqldb/index/IndexAVLCheck.java +++ /dev/null @@ -1,576 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.index; - -import org.hsqldb.HsqlException; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.lib.IntKeyHashMap; -import org.hsqldb.lib.OrderedLongHashSet; -import org.hsqldb.map.BitMap; -import org.hsqldb.persist.DataFileCache; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.persist.RowStoreAVL; -import org.hsqldb.result.Result; -import org.hsqldb.rowio.RowInputBinary; - -/** - * Checks indexes for inconsistencies - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.5.1 - */ -public class IndexAVLCheck { - - public static Result checkAllTables(Session session, int type) { - - Result result = IndexStats.newEmptyResult(); - HsqlArrayList allTables = - session.database.schemaManager.getAllTables(true); - int tableCount = allTables.size(); - - for (int i = 0; i < tableCount; i++) { - Table table = (Table) allTables.get(i); - - if (!table.isCached()) { - continue; - } - - checkTable(session, table, result, type); - } - - return result; - } - - public static Result checkTable(Session session, Table table, int type) { - - Result result = IndexStats.newEmptyResult(); - - if (!table.isCached()) { - return result; - } - - checkTable(session, table, result, type); - - return result; - } - - public static void checkTable(Session session, Table table, Result result, - int type) { - - RowStoreAVL tableStore = - (RowStoreAVL) table.database.persistentStoreCollection.getStore( - table); - IndexStats[] statList = tableStore.checkIndexes(session, type); - - statList[0].addTableStats(result); - - for (int j = 0; j < statList.length; j++) { - statList[j].addStats(result); - } - - if (type == IndexStats.fixAll) { - boolean hasErrors = false; - - for (int j = 0; j < statList.length; j++) { - if (statList[j].hasErrors) { - hasErrors = true; - } - } - - if (hasErrors) { - reindexTable(session, table, tableStore, statList); - - for (int j = 0; j < statList.length; j++) { - if (statList[j].reindexed) { - statList[j].addReindexedStats(result); - } - } - } - } - } - - public static void reindexTable(Session session, Table table, - PersistentStore store, - IndexStats[] indexStats) { - - Index readIndex = null; - boolean reindex = false; - - for (int i = 0; i < indexStats.length; i++) { - if (!indexStats[i].hasErrors) { - readIndex = table.getIndex(i); - - break; - } - } - - if (readIndex == null) { - session.database.logger.logSevereEvent( - "could not recreate damaged indexes for table: " - + table.getName().statementName, null); - - return; - } - - for (int i = 0; i < indexStats.length; i++) { - if (indexStats[i].hasErrors) { - Index index = table.getIndex(i); - - store.reindex(session, index, readIndex); - - indexStats[i].reindexed = true; - reindex = true; - } - } - - if (reindex) { - session.database.logger.logSevereEvent( - "recreated damaged indexes for table: " - + table.getName().statementName, null); - } - } - - public static class IndexAVLProbe { - - static final int maxDepth = 16; // must be half of 32 (max depth) - final int fileBlockItemCount; - final int cacheScale; - final Session session; - final PersistentStore store; - final IndexAVL index; - final NodeAVLDisk rootNode; - - // - IntKeyHashMap bitMaps; - IntKeyHashMap bitMapsPos; - OrderedLongHashSet badRows; - OrderedLongHashSet loopedRows; - OrderedLongHashSet ignoreRows; - HsqlArrayList unorderedRows = new HsqlArrayList(); - int branchPosition; - int leafPosition; - long errorRowCount; - long rowCount; - long loopCount; - boolean printErrors = false; - - /** - * Uses one arraylist for the nodes near the root and another array list - * for leaves. - * - * Returns nodes to depth of 32 - */ - public IndexAVLProbe(Session session, PersistentStore store, - IndexAVL index, NodeAVL rootNode) { - - DataFileCache cache = store.getCache(); - - this.fileBlockItemCount = cache == null ? 0 - : store.getCache() - .spaceManager - .getFileBlockItemCount(); - this.cacheScale = cache == null ? 0 - : store.getCache() - .getDataFileScale(); - this.session = session; - this.store = store; - this.index = index; - this.rootNode = cache == null ? null - : (NodeAVLDisk) rootNode; - } - - public IndexStats getStats() { - - IndexStats stats = new IndexStats(); - - stats.index = index; - stats.store = store; - stats.errorCount = errorRowCount; - stats.loopCount = loopCount; - stats.goodRowCount = rowCount; - stats.unorderedList = unorderedRows; - stats.hasErrors = hasErrors(); - - return stats; - } - - public boolean hasErrors() { - return !(errorRowCount == 0 && loopCount == 0 - && unorderedRows.isEmpty()); - } - - public void probe() { - - if (index == null) { - return; - } - - if (rootNode == null) { - return; - } - - if (fileBlockItemCount == 0) { - return; - } - - bitMaps = new IntKeyHashMap(); - bitMapsPos = new IntKeyHashMap(); - badRows = new OrderedLongHashSet(); - loopedRows = new OrderedLongHashSet(); - ignoreRows = new OrderedLongHashSet(); - unorderedRows = new HsqlArrayList(); - - Row row = rootNode.getRow(store); - - setSpaceForRow(row); - - // fill the root and set any branch roots - getNodesFrom(0, rootNode, true); - - if (!hasErrors()) { - checkIndexOrder(); - } - } - - public void checkIndexOrder() { - - int errors = 0; - - store.readLock(); - - try { - NodeAVL p = index.getAccessor(store); - NodeAVL f = null; - - while (p != null) { - f = p; - p = p.getLeft(store); - } - - p = f; - - while (f != null) { - errors += checkNodes(f, unorderedRows); - - NodeAVL fnext = index.next(store, f); - - if (fnext != null) { - int c = index.compareRowForInsertOrDelete(session, - fnext.getRow(store), f.getRow(store), true, 0); - - if (c <= 0) { - if (errors < 10) { - unorderedRows.add("broken index order "); - } - - errors++; - } - } - - f = fnext; - } - } finally { - store.readUnlock(); - } - } - - int checkNodes(NodeAVL p, HsqlArrayList list) { - - NodeAVLDisk l = (NodeAVLDisk) p.getLeft(store); - NodeAVLDisk r = (NodeAVLDisk) p.getRight(store); - int errors = 0; - - if (l != null && l.iBalance == -2) { - list.add("broken index - deleted"); - - errors++; - } - - if (r != null && r.iBalance == -2) { - list.add("broken index -deleted"); - - errors++; - } - - if (l != null && p.getPos() != l.getParentPos()) { - list.add("broken index - no parent"); - - errors++; - } - - if (r != null && p.getPos() != r.getParentPos()) { - list.add("broken index - no parent"); - - errors++; - } - - return errors; - } - - public TableBase getCurrentTable() { - return index.getTable(); - } - - public long getErrorCount() { - return errorRowCount; - } - - public IntKeyHashMap getBitMaps() { - return bitMaps; - } - - public OrderedLongHashSet getBadRowPosList() { - return badRows; - } - - /* - * todo - - * - * this goes from root to branch in one direction. we can also check the - * parent node of each node and see if it leads to a differen node not - * yet found - this will find errors with AVL and saving of rows - */ - - /** - * goes to maxDepth - * include is false to exclude a node that has readable index pointers but unreadable data - */ - private void getNodesFrom(int depth, NodeAVLDisk node, - boolean include) { - - if (node == null) { - return; - } - - long pos = node.getPos(); - - if (!recordRowPos(pos)) { - loopedRows.add(pos); - - return; - } - - rowCount++; - - // the children of the node are checked but the row is ignored - if (!include) { - ignoreRows.add(pos); - } - - long leftPos = node.getLeftPos(); - - try { - if (badRows.contains(leftPos)) { - return; - } - - NodeAVLDisk next = (NodeAVLDisk) node.getLeft(store); - - if (next != null) { - Row row = next.getRow(store); - - // avoid overwitten - if (setSpaceForRow(row)) { - getNodesFrom(depth + 1, next, true); - - if (next.getParentPos() != pos) { - NodeAVLDisk parentNode = - (NodeAVLDisk) node.getParent(store); - - loopCount++; - } - } else { - badRows.add(leftPos); - } - } - } catch (HsqlException e) { - RowInputBinary rowIn = (RowInputBinary) e.info; - - if (rowIn != null) { - rowIn.ignoreDataErrors = true; - - try { - NodeAVLDisk next = (NodeAVLDisk) node.getLeft(store); - - getNodesFrom(depth + 1, next, false); - } catch (Throwable t) { - badRows.add((int) leftPos); - } finally { - rowIn.ignoreDataErrors = false; - } - } - - errorRowCount++; - } catch (Throwable t) { - errorRowCount++; - } - - long rightPos = node.getRightPos(); - - try { - if (badRows.contains(rightPos)) { - return; - } - - NodeAVLDisk next = (NodeAVLDisk) node.getRight(store); - - if (next != null) { - Row row = next.getRow(store); - - // avoid loops - if (setSpaceForRow(row)) { - getNodesFrom(depth + 1, next, true); - - if (next.getParentPos() != pos) { - NodeAVLDisk parentNode = - (NodeAVLDisk) node.getParent(store); - - loopCount++; - } - } else { - badRows.add(rightPos); - } - } - } catch (HsqlException e) { - RowInputBinary rowIn = (RowInputBinary) e.info; - - if (rowIn != null) { - rowIn.ignoreDataErrors = true; - - try { - NodeAVLDisk next = (NodeAVLDisk) node.getRight(store); - - getNodesFrom(depth + 1, next, false); - } catch (Throwable t) { - badRows.add(rightPos); - } finally { - rowIn.ignoreDataErrors = false; - } - } - - errorRowCount++; - } catch (Throwable t) { - errorRowCount++; - } - } - - /** - * returns false if a node appears more than once in the index - */ - boolean setSpaceForRow(Row object) { - - long position = object.getPos(); - int units = object.getStorageSize() / cacheScale; - boolean result = true; - - for (; units > 0; ) { - int blockIndex = (int) (position / fileBlockItemCount); - int blockOffset = (int) (position % fileBlockItemCount); - int currentUnits = fileBlockItemCount - blockOffset; - - if (currentUnits > units) { - currentUnits = units; - } - - BitMap bitMap = getBitMap(blockIndex); - int countSet = bitMap.countSet(blockOffset, currentUnits); - - if (countSet > 0) { - - // two rows overlap (if only one index is adding to bit map) - if (printErrors) { - System.out.println( - "index scan - row duplicate in file block " - + blockIndex + " offset " + blockOffset); - } - - result = false; - } else { - bitMap.setRange(blockOffset, currentUnits); - } - - units -= currentUnits; - position += currentUnits; - } - - return result; - } - - BitMap getBitMap(int blockIndex) { - - BitMap bitMap = (BitMap) bitMaps.get(blockIndex); - - if (bitMap == null) { - bitMap = - new BitMap(new int[fileBlockItemCount / Integer.SIZE]); - - bitMaps.put(blockIndex, bitMap); - } - - return bitMap; - } - - boolean recordRowPos(long position) { - - int blockIndex = (int) (position / fileBlockItemCount); - int blockOffset = (int) (position % fileBlockItemCount); - BitMap bitMap = getPosSet(blockIndex); - - if (bitMap.isSet(blockOffset)) { - return false; - } - - bitMap.set(blockOffset); - - return true; - } - - BitMap getPosSet(int blockIndex) { - - BitMap bitMap = (BitMap) bitMapsPos.get(blockIndex); - - if (bitMap == null) { - bitMap = - new BitMap(new int[fileBlockItemCount / Integer.SIZE]); - - bitMapsPos.put(blockIndex, bitMap); - } - - return bitMap; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/index/IndexAVLMemory.java b/database/hsqldb/src/org/hsqldb/index/IndexAVLMemory.java deleted file mode 100644 index 5710de59..00000000 --- a/database/hsqldb/src/org/hsqldb/index/IndexAVLMemory.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.index; - -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.TableBase; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.types.Type; - -/** - * Implementation of an AVL for memory tables.

    - * - * New class derived from Hypersonic SQL code and enhanced in HSQLDB.

    - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since Hypersonic SQL - */ -public class IndexAVLMemory extends IndexAVL { - - /** - * Constructor declaration - * - * @param name HsqlName of the index - * @param id persistnece id - * @param table table of the index - * @param columns array of column indexes - * @param descending boolean[] for result sets - * @param nullsLast boolean[] for result sets - * @param colTypes array of column types - * @param pk is index for a primary key - * @param unique is this a unique index - * @param constraint does this index belong to a constraint - * @param forward is this an auto-index for an FK that refers to a table - * defined after this table - */ - public IndexAVLMemory(HsqlName name, long id, TableBase table, - int[] columns, boolean[] descending, - boolean[] nullsLast, Type[] colTypes, boolean pk, - boolean unique, boolean constraint, - boolean forward) { - super(name, id, table, columns, descending, nullsLast, colTypes, pk, - unique, constraint, forward); - } - - void delete(PersistentStore store, NodeAVL x) { - - if (x == null) { - return; - } - - NodeAVL n; - - if (x.nLeft == null) { - n = x.nRight; - } else if (x.nRight == null) { - n = x.nLeft; - } else { - NodeAVL d = x; - - x = x.nLeft; - - while (true) { - NodeAVL temp = x.nRight; - - if (temp == null) { - break; - } - - x = temp; - } - - // x will be replaced with n later - n = x.nLeft; - - // swap d and x - int b = x.iBalance; - - x.iBalance = d.iBalance; - d.iBalance = b; - - // set x.parent - NodeAVL xp = x.nParent; - NodeAVL dp = d.nParent; - - if (d.isRoot(store)) { - store.setAccessor(this, x); - } - - x.nParent = dp; - - if (dp != null) { - if (dp.nRight == d) { - dp.nRight = x; - } else { - dp.nLeft = x; - } - } - - // relink d.parent, x.left, x.right - if (d == xp) { - d.nParent = x; - - if (d.nLeft == x) { - x.nLeft = d; - - NodeAVL dr = d.nRight; - - x.nRight = dr; - } else { - x.nRight = d; - - NodeAVL dl = d.nLeft; - - x.nLeft = dl; - } - } else { - d.nParent = xp; - xp.nRight = d; - - NodeAVL dl = d.nLeft; - NodeAVL dr = d.nRight; - - x.nLeft = dl; - x.nRight = dr; - } - - x.nRight.nParent = x; - x.nLeft.nParent = x; - - // set d.left, d.right - d.nLeft = n; - - if (n != null) { - n.nParent = d; - } - - d.nRight = null; - x = d; - } - - boolean isleft = x.isFromLeft(store); - - x.replace(store, this, n); - - n = x.nParent; - - x.delete(); - - while (n != null) { - x = n; - - int sign = isleft ? 1 - : -1; - - switch (x.iBalance * sign) { - - case -1 : - x.iBalance = 0; - break; - - case 0 : - x.iBalance = sign; - - return; - - case 1 : - NodeAVL r = x.child(store, !isleft); - int b = r.iBalance; - - if (b * sign >= 0) { - x.replace(store, this, r); - - NodeAVL child = r.child(store, isleft); - - x.set(store, !isleft, child); - r.set(store, isleft, x); - - if (b == 0) { - x.iBalance = sign; - r.iBalance = -sign; - - return; - } - - x.iBalance = 0; - r.iBalance = 0; - x = r; - } else { - NodeAVL l = r.child(store, isleft); - - x.replace(store, this, l); - - b = l.iBalance; - - r.set(store, isleft, l.child(store, !isleft)); - l.set(store, !isleft, r); - x.set(store, !isleft, l.child(store, isleft)); - l.set(store, isleft, x); - - x.iBalance = (b == sign) ? -sign - : 0; - r.iBalance = (b == -sign) ? sign - : 0; - l.iBalance = 0; - x = l; - } - } - - isleft = x.isFromLeft(store); - n = x.nParent; - } - } - - NodeAVL next(PersistentStore store, NodeAVL x) { - - NodeAVL r = x.nRight; - - if (r != null) { - x = r; - - NodeAVL l = x.nLeft; - - while (l != null) { - x = l; - l = x.nLeft; - } - - return x; - } - - NodeAVL ch = x; - - x = x.nParent; - - while (x != null && ch == x.nRight) { - ch = x; - x = x.nParent; - } - - return x; - } - - NodeAVL last(PersistentStore store, NodeAVL x) { - - if (x == null) { - return null; - } - - NodeAVL left = x.nLeft; - - if (left != null) { - x = left; - - NodeAVL right = x.nRight; - - while (right != null) { - x = right; - right = x.nRight; - } - - return x; - } - - NodeAVL ch = x; - - x = x.nParent; - - while (x != null && ch.equals(x.nLeft)) { - ch = x; - x = x.nParent; - } - - return x; - } - - /** - * Balances part of the tree after an alteration to the index. - */ - void balance(PersistentStore store, NodeAVL x, boolean isleft) { - - while (true) { - int sign = isleft ? 1 - : -1; - - switch (x.iBalance * sign) { - - case 1 : - x.iBalance = 0; - - return; - - case 0 : - x.iBalance = -sign; - break; - - case -1 : - NodeAVL l = isleft ? x.nLeft - : x.nRight; - - if (l.iBalance == -sign) { - x.replace(store, this, l); - x.set(store, isleft, l.child(store, !isleft)); - l.set(store, !isleft, x); - - x.iBalance = 0; - l.iBalance = 0; - } else { - NodeAVL r = !isleft ? l.nLeft - : l.nRight; - - x.replace(store, this, r); - l.set(store, !isleft, r.child(store, isleft)); - r.set(store, isleft, l); - x.set(store, isleft, r.child(store, !isleft)); - r.set(store, !isleft, x); - - int rb = r.iBalance; - - x.iBalance = (rb == -sign) ? sign - : 0; - l.iBalance = (rb == sign) ? -sign - : 0; - r.iBalance = 0; - } - - return; - } - - if (x.nParent == null) { - return; - } - - isleft = x == x.nParent.nLeft; - x = x.nParent; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/index/IndexStats.java b/database/hsqldb/src/org/hsqldb/index/IndexStats.java deleted file mode 100644 index b43944ed..00000000 --- a/database/hsqldb/src/org/hsqldb/index/IndexStats.java +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.index; - -import org.hsqldb.Table; -import org.hsqldb.TypeInvariants; -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.result.Result; -import org.hsqldb.types.Type; - -/** - * Holds results of index check - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.1 - * @since 2.5.1 - */ -public class IndexStats { - - public static final IndexStats[] emptyArray = new IndexStats[0]; - - // - public static final int sizes = 1; - public static final int checkSpaces = 2; - public static final int checkRows = 3; - public static final int checkIndexSpaces = 4; - public static final int setVersion = 5; - public static final int findRoots = 6; - public static final int fixAll = 8; - - // - public Index index; - public PersistentStore store; - public boolean hasErrors; - public long errorCount; - public long loopCount; - public long goodRowCount; - public boolean reindexed; // set after a reindex - HsqlArrayList unorderedList = new HsqlArrayList(); - - public static Result newEmptyResult() { - - String[] names = new String[] { - "TABLE_NAME", "INDEX_NAME", "INFO" - }; - Type[] types = new Type[] { - Type.SQL_VARCHAR_DEFAULT, TypeInvariants.SQL_IDENTIFIER, - Type.SQL_VARCHAR_DEFAULT - }; - Result result = Result.newMultiColumnResult(names, types); - - return result; - } - - public void addTableStats(Result result) { - - Object[] data = new Object[] { - ((Table) index.getTable()).getName() - .getSchemaQualifiedStatementName(), - "", "rows " + store.elementCount() - }; - - result.navigator.add(data); - } - - public void addStats(Result result) { - - { - Object[] data = new Object[] { - ((Table) index.getTable()).getName() - .getSchemaQualifiedStatementName(), - index.getName().getStatementName(), - "readable rows " + goodRowCount - }; - - result.navigator.add(data); - } - - if (errorCount != 0) { - Object[] data = new Object[] { - "", "", "error rows " + errorCount - }; - - result.navigator.add(data); - } - - if (loopCount != 0) { - Object[] data = new Object[] { - "", "", "loop rows " + loopCount - }; - - result.navigator.add(data); - } - - for (int i = 0; i < unorderedList.size(); i++) { - Object[] data = new Object[] { - "", "", (Object) unorderedList.get(i) - }; - - result.navigator.add(data); - } - } - - public void addReindexedStats(Result result) { - - { - Object[] data = new Object[] { - ((Table) index.getTable()).getName() - .getSchemaQualifiedStatementName(), - index.getName().getStatementName(), "reindexed" - }; - - result.navigator.add(data); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/index/NodeAVL.java b/database/hsqldb/src/org/hsqldb/index/NodeAVL.java deleted file mode 100644 index 4570b955..00000000 --- a/database/hsqldb/src/org/hsqldb/index/NodeAVL.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.index; - -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.RowAVLDisk; -import org.hsqldb.lib.LongLookup; -import org.hsqldb.persist.CachedObject; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.rowio.RowOutputInterface; -import org.hsqldb.rowio.RowInputInterface; - -// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP) -// fredt@users 20020920 - path 1.7.1 - refactoring to cut memory footprint -// fredt@users 20021205 - path 1.7.2 - enhancements -// fredt@users 20021215 - doc 1.7.2 - javadoc comments - -/** - * The parent for all AVL node implementations. Subclasses of Node vary - * in the way they hold - * references to other Nodes in the AVL tree, or to their Row data.
    - * - * nNext links the Node objects belonging to different indexes for each - * table row. It is used solely by Row to locate the node belonging to a - * particular index.
    - * - * New class derived from Hypersonic SQL code and enhanced in HSQLDB.

    - * - * @author Fred Toussi (fredt@users dot sourceforge dot net) - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.3.3 - * @since Hypersonic SQL - */ -public class NodeAVL implements CachedObject { - - static final int NO_POS = RowAVLDisk.NO_POS; - public int iBalance; - public NodeAVL nNext; // node of next index (nNext==null || nNext.iId=iId+1) - - // - protected NodeAVL nLeft; - protected NodeAVL nRight; - protected NodeAVL nParent; - protected final Row row; - - NodeAVL() { - row = null; - } - - public NodeAVL(Row r) { - row = r; - } - - public void delete() { - iBalance = 0; - nLeft = nRight = nParent = null; - } - - NodeAVL getLeft(PersistentStore store) { - return nLeft; - } - - NodeAVL setLeft(PersistentStore persistentStore, NodeAVL n) { - - nLeft = n; - - return this; - } - - public int getBalance(PersistentStore store) { - return iBalance; - } - - boolean isLeft(PersistentStore store, NodeAVL node) { - return nLeft == node; - } - - boolean isRight(PersistentStore store, NodeAVL node) { - return nRight == node; - } - - NodeAVL getRight(PersistentStore persistentStore) { - return nRight; - } - - NodeAVL setRight(PersistentStore persistentStore, NodeAVL n) { - - nRight = n; - - return this; - } - - NodeAVL getParent(PersistentStore store) { - return nParent; - } - - boolean isRoot(PersistentStore store) { - return nParent == null; - } - - NodeAVL setParent(PersistentStore persistentStore, NodeAVL n) { - - nParent = n; - - return this; - } - - public NodeAVL setBalance(PersistentStore store, int b) { - - iBalance = b; - - return this; - } - - boolean isFromLeft(PersistentStore store) { - - if (nParent == null) { - return true; - } - - return this == nParent.nLeft; - } - - public NodeAVL child(PersistentStore store, boolean isleft) { - return isleft ? getLeft(store) - : getRight(store); - } - - public NodeAVL set(PersistentStore store, boolean isLeft, NodeAVL n) { - - if (isLeft) { - nLeft = n; - } else { - nRight = n; - } - - if (n != null) { - n.nParent = this; - } - - return this; - } - - public void replace(PersistentStore store, Index index, NodeAVL n) { - - if (nParent == null) { - if (n != null) { - n = n.setParent(store, null); - } - - store.setAccessor(index, n); - } else { - nParent.set(store, isFromLeft(store), n); - } - } - - boolean equals(NodeAVL n) { - return n == this; - } - - public void setInMemory(boolean in) {} - - public int getDefaultCapacity() { - return 0; - } - - public void read(RowInputInterface in) {} - - public void write(RowOutputInterface out) {} - - public void write(RowOutputInterface out, LongLookup lookup) {} - - public long getPos() { - return 0; - } - - public RowAVL getRow(PersistentStore store) { - return (RowAVL) row; - } - - protected Object[] getData(PersistentStore store) { - return row.getData(); - } - - public void updateAccessCount(int count) {} - - public int getAccessCount() { - return 0; - } - - public void setStorageSize(int size) {} - - public int getStorageSize() { - return 0; - } - - public final boolean isInvariable() { - return false; - } - - public final boolean isBlock() { - return false; - } - - public void setPos(long pos) {} - - public boolean isNew() { - return false; - } - - public boolean hasChanged() { - return false; - } - - public void setChanged(boolean flag) {} - - public boolean isKeepInMemory() { - return false; - } - - public boolean keepInMemory(boolean keep) { - return true; - } - - public boolean isInMemory() { - return false; - } - - public void restore() {} - - public void destroy() {} - - public int getRealSize(RowOutputInterface out) { - return 0; - } - - public boolean isMemory() { - return true; - } -} diff --git a/database/hsqldb/src/org/hsqldb/index/NodeAVLDisk.java b/database/hsqldb/src/org/hsqldb/index/NodeAVLDisk.java deleted file mode 100644 index 1548da84..00000000 --- a/database/hsqldb/src/org/hsqldb/index/NodeAVLDisk.java +++ /dev/null @@ -1,482 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.index; - -import org.hsqldb.RowAVL; -import org.hsqldb.RowAVLDisk; -import org.hsqldb.Table; -import org.hsqldb.lib.LongLookup; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP) -// fredt@users 20020920 - path 1.7.1 - refactoring to cut memory footprint -// fredt@users 20021205 - path 1.7.2 - enhancements - -/** - * Cached table Node implementation.

    - * Only integral references to left, right and parent nodes in the AVL tree - * are held and used as pointers data.

    - * - * iId is a reference to the Index object that contains this node.
    - * This fields can be eliminated in the future, by changing the - * method signatures to take a Index parameter from Index.java (fredt@users) - * - * New class derived from Hypersonic SQL code and enhanced in HSQLDB.

    - * - * @author Fred Toussi (fredt@users dot sourceforge dot net) - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.6.0 - * @since Hypersonic SQL - */ -public class NodeAVLDisk extends NodeAVL { - - private int iLeft = NO_POS; - private int iRight = NO_POS; - private int iParent = NO_POS; - private int iId; // id of Index object for this Node - public static final int SIZE_IN_BYTE = 4 * 4; - - public NodeAVLDisk(RowAVLDisk r, RowInputInterface in, int id) { - - super(r); - - iId = id; - iBalance = in.readInt(); - iLeft = in.readInt(); - iRight = in.readInt(); - iParent = in.readInt(); - - if (iLeft <= 0) { - iLeft = NO_POS; - } - - if (iRight <= 0) { - iRight = NO_POS; - } - - if (iParent <= 0) { - iParent = NO_POS; - } - } - - public NodeAVLDisk(RowAVLDisk r, int id) { - - super(r); - - iId = id; - } - - public void delete() { - - iLeft = NO_POS; - iRight = NO_POS; - iParent = NO_POS; - nLeft = null; - nRight = null; - nParent = null; - iBalance = 0; - - ((RowAVLDisk) row).setNodesChanged(); - } - - public boolean isInMemory() { - return row.isInMemory(); - } - - public boolean isMemory() { - return false; - } - - public long getPos() { - return row.getPos(); - } - - public RowAVL getRow(PersistentStore store) { - return (RowAVLDisk) store.get(this.row, false); - } - - public Object[] getData(PersistentStore store) { - return row.getData(); - } - - private NodeAVLDisk findNode(PersistentStore store) { - - if (row.isInMemory()) { - return this; - } - - RowAVLDisk r = (RowAVLDisk) store.get(row.getPos(), false); - - if (r == null) { - String tableName = ""; - - if (row.getTable().getTableType() == Table.CACHED_TABLE) { - tableName = ((Table) row.getTable()).getName().name; - } - - store.getCache().logSevereEvent(tableName + " NodeAVLDisk " - + row.getPos(), null); - - return this; - } - - return (NodeAVLDisk) r.getNode(iId); - } - - private NodeAVLDisk findNode(PersistentStore store, long pos) { - - NodeAVLDisk ret = null; - RowAVLDisk r = (RowAVLDisk) store.get(pos, false); - - if (r != null) { - ret = (NodeAVLDisk) r.getNode(iId); - } - - return ret; - } - - boolean isLeft(PersistentStore store, NodeAVL n) { - - NodeAVLDisk node = findNode(store); - - if (n == null) { - return node.iLeft == NO_POS; - } - - return node.iLeft == n.getPos(); - } - - boolean isRight(PersistentStore store, NodeAVL n) { - - NodeAVLDisk node = findNode(store); - - if (n == null) { - return node.iRight == NO_POS; - } - - return node.iRight == n.getPos(); - } - - NodeAVL getLeft(PersistentStore store) { - - NodeAVLDisk node = findNode(store); - - if (node.iLeft == NO_POS) { - return null; - } - - return findNode(store, node.iLeft); - } - - NodeAVL getRight(PersistentStore store) { - - NodeAVLDisk node = findNode(store); - - if (node.iRight == NO_POS) { - return null; - } - - return findNode(store, node.iRight); - } - - NodeAVL getParent(PersistentStore store) { - - NodeAVLDisk node = findNode(store); - - if (node.iParent == NO_POS) { - return null; - } - - return findNode(store, node.iParent); - } - - public int getBalance(PersistentStore store) { - - NodeAVLDisk node = findNode(store); - - return node.iBalance; - } - - boolean isRoot(PersistentStore store) { - - NodeAVLDisk node = findNode(store); - - return node.iParent == NO_POS; - } - - boolean isFromLeft(PersistentStore store) { - - NodeAVLDisk node = findNode(store); - - if (node.iParent == NO_POS) { - return true; - } - - NodeAVLDisk temp = findNode(store, node.iParent); - - return row.getPos() == temp.iLeft; - } - - public NodeAVL child(PersistentStore store, boolean isleft) { - return isleft ? getLeft(store) - : getRight(store); - } - - NodeAVL setParent(PersistentStore store, NodeAVL n) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDisk node = (NodeAVLDisk) row.getNode(iId); - - row.setNodesChanged(); - - node.iParent = n == null ? NO_POS - : (int) n.getPos(); - - row.keepInMemory(false); - - return node; - } - - public NodeAVL setBalance(PersistentStore store, int b) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDisk node = (NodeAVLDisk) row.getNode(iId); - - row.setNodesChanged(); - - node.iBalance = b; - - row.keepInMemory(false); - - return node; - } - - NodeAVL setLeft(PersistentStore store, NodeAVL n) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDisk node = (NodeAVLDisk) row.getNode(iId); - - node.iLeft = n == null ? NO_POS - : (int) n.getPos(); - - row.setNodesChanged(); - row.keepInMemory(false); - - return node; - } - - NodeAVL setRight(PersistentStore store, NodeAVL n) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDisk node = (NodeAVLDisk) row.getNode(iId); - - node.iRight = n == null ? NO_POS - : (int) n.getPos(); - - row.setNodesChanged(); - row.keepInMemory(false); - - return node; - } - - public NodeAVL set(PersistentStore store, boolean isLeft, NodeAVL n) { - - NodeAVL x; - - if (isLeft) { - x = setLeft(store, n); - } else { - x = setRight(store, n); - } - - if (n != null) { - n.setParent(store, x); - } - - return x; - } - - public void replace(PersistentStore store, Index index, NodeAVL n) { - - NodeAVLDisk node = findNode(store); - - if (node.iParent == NO_POS) { - if (n != null) { - n = n.setParent(store, null); - } - - store.setAccessor(index, n); - } else { - boolean isFromLeft = isFromLeft(store); - - getParent(store).set(store, isFromLeft, n); - } - } - - boolean equals(NodeAVL n) { - - if (n instanceof NodeAVLDisk) { - return this == n || (row.getPos() == n.getPos()); - } - - return false; - } - - public int getRealSize(RowOutputInterface out) { - return NodeAVLDisk.SIZE_IN_BYTE; - } - - public void setInMemory(boolean in) {} - - public void write(RowOutputInterface out) { - - out.writeInt(iBalance); - out.writeInt((iLeft == NO_POS) ? 0 - : iLeft); - out.writeInt((iRight == NO_POS) ? 0 - : iRight); - out.writeInt((iParent == NO_POS) ? 0 - : iParent); - } - - public void write(RowOutputInterface out, LongLookup lookup) { - - out.writeInt(iBalance); - out.writeInt(getTranslatePointer(iLeft, lookup)); - out.writeInt(getTranslatePointer(iRight, lookup)); - out.writeInt(getTranslatePointer(iParent, lookup)); - } - - private static int getTranslatePointer(int pointer, LongLookup lookup) { - - int newPointer = 0; - - if (pointer != NodeAVL.NO_POS) { - if (lookup == null) { - newPointer = pointer; - } else { - newPointer = (int) lookup.lookup(pointer); - } - } - - return newPointer; - } - - public void restore() {} - - public void destroy() {} - - public void updateAccessCount(int count) {} - - public int getAccessCount() { - return 0; - } - - public void setStorageSize(int size) {} - - public int getStorageSize() { - return 0; - } - - public void setPos(long pos) {} - - public boolean isNew() { - return false; - } - - public boolean hasChanged() { - return false; - } - - public void setChanged(boolean flag) {} - - public boolean isKeepInMemory() { - return false; - } - - public boolean keepInMemory(boolean keep) { - return false; - } - - long getLeftPos() { - return iLeft; - } - - long getRightPos() { - return iRight; - } - - long getParentPos() { - return iParent; - } -} diff --git a/database/hsqldb/src/org/hsqldb/index/NodeAVLDiskLarge.java b/database/hsqldb/src/org/hsqldb/index/NodeAVLDiskLarge.java deleted file mode 100644 index 8b205678..00000000 --- a/database/hsqldb/src/org/hsqldb/index/NodeAVLDiskLarge.java +++ /dev/null @@ -1,427 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.index; - -import org.hsqldb.RowAVL; -import org.hsqldb.RowAVLDisk; -import org.hsqldb.Table; -import org.hsqldb.lib.LongLookup; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * Subclass of NodeAVL for huge databases. - * @author Fred Toussi (fredt@users dot sourceforge dot net) - * @version 2.3.4 - * @since 2.2.9 - */ -public class NodeAVLDiskLarge extends NodeAVL { - - private long iLeft = NO_POS; - private long iRight = NO_POS; - private long iParent = NO_POS; - private int iId; // id of Index object for this Node - public static final int SIZE_IN_BYTE = 4 * 4; - - public NodeAVLDiskLarge(RowAVLDisk r, RowInputInterface in, int id) { - - super(r); - - iId = id; - - int ext = in.readInt(); - - iBalance = (byte) ext; - iLeft = in.readInt() & 0xffffffffL; - iRight = in.readInt() & 0xffffffffL; - iParent = in.readInt() & 0xffffffffL; - - if (ext > 0xff) { - iParent |= (((long) ext << 8) & 0xff00000000L); - iLeft |= (((long) ext << 16) & 0xff00000000L); - iRight |= (((long) ext << 24) & 0xff00000000L); - } - - if (iLeft == 0) { - iLeft = NO_POS; - } - - if (iRight == 0) { - iRight = NO_POS; - } - - if (iParent == 0) { - iParent = NO_POS; - } - } - - public NodeAVLDiskLarge(RowAVLDisk r, int id) { - - super(r); - - iId = id; - } - - public void delete() { - - iLeft = NO_POS; - iRight = NO_POS; - iParent = NO_POS; - iBalance = 0; - - ((RowAVLDisk) row).setNodesChanged(); - } - - public boolean isInMemory() { - return row.isInMemory(); - } - - public boolean isMemory() { - return false; - } - - public long getPos() { - return row.getPos(); - } - - public RowAVL getRow(PersistentStore store) { - return (RowAVLDisk) store.get(this.row, false); - } - - public Object[] getData(PersistentStore store) { - return row.getData(); - } - - private NodeAVLDiskLarge findNode(PersistentStore store) { - - if (row.isInMemory()) { - return this; - } - - RowAVLDisk r = (RowAVLDisk) store.get(row.getPos(), false); - - if (r == null) { - String tableName = ""; - - if (row.getTable().getTableType() == Table.CACHED_TABLE) { - tableName = ((Table) row.getTable()).getName().name; - } - - store.getCache().logSevereEvent(tableName + " NodeAVLDiskLarge " - + row.getPos(), null); - - return this; - } - - return (NodeAVLDiskLarge) r.getNode(iId); - } - - private NodeAVLDiskLarge findNode(PersistentStore store, long pos) { - - NodeAVLDiskLarge ret = null; - RowAVLDisk r = (RowAVLDisk) store.get(pos, false); - - if (r != null) { - ret = (NodeAVLDiskLarge) r.getNode(iId); - } - - return ret; - } - - boolean isLeft(PersistentStore store, NodeAVL n) { - - NodeAVLDiskLarge node = findNode(store); - - if (n == null) { - return node.iLeft == NO_POS; - } - - return node.iLeft == n.getPos(); - } - - boolean isRight(PersistentStore store, NodeAVL n) { - - NodeAVLDiskLarge node = findNode(store); - - if (n == null) { - return node.iRight == NO_POS; - } - - return node.iRight == n.getPos(); - } - - NodeAVL getLeft(PersistentStore store) { - - NodeAVLDiskLarge node = findNode(store); - - if (node.iLeft == NO_POS) { - return null; - } - - return findNode(store, node.iLeft); - } - - NodeAVL getRight(PersistentStore store) { - - NodeAVLDiskLarge node = findNode(store); - - if (node.iRight == NO_POS) { - return null; - } - - return findNode(store, node.iRight); - } - - NodeAVL getParent(PersistentStore store) { - - NodeAVLDiskLarge node = findNode(store); - - if (node.iParent == NO_POS) { - return null; - } - - return findNode(store, iParent); - } - - public int getBalance(PersistentStore store) { - - NodeAVLDiskLarge node = findNode(store); - - return node.iBalance; - } - - boolean isRoot(PersistentStore store) { - - NodeAVLDiskLarge node = findNode(store); - - return node.iParent == NO_POS; - } - - boolean isFromLeft(PersistentStore store) { - - NodeAVLDiskLarge node = findNode(store); - - if (node.iParent == NO_POS) { - return true; - } - - NodeAVLDiskLarge temp = findNode(store, iParent); - - return row.getPos() == temp.iLeft; - } - - public NodeAVL child(PersistentStore store, boolean isleft) { - return isleft ? getLeft(store) - : getRight(store); - } - - NodeAVL setParent(PersistentStore store, NodeAVL n) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDiskLarge node = (NodeAVLDiskLarge) row.getNode(iId); - - row.setNodesChanged(); - - node.iParent = n == null ? NO_POS - : n.getPos(); - - row.keepInMemory(false); - - return node; - } - - public NodeAVL setBalance(PersistentStore store, int b) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDiskLarge node = (NodeAVLDiskLarge) row.getNode(iId); - - row.setNodesChanged(); - - node.iBalance = b; - - row.keepInMemory(false); - - return node; - } - - NodeAVL setLeft(PersistentStore store, NodeAVL n) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDiskLarge node = (NodeAVLDiskLarge) row.getNode(iId); - - node.iLeft = n == null ? NO_POS - : n.getPos(); - - row.setNodesChanged(); - row.keepInMemory(false); - - return node; - } - - NodeAVL setRight(PersistentStore store, NodeAVL n) { - - RowAVLDisk row = (RowAVLDisk) store.get(this.row, true); - NodeAVLDiskLarge node = (NodeAVLDiskLarge) row.getNode(iId); - - node.iRight = n == null ? NO_POS - : n.getPos(); - - row.setNodesChanged(); - row.keepInMemory(false); - - return node; - } - - public NodeAVL set(PersistentStore store, boolean isLeft, NodeAVL n) { - - NodeAVL x; - - if (isLeft) { - x = setLeft(store, n); - } else { - x = setRight(store, n); - } - - if (n != null) { - n.setParent(store, x); - } - - return x; - } - - public void replace(PersistentStore store, Index index, NodeAVL n) { - - NodeAVLDiskLarge node = findNode(store); - - if (node.iParent == NO_POS) { - if (n != null) { - n = n.setParent(store, null); - } - - store.setAccessor(index, n); - } else { - boolean isFromLeft = node.isFromLeft(store); - - node.getParent(store).set(store, isFromLeft, n); - } - } - - boolean equals(NodeAVL n) { - - if (n instanceof NodeAVLDiskLarge) { - return this == n || row.getPos() == n.getPos(); - } - - return false; - } - - public int getRealSize(RowOutputInterface out) { - return NodeAVLDiskLarge.SIZE_IN_BYTE; - } - - public void setInMemory(boolean in) {} - - public void write(RowOutputInterface out) { - write(out, null); - } - - public void write(RowOutputInterface out, LongLookup lookup) { - - long leftTemp = getTranslatePointer(iLeft, lookup); - long rightTemp = getTranslatePointer(iRight, lookup); - long parentTemp = getTranslatePointer(iParent, lookup); - int ext = 0; - - ext |= (int) ((parentTemp & 0xff00000000L) >> 8); - ext |= (int) ((leftTemp & 0xff00000000L) >> 16); - ext |= (int) ((rightTemp & 0xff00000000L) >> 24); - - if (ext == 0) { - ext = iBalance; - } else { - ext |= (iBalance & 0xff); - } - - out.writeInt(ext); - out.writeInt((int) leftTemp); - out.writeInt((int) rightTemp); - out.writeInt((int) parentTemp); - } - - private static long getTranslatePointer(long pointer, LongLookup lookup) { - - long newPointer = 0; - - if (pointer != NodeAVL.NO_POS) { - if (lookup == null) { - newPointer = pointer; - } else { - newPointer = lookup.lookup(pointer); - } - } - - return newPointer; - } - - public void restore() {} - - public void destroy() {} - - public void updateAccessCount(int count) {} - - public int getAccessCount() { - return 0; - } - - public void setStorageSize(int size) {} - - public int getStorageSize() { - return 0; - } - - public void setPos(long pos) {} - - public boolean hasChanged() { - return false; - } - - public void setChanged(boolean flag) {} - - public boolean isKeepInMemory() { - return false; - } - - public boolean keepInMemory(boolean keep) { - return false; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCArray.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCArray.java deleted file mode 100644 index 4492cbd9..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCArray.java +++ /dev/null @@ -1,582 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.Array; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.hsqldb.ColumnBase; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.navigator.RowSetNavigatorClient; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.types.Type; - -/** - * The mapping in the Java programming language for the SQL type - * ARRAY. - * By default, an Array value is a transaction-duration - * reference to an SQL ARRAY value. By default, an Array - * object is implemented using an SQL LOCATOR(array) internally, which - * means that an Array object contains a logical pointer - * to the data in the SQL ARRAY value rather - * than containing the ARRAY value's data. - *

    - * The Array interface provides methods for bringing an SQL - * ARRAY value's data to the client as either an array or a - * ResultSet object. - * If the elements of the SQL ARRAY - * are a UDT, they may be custom mapped. To create a custom mapping, - * a programmer must do two things: - *

      - *
    • create a class that implements the {@link java.sql.SQLData} - * interface for the UDT to be custom mapped. - *
    • make an entry in a type map that contains - *
        - *
      • the fully-qualified SQL type name of the UDT - *
      • the Class object for the class implementing - * SQLData - *
      - *
    - *

    - * When a type map with an entry for - * the base type is supplied to the methods getArray - * and getResultSet, the mapping - * it contains will be used to map the elements of the ARRAY value. - * If no type map is supplied, which would typically be the case, - * the connection's type map is used by default. - * If the connection's type map or a type map supplied to a method has no entry - * for the base type, the elements are mapped according to the standard mapping. - *

    - * All methods on the Array interface must be fully implemented if the - * JDBC driver supports the data type. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.1 - * @since JDK 1.2, HSQLDB 2.0 - */ -public class JDBCArray implements Array { - - /** - * Retrieves the SQL type name of the elements in - * the array designated by this Array object. - * If the elements are a built-in type, it returns - * the database-specific type name of the elements. - * If the elements are a user-defined type (UDT), - * this method returns the fully-qualified SQL type name. - * - * @return a String that is the database-specific - * name for a built-in base type; or the fully-qualified SQL type - * name for a base type that is a UDT - * @exception SQLException if an error occurs while attempting - * to access the type name - * @since JDK 1.2 - */ - public String getBaseTypeName() throws SQLException { - - checkClosed(); - - return elementType.getNameString(); - } - - /** - * Retrieves the JDBC type of the elements in the array designated - * by this Array object. - * - * @return a constant from the class {@link java.sql.Types} that is - * the type code for the elements in the array designated by this - * Array object - * @exception SQLException if an error occurs while attempting - * to access the base type - * @since JDK 1.2 - */ - public int getBaseType() throws SQLException { - - checkClosed(); - - return elementType.getJDBCTypeCode(); - } - - /** - * - * Retrieves the contents of the SQL ARRAY value designated - * by this - * Array object in the form of an array in the Java - * programming language. This version of the method getArray - * uses the type map associated with the connection for customizations of - * the type mappings. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @return an array in the Java programming language that contains - * the ordered elements of the SQL ARRAY value - * designated by this Array object - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public Object getArray() throws SQLException { - - checkClosed(); - - Object[] array = new Object[data.length]; - - for (int i = 0; i < data.length; i++) { - array[i] = elementType.convertSQLToJava(sessionProxy, data[i]); - } - - return array; - } - - /** - * - * Retrieves the contents of the SQL ARRAY value designated by this - * Array object. - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getArray uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @param map a java.util.Map object that contains mappings - * of SQL type names to classes in the Java programming language - * @return an array in the Java programming language that contains the ordered - * elements of the SQL array designated by this object - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public Object getArray(java.util.Map> map) throws SQLException { - return getArray(); - } - - /** - * - * Retrieves a slice of the SQL ARRAY - * value designated by this Array object, beginning with the - * specified index and containing up to count - * successive elements of the SQL array. This method uses the type map - * associated with the connection for customizations of the type mappings. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to retrieve - * @return an array containing up to count consecutive elements - * of the SQL array, beginning with element index - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public Object getArray(long index, int count) throws SQLException { - - checkClosed(); - - if (!JDBCClobClient.isInLimits(data.length, index - 1, count)) { - throw JDBCUtil.outOfRangeArgument(); - } - - Object[] slice = new Object[count]; - - for (int i = 0; i < count; i++) { - slice[i] = elementType.convertSQLToJava(sessionProxy, - data[(int) index + i - 1]); - } - - return slice; - } - - /** - * - * Retrieves a slice of the SQL ARRAY value - * designated by this Array object, beginning with the specified - * index and containing up to count - * successive elements of the SQL array. - *

    - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getArray uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to - * retrieve - * @param map a java.util.Map object - * that contains SQL type names and the classes in - * the Java programming language to which they are mapped - * @return an array containing up to count - * consecutive elements of the SQL ARRAY value designated by this - * Array object, beginning with element - * index - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public Object getArray(long index, int count, - java.util.Map> map) throws SQLException { - return getArray(index, count); - } - - /** - * Retrieves a result set that contains the elements of the SQL - * ARRAY value - * designated by this Array object. If appropriate, - * the elements of the array are mapped using the connection's type - * map; otherwise, the standard mapping is used. - *

    - * The result set contains one row for each array element, with - * two columns in each row. The second column stores the element - * value; the first column stores the index into the array for - * that element (with the first array element being at index 1). - * The rows are in ascending order corresponding to - * the order of the indices. - * - * @return a {@link ResultSet} object containing one row for each - * of the elements in the array designated by this Array - * object, with the rows in ascending order based on the indices. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet() throws SQLException { - - checkClosed(); - - Result result = this.newColumnResult(0, data.length); - - return new JDBCResultSet(connection, result, result.metaData); - } - - /** - * Retrieves a result set that contains the elements of the SQL - * ARRAY value designated by this Array object. - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getResultSet uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * The result set contains one row for each array element, with - * two columns in each row. The second column stores the element - * value; the first column stores the index into the array for - * that element (with the first array element being at index 1). - * The rows are in ascending order corresponding to - * the order of the indices. - * - * @param map contains the mapping of SQL user-defined types to - * classes in the Java programming language - * @return a ResultSet object containing one row for each - * of the elements in the array designated by this Array - * object, with the rows in ascending order based on the indices. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet(java.util.Map> map) throws SQLException { - return getResultSet(); - } - - /** - * Retrieves a result set holding the elements of the subarray that - * starts at index index and contains up to - * count successive elements. This method uses - * the connection's type map to map the elements of the array if - * the map contains an entry for the base type. Otherwise, the - * standard mapping is used. - *

    - * The result set has one row for each element of the SQL array - * designated by this object, with the first row containing the - * element at index index. The result set has - * up to count rows in ascending order based on the - * indices. Each row has two columns: The second column stores - * the element value; the first column stores the index into the - * array for that element. - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to retrieve - * @return a ResultSet object containing up to - * count consecutive elements of the SQL array - * designated by this Array object, starting at - * index index. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet(long index, int count) throws SQLException { - - checkClosed(); - - Result result = this.newColumnResult(index - 1, count); - - return new JDBCResultSet(connection, result, result.metaData); - } - - /** - * Retrieves a result set holding the elements of the subarray that - * starts at index index and contains up to - * count successive elements. - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getResultSet uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * The result set has one row for each element of the SQL array - * designated by this object, with the first row containing the - * element at index index. The result set has - * up to count rows in ascending order based on the - * indices. Each row has two columns: The second column stores - * the element value; the first column stores the index into the - * array for that element. - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to retrieve - * @param map the Map object that contains the mapping - * of SQL type names to classes in the Java(tm) programming language - * @return a ResultSet object containing up to - * count consecutive elements of the SQL array - * designated by this Array object, starting at - * index index. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet(long index, int count, - java.util.Map> map) throws SQLException { - return getResultSet(index, count); - } - - /** - * Returns a string representation in the form ARRAY[..., ...] - */ - public String toString() { - - if (arrayType == null) { - arrayType = Type.getDefaultArrayType(elementType.typeCode); - } - - return arrayType.convertToString(data); - } - - /** - * This method frees the Array object and releases the resources that - * it holds. The object is invalid once the free - * method is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - *

    - * - * @throws SQLException if an error occurs releasing - * the Array's resources - * @since JDK 1.6 - */ - public void free() throws SQLException { - - if (!closed) { - closed = true; - connection = null; - sessionProxy = null; - } - } - - //------------- - volatile boolean closed; - Type arrayType; - Type elementType; - Object[] data; - JDBCConnection connection; - SessionInterface sessionProxy; - - public JDBCArray(Object[] data, Type type, Type arrayType, - SessionInterface session) { - - this(data, type, arrayType, session.getJDBCConnection()); - - this.sessionProxy = session; - } - - /** - * Constructor should reject unsupported types. - */ - JDBCArray(Object[] data, Type type, Type arrayType, - JDBCConnection connection) { - - this.data = data; - this.elementType = type; - this.arrayType = arrayType; - this.connection = connection; - - if (connection != null) { - this.sessionProxy = connection.sessionProxy; - } - } - - public Object[] getArrayInternal() { - return data; - } - - private Result newColumnResult(long position, - int count) throws SQLException { - - if (!JDBCClobClient.isInLimits(data.length, position, count)) { - throw JDBCUtil.outOfRangeArgument(); - } - - Type[] types = new Type[2]; - - types[0] = Type.SQL_INTEGER; - types[1] = elementType; - - ResultMetaData meta = ResultMetaData.newSimpleResultMetaData(types); - - meta.columnLabels = new String[] { - "C1", "C2" - }; - meta.colIndexes = new int[] { - -1, -1 - }; - meta.columns = new ColumnBase[2]; - - ColumnBase column = new ColumnBase("", "", "", ""); - - column.setType(types[0]); - - meta.columns[0] = column; - column = new ColumnBase("", "", "", ""); - - column.setType(types[1]); - - meta.columns[1] = column; - - RowSetNavigatorClient navigator = new RowSetNavigatorClient(); - - for (int i = (int) position; i < position + count; i++) { - Object[] rowData = new Object[2]; - - rowData[0] = Integer.valueOf(i + 1); - rowData[1] = data[i]; - - navigator.add(rowData); - } - - Result result = Result.newDataResult(meta); - - result.setNavigator(navigator); - - return result; - } - - private void checkClosed() throws SQLException { - - if (closed) { - throw JDBCUtil.sqlException(ErrorCode.X_07501); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCArrayBasic.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCArrayBasic.java deleted file mode 100644 index f4cd6017..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCArrayBasic.java +++ /dev/null @@ -1,540 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.Array; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.hsqldb.ColumnBase; -import org.hsqldb.navigator.RowSetNavigatorClient; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.types.Type; - -/** - * The mapping in the Java programming language for the SQL type - * ARRAY. - * By default, an Array value is a transaction-duration - * reference to an SQL ARRAY value. By default, an Array - * object is implemented using an SQL LOCATOR(array) internally, which - * means that an Array object contains a logical pointer - * to the data in the SQL ARRAY value rather - * than containing the ARRAY value's data. - *

    - * The Array interface provides methods for bringing an SQL - * ARRAY value's data to the client as either an array or a - * ResultSet object. - * If the elements of the SQL ARRAY - * are a UDT, they may be custom mapped. To create a custom mapping, - * a programmer must do two things: - *

      - *
    • create a class that implements the {@link java.sql.SQLData} - * interface for the UDT to be custom mapped. - *
    • make an entry in a type map that contains - *
        - *
      • the fully-qualified SQL type name of the UDT - *
      • the Class object for the class implementing - * SQLData - *
      - *
    - *

    - * When a type map with an entry for - * the base type is supplied to the methods getArray - * and getResultSet, the mapping - * it contains will be used to map the elements of the ARRAY value. - * If no type map is supplied, which would typically be the case, - * the connection's type map is used by default. - * If the connection's type map or a type map supplied to a method has no entry - * for the base type, the elements are mapped according to the standard mapping. - *

    - * All methods on the Array interface must be fully implemented if the - * JDBC driver supports the data type. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since JDK 1.2, HSQLDB 2.0.1 - */ -public class JDBCArrayBasic implements Array { - - /** - * Retrieves the SQL type name of the elements in - * the array designated by this Array object. - * If the elements are a built-in type, it returns - * the database-specific type name of the elements. - * If the elements are a user-defined type (UDT), - * this method returns the fully-qualified SQL type name. - * - * @return a String that is the database-specific - * name for a built-in base type; or the fully-qualified SQL type - * name for a base type that is a UDT - * @exception SQLException if an error occurs while attempting - * to access the type name - * @since JDK 1.2 - */ - public String getBaseTypeName() throws SQLException { - - checkClosed(); - - return elementType.getNameString(); - } - - /** - * Retrieves the JDBC type of the elements in the array designated - * by this Array object. - * - * @return a constant from the class {@link java.sql.Types} that is - * the type code for the elements in the array designated by this - * Array object - * @exception SQLException if an error occurs while attempting - * to access the base type - * @since JDK 1.2 - */ - public int getBaseType() throws SQLException { - - checkClosed(); - - return elementType.getJDBCTypeCode(); - } - - /** - * - * Retrieves the contents of the SQL ARRAY value designated - * by this - * Array object in the form of an array in the Java - * programming language. This version of the method getArray - * uses the type map associated with the connection for customizations of - * the type mappings. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @return an array in the Java programming language that contains - * the ordered elements of the SQL ARRAY value - * designated by this Array object - * @since JDK 1.2 - */ - public Object getArray() { - return data; - } - - /** - * - * Retrieves the contents of the SQL ARRAY value designated by this - * Array object. - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getArray uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @param map a java.util.Map object that contains mappings - * of SQL type names to classes in the Java programming language - * @return an array in the Java programming language that contains the ordered - * elements of the SQL array designated by this object - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public Object getArray(java.util.Map> map) throws SQLException { - return getArray(); - } - - /** - * - * Retrieves a slice of the SQL ARRAY - * value designated by this Array object, beginning with the - * specified index and containing up to count - * successive elements of the SQL array. This method uses the type map - * associated with the connection for customizations of the type mappings. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to retrieve - * @return an array containing up to count consecutive elements - * of the SQL array, beginning with element index - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public Object getArray(long index, int count) throws SQLException { - - checkClosed(); - - if (!JDBCClobClient.isInLimits(data.length, index - 1, count)) { - throw JDBCUtil.outOfRangeArgument(); - } - - Object[] slice = new Object[count]; - - System.arraycopy(data, (int) index - 1, slice, 0, count); - - return slice; - } - - /** - * - * Retrieves a slice of the SQL ARRAY value - * designated by this Array object, beginning with the specified - * index and containing up to count - * successive elements of the SQL array. - *

    - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getArray uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * Note: When getArray is used to materialize - * a base type that maps to a primitive data type, then it is - * implementation-defined whether the array returned is an array of - * that primitive data type or an array of Object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns an array of Object. - * - *

    - * - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to - * retrieve - * @param map a java.util.Map object - * that contains SQL type names and the classes in - * the Java programming language to which they are mapped - * @return an array containing up to count - * consecutive elements of the SQL ARRAY value designated by this - * Array object, beginning with element - * index - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public Object getArray(long index, int count, - java.util.Map> map) throws SQLException { - return getArray(index, count); - } - - /** - * Retrieves a result set that contains the elements of the SQL - * ARRAY value - * designated by this Array object. If appropriate, - * the elements of the array are mapped using the connection's type - * map; otherwise, the standard mapping is used. - *

    - * The result set contains one row for each array element, with - * two columns in each row. The second column stores the element - * value; the first column stores the index into the array for - * that element (with the first array element being at index 1). - * The rows are in ascending order corresponding to - * the order of the indices. - * - * @return a {@link ResultSet} object containing one row for each - * of the elements in the array designated by this Array - * object, with the rows in ascending order based on the indices. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet() throws SQLException { - - checkClosed(); - - Result result = this.newColumnResult(0, data.length); - - return JDBCResultSet.newJDBCResultSet(result, result.metaData); - } - - /** - * Retrieves a result set that contains the elements of the SQL - * ARRAY value designated by this Array object. - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getResultSet uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * The result set contains one row for each array element, with - * two columns in each row. The second column stores the element - * value; the first column stores the index into the array for - * that element (with the first array element being at index 1). - * The rows are in ascending order corresponding to - * the order of the indices. - * - * @param map contains the mapping of SQL user-defined types to - * classes in the Java programming language - * @return a ResultSet object containing one row for each - * of the elements in the array designated by this Array - * object, with the rows in ascending order based on the indices. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet(java.util.Map> map) throws SQLException { - return getResultSet(); - } - - /** - * Retrieves a result set holding the elements of the subarray that - * starts at index index and contains up to - * count successive elements. This method uses - * the connection's type map to map the elements of the array if - * the map contains an entry for the base type. Otherwise, the - * standard mapping is used. - *

    - * The result set has one row for each element of the SQL array - * designated by this object, with the first row containing the - * element at index index. The result set has - * up to count rows in ascending order based on the - * indices. Each row has two columns: The second column stores - * the element value; the first column stores the index into the - * array for that element. - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to retrieve - * @return a ResultSet object containing up to - * count consecutive elements of the SQL array - * designated by this Array object, starting at - * index index. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet(long index, int count) throws SQLException { - - checkClosed(); - - Result result = this.newColumnResult(index - 1, count); - - return new JDBCResultSet(null, result, result.metaData); - } - - /** - * Retrieves a result set holding the elements of the subarray that - * starts at index index and contains up to - * count successive elements. - * This method uses - * the specified map for type map customizations - * unless the base type of the array does not match a user-defined - * type in map, in which case it - * uses the standard mapping. This version of the method - * getResultSet uses either the given type map or the standard mapping; - * it never uses the type map associated with the connection. - *

    - * The result set has one row for each element of the SQL array - * designated by this object, with the first row containing the - * element at index index. The result set has - * up to count rows in ascending order based on the - * indices. Each row has two columns: The second column stores - * the element value; the first column stores the index into the - * array for that element. - * - * @param index the array index of the first element to retrieve; - * the first element is at index 1 - * @param count the number of successive SQL array elements to retrieve - * @param map the Map object that contains the mapping - * of SQL type names to classes in the Java(tm) programming language - * @return a ResultSet object containing up to - * count consecutive elements of the SQL array - * designated by this Array object, starting at - * index index. - * @exception SQLException if an error occurs while attempting to - * access the array - * @since JDK 1.2 - */ - public ResultSet getResultSet(long index, int count, - java.util.Map> map) throws SQLException { - return getResultSet(index, count); - } - - /** - * Returns a string representation in the form ARRAY[..., ...] - */ - public String toString() { - - if (arrayType == null) { - arrayType = Type.getDefaultArrayType(elementType.typeCode); - } - - return arrayType.convertToString(data); - } - - /** - * This method frees the Array object and releases the resources that - * it holds. The object is invalid once the free - * method is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - *

    - * - * @throws SQLException if an error occurs releasing - * the Array's resources - * @since JDK 1.6 - */ - public void free() throws SQLException { - - // - } - - //------------- - Type arrayType; - Type elementType; - Object[] data; - - /** - * Public constructor to create an Array object from an Object[] and an - * HSQLDB org.hsqldb.types.Type object. - * - * @param data the Object[] - * @param type the HSQLDB org.hsqldb.types.Type object - */ - public JDBCArrayBasic(Object[] data, Type type) { - this.data = data; - this.elementType = type; - } - - Object[] getArrayInternal() { - return data; - } - - private Result newColumnResult(long position, - int count) throws SQLException { - - if (!JDBCClobClient.isInLimits(data.length, position, count)) { - throw JDBCUtil.outOfRangeArgument(); - } - - Type[] types = new Type[2]; - - types[0] = Type.SQL_INTEGER; - types[1] = elementType; - - ResultMetaData meta = ResultMetaData.newSimpleResultMetaData(types); - - meta.columnLabels = new String[] { - "C1", "C2" - }; - meta.colIndexes = new int[] { - -1, -1 - }; - meta.columns = new ColumnBase[2]; - - for (int i = 0; i < meta.columns.length; i++) { - ColumnBase column = new ColumnBase("", "", "", ""); - - column.setType(types[i]); - - meta.columns[i] = column; - } - - RowSetNavigatorClient navigator = new RowSetNavigatorClient(); - - for (int i = (int) position; i < position + count; i++) { - Object[] rowData = new Object[2]; - - rowData[0] = Integer.valueOf(i + 1); - rowData[1] = data[i]; - - navigator.add(rowData); - } - - Result result = Result.newDataResult(meta); - - result.setNavigator(navigator); - - return result; - } - - private void checkClosed() throws SQLException { - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlob.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlob.java deleted file mode 100644 index a333f559..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlob.java +++ /dev/null @@ -1,793 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; - -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.KMPSearchAlgorithm; -import org.hsqldb.lib.java.JavaSystem; - -// campbell-burnet@users 2004-04-xx - patch 1.7.2 - position and truncate methods -// implemented; minor changes for moderate thread -// safety and optimal performance -// campbell-burnet@users 2004-04-xx - doc 1.7.2 - javadocs updated; methods put in -// correct (historical, interface declared) order -// campbell-burnet@users 2005-12-07 - patch 1.8.0.x - initial JDBC 4.0 support work -// campbell-burnet@users 2006-05-22 - doc 1.9.0 - full synch up to Mustang Build 84 -// - patch 1.9.0 - setBinaryStream improvement -// patch 1.9.0 -// - fixed invalid reference to new BinaryStream(...) in getBinaryStream -// -// patch 1.9.0 - full synch up to Mustang b90 -// - better bounds checking -// - added support for clients to decide whether getBinaryStream -// uses copy of internal byte buffer - -/** - * The representation (mapping) in - * the Java™ programming language of an SQL - * BLOB value. An SQL BLOB is a built-in type - * that stores a Binary Large Object as a column value in a row of - * a database table. By default drivers implement Blob using - * an SQL locator(BLOB), which means that a - * Blob object contains a logical pointer to the - * SQL BLOB data rather than the data itself. - * A Blob object is valid for the duration of the - * transaction in which it was created. - * - *

    Methods in the interfaces {@link java.sql.ResultSet}, - * {@link java.sql.CallableStatement}, and {@link java.sql.PreparedStatement}, such as - * getBlob and setBlob allow a programmer to - * access an SQL BLOB value. - * The Blob interface provides methods for getting the - * length of an SQL BLOB (Binary Large Object) value, - * for materializing a BLOB value on the client, and for - * determining the position of a pattern of bytes within a - * BLOB value. In addition, this interface has methods for updating - * a BLOB value. - *

    - * All methods on the Blob interface must be fully implemented if the - * JDBC driver supports the data type. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Previous to 2.0, the HSQLDB driver did not implement Blob using an SQL - * locator(BLOB). That is, an HSQLDB Blob object did not contain a logical - * pointer to SQL BLOB data; rather it directly contained a representation of - * the data (a byte array). As a result, an HSQLDB Blob object was itself - * valid beyond the duration of the transaction in which is was created, - * although it did not necessarily represent a corresponding value - * on the database. Also, the interface methods for updating a BLOB value - * were unsupported, with the exception of the truncate method, - * in that it could be used to truncate the local value.

    - * - * Starting with 2.0, the HSQLDB driver fully supports both local and remote - * SQL BLOB data implementations, meaning that an HSQLDB Blob object may - * contain a logical pointer to remote SQL BLOB data (see {@link JDBCBlobClient - * JDBCBlobClient}) or it may directly contain a local representation of the - * data (as implemented in this class). In particular, when the product is built - * under JDK 1.6+ and the Blob instance is constructed as a result of calling - * JDBCConnection.createBlob(), then the resulting Blob instance is initially - * disconnected (is not bound to the transaction scope of the vending Connection - * object), the data is contained directly and all interface methods for - * updating the BLOB value are supported for local use until the first - * invocation of free(); otherwise, an HSQLDB Blob's implementation is - * determined at runtime by the driver, it is typically not valid beyond the - * duration of the transaction in which is was created, and there no - * standard way to query whether it represents a local or remote - * value.

    - * - *

    - * - * - * @author james house (jhouse@part.net) - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.4.0 - * @since JDK 1.2, HSQLDB 1.7.2 - */ -public class JDBCBlob implements Blob { - - /** - * Returns the number of bytes in the BLOB value - * designated by this Blob object. - * @return length of the BLOB in bytes - * @exception SQLException if there is an error accessing the - * length of the BLOB - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public long length() throws SQLException { - return getData().length; - } - - /** - * Retrieves all or part of the BLOB - * value that this Blob object represents, as an array of - * bytes. This byte array contains up to length - * consecutive bytes starting at position pos. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The official specification above is ambiguous in that it does not - * precisely indicate the policy to be observed when - * {@code pos > this.length() - length}. One policy would be to retrieve the - * octets from pos to this.length(). Another would be to throw an - * exception. HSQLDB observes the second policy. - *

    - * - * - * @param pos the ordinal position of the first byte in the - * BLOB value to be extracted; the first byte is at - * position 1 - * @param length the number of consecutive bytes to be copied; JDBC 4.1[the value - * for length must be 0 or greater] - * @return a byte array containing up to length - * consecutive bytes from the BLOB value designated - * by this Blob object, starting with the - * byte at position pos - * @exception SQLException if there is an error accessing the - * BLOB value; if pos is less than 1 or length is - * less than 0 - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setBytes - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public byte[] getBytes(long pos, final int length) throws SQLException { - - final byte[] data = getData(); - final int dlen = data.length; - - if (pos < MIN_POS || pos - MIN_POS > dlen) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - final int index = (int) pos - 1; - - if (length < 0 || length > dlen - index) { - throw JDBCUtil.outOfRangeArgument("length: " + length); - } - - final byte[] result = new byte[length]; - - System.arraycopy(data, index, result, 0, length); - - return result; - } - - /** - * Retrieves the BLOB value designated by this - * Blob instance as a stream. - * - * @return a stream containing the BLOB data - * @exception SQLException if there is an error accessing the - * BLOB value - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setBinaryStream - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public InputStream getBinaryStream() throws SQLException { - return new ByteArrayInputStream(getData()); - } - - /** - * Retrieves the byte position at which the specified byte array - * pattern begins within the BLOB - * value that this Blob object represents. The - * search for pattern begins at position - * start. - * - * @param pattern the byte array for which to search - * @param start the position at which to begin searching; the - * first position is 1 - * @return the position at which the pattern appears, else -1 - * @exception SQLException if there is an error accessing the - * BLOB or if start is less than 1 - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public long position(final byte[] pattern, - final long start) throws SQLException { - - final byte[] data = getData(); - final int dlen = data.length; - - if (start < MIN_POS) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } else if (start > dlen || pattern == null) { - return -1L; - } - - // by now, we know start <= Integer.MAX_VALUE; - final int startIndex = (int) start - 1; - final int plen = pattern.length; - - if (plen == 0 || startIndex > dlen - plen) { - return -1L; - } - - final int result = KMPSearchAlgorithm.search(data, pattern, - KMPSearchAlgorithm.computeTable(pattern), startIndex); - - return (result == -1) ? -1 - : result + 1; - } - - /** - * Retrieves the byte position in the BLOB value - * designated by this Blob object at which - * pattern begins. The search begins at position - * start. - * - * @param pattern the Blob object designating - * the BLOB value for which to search - * @param start the position in the BLOB value - * at which to begin searching; the first position is 1 - * @return the position at which the pattern begins, else -1 - * @exception SQLException if there is an error accessing the - * BLOB value or if start is less than 1 - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public long position(final Blob pattern, long start) throws SQLException { - - final byte[] data = getData(); - final int dlen = data.length; - - if (start < MIN_POS) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } else if (start > dlen || pattern == null) { - return -1L; - } - - // by now, we know start <= Integer.MAX_VALUE; - final int startIndex = (int) (start - MIN_POS); - final long plen = pattern.length(); - - if (plen == 0 || startIndex > ((long) dlen) - plen) { - return -1L; - } - - // by now, we know plen <= Integer.MAX_VALUE - final int iplen = (int) plen; - byte[] bytePattern; - - if (pattern instanceof JDBCBlob) { - bytePattern = ((JDBCBlob) pattern).data(); - } else { - bytePattern = pattern.getBytes(1L, iplen); - } - - final int result = KMPSearchAlgorithm.search(data, bytePattern, - KMPSearchAlgorithm.computeTable(bytePattern), startIndex); - - return (result == -1) ? -1 - : result + 1; - } - - // -------------------------- JDBC 3.0 ----------------------------------- - - /** - * Writes the given array of bytes to the BLOB value that - * this Blob object represents, starting at position - * pos, and returns the number of bytes written. - * The array of bytes will overwrite the existing bytes - * in the Blob object starting at the position - * pos. If the end of the Blob value is reached - * while writing the array of bytes, then the length of the Blob - * value will be increased to accommodate the extra bytes. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is supported.

    - * - * When built under JDK 1.6+ and the Blob instance is constructed as a - * result of calling JDBCConnection.createBlob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createBlob() constructs disconnected, - * initially empty Blob instances. To propagate the Blob value to a database - * in this case, it is required to supply the Blob instance to an updating - * or inserting setXXX method of a Prepared or Callable Statement, or to - * supply the Blob instance to an updateXXX method of an updatable - * ResultSet.

    - * - * Implementation Notes:

    - * - * Starting with HSQLDB 2.1, JDBCBlob no longer utilizes volatile fields - * and is effectively thread safe, but still uses local variable - * snapshot isolation.

    - * - * As such, the synchronization policy still does not strictly enforce - * serialized read/write access to the underlying data

    - * - * So, if an application may perform concurrent JDBCBlob modifications and - * the integrity of the application depends on total order Blob modification - * semantics, then such operations should be synchronized on an appropriate - * monitor.

    - * - *

    - * - * - * @param pos the position in the BLOB object at which - * to start writing; the first position is 1 - * @param bytes the array of bytes to be written to the BLOB - * value that this Blob object represents - * @return the number of bytes written - * @exception SQLException if there is an error accessing the - * BLOB value or if pos is less than 1 - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBytes - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int setBytes(long pos, byte[] bytes) throws SQLException { - return setBytes(pos, bytes, 0, bytes == null ? 0 - : bytes.length); - } - - /** - * Writes all or part of the given byte array to the - * BLOB value that this Blob object represents - * and returns the number of bytes written. - * Writing starts at position pos in the BLOB - * value; len bytes from the given byte array are written. - * The array of bytes will overwrite the existing bytes - * in the Blob object starting at the position - * pos. If the end of the Blob value is reached - * while writing the array of bytes, then the length of the Blob - * value will be increased to accommodate the extra bytes. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is supported.

    - * - * When built under JDK 1.6+ and the Blob instance is constructed as a - * result of calling JDBCConnection.createBlob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createBlob() constructs disconnected, - * initially empty Blob instances. To propagate the Blob value to a database - * in this case, it is required to supply the Blob instance to an updating - * or inserting setXXX method of a Prepared or Callable Statement, or to - * supply the Blob instance to an updateXXX method of an updatable - * ResultSet.

    - * - * Implementation Notes:

    - * - * If the value specified for pos - * is greater than the length of the BLOB value, then - * the BLOB value is extended in length to accept the - * written octets and the undefined region up to pos is - * filled with (byte)0.

    - * - * Starting with HSQLDB 2.1, JDBCBlob no longer utilizes volatile fields - * and is effectively thread safe, but still uses local variable - * snapshot isolation.

    - * - * As such, the synchronization policy still does not strictly enforce - * serialized read/write access to the underlying data

    - * - * So, if an application may perform concurrent JDBCBlob modifications and - * the integrity of the application depends on total order Blob modification - * semantics, then such operations should be synchronized on an appropriate - * monitor.

    - * - *

    - * - * - * @param pos the position in the BLOB object at which - * to start writing; the first position is 1 - * @param bytes the array of bytes to be written to this BLOB - * object - * @param offset the offset into the array bytes at which - * to start reading the bytes to be set - * @param len the number of bytes to be written to the BLOB - * value from the array of bytes bytes - * @return the number of bytes written - * @exception SQLException if there is an error accessing the - * BLOB value or if pos is less than 1 - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBytes - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int setBytes(long pos, byte[] bytes, int offset, - int len) throws SQLException { - - checkReadonly(); - - if (bytes == null) { - throw JDBCUtil.nullArgument("bytes"); - } - - if (offset < 0 || offset > bytes.length) { - throw JDBCUtil.outOfRangeArgument("offset: " + offset); - } - - if (len > bytes.length - offset) { - throw JDBCUtil.outOfRangeArgument("len: " + len); - } - - if (pos < MIN_POS || (pos - MIN_POS) > (Integer.MAX_VALUE - len)) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - final int index = (int) (pos - MIN_POS); - byte[] data = getData(); - final int dlen = data.length; - - if (index > dlen - len) { - byte[] temp = new byte[index + len]; - - System.arraycopy(data, 0, temp, 0, dlen); - - data = temp; - temp = null; - } - - System.arraycopy(bytes, offset, data, index, len); - setData(data); - - return len; - } - - /** - * Retrieves a stream that can be used to write to the BLOB - * value that this Blob object represents. The stream begins - * at position pos. - * The bytes written to the stream will overwrite the existing bytes - * in the Blob object starting at the position - * pos. If the end of the Blob value is reached - * while writing to the stream, then the length of the Blob - * value will be increased to accommodate the extra bytes. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is supported.

    - * - * When built under JDK 1.6+ and the Blob instance is constructed as a - * result of calling JDBCConnection.createBlob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createBlob() constructs disconnected, - * initially empty Blob instances. To propagate the Blob value to a database - * in this case, it is required to supply the Blob instance to an updating - * or inserting setXXX method of a Prepared or Callable Statement, or to - * supply the Blob instance to an updateXXX method of an updatable - * ResultSet.

    - * - * Implementation Notes:

    - * - * The data written to the stream does not appear in this - * Blob until the stream is closed

    - * - * When the stream is closed, if the value specified for pos - * is greater than the length of the BLOB value, then - * the BLOB value is extended in length to accept the - * written octets and the undefined region up to pos is - * filled with (byte)0.

    - * - * Starting with HSQLDB 2.1, JDBCBlob no longer utilizes volatile fields - * and is effectively thread safe, but still uses local variable - * snapshot isolation.

    - * - * As such, the synchronization policy still does not strictly enforce - * serialized read/write access to the underlying data

    - * - * So, if an application may perform concurrent JDBCBlob modifications and - * the integrity of the application depends on total order Blob modification - * semantics, then such operations should be synchronized on an appropriate - * monitor.

    - * - *

    - * - * - * @param pos the position in the BLOB value at which - * to start writing; the first position is 1 - * @return a java.io.OutputStream object to which data can - * be written - * @exception SQLException if there is an error accessing the - * BLOB value or if pos is less than 1 - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBinaryStream - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public OutputStream setBinaryStream(final long pos) throws SQLException { - - checkReadonly(); - - if (pos < MIN_POS || pos > MAX_POS) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - checkClosed(); - - return new java.io.ByteArrayOutputStream() { - - private boolean closed; - - public synchronized void close() throws java.io.IOException { - - if (closed) { - return; - } - - closed = true; - - byte[] bytes = super.buf; - int length = super.count; - - super.buf = NO_BYTES; - super.count = 0; - - try { - JDBCBlob.this.setBytes(pos, bytes, 0, length); - } catch (SQLException se) { - throw JavaSystem.toIOException(se); - } finally { - super.close(); - } - } - }; - } - - /** - * Truncates the BLOB value that this Blob - * object represents to be len bytes in length. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is fully supported.

    - * - * When built under JDK 1.6+ and the Blob instance is constructed as a - * result of calling JDBCConnection.createBlob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createBlob() constructs disconnected, - * initially empty Blob instances. To propagate the truncated Blob value to - * a database in this case, it is required to supply the Blob instance to - * an updating or inserting setXXX method of a Prepared or Callable - * Statement, or to supply the Blob instance to an updateXXX method of an - * updateable ResultSet.

    - * - *

    - * - * - * @param len the length, in bytes, to which the BLOB value - * that this Blob object represents should be truncated - * @exception SQLException if there is an error accessing the - * BLOB value or if len is less than 0 - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public void truncate(final long len) throws SQLException { - - checkReadonly(); - - final byte[] data = getData(); - - if (len < 0 || len > data.length) { - throw JDBCUtil.outOfRangeArgument("len: " + len); - } else if (len == data.length) { - return; - } - - byte[] newData = new byte[(int) len]; - - System.arraycopy(data, 0, newData, 0, (int) len); - setData(newData); - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * This method frees the Blob object and releases the resources that - * it holds. The object is invalid once the free - * method is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - *

    - * - * @throws SQLException if an error occurs releasing - * the Blob's resources - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void free() throws SQLException { - m_closed = true; - m_data = null; - } - - /** - * Returns an InputStream object that contains a partial Blob value, - * starting with the byte specified by pos, which is length bytes in length. - * - * @param pos the offset to the first byte of the partial value to be retrieved. - * The first byte in the Blob is at position 1 - * @param length the length in bytes of the partial value to be retrieved - * @return InputStream through which the partial Blob value can be read. - * @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes - * in the Blob or if pos + length is greater than the number of bytes - * in the Blob - * - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public InputStream getBinaryStream(long pos, - long length) throws SQLException { - - final byte[] data = getData(); - final int dlen = data.length; - - if (pos < MIN_POS || pos > dlen) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - int index = (int) (pos - MIN_POS); - - if (length < 0 || length > dlen - index) { - throw JDBCUtil.outOfRangeArgument("length: " + length); - } - - if (index == 0 && length == dlen) { - return new ByteArrayInputStream(data); - } - - final int ilength = (int) length; - final byte[] result = new byte[ilength]; - - System.arraycopy(data, index, result, 0, ilength); - - return new ByteArrayInputStream(result); - } - - // ---------------------- internal implementation -------------------------- - private static final long MIN_POS = 1L; - private static final long MAX_POS = MIN_POS + (long) Integer.MAX_VALUE; - private static final byte[] NO_BYTES = new byte[0]; - private boolean m_closed; - private byte[] m_data; - private final boolean m_createdByConnection; - - /** - * Constructs a new JDBCBlob instance wrapping the given octet sequence.

    - * - * This constructor is used internally to retrieve result set values as - * Blob objects, yet it must be public to allow access from other packages. - * As such (in the interest of efficiency) this object maintains a reference - * to the given octet sequence rather than making a copy; special care - * should be taken by external clients never to use this constructor with a - * byte array object that may later be modified externally. - * - * @param data the octet sequence representing the Blob value - * @throws SQLException if the argument is null - */ - public JDBCBlob(final byte[] data) throws SQLException { - - if (data == null) { - throw JDBCUtil.nullArgument("data"); - } - - m_data = data; - m_createdByConnection = false; - } - - protected JDBCBlob() { - m_data = new byte[0]; - m_createdByConnection = true; - } - - protected void checkReadonly() throws SQLException { - - if (!m_createdByConnection) { - throw JDBCUtil.sqlException(ErrorCode.X_25006, - "Blob is read-only"); - } - } - - protected synchronized void checkClosed() throws SQLException { - - if (m_closed) { - throw JDBCUtil.sqlException(ErrorCode.X_07501); - } - } - - protected byte[] data() throws SQLException { - return getData(); - } - - //@SuppressWarnings("ReturnOfCollectionOrArrayField") - private synchronized byte[] getData() throws SQLException { - - checkClosed(); - - return m_data; - } - - //@SuppressWarnings("AssignmentToCollectionOrArrayFieldFromParameter") - private synchronized void setData(byte[] data) throws SQLException { - - checkClosed(); - - m_data = data; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlobClient.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlobClient.java deleted file mode 100644 index 0b90f084..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlobClient.java +++ /dev/null @@ -1,412 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.SQLException; - -import org.hsqldb.HsqlException; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.types.BlobDataID; -import org.hsqldb.types.BlobInputStream; - -/** - * A wrapper for HSQLDB BlobData objects. - * - * Instances of this class are returned by calls to ResultSet methods. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.0 - * @since 1.9.0 - */ -public class JDBCBlobClient implements Blob { - - /** - * Returns the number of bytes in the BLOB value designated - * by this Blob object. - * - * @return length of the BLOB in bytes - * @throws SQLException if there is an error accessing the length of the - * BLOB - */ - public synchronized long length() throws SQLException { - - checkClosed(); - - try { - return blob.length(session); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves all or part of the BLOB value that this - * Blob object represents, as an array of bytes. - * - * @param pos the ordinal position of the first byte in the - * BLOB value to be extracted; the first byte is at - * position 1 - * @param length the number of consecutive bytes to be copied - * @return a byte array containing up to length consecutive - * bytes from the BLOB value designated by this - * Blob object, starting with the byte at position - * pos - * @throws SQLException if there is an error accessing the - * BLOB value - */ - public synchronized byte[] getBytes(long pos, - int length) throws SQLException { - - checkClosed(); - - if (!isInLimits(Long.MAX_VALUE, pos - 1, length)) { - throw JDBCUtil.outOfRangeArgument(); - } - - try { - return blob.getBytes(session, pos - 1, length); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves the BLOB value designated by this - * Blob instance as a stream. - * - * @return a stream containing the BLOB data - * @throws SQLException if there is an error accessing the - * BLOB value - */ - public synchronized InputStream getBinaryStream() throws SQLException { - - checkClosed(); - - return new BlobInputStream(session, blob, 0, length()); - } - - /** - * Retrieves the byte position at which the specified byte array - * pattern begins within the BLOB value that - * this Blob object represents. - * - * @param pattern the byte array for which to search - * @param start the position at which to begin searching; the first - * position is 1 - * @return the position at which the pattern appears, else -1 - * @throws SQLException if there is an error accessing the - * BLOB - */ - public synchronized long position(byte[] pattern, - long start) throws SQLException { - - checkClosed(); - - if (!isInLimits(Long.MAX_VALUE, start - 1, 0)) { - throw JDBCUtil.outOfRangeArgument(); - } - - try { - long position = blob.position(session, pattern, start - 1); - - if (position >= 0) { - position++; - } - - return position; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves the byte position in the BLOB value designated - * by this Blob object at which pattern begins. - * - * @param pattern the Blob object designating the - * BLOB value for which to search - * @param start the position in the BLOB value at which to - * begin searching; the first position is 1 - * @return the position at which the pattern begins, else -1 - * @throws SQLException if there is an error accessing the - * BLOB value - */ - public synchronized long position(Blob pattern, - long start) throws SQLException { - - checkClosed(); - - if (!isInLimits(Long.MAX_VALUE, start - 1, 0)) { - throw JDBCUtil.outOfRangeArgument(); - } - - if (pattern instanceof JDBCBlobClient) { - BlobDataID searchClob = ((JDBCBlobClient) pattern).blob; - - try { - long position = blob.position(session, searchClob, start - 1); - - if (position >= 0) { - position++; - } - - return position; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - if (!isInLimits(Integer.MAX_VALUE, 0, pattern.length())) { - throw JDBCUtil.outOfRangeArgument(); - } - - byte[] bytePattern = pattern.getBytes(1, (int) pattern.length()); - - return position(bytePattern, start); - } - - /** - * Writes the given array of bytes to the BLOB value that - * this Blob object represents, starting at position - * pos, and returns the number of bytes written. - * - * @param pos the position in the BLOB object at which to - * start writing - * @param bytes the array of bytes to be written to the - * BLOB value that this Blob object - * represents - * @return the number of bytes written - * @throws SQLException if there is an error accessing the - * BLOB value - */ - public synchronized int setBytes(long pos, - byte[] bytes) throws SQLException { - return setBytes(pos, bytes, 0, bytes.length); - } - - /** - * Writes all or part of the given byte array to the - * BLOB value that this Blob object represents - * and returns the number of bytes written. - * - * @param pos the position in the BLOB object at which to - * start writing - * @param bytes the array of bytes to be written to this - * BLOB object - * @param offset the offset into the array bytes at which - * to start reading the bytes to be set - * @param len the number of bytes to be written to the BLOB - * value from the array of bytes bytes - * @return the number of bytes written - * @throws SQLException if there is an error accessing the - * BLOB value - */ - public synchronized int setBytes(long pos, byte[] bytes, int offset, - int len) throws SQLException { - - checkClosed(); - - if (!isInLimits(bytes.length, offset, len)) { - throw JDBCUtil.outOfRangeArgument(); - } - - if (!isInLimits(Long.MAX_VALUE, pos - 1, len)) { - throw JDBCUtil.outOfRangeArgument(); - } - - if (!isWritable) { - throw JDBCUtil.notUpdatableColumn(); - } - - try { - startUpdate(); - - blob.setBytes(session, pos - 1, bytes, offset, len); - - return len; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves a stream that can be used to write to the BLOB - * value that this Blob object represents. - * - * @param pos the position in the BLOB value at which to - * start writing - * @return a java.io.OutputStream object to which data can - * be written - * @throws SQLException if there is an error accessing the - * BLOB value - */ - public synchronized OutputStream setBinaryStream(long pos) - throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Truncates the BLOB value that this Blob - * object represents to be len bytes in length. - * - * @param len the length, in bytes, to which the BLOB value - * that this Blob object represents should be truncated - * @throws SQLException if there is an error accessing the - * BLOB value - */ - public synchronized void truncate(long len) throws SQLException { - - checkClosed(); - - if (!isInLimits(Long.MAX_VALUE, 0, len)) { - throw JDBCUtil.outOfRangeArgument(); - } - - try { - blob.truncate(session, len); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * This method frees the Blob object and releases the resources that - * it holds. The object is invalid once the free - * method is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - *

    - * - * @throws SQLException if an error occurs releasing - * the Blob's resources - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void free() throws SQLException { - isClosed = true; - } - - /** - * Returns an InputStream object that contains a partial Blob value, - * starting with the byte specified by pos, which is length bytes in length. - * - * @param pos the offset to the first byte of the partial value to be retrieved. - * The first byte in the Blob is at position 1 - * @param length the length in bytes of the partial value to be retrieved - * @return InputStream through which the partial Blob value can be read. - * @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes - * in the Blob or if pos + length is greater than the number of bytes - * in the Blob - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized InputStream getBinaryStream(long pos, - long length) throws SQLException { - - checkClosed(); - - if (!isInLimits(this.length(), pos - 1, length)) { - throw JDBCUtil.outOfRangeArgument(); - } - - return new BlobInputStream(session, blob, pos - 1, length); - } - - //-- - BlobDataID originalBlob; - BlobDataID blob; - SessionInterface session; - int colIndex; - private boolean isClosed; - private boolean isWritable; - JDBCResultSet resultSet; - - public JDBCBlobClient(SessionInterface session, BlobDataID blob) { - this.session = session; - this.blob = blob; - } - - public boolean isClosed() { - return isClosed; - } - - public BlobDataID getBlob() { - return blob; - } - - public synchronized void setWritable(JDBCResultSet result, int index) { - - isWritable = true; - resultSet = result; - colIndex = index; - } - - public synchronized void clearUpdates() { - - if (originalBlob != null) { - blob = originalBlob; - originalBlob = null; - } - } - - private void startUpdate() throws SQLException { - - if (originalBlob != null) { - return; - } - - originalBlob = blob; - blob = (BlobDataID) blob.duplicate(session); - - resultSet.startUpdate(colIndex + 1); - - resultSet.preparedStatement.parameterValues[colIndex] = blob; - resultSet.preparedStatement.parameterSet[colIndex] = true; - } - - private void checkClosed() throws SQLException { - - if (isClosed) { - throw JDBCUtil.sqlException(ErrorCode.X_0F502); - } - } - - static boolean isInLimits(long fullLength, long pos, long len) { - return pos >= 0 && len >= 0 && pos + len <= fullLength; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlobFile.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlobFile.java deleted file mode 100644 index 27668e83..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCBlobFile.java +++ /dev/null @@ -1,1032 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.RandomAccessFile; -import java.io.Reader; -import java.io.Writer; -import java.sql.Blob; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.CountdownInputStream; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.lib.FrameworkLogger; -import org.hsqldb.lib.InOutUtil; -import org.hsqldb.lib.KMPSearchAlgorithm; - -/** - * A client-side file-based implementation of Blob. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.1, in addition to HSQLDB driver support for both client-side - * in-memory and remote SQL CLOB data implementations, this class is provided - * to expose efficient, relatively high-performance BLOB operations over client - * accessible files.

    - * - * Design Notes

    - * - * Although it is possible to implement a transactional version of this class, - * the present implementation directly propagates changes to the underlying - * file such that changes become visible as soon as they are either - * implicitly or explicitly flushed to disk. - *

    - * - *

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.1 - * @since HSQLDB 2.1 - */ -public class JDBCBlobFile implements java.sql.Blob { - private static final FrameworkLogger LOG = FrameworkLogger.getLog( - JDBCBlobFile.class); - - /** - * Returns the number of bytes in the BLOB value - * designated by this Blob object. - * @return length of the BLOB in bytes - * @exception SQLException if there is an error accessing the - * length of the BLOB - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public long length() throws SQLException { - - checkClosed(); - - try { - return m_file.length(); - } catch (SecurityException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves all or part of the BLOB - * value that this Blob object represents, as an array of - * bytes. This byte array contains up to length - * consecutive bytes starting at position pos. - * - * @param pos the ordinal position of the first byte in the - * BLOB value to be extracted; the first byte is at - * position 1 - * @param length the number of consecutive bytes to be copied; the value - * for length must be 0 or greater - * @return a byte array containing up to length - * consecutive bytes from the BLOB value designated - * by this Blob object, starting with the - * byte at position pos - * @exception SQLException if there is an error accessing the - * BLOB value; if pos is less than 1 or length is - * less than 0 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setBytes - * @since JDK 1.2 - */ - public byte[] getBytes(final long pos, - final int length) throws SQLException { - - InputStream is = null; - ByteArrayOutputStream baos = null; - final int initialBufferSize = - Math.min(InOutUtil.DEFAULT_COPY_BUFFER_SIZE, length); - - try { - is = getBinaryStream(pos, length); - baos = new ByteArrayOutputStream(initialBufferSize); - - InOutUtil.copy(is, baos, length); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(is); - } - - return baos.toByteArray(); - } - - /** - * Retrieves the BLOB value designated by this - * Blob instance as a stream. - * - * @return a stream containing the BLOB data - * @exception SQLException if there is an error accessing the - * BLOB value - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setBinaryStream - * @since JDK 1.2 - */ - public InputStream getBinaryStream() throws SQLException { - return getBinaryStream(1, Long.MAX_VALUE); - } - - /** - * Retrieves the byte position at which the specified byte array - * pattern begins within the BLOB - * value that this Blob object represents. The - * search for pattern begins at position - * start. - * - * @param pattern the byte array for which to search - * @param start the position at which to begin searching; the - * first position is 1 - * @return the position at which the pattern appears, else -1 - * @exception SQLException if there is an error accessing the - * BLOB or if start is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public long position(final byte[] pattern, - final long start) throws SQLException { - - if (start < 1) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } else if (pattern == null || pattern.length == 0) { - return -1L; - } - - final long length = this.length(); - - if (start > length || pattern.length > length || start > length - - pattern.length) { - return -1; - } - - return position0(pattern, start); - } - - private long position0(final byte[] pattern, final long start) throws - SQLException { - InputStream is = null; - - try { - is = getBinaryStream(start, Long.MAX_VALUE); - - //@todo maybe single-byte encoding reader - // and java.util.Scanner.findWithinHorizon. - // Need to do comparative benchmark and unit - // tests first. - final long matchOffset = KMPSearchAlgorithm.search(is, pattern, - KMPSearchAlgorithm.computeTable(pattern)); - - return (matchOffset == -1) ? -1 - : start + matchOffset; - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(is); - } - } - - /** - * Retrieves the byte position in the BLOB value - * designated by this Blob object at which - * pattern begins. The search begins at position - * start. - * - * @param pattern the Blob object designating - * the BLOB value for which to search - * @param start the position in the BLOB value - * at which to begin searching; the first position is 1 - * @return the position at which the pattern begins, else -1 - * @exception SQLException if there is an error accessing the - * BLOB value or if start is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public long position(final Blob pattern, - final long start) throws SQLException { - - if (start < 1) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } - - if (pattern == null) { - return -1; - } - - final long patternLength = pattern.length(); - - if (patternLength == 0) { - return -1; - } else if (patternLength > Integer.MAX_VALUE) { - throw JDBCUtil.outOfRangeArgument("pattern.length(): " - + patternLength); - } - - final long length = this.length(); - - if (start > length || patternLength > length || start > length - - patternLength) { - return -1; - } - - final byte[] bytePattern = (pattern instanceof JDBCBlob) - ? ((JDBCBlob) pattern).data() - : pattern.getBytes(1L, (int) patternLength); - - return position0(bytePattern, start); - } - - // -------------------------- JDBC 3.0 ----------------------------------- - - /** - * Writes the given array of bytes to the BLOB value that - * this Blob object represents, starting at position - * pos, and returns the number of bytes written. - * The array of bytes will overwrite the existing bytes - * in the Blob object starting at the position - * pos. If the end of the Blob value is reached - * while writing the array of bytes, then the length of the Blob - * value will be increased to accommodate the extra bytes. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This operation affects only the content of the underlying file; it has no - * effect upon a value stored in a database. To propagate the updated - * Blob value to a database, it is required to supply the Blob instance to - * an updating or inserting setXXX method of a Prepared or Callable - * Statement, or to supply the Blob instance to an updateXXX method of an - * updatable ResultSet.

    - * - *

    - * - * - * @param pos the position in the BLOB object at which - * to start writing; the first position is 1 - * @param bytes the array of bytes to be written to the BLOB - * value that this Blob object represents - * @return the number of bytes written - * @exception SQLException if there is an error accessing the - * BLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBytes - * @since JDK 1.4 - */ - public int setBytes(final long pos, - final byte[] bytes) throws SQLException { - return setBytes(pos, bytes, 0, bytes == null ? 0 - : bytes.length); - } - - /** - * Writes all or part of the given byte array to the - * BLOB value that this Blob object represents - * and returns the number of bytes written. - * Writing starts at position pos in the BLOB - * value; len bytes from the given byte array are written. - * The array of bytes will overwrite the existing bytes - * in the Blob object starting at the position - * pos. If the end of the Blob value is reached - * while writing the array of bytes, then the length of the Blob - * value will be increased to accommodate the extra bytes. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This operation affects only the content of the underlying file; it has no - * effect upon a value stored in a database. To propagate the updated - * Blob value to a database, it is required to supply the Blob instance to - * an updating or inserting setXXX method of a Prepared or Callable - * Statement, or to supply the Blob instance to an updateXXX method of an - * updatable ResultSet.

    - * - *

    - * - * - * @param pos the position in the BLOB object at which - * to start writing; the first position is 1 - * @param bytes the array of bytes to be written to this BLOB - * object - * @param offset the offset into the array bytes at which - * to start reading the bytes to be set - * @param len the number of bytes to be written to the BLOB - * value from the array of bytes bytes - * @return the number of bytes written - * @exception SQLException if there is an error accessing the - * BLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBytes - * @since JDK 1.4 - */ - public int setBytes(final long pos, final byte[] bytes, final int offset, - final int len) throws SQLException { - - if (bytes == null) { - throw JDBCUtil.nullArgument("bytes"); - } - - final OutputStream os = setBinaryStream(pos); - - try { - os.write(bytes, offset, len); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(os); - } - - return len; - } - - /** - * Retrieves a stream that can be used to write to the BLOB - * value that this Blob object represents. The stream begins - * at position pos. - * The bytes written to the stream will overwrite the existing bytes - * in the Blob object starting at the position - * pos. If the end of the Blob value is reached - * while writing to the stream, then the length of the Blob - * value will be increased to accommodate the extra bytes. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Data written to the returned stream affects only the content of the - * underlying file; it has no effect upon a value stored in a database. - * To propagate the updated Blob value to a database, it is required to - * supply the Blob instance to an updating or inserting setXXX method of a - * Prepared or Callable Statement, or to supply the Blob instance to an - * updateXXX method of an updateable ResultSet.

    - * - *

    - * - * - * @param pos the position in the BLOB value at which - * to start writing; the first position is 1 - * @return a java.io.OutputStream object to which data can - * be written - * @exception SQLException if there is an error accessing the - * BLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBinaryStream - * @since JDK 1.4 - */ - public OutputStream setBinaryStream(final long pos) throws SQLException { - - if (pos < 1) { - throw JDBCUtil.invalidArgument("pos: " + pos); - } - - checkClosed(); - createFile(); - - OutputStream adapter; - - try { - adapter = new OutputStreamAdapter(m_file, pos - 1) { - private boolean closed; - public synchronized void close() throws IOException { - if (closed) { - return; - } - closed = true; - try { - super.close(); - } finally { - m_streams.remove(this); - } - } - }; - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IllegalArgumentException ex) { - throw JDBCUtil.sqlException(ex); - } catch (SecurityException ex) { - throw JDBCUtil.sqlException(ex); - } - - m_streams.add(adapter); - - final OutputStream result = new BufferedOutputStream(adapter); - - return result; - } - - /** - * Truncates the BLOB value that this Blob - * object represents to be len bytes in length. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the BLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This operation affects only the length of the underlying file; it has no - * effect upon a value stored in a database. To propagate the truncated - * Blob value to a database, it is required to supply the Blob instance to - * an updating or inserting setXXX method of a Prepared or Callable - * Statement, or to supply the Blob instance to an updateXXX method of an - * updatable ResultSet.

    - * - *

    - * - * - * @param len the length, in bytes, to which the BLOB value - * that this Blob object represents should be truncated - * @exception SQLException if there is an error accessing the - * BLOB value or if len is less than 0 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4 - */ - public void truncate(long len) throws SQLException { - - if (len < 0) { - throw JDBCUtil.invalidArgument("len: " + len); - } - - checkClosed(); - - RandomAccessFile randomAccessFile = null; - - try { - randomAccessFile = new RandomAccessFile(m_file, "rw"); - - randomAccessFile.setLength(len); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IllegalArgumentException ex) { - throw JDBCUtil.sqlException(ex); - } catch (SecurityException ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(randomAccessFile); - } - } - - /** - * This method frees the Blob object and releases the resources that - * it holds. The object is invalid once the free - * method is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This operation closes any input and/or output streams obtained - * via {@link #getBinaryStream()}, {@link #getBinaryStream(long, long)} or - * {@link #setBinaryStream(long)}.

    - * - * Additionally, if the property {@link #isDeleteOnFree()} is true, then - * an attempt is made to delete the backing file. - * - *

    - * - * - * @throws SQLException if an error occurs releasing - * the Blob's resources - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setDeleteOnFree(boolean) - * @see #isDeleteOnFree() - * @since JDK 1.6 - */ - public synchronized void free() throws SQLException { - - if (m_closed) { - return; - } - - m_closed = true; - - final List streams = new ArrayList(m_streams); - - m_streams = null; - - for (Iterator itr = streams.iterator(); itr.hasNext(); ) { - final Object stream = itr.next(); - - closeSafely(stream); - } - - if (m_deleteOnFree) { - try { - m_file.delete(); - } catch (SecurityException e) {} - } - } - - /** - * Returns an InputStream object that contains a partial Blob value, - * starting with the byte specified by pos, which is length bytes in length. - * - * @param pos the offset to the first byte of the partial value to be retrieved. - * The first byte in the Blob is at position 1 - * @param length the length in bytes of the partial value to be retrieved - * @return InputStream through which the partial Blob value can be read. - * @throws SQLException if pos is less than 1 or if pos is greater than the number of bytes - * in the Blob or if pos + length is greater than the number of bytes - * in the Blob - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 - */ - public InputStream getBinaryStream(final long pos, - final long length) throws SQLException { - - if (pos < 1) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - checkClosed(); - - InputStream result; - - final List streams = m_streams; - - try { - result = new InputStreamAdapter(m_file, pos - 1, length) { - private boolean closed; - private final InputStream self = this; - - public void close() throws IOException { - if (closed) { - return; - } - closed = true; - try { - super.close(); - } finally { - streams.remove(self); - } - } - }; - } catch (Exception ex) { - throw JDBCUtil.sqlException(ex); - } - - streams.add(result); - - return result; - } - - /** - * Retrieves the canonical File object denoting the file that - * backs this BLOB. - * - * @return the file that backs this BLOB. - */ - public File getFile() { - return m_file; - } - - /** - * Retrieves whether an attempt to delete the backing file - * is made in response to invocation of {@link #free()}. - * - * @return true if backing file deletion is attempted; otherwise false. - */ - public boolean isDeleteOnFree() { - return m_deleteOnFree; - } - - /** - * Assigns whether an attempt to delete the backing file - * is made in response to invocation of {@link #free()}. - * - * @param deleteOnFree the new value to assign - */ - public void setDeleteOnFree(boolean deleteOnFree) { - m_deleteOnFree = deleteOnFree; - } - - //-------------------------------------------------------------------------- - // Internal Implementation - //-------------------------------------------------------------------------- - public static final String TEMP_FILE_PREFIX = "hsql_jdbc_blob_file_"; - public static final String TEMP_FILE_SUFFIX = ".tmp"; - - // - private final File m_file; - private boolean m_closed; - private boolean m_deleteOnFree; - private List m_streams = new ArrayList(); - - - /** - * Convenience constructor; equivalent to JDBCBlobFile(true); - * - * @throws SQLException If a file could not be created or if a security - * manager exists and its {@link - * java.lang.SecurityManager#checkWrite(java.lang.String)} - * method does not allow a file to be created. - */ - public JDBCBlobFile() throws SQLException { - this(true); - } - - /** - * Constructs a new instance backed by a File object created in response - * to invoking File.createTempFile(TEMP_FILE_PREFIX,TEMP_FILE_SUFFIX)

    - * - * @param deleteOnFree Assigns whether an attempt to delete the backing file - * is to be made in response to invocation of {@link #free()}. - * - * @throws SQLException If a file could not be created or if a security - * manager exists and its {@link - * java.lang.SecurityManager#checkWrite(java.lang.String)} - * method does not allow a file to be created. - */ - public JDBCBlobFile(boolean deleteOnFree) throws SQLException { - - m_deleteOnFree = deleteOnFree; - - try { - m_file = File.createTempFile(TEMP_FILE_PREFIX, - TEMP_FILE_SUFFIX).getCanonicalFile(); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } - } - - /** - * Convenience constructor; equivalent to JDBCBlobFile(file, false); - * - * @param file used to back this BLOB instance. - * @throws SQLException If an I/O error occurs, which is possible because - * the construction of the canonical pathname may require file system - * queries; if a required system property value cannot be accessed, - * or if a security manager exists and its {@link - * java.lang.SecurityManager#checkRead} method denies - * read access to the file - */ - public JDBCBlobFile(final File file) throws SQLException { - this(file, false); - } - - /** - * Constructs a new instance backed by the given File object. - * - * @param file used to back this BLOB instance. - * @param deleteOnFree Assigns whether an attempt to delete the backing file - * is to be made in response to invocation of {@link #free()}. - * @throws SQLException If an I/O error occurs, which is possible because - * the construction of the canonical pathname may require file system - * queries; if a required system property value cannot be accessed, - * or if a security manager exists and its {@link - * java.lang.SecurityManager#checkRead} method denies - * read access to the file - */ - public JDBCBlobFile(final File file, - boolean deleteOnFree) throws SQLException { - - m_deleteOnFree = deleteOnFree; - - try { - m_file = file.getCanonicalFile(); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } - - checkIsFile(/*checkExists*/false); - } - - protected final void checkIsFile(boolean checkExists) throws SQLException { - - boolean exists = false; - boolean isFile = false; - - try { - exists = m_file.exists(); - } catch (Exception ex) { - throw JDBCUtil.sqlException(ex); - } - - if (exists) { - try { - isFile = m_file.isFile(); - } catch (Exception ex) { - throw JDBCUtil.sqlException(ex); - } - } - - if (exists) { - if (!isFile) { - throw JDBCUtil.invalidArgument("Is not a file: " + m_file); - } - } else if (checkExists) { - throw JDBCUtil.invalidArgument("Does not exist: " + m_file); - } - } - - private void checkClosed() throws SQLException { - - if (m_closed) { - throw JDBCUtil.sqlException(ErrorCode.X_07501); - } - } - - private void createFile() throws SQLException { - - try { - if (!m_file.exists()) { - FileUtil.getFileUtil().makeParentDirectories(m_file); - m_file.createNewFile(); - } - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } - - checkIsFile( /*checkExists*/true); - } - - // - private static void closeSafely(RandomAccessFile target) { - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(InputStream target) { - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(OutputStream target) { - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(Reader target) { - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(Writer target) { - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private void closeSafely(Object target) { - if (target instanceof RandomAccessFile) { - closeSafely((RandomAccessFile) target); - } else if (target instanceof InputStream) { - closeSafely((InputStream) target); - } else if (target instanceof OutputStream) { - closeSafely((OutputStream) target); - } else if (target instanceof Reader) { - closeSafely((Reader) target); - } else if (target instanceof Writer) { - closeSafely((Writer) target); - } - } - // - - // @todo JDK7 + can use java.nio.SeekableByteChannel instead of adapters. - - protected static class OutputStreamAdapter extends OutputStream { - - private final RandomAccessFile m_randomAccessFile; - - protected OutputStreamAdapter(final File file, - final long pos) - throws FileNotFoundException, IOException, - IllegalArgumentException, - NullPointerException, - SecurityException { - - if (pos < 0) { - throw new IllegalArgumentException("pos: " + pos); - } - - m_randomAccessFile = new RandomAccessFile(file, "rw"); - - boolean seekSucceeded = false; - - try { - m_randomAccessFile.seek(pos); - seekSucceeded = true; - } finally { - if (!seekSucceeded) { - closeSafely(m_randomAccessFile); - } - } - } - - protected OutputStreamAdapter(RandomAccessFile randomAccessFile) { - if (randomAccessFile == null) { - throw new NullPointerException(); - } - m_randomAccessFile = randomAccessFile; - } - - public void write(int b) throws IOException { - m_randomAccessFile.write(b); - } - - public void write(byte[] b) throws IOException { - m_randomAccessFile.write(b); - } - - public void write(byte[] b, int off, int len) throws IOException { - m_randomAccessFile.write(b, off, len); - } - - public void flush() throws IOException { - if (m_randomAccessFile.getFD().valid()) { - m_randomAccessFile.getFD().sync(); - } - } - - public void close() throws IOException { - m_randomAccessFile.close(); - } - } - - static class InputStreamAdapter extends InputStream { - - private final CountdownInputStream m_ciStream; - - InputStreamAdapter(final File file, final long pos, - final long length) - throws FileNotFoundException, IOException, - SecurityException, NullPointerException, - IllegalArgumentException { - - if (file == null) { - throw new NullPointerException("file"); - } - - if (pos < 0) { - throw new IllegalArgumentException("pos: " + pos); - } - - if (length < 0) { - throw new IllegalArgumentException("length: " + length); - } - - FileInputStream fis = null; - boolean success = false; - try { - fis = new FileInputStream(file); - - if (pos > 0) { - // skip is a 'native' method and is likely to - // be at least as efficient as RandomAccessFile.seek - final long actualPos = fis.skip(pos); - // Ignoring actualPos because it is 'ok' if - // pos > file.length or pos > file.length - length, since - // the client code ends up with an 'empty' stream (no data). - - } - success = true; - } finally { - if (!success) { - closeSafely(fis); - } - } - - final BufferedInputStream bis = new BufferedInputStream(fis); - final CountdownInputStream cis = new CountdownInputStream(bis); - - cis.setCount(length); - - m_ciStream = cis; - } - - public int available() throws IOException { - return m_ciStream.available(); - } - - public int read() throws IOException { - return m_ciStream.read(); - } - - public int read(byte[] b) throws IOException { - return m_ciStream.read(b); - } - - public int read(byte[] b, int off, int len) throws IOException { - return m_ciStream.read(b, off, len); - } - - public long skip(long n) throws IOException { - return m_ciStream.skip(n); - } - - public void close() throws IOException { - m_ciStream.close(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCCallableStatement.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCCallableStatement.java deleted file mode 100644 index 7e161702..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCCallableStatement.java +++ /dev/null @@ -1,5267 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Date; -import java.sql.NClob; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLXML; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Locale; -import java.util.Map; - -import org.hsqldb.HsqlException; -import org.hsqldb.SchemaObject; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.IntValueHashMap; -import org.hsqldb.result.ResultConstants; -import org.hsqldb.types.BinaryData; -import org.hsqldb.types.BlobDataID; -import org.hsqldb.types.ClobDataID; -import org.hsqldb.types.DateTimeType; -import org.hsqldb.types.IntervalMonthData; -import org.hsqldb.types.IntervalSecondData; -import org.hsqldb.types.JavaObjectData; -import org.hsqldb.types.TimeData; -import org.hsqldb.types.TimestampData; -import org.hsqldb.types.Type; -import org.hsqldb.types.Types; - -//#ifdef JAVA8 -import java.sql.JDBCType; -import java.sql.SQLType; -import java.time.Duration; -import java.time.Period; - -//#endif JAVA8 - - -/* $Id: JDBCCallableStatement.java 6656 2023-05-29 15:55:53Z fredt $ */ - -/* @todo fredt 1.9.0 - continuous review wrt multiple result sets, named parameters etc. */ - -// campbell-burnet@users patch 1.7.2 - CallableStatement impl removed -// from JDBCParameterMetaData and moved here; sundry changes elsewhere to -// comply -// TODO: 1.7.2 Alpha N :: DONE -// maybe implement set-by-parameter-name. We have an informal spec, -// being "@p1" => 1, "@p2" => 2, etc. Problems: return value is "@p0" -// and there is no support for registering the return value as an out -// parameter. -// TODO: 1.9.x :: DONE -// engine and client-side mechanisms for adding, retrieving, -// navigating (and perhaps controlling holdability of) multiple -// results generated from a single execution. -// campbell-burnet@users 2004-03/04-xx - patch 1.7.2 - some minor code cleanup -// - parameter map NPE correction -// - embedded SQL/SQLCLI client usability -// (parameter naming changed from @n to @pn) -// campbell-burnet@users 2004-04-xx - doc 1.7.2 - javadocs added/updated -// campbell-burnet@users 2005-12-07 - patch 1.8.0.x - initial JDBC 4.0 support work -// campbell-burnet@users 2006-05-22 - doc 1.9.0 - full synch up to Mustang Build 84 -// Revision 1.14 2006/07/12 11:58:49 campbell-burnet -// - full synch up to Mustang b90 - -/** - * - * - * The interface used to execute SQL stored procedures. The JDBC API - * provides a stored procedure SQL escape syntax that allows stored procedures - * to be called in a standard way for all RDBMSs. This escape syntax has one - * form that includes a result parameter and one that does not. If used, the result - * parameter must be registered as an OUT parameter. The other parameters - * can be used for input, output or both. Parameters are referred to - * sequentially, by number, with the first parameter being 1. - *

    (JDBC4 clarification:) - *

    - *   {?= call <procedure-name>[(<arg1>,<arg2>, ...)]}
    - *   {call <procedure-name>[(<arg1>,<arg2>, ...)]}
    - * 
    - *

    - * IN parameter values are set using the set methods inherited from - * {@link java.sql.PreparedStatement}. The type of all OUT parameters must be - * registered prior to executing the stored procedure; their values - * are retrieved after execution via the get methods provided here. - *

    - * A CallableStatement can return one {@link java.sql.ResultSet} object or - * multiple ResultSet objects. Multiple - * ResultSet objects are handled using operations - * inherited from {@link java.sql.Statement}. - *

    - * For maximum portability, a call's ResultSet objects and - * update counts should be processed prior to getting the values of output - * parameters. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Beyond the XOpen/ODBC extended scalar functions, stored procedures are - * typically supported in ways that vary greatly from one DBMS implementation - * to the next. So, it is almost guaranteed that the code for a stored - * procedure written under a specific DBMS product will not work without - * at least some modification in the context of another vendor's product - * or even across a single vendor's product lines. Moving stored procedures - * from one DBMS product line to another almost invariably involves complex - * porting issues and often may not be possible at all. Be warned.

    - * - * One kind of HSQLDB stored procedures and functions is SQL/JRT, Java routines - * that map directly onto the static methods of compiled Java classes found on - * the class path of the engine at runtime. The CREATE PROCEDURE or CREATE FUNCTION - * statements are used in SQL to support the Java methods.

    - * - * The other kind of HSQLDB stored procedures is SQL/PSM routines that are - * written entirely in the SQL procedural language. - * - * Overloaded methods are supported and resolved according to the type of - * parameters. - * - * With procedures, OUT and IN OUT parameters - * are also supported.

    - * - * In addition, HSQLDB stored procedure call mechanism allows the - * more general HSQLDB SQL expression evaluation mechanism. This - * extension provides the ability to evaluate simple SQL expressions, possibly - * containing Java method invocations.

    - * - * With HSQLDB, executing a CALL statement that produces an opaque - * (OTHER) or known scalar object reference has virtually the same effect as: - * - *

    - * CREATE TABLE DUAL (dummy VARCHAR);
    - * INSERT INTO DUAL VALUES(NULL);
    - * SELECT <simple-expression> FROM DUAL;
    - * 
    - * - * HSQLDB functions can return a single result set. HSQLDB procedures can - * return one or more result sets. - * - * Here is a very simple example of an HSQLDB stored procedure generating a - * user-defined result set: - * - *
    - * package mypackage;
    - *
    - * import java.sql.ResultSet;
    - * import java.sql.SQLException;
    - *
    - * class MyLibraryClass {
    - *
    - *      public static ResultSet mySp() throws SQLException {
    - *          return ctx.getConnection().createStatement().executeQuery("select * from my_table");
    - *      }
    - * }
    - *
    - * 
    - * - * (campbell-burnet@users) - *
    - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - * @see JDBCConnection#prepareCall - * @see JDBCResultSet - */ -public class JDBCCallableStatement extends JDBCPreparedStatement implements CallableStatement { - -// ----------------------------------- JDBC 1 ---------------------------------- - - /** - * - * - * Registers the OUT parameter in ordinal position - * parameterIndex to the JDBC type - * sqlType. All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by sqlType for an OUT - * parameter determines the Java type that must be used - * in the get method to read the value of that parameter. - *

    - * If the JDBC type expected to be returned to this output parameter - * is specific to this particular database, sqlType - * should be java.sql.Types.OTHER. The method - * {@link #getObject} retrieves the value. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature. This method can be called after a - * PrepareCall method. HSQLDB has already determined which parameters are - * OUT or INOUT parameters, therefore this method only checks and - * throws an exception if the parameter is not of the correct form. - * The data type argument is ignored

    - * - * The get method to read the value of the parameter is - * determined by the engine based on the data type of the parameter. - * - * Furthermore, HSQLDB supports multiple OUT and INOUT parameters for - * stored procedures.

    - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param sqlType the JDBC type code defined by java.sql.Types. - * If the parameter is of JDBC type NUMERIC - * or DECIMAL, the version of - * registerOutParameter that accepts a scale value - * should be used. - * - * @exception SQLException JDBC 4.1 [if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see java.sql.Types - */ - public synchronized void registerOutParameter(int parameterIndex, - int sqlType) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - if (parameterModes[--parameterIndex] - == SchemaObject.ParameterModes.PARAM_IN) { - throw JDBCUtil.invalidArgument(); - } - } - - public ResultSet getResultSet() throws SQLException { - if (resultIn.mode == ResultConstants.CALL_RESPONSE - && resultIn.getChainedResult() != null) { - getMoreResults(); - } - - return super.getResultSet(); - } - - /** - * - * - * Registers the parameter in ordinal position - * parameterIndex to be of JDBC type - * sqlType. (JDBC4 clarification:) All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by sqlType for an OUT - * parameter determines the Java type that must be used - * in the get method to read the value of that parameter. - *

    - * This version of registerOutParameter should be - * used when the parameter is of JDBC type NUMERIC - * or DECIMAL. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param sqlType the SQL type code defined by java.sql.Types. - * @param scale the desired number of digits to the right of the - * decimal point. It must be greater than or equal to zero. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see java.sql.Types - */ - public synchronized void registerOutParameter(int parameterIndex, - int sqlType, int scale) throws SQLException { - registerOutParameter(parameterIndex, sqlType); - } - - /** - * - * - * Retrieves whether the last OUT parameter read had the value of - * SQL NULL. Note that this method should be called only after - * calling a getter method; otherwise, there is no value to use in - * determining whether it is null or not. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @return true if the last parameter read was SQL - * NULL; false otherwise - * @exception SQLException if a database access error occurs or - * this method is called on a closed CallableStatement - */ - public synchronized boolean wasNull() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return wasNullValue; - } - - /** - * - * - * Retrieves the value of the designated JDBC CHAR, - * VARCHAR, or LONGVARCHAR parameter as a - * String in the Java programming language. - *

    - * For the fixed-length type JDBC CHAR, - * the String object - * returned has exactly the same value the (JDBC4 clarification:) SQL - * CHAR value had in the - * database, including any padding added by the database. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, - * the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setString - */ - public synchronized String getString( - int parameterIndex) throws SQLException { - return (String) getColumnInType(parameterIndex, Type.SQL_VARCHAR); - } - - /** - * - * - * (JDBC4 modified:) - * Retrieves the value of the designated JDBC BIT - * or BOOLEAN parameter as a - * boolean in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, - * the result is false. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setBoolean - */ - public synchronized boolean getBoolean( - int parameterIndex) throws SQLException { - - Object o = getColumnInType(parameterIndex, Type.SQL_BOOLEAN); - - return o == null ? false - : ((Boolean) o).booleanValue(); - } - - /** - * - * - * Retrieves the value of the designated JDBC TINYINT parameter - * as a byte in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setByte - */ - public synchronized byte getByte(int parameterIndex) throws SQLException { - - Object o = getColumnInType(parameterIndex, Type.TINYINT); - - return o == null ? 0 - : ((Number) o).byteValue(); - } - - /** - * - * - * Retrieves the value of the designated JDBC SMALLINT parameter - * as a short in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setShort - */ - public synchronized short getShort( - int parameterIndex) throws SQLException { - - Object o = getColumnInType(parameterIndex, Type.SQL_SMALLINT); - - return o == null ? 0 - : ((Number) o).shortValue(); - } - - /** - * - * - * Retrieves the value of the designated JDBC INTEGER parameter - * as an int in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setInt - */ - public synchronized int getInt(int parameterIndex) throws SQLException { - - Object o = getColumnInType(parameterIndex, Type.SQL_INTEGER); - - return o == null ? 0 - : ((Number) o).intValue(); - } - - /** - * - * - * Retrieves the value of the designated JDBC BIGINT parameter - * as a long in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setLong - */ - public synchronized long getLong(int parameterIndex) throws SQLException { - - Object o = getColumnInType(parameterIndex, Type.SQL_BIGINT); - - return o == null ? 0 - : ((Number) o).longValue(); - } - - /** - * - * - * Retrieves the value of the designated JDBC FLOAT parameter - * as a float in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setFloat - */ - public synchronized float getFloat( - int parameterIndex) throws SQLException { - - Object o = getColumnInType(parameterIndex, Type.SQL_DOUBLE); - - return o == null ? (float) 0.0 - : ((Number) o).floatValue(); - } - - /** - * - * - * Retrieves the value of the designated JDBC DOUBLE parameter as a double - * in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setDouble - */ - public synchronized double getDouble( - int parameterIndex) throws SQLException { - - Object o = getColumnInType(parameterIndex, Type.SQL_DOUBLE); - - return o == null ? 0.0 - : ((Number) o).doubleValue(); - } - - /** - * - * - * Retrieves the value of the designated JDBC NUMERIC parameter as a - * java.math.BigDecimal object with scale digits to - * the right of the decimal point. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param scale the number of digits to the right of the decimal point - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @deprecated use getBigDecimal(int parameterIndex) - * or getBigDecimal(String parameterName) - * @see #setBigDecimal - */ - -//#ifdef DEPRECATEDJDBC - @Deprecated - public synchronized BigDecimal getBigDecimal(int parameterIndex, - int scale) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (scale < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - - BigDecimal bd = getBigDecimal(parameterIndex); - - if (bd != null) { - bd = bd.setScale(scale, RoundingMode.DOWN); - } - - return bd; - } - -//#endif DEPRECATEDJDBC - - /** - * - * - * Retrieves the value of the designated JDBC BINARY or - * VARBINARY parameter as an array of byte - * values in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setBytes - */ - public synchronized byte[] getBytes( - int parameterIndex) throws SQLException { - - Object x = getColumnInType(parameterIndex, Type.SQL_VARBINARY); - - if (x == null) { - return null; - } - - return ((BinaryData) x).getBytes(); - } - - /** - * - * - * Retrieves the value of the designated JDBC DATE parameter as a - * java.sql.Date object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setDate - */ - public synchronized Date getDate(int parameterIndex) throws SQLException { - - TimestampData t = (TimestampData) getColumnInType(parameterIndex, - Type.SQL_DATE); - - if (t == null) { - return null; - } - - return (Date) Type.SQL_DATE.convertSQLToJava(session, t); - } - - /** - * - * - * Retrieves the value of the designated JDBC TIME parameter as a - * java.sql.Time object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setTime - */ - public synchronized Time getTime(int parameterIndex) throws SQLException { - - TimeData t = (TimeData) getColumnInType(parameterIndex, Type.SQL_TIME); - - if (t == null) { - return null; - } - - return (Time) Type.SQL_TIME.convertSQLToJava(session, t); - } - - /** - * - * - * Retrieves the value of the designated JDBC TIMESTAMP - * parameter as a java.sql.Timestamp object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setTimestamp - */ - public synchronized Timestamp getTimestamp( - int parameterIndex) throws SQLException { - - TimestampData t = (TimestampData) getColumnInType(parameterIndex, - Type.SQL_TIMESTAMP); - - if (t == null) { - return null; - } - - return (Timestamp) Type.SQL_TIMESTAMP.convertSQLToJava(session, t); - } - - //---------------------------------------------------------------------- - // Advanced features: - - /** - * - * - * Retrieves the value of the designated parameter as an Object - * in the Java programming language. If the value is an SQL NULL, - * the driver returns a Java null. - *

    - * This method returns a Java object whose type corresponds to the JDBC - * type that was registered for this parameter using the method - * registerOutParameter. By registering the target JDBC - * type as java.sql.Types.OTHER, this method can be used - * to read database-specific abstract data types. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return A java.lang.Object holding the OUT parameter value - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see java.sql.Types - * @see #setObject - */ - public synchronized Object getObject( - int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - Type sourceType = parameterTypes[parameterIndex - 1]; - - switch (sourceType.typeCode) { - - case Types.SQL_ARRAY : - return getArray(parameterIndex); - case Types.SQL_DATE : - return getDate(parameterIndex); - case Types.SQL_TIME : - return getTime(parameterIndex); - case Types.SQL_TIME_WITH_TIME_ZONE : - return getTimeWithZone(parameterIndex); - case Types.SQL_TIMESTAMP : - return getTimestamp(parameterIndex); - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return getTimestampWithZone(parameterIndex); - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - return getBytes(parameterIndex); - case Types.SQL_BIT : { - boolean b = getBoolean(parameterIndex); - - return wasNull() ? null - : b ? Boolean.TRUE - : Boolean.FALSE; - } - case Types.SQL_CLOB : - return getClob(parameterIndex); - case Types.SQL_BLOB : - return getBlob(parameterIndex); - case Types.OTHER : - case Types.JAVA_OBJECT : { - Object o = getColumnInType(parameterIndex, sourceType); - - if (o == null) { - return null; - } - - try { - return ((JavaObjectData) o).getObject(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - default : - return getColumnInType(parameterIndex, sourceType); - } - } - - //--------------------------JDBC 2.0----------------------------- - - /** - * - * - * Retrieves the value of the designated JDBC NUMERIC parameter as a - * java.math.BigDecimal object with as many digits to the - * right of the decimal point as the value contains. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value in full precision. If the value is - * SQL NULL, the result is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setBigDecimal - * @since JDK 1.2 - */ - public synchronized BigDecimal getBigDecimal( - int parameterIndex) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - Type targetType = parameterMetaData.columnTypes[parameterIndex - 1]; - - switch (targetType.typeCode) { - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - break; - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - targetType = Type.SQL_DECIMAL; - - break; - case Types.SQL_DOUBLE : - default : - targetType = Type.SQL_DECIMAL_DEFAULT; - - break; - } - - return (BigDecimal) getColumnInType(parameterIndex, targetType); - } - - /** - * - * - * Returns an object representing the value of OUT parameter - * parameterIndex and uses map for the custom - * mapping of the parameter value. - *

    - * This method returns a Java object whose type corresponds to the - * JDBC type that was registered for this parameter using the method - * registerOutParameter. By registering the target - * JDBC type as java.sql.Types.OTHER, this method can - * be used to read database-specific abstract data types. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, and so on - * @param map the mapping from SQL type names to Java classes - * @return a java.lang.Object holding the OUT parameter value - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setObject - * @since JDK 1.2 - */ - public Object getObject(int parameterIndex, - Map> map) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Retrieves the value of the designated JDBC REF(<structured-type>) - * parameter as a {@link java.sql.Ref} object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @return the parameter value as a Ref object in the - * Java programming language. If the value was SQL NULL, the value - * null is returned. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Ref getRef(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Retrieves the value of the designated JDBC BLOB parameter as a - * {@link java.sql.Blob} object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, and so on - * @return the parameter value as a Blob object in the - * Java programming language. If the value was SQL NULL, the value - * null is returned. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public synchronized Blob getBlob(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - Type sourceType = parameterMetaData.columnTypes[parameterIndex - 1]; - Object o = getColumnInType(parameterIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof BlobDataID) { - return new JDBCBlobClient(session, (BlobDataID) o); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - /** - * - * - * Retrieves the value of the designated JDBC CLOB parameter as a - * java.sql.Clob object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, and - * so on - * @return the parameter value as a Clob object in the - * Java programming language. If the value was SQL NULL, the - * value null is returned. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public synchronized Clob getClob(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - Type sourceType = parameterMetaData.columnTypes[parameterIndex - 1]; - Object o = getColumnInType(parameterIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof ClobDataID) { - return new JDBCClobClient(session, (ClobDataID) o); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - /** - * - * - * Retrieves the value of the designated JDBC ARRAY parameter as an - * {@link java.sql.Array} object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, and - * so on - * @return the parameter value as an Array object in - * the Java programming language. If the value was SQL NULL, the - * value null is returned. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Array getArray(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - Type type = parameterMetaData.columnTypes[parameterIndex - 1]; - - if (!type.isArrayType()) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - Object[] data = (Object[]) parameterValues[parameterIndex - 1]; - - if (data == null) { - return null; - } - - return new JDBCArray(data, type.collectionBaseType(), type, - connection); - } - - /** - * - * - * Retrieves the value of the designated JDBC DATE parameter as a - * java.sql.Date object, using - * the given Calendar object - * to construct the date. - * With a Calendar object, the driver - * can calculate the date taking into account a custom timezone and locale. - * If no Calendar object is specified, the driver uses the - * default timezone and locale. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param cal the Calendar object the driver will use - * to construct the date - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setDate - * @since JDK 1.2 - */ - public synchronized Date getDate(int parameterIndex, - Calendar cal) throws SQLException { - - TimestampData t = (TimestampData) getColumnInType(parameterIndex, - Type.SQL_DATE); - - if (t == null) { - return null; - } - - return (Date) Type.SQL_DATE.convertSQLToJava(session, t, cal); - } - - /** - * - * - * Retrieves the value of the designated JDBC TIME parameter as a - * java.sql.Time object, using - * the given Calendar object - * to construct the time. - * With a Calendar object, the driver - * can calculate the time taking into account a custom timezone and locale. - * If no Calendar object is specified, the driver uses the - * default timezone and locale. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param cal the Calendar object the driver will use - * to construct the time - * @return the parameter value; if the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setTime - * @since JDK 1.2 - */ - public synchronized Time getTime(int parameterIndex, - Calendar cal) throws SQLException { - - Object t = getColumnValue(parameterIndex); - - if (t == null) { - return null; - } - - return (Time) Type.SQL_TIME.convertSQLToJava(session, t, cal); - } - - /** - * - * - * Retrieves the value of the designated JDBC TIMESTAMP parameter as a - * java.sql.Timestamp object, using - * the given Calendar object to construct - * the Timestamp object. - * With a Calendar object, the driver - * can calculate the timestamp taking into account a custom timezone and locale. - * If no Calendar object is specified, the driver uses the - * default timezone and locale. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param cal the Calendar object the driver will use - * to construct the timestamp - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #setTimestamp - * @since JDK 1.2 - */ - public synchronized Timestamp getTimestamp(int parameterIndex, - Calendar cal) throws SQLException { - - - Object t = getColumnValue(parameterIndex); - - if (t == null) { - return null; - } - - return (Timestamp) Type.SQL_TIMESTAMP.convertSQLToJava(session, t, cal); - } - - /** - * - * - * Registers the designated output parameter. - * This version of - * the method registerOutParameter - * should be used for a user-defined or REF output parameter. Examples - * of user-defined types include: STRUCT, DISTINCT, - * JAVA_OBJECT, and named array types. - *

    - * All OUT parameters must be registered - * before a stored procedure is executed. - *

    For a user-defined parameter, the fully-qualified SQL - * type name of the parameter should also be given, while a REF - * parameter requires that the fully-qualified type name of the - * referenced type be given. A JDBC driver that does not need the - * type code and type name information may ignore it. To be portable, - * however, applications should always provide these values for - * user-defined and REF parameters. - * - * Although it is intended for user-defined and REF parameters, - * this method may be used to register a parameter of any JDBC type. - * If the parameter does not have a user-defined or REF type, the - * typeName parameter is ignored. - * - *

    Note: When reading the value of an out parameter, you - * must use the getter method whose Java type corresponds to the - * parameter's registered SQL type. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2,... - * @param sqlType a value from {@link java.sql.Types} - * @param typeName the fully-qualified name of an SQL structured type - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see java.sql.Types - * @since JDK 1.2 - * - */ - public synchronized void registerOutParameter(int parameterIndex, - int sqlType, String typeName) throws SQLException { - registerOutParameter(parameterIndex, sqlType); - } - -// ----------------------------------- JDBC 3.0---------------------------------- - - /** - * - * - * Registers the OUT parameter named - * parameterName to the JDBC type - * sqlType. All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by sqlType for an OUT - * parameter determines the Java type that must be used - * in the get method to read the value of that parameter. - *

    - * If the JDBC type expected to be returned to this output parameter - * is specific to this particular database, sqlType - * should be java.sql.Types.OTHER. The method - * {@link #getObject} retrieves the value. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param sqlType the JDBC type code defined by java.sql.Types. - * If the parameter is of JDBC type NUMERIC - * or DECIMAL, the version of - * registerOutParameter that accepts a scale value - * should be used. - * @exception SQLException JDBC 41.[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type or if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQL 1.7.0 - * @see java.sql.Types - */ - public synchronized void registerOutParameter(String parameterName, - int sqlType) throws SQLException { - registerOutParameter(findParameterIndex(parameterName), sqlType); - } - - /** - * - * - * Registers the parameter named - * parameterName to be of JDBC type - * sqlType. (JDBC4 clarification:) All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by sqlType for an OUT - * parameter determines the Java type that must be used - * in the get method to read the value of that parameter. - *

    - * This version of registerOutParameter should be - * used when the parameter is of JDBC type NUMERIC - * or DECIMAL. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param sqlType SQL type code defined by java.sql.Types. - * @param scale the desired number of digits to the right of the - * decimal point. It must be greater than or equal to zero. - * @exception SQLException JDBC 41.[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type or if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - * @see java.sql.Types - */ - public synchronized void registerOutParameter(String parameterName, - int sqlType, int scale) throws SQLException { - registerOutParameter(findParameterIndex(parameterName), sqlType); - } - - /** - * - * - * Registers the designated output parameter. This version of - * the method registerOutParameter - * should be used for a user-named or REF output parameter. Examples - * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and - * named array types. - *

    - * (JDBC4 clarification:)

    - * All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * For a user-named parameter the fully-qualified SQL - * type name of the parameter should also be given, while a REF - * parameter requires that the fully-qualified type name of the - * referenced type be given. A JDBC driver that does not need the - * type code and type name information may ignore it. To be portable, - * however, applications should always provide these values for - * user-named and REF parameters. - * - * Although it is intended for user-named and REF parameters, - * this method may be used to register a parameter of any JDBC type. - * If the parameter does not have a user-named or REF type, the - * typeName parameter is ignored. - * - *

    Note: When reading the value of an out parameter, you - * must use the getXXX method whose Java type XXX corresponds to the - * parameter's registered SQL type. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param sqlType a value from {@link java.sql.Types} - * @param typeName the fully-qualified name of an SQL structured type - * @exception SQLException JDBC 41.[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type or if the JDBC driver does not support - * this method - * @see java.sql.Types - * @since JDK 1.4, HSQL 1.7.0 - */ - public synchronized void registerOutParameter(String parameterName, - int sqlType, String typeName) throws SQLException { - registerOutParameter(findParameterIndex(parameterName), sqlType); - } - - /** - * - * - * Retrieves the value of the designated JDBC DATALINK parameter as a - * java.net.URL object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2,... - * @return a java.net.URL object that represents the - * JDBC DATALINK value used as the designated - * parameter - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs, - * this method is called on a closed CallableStatement, - * or if the URL being returned is - * not a valid URL on the Java platform - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setURL - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public java.net.URL getURL(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Sets the designated parameter to the given java.net.URL object. - * The driver converts this to an SQL DATALINK value when - * it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterName the name of the parameter - * @param val the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs, - * this method is called on a closed CallableStatement, - * or if a URL is malformed - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getURL - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void setURL(String parameterName, - java.net.URL val) throws SQLException { - setURL(findParameterIndex(parameterName), val); - } - - /** - * - * - * Sets the designated parameter to SQL NULL. - * - *

    Note: You must specify the parameter's SQL type. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param sqlType the SQL type code defined in java.sql.Types - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setNull(String parameterName, - int sqlType) throws SQLException { - setNull(findParameterIndex(parameterName), sqlType); - } - - /** - * - * - * Sets the designated parameter to the given Java boolean value. - * - *

    (JDBC4 clarification:)

    - * - * The driver converts this - * to an SQL BIT or BOOLEAN value when it sends it to the database. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @see #getBoolean - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBoolean - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setBoolean(String parameterName, - boolean x) throws SQLException { - setBoolean(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java byte value. - * The driver converts this - * to an SQL TINYINT value when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getByte - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setByte(String parameterName, - byte x) throws SQLException { - setByte(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java short value. - * The driver converts this - * to an SQL SMALLINT value when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getShort - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setShort(String parameterName, - short x) throws SQLException { - setShort(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java int value. - * The driver converts this - * to an SQL INTEGER value when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getInt - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setInt(String parameterName, - int x) throws SQLException { - setInt(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java long value. - * The driver converts this - * to an SQL BIGINT value when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getLong - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setLong(String parameterName, - long x) throws SQLException { - setLong(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java float value. - * The driver converts this - * to an SQL FLOAT value when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getFloat - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setFloat(String parameterName, - float x) throws SQLException { - setFloat(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java double value. - * The driver converts this - * to an SQL DOUBLE value when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDouble - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setDouble(String parameterName, - double x) throws SQLException { - setDouble(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given - * java.math.BigDecimal value. - * The driver converts this to an SQL NUMERIC value when - * it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBigDecimal - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setBigDecimal(String parameterName, - BigDecimal x) throws SQLException { - setBigDecimal(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java String value. - * The driver converts this - * to an SQL VARCHAR or LONGVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on VARCHAR values) - * when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getString - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setString(String parameterName, - String x) throws SQLException { - setString(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Java array of bytes. - * The driver converts this to an SQL VARBINARY or - * LONGVARBINARY (depending on the argument's size relative - * to the driver's limits on VARBINARY values) when it sends - * it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getBytes - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setBytes(String parameterName, - byte[] x) throws SQLException { - setBytes(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given java.sql.Date value - * (JDBC4 clarification:)

    - * using the default time zone of the virtual machine that is running - * the application. - * The driver converts this - * to an SQL DATE value when it sends it to the database. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDate - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setDate(String parameterName, - Date x) throws SQLException { - setDate(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given java.sql.Time value. - * The driver converts this - * to an SQL TIME value when it sends it to the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTime - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setTime(String parameterName, - Time x) throws SQLException { - setTime(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given java.sql.Timestamp value. - * The driver - * converts this to an SQL TIMESTAMP value when it sends it to the - * database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTimestamp - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setTimestamp(String parameterName, - Timestamp x) throws SQLException { - setTimestamp(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setAsciiStream(String parameterName, - java.io.InputStream x, int length) throws SQLException { - setAsciiStream(findParameterIndex(parameterName), x, length); - } - - /** - * - * - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the stream - * as needed until end-of-file is reached. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setBinaryStream(String parameterName, - java.io.InputStream x, int length) throws SQLException { - setBinaryStream(findParameterIndex(parameterName), x, length); - } - - /** - * - * - * Sets the value of the designated parameter with the given object. The second - * argument must be an object type; for integral values, the - * java.lang equivalent objects should be used. - * - *

    The given Java object will be converted to the given targetSqlType - * before being sent to the database. - * - * If the object has a custom mapping (is of a class implementing the - * interface SQLData), - * the JDBC driver should call the method SQLData.writeSQL to write it - * to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, NClob, - * Struct, java.net.URL, - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - *

    - * Note that this method may be used to pass database- - * specific abstract data types. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database. The scale argument may further qualify this type. - * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, - * this is the number of digits after the decimal point. For all other - * types, this value will be ignored. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see java.sql.Types - * @see #getObject - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setObject(String parameterName, Object x, - int targetSqlType, - int scale) throws SQLException { - setObject(findParameterIndex(parameterName), x, targetSqlType, scale); - } - - /** - * - * - * Sets the value of the designated parameter with the given object. - * This method is like the method setObject - * above, except that it assumes a scale of zero. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see #getObject - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setObject(String parameterName, Object x, - int targetSqlType) throws SQLException { - setObject(findParameterIndex(parameterName), x, targetSqlType); - } - - /** - * - * - * Sets the value of the designated parameter with the given object. - * The second parameter must be of type Object; therefore, the - * java.lang equivalent objects should be used for built-in types. - * - *

    The JDBC specification specifies a standard mapping from - * Java Object types to SQL types. The given argument - * will be converted to the corresponding SQL type before being - * sent to the database. - * - *

    Note that this method may be used to pass datatabase- - * specific abstract data types, by using a driver-specific Java - * type. - * - * If the object is of a class implementing the interface SQLData, - * the JDBC driver should call the method SQLData.writeSQL - * to write it to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, NClob, - * Struct, java.net.URL, - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - *

    - * This method throws an exception if there is an ambiguity, for example, if the - * object is of a class implementing more than one of the interfaces named above. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs, - * this method is called on a closed CallableStatement or if the given - * Object parameter is ambiguous - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getObject - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setObject(String parameterName, - Object x) throws SQLException { - setObject(findParameterIndex(parameterName), x); - } - - /** - * - * - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that - * contains the UNICODE data used as the designated parameter - * @param length the number of characters in the stream - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setCharacterStream(String parameterName, - java.io.Reader reader, int length) throws SQLException { - setCharacterStream(findParameterIndex(parameterName), reader, length); - } - - /** - * - * - * Sets the designated parameter to the given java.sql.Date value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL DATE value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the date - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the date - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getDate - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setDate(String parameterName, Date x, - Calendar cal) throws SQLException { - setDate(findParameterIndex(parameterName), x, cal); - } - - /** - * - * - * Sets the designated parameter to the given java.sql.Time value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIME value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the time - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the time - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTime - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setTime(String parameterName, Time x, - Calendar cal) throws SQLException { - setTime(findParameterIndex(parameterName), x, cal); - } - - /** - * - * - * Sets the designated parameter to the given java.sql.Timestamp value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIMESTAMP value, - * which the driver then sends to the database. With a - * a Calendar object, the driver can calculate the timestamp - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the timestamp - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getTimestamp - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setTimestamp(String parameterName, Timestamp x, - Calendar cal) throws SQLException { - setTimestamp(findParameterIndex(parameterName), x, cal); - } - - /** - * - * - * Sets the designated parameter to SQL NULL. - * This version of the method setNull should - * be used for user-defined types and REF type parameters. Examples - * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and - * named array types. - * - *

    Note: To be portable, applications must give the - * SQL type code and the fully-qualified SQL type name when specifying - * a NULL user-defined or REF parameter. In the case of a user-defined type - * the name is the type name of the parameter itself. For a REF - * parameter, the name is the type name of the referenced type. If - * a JDBC driver does not need the type code or type name information, - * it may ignore it. - * - * Although it is intended for user-defined and Ref parameters, - * this method may be used to set a null parameter of any JDBC type. - * If the parameter does not have a user-defined or REF type, the given - * typeName is ignored. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param sqlType a value from java.sql.Types - * @param typeName the fully-qualified name of an SQL user-defined type; - * ignored if the parameter is not a user-defined type or - * SQL REF value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized void setNull(String parameterName, int sqlType, - String typeName) throws SQLException { - setNull(findParameterIndex(parameterName), sqlType, typeName); - } - - /** - * - * - * Retrieves the value of a JDBC CHAR, VARCHAR, - * or LONGVARCHAR parameter as a String in - * the Java programming language. - *

    - * For the fixed-length type JDBC CHAR, - * the String object - * returned has exactly the same value the (JDBC4 clarification:) SQL - * CHAR value had in the - * database, including any padding added by the database. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setString - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized String getString( - String parameterName) throws SQLException { - return getString(findParameterIndex(parameterName)); - } - - /** - * - * - * (JDBC4 modified:)

    - * Retrieves the value of a JDBC BIT or BOOLEAN - * parameter as a - * boolean in the Java programming language. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result - * is false. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setBoolean - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized boolean getBoolean( - String parameterName) throws SQLException { - return getBoolean(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC TINYINT parameter as a byte - * in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setByte - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized byte getByte( - String parameterName) throws SQLException { - return getByte(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC SMALLINT parameter as a short - * in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result - * is 0. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setShort - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized short getShort( - String parameterName) throws SQLException { - return getShort(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC INTEGER parameter as an int - * in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, - * the result is 0. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setInt - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized int getInt(String parameterName) throws SQLException { - return getInt(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC BIGINT parameter as a long - * in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, - * the result is 0. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setLong - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized long getLong( - String parameterName) throws SQLException { - return getLong(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC FLOAT parameter as a float - * in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, - * the result is 0. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setFloat - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized float getFloat( - String parameterName) throws SQLException { - return getFloat(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC DOUBLE parameter as a double - * in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, - * the result is 0. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setDouble - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized double getDouble( - String parameterName) throws SQLException { - return getDouble(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC BINARY or VARBINARY - * parameter as an array of byte values in the Java - * programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result is - * null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setBytes - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized byte[] getBytes( - String parameterName) throws SQLException { - return getBytes(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC DATE parameter as a - * java.sql.Date object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setDate - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Date getDate( - String parameterName) throws SQLException { - return getDate(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC TIME parameter as a - * java.sql.Time object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setTime - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Time getTime( - String parameterName) throws SQLException { - return getTime(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC TIMESTAMP parameter as a - * java.sql.Timestamp object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value. If the value is SQL NULL, the result - * is null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setTimestamp - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Timestamp getTimestamp( - String parameterName) throws SQLException { - return getTimestamp(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a parameter as an Object in the Java - * programming language. If the value is an SQL NULL, the - * driver returns a Java null. - *

    - * This method returns a Java object whose type corresponds to the JDBC - * type that was registered for this parameter using the method - * registerOutParameter. By registering the target JDBC - * type as java.sql.Types.OTHER, this method can be used - * to read database-specific abstract data types. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return A java.lang.Object holding the OUT parameter value. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see java.sql.Types - * @see #setObject - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Object getObject( - String parameterName) throws SQLException { - return getObject(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC NUMERIC parameter as a - * java.math.BigDecimal object with as many digits to the - * right of the decimal point as the value contains. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value in full precision. If the value is - * SQL NULL, the result is null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setBigDecimal - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized BigDecimal getBigDecimal( - String parameterName) throws SQLException { - return getBigDecimal(findParameterIndex(parameterName)); - } - - /** - * - * - * Returns an object representing the value of OUT parameter - * parameterName and uses map for the custom - * mapping of the parameter value. - *

    - * This method returns a Java object whose type corresponds to the - * JDBC type that was registered for this parameter using the method - * registerOutParameter. By registering the target - * JDBC type as java.sql.Types.OTHER, this method can - * be used to read database-specific abstract data types. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param map the mapping from SQL type names to Java classes - * @return a java.lang.Object holding the OUT parameter value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setObject - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Object getObject(String parameterName, - Map> map) throws SQLException { - return getObject(findParameterIndex(parameterName), map); - } - - - /** - * - * - * Retrieves the value of a JDBC REF(<structured-type>) - * parameter as a {@link java.sql.Ref} object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value as a Ref object in the - * Java programming language. If the value was SQL NULL, - * the value null is returned. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Ref getRef(String parameterName) throws SQLException { - return getRef(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC BLOB parameter as a - * {@link java.sql.Blob} object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value as a Blob object in the - * Java programming language. If the value was SQL NULL, - * the value null is returned. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Blob getBlob( - String parameterName) throws SQLException { - return getBlob(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC CLOB parameter as a - * {@link java.sql.Clob} object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value as a Clob object in the - * Java programming language. If the value was SQL NULL, - * the value null is returned. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Clob getClob( - String parameterName) throws SQLException { - return getClob(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC ARRAY parameter as an - * {@link java.sql.Array} object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value as an Array object in - * Java programming language. If the value was SQL NULL, - * the value null is returned. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Array getArray( - String parameterName) throws SQLException { - return getArray(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of a JDBC DATE parameter as a - * java.sql.Date object, using - * the given Calendar object - * to construct the date. - * With a Calendar object, the driver - * can calculate the date taking into account a custom timezone and locale. - * If no Calendar object is specified, the driver uses the - * default timezone and locale. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param cal the Calendar object the driver will use - * to construct the date - * @return the parameter value. If the value is SQL NULL, - * the result is null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setDate - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Date getDate(String parameterName, - Calendar cal) throws SQLException { - return getDate(findParameterIndex(parameterName), cal); - } - - /** - * - * - * Retrieves the value of a JDBC TIME parameter as a - * java.sql.Time object, using - * the given Calendar object - * to construct the time. - * With a Calendar object, the driver - * can calculate the time taking into account a custom timezone and locale. - * If no Calendar object is specified, the driver uses the - * default timezone and locale. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param cal the Calendar object the driver will use - * to construct the time - * @return the parameter value; if the value is SQL NULL, the result is - * null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setTime - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Time getTime(String parameterName, - Calendar cal) throws SQLException { - return getTime(findParameterIndex(parameterName), cal); - } - - /** - * - * - * Retrieves the value of a JDBC TIMESTAMP parameter as a - * java.sql.Timestamp object, using - * the given Calendar object to construct - * the Timestamp object. - * With a Calendar object, the driver - * can calculate the timestamp taking into account a custom timezone and locale. - * If no Calendar object is specified, the driver uses the - * default timezone and locale. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * - * @param parameterName the name of the parameter - * @param cal the Calendar object the driver will use - * to construct the timestamp - * @return the parameter value. If the value is SQL NULL, the result is - * null. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setTimestamp - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public synchronized Timestamp getTimestamp(String parameterName, - Calendar cal) throws SQLException { - return getTimestamp(findParameterIndex(parameterName), cal); - } - - /** - * - * - * Retrieves the value of a JDBC DATALINK parameter as a - * java.net.URL object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value as a java.net.URL object in the - * Java programming language. If the value was SQL NULL, the - * value null is returned. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs, - * this method is called on a closed CallableStatement, - * or if there is a problem with the URL - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setURL - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public java.net.URL getURL(String parameterName) throws SQLException { - return getURL(findParameterIndex(parameterName)); - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * - * - * Retrieves the value of the designated JDBC ROWID parameter as a - * java.sql.RowId object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2,... - * @return a RowId object that represents the JDBC ROWID - * value is used as the designated parameter. If the parameter contains - * a SQL NULL, then a null value is returned. - * @throws SQLException JDBC 4.1[ if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public RowId getRowId(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Retrieves the value of the designated JDBC ROWID parameter as a - * java.sql.RowId object. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return a RowId object that represents the JDBC ROWID - * value is used as the designated parameter. If the parameter contains - * a SQL NULL, then a null value is returned. - * @throws SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized RowId getRowId( - String parameterName) throws SQLException { - return getRowId(findParameterIndex(parameterName)); - } - - /** - * - * - * Sets the designated parameter to the given java.sql.RowId object. The - * driver converts this to a SQL ROWID when it sends it to the - * database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @param x the parameter value - * @throws SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setRowId(String parameterName, - RowId x) throws SQLException { - super.setRowId(findParameterIndex(parameterName), x); - } - - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @throws SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNString(String parameterName, - String value) throws SQLException { - super.setNString(findParameterIndex(parameterName), value); - } - - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNCharacterStream(String parameterName, - Reader value, long length) throws SQLException { - super.setNCharacterStream(findParameterIndex(parameterName), value, - length); - } - - /** - * Sets the designated parameter to a java.sql.NClob object. The object - * implements the java.sql.NClob interface. This NClob - * object maps to a SQL NCLOB. - * @param parameterName the name of the parameter to be set - * @param value the parameter value - * @throws SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNClob(String parameterName, - NClob value) throws SQLException { - super.setNClob(findParameterIndex(parameterName), value); - } - - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the length specified is less than zero; - * a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setClob(String parameterName, Reader reader, - long length) throws SQLException { - super.setClob(findParameterIndex(parameterName), reader, length); - } - - /** - * Sets the designated parameter to a InputStream object. The inputstream must contain the number - * of characters specified by length, otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - * @param parameterName the name of the parameter to be set - * the second is 2, ... - * - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the length specified - * is less than zero; if the number of bytes in the input stream does not match - * the specified length; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setBlob(String parameterName, - InputStream inputStream, - long length) throws SQLException { - super.setBlob(findParameterIndex(parameterName), inputStream, length); - } - - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the CallableStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - * - * @param parameterName the name of the parameter to be set - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the length specified is less than zero; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNClob(String parameterName, Reader reader, - long length) throws SQLException { - super.setNClob(findParameterIndex(parameterName), reader, length); - } - - /** - * - * - * Retrieves the value of the designated JDBC NCLOB parameter as a - * java.sql.NClob object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, and - * so on - * @return the parameter value as a NClob object in the - * Java programming language. If the value was SQL NULL, the - * value null is returned. - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public NClob getNClob(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Retrieves the value of a JDBC NCLOB parameter as a - * java.sql.NClob object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterName the name of the parameter - * @return the parameter value as a NClob object in the - * Java programming language. If the value was SQL NULL, - * the value null is returned. - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized NClob getNClob( - String parameterName) throws SQLException { - return getNClob(findParameterIndex(parameterName)); - } - - /** - * Sets the designated parameter to the given java.sql.SQLXML object. The driver converts this to an - * SQL XML value when it sends it to the database. - * - * @param parameterName the name of the parameter - * @param xmlObject a SQLXML object that maps an SQL XML value - * @throws SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs; - * this method is called on a closed CallableStatement or - * the java.xml.transform.Result, - * Writer or OutputStream has not been closed for the SQLXML object - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setSQLXML(String parameterName, - SQLXML xmlObject) throws SQLException { - super.setSQLXML(findParameterIndex(parameterName), xmlObject); - } - - /** - * - * - * Retrieves the value of the designated SQL XML parameter as a - * java.sql.SQLXML object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public SQLXML getSQLXML(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Retrieves the value of the designated SQL XML parameter as a - * java.sql.SQLXML object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterName the name of the parameter - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized SQLXML getSQLXML( - String parameterName) throws SQLException { - return getSQLXML(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of the designated NCHAR, - * NVARCHAR - * or LONGNVARCHAR parameter as - * a String in the Java programming language. - *

    - * For the fixed-length type JDBC NCHAR, - * the String object - * returned has exactly the same value the SQL - * NCHAR value had in the - * database, including any padding added by the database. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @return a String object that maps an - * NCHAR, NVARCHAR or LONGNVARCHAR value - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - * @see #setNString - */ - public String getNString(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Retrieves the value of the designated NCHAR, - * NVARCHAR - * or LONGNVARCHAR parameter as - * a String in the Java programming language. - *

    - * For the fixed-length type JDBC NCHAR, - * the String object - * returned has exactly the same value the SQL - * NCHAR value had in the - * database, including any padding added by the database. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterName the name of the parameter - * @return a String object that maps an - * NCHAR, NVARCHAR or LONGNVARCHAR value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - * @see #setNString - */ - public synchronized String getNString( - String parameterName) throws SQLException { - return getNString(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR parameters. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] - * if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public Reader getNCharacterStream(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - throw JDBCUtil.notSupported(); - } - - /** - * - * - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR parameters. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @param parameterName the name of the parameter - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized Reader getNCharacterStream( - String parameterName) throws SQLException { - return getNCharacterStream(findParameterIndex(parameterName)); - } - - /** - * - * - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature.

    - * - * Calling this method always throws an SQLException. - *

    - * - * - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @exception SQLException JDBC 4.1[if the parameterIndex is not valid;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @since JDK 1.6, HSQLDB 2.0 - */ - public Reader getCharacterStream(int parameterIndex) throws SQLException { - - checkGetParameterIndex(parameterIndex); - - Type sourceType = parameterMetaData.columnTypes[parameterIndex - 1]; - Object o = getColumnInType(parameterIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof ClobDataID) { - return ((ClobDataID) o).getCharacterStream(session); - } else if (o instanceof Clob) { - return ((Clob) o).getCharacterStream(); - } else if (o instanceof String) { - return new StringReader((String) o); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - /** - * - * - * Retrieves the value of the designated parameter as a - * java.io.Reader object in the Java programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - *

    - * - * - * @param parameterName the name of the parameter - * @return a java.io.Reader object that contains the parameter - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized Reader getCharacterStream( - String parameterName) throws SQLException { - return getCharacterStream(findParameterIndex(parameterName)); - } - - /** - * Sets the designated parameter to the given java.sql.Blob object. - * The driver converts this to an SQL BLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Blob object that maps an SQL BLOB value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setBlob(String parameterName, - Blob x) throws SQLException { - super.setBlob(findParameterIndex(parameterName), x); - } - - /** - * Sets the designated parameter to the given java.sql.Clob object. - * The driver converts this to an SQL CLOB value when it - * sends it to the database. - * - * @param parameterName the name of the parameter - * @param x a Clob object that maps an SQL CLOB value - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setClob(String parameterName, - Clob x) throws SQLException { - super.setClob(findParameterIndex(parameterName), x); - } - - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setAsciiStream(String parameterName, - java.io.InputStream x, long length) throws SQLException { - - if (length > Integer.MAX_VALUE) { - String msg = "Maximum ASCII input octet length exceeded: " - + length; // NOI18N - - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg); - } - this.setAsciiStream(parameterName, x, (int) length); - } - - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the stream - * as needed until end-of-file is reached. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setBinaryStream(String parameterName, - java.io.InputStream x, long length) throws SQLException { - - if (length > Integer.MAX_VALUE) { - String msg = "Maximum Binary input octet length exceeded: " - + length; // NOI18N - - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg); - } - setBinaryStream(parameterName, x, (int) length); - } - - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that - * contains the UNICODE data used as the designated parameter - * @param length the number of characters in the stream - * @exception SQLException JDBC 4.1[if parameterName does not correspond to a named - * parameter;] if a database access error occurs or - * this method is called on a closed CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setCharacterStream(String parameterName, - java.io.Reader reader, long length) throws SQLException { - - if (length > Integer.MAX_VALUE) { - String msg = "Maximum character input length exceeded: " + length; // NOI18N - - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg); - } - setCharacterStream(parameterName, reader, (int) length); - } - - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setAsciiStream(String parameterName, - java.io.InputStream x) throws SQLException { - super.setAsciiStream(findParameterIndex(parameterName), x); - } - - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setBinaryStream(String parameterName, - java.io.InputStream x) throws SQLException { - super.setBinaryStream(findParameterIndex(parameterName), x); - } - - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setCharacterStream(String parameterName, - java.io.Reader reader) throws SQLException { - super.setCharacterStream(findParameterIndex(parameterName), reader); - } - - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param value the parameter value - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs; or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNCharacterStream(String parameterName, - Reader value) throws SQLException { - super.setNCharacterStream(findParameterIndex(parameterName), value); - } - - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or this method is called on - * a closed CallableStatement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setClob(String parameterName, - Reader reader) throws SQLException { - super.setClob(findParameterIndex(parameterName), reader); - } - - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setBlob( - String parameterName, - InputStream inputStream) throws SQLException { - super.setBlob(findParameterIndex(parameterName), inputStream); - } - - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterName the name of the parameter - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterName does not correspond to a named - * parameter; if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNClob(String parameterName, - Reader reader) throws SQLException { - super.setNClob(findParameterIndex(parameterName), reader); - } - - //------------------------- JDBC 4.1 ----------------------------------- - - /** - *

    Returns an object representing the value of OUT parameter - * {@code parameterIndex} and will convert from the - * SQL type of the parameter to the requested Java data type, if the - * conversion is supported. If the conversion is not - * supported or null is specified for the type, a - * SQLException is thrown. - *

    - * At a minimum, an implementation must support the conversions defined in - * Appendix B, Table B-3 and conversion of appropriate user defined SQL - * types to a Java type which implements {@code SQLData}, or {@code Struct}. - * Additional conversions may be supported and are vendor defined. - * - * @param parameterIndex the first parameter is 1, the second is 2, and so on - * @param type Class representing the Java data type to convert the - * designated parameter to. - * @return an instance of {@code type} holding the OUT parameter value - * @throws SQLException if conversion is not supported, type is null or - * another error occurs. The getCause() method of the - * exception may provide a more detailed exception, for example, if - * a conversion error occurs - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ -//#ifdef JAVA8 - public T getObject(int parameterIndex, Class type) throws SQLException { - - if (type == null) { - throw JDBCUtil.nullArgument(); - } - - final Object source = getColumnValue(parameterIndex); - - if (wasNullValue) { - return null; - } - - Object o = null; - - switch(type.getName()){ - case "int": - case "java.lang.Integer": - o = getInt(parameterIndex); - break; - case "double": - case "java.lang.Double": - o = getDouble(parameterIndex); - break; - case "boolean": - case "java.lang.Boolean": - o = getBoolean(parameterIndex); - break; - case "byte": - case "java.lang.Byte": - o = getByte(parameterIndex); - break; - case "short": - case "java.lang.Short": - o = getShort(parameterIndex); - break; - case "long": - case "java.lang.Long": - o = getLong(parameterIndex); - break; - case "[B": - o = getBytes(parameterIndex); - break; - case "java.lang.Object": - o = getObject(parameterIndex); - break; - case "java.math.BigDecimal": - o = getBigDecimal(parameterIndex); - break; - case "java.sql.Blob": - o = getBlob(parameterIndex); - break; - - case "java.sql.Clob": - o = getClob(parameterIndex); - break; - case "java.lang.String": - case "java.lang.CharSequence": - o = getString(parameterIndex); - break; - - case "java.sql.Date": { - o = getDate(parameterIndex); - break; - } - case "java.sql.Time": { - o = getTime(parameterIndex); - break; - } - case "java.sql.Timestamp": { - o = getTimestamp(parameterIndex); - break; - } - case "java.util.UUID": { - Type columnType = parameterTypes[parameterIndex - 1]; - if (columnType.isUUIDType()) { - o = Type.SQL_GUID.convertSQLToJava(session, source); - } else { - Object value = Type.SQL_GUID.convertToTypeJDBC(session, - source, columnType); - o = Type.SQL_GUID.convertSQLToJava(session, value); - } - break; - } - case "java.time.Instant": { - Type columnType = parameterTypes[parameterIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toInstant(session, v); - } - break; - } - case "java.time.LocalDate": { - Type columnType = parameterTypes[parameterIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toLocalDate(session, v); - } - break; - } - case "java.time.LocalTime": { - Type columnType = parameterTypes[parameterIndex - 1]; - if (columnType.isTimeType()) { - TimeData v = (TimeData) source; - o = ((DateTimeType) columnType).toLocalTime(session, v); - } else if (columnType.isTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toLocalTime(session, v); - } - break; - } - case "java.time.LocalDateTime": { - Type columnType = parameterTypes[parameterIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toLocalDateTime(session, v); - } - break; - } - case "java.time.OffsetTime": { - Type columnType = parameterTypes[parameterIndex - 1]; - if (columnType.isTimeType()) { - TimeData v = (TimeData) source; - o = ((DateTimeType) columnType).toOffsetTime(session, v); - } else if (columnType.isTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toOffsetTime(session, v); - } - - break; - } - case "java.time.OffsetDateTime": { - Type columnType = parameterTypes[parameterIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toOffsetDateTime(session, v); - } - break; - } - case "java.time.Duration": { - Type sourceType = parameterMetaData.columnTypes[parameterIndex - 1]; - - if (!sourceType.isIntervalDaySecondType()) { - break; - } - IntervalSecondData v = (IntervalSecondData) source; - o = Duration.ofSeconds(v.getSeconds(), v.getNanos()); - break; - } - case "java.time.Period": { - Type sourceType = parameterMetaData.columnTypes[parameterIndex - 1]; - - if (!sourceType.isIntervalYearMonthType()) { - break; - } - IntervalMonthData v = (IntervalMonthData) source; - int months = v.getMonths(); - - if (sourceType.typeCode == Types.SQL_INTERVAL_MONTH) { - o = Period.ofMonths(months); - } else { - o = Period.of(months / 12, months % 12, 0); - } - break; - } - } - - if (o == null) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - return (T) o; - } -//#else -/* - public T getObject(int parameterIndex, Class type) throws SQLException { - throw JDBCUtil.notSupported(); - } -*/ - -//#endif JAVA8 - - /** - *

    Returns an object representing the value of OUT parameter - * {@code parameterName} and will convert from the - * SQL type of the parameter to the requested Java data type, if the - * conversion is supported. If the conversion is not - * supported or null is specified for the type, a - * SQLException is thrown. - *

    - * At a minimum, an implementation must support the conversions defined in - * Appendix B, Table B-3 and conversion of appropriate user defined SQL - * types to a Java type which implements {@code SQLData}, or {@code Struct}. - * Additional conversions may be supported and are vendor defined. - * - * @param parameterName the name of the parameter - * @param type Class representing the Java data type to convert - * the designated parameter to. - * @return an instance of {@code type} holding the OUT parameter - * value - * @throws SQLException if conversion is not supported, type is null or - * another error occurs. The getCause() method of the - * exception may provide a more detailed exception, for example, if - * a conversion error occurs - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public T getObject(String parameterName, - Class type) throws SQLException { - - return getObject(findParameterIndex(parameterName), type); - } - - /** - *

    Sets the value of the designated parameter with the given object. - * - * If the second argument is an {@code InputStream} then the stream - * must contain the number of bytes specified by scaleOrLength. - * If the second argument is a {@code Reader} then the reader must - * contain the number of characters specified - * by scaleOrLength. If these conditions are not true the driver - * will generate a - * {@code SQLException} when the prepared statement is executed. - * - *

    The given Java object will be converted to the given targetSqlType - * before being sent to the database. - * - * If the object has a custom mapping (is of a class implementing the - * interface {@code SQLData}), - * the JDBC driver should call the method {@code SQLData.writeSQL} to - * write it to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob}, - * {@code Struct}, {@code java.net.URL}, - * or {@code Array}, the driver should pass it to the database as a - * value of the corresponding SQL type. - * - *

    Note that this method may be used to pass database-specific - * abstract data types. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type to be - * sent to the database. The scale argument may further qualify this type. - * @param scaleOrLength for {@code java.sql.JDBCType.DECIMAL} - * or {@code java.sql.JDBCType.NUMERIC types}, - * this is the number of digits after the decimal point. For - * Java Object types {@code InputStream} and {@code Reader}, - * this is the length - * of the data in the stream or reader. For all other types, - * this value will be ignored. - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs - * or this method is called on a closed {@code CallableStatement} or - * if the Java Object specified by x is an InputStream - * or Reader object and the value of the scale parameter is less - * than zero - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified targetSqlType - * @see JDBCType - * @see SQLType - * - * @since 1.8 - */ -//#ifdef JAVA8 - public void setObject(String parameterName, Object x, SQLType targetSqlType, - int scaleOrLength) throws SQLException { - setObject(parameterName, x, targetSqlType.getVendorTypeNumber(), scaleOrLength); - } -//#endif JAVA8 - /** - * Sets the value of the designated parameter with the given object. - * - * This method is similar to {@link #setObject(String parameterName, - * Object x, SQLType targetSqlType, int scaleOrLength)}, - * except that it assumes a scale of zero. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterName the name of the parameter - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type to be sent to the database - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs - * or this method is called on a closed {@code CallableStatement} - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified targetSqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void setObject(String parameterName, Object x, SQLType targetSqlType) - throws SQLException { - setObject(parameterName, x, targetSqlType.getVendorTypeNumber()); - } -//#endif JAVA8 - - /** - * Registers the OUT parameter in ordinal position - * {@code parameterIndex} to the JDBC type - * {@code sqlType}. All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by {@code sqlType} for an OUT - * parameter determines the Java type that must be used - * in the {@code get} method to read the value of that parameter. - *

    - * If the JDBC type expected to be returned to this output parameter - * is specific to this particular database, {@code sqlType} - * may be {@code JDBCType.OTHER} or a {@code SQLType} that is supported by - * the JDBC driver. The method - * {@link #getObject} retrieves the value. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param sqlType the JDBC type code defined by {@code SQLType} to use to - * register the OUT Parameter. - * If the parameter is of JDBC type {@code JDBCType.NUMERIC} - * or {@code JDBCType.DECIMAL}, the version of - * {@code registerOutParameter} that accepts a scale value - * should be used. - * - * @exception SQLException if the parameterIndex is not valid; - * if a database access error occurs or - * this method is called on a closed {@code CallableStatement} - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified sqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void registerOutParameter(int parameterIndex, SQLType sqlType) - throws SQLException { - registerOutParameter(parameterIndex,sqlType.getVendorTypeNumber()); - } -//#endif JAVA8 - - /** - * Registers the parameter in ordinal position - * {@code parameterIndex} to be of JDBC type - * {@code sqlType}. All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by {@code sqlType} for an OUT - * parameter determines the Java type that must be used - * in the {@code get} method to read the value of that parameter. - *

    - * This version of {@code registerOutParameter} should be - * used when the parameter is of JDBC type {@code JDBCType.NUMERIC} - * or {@code JDBCType.DECIMAL}. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterIndex the first parameter is 1, the second is 2, - * and so on - * @param sqlType the JDBC type code defined by {@code SQLType} to use to - * register the OUT Parameter. - * @param scale the desired number of digits to the right of the - * decimal point. It must be greater than or equal to zero. - * @exception SQLException if the parameterIndex is not valid; - * if a database access error occurs or - * this method is called on a closed {@code CallableStatement} - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified sqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void registerOutParameter(int parameterIndex, SQLType sqlType, - int scale) throws SQLException { - registerOutParameter(parameterIndex,sqlType.getVendorTypeNumber(), scale); - } -//#endif JAVA8 - - /** - * Registers the designated output parameter. - * This version of - * the method {@code registerOutParameter} - * should be used for a user-defined or {@code REF} output parameter. - * Examples - * of user-defined types include: {@code STRUCT}, {@code DISTINCT}, - * {@code JAVA_OBJECT}, and named array types. - *

    - * All OUT parameters must be registered - * before a stored procedure is executed. - *

    For a user-defined parameter, the fully-qualified SQL - * type name of the parameter should also be given, while a {@code REF} - * parameter requires that the fully-qualified type name of the - * referenced type be given. A JDBC driver that does not need the - * type code and type name information may ignore it. To be portable, - * however, applications should always provide these values for - * user-defined and {@code REF} parameters. - * - * Although it is intended for user-defined and {@code REF} parameters, - * this method may be used to register a parameter of any JDBC type. - * If the parameter does not have a user-defined or {@code REF} type, the - * typeName parameter is ignored. - * - *

    Note: When reading the value of an out parameter, you - * must use the getter method whose Java type corresponds to the - * parameter's registered SQL type. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterIndex the first parameter is 1, the second is 2,... - * @param sqlType the JDBC type code defined by {@code SQLType} to use to - * register the OUT Parameter. - * @param typeName the fully-qualified name of an SQL structured type - * @exception SQLException if the parameterIndex is not valid; - * if a database access error occurs or - * this method is called on a closed {@code CallableStatement} - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified sqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void registerOutParameter (int parameterIndex, SQLType sqlType, - String typeName) throws SQLException { - registerOutParameter(parameterIndex,sqlType.getVendorTypeNumber(), typeName); - } -//#endif JAVA8 - - /** - * Registers the OUT parameter named - * parameterName to the JDBC type - * {@code sqlType}. All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by {@code sqlType} for an OUT - * parameter determines the Java type that must be used - * in the {@code get} method to read the value of that parameter. - *

    - * If the JDBC type expected to be returned to this output parameter - * is specific to this particular database, {@code sqlType} - * should be {@code JDBCType.OTHER} or a {@code SQLType} that is supported - * by the JDBC driver. The method - * {@link #getObject} retrieves the value. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterName the name of the parameter - * @param sqlType the JDBC type code defined by {@code SQLType} to use to - * register the OUT Parameter. - * If the parameter is of JDBC type {@code JDBCType.NUMERIC} - * or {@code JDBCType.DECIMAL}, the version of - * {@code registerOutParameter} that accepts a scale value - * should be used. - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed {@code CallableStatement} - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified sqlType - * or if the JDBC driver does not support - * this method - * @since 1.8 - * @see JDBCType - * @see SQLType - */ -//#ifdef JAVA8 - public void registerOutParameter(String parameterName, SQLType sqlType) - throws SQLException { - registerOutParameter(parameterName,sqlType.getVendorTypeNumber()); - } -//#endif JAVA8 - - /** - * Registers the parameter named - * parameterName to be of JDBC type - * {@code sqlType}. All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * The JDBC type specified by {@code sqlType} for an OUT - * parameter determines the Java type that must be used - * in the {@code get} method to read the value of that parameter. - *

    - * This version of {@code registerOutParameter} should be - * used when the parameter is of JDBC type {@code JDBCType.NUMERIC} - * or {@code JDBCType.DECIMAL}. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterName the name of the parameter - * @param sqlType the JDBC type code defined by {@code SQLType} to use to - * register the OUT Parameter. - * @param scale the desired number of digits to the right of the - * decimal point. It must be greater than or equal to zero. - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed {@code CallableStatement} - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified sqlType - * or if the JDBC driver does not support - * this method - * @since 1.8 - * @see JDBCType - * @see SQLType - */ -//#ifdef JAVA8 - public void registerOutParameter(String parameterName, SQLType sqlType, - int scale) throws SQLException { - registerOutParameter(parameterName,sqlType.getVendorTypeNumber(), scale); - } -//#endif JAVA8 - - /** - * Registers the designated output parameter. This version of - * the method {@code registerOutParameter} - * should be used for a user-named or REF output parameter. Examples - * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and - * named array types. - *

    - * All OUT parameters must be registered - * before a stored procedure is executed. - *

    - * For a user-named parameter the fully-qualified SQL - * type name of the parameter should also be given, while a REF - * parameter requires that the fully-qualified type name of the - * referenced type be given. A JDBC driver that does not need the - * type code and type name information may ignore it. To be portable, - * however, applications should always provide these values for - * user-named and REF parameters. - * - * Although it is intended for user-named and REF parameters, - * this method may be used to register a parameter of any JDBC type. - * If the parameter does not have a user-named or REF type, the - * typeName parameter is ignored. - * - *

    Note: When reading the value of an out parameter, you - * must use the {@code getXXX} method whose Java type XXX corresponds to the - * parameter's registered SQL type. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterName the name of the parameter - * @param sqlType the JDBC type code defined by {@code SQLType} to use to - * register the OUT Parameter. - * @param typeName the fully-qualified name of an SQL structured type - * @exception SQLException if parameterName does not correspond to a named - * parameter; if a database access error occurs or - * this method is called on a closed {@code CallableStatement} - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified sqlType - * or if the JDBC driver does not support this method - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void registerOutParameter (String parameterName, SQLType sqlType, - String typeName) throws SQLException { - registerOutParameter(parameterName,sqlType.getVendorTypeNumber(), typeName); - } -//#endif JAVA8 - -// --------------------------- Internal Implementation ------------------------- - - /** parameter name maps to parameter index */ - private IntValueHashMap parameterNameMap; - private boolean wasNullValue; - - /* parameter index => registered OUT type */ - -// private IntKeyIntValueHashMap outRegistrationMap; - - /** - * Constructs a new JDBCCallableStatement with the specified connection and - * result type. - * - * @param c the connection on which this statement will execute - * @param sql the SQL statement this object represents - * @param resultSetType the type of result this statement will produce - * @param resultSetConcurrency (updatability) - * @param resultSetHoldability (validity beyond commit) - * @throws HsqlException if the statement is not accepted by the database - * @throws SQLException if preprocessing by driver fails - */ - public JDBCCallableStatement( - JDBCConnection c, String sql, int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) throws HsqlException, SQLException { - - super(c, sql, resultSetType, resultSetConcurrency, - resultSetHoldability, ResultConstants.RETURN_NO_GENERATED_KEYS, - null, null); - - String[] names; - String name; - - // outRegistrationMap = new IntKeyIntValueHashMap(); - parameterNameMap = new IntValueHashMap(); - - if (parameterMetaData != null) { - names = parameterMetaData.columnLabels; - - for (int i = 0; i < names.length; i++) { - name = names[i]; - - // PRE: should never happen in practice - if (name == null || name.isEmpty()) { - continue; // throw? - } - parameterNameMap.put(name, i); - } - } - } - - void fetchResult() throws SQLException { - - super.fetchResult(); - - if (resultIn.getType() == ResultConstants.CALL_RESPONSE) { - Object[] data = resultIn.getParameterData(); - - System.arraycopy(data, 0, parameterValues, 0, parameterValues.length); - } - } - - /** - * Retrieves the parameter index corresponding to the given - * parameter name.

    - * - * @param parameterName to look up - * @throws SQLException if not found - * @return index for name - */ - int findParameterIndex(String parameterName) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (parameterName == null) { - throw JDBCUtil.nullArgument(); - } - - int index = parameterNameMap.get(parameterName, -1); - - if (index >= 0) { - return index + 1; - } - - index = parameterNameMap.get(parameterName.toUpperCase(Locale.ENGLISH), - -1); - - if (index >= 0) { - return index + 1; - } - - throw JDBCUtil.sqlException(ErrorCode.JDBC_COLUMN_NOT_FOUND, - parameterName); - } - - /** - * Does the specialized work required to free this object's resources and - * that of its parent classes.

    - * - * @throws SQLException if a database access error occurs - */ - public synchronized void close() throws SQLException { - - if (isClosed()) { - return; - } - - // outRegistrationMap = null; - parameterNameMap = null; - - super.close(); - } - - /* - * Checks if the parameter of the given index has been successfully - * registered as an OUT parameter.

    - * - * @param parameterIndex to check - * @throws SQLException if not registered - */ -/* - private void checkIsRegisteredParameterIndex(int parameterIndex) - throws SQLException { - - int type; - String msg; - - checkClosed(); - - type = outRegistrationMap.get(parameterIndex, Integer.MIN_VALUE); - - if (type == Integer.MIN_VALUE) { - msg = "Parameter not registered: " + parameterIndex; //NOI18N - - throw JDBCUtil.sqlException(ErrorCode.INVALID_JDBC_ARGUMENT, msg); - } - } -*/ - - /** - * Internal get value. - */ - protected Object getColumnValue(int columnIndex) throws SQLException { - - checkGetParameterIndex(columnIndex); - - Object value = parameterValues[columnIndex - 1]; - - trackNull(value); - - return value; - } - - /** - * Internal value converter. Similar to its counterpart in JDBCResultSet

    - * - * All trivially successful getXXX methods eventually go through this - * method, converting if necessary from the source type to the - * requested type.

    - * - * Conversion to the JDBC representation, if different, is handled by the - * calling methods. - * - * @param columnIndex of the column value for which to perform the - * conversion - * @param targetType the org.hsqldb.types.Type object for targetType - * @return an Object of the requested targetType, representing the value of the - * specified column - * @throws SQLException when there is no rowData, the column index is - * invalid, or the conversion cannot be performed - */ - private Object getColumnInType(int columnIndex, - Type targetType) throws SQLException { - - checkGetParameterIndex(columnIndex); - - Type sourceType; - Object value; - - sourceType = parameterTypes[--columnIndex]; - value = parameterValues[columnIndex]; - - if (trackNull(value)) { - return null; - } - - if (sourceType.typeCode != targetType.typeCode) { - try { - value = targetType.convertToTypeJDBC(session, value, - sourceType); - } catch (HsqlException e) { - String stringValue = - (value instanceof Number || value instanceof String - || value instanceof java.util.Date) ? value.toString() - : "instance of " + value.getClass().getName(); - String msg = "from SQL type " + sourceType.getNameString() - + " to " + targetType.getJDBCClassName() - + ", value: " + stringValue; - - throw JDBCUtil.sqlException(ErrorCode.X_42561, msg); - } - } - - return value; - } - - private Object getTimestampWithZone(int columnIndex) throws SQLException { - TimestampData v = (TimestampData) getColumnInType(columnIndex, - Type.SQL_TIMESTAMP_WITH_TIME_ZONE); - - if (v == null) { - return null; - } - return Type.SQL_TIMESTAMP_WITH_TIME_ZONE.convertSQLToJava(session, v); - } - - private Object getTimeWithZone(int columnIndex) throws SQLException { - TimeData v = (TimeData) getColumnInType(columnIndex, - Type.SQL_TIME_WITH_TIME_ZONE); - - if (v == null) { - return null; - } - return Type.SQL_TIME_WITH_TIME_ZONE.convertSQLToJava(session, v); - } - - private boolean trackNull(Object o) { - return (wasNullValue = (o == null)); - } - - public void closeOnCompletion() throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean isCloseOnCompletion() throws SQLException { - throw new UnsupportedOperationException("Not supported yet."); - } - - /** - * - * Executes the SQL query in this PreparedStatement object - * and returns the ResultSet object generated by the query. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this method for a call to a FUNCTION that returns a result. - * For a PROCEDURE that returns one or more results, the first result is - * returned.

    - * - * If the FUNCTION or PROCEDURE does not return a ResultSet, an - * SQLException is thrown. - *

    - * - * - * @return a ResultSet object that contains the data produced by the - * query; never null - * @exception SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement or the SQL - * statement does not return a ResultSet object - */ - public synchronized ResultSet executeQuery() throws SQLException { - - fetchResult(); - - ResultSet rs = getResultSet(); - - if (rs != null) { - return rs; - } - - if (getMoreResults()) { - return getResultSet(); - } - - throw JDBCUtil.sqlException(ErrorCode.X_07504); - } - - -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCClob.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCClob.java deleted file mode 100644 index 60693303..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCClob.java +++ /dev/null @@ -1,1070 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.ByteArrayInputStream; -import java.io.CharArrayReader; -import java.io.Reader; -import java.io.StringReader; -import java.sql.Clob; -import java.sql.SQLException; - -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.java.JavaSystem; - -/* $Id: JDBCClob.java 6656 2023-05-29 15:55:53Z fredt $ */ - -// campbell-burnet@users 2004-03/04-xx - doc 1.7.2 - javadocs updated; methods put in -// correct (historical, interface -// declared) order -// campbell-burnet@users 2004-03/04-xx - patch 1.7.2 - null check for constructor (a -// null CLOB value is Java null, -// not a Clob object with null -// data);moderate thread safety; -// simplification; optimization -// of operations between jdbcClob -// instances -// campbell-burnet@users 2005-12-07 - patch 1.8.0.x - initial JDBC 4.0 support work -// campbell-burnet@users 2006-05-22 - doc 1.9.0 - full synch up to Mustang Build 84 -// - patch 1.9.0 - setAsciiStream & -// setCharacterStream improvement -// patch 1.9.0 -// - full synch up to Mustang b90 -// - better bounds checking - -/** - * The mapping in the Java™ programming language for the SQL CLOB type. - * An SQL CLOB is a built-in type - * that stores a Character Large Object as a column value in a row of - * a database table. - * By default drivers implement a Clob object using an SQL - * locator(CLOB), which means that a Clob object - * contains a logical pointer to the SQL CLOB data rather than - * the data itself. A Clob object is valid for the duration - * of the transaction in which it was created. - *

    The Clob interface provides methods for getting the - * length of an SQL CLOB (Character Large Object) value, - * for materializing a CLOB value on the client, and for - * searching for a substring or CLOB object within a - * CLOB value. - * Methods in the interfaces {@link java.sql.ResultSet}, - * {@link java.sql.CallableStatement}, and {@link java.sql.PreparedStatement}, such as - * getClob and setClob allow a programmer to - * access an SQL CLOB value. In addition, this interface - * has methods for updating a CLOB value. - *

    - * All methods on the Clob interface must be fully implemented if the - * JDBC driver supports the data type. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Previous to 2.0, the HSQLDB driver did not implement Clob using an SQL - * locator(CLOB). That is, an HSQLDB Clob object did not contain a logical - * pointer to SQL CLOB data; rather it directly contained a representation of - * the data (a String). As a result, an HSQLDB Clob object was itself - * valid beyond the duration of the transaction in which is was created, - * although it did not necessarily represent a corresponding value - * on the database. Also, the interface methods for updating a CLOB value - * were unsupported, with the exception of the truncate method, - * in that it could be used to truncate the local value.

    - * - * Starting with 2.0, the HSQLDB driver fully supports both local and remote - * SQL CLOB data implementations, meaning that an HSQLDB Clob object may - * contain a logical pointer to remote SQL CLOB data (see {@link JDBCClobClient - * JDBCClobClient}) or it may directly contain a local representation of the - * data (as implemented in this class). In particular, when the product is built - * under JDK 1.6+ and the Clob instance is constructed as a result of calling - * JDBCConnection.createClob(), then the resulting Clob instance is initially - * disconnected (is not bound to the transaction scope of the vending Connection - * object), the data is contained directly and all interface methods for - * updating the CLOB value are supported for local use until the first - * invocation of free(); otherwise, an HSQLDB Clob's implementation is - * determined at runtime by the driver, it is typically not valid beyond - * the duration of the transaction in which is was created, and there no - * standard way to query whether it represents a local or remote value.

    - * - *

    - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.5.0 - * @since JDK 1.2, HSQLDB 1.7.2 - */ -public class JDBCClob implements Clob { - - /** - * Retrieves the number of characters - * in the CLOB value - * designated by this Clob object. - * - * @return length of the CLOB in characters - * @exception SQLException if there is an error accessing the - * length of the CLOB value - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public long length() throws SQLException { - return getData().length(); - } - - /** - * Retrieves a copy of the specified substring - * in the CLOB value - * designated by this Clob object. - * The substring begins at position - * pos and has up to length consecutive - * characters. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The official specification above is ambiguous in that it does not - * precisely indicate the policy to be observed when - * {@code pos > this.length() - length}. One policy would be to retrieve - * the characters from {@code pos} to {@code this.length()}. Another would - * be to throw an exception. This class observes the second policy.

    - * - * Note

    - * - * This method uses {@link java.lang.String#substring(int, int)}. - *

    - * Depending on implementation (typically JDK 6 and earlier releases), the - * returned value may be sharing the underlying (and possibly much larger) - * character buffer. Depending on factors such as hardware acceleration for - * array copies, the average length and number of sub-strings taken, and so - * on, this may or may not result in faster operation and - * non-trivial memory savings. On the other hand, Oracle / OpenJDK 7, it - * was decided that the memory leak implications outweigh the benefits - * of buffer sharing for most use cases on modern hardware. - *

    - * It is left up to any client of this method to determine if this is a - * potential factor relative to the target runtime and to decide how to - * handle space-time trade-offs (i.e. whether to make an isolated copy of - * the returned substring or risk that more memory remains allocated than - * is absolutely required). - *

    - * - * - * @param pos the first character of the substring to be extracted. - * The first character is at position 1. - * @param length the number of consecutive characters to be copied; - * JDBC 4.1[ the value for length must be 0 or greater] - * @return a String that is the specified substring in - * the CLOB value designated by this Clob object - * @exception SQLException if there is an error accessing the - * CLOB value; if pos is less than 1 JDBC 4.1[or length is - * less than 0] - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public String getSubString(final long pos, - final int length) throws SQLException { - - final String data = getData(); - final int dlen = data.length(); - - if (pos == MIN_POS && length == dlen) { - return data; - } - - if (pos < MIN_POS || pos > dlen) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - final long index = pos - 1; - - if (length < 0 || length > dlen - index) { - throw JDBCUtil.outOfRangeArgument("length: " + length); - } - - return data.substring((int) index, (int) index + length); - } - - /** - * Retrieves the CLOB value designated by this Clob - * object as a java.io.Reader object (or as a stream of - * characters). - * - * @return a java.io.Reader object containing the - * CLOB data - * @exception SQLException if there is an error accessing the - * CLOB value - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setCharacterStream - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public java.io.Reader getCharacterStream() throws SQLException { - return new StringReader(getData()); - } - - /** - * Retrieves the CLOB value designated by this Clob - * object as an ASCII stream. - * - * @return a java.io.InputStream object containing the - * CLOB data - * @exception SQLException if there is an error accessing the - * CLOB value - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setAsciiStream - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public java.io.InputStream getAsciiStream() throws SQLException { - - try { - return new ByteArrayInputStream( - getData().getBytes(JavaSystem.CS_US_ASCII)); - } catch (Throwable e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves the character position at which the specified substring - * searchstr appears in the SQL CLOB value - * represented by this Clob object. The search - * begins at position start. - * - * @param searchstr the substring for which to search - * @param start the position at which to begin searching; the first position - * is 1 - * @return the position at which the substring appears or -1 if it is not - * present; the first position is 1 - * @exception SQLException if there is an error accessing the - * CLOB value or if start is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public long position(final String searchstr, - long start) throws SQLException { - - final String data = getData(); - - if (start < MIN_POS) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } - - if (searchstr == null || start > MAX_POS) { - return -1; - } - - final int position = data.indexOf(searchstr, (int) start - 1); - - return (position == -1) ? -1 - : position + 1; - } - - /** - * Retrieves the character position at which the specified - * Clob object searchstr appears in this - * Clob object. The search begins at position - * start. - * - * @param searchstr the Clob object for which to search - * @param start the position at which to begin searching; the first - * position is 1 - * @return the position at which the Clob object appears - * or -1 if it is not present; the first position is 1 - * @exception SQLException if there is an error accessing the - * CLOB value or if start is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2, HSQLDB 1.7.2 - */ - public long position(final Clob searchstr, - final long start) throws SQLException { - - final String data = getData(); - - if (start < MIN_POS) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } - - if (searchstr == null) { - return -1; - } - - final long dlen = data.length(); - final long sslen = searchstr.length(); - final long startIndex = start - 1; - - // This is potentially much less expensive than materializing a large - // substring from some other vendor's CLOB. Indeed, we should probably - // do the comparison piecewise, using an in-memory buffer (or temp-files - // when available), if it is detected that the input CLOB is very long. - if (startIndex > dlen - sslen) { - return -1; - } - - // by now, we know sslen and startIndex are both < Integer.MAX_VALUE - String pattern; - - if (searchstr instanceof JDBCClob) { - pattern = ((JDBCClob) searchstr).getData(); - } else { - pattern = searchstr.getSubString(1L, (int) sslen); - } - - final int index = data.indexOf(pattern, (int) startIndex); - - return (index == -1) ? -1 - : index + 1; - } - - //---------------------------- jdbc 3.0 ----------------------------------- - - /** - * Writes the given Java String to the CLOB - * value that this Clob object designates at the position - * pos. The string will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing the given string, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is supported.

    - * - * When built under JDK 1.6+ and the Clob instance is constructed as a - * result of calling JDBCConnection.createClob(), this operation affects - * only the client-side value; it has no effect upon a value stored in the - * database because JDBCConnection.createClob() constructs disconnected, - * initially empty Clob instances. To propagate the Clob value to a database - * in this case, it is required to supply the Clob instance to an updating - * or inserting setXXX method of a Prepared or Callable Statement, or to - * supply the Clob instance to an updateXXX method of an updateable - * ResultSet.

    - * - * Implementation Notes:

    - * - * No attempt is made to ensure precise thread safety. Instead, volatile - * member field and local variable snapshot isolation semantics are - * implemented. This is expected to eliminate most issues related - * to race conditions, with the possible exception of concurrent - * invocation of free().

    - * - * In general, if an application may perform concurrent JDBCClob - * modifications and the integrity of the application depends on total order - * Clob modification semantics, then such operations should be synchronized - * on an appropriate monitor.

    - * - * When the value specified for pos is greater then the - * length+1, then the CLOB value is extended in length to accept the - * written characters and the undefined region up to @{code pos} is filled - * with with space (' ') characters. - * - * - *

    - * - * - * @param pos the position at which to start writing to the CLOB - * value that this Clob object represents; - * The first position is 1 - * @param str the string to be written to the CLOB - * value that this Clob designates - * @return the number of characters written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int setString(long pos, String str) throws SQLException { - return setString(pos, str, 0, str == null ? 0 - : str.length()); - } - - /** - * Writes len characters of str, starting - * at character offset, to the CLOB value - * that this Clob represents. The string will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing the given string, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is supported.

    - * - * When built under JDK 1.6+ and the Clob instance is constructed as a - * result of calling JDBCConnection.createClob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createClob() constructs disconnected, - * initially empty Clob instances. To propagate the Clob value to a database - * in this case, it is required to supply the Clob instance to an updating - * or inserting setXXX method of a Prepared or Callable Statement, or to - * supply the Clob instance to an updateXXX method of an updateable - * ResultSet.

    - * - * Implementation Notes:

    - * - * If the value specified for pos - * is greater than the length of the CLOB value, then - * the CLOB value is extended in length to accept the - * written characters and the undefined region up to pos is - * filled with space (' ') characters.

    - * - * No attempt is made to ensure precise thread safety. Instead, volatile - * member field and local variable snapshot isolation semantics are - * implemented. This is expected to eliminate most issues related - * to race conditions, with the possible exception of concurrent - * invocation of free().

    - * - * In general, if an application may perform concurrent JDBCClob - * modifications and the integrity of the application depends on total order - * Clob modification semantics, then such operations should be synchronized - * on an appropriate monitor.

    - * - *

    - * - * - * @param pos the position at which to start writing to this - * CLOB object; The first position is 1 - * @param str the string to be written to the CLOB - * value that this Clob object represents - * @param offset the offset into str to start reading - * the characters to be written - * @param len the number of characters to be written - * @return the number of characters written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int setString(final long pos, final String str, final int offset, - final int len) throws SQLException { - - checkReadonly(); - - final String data = getData(); - - if (str == null) { - throw JDBCUtil.nullArgument("str"); - } - - final int strlen = str.length(); - final int dlen = data.length(); - final int ipos = (int) (pos - 1); - - if (offset == 0 && len == strlen && ipos == 0 && len >= dlen) { - setData(str); - - return len; - } - - if (offset < 0 || offset > strlen) { - throw JDBCUtil.outOfRangeArgument("offset: " + offset); - } - - if (len < 0 || len > strlen - offset) { - throw JDBCUtil.outOfRangeArgument("len: " + len); - } - - if (pos < MIN_POS || (pos - MIN_POS) > (Integer.MAX_VALUE - len)) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - final long endPos = (pos + len); - char[] chars; - - if (pos > dlen) { - - // 1.) 'datachars' + '\32\32\32...' + substring - chars = new char[(int) endPos - 1]; - - data.getChars(0, dlen, chars, 0); - - for (int i = dlen; i < ipos; i++) { - chars[i] = ' '; - } - - str.getChars(offset, offset + len, chars, ipos); - } else if (endPos > dlen) { - - // 2.) 'datach...' + substring - chars = new char[(int) endPos - 1]; - - data.getChars(0, ipos, chars, 0); - str.getChars(offset, offset + len, chars, ipos); - } else { - - // 3.) 'dat' + substring + 'rs' - chars = new char[dlen]; - - data.getChars(0, ipos, chars, 0); - str.getChars(offset, offset + len, chars, ipos); - - final int dataOffset = ipos + len; - - data.getChars(dataOffset, dlen, chars, dataOffset); - } - - setData(new String(chars)); - - return len; - } - - /** - * Retrieves a stream to be used to write ASCII characters to the - * CLOB value that this Clob object represents, - * starting at position pos. Characters written to the stream - * will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing characters to the stream, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length of the CLOB value, then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is supported.

    - * - * When built under JDK 1.6+ and the Clob instance is constructed as a - * result of calling JDBCConnection.createClob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createClob() constructs disconnected, - * initially empty Clob instances. To propagate the Clob value to a database - * in this case, it is required to supply the Clob instance to an updating - * or inserting setXXX method of a Prepared or Callable Statement, or to - * supply the Clob instance to an updateXXX method of an updatable - * ResultSet.

    - * - * Implementation Notes:

    - * - * The data written to the stream does not appear in this - * Clob until the stream is closed.

    - * - * When the stream is closed, if the value specified for pos - * is greater than the length of the CLOB value, then - * the CLOB value is extended in length to accept the - * written characters and the undefined region up to pos is - * filled with space (' ') characters.

    - * - * Also, no attempt is made to ensure precise thread safety. Instead, - * volatile member field and local variable snapshot isolation semantics - * are implemented. This is expected to eliminate most issues related - * to race conditions, with the possible exception of concurrent - * invocation of free().

    - * - * In general, if an application may perform concurrent JDBCClob - * modifications and the integrity of the application depends on total order - * Clob modification semantics, then such operations should be synchronized - * on an appropriate monitor.

    - * - *

    - * - * - * @param pos the position at which to start writing to this - * CLOB object; The first position is 1 - * @return the stream to which ASCII encoded characters can be written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getAsciiStream - * - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public java.io.OutputStream setAsciiStream(final long pos) - throws SQLException { - - checkReadonly(); - checkClosed(); - - if (pos < MIN_POS || pos > MAX_POS) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - return new java.io.ByteArrayOutputStream() { - - boolean closed = false; - - public synchronized void close() throws java.io.IOException { - - if (closed) { - return; - } - - closed = true; - - final byte[] bytes = super.buf; - final int length = super.count; - - super.buf = null; - super.count = 0; - - try { - final String str = new String(bytes, 0, length, - JavaSystem.CS_US_ASCII); - - JDBCClob.this.setString(pos, str); - } catch (Throwable e) { - throw JavaSystem.toIOException(e); - } - } - }; - } - - /** - * Retrieves a stream to be used to write a stream of Unicode characters - * to the CLOB value that this Clob object - * represents, at position pos. Characters written to the stream - * will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing characters to the stream, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is supported.

    - * - * When built under JDK 1.6+ and the Clob instance is constructed as a - * result of calling JDBCConnection.createClob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createClob() constructs disconnected, - * initially empty Clob instances. To propagate the Clob value to a database - * in this case, it is required to supply the Clob instance to an updating - * or inserting setXXX method of a Prepared or Callable Statement, or to - * supply the Clob instance to an updateXXX method of an updateable - * ResultSet.

    - * - * Implementation Notes:

    - * - * The data written to the stream does not appear in this - * Clob until the stream is closed.

    - * - * When the stream is closed, if the value specified for pos - * is greater than the length of the CLOB value, then - * the CLOB value is extended in length to accept the - * written characters and the undefined region up to pos is - * filled with space (' ') characters.

    - * - * Also, no attempt is made to ensure precise thread safety. Instead, - * volatile member field and local variable snapshot isolation semantics - * are implemented. This is expected to eliminate most issues related - * to race conditions, with the possible exception of concurrent - * invocation of free().

    - * - * In general, if an application may perform concurrent JDBCClob - * modifications and the integrity of the application depends on - * total order Clob modification semantics, then such operations - * should be synchronized on an appropriate monitor.

    - * - *

    - * - * - * @param pos the position at which to start writing to the - * CLOB value; The first position is 1 - * - * @return a stream to which Unicode encoded characters can be written - * @exception SQLException if there is an error accessing the - * CLOB value or if {@code pos} is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getCharacterStream - * - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public java.io.Writer setCharacterStream(final long pos) - throws SQLException { - - checkReadonly(); - checkClosed(); - - if (pos < MIN_POS || pos > MAX_POS) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - return new java.io.StringWriter() { - - private boolean closed = false; - - public synchronized void close() throws java.io.IOException { - - if (closed) { - return; - } - - closed = true; - - final StringBuffer sb = super.getBuffer(); - - try { - JDBCClob.this.setStringBuffer(pos, sb, 0, sb.length()); - } catch (SQLException se) { - throw JavaSystem.toIOException(se); - } finally { - sb.setLength(0); - sb.trimToSize(); - } - } - }; - } - - /** - * Truncates the CLOB value that this Clob - * designates to have a length of len - * characters. - *

    - * Note: If the value specified for len - * is greater than the length of the CLOB value, then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0 this feature is fully supported.

    - * - * When built under JDK 1.6+ and the Clob instance is constructed as a - * result of calling JDBCConnection.createClob(), this operation affects - * only the client-side value; it has no effect upon a value stored in a - * database because JDBCConnection.createClob() constructs disconnected, - * initially empty Blob instances. To propagate the truncated Clob value to - * a database in this case, it is required to supply the Clob instance to - * an updating or inserting setXXX method of a Prepared or Callable - * Statement, or to supply the Blob instance to an updateXXX method of an - * updateable ResultSet.

    - * - * Implementation Notes:

    - * - * HSQLDB throws an SQLException if the specified len is greater - * than the value returned by {@link #length() length}.

    - * - *

    - * - * - * @param len the length, in characters, to which the CLOB value - * should be truncated - * @exception SQLException if there is an error accessing the - * CLOB value or if len is less than 0 - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public void truncate(final long len) throws SQLException { - - checkReadonly(); - - final String data = getData(); - final long dlen = data.length(); - - if (len == dlen) { - return; - } - - if (len < 0 || len > dlen) { - throw JDBCUtil.outOfRangeArgument("len: " + len); - } - - setData(data.substring(0, (int) len)); - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * This method frees the Clob object and releases the resources - * that it holds. The object is invalid once the free method - * is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - *

    - * @throws SQLException if an error occurs releasing - * the Clob's resources - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void free() throws SQLException { - m_closed = true; - m_data = null; - } - - /** - * Returns a Reader object that contains a partial Clob value, starting - * with the character specified by pos, which is length characters in length. - * - * @param pos the offset to the first character of the partial value to - * be retrieved. The first character in the Clob is at position 1. - * @param length the length in characters of the partial value to be retrieved. - * @return Reader through which the partial Clob value can be read. - * @throws SQLException if pos is less than 1 or if pos is greater than the number of - * characters in the Clob or if pos + length is greater than the number of - * characters in the Clob - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public Reader getCharacterStream(long pos, - long length) throws SQLException { - - if (length > Integer.MAX_VALUE) { - throw JDBCUtil.outOfRangeArgument("length: " + length); - } - - final String data = getData(); - final int dlen = data.length(); - - if (pos == MIN_POS && length == dlen) { - return new StringReader(data); - } - - if (pos < MIN_POS || pos > dlen) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - final long startIndex = pos - 1; - - if (length < 0 || length > dlen - startIndex) { - throw JDBCUtil.outOfRangeArgument("length: " + length); - } - - final int endIndex = (int) (startIndex + length); // exclusive - final char[] chars = new char[(int) length]; - - data.getChars((int) startIndex, endIndex, chars, 0); - - return new CharArrayReader(chars); - } - - // ---------------------- internal implementation -------------------------- - private static final long MIN_POS = 1L; - private static final long MAX_POS = 1L + (long) Integer.MAX_VALUE; - private boolean m_closed; - private String m_data; - private final boolean m_createdByConnection; - - /** - * Constructs a new, read-only JDBCClob object wrapping the given character - * sequence.

    - * - * This constructor is used internally to retrieve result set values as - * Clob objects, yet it must be public to allow access from other packages. - * As such (in the interest of efficiency) this object maintains a reference - * to the given String object rather than making a copy and so it is - * gently suggested (in the interest of effective memory management) that - * external clients using this constructor either take pause to consider - * the implications or at least take care to provide a String object whose - * internal character buffer is not much larger than required to represent - * the value. - * - * @param data the character sequence representing the Clob value - * @throws SQLException if the argument is null - */ - public JDBCClob(final String data) throws SQLException { - - if (data == null) { - throw JDBCUtil.nullArgument(); - } - - m_data = data; - m_createdByConnection = false; - } - - /** - * Constructs a new, empty (zero-length), read/write JDBCClob object. - */ - protected JDBCClob() { - m_data = ""; - m_createdByConnection = true; - } - - protected void checkReadonly() throws SQLException { - - if (!m_createdByConnection) { - throw JDBCUtil.sqlException(ErrorCode.X_25006, - "Clob is read-only"); - } - } - - protected synchronized void checkClosed() throws SQLException { - - if (m_closed) { - throw JDBCUtil.sqlException(ErrorCode.X_07501); - } - } - - synchronized String getData() throws SQLException { - - checkClosed(); - - return m_data; - } - - private synchronized void setData(String data) throws SQLException { - - checkClosed(); - - m_data = data; - } - - /** - * Behaviour is identical to {@link #setString(long, java.lang.String, int, int)}. - * - * @param pos the position at which to start writing to this - * CLOB object; The first position is 1 - * @param sb the buffer to be written to the CLOB - * value that this Clob object represents - * @param offset the offset into sb to start reading - * the characters to be written - * @param len the number of characters to be written - * @return the number of characters written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - */ - public int setStringBuffer(final long pos, final StringBuffer sb, - final int offset, - final int len) throws SQLException { - - checkReadonly(); - - String data = getData(); - - if (sb == null) { - throw JDBCUtil.nullArgument("sb"); - } - - final int strlen = sb.length(); - final int dlen = data.length(); - final int ipos = (int) (pos - 1); - - if (offset == 0 && len == strlen && ipos == 0 && len >= dlen) { - setData(sb.toString()); - - return len; - } - - if (offset < 0 || offset > strlen) { - throw JDBCUtil.outOfRangeArgument("offset: " + offset); - } - - if (len > strlen - offset) { - throw JDBCUtil.outOfRangeArgument("len: " + len); - } - - if (pos < MIN_POS || (pos - MIN_POS) > (Integer.MAX_VALUE - len)) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - final long endPos = (pos + len); - char[] chars; - - if (pos > dlen) { - - // 1.) 'datachars' + '\32\32\32...' + substring - chars = new char[(int) endPos - 1]; - - data.getChars(0, dlen, chars, 0); - - for (int i = dlen; i < ipos; i++) { - chars[i] = ' '; - } - - sb.getChars(offset, offset + len, chars, ipos); - } else if (endPos > dlen) { - - // 2.) 'datach...' + substring - chars = new char[(int) endPos - 1]; - - data.getChars(0, ipos, chars, 0); - sb.getChars(offset, offset + len, chars, ipos); - } else { - - // 3.) 'dat' + substring + 'rs' - chars = new char[dlen]; - - data.getChars(0, ipos, chars, 0); - sb.getChars(offset, offset + len, chars, ipos); - - final int dataOffset = ipos + len; - - data.getChars(dataOffset, dlen, chars, dataOffset); - } - - setData(new String(chars)); - - return len; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCClobClient.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCClobClient.java deleted file mode 100644 index 0b518547..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCClobClient.java +++ /dev/null @@ -1,609 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import java.sql.Clob; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; - -import org.hsqldb.HsqlException; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.types.ClobDataID; -import org.hsqldb.types.ClobInputStream; - -/** - * A wrapper for HSQLDB ClobData objects. - * - * Instances of this class are returned by calls to ResultSet methods. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.1 - * @since HSQLDB 1.9.0 - */ -public class JDBCClobClient implements Clob { - - /** - * Retrieves the CLOB value designated by this - * Clob object as an ascii stream. - * - * The ascii stream consists of the low ordre bytes of UTF-16 characters - * in the clob. The question mark character is returnd for UTF-16 characters - * beyond the range of 8-bit ASCII. - * - * @return a java.io.InputStream object containing the - * CLOB data - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized InputStream getAsciiStream() throws SQLException { - - checkClosed(); - - return new InputStream() { - - private Reader reader = clob.getCharacterStream(session); - - public int read() throws IOException { - - int c = reader.read(); - - if (c < 0) { - return -1; - } - - if (c >= 256) { - if (Character.isHighSurrogate((char) c)) { - reader.read(); - } - - c = '?'; - } - - return c; - } - - public int read(byte[] b, int off, int len) throws IOException { - - if (b == null) { - throw new NullPointerException(); - } - - if (off < 0 || len < 0 || len > b.length - off) { - throw new IndexOutOfBoundsException(); - } - - if (len == 0) { - return 0; - } - - int bytesRead = 0; - - for (int i = 0; i < len; i++) { - int c = reader.read(); - - if (c < 0) { - break; - } - - if (c >= 256) { - if (Character.isHighSurrogate((char) c)) { - reader.read(); - } - - c = '?'; - } - - b[off + i] = (byte) c; - - bytesRead++; - } - - return bytesRead == 0 ? -1 : bytesRead; - } - - public void close() throws IOException { - - try { - reader.close(); - } catch (Exception ex) {} - } - }; - } - - /** - * Retrieves the CLOB value designated by this - * Clob object as a java.io.Reader object (or - * as a stream of characters). - * - * @return a java.io.Reader object containing the - * CLOB data - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized Reader getCharacterStream() throws SQLException { - - checkClosed(); - - return new ClobInputStream(session, clob, 0, length()); - } - - /** - * Retrieves a copy of the specified substring in the CLOB - * value designated by this Clob object. - * - * @param pos the first character of the substring to be extracted. The - * first character is at position 1. - * @param length the number of consecutive characters to be copied - * @return a String that is the specified substring in the - * CLOB value designated by this Clob object - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized String getSubString(long pos, - int length) throws SQLException { - - checkClosed(); - - if (!isInLimits(Long.MAX_VALUE, pos - 1, length)) { - throw JDBCUtil.outOfRangeArgument(); - } - - try { - return clob.getSubString(session, pos - 1, length); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves the number of characters in the CLOB value - * designated by this Clob object. - * - * @return length of the CLOB in characters - * @throws SQLException if there is an error accessing the length of the - * CLOB value - */ - public synchronized long length() throws SQLException { - - checkClosed(); - - try { - return clob.length(session); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves the character position at which the specified substring - * searchstr appears in the SQL CLOB value - * represented by this Clob object. - * - * @param searchstr the substring for which to search - * @param start the position at which to begin searching; the first - * position is 1 - * @return the position at which the substring appears or -1 if it is - * not present; the first position is 1 - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized long position(String searchstr, - long start) throws SQLException { - - checkClosed(); - - if (!isInLimits(Long.MAX_VALUE, start - 1, 0)) { - throw JDBCUtil.outOfRangeArgument(); - } - - try { - return clob.position(session, searchstr, start - 1); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves the character position at which the specified - * Clob object searchstr appears in this - * Clob object. - * - * @param searchstr the Clob object for which to search - * @param start the position at which to begin searching; the first - * position is 1 - * @return the position at which the Clob object appears or - * -1 if it is not present; the first position is 1 - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized long position(Clob searchstr, - long start) throws SQLException { - - checkClosed(); - - if (!isInLimits(Long.MAX_VALUE, start - 1, 0)) { - throw JDBCUtil.outOfRangeArgument(); - } - - if (searchstr instanceof JDBCClobClient) { - ClobDataID searchClob = ((JDBCClobClient) searchstr).clob; - - try { - return clob.position(session, searchClob, start - 1); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - if (!isInLimits(Integer.MAX_VALUE, 0, searchstr.length())) { - throw JDBCUtil.outOfRangeArgument(); - } - - return position(searchstr.getSubString(1, (int) searchstr.length()), - start); - } - - /** - * Retrieves a stream to be used to write Ascii characters to the - * CLOB value that this Clob object represents, - * starting at position pos. - * - * The bytes written to the OutputStream are stored verbatim in the clob as - * the low order bytes of UTF-16 characters. - * - * @param pos the position at which to start writing to this - * CLOB object - * @return the stream to which ASCII encoded characters can be written - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized OutputStream setAsciiStream(final long pos) - throws SQLException { - - return new OutputStream() { - - Writer writer = setCharacterStream(pos); - - public void write(int b) throws IOException { - writer.write(b & 0xff); - } - - public void write(byte[] b, int off, int len) throws IOException { - - if (b == null) { - throw new NullPointerException(); - } - - if (off < 0 || len < 0 || len > b.length - off) { - throw new IndexOutOfBoundsException(); - } - - if (len == 0) { - return; - } - - char[] charArray = new char[len]; - - for (int i = 0; i < len; i++) { - charArray[i] = (char) b[off + i]; - } - - writer.write(charArray, 0, len); - } - - public void close() throws IOException { - writer.close(); - } - }; - } - - /** - * Retrieves a stream to be used to write a stream of Unicode characters - * to the CLOB value that this Clob object - * represents, at position pos. - * - * @param pos the position at which to start writing to the - * CLOB value - * @return a stream to which Unicode encoded characters can be written - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized Writer setCharacterStream(final long pos) - throws SQLException { - - checkClosed(); - - if (pos < 1) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - if (!isWritable) { - throw JDBCUtil.notUpdatableColumn(); - } - - startUpdate(); - - return new Writer() { - - private long m_clobPosition = pos - 1; - private boolean m_closed; - - public void write(char[] cbuf, int off, - int len) throws IOException { - - checkClosed(); - clob.setChars(session, m_clobPosition, cbuf, off, len); - - m_clobPosition += len; - } - - public void flush() throws IOException { - - // no-op - } - - @Override - public void close() throws IOException { - m_closed = true; - } - - private void checkClosed() throws IOException { - - if (m_closed || JDBCClobClient.this.isClosed()) { - throw new IOException("The stream is closed"); - } - } - }; - } - - /** - * Writes the given Java String to the CLOB - * value that this Clob object designates at the position - * pos. - * - * @param pos the position at which to start writing to the - * CLOB value that this Clob object - * represents - * @param str the string to be written to the CLOB value - * that this Clob designates - * @return the number of characters written - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized int setString(long pos, - String str) throws SQLException { - return setString(pos, str, 0, str.length()); - } - - /** - * Writes len characters of str, starting at - * character offset, to the CLOB value that - * this Clob represents. - * - * @param pos the position at which to start writing to this - * CLOB object - * @param str the string to be written to the CLOB value - * that this Clob object represents - * @param offset the offset into str to start reading the - * characters to be written - * @param len the number of characters to be written - * @return the number of characters written - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized int setString(long pos, String str, int offset, - int len) throws SQLException { - - checkClosed(); - - if (!isInLimits(str.length(), offset, len)) { - throw JDBCUtil.outOfRangeArgument(); - } - - if (pos < 1) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - if (!isWritable) { - throw JDBCUtil.notUpdatableColumn(); - } - - try { - startUpdate(); - - str = str.substring(offset, offset + len); - - clob.setString(session, pos - 1, str); - - return len; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Truncates the CLOB value that this Clob - * designates to have a length of len characters. - * - * @param len the length, in bytes, to which the CLOB value - * should be truncated - * @throws SQLException if there is an error accessing the - * CLOB value - */ - public synchronized void truncate(long len) throws SQLException { - - checkClosed(); - - if (len < 0) { - throw JDBCUtil.outOfRangeArgument("len: " + len); - } - - try { - clob.truncate(session, len); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * This method frees the Clob object and releases the resources - * that it holds. The object is invalid once the free method - * is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - *

    - * @throws SQLException if an error occurs releasing - * the Clob's resources - * - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void free() throws SQLException { - - isClosed = true; - clob = null; - session = null; - } - - /** - * Returns a Reader object that contains a partial Clob value, starting - * with the character specified by pos, which is length characters in length. - * - * @param pos the offset to the first character of the partial value to - * be retrieved. The first character in the Clob is at position 1. - * @param length the length in characters of the partial value to be retrieved. - * @return Reader through which the partial Clob value can be read. - * @throws SQLException if pos is less than 1 or if pos is greater than the number of - * characters in the Clob or if pos + length is greater than the number of - * characters in the Clob - * - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized Reader getCharacterStream(long pos, - long length) throws SQLException { - - checkClosed(); - - if (!isInLimits(this.length(), pos - 1, length)) { - throw JDBCUtil.outOfRangeArgument(); - } - - return new ClobInputStream(session, clob, pos - 1, length); - } - - char[] getChars(long position, int length) throws SQLException { - - try { - return clob.getChars(session, position - 1, length); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - // - ClobDataID originalClob; - ClobDataID clob; - SessionInterface session; - int colIndex; - private boolean isClosed; - private boolean isWritable; - JDBCResultSet resultSet; - - public JDBCClobClient(SessionInterface session, ClobDataID clob) { - this.session = session; - this.clob = clob; - } - - public ClobDataID getClob() { - return clob; - } - - public synchronized boolean isClosed() { - return isClosed; - } - - public synchronized void setWritable(JDBCResultSet result, int index) { - - isWritable = true; - resultSet = result; - colIndex = index; - } - - public synchronized void clearUpdates() { - - if (originalClob != null) { - clob = originalClob; - originalClob = null; - } - } - - private void startUpdate() throws SQLException { - - if (originalClob != null) { - return; - } - - originalClob = clob; - clob = (ClobDataID) clob.duplicate(session); - - resultSet.startUpdate(colIndex + 1); - - resultSet.preparedStatement.parameterValues[colIndex] = clob; - resultSet.preparedStatement.parameterSet[colIndex] = true; - } - - private void checkClosed() throws SQLException { - - if (isClosed) { - throw JDBCUtil.sqlException(ErrorCode.X_0F502); - } - } - - static boolean isInLimits(long fullLength, long pos, long len) { - return fullLength >= 0 && pos >= 0 && len >= 0 - && pos <= fullLength - len; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCClobFile.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCClobFile.java deleted file mode 100644 index ffb29881..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCClobFile.java +++ /dev/null @@ -1,1470 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.BufferedInputStream; -import java.io.BufferedWriter; -import java.io.CharArrayWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.RandomAccessFile; -import java.io.Reader; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CodingErrorAction; -import java.nio.charset.IllegalCharsetNameException; -import java.sql.Clob; -import java.sql.SQLException; -import java.util.Scanner; -import java.util.regex.MatchResult; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import org.hsqldb.error.ErrorCode; -import org.hsqldb.jdbc.JDBCBlobFile.OutputStreamAdapter; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.lib.FrameworkLogger; -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.lib.InOutUtil; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.List; - -/** - * A client-side file-based implementation of Clob. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.1, in addition to HSQLDB driver support for both client-side - * in-memory and remote SQL CLOB data implementations, this class is provided - * to expose efficient, relatively high-performance CLOB operations over client - * accessible files.

    - * - * Design Notes

    - * - * Although it is possible to implement a transactional version of this class, - * the present implementation directly propagates changes to the underlying - * file such that changes become visible as soon as they are either - * implicitly or explicitly flushed to disk. - * - *

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.1 - * @since HSQLDB 2.1 - */ -public class JDBCClobFile implements java.sql.Clob { - - private static final FrameworkLogger LOG = - FrameworkLogger.getLog(JDBCClobFile.class); - - /** - * Retrieves the number of characters - * in the CLOB value - * designated by this Clob object. - * - * @return length of the CLOB in characters - * @exception SQLException if there is an error accessing the - * length of the CLOB value - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public long length() throws SQLException { - - checkClosed(); - - if (m_fixedWidthCharset) { - return m_file.length() / m_maxCharWidth; - } - - ReaderAdapter adapter = null; - - try { - adapter = new ReaderAdapter(m_file, 0, Long.MAX_VALUE); - - final long length = adapter.skip(Long.MAX_VALUE); - - return length; - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(adapter); - } - } - - /** - * Retrieves a copy of the specified substring - * in the CLOB value - * designated by this Clob object. - * The substring begins at position - * pos and has up to length consecutive - * characters. - * - * @param pos the first character of the substring to be extracted. - * The first character is at position 1. - * @param length the number of consecutive characters to be copied; - * the value for length must be 0 or greater - * @return a String that is the specified substring in - * the CLOB value designated by this Clob object - * @exception SQLException if there is an error accessing the - * CLOB value; if pos is less than 1 or length is - * less than 0 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public String getSubString(final long pos, - final int length) throws SQLException { - - Reader reader = null; - CharArrayWriter writer; - final int initialCapacity = - Math.min(InOutUtil.DEFAULT_COPY_BUFFER_SIZE, length); - - try { - reader = getCharacterStream(pos, length); - writer = new CharArrayWriter(initialCapacity); - - InOutUtil.copy(reader, writer, length); - - return writer.toString(); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(reader); - } - } - - /** - * Retrieves the CLOB value designated by this Clob - * object as a java.io.Reader object (or as a stream of - * characters). - * - * @return a java.io.Reader object containing the - * CLOB data - * @exception SQLException if there is an error accessing the - * CLOB value - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setCharacterStream - * @since JDK 1.2 - */ - public Reader getCharacterStream() throws SQLException { - return getCharacterStream(1, Long.MAX_VALUE); - } - - /** - * Retrieves the CLOB value designated by this Clob - * object as an ASCII stream. - * - * @return a java.io.InputStream object containing the - * CLOB data - * @exception SQLException if there is an error accessing the - * CLOB value - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setAsciiStream - * @since JDK 1.2 - */ - public InputStream getAsciiStream() throws SQLException { - - InputStream stream; - - final List streams = m_streams; - - try { - stream = new JDBCBlobFile.InputStreamAdapter(m_file, 0, - Long.MAX_VALUE) { - - private boolean closed; - - private InputStream self = this; - - public synchronized void close() throws IOException { - - if (closed) { - return; - } - - closed = true; - - try { - super.close(); - } finally { - streams.remove(self); - } - } - }; - } catch (FileNotFoundException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (SecurityException ex) { - throw JDBCUtil.sqlException(ex); - } catch (NullPointerException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IllegalArgumentException ex) { - throw JDBCUtil.sqlException(ex); - } - - streams.add(stream); - - return stream; - } - - /** - * Retrieves the character position at which the specified char[] - * pattern appears in the CLOB value - * represented by this Clob object. The search - * begins at position start. - * - * @param pattern the substring for which to search - * @param start the position at which to begin searching; the first position - * is 1 - * @return the position at which the substring appears or -1 if it is not - * present; the first position is 1 - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public long position(final char[] pattern, - final long start) throws SQLException { - - if (start < 1) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } else if (pattern == null || pattern.length == 0) { - return -1L; - } - - long length = this.length(); - - if (start > length || pattern.length > length - || start > length - pattern.length) { - return -1; - } - - return position0(new String(pattern), start); - } - - /** - * Retrieves the character position at which the specified - * pattern appears in the SQL CLOB value - * represented by this Clob object. The search begins at - * position start. - * - * @param pattern for which to search - * @param start position at which to begin searching; the first - * position is 1 - * @return the position at which the substring appears or -1 if it is not - * present; the first position is 1 - * @exception SQLException if there is an error accessing the - * CLOB value or if start is less than 1 - */ - private long position0(final String pattern, - final long start) throws SQLException { - - Pattern literal; - - try { - literal = Pattern.compile(Pattern.quote(pattern)); - } catch (PatternSyntaxException ex) { - throw JDBCUtil.sqlException(ex); - } - - Reader reader = null; - Scanner scanner = null; - boolean gotReaderAndScanner = false; - - try { - reader = new ReaderAdapter(m_file, start - 1, m_file.length()); - scanner = new Scanner(reader); - gotReaderAndScanner = true; - } catch (FileNotFoundException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (SecurityException ex) { - throw JDBCUtil.sqlException(ex); - } catch (NullPointerException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IllegalArgumentException ex) { - throw JDBCUtil.sqlException(ex); - } finally { - if (!gotReaderAndScanner) { - closeSafely(scanner); - closeSafely(reader); - } - } - - int position = -1; - - try { - if (scanner.hasNext()) { - final boolean found = (null - != scanner.findWithinHorizon(literal, - 0)); - - if (found) { - MatchResult match = scanner.match(); - - position = match.start() + 1; - } - } - } finally { - closeSafely(scanner); - closeSafely(reader); - } - - return position; - } - - /** - * Retrieves the character position at which the specified substring - * searchstr appears in the SQL CLOB value - * represented by this Clob object. The search - * begins at position start. - * - * @param searchstr the substring for which to search - * @param start the position at which to begin searching; the first position - * is 1 - * @return the position at which the substring appears or -1 if it is not - * present; the first position is 1 - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public long position(String searchstr, long start) throws SQLException { - - if (start < 1) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } else if (searchstr == null || searchstr.isEmpty()) { - return -1L; - } - - final long length = this.length(); - final int searchstrLength = searchstr.length(); - - if (start > length || searchstrLength > length - || start > length - searchstrLength) { - return -1; - } - - return position0(searchstr, start); - } - - /** - * Retrieves the character position at which the specified - * Clob object searchstr appears in this - * Clob object. The search begins at position - * start. - * - * @param pattern the Clob object for which to search - * @param start the position at which to begin searching; the first - * position is 1 - * @return the position at which the Clob object appears - * or -1 if it is not present; the first position is 1 - * @exception SQLException if there is an error accessing the - * CLOB value or if start is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public long position(final Clob pattern, - final long start) throws SQLException { - - long patternLength; - - if (start < 1) { - throw JDBCUtil.outOfRangeArgument("start: " + start); - } else if ((patternLength = pattern == null ? 0 - : pattern.length()) == 0) { - return -1L; - } else if (patternLength > Integer.MAX_VALUE) { - throw JDBCUtil.outOfRangeArgument("pattern.length(): " - + patternLength); - } - - long length = this.length(); - - if (start > length || patternLength > length - || start > length - patternLength) { - return -1; - } - - String stringPattern; - - if (pattern instanceof JDBCClob) { - stringPattern = ((JDBCClob) pattern).getData(); - } else { - Reader reader = null; - StringWriter writer = new StringWriter(); - - try { - reader = pattern.getCharacterStream(); - - InOutUtil.copy(reader, writer, patternLength); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (Throwable ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(reader); - } - - stringPattern = writer.toString(); - } - - return position0(stringPattern, start); - } - - //---------------------------- jdbc 3.0 ----------------------------------- - - /** - * Writes the given Java String to the CLOB - * value that this Clob object designates at the position - * pos. The string will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing the given string, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * @param pos the position at which to start writing to the CLOB - * value that this Clob object represents; - * The first position is 1 - * @param str the string to be written to the CLOB - * value that this Clob designates - * @return the number of characters written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4 - */ - public int setString(final long pos, - final String str) throws SQLException { - return setString(pos, str, 0, str == null ? 0 - : str.length()); - } - - /** - * Writes len characters of str, starting - * at character offset, to the CLOB value - * that this Clob represents. The string will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing the given string, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * @param pos the position at which to start writing to this - * CLOB object; The first position is 1 - * @param str the string to be written to the CLOB - * value that this Clob object represents - * @param offset the offset into str to start reading - * the characters to be written - * @param len the number of characters to be written - * @return the number of characters written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4 - */ - public int setString(final long pos, final String str, final int offset, - final int len) throws SQLException { - - checkClosed(); - - if (str == null) { - throw JDBCUtil.nullArgument("str"); - } - - final int strlen = str.length(); - - if (offset < 0 || offset > strlen) { - throw JDBCUtil.outOfRangeArgument("offset: " + offset); - } - - if (len < 0 || len > strlen - offset) { - throw JDBCUtil.outOfRangeArgument("len: " + len); - } - - if (pos < 1L) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - long oldLength = this.length(); - - if (pos > oldLength + 1) { - fillSpace(oldLength + 1, pos); - } - - Writer writer = null; - - try { - writer = setCharacterStream(pos); - - writer.write(str, offset, len); - } catch (SQLException ex) { - throw ex; - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (Throwable ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(writer); - } - - return len; - } - - /** - * - * @param startPos inclusive - * @param endPos exclusive - * @throws SQLException exception - */ - private void fillSpace(final long startPos, - long endPos) throws SQLException { - - Writer writer = null; - - try { - writer = setCharacterStream(startPos); - - for (long i = endPos - startPos; i >= 0; i--) { - writer.append(' '); - } - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (Throwable ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(writer); - } - } - - /** - * Retrieves a stream to be used to write Ascii characters to the - * CLOB value that this Clob object represents, - * starting at position pos. Characters written to the stream - * will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing characters to the stream, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * @param pos the position at which to start writing to this - * CLOB object; The first position is 1 - * @return the stream to which ASCII encoded characters can be written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getAsciiStream - * - * @since JDK 1.4 - */ - public OutputStream setAsciiStream(long pos) throws SQLException { - - if (pos < 1) { - throw JDBCUtil.invalidArgument("pos: " + pos); - } - - checkClosed(); - createFile(); - - long thisLength = this.length(); - - if (pos > thisLength + 1) { - this.fillSpace(thisLength + 1, pos); - } - - OutputStream stream; - - try { - stream = new JDBCBlobFile.OutputStreamAdapter(m_file, pos - 1) { - - public void close() throws IOException { - - try { - super.close(); - } finally { - m_streams.remove(this); - } - } - }; - } catch (FileNotFoundException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (IllegalArgumentException ex) { - throw JDBCUtil.sqlException(ex); - } catch (NullPointerException ex) { - throw JDBCUtil.sqlException(ex); - } catch (SecurityException ex) { - throw JDBCUtil.sqlException(ex); - } - - m_streams.add(stream); - - return stream; - } - - /** - * Retrieves a stream to be used to write a stream of Unicode characters - * to the CLOB value that this Clob object - * represents, at position pos. Characters written to the stream - * will overwrite the existing characters - * in the Clob object starting at the position - * pos. If the end of the Clob value is reached - * while writing characters to the stream, then the length of the Clob - * value will be increased to accommodate the extra characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * When the value specified for pos is greater then the - * length+1, an SQLException is thrown. - *

    - * - * @param pos the position at which to start writing to the - * CLOB value; The first position is 1 - * - * @return a stream to which Unicode encoded characters can be written - * @exception SQLException if there is an error accessing the - * CLOB value or if pos is less than 1 - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #getCharacterStream - * - * @since JDK 1.4 - */ - public Writer setCharacterStream(final long pos) throws SQLException { - - if (pos < 1) { - throw JDBCUtil.invalidArgument("pos: " + pos); - } - - checkClosed(); - createFile(); - - long thisLength = this.length(); - - if (pos > thisLength + 1) { - this.fillSpace(thisLength + 1, pos); - } - - Writer writer; - WriterAdapter adapter; - - try { - adapter = new WriterAdapter(m_file, pos - 1) { - - public void close() throws IOException { - - try { - super.close(); - } finally { - m_streams.remove(this); - } - } - }; - writer = new BufferedWriter(adapter); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (Throwable ex) { - throw JDBCUtil.sqlException(ex); - } - - m_streams.add(adapter); - - return writer; - } - - /** - * Truncates the CLOB value that this Clob - * designates to have a length of len - * characters. - *

    - * Note: If the value specified for pos - * is greater than the length+1 of the CLOB value then the - * behavior is undefined. Some JDBC drivers may throw a - * SQLException while other drivers may support this - * operation. - * - * @param len the length, in characters, to which the CLOB value - * should be truncated - * @exception SQLException if there is an error accessing the - * CLOB value or if len is less than 0 - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4 - */ - public void truncate(long len) throws SQLException { - - if (len < 0) { - throw JDBCUtil.invalidArgument("len: " + len); - } - - checkClosed(); - - ReaderAdapter adapter = null; - RandomAccessFile randomAccessFile = null; - long filePointer; - - try { - adapter = new ReaderAdapter(m_file, len, Long.MAX_VALUE); - filePointer = adapter.getFilePointer(); - - adapter.close(); - - randomAccessFile = new RandomAccessFile(m_file, "rw"); - - randomAccessFile.setLength(filePointer); - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (Throwable ex) { - throw JDBCUtil.sqlException(ex); - } finally { - closeSafely(adapter); - closeSafely(randomAccessFile); - } - } - - /** - * This method frees the Clob object and releases the resources - * that it holds. The object is invalid once the free method - * is called. - *

    - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - *

    - * @throws SQLException if an error occurs releasing - * the Clob's resources - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4 - */ - public synchronized void free() throws SQLException { - - if (m_closed) { - return; - } - - m_closed = true; - - final List streams = m_streams; - - m_streams = null; - - for (Iterator itr = streams.iterator(); itr.hasNext(); ) { - final Object stream = itr.next(); - - closeSafely(stream); - } - - if (m_deleteOnFree) { - try { - m_file.delete(); - } catch (SecurityException e) {} - } - } - - /** - * Returns a Reader object that contains a partial Clob value, starting - * with the character specified by pos, which is length characters in length. - * - * @param pos the offset to the first character of the partial value to - * be retrieved. The first character in the Clob is at position 1. - * @param length the length in characters of the partial value to be retrieved. - * @return Reader through which the partial Clob value can be read. - * @throws SQLException if pos is less than 1 or if pos is greater than the number of - * characters in the Clob or if pos + length is greater than the number of - * characters in the Clob - * - * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public Reader getCharacterStream(long pos, - long length) throws SQLException { - - if (pos < 1) { - throw JDBCUtil.outOfRangeArgument("pos: " + pos); - } - - if (length < 0) { - throw JDBCUtil.outOfRangeArgument("length: " + length); - } - - Reader reader; - - final List streams = m_streams; - - try { - reader = new ReaderAdapter(m_file, pos - 1, length) { - - public void close() throws IOException { - - try { - super.close(); - } finally { - streams.remove(this); - } - } - }; - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (Throwable ex) { - throw JDBCUtil.sqlException(ex); - } - - streams.add(reader); - - return reader; - } - - /** - * Retrieves the canonical File object denoting the file that - * backs this CLOB. - * - * @return the file that backs this CLOB. - */ - public File getFile() { - return m_file; - } - - /** - * - * @return the name of the character encoding used to read and write - * character data in the underlying files, as well as to determine - * the character length and character offsets into the underlying - * file - */ - public String getEncoding() { - return m_encoding; - } - - /** - * Retrieves whether an attempt to delete the backing file - * is made in response to invocation of {@link #free()}. - * - * @return true if backing file deletion is attempted; otherwise false. - */ - public boolean isDeleteOnFree() { - return m_deleteOnFree; - } - - /** - * Assigns whether an attempt to delete the backing file - * is made in response to invocation of {@link #free()}. - * - * @param deleteOnFree the new value to assign - */ - public void setDeleteOnFree(boolean deleteOnFree) { - m_deleteOnFree = deleteOnFree; - } - - //-------------------------------------------------------------------------- - // Internal Implementation - //-------------------------------------------------------------------------- - public static final String TEMP_FILE_PREFIX = "hsql_jdbc_clob_file_"; - public static final String TEMP_FILE_SUFFIX = ".tmp"; - - // - private final File m_file; - - // - private boolean m_closed; - private boolean m_deleteOnFree; - private String m_encoding; - private Charset m_charset; - private CharsetEncoder m_encoder; - private boolean m_fixedWidthCharset; - private int m_maxCharWidth; - private List m_streams = new HsqlArrayList(); - - /** - * Convenience constructor for {@link - * #JDBCClobFile(java.lang.String) - * JDBCClobFile((String)null)}.

    - * - * @throws SQLException if the platform encoding is unsupported, - * the temp file cannot be created or some other - * error occurs that prevents the construction of a - * valid instance of this class. - */ - public JDBCClobFile() throws SQLException { - this((String) null); - } - - /** - * Constructs a new JDBCClobFile instance backed by a File object - * created by File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX), - * using the given encoding to read and write file content. - * - * @param encoding the name of the character encoding used to read and write - * character data in the underlying file, as well as to determine - * the character length of and character offsets into the underlying - * file. Specify null to denote the platform encoding. - * - * @throws SQLException if the given encoding is unsupported, - * the backing temp file could not be created or if a security - * manager exists and its {@link - * java.lang.SecurityManager#checkWrite(java.lang.String)} - * method does not allow a file to be created. - */ - public JDBCClobFile(String encoding) throws SQLException { - - try { - setEncoding(encoding); - - m_file = File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX); - m_deleteOnFree = true; - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (SecurityException se) { - throw JDBCUtil.sqlException(se); - } - } - - /** - * Convenience constructor for {@link - * #JDBCClobFile(java.io.File, java.lang.String) - * JDBCClobFile(file,null)}. - * - * @param file that is to back the new CLOB instance. - * - * @throws SQLException if an I/O error occurs, which is possible because the - * construction of the canonical pathname may require - * file-system queries; a required system property value - * cannot be accessed; a security manager exists and its - * {@link java.lang.SecurityManager#checkRead} - * method denies read access to the file - */ - public JDBCClobFile(File file) throws SQLException { - this(file, null); - } - - /** - * Constructs a new JDBCClobFile instance backed by the given File object - * using the given encoding to read and write file content. - * - * @param file that is to back the new CLOB instance. - * @param encoding the name of the character encoding used to read and write - * character data in the underlying file, as well as to determine - * the character length of and character offsets into the underlying - * file. Specify null to denote the platform encoding. - * - * @throws SQLException if the given encoding is unsupported; - * an I/O error occurs, which is possible because the - * construction of the canonical pathname may require - * file-system queries; a required system property value - * cannot be accessed; a security manager exists and its - * {@link java.lang.SecurityManager#checkRead} - * method denies read access to the file - */ - public JDBCClobFile(File file, String encoding) throws SQLException { - - if (file == null) { - throw JDBCUtil.nullArgument("file"); - } - - try { - setEncoding(encoding); - - m_file = file.getCanonicalFile(); - - checkIsFile( /*checkExists*/false); - - m_deleteOnFree = false; - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (SQLException ex) { - throw JDBCUtil.sqlException(ex); - } - } - - protected final void setEncoding(final String encoding) - throws UnsupportedEncodingException { - - final Charset charSet = charsetForName(encoding); - final CharsetEncoder encoder = charSet.newEncoder().onMalformedInput( - CodingErrorAction.REPLACE).onUnmappableCharacter( - CodingErrorAction.REPLACE); - final float maxBytesPerChar = encoder.maxBytesPerChar(); - final float averageBytesPerChar = encoder.averageBytesPerChar(); - final boolean fixedWidthCharset = - (maxBytesPerChar == Math.round(maxBytesPerChar)) - && (maxBytesPerChar == averageBytesPerChar); - - // - m_fixedWidthCharset = fixedWidthCharset; - m_maxCharWidth = Math.round(maxBytesPerChar); - m_charset = charSet; - m_encoder = encoder; - m_encoding = m_charset.name(); - } - - protected static Charset charsetForName(final String charsetName) - throws UnsupportedEncodingException { - - String csn = charsetName; - - if (csn == null) { - csn = Charset.defaultCharset().name(); - } - - try { - if (Charset.isSupported(csn)) { - return Charset.forName(csn); - } - } catch (IllegalCharsetNameException x) { - LOG.warning(x.getMessage(), x); - } - - throw new UnsupportedEncodingException(csn); - } - - protected final void checkIsFile(final boolean checkExists) - throws SQLException { - - boolean exists = false; - boolean isFile = false; - - try { - exists = m_file.exists(); - } catch (Exception ex) { - throw JDBCUtil.sqlException(ex); - } - - if (exists) { - try { - isFile = m_file.isFile(); - } catch (Exception ex) { - throw JDBCUtil.sqlException(ex); - } - } - - if (exists) { - if (!isFile) { - throw JDBCUtil.invalidArgument("Is not a file: " + m_file); - } - } else if (checkExists) { - throw JDBCUtil.invalidArgument("Does not exist: " + m_file); - } - } - - protected void checkClosed() throws SQLException { - - if (m_closed) { - throw JDBCUtil.sqlException(ErrorCode.X_07501); - } - } - - protected void createFile() throws SQLException { - - try { - if (!m_file.exists()) { - FileUtil.getFileUtil().makeParentDirectories(m_file); - m_file.createNewFile(); - } - } catch (IOException ex) { - throw JDBCUtil.sqlException(ex); - } catch (Throwable ex) { - throw JDBCUtil.sqlException(ex); - } - - checkIsFile( /*checkExists*/true); - } - - // - private static void closeSafely(final RandomAccessFile target) { - - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(final InputStream target) { - - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(final OutputStream target) { - - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(final Reader target) { - - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(final Writer target) { - - if (target != null) { - try { - target.close(); - } catch (IOException ignoredIoe) { - LOG.info(ignoredIoe.getMessage(), ignoredIoe); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private static void closeSafely(final Scanner target) { - - if (target != null) { - try { - target.close(); - } catch (Throwable ignoredRex) { - LOG.info(ignoredRex.getMessage(), ignoredRex); - } - } - } - - private void closeSafely(final Object target) { - - if (target instanceof RandomAccessFile) { - closeSafely((RandomAccessFile) target); - } else if (target instanceof InputStream) { - closeSafely((InputStream) target); - } else if (target instanceof OutputStream) { - closeSafely((OutputStream) target); - } else if (target instanceof Reader) { - closeSafely((Reader) target); - } else if (target instanceof Writer) { - closeSafely((Writer) target); - } else if (target instanceof Scanner) { - closeSafely((Scanner) target); - } - } - - // - protected class WriterAdapter extends Writer { - - protected final Writer m_writer; - - protected WriterAdapter(final File file, - final long pos) - throws FileNotFoundException, IOException, - SecurityException, - NullPointerException, - IllegalArgumentException { - - if (file == null) { - throw new NullPointerException("file"); - } - - if (pos < 0) { - throw new IllegalArgumentException("pos: " + pos); - } - - ReaderAdapter reader = null; - long filePointer; - - try { - reader = new ReaderAdapter(file, pos, Long.MAX_VALUE); - filePointer = reader.getFilePointer(); - } finally { - closeSafely(reader); - } - - RandomAccessFile raf = null; - boolean success = false; - - try { - raf = new RandomAccessFile(file, "rw"); - - raf.seek(filePointer); - - success = true; - } finally { - if (!success) { - closeSafely(raf); - } - } - - final OutputStreamAdapter osa = new OutputStreamAdapter(raf); - - m_writer = m_encoding == null ? new OutputStreamWriter(osa) - : new OutputStreamWriter(osa, - m_charset); - } - - public void flush() throws IOException { - m_writer.flush(); - } - - public void close() throws IOException { - m_writer.close(); - } - - public void write(char[] cbuf, int off, int len) throws IOException { - m_writer.write(cbuf, off, len); - } - } - - protected class ReaderAdapter extends Reader { - - // - private static final int CHARBUFFER_CAPACTIY = 128; - - // - private final Reader m_reader; - private long m_remaining = Long.MAX_VALUE; - private long m_filePointer; - private ByteBuffer m_byteBuffer; - private CharBuffer m_charBuffer; - - protected ReaderAdapter(final File file, final long pos, - final long length) - throws FileNotFoundException, IOException, - NullPointerException, - IllegalArgumentException, - SecurityException { - - if (file == null) { - throw new NullPointerException("file"); - } - - if (pos < 0) { - throw new IllegalArgumentException("pos: " + pos); - } - - if (length < 0) { - throw new IllegalArgumentException("length: " + length); - } - - long fileLength = file.length(); - long maxCharsLength = m_fixedWidthCharset - ? Math.round(fileLength - / (double) m_maxCharWidth) - : fileLength; - - if (maxCharsLength - pos < 0) { - throw new IllegalArgumentException("pos: " + pos); - } - - // - if (!m_fixedWidthCharset) { - final int charCapacity = CHARBUFFER_CAPACTIY; - final int byteCapacity = charCapacity * m_maxCharWidth; - - m_charBuffer = CharBuffer.allocate(charCapacity); - m_byteBuffer = ByteBuffer.allocate(byteCapacity); - } - - FileInputStream fis = null; - - try { - fis = new FileInputStream(file); - - final BufferedInputStream bis = new BufferedInputStream(fis); - final InputStreamReader isr = new InputStreamReader(bis, - m_charset); - - m_reader = isr; - } catch (FileNotFoundException ex) { - closeSafely(fis); - - throw ex; - } catch (SecurityException ex) { - closeSafely(fis); - - throw ex; - } catch (NullPointerException ex) { - closeSafely(fis); - - throw ex; - } catch (RuntimeException ex) { - closeSafely(fis); - - throw ex; - } - - long skipped = this.skip(pos); - - if (skipped < pos) { - throw new IllegalArgumentException("pos: " + pos); - } - - // important - do not assign until *after* seek above. - m_remaining = length; - } - - public int read(final char[] cbuf, final int off, - int len) throws IOException { - - final long l_remaining = m_remaining; - - if (l_remaining <= 0) { - return -1; - } else if (l_remaining < len) { - len = (int) l_remaining; - } - - int charsRead = m_reader.read(cbuf, off, len); - - if (charsRead == -1) { - return -1; - } else if (charsRead > l_remaining) { - charsRead = (int) l_remaining; - m_remaining = 0; - } else { - m_remaining -= charsRead; - } - - int bytesRead; - - if (m_fixedWidthCharset) { - bytesRead = (m_maxCharWidth * charsRead); - } else { - final boolean reallocate = (charsRead - > m_charBuffer.capacity()); - final CharBuffer cb = reallocate - ? CharBuffer.allocate(charsRead) - : m_charBuffer; - final ByteBuffer bb = reallocate - ? ByteBuffer.allocate(charsRead - * m_maxCharWidth) - : m_byteBuffer; - - // - cb.clear(); - bb.clear(); - cb.put(cbuf, off, charsRead); - cb.flip(); - m_encoder.encode(cb, bb, /*endOfinput*/ true); - bb.flip(); - - bytesRead = bb.limit(); - - if (reallocate) { - m_byteBuffer = bb; - m_charBuffer = cb; - } - } - - m_filePointer += bytesRead; - - return charsRead; - } - - public void close() throws IOException { - m_reader.close(); - } - - public long getFilePointer() { - return m_filePointer; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCColumnMetaData.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCColumnMetaData.java deleted file mode 100644 index 560d9587..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCColumnMetaData.java +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.lang.reflect.Field; - -// fredt@users - 1.9.0 rewritten as simple structure derived from JDBCResultSetMetaData - -/** - * Provides a site for holding the ResultSetMetaData for individual ResultSet - * columns. In 2.0 it is implemented as a simple data structure derived - * from calls to JDBCResultSetMetaData methods. - * purposes.

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.0 - * @since HSQLDB 1.7.2 - */ -public final class JDBCColumnMetaData { - - /** The column's table's catalog name. */ - public String catalogName; - - /** - * The fully-qualified name of the Java class whose instances are - * manufactured if the method ResultSet.getObject is called to retrieve - * a value from the column. - */ - public String columnClassName; - - /** The column's normal max width in chars. */ - public int columnDisplaySize; - - /** The suggested column title for use in printouts and displays. */ - public String columnLabel; - - /** The column's name. */ - public String columnName; - - /** The column's SQL type. */ - public int columnType; - - /** The column's value's number of decimal digits. */ - public int precision; - - /** The column's value's number of digits to right of the decimal point. */ - public int scale; - - /** The column's table's schema. */ - public String schemaName; - - /** The column's table's name. */ - public String tableName; - - /** Whether the value of the column are automatically numbered. */ - public boolean isAutoIncrement; - - /** Whether the column's value's case matters. */ - public boolean isCaseSensitive; - - /** Whether the values in the column are cash values. */ - public boolean isCurrency; - - /** Whether a write on the column will definitely succeed. */ - public boolean isDefinitelyWritable; - - /** The nullability of values in the column. */ - public int isNullable; - - /** Whether the column's values are definitely not writable. */ - public boolean isReadOnly; - - /** Whether the column's values can be used in a where clause. */ - public boolean isSearchable; - - /** Whether values in the column are signed numbers. */ - public boolean isSigned; - - /** Whether it is possible for a write on the column to succeed. */ - public boolean isWritable; - - /** - * Retrieves a String representation of this object. - * - * @return a String representation of this object - */ - public String toString() { - - try { - return toStringImpl(); - } catch (Exception e) { - return super.toString() + "[" + e + "]"; - } - } - - /** - * Provides the implementation of the toString() method. - * - * @return a String representation of this object - */ - private String toStringImpl() throws Exception { - - StringBuilder sb; - Field[] fields; - Field field; - - sb = new StringBuilder(); - - sb.append('['); - - fields = getClass().getFields(); - - int len = fields.length; - - for (int i = 0; i < len; i++) { - field = fields[i]; - - sb.append(field.getName()); - sb.append('='); - sb.append(field.get(this)); - - if (i + 1 < len) { - sb.append(','); - sb.append(' '); - } - } - - sb.append(']'); - - return sb.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCCommonDataSource.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCCommonDataSource.java deleted file mode 100644 index d5addfdb..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCCommonDataSource.java +++ /dev/null @@ -1,374 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.PrintWriter; -import java.io.Serializable; -import java.sql.SQLException; -import java.util.Properties; -import java.sql.SQLFeatureNotSupportedException; - -import javax.sql.CommonDataSource; - -/** - * Common base for DataSource implementations. - * - * This class implements the methods used for setting the properties for new - * connections. - * - * The setUrl() or setDatabase() methods are used to set the URL. - * - * It is possible to set all the rest of required properties in a Properties - * file and use the setProperties() method. - * - * Alternatively, the setXXX() methods for user and password can be used. - * - * It is best to use only one method for setting the properties. - * - * If setXXX() methods are used, the values override the values set in a - * call made to setProperties() before or after calling setXXX(). - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.3 - * @since JDK 1.2, HSQLDB 2.0 - */ -public abstract class JDBCCommonDataSource -implements CommonDataSource, Serializable { - - /** - *

    Retrieves the log writer for this DataSource - * object. - * - *

    The log writer is a character output stream to which all logging - * and tracing messages for this data source will be - * printed. This includes messages printed by the methods of this - * object, messages printed by methods of other objects manufactured - * by this object, and so on. Messages printed to a data source - * specific log writer are not printed to the log writer associated - * with the java.sql.DriverManager class. When a - * DataSource object is - * created, the log writer is initially null; in other words, the - * default is for logging to be disabled. - * - * @return the log writer for this data source or null if - * logging is disabled - * @exception java.sql.SQLException if a database access error occurs - * @see #setLogWriter - * @since 1.4 - */ - public PrintWriter getLogWriter() throws SQLException { - return logWriter; - } - - /** - *

    Sets the log writer for this DataSource - * object to the given java.io.PrintWriter object. - * - *

    The log writer is a character output stream to which all logging - * and tracing messages for this data source will be - * printed. This includes messages printed by the methods of this - * object, messages printed by methods of other objects manufactured - * by this object, and so on. Messages printed to a data source- - * specific log writer are not printed to the log writer associated - * with the java.sql.DriverManager class. When a - * DataSource object is created the log writer is - * initially null; in other words, the default is for logging to be - * disabled. - * - * @param out the new log writer; to disable logging, set to null - * @exception SQLException if a database access error occurs - * @see #getLogWriter - * @since 1.4 - */ - public void setLogWriter(java.io.PrintWriter out) throws SQLException { - logWriter = out; - } - - /** - *

    Sets the maximum time in seconds that this data source will wait - * while attempting to connect to a database. A value of zero - * specifies that the timeout is the default system timeout - * if there is one; otherwise, it specifies that there is no timeout. - * When a DataSource object is created, the login timeout is - * initially zero. - * - * @param seconds the data source login time limit - * @exception SQLException if a database access error occurs. - * @see #getLoginTimeout - * @since 1.4 - */ - public void setLoginTimeout(int seconds) throws SQLException { - - loginTimeout = seconds; - - connectionProps.setProperty("loginTimeout", - Integer.toString(loginTimeout)); - } - - /** - * Gets the maximum time in seconds that this data source can wait - * while attempting to connect to a database. A value of zero - * means that the timeout is the default system timeout - * if there is one; otherwise, it means that there is no timeout. - * When a DataSource object is created, the login timeout is - * initially zero. - * - * @return the data source login time limit - * @exception SQLException if a database access error occurs. - * @see #setLoginTimeout - * @since 1.4 - */ - public int getLoginTimeout() throws SQLException { - return loginTimeout; - } - - // ------------------------ custom public methods ------------------------ - - /** - * Retrieves the description of the data source.

    - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Retrieves the name of the data source.

    - * - * @return the description - */ - public String getDataSourceName() { - return dataSourceName; - } - - /** - * Retrieves the network protocol of the data source.

    - * - * @return the network protocol - */ - public String getNetworkProtocol() { - return networkProtocol; - } - - /** - * Retrieves the server name attribute.

    - * - * @return the server name attribute - */ - public String getServerName() { - return serverName; - } - - /** - * Synonym for getUrl(). - * - * @return the jdbc database connection url attribute - */ - public String getDatabaseName() { - return url; - } - - /** - * Synonym for getUrl(). - * - * @return the jdbc database connection url attribute - */ - public String getDatabase() { - return url; - } - - /** - * Retrieves the jdbc database connection url attribute.

    - * - * @return the jdbc database connection url attribute - */ - public String getUrl() { - return url; - } - - /** - * Retrieves the jdbc database connection url attribute.

    - * - * @return the jdbc database connection url attribute - */ - public String getURL() { - return url; - } - - /** - * Retrieves the user name for the connection.

    - * - * @return the username for the connection - */ - public String getUser() { - return user; - } - - /** - * Synonym for setUrl(String).

    - * - * @param databaseName the new value for the attribute - */ - public void setDatabaseName(String databaseName) { - this.url = databaseName; - } - - /** - * Synonym for setUrl(String).

    - * - * @param database the new value for the attribute - */ - public void setDatabase(String database) { - this.url = database; - } - - /** - * Sets the jdbc database URL.

    - * - * @param url the new value of this object's jdbc database connection - * url attribute - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * Sets the jdbc database URL.

    - * - * @param url the new value of this object's jdbc database connection - * url attribute - */ - public void setURL(String url) { - this.url = url; - } - - /** - * Sets the password for the user name. - * - * @param password the password - */ - public void setPassword(String password) { - - this.password = password; - - connectionProps.setProperty("password", password); - } - - /** - * Sets the user name. - * - * @param user the user id - */ - public void setUser(String user) { - - this.user = user; - - connectionProps.setProperty("user", user); - } - - /** - * Sets connection properties. If user / password / loginTimeout has been - * set with one of the setXXX() methods it will be added to the Properties - * object. - * - * @param props properties. If null, then existing properties will be - * cleared/replaced. - */ - public void setProperties(Properties props) { - - connectionProps = (props == null) ? new Properties() - : (Properties) props.clone(); - - if (user != null) { - connectionProps.setProperty("user", user); - } - - if (password != null) { - connectionProps.setProperty("password", password); - } - - if (loginTimeout != 0) { - connectionProps.setProperty("loginTimeout", - Integer.toString(loginTimeout)); - } - } - - //------------------------- JDBC 4.1 ----------------------------------- - - /** - * Return the parent Logger of all the Loggers used by this data source. This - * should be the Logger farthest from the root Logger that is - * still an ancestor of all of the Loggers used by this data source. Configuring - * this Logger will affect all of the log messages generated by the data source. - * In the worst case, this may be the root Logger. - * - * @return the parent Logger for this data source - * @throws SQLFeatureNotSupportedException if the data source does not use java.util.logging. - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public java.util.logging.Logger getParentLogger() - throws java.sql.SQLFeatureNotSupportedException { - throw (java.sql - .SQLFeatureNotSupportedException) JDBCUtil.notSupported(); - } - - // ------------------------ internal implementation ------------------------ - protected Properties connectionProps = new Properties(); - - /** description of data source - informational */ - protected String description = null; - - /** name of data source - informational */ - protected String dataSourceName = null; - - /** name of server - informational */ - protected String serverName = null; - - /** network protocol - informational */ - protected String networkProtocol = null; - - /** login timeout */ - protected int loginTimeout = 0; - - /** log writer */ - protected transient PrintWriter logWriter; - - /** connection user */ - protected String user = null; - - /** connection password */ - protected String password = null; - - /** database URL */ - protected String url = null; -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCConnection.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCConnection.java deleted file mode 100644 index e0e6fea0..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCConnection.java +++ /dev/null @@ -1,3759 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.NClob; -import java.sql.PreparedStatement; -import java.sql.SQLClientInfoException; -import java.sql.SQLFeatureNotSupportedException; - -//import java.sql.SQLData; -//import java.sql.SQLOutput; -//import java.sql.SQLInput; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Savepoint; -import java.sql.Statement; -import java.sql.Struct; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.TimeZone; - -// import java.util.logging.Level; -// import java.util.logging.Logger; -import org.hsqldb.ClientConnection; -import org.hsqldb.ClientConnectionHTTP; -import org.hsqldb.DatabaseManager; -import org.hsqldb.DatabaseURL; -import org.hsqldb.HsqlException; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.StringUtil; -import org.hsqldb.persist.HsqlDatabaseProperties; -import org.hsqldb.persist.HsqlProperties; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultConstants; -import org.hsqldb.result.ResultProperties; -import org.hsqldb.types.ArrayType; -import org.hsqldb.types.Type; - -/* $Id: JDBCConnection.java 6524 2022-05-22 19:09:49Z fredt $ */ - -// fredt@users 20020320 - patch 1.7.0 - JDBC 2 support and error trapping -// -// campbell-burnet@users 20020509 - added "throws SQLException" to all methods where -// it was missing here but specified in the -// java.sql.Connection interface, -// updated generic documentation to JDK 1.4, and -// added JDBC3 methods and docs -// boucherb & -// fredt@users 20020505 - extensive review and update of docs and behaviour -// to comply with java.sql specification -// fredt@users 20020830 - patch 487323 by xclayl@users - better synchronization -// fredt@users 20020930 - patch 1.7.1 - support for connection properties -// kneedeepincode@users -// 20021110 - patch 635816 - correction to properties -// unsaved@users 20021113 - patch 1.7.2 - SSL support -// campbell-burnet@users 2003 ??? - patch 1.7.2 - SSL support moved to factory interface -// fredt@users 20030620 - patch 1.7.2 - reworked to use a SessionInterface -// campbell-burnet@users 20030801 - JavaDoc updates to reflect new connection urls -// campbell-burnet@users 20030819 - patch 1.7.2 - partial fix for broken nativeSQL method -// campbell-burnet@users 20030819 - patch 1.7.2 - SQLWarning cases implemented -// campbell-burnet@users 20051207 - 1.9.0 - JDBC 4.0 support - docs and methods -// - 20060712 - full synch up to Mustang Build 90 -// fredt@users 20090810 - 1.9.0 - full review and updates -// -// Revision 1.23 2006/07/12 12:02:43 boucherb -// patch 1.9.0 -// - full synch up to Mustang b90 - -/** - * - * - * A connection (session) with a specific - * database. SQL statements are executed and results are returned - * within the context of a connection. - *

    - * A Connection object's database is able to provide information - * describing its tables, its supported SQL grammar, its stored - * procedures, the capabilities of this connection, and so on. This - * information is obtained with the getMetaData method. - * - *

    (JDBC4 clarification:) - *

    Note: When configuring a Connection, JDBC applications - * should use the appropriate Connection method such as - * setAutoCommit or setTransactionIsolation. - * Applications should not invoke SQL commands directly to change the connection's - * configuration when there is a JDBC method available. By default, a Connection object is in - * auto-commit mode, which means that it automatically commits changes - * after executing each statement. If auto-commit mode has been - * disabled, the method commit must be called explicitly in - * order to commit changes; otherwise, database changes will not be saved. - *

    - * A new Connection object created using the JDBC 2.1 core API - * has an initially empty type map associated with it. A user may enter a - * custom mapping for a UDT in this type map. - * When a UDT is retrieved from a data source with the - * method ResultSet.getObject, the getObject method - * will check the connection's type map to see if there is an entry for that - * UDT. If so, the getObject method will map the UDT to the - * class indicated. If there is no entry, the UDT will be mapped using the - * standard mapping. - *

    - * A user may create a new type map, which is a java.util.Map - * object, make an entry in it, and pass it to the java.sql - * methods that can perform custom mapping. In this case, the method - * will use the given type map instead of the one associated with - * the connection. - *

    - * For example, the following code fragment specifies that the SQL - * type ATHLETES will be mapped to the class - * Athletes in the Java programming language. - * The code fragment retrieves the type map for the Connection - * object con, inserts the entry into it, and then sets - * the type map with the new entry as the connection's type map. - *

    - *      java.util.Map map = con.getTypeMap();
    - *      map.put("mySchemaName.ATHLETES", Class.forName("Athletes"));
    - *      con.setTypeMap(map);
    - * 
    - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * To get a Connection to an HSQLDB database, the - * following code may be used (updated to reflect the most recent - * recommendations): - * - *


    - * - * When using HSQLDB, the database connection <url> must start with - * 'jdbc:hsqldb:'

    - * - * Since 1.7.2, connection properties (<key-value-pairs>) may be appended - * to the database connection <url>, using the form: - * - *

    - * '<url>[;key=value]*' - *

    - * - * Also since 1.7.2, the allowable forms of the HSQLDB database connection - * <url> have been extended. However, all legacy forms continue - * to work, with unchanged semantics. The extensions are as described in the - * following material. - * - *


    - * - * Network Server Database Connections:

    - * - * The {@link org.hsqldb.server.Server Server} database connection <url> - * takes one of the two following forms: - * - *

    - *
      - *
    1. 'jdbc:hsqldb:hsql://host[:port][/<alias>][<key-value-pairs>]' - * - *
    2. 'jdbc:hsqldb:hsqls://host[:port][/<alias>][<key-value-pairs>]' - * (with TLS). - *
    - *

    - * - * The {@link org.hsqldb.server.WebServer WebServer} database connection <url> - * takes one of two following forms: - * - *

    - *
      - *
    1. 'jdbc:hsqldb:http://host[:port][/<alias>][<key-value-pairs>]' - * - *
    2. 'jdbc:hsqldb:https://host[:port][/<alias>][<key-value-pairs>]' - * (with TLS). - *
    - *

    - * - * In both network server database connection <url> forms, the - * optional <alias> component is used to identify one of possibly - * several database instances available at the indicated host and port. If the - * <alias> component is omitted, then a connection is made to the - * network server's default database instance, if such an instance is - * available.

    - * - * For more information on server configuration regarding mounting multiple - * databases and assigning them <alias> values, please read the - * Java API documentation for {@link org.hsqldb.server.Server Server} and related - * chapters in the general documentation, especially the HyperSQL User - * Guide. - * - *


    - * - * Transient, In-Process Database Connections:

    - * - * The 100% in-memory (transient, in-process) database connection - * <url> takes one of the two following forms: - * - *

    - *
      - *
    1. 'jdbc:hsqldb:.[<key-value-pairs>]' - * (the legacy form, extended) - * - *
    2. 'jdbc:hsqldb:mem:<alias>[<key-value-pairs>]' - * (the new form) - *
    - *

    - * - * The driver converts the supplied <alias> component to - * Local.ENGLISH lower case and uses the resulting character sequence as the - * key used to look up a mem: protocol database instance amongst the - * collection of all such instances already in existence within the current - * class loading context in the current JVM. If no such instance exists, one - * may be automatically created and mapped to the <alias>, - * as governed by the 'ifexists=true|false' connection property.

    - * - * The rationale for converting the supplied <alias> component to - * lower case is to provide consistency with the behavior of res: - * protocol database connection <url>s, explained further on in - * this overview. - * - *


    - * - * Persistent, In-Process Database Connections:

    - * - * The standalone (persistent, in-process) database connection - * <url> takes one of the three following forms: - * - *

    - *
      - *
    1. 'jdbc:hsqldb:<path>[<key-value-pairs>]' - * (the legacy form, extended) - * - *
    2. 'jdbc:hsqldb:file:<path>[<key-value-pairs>]' - * (same semantics as the legacy form) - * - *
    3. 'jdbc:hsqldb:res:<path>[<key-value-pairs>]' - * (new form with 'files_in_jar' semantics) - *
    - *

    - * - * For the persistent, in-process database connection <url>, - * the <path> component is the path prefix common to all of - * the files that compose the database.

    - * - * From 1.7.2, although other files may be involved (such as transient working - * files and/or TEXT table CSV data source files), the essential set that may, - * at any particular point in time, compose an HSQLDB database is: - * - *

    - *
      - *
    • <path>.properties - *
    • <path>.script - *
    • <path>.log - *
    • <path>.data - *
    • <path>.backup - *
    • <path>.lck - *
    - *

    - * - * For example: 'jdbc:hsqldb:file:test' connects to a database - * composed of some subset of the files listed above, where the expansion - * of <path> is 'test' prefixed with the canonical path of - * the JVM's effective working directory at the time the designated database - * is first opened in-process.

    - * - * Be careful to note that this canonical expansion of <path> is - * cached by the driver until JVM exit. So, although legacy JVMs tend to fix - * the reported effective working directory at the one noted upon JVM startup, - * there is no guarantee that modern JVMs will continue to uphold this - * behaviour. What this means is there is effectively no guarantee into the - * future that a relative file: protocol database connection - * <url> will connect to the same database instance for the life - * of the JVM. To avoid any future ambiguity issues, it is probably a best - * practice for clients to attempt to pre-canonicalize the <path> - * component of file: protocol database connection* <url>s. - *

    - * - * Under Windows, - * 'jdbc:hsqldb:file:c:\databases\test' connects to a database located - * on drive 'C:' in the directory 'databases', composed - * of some subset of the files: - * - *

    - * C:\
    - * +--databases\
    - *    +--test.properties
    - *    +--test.script
    - *    +--test.log
    - *    +--test.data
    - *    +--test.backup
    - *    +--test.lck
    - * 
    - * - * Under most variations of UNIX, 'jdbc:hsqldb:file:/databases/test' - * connects to a database located in the directory 'databases' directly - * under root, once again composed of some subset of the files: - * - *
    - *
    - * +--databases
    - *    +--test.properties
    - *    +--test.script
    - *    +--test.log
    - *    +--test.data
    - *    +--test.backup
    - *    +--test.lck
    - * 
    - * - * Some Guidelines: - * - *
      - *
    1. Both relative and absolute database file paths are supported. - * - *
    2. Relative database file paths can be specified in a platform independent - * manner as: '[dir1/dir2/.../dirn/]<file-name-prefix>'. - * - *
    3. Specification of absolute file paths is operating-system specific.
      - * Please read your OS file system documentation. - * - *
    4. Specification of network mounts may be operating-system specific.
      - * Please read your OS file system documentation. - * - *
    5. Special care may be needed w.r.t. file path specifications - * containing whitespace, mixed-case, special characters and/or - * reserved file names.
      - * Please read your OS file system documentation. - *

    - * - * Note:HSQLDB creates - * directories along the file path specified in the persistent, in-process mode - * database connection <url> form, in the case that they did - * not already exist. - *


    - * - * res: protocol Connections:

    - * - * The 'jdbc:hsqldb:res:<path>' database connection - * <url> has different semantics than the - * 'jdbc:hsqldb:file:<path>' form. The semantics are similar to - * those of a 'files_readonly' database, but with some additional - * points to consider.

    - * - * Specifically, the '<path>' component of a res: protocol - * database connection <url> is first converted to lower case - * with Locale.ENGLISH and only then used to obtain resource URL - * objects, which in turn are used to read the database files as resources on - * the class path.

    - * - * Due to lower case conversion by the driver, res: '<path>' - * components never find jar resources stored with - * Locale.ENGLISH mixed case paths. The rationale for converting to - * lower case is that not all pkzip implementations guarantee path case is - * preserved when archiving resources, and conversion to lower case seems to - * be the most common occurrence (although there is also no actual guarantee - * that the conversion is Locale.ENGLISH).

    - * - * More importantly, res: '<path>' components must - * point only to resources contained in one or more jars on the class - * path. That is, only resources having the jar sub-protocol are considered - * valid.

    - * - * This restriction is enforced to avoid the unfortunate situation in which, - * because res: database instances do not create a <path>.lck - * file (they are strictly files-read-only) and because the <path> - * components of res: and file: database URIs are not - * checked for file system equivalence, it is possible for the same database - * files to be accessed concurrently by both file: and res: - * database instances. That is, without this restriction, it is possible that - * <path>.data and <path>.properties file content may - * be written by a file: database instance without the knowledge or - * cooperation of a res: database instance open on the same files, - * potentially resulting in unexpected database errors, inconsistent operation - * and/or data corruption.

    - * - * In short, a res: type database connection <url> is - * designed specifically to connect to a 'files_in_jar' mode database - * instance, which in turn is designed specifically to operate under - * Java WebStart and - * Java Applet configurations, - * where co-locating the database files in the jars that make up the - * WebStart application or Applet avoids the need for special security - * configuration or code signing.

    - * - * Note: Since it is difficult and often nearly impossible to determine - * or control at runtime from where all classes are being loaded or which class - * loader is doing the loading (and hence how relative path specifications - * are resolved) under 'files_in_jar' semantics, the <path> - * component of the res: database connection <url> is always - * taken to be relative to the default package and resource URL resolution is - * always performed using the ClassLoader that loads the - * org.hsqldb.persist.Logger class. That is, if the <path> - * component does not start with '/', then'/' is prepended when obtaining the - * resource URLs used to read the database files, and only the effective class - * path of org.hsqldb.persist.Logger's ClassLoader is searched. - * - *


    - * - * For more information about HSQLDB file structure, various database modes - * and other attributes such as those controlled through the HSQLDB properties - * files, please read the general documentation, especially the HyperSQL User - * Guide.

    - * - * JDBC 4.0 Notes:

    - * - * Starting with JDBC 4.0 (JDK 1.6), the DriverManager methods - * getConnection and getDrivers have been - * enhanced to support the Java Standard Edition Service Provider mechanism. - * HSQLDB distribution - * jars containing the Driver implementation also include the file - * META-INF/services/java.sql.Driver. This file contains the fully - * qualified class name ('org.hsqldb.jdbc.JDBCDriver') of the HSQLDB implementation - * of java.sql.Driver.

    - * - * Hence, under JDBC 4.0 or greater, applications no longer need to explicitly - * load the HSQLDB JDBC driver using Class.forName(). Of course, - * existing programs which do load JDBC drivers using - * Class.forName() will continue to work without modification. - * - *


    - * - * (fredt@users)
    - * (campbell-burnet@users)

    - * - *

    - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since HSQLDB 1.9.0 - * @see JDBCDriver - * @see JDBCStatement - * @see JDBCParameterMetaData - * @see JDBCCallableStatement - * @see JDBCResultSet - * @see JDBCDatabaseMetaData - * @see java.sql.DriverManager - * @see java.sql.Statement - * @see java.sql.ResultSet - * @see java.sql.DatabaseMetaData - */ -public class JDBCConnection implements Connection { - -// ----------------------------------- JDBC 1 ------------------------------- - - /** - * - * - * Creates a Statement object for sending - * SQL statements to the database. - * SQL statements without parameters are normally - * executed using Statement objects. If the same SQL statement - * is executed many times, it may be more efficient to use a - * PreparedStatement object. - *

    - * Result sets created using the returned Statement - * object will by default be type TYPE_FORWARD_ONLY - * and have a concurrency level of CONCUR_READ_ONLY. - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 1.7.2, support for precompilation at the engine level - * has been implemented, so it is now much more efficient and performant - * to use a PreparedStatement object if the same short-running - * SQL statement is to be executed many times.

    - * - * HSQLDB supports TYPE_FORWARD_ONLY, - * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY - * results.

    - * - *

    - * - * @return a new default Statement object - * @exception SQLException if a database access error occurs - * (JDBC4 clarification:) - * or this method is called on a closed connection - * @see #createStatement(int,int) - * @see #createStatement(int,int,int) - */ - public synchronized Statement createStatement() throws SQLException { - - checkClosed(); - - int props = - ResultProperties.getValueForJDBC(JDBCResultSet.TYPE_FORWARD_ONLY, - JDBCResultSet.CONCUR_READ_ONLY, - rsHoldability); - Statement stmt = new JDBCStatement(this, props); - - return stmt; - } - - /** - * - * - * Creates a PreparedStatement object for sending - * parameterized SQL statements to the database. - *

    - * A SQL statement with or without IN parameters can be - * pre-compiled and stored in a PreparedStatement object. This - * object can then be used to efficiently execute this statement - * multiple times. - * - *

    Note: This method is optimized for handling - * parametric SQL statements that benefit from precompilation. If - * the driver supports precompilation, - * the method prepareStatement will send - * the statement to the database for precompilation. Some drivers - * may not support precompilation. In this case, the statement may - * not be sent to the database until the PreparedStatement - * object is executed. This has no direct effect on users; however, it does - * affect which methods throw certain SQLException objects. - *

    - * Result sets created using the returned PreparedStatement - * object will by default be type TYPE_FORWARD_ONLY - * and have a concurrency level of CONCUR_READ_ONLY. - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 1.7.2, support for precompilation at the engine level - * has been implemented, so it is now much more efficient and performant - * to use a PreparedStatement object if the same short-running - * SQL statement is to be executed many times.

    - * - * The support for and behaviour of PreparedStatement complies with SQL and - * JDBC standards. Please read the introductory section - * of the documentation for ${link JDBCParameterMetaData}.

    - * - *

    - * - * @param sql an SQL statement that may contain one or more '?' IN - * parameter placeholders - * @return a new default PreparedStatement object containing the - * pre-compiled SQL statement - * @exception SQLException if a database access error occurs - * (JDBC4 clarification:) - * or this method is called on a closed connection - * @see #prepareStatement(String,int,int) - */ - public synchronized PreparedStatement prepareStatement(String sql) - throws SQLException { - - checkClosed(); - - try { - return new JDBCPreparedStatement( - this, sql, JDBCResultSet.TYPE_FORWARD_ONLY, - JDBCResultSet.CONCUR_READ_ONLY, rsHoldability, - ResultConstants.RETURN_NO_GENERATED_KEYS, null, null); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Creates a CallableStatement object for calling - * database stored procedures. - * The CallableStatement object provides - * methods for setting up its IN and OUT parameters, and - * methods for executing the call to a stored procedure. - * - *

    Note: This method is optimized for handling stored - * procedure call statements. Some drivers may send the call - * statement to the database when the method prepareCall - * is done; others - * may wait until the CallableStatement object - * is executed. This has no - * direct effect on users; however, it does affect which method - * throws certain SQLExceptions. - *

    - * Result sets created using the returned CallableStatement - * object will by default be type TYPE_FORWARD_ONLY - * and have a concurrency level of CONCUR_READ_ONLY. - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 1.7.2, the support for and behaviour of - * CallableStatement has changed. Please read the introductory section - * of the documentation for org.hsqldb.jdbc.JDBCCallableStatement. - * - *

    - * - * @param sql an SQL statement that may contain one or more '?' - * parameter placeholders. (JDBC4 clarification:) Typically this statement is specified using JDBC - * call escape syntax. - * @return a new default CallableStatement object containing the - * pre-compiled SQL statement - * @exception SQLException if a database access error occurs - * (JDBC4 clarification:) - * or this method is called on a closed connection - * @see #prepareCall(String,int,int) - */ - public synchronized CallableStatement prepareCall(String sql) - throws SQLException { - - CallableStatement stmt; - - checkClosed(); - - try { - stmt = new JDBCCallableStatement(this, sql, - JDBCResultSet.TYPE_FORWARD_ONLY, - JDBCResultSet.CONCUR_READ_ONLY, - rsHoldability); - - return stmt; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Converts the given SQL statement into the system's native SQL grammar. - * A driver may convert the JDBC SQL grammar into its system's - * native SQL grammar prior to sending it. This method returns the - * native form of the statement that the driver would have sent. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the JDBC SQL - * grammar into the system's native SQL grammar prior to sending - * it, if escape processing is set true; this method returns the - * native form of the statement that the driver would send in place - * of client-specified JDBC SQL grammar.

    - * - * Before 1.7.2, escape processing was incomplete and - * also broken in terms of support for nested escapes.

    - * - * Starting with 1.7.2, escape processing is complete and handles nesting - * to arbitrary depth, but enforces a very strict interpretation of the - * syntax and does not detect or process SQL comments.

    - * - * In essence, the HSQLDB engine directly handles the prescribed syntax - * and date / time formats specified internal to the JDBC escapes. - * It also directly offers the XOpen / ODBC extended scalar - * functions specified available internal to the {fn ...} JDBC escape. - * As such, the driver simply removes the curly braces and JDBC escape - * codes in the simplest and fastest fashion possible, by replacing them - * with whitespace. - * - * But to avoid a great deal of complexity, certain forms of input - * whitespace are currently not recognised. For instance, - * the driver handles "{?= call ...}" but not "{ ?= call ...} or - * "{? = call ...}"

    - * - * Also, comments embedded in SQL are currently not detected or - * processed and thus may have unexpected effects on the output - * of this method, for instance causing otherwise valid SQL to become - * invalid. It is especially important to be aware of this because escape - * processing is set true by default for Statement objects and is always - * set true when producing a PreparedStatement from prepareStatement() - * or CallableStatement from prepareCall(). Currently, it is simply - * recommended to avoid submitting SQL having comments containing JDBC - * escape sequence patterns and/or single or double quotation marks, - * as this will avoid any potential problems. - * - * It is intended to implement a less strict handling of whitespace and - * proper processing of SQL comments at some point in the near future. - * - * In any event, 1.7.2 now correctly processes the following JDBC escape - * forms to arbitrary nesting depth, but only if the exact whitespace - * layout described below is used: - * - *

      - *
    1. {call ...} - *
    2. {?= call ...} - *
    3. {fn ...} - *
    4. {oj ...} - *
    5. {d ...} - *
    6. {t ...} - *
    7. {ts ...} - *

    - * - *

    - * - * @param sql an SQL statement that may contain one or more '?' - * parameter placeholders - * @return the native form of this statement - * @exception SQLException if a database access error occurs - * (JDBC4 clarification:) - * or this method is called on a closed connection - */ - public synchronized String nativeSQL(final String sql) - throws SQLException { - - checkClosed(); - - if (sql == null || sql.isEmpty() || sql.indexOf('{') == -1) { - return sql; - } - - boolean changed = false; - int state = 0; - int len = sql.length(); - int nest = 0; - StringBuilder sb = null; - String msg; - - //-- - final int outside_all = 0; - final int outside_escape_inside_single_quotes = 1; - final int outside_escape_inside_double_quotes = 2; - - //-- - final int inside_escape = 3; - final int inside_escape_inside_single_quotes = 4; - final int inside_escape_inside_double_quotes = 5; - - /* @todo */ - - // final int inside_single_line_comment = 6; - // final int inside_multi_line_comment = 7; - // Better than old way for large inputs and for avoiding GC overhead; - // toString() reuses internal char[], reducing memory requirement - // and garbage items 3:2 - int tail = 0; - - for (int i = 0; i < len; i++) { - char c = sql.charAt(i); - - switch (state) { - - case outside_all : // Not inside an escape or quotes - if (c == '\'') { - state = outside_escape_inside_single_quotes; - } else if (c == '"') { - state = outside_escape_inside_double_quotes; - } else if (c == '{') { - if (sb == null) { - sb = new StringBuilder(sql.length()); - } - - sb.append(sql, tail, i); - - i = onStartEscapeSequence(sql, sb, i); - tail = i; - changed = true; - - nest++; - - state = inside_escape; - } - break; - - case outside_escape_inside_single_quotes : // inside ' ' only - case inside_escape_inside_single_quotes : // inside { } and ' ' - if (c == '\'') { - state -= 1; - } - break; - - case outside_escape_inside_double_quotes : // inside " " only - case inside_escape_inside_double_quotes : // inside { } and " " - if (c == '"') { - state -= 2; - } - break; - - case inside_escape : // inside { } - if (c == '\'') { - state = inside_escape_inside_single_quotes; - } else if (c == '"') { - state = inside_escape_inside_double_quotes; - } else if (c == '}') { - sb.append(sql, tail, i); - sb.append(' '); - - i++; - - tail = i; - changed = true; - - nest--; - - state = (nest == 0) ? outside_all - : inside_escape; - } else if (c == '{') { - sb.append(sql, tail, i); - - i = onStartEscapeSequence(sql, sb, i); - tail = i; - changed = true; - - nest++; - - state = inside_escape; - } - break; - - default : - } - } - - if (!changed) { - return sql; - } - - sb.append(sql.substring(tail)); - - return sb.toString(); - } - - /* - * @todo - semantics of autocommit regarding commit when the ResultSet is closed - */ - - /** - * - * - * Sets this connection's auto-commit mode to the given state. - * If a connection is in auto-commit mode, then all its SQL - * statements will be executed and committed as individual - * transactions. Otherwise, its SQL statements are grouped into - * transactions that are terminated by a call to either - * the method commit or the method rollback. - * By default, new connections are in auto-commit - * mode. - *

    - * The commit occurs when the statement completes. The time when the statement - * completes depends on the type of SQL Statement: - *

      - *
    • For DML statements, such as Insert, Update or Delete, and DDL statements, - * the statement is complete as soon as it has finished executing. - *
    • For Select statements, the statement is complete when the associated result - * set is closed. - *
    • For CallableStatement objects or for statements that return - * multiple results, the statement is complete - * when all of the associated result sets have been closed, and all update - * counts and output parameters have been retrieved. - *
    - *

    - * NOTE: If this method is called during a transaction and the - * auto-commit mode is changed, the transaction is committed. If - * setAutoCommit is called and the auto-commit mode is - * not changed, the call is a no-op. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Up to and including HSQLDB 2.0, - * - *

      - *
    1. All rows of a result set are retrieved internally - * before the first row can actually be fetched.
      - * Therefore, a statement can be considered complete as soon as - * any XXXStatement.executeXXX method returns.
    2. - *
    - *

    - * - * Starting with 2.0, HSQLDB may not return a result set to the network - * client as a whole; the generic documentation will apply. The fetch - * size is taken into account - * - * (campbell-burnet@users)

    - * - * @param autoCommit true to enable auto-commit mode; - * false to disable it - * @exception SQLException if a database access error occurs, - * (JDBC4 Clarification:) - * setAutoCommit(true) is called while participating in a distributed transaction, - * or this method is called on a closed connection - * @see #getAutoCommit - */ - public synchronized void setAutoCommit(boolean autoCommit) - throws SQLException { - - checkClosed(); - - try { - sessionProxy.setAutoCommit(autoCommit); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves the current auto-commit mode for this Connection - * object. - * - * @return the current state of this Connection object's - * auto-commit mode - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - * @see #setAutoCommit - */ - public synchronized boolean getAutoCommit() throws SQLException { - - checkClosed(); - - try { - return sessionProxy.isAutoCommit(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Makes all changes made since the previous - * commit/rollback permanent and releases any database locks - * currently held by this Connection object. - * This method should be - * used only when auto-commit mode has been disabled. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - *

    - * - * @exception SQLException if a database access error occurs, - * (JDBC4 Clarification:) - * this method is called while participating in a distributed transaction, - * if this method is called on a closed connection or this - * Connection object is in auto-commit mode - * @see #setAutoCommit - */ - public synchronized void commit() throws SQLException { - - checkClosed(); - - try { - sessionProxy.commit(false); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Undoes all changes made in the current transaction - * and releases any database locks currently held - * by this Connection object. This method should be - * used only when auto-commit mode has been disabled. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 1.7.2, savepoints are fully supported both - * in SQL and via the JDBC interface.

    - * - * Using SQL, savepoints may be set, released and used in rollback - * as follows: - * - *

    -     * SAVEPOINT <savepoint-name>
    -     * RELEASE SAVEPOINT <savepoint-name>
    -     * ROLLBACK TO SAVEPOINT <savepoint-name>
    -     * 
    - * - *
    - * - * @exception SQLException if a database access error occurs, - * (JDBC4 Clarification:) - * this method is called while participating in a distributed transaction, - * this method is called on a closed connection or this - * Connection object is in auto-commit mode - * @see #setAutoCommit - */ - public synchronized void rollback() throws SQLException { - - checkClosed(); - - try { - sessionProxy.rollback(false); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Releases this Connection object's database and JDBC resources - * immediately instead of waiting for them to be automatically released. - *

    - * Calling the method close on a Connection - * object that is already closed is a no-op. - *

    - * It is strongly recommended that an application explicitly - * commits or rolls back an active transaction prior to calling the - * close method. If the close method is called - * and there is an active transaction, the results are implementation-defined. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * From 1.7.2, HSQLDB INTERNAL Connection - * objects are not closable from JDBC client code.

    - * - *

    - * - * @exception SQLException if a database access error occurs - */ - public synchronized void close() throws SQLException { - - // Changed to synchronized above because - // we would not want a sessionProxy.close() - // operation to occur concurrently with a - // statementXXX.executeXXX operation. - if (isInternal || isClosed) { - return; - } - - isClosed = true; - rootWarning = null; - connProperties = null; - - if (isPooled) { - if (poolEventListener != null) { - poolEventListener.connectionClosed(); - - poolEventListener = null; - } - } else if (sessionProxy != null) { - sessionProxy.close(); - - sessionProxy = null; - } - } - - /** - * Retrieves whether this Connection object has been - * closed. A connection is closed if the method close - * has been called on it or if certain fatal errors have occurred. - * This method is guaranteed to return true only when - * it is called after the method Connection.close has - * been called. - *

    - * This method generally cannot be called to determine whether a - * connection to a database is valid or invalid. A typical client - * can determine that a connection is invalid by catching any - * exceptions that might be thrown when an operation is attempted. - * - * @return true if this Connection object - * is closed; false if it is still open - * @exception SQLException if a database access error occurs - */ - public synchronized boolean isClosed() throws SQLException { - return isClosed; - } - - //====================================================================== - // Advanced features: - - /** - * - * - * Retrieves a DatabaseMetaData object that contains - * metadata about the database to which this - * Connection object represents a connection. - * The metadata includes information about the database's - * tables, its supported SQL grammar, its stored - * procedures, the capabilities of this connection, and so on. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 essentially supports full database metadata.

    - * - * For discussion in greater detail, please follow the link to the - * overview for JDBCDatabaseMetaData, below. - * - *

    - * - * @return a DatabaseMetaData object for this - * Connection object - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification) - * or this method is called on a closed connection - * @see JDBCDatabaseMetaData - */ - public synchronized DatabaseMetaData getMetaData() throws SQLException { - - checkClosed(); - - return new JDBCDatabaseMetaData(this); - } - - /** - * - * - * Puts this connection in read-only mode as a hint to the driver to enable - * database optimizations. - * - *

    Note: This method cannot be called during a transaction. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports the SQL standard, which will not allow calls to - * this method to succeed during a transaction.

    - * - * Additionally, HSQLDB provides a way to put a whole database in - * read-only mode. This is done by manually adding the line - * 'readonly=true' to the database's .properties file while the - * database is offline. Upon restart, all connections will be - * readonly, since the entire database will be readonly. To take - * a database out of readonly mode, simply take the database - * offline and remove the line 'readonly=true' from the - * database's .properties file. Upon restart, the database will - * be in regular (read-write) mode.

    - * - * When a database is put in readonly mode, its files are opened - * in readonly mode, making it possible to create CD-based - * readonly databases. To create a CD-based readonly database - * that has CACHED tables and whose .data file is suspected of - * being highly fragmented, it is recommended that the database - * first be SHUTDOWN COMPACTed before copying the database - * files to CD. This will reduce the space required and may - * improve access times against the .data file which holds the - * CACHED table data.

    - * - * Starting with 1.7.2, an alternate approach to opimizing the - * .data file before creating a CD-based readonly database is to issue - * the CHECKPOINT DEFRAG command followed by SHUTDOWN to take the - * database offline in preparation to burn the database files to CD.

    - * - *

    - * - * @param readOnly true enables read-only mode; - * false disables it - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection or this - * method is called during a transaction - */ - public synchronized void setReadOnly(boolean readOnly) - throws SQLException { - - checkClosed(); - - try { - sessionProxy.setReadOnlyDefault(readOnly); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Retrieves whether this Connection - * object is in read-only mode. - * - * @return true if this Connection object - * is read-only; false otherwise - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - */ - public synchronized boolean isReadOnly() throws SQLException { - - checkClosed(); - - try { - return sessionProxy.isReadOnlyDefault(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Sets the given catalog name in order to select - * a subspace of this Connection object's database - * in which to work. - *

    - * - * (JDBC4 Clarification:)

    - * If the driver does not support catalogs, it will - * silently ignore this request. - * JDBC 4.1[

    - * Calling {@code setCatalog} has no effect on previously created or prepared - * {@code Statement} objects. It is implementation defined whether a DBMS - * prepare operation takes place immediately when the {@code Connection} - * method {@code prepareStatement} or {@code prepareCall} is invoked. - * For maximum portability, {@code setCatalog} should be called before a - * {@code Statement} is created or prepared.] - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports a single catalog per database. If the given catalog name - * is not the same as the database catalog name, this method throws an - * error.

    - *

    - * - * @param catalog the name of a catalog (subspace in this - * Connection object's database) in which to work - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification) - * or this method is called on a closed connection - * @see #getCatalog - */ - public synchronized void setCatalog(String catalog) throws SQLException { - - checkClosed(); - - try { - sessionProxy.setAttribute(SessionInterface.INFO_CATALOG, catalog); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Retrieves this Connection object's current catalog name. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports a single catalog per database. This method - * returns the catalog name for the current database - * error.

    - * - *

    - * - * @return the current catalog name or null if there is none - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - * @see #setCatalog - */ - public synchronized String getCatalog() throws SQLException { - - checkClosed(); - - try { - return (String) sessionProxy.getAttribute( - SessionInterface.INFO_CATALOG); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Attempts to change the transaction isolation level for this - * Connection object to the one given. - * The constants defined in the interface Connection - * are the possible transaction isolation levels. - *

    - * Note: If this method is called during a transaction, the result - * is implementation-defined. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 accepts all isolation levels. Connection.TRANSACTION_READ_UNCOMMITED - * is promoted to Connection.TRANSACTION_READ_COMMITED, but the transactions become read only. - * Calling this method during a transaction always succeeds and the selected - * isolation level is used from the next transaction.

    - * - *

    - * - * @param level one of the following Connection constants: - * Connection.TRANSACTION_READ_UNCOMMITTED, - * Connection.TRANSACTION_READ_COMMITTED, - * Connection.TRANSACTION_REPEATABLE_READ, or - * Connection.TRANSACTION_SERIALIZABLE. - * (Note that Connection.TRANSACTION_NONE cannot be used - * because it specifies that transactions are not supported.) - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection - * (:JDBC4 End Clarification) - * or the given parameter is not one of the Connection - * constants - * @see JDBCDatabaseMetaData#supportsTransactionIsolationLevel - * @see #getTransactionIsolation - */ - public synchronized void setTransactionIsolation(int level) - throws SQLException { - - checkClosed(); - - switch (level) { - - case TRANSACTION_READ_UNCOMMITTED : - case TRANSACTION_READ_COMMITTED : - case TRANSACTION_REPEATABLE_READ : - case TRANSACTION_SERIALIZABLE : - break; - - default : - throw JDBCUtil.invalidArgument(); - } - - try { - sessionProxy.setIsolationDefault(level); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Retrieves this Connection object's current - * transaction isolation level. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports all isolation levels. Connection.TRANSACTION_READ_UNCOMMITED - * is promoted to Connection.TRANSACTION_READ_COMMITED. - * - *

    - * - * @return the current transaction isolation level, which will be one - * of the following constants: - * Connection.TRANSACTION_READ_UNCOMMITTED, - * Connection.TRANSACTION_READ_COMMITTED, - * Connection.TRANSACTION_REPEATABLE_READ, - * Connection.TRANSACTION_SERIALIZABLE, or - * Connection.TRANSACTION_NONE. - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - * @see JDBCDatabaseMetaData#supportsTransactionIsolationLevel - * @see #setTransactionIsolation - */ - public synchronized int getTransactionIsolation() throws SQLException { - - checkClosed(); - - try { - return sessionProxy.getIsolation(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Retrieves the first warning reported by calls on this - * Connection object. If there is more than one - * warning, subsequent warnings will be chained to the first one - * and can be retrieved by calling the method - * SQLWarning.getNextWarning on the warning - * that was retrieved previously. - *

    - * This method may not be - * called on a closed connection; doing so will cause an - * SQLException to be thrown. - * - *

    Note: Subsequent warnings will be chained to this - * SQLWarning. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB produces warnings whenever a createStatement(), - * prepareStatement() or prepareCall() invocation requests an unsupported - * but defined combination of result set type, concurrency and holdability, - * such that another set is substituted.

    - * Other warnings are typically raised during the execution of data change - * and query statements.

    - * - * Only the warnings caused by the last operation on this connection are - * returned by this method. A single operation may return up to 10 chained - * warnings. - * - *

    - * @return the first SQLWarning object or null - * if there are none - * @exception SQLException if a database access error occurs or - * this method is called on a closed connection - * @see java.sql.SQLWarning - */ - public synchronized SQLWarning getWarnings() throws SQLException { - - checkClosed(); - - return rootWarning; - } - - /** - * - * - * Clears all warnings reported for this Connection object. - * After a call to this method, the method getWarnings - * returns null until a new warning is - * reported for this Connection object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The standard behaviour is implemented.

    - * - *

    - * - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - */ - public synchronized void clearWarnings() throws SQLException { - - checkClosed(); - - rootWarning = null; - } - - //--------------------------JDBC 2.0----------------------------- - - /** - * - * - * Creates a Statement object that will generate - * ResultSet objects with the given type and concurrency. - * This method is the same as the createStatement method - * above, but it allows the default result set - * type and concurrency to be overridden. - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - * interpretation of of resultSetType and resultSetConcurrency has - * changed in this version.

    - * - * HSQLDB supports TYPE_FORWARD_ONLY, - * TYPE_SCROLL_INSENSITIVE, - * CONCUR_READ_ONLY, - * CONCUR_UPDATABLE - * results.

    - * - * If an unsupported combination is requested, a SQLWarning is issued on - * this Connection and the closest supported combination is used instead.

    - * - *

    - * - * @param resultSetType a result set type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @param resultSetConcurrency a concurrency type; one of - * ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @return a new Statement object that will generate - * ResultSet objects with the given type and - * concurrency - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection - * (:JDBC4 Clarification) - * or the given parameters are not ResultSet - * constants indicating type and concurrency - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method or this method is not supported for the specified result - * set type and result set concurrency. - * @since JDK 1.2 - */ - public synchronized Statement createStatement(int resultSetType, - int resultSetConcurrency) throws SQLException { - - checkClosed(); - - int props = ResultProperties.getValueForJDBC(resultSetType, - resultSetConcurrency, rsHoldability); - - return new JDBCStatement(this, props); - } - - /** - * - * - * Creates a PreparedStatement object that will generate - * ResultSet objects with the given type and concurrency. - * This method is the same as the prepareStatement method - * above, but it allows the default result set - * type and concurrency to be overridden. - * (JDBC4 Clarification:) - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - * interpretation of of resultSetType and resultSetConcurrency has - * changed in this version.

    - * - * HSQLDB supports TYPE_FORWARD_ONLY, - * TYPE_SCROLL_INSENSITIVE, - * CONCUR_READ_ONLY, - * CONCUR_UPDATABLE - * results.

    - * - * If an unsupported combination is requested, a SQLWarning is issued on - * this Connection and the closest supported combination is used instead.

    - * - *

    - * - * @param sql a String object that is the SQL statement to - * be sent to the database; may contain one or more '?' IN - * parameters - * @param resultSetType a result set type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @param resultSetConcurrency a concurrency type; one of - * ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @return a new PreparedStatement object containing the - * pre-compiled SQL statement that will produce ResultSet - * objects with the given type and concurrency - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection - * (:JDBC4 Clarification) - * or the given parameters are not ResultSet - * constants indicating type and concurrency - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method or this method is not supported for the specified result - * set type and result set concurrency. - * @since JDK 1.2 - */ - public synchronized PreparedStatement prepareStatement(String sql, - int resultSetType, int resultSetConcurrency) throws SQLException { - - checkClosed(); - - try { - return new JDBCPreparedStatement( - this, sql, resultSetType, resultSetConcurrency, rsHoldability, - ResultConstants.RETURN_NO_GENERATED_KEYS, null, null); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Creates a CallableStatement object that will generate - * ResultSet objects with the given type and concurrency. - * This method is the same as the prepareCall method - * above, but it allows the default result set - * type and concurrency to be overridden. - * (JDBC4 Clarification:) - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - * interpretation of of resultSetType and resultSetConcurrency has - * changed in this version.

    - * - * HSQLDB supports TYPE_FORWARD_ONLY, - * TYPE_SCROLL_INSENSITIVE, - * CONCUR_READ_ONLY, - * CONCUR_UPDATABLE - * results.

    - * - * If an unsupported combination is requested, a SQLWarning is issued on - * this Connection and the closest supported combination is used instead.

    - * - *

    - * - * @param sql a String object that is the SQL statement to - * be sent to the database; may contain on or more '?' parameters - * @param resultSetType a result set type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @param resultSetConcurrency a concurrency type; one of - * ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @return a new CallableStatement object containing the - * pre-compiled SQL statement that will produce ResultSet - * objects with the given type and concurrency - * @exception SQLException if a database access error occurs, this method - * (JDBC4 Clarification:) - * is called on a closed connection - * (:JDBC4 Clarification) - * or the given parameters are not ResultSet - * constants indicating type and concurrency - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method or this method is not supported for the specified result - * set type and result set concurrency. - * @since JDK 1.2 - */ - public synchronized CallableStatement prepareCall(String sql, - int resultSetType, int resultSetConcurrency) throws SQLException { - - checkClosed(); - - try { - return new JDBCCallableStatement(this, sql, resultSetType, - resultSetConcurrency, - rsHoldability); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Retrieves the Map object associated with this - * Connection object. - * Unless the application has added an entry, the type map returned - * will be empty. - * JDBC 4.1[

    - * You must invoke setTypeMap after making changes to the - * Map object returned from - * getTypeMap as a JDBC driver may create an internal - * copy of the Map object passed to setTypeMap: - *

    -     *      Map<String,Class<?>> myMap = con.getTypeMap();
    -     *      myMap.put("mySchemaName.ATHLETES", Athletes.class);
    -     *      con.setTypeMap(myMap);
    -     * 
    ] - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * For compatibility, HSQLDB returns an empty map.

    - * - *

    - * - * @return the java.util.Map object associated - * with this Connection object - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - * @see #setTypeMap - */ - public synchronized Map> getTypeMap() - throws SQLException { - - checkClosed(); - - return new HashMap>(); - } - - /** - * - * - * Installs the given TypeMap object as the type map for - * this Connection object. The type map will be used for the - * custom mapping of SQL structured types and distinct types. - * JDBC4.1[

    - * You must set the values for the TypeMap prior to - * calling setMap as a JDBC driver may create an internal copy - * of the TypeMap: - * - *

    -     *      Map myMap<String,Class<?>> = new HashMap<String,Class<?>>();
    -     *      myMap.put("mySchemaName.ATHLETES", Athletes.class);
    -     *      con.setTypeMap(myMap);
    -     * 
    ] - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not yet support this feature. Calling this - * method always throws a SQLException, stating that - * the function is not supported.

    - * - *

    - * - * @param map the java.util.Map object to install - * as the replacement for this Connection - * object's default type map - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection or - * (:JDBC4 Clarification) - * the given parameter is not a java.util.Map - * object - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - * @see #getTypeMap - */ - public synchronized void setTypeMap(Map> map) - throws SQLException { - - checkClosed(); - - throw JDBCUtil.notSupported(); - } - - //--------------------------JDBC 3.0----------------------------- - - /** - * - * - * (JDBC4 Clarification:) - * Changes the default holdability of ResultSet objects - * created using this Connection object to the given - * holdability. The default holdability of ResultSet objects - * can be determined by invoking - * {@link DatabaseMetaData#getResultSetHoldability}. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * @param holdability a ResultSet holdability constant; one of - * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @throws SQLException if a database access occurs, this method is called - * (JDBC4 Clarification:) - * on a closed connection, or the given parameter - * (JDBC4 Clarification:) - * is not a ResultSet constant indicating holdability - * @exception SQLFeatureNotSupportedException if the given holdability is not supported - * @see #getHoldability - * @see DatabaseMetaData#getResultSetHoldability - * @see JDBCResultSet - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized void setHoldability(int holdability) - throws SQLException { - - checkClosed(); - - switch (holdability) { - - case JDBCResultSet.HOLD_CURSORS_OVER_COMMIT : - case JDBCResultSet.CLOSE_CURSORS_AT_COMMIT : - break; - - default : - throw JDBCUtil.invalidArgument(); - } - - rsHoldability = holdability; - } - - /** - * - * - * Retrieves the current holdability of ResultSet objects - * created using this Connection object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB returns the current holdability.

    - * - * The default is HOLD_CURSORS_OVER_COMMIT.

    - * - *

    - * - * @return the holdability, one of - * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @throws SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - * @see #setHoldability - * @see DatabaseMetaData#getResultSetHoldability - * @see JDBCResultSet - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized int getHoldability() throws SQLException { - - checkClosed(); - - return rsHoldability; - } - - /** - * - * - * Creates an unnamed savepoint in the current transaction and - * returns the new Savepoint object that represents it. - * - *

    (JDBC4 clarification:) if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created - * savepoint. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports this feature.

    - * - * Note: Unnamed savepoints are not part of the SQL:2003 standard. - * Use setSavepoint(String name) instead.

    - * - *

    - * - * @return the new Savepoint object - * @exception SQLException if a database access error occurs, - * (JDBC4 Clarification:) - * this method is called while participating in a distributed transaction, - * this method is called on a closed connection - * or this Connection object is currently in - * auto-commit mode - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see JDBCSavepoint - * @see java.sql.Savepoint - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized Savepoint setSavepoint() throws SQLException { - - checkClosed(); - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4 && getAutoCommit()) { - throw JDBCUtil.sqlException(ErrorCode.X_3B001); - } - - JDBCSavepoint savepoint = new JDBCSavepoint(this); - - try { - sessionProxy.savepoint(savepoint.name); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - return savepoint; - } - - /** - * - * - * Creates a savepoint with the given name in the current transaction - * and returns the new Savepoint object that represents it. - * - *

    if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created - * savepoint. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Previous to JDBC 4, if the connection is autoCommit, - * setting a savepoint has no effect, as it is cleared upon the execution - * of the next transactional statement. When built for JDBC 4, this method - * throws an SQLException when this Connection object is currently - * in auto-commit mode, as per the JDBC 4 standard. - *

    - * - * @param name a String containing the name of the savepoint - * @return the new Savepoint object - * @exception SQLException if a database access error occurs, - * (JDBC4 Clarification:) - * this method is called while participating in a distributed transaction, - * this method is called on a closed connection - * or this Connection object is currently in - * auto-commit mode - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see JDBCSavepoint - * @see java.sql.Savepoint - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized Savepoint setSavepoint(String name) - throws SQLException { - - checkClosed(); - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4 && getAutoCommit()) { - throw JDBCUtil.sqlException(ErrorCode.X_3B001); - } - - if (name == null) { - throw JDBCUtil.nullArgument(); - } - - if (name.startsWith("SYSTEM_SAVEPOINT_")) { - throw JDBCUtil.invalidArgument(); - } - - try { - sessionProxy.savepoint(name); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - return new JDBCSavepoint(name, this); - } - - /** - * - * - * Undoes all changes made after the given Savepoint object - * was set. - *

    - * This method should be used only when auto-commit has been disabled. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Previous to JDBC 4, JDBCSavepoint objects are valid for the life of - * the originating Connection object and hence can be used - * interchangeably, as long as they have equal savepoint names.

    - * - * When built for JDBC 4, JDBCConnection objects invalidate - * JDBCSavepoint objects when auto-commit mode is entered as well - * as when they are used to successfully release or roll back to a named SQL - * savepoint. As per the JDBC 4 standard, when built for JDBC 4, this - * method throws an SQLException when this Connection - * object is currently in auto-commit mode and an invalidated - * JDBCSavepoint is specified. - *

    - * - * @param savepoint the Savepoint object to roll back to - * @exception SQLException if a database access error occurs, - * this method is called while participating in a distributed transaction, - * this method is called on a closed connection, - * the Savepoint object is no longer valid, - * or this Connection object is currently in - * auto-commit mode - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see JDBCSavepoint - * @see java.sql.Savepoint - * @see #rollback - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized void rollback(Savepoint savepoint) - throws SQLException { - - JDBCSavepoint sp; - - checkClosed(); - - if (savepoint == null) { - throw JDBCUtil.nullArgument(); - } - - if (!(savepoint instanceof JDBCSavepoint)) { - throw JDBCUtil.invalidArgument(ErrorCode.X_3B001); - } - - sp = (JDBCSavepoint) savepoint; - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4 && sp.name == null) { - throw JDBCUtil.invalidArgument(ErrorCode.X_3B001); - } - - if (this != sp.connection) { - throw JDBCUtil.invalidArgument(ErrorCode.X_3B001); - } - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4 && getAutoCommit()) { - sp.name = null; - sp.connection = null; - - throw JDBCUtil.sqlException(ErrorCode.X_3B001); - } - - try { - sessionProxy.rollbackToSavepoint(sp.name); - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4) { - sp.connection = null; - sp.name = null; - } - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Removes the specified Savepoint (JDBC4 Clarification:) and subsequent Savepoint objects from the current - * transaction. Any reference to the savepoint after it have been removed - * will cause an SQLException to be thrown. - * - * - * - * - * HSLQDB Note:

    - * - * Previous to JDBC 4, JDBCSavepoint objects are valid for the life of - * the originating Connection object and hence can be used - * interchangeably, as long as they have equal savepoint names.

    - * - * When built for JDBC 4, JDBCConnection objects invalidate - * JDBCSavepoint objects when auto-commit mode is entered as well - * as when they are used to successfully release or roll back to a named SQL - * savepoint. As per the JDBC 4 standard, when built for JDBC 4, this - * method throws an SQLException when this Connection - * object is currently in auto-commit mode and when an invalidated - * JDBCSavepoint is specified.

    - * - * @param savepoint the Savepoint object to be removed - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection or - * the given Savepoint object is not a valid - * savepoint in the current transaction - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see JDBCSavepoint - * @see java.sql.Savepoint - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized void releaseSavepoint(Savepoint savepoint) - throws SQLException { - - JDBCSavepoint sp; - Result req; - - checkClosed(); - - if (savepoint == null) { - throw JDBCUtil.nullArgument(); - } - - if (!(savepoint instanceof JDBCSavepoint)) { - throw JDBCUtil.invalidArgument(ErrorCode.X_3B001); - } - - sp = (JDBCSavepoint) savepoint; - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4 && sp.name == null) { - throw JDBCUtil.invalidArgument(ErrorCode.X_3B001); - } - - if (this != sp.connection) { - throw JDBCUtil.invalidArgument(ErrorCode.X_3B001); - } - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4 && getAutoCommit()) { - sp.name = null; - sp.connection = null; - - throw JDBCUtil.invalidArgument(ErrorCode.X_3B001); - } - - try { - sessionProxy.releaseSavepoint(sp.name); - - if (JDBCDatabaseMetaData.JDBC_MAJOR >= 4) { - sp.connection = null; - sp.name = null; - } - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Creates a Statement object that will generate - * ResultSet objects with the given type, concurrency, - * and holdability. - * This method is the same as the createStatement method - * above, but it allows the default result set - * type, concurrency, and holdability to be overridden. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - * interpretation of of resultSetType and resultSetConcurrency has - * changed in this version.

    - * - * HSQLDB supports TYPE_FORWARD_ONLY, - * TYPE_SCROLL_INSENSITIVE, - * CONCUR_READ_ONLY, - * CONCUR_UPDATABLE - * results.

    - * - * If an unsupported combination is requested, a SQLWarning is issued on - * this Connection and the closest supported combination is used instead.

    - * - *

    - * - * @param resultSetType one of the following ResultSet - * constants: - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @param resultSetConcurrency one of the following ResultSet - * constants: - * ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @param resultSetHoldability one of the following ResultSet - * constants: - * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @return a new Statement object that will generate - * ResultSet objects with the given type, - * concurrency, and holdability - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection - * (:JDBC4 Clarification) - * or the given parameters are not ResultSet - * constants indicating type, concurrency, and holdability - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method or this method is not supported for the specified result - * set type, result set holdability and result set concurrency. - * @see JDBCResultSet - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized Statement createStatement(int resultSetType, - int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - - checkClosed(); - - int props = ResultProperties.getValueForJDBC(resultSetType, - resultSetConcurrency, resultSetHoldability); - - return new JDBCStatement(this, props); - } - - /** - * - * - * Creates a PreparedStatement object that will generate - * ResultSet objects with the given type, concurrency, - * and holdability. - *

    - * This method is the same as the prepareStatement method - * above, but it allows the default result set - * type, concurrency, and holdability to be overridden. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - * interpretation of of resultSetType and resultSetConcurrency has - * changed in this version.

    - * - * HSQLDB supports TYPE_FORWARD_ONLY, - * TYPE_SCROLL_INSENSITIVE, - * CONCUR_READ_ONLY, - * CONCUR_UPDATABLE - * results.

    - * HOLD_CURSORS_OVER_COMMIT is supported only when - * CONCUR_READ_ONLY is requested.

    - * - * - * If an unsupported combination is requested, a SQLWarning is issued on - * this Connection and the closest supported combination is used instead.

    - * - *

    - * - * @param sql a String object that is the SQL statement to - * be sent to the database; may contain one or more '?' IN - * parameters - * @param resultSetType one of the following ResultSet - * constants: - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @param resultSetConcurrency one of the following ResultSet - * constants: - * ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @param resultSetHoldability one of the following ResultSet - * constants: - * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @return a new PreparedStatement object, containing the - * pre-compiled SQL statement, that will generate - * ResultSet objects with the given type, - * concurrency, and holdability - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection - * (:JDBC4 Clarification) - * or the given parameters are not ResultSet - * constants indicating type, concurrency, and holdability - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method or this method is not supported for the specified result - * set type, result set holdability and result set concurrency. - * @see JDBCResultSet - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized PreparedStatement prepareStatement(String sql, - int resultSetType, int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - - checkClosed(); - - try { - return new JDBCPreparedStatement( - this, sql, resultSetType, resultSetConcurrency, - resultSetHoldability, - ResultConstants.RETURN_NO_GENERATED_KEYS, null, null); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Creates a CallableStatement object that will generate - * ResultSet objects with the given type and concurrency. - * This method is the same as the prepareCall method - * above, but it allows the default result set - * type, result set concurrency type and holdability to be overridden. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 adheres closely to SQL and JDBC standards. The - * interpretation of of resultSetType and resultSetConcurrency has - * changed in this version.

    - * - * HSQLDB supports TYPE_FORWARD_ONLY, - * TYPE_SCROLL_INSENSITIVE, - * CONCUR_READ_ONLY, - * CONCUR_UPDATABLE - * results.

    - * - * If an unsupported combination is requested, a SQLWarning is issued on - * this Connection and the closest supported combination is used instead.

    - * - *

    - * - * @param sql a String object that is the SQL statement to - * be sent to the database; may contain on or more '?' parameters - * @param resultSetType one of the following ResultSet - * constants: - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @param resultSetConcurrency one of the following ResultSet - * constants: - * ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @param resultSetHoldability one of the following ResultSet - * constants: - * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @return a new CallableStatement object, containing the - * pre-compiled SQL statement, that will generate - * ResultSet objects with the given type, - * concurrency, and holdability - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection - * (:JDBC4 Clarification) - * or the given parameters are not ResultSet - * constants indicating type, concurrency, and holdability - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method or this method is not supported for the specified result - * set type, result set holdability and result set concurrency. - * @see JDBCResultSet - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized CallableStatement prepareCall(String sql, - int resultSetType, int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - - checkClosed(); - - try { - return new JDBCCallableStatement(this, sql, resultSetType, - resultSetConcurrency, - resultSetHoldability); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Creates a default PreparedStatement object that has - * the capability to retrieve auto-generated keys. The given constant - * tells the driver whether it should make auto-generated keys - * available for retrieval. This parameter is ignored if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * Note: This method is optimized for handling - * parametric SQL statements that benefit from pre-compilation. If - * the driver supports pre-compilation, - * the method prepareStatement will send - * the statement to the database for pre-compilation. Some drivers - * may not support pre-compilation. In this case, the statement may - * not be sent to the database until the PreparedStatement - * object is executed. This has no direct effect on users; however, it does - * affect which methods throw certain SQLExceptions. - *

    - * Result sets created using the returned PreparedStatement - * object will by default be type TYPE_FORWARD_ONLY - * and have a concurrency level of CONCUR_READ_ONLY. - * (JDBC4 Clarification:) - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports returning generated columns - * with single-row and multi-row INSERT, UPDATE and MERGE statements.

    - * If the table has an IDENTITY or GENERATED column(s) the values for these - * columns are returned in the next call to getGeneratedKeys() after each - * execution of the PreparedStatement.

    - * - * HSQLDB also supports returning primary key values from he rows by using the - * org.hsqldb.jdbc.JDBCStatement.RETURN_PRIMARY_KEYS constant.

    - * - *

    - * - * @param sql an SQL statement that may contain one or more '?' IN - * parameter placeholders - * @param autoGeneratedKeys a flag indicating whether auto-generated keys - * should be returned; one of - * Statement.RETURN_GENERATED_KEYS or - * Statement.NO_GENERATED_KEYS - * @return a new PreparedStatement object, containing the - * pre-compiled SQL statement, that will have the capability of - * returning auto-generated keys - * @exception SQLException if a database access error occurs, this - * (JDBC4 Clarification:) - * method is called on a closed connection - * (:JDBC4 Clarification) - * or the given parameter is not a Statement - * constant indicating whether auto-generated keys should be - * returned - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method with a constant of Statement.RETURN_GENERATED_KEYS - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized PreparedStatement prepareStatement(String sql, - int autoGeneratedKeys) throws SQLException { - - checkClosed(); - - try { - if (autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS - && autoGeneratedKeys != Statement.NO_GENERATED_KEYS - && autoGeneratedKeys - != JDBCStatement.RETURN_PRIMARY_KEYS) { - throw JDBCUtil.invalidArgument("autoGeneratedKeys"); - } - - return new JDBCPreparedStatement(this, sql, - JDBCResultSet.TYPE_FORWARD_ONLY, - JDBCResultSet.CONCUR_READ_ONLY, - rsHoldability, autoGeneratedKeys, - null, null); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * Creates a default PreparedStatement object capable - * of returning the auto-generated keys designated by the given array. - * This array contains the indexes of the columns in the target - * table that contain the auto-generated keys that should be made - * available. The driver will ignore the array if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * An SQL statement with or without IN parameters can be - * pre-compiled and stored in a PreparedStatement object. This - * object can then be used to efficiently execute this statement - * multiple times. - *

    - * Note: This method is optimized for handling - * parametric SQL statements that benefit from pre-compilation. If - * the driver supports pre-compilation, - * the method prepareStatement will send - * the statement to the database for pre-compilation. Some drivers - * may not support pre-compilation. In this case, the statement may - * not be sent to the database until the PreparedStatement - * object is executed. This has no direct effect on users; however, it does - * affect which methods throw certain SQLExceptions. - *

    - * Result sets created using the returned PreparedStatement - * object will by default be type TYPE_FORWARD_ONLY - * and have a concurrency level of CONCUR_READ_ONLY. - * (JDBC4 Clarification:) - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports returning generated columns - * with single-row and multi-row INSERT, UPDATE and MERGE statements.

    - * The columnIndexes may specify any set of columns of the table. - * - *

    - * - * @param sql an SQL statement that may contain one or more '?' IN - * parameter placeholders - * @param columnIndexes an array of column indexes indicating the columns - * that should be returned from the inserted row or rows - * @return a new PreparedStatement object, containing the - * pre-compiled statement, that is capable of returning the - * auto-generated keys designated by the given array of column - * indexes - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized PreparedStatement prepareStatement(String sql, - int[] columnIndexes) throws SQLException { - - checkClosed(); - - try { - return new JDBCPreparedStatement( - this, sql, JDBCResultSet.TYPE_FORWARD_ONLY, - JDBCResultSet.CONCUR_READ_ONLY, rsHoldability, - ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES, - columnIndexes, null); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * - * Creates a default PreparedStatement object capable - * of returning the auto-generated keys designated by the given array. - * This array contains the names of the columns in the target - * table that contain the auto-generated keys that should be returned. - * The driver will ignore the array if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * An SQL statement with or without IN parameters can be - * pre-compiled and stored in a PreparedStatement object. This - * object can then be used to efficiently execute this statement - * multiple times. - *

    - * Note: This method is optimized for handling - * parametric SQL statements that benefit from pre-compilation. If - * the driver supports pre-compilation, - * the method prepareStatement will send - * the statement to the database for pre-compilation. Some drivers - * may not support pre-compilation. In this case, the statement may - * not be sent to the database until the PreparedStatement - * object is executed. This has no direct effect on users; however, it does - * affect which methods throw certain SQLExceptions. - *

    - * Result sets created using the returned PreparedStatement - * object will by default be type TYPE_FORWARD_ONLY - * and have a concurrency level of CONCUR_READ_ONLY. - * (JDBC4 Clarification:) - * The holdability of the created result sets can be determined by - * calling {@link #getHoldability}. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports returning generated columns - * with single-row and multi-row INSERT, UPDATE and MERGE statements.

    - * The columnNames may specify any set of columns of the table. The names - * are case-sensitive, unlike column names in ResultSet methods. - * - *

    - * - * @param sql an SQL statement that may contain one or more '?' IN - * parameter placeholders - * @param columnNames an array of column names indicating the columns - * that should be returned from the inserted row or rows - * @return a new PreparedStatement object, containing the - * pre-compiled statement, that is capable of returning the - * auto-generated keys designated by the given array of column - * names - * @exception SQLException if a database access error occurs - * (JDBC4 Clarification:) - * or this method is called on a closed connection - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public synchronized PreparedStatement prepareStatement(String sql, - String[] columnNames) throws SQLException { - - checkClosed(); - - try { - return new JDBCPreparedStatement( - this, sql, JDBCResultSet.TYPE_FORWARD_ONLY, - JDBCResultSet.CONCUR_READ_ONLY, rsHoldability, - ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES, null, - columnNames); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * Constructs an object that implements the Clob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of - * the Clob interface may be used to add data to the Clob. - * @return An object that implements the Clob interface - * @throws SQLException if an object that implements the - * Clob interface can not be constructed, this method is - * called on a closed connection or a database access error occurs. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this data type - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public Clob createClob() throws SQLException { - - checkClosed(); - - return new JDBCClob(); - } - - /** - * Constructs an object that implements the Blob interface. The object - * returned initially contains no data. The setBinaryStream and - * setBytes methods of the Blob interface may be used to add data to - * the Blob. - * @return An object that implements the Blob interface - * @throws SQLException if an object that implements the - * Blob interface can not be constructed, this method is - * called on a closed connection or a database access error occurs. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this data type - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public Blob createBlob() throws SQLException { - - checkClosed(); - - return new JDBCBlob(); - } - - /** - * Constructs an object that implements the NClob interface. The object - * returned initially contains no data. The setAsciiStream, - * setCharacterStream and setString methods of the NClob interface may - * be used to add data to the NClob. - * @return An object that implements the NClob interface - * @throws SQLException if an object that implements the - * NClob interface can not be constructed, this method is - * called on a closed connection or a database access error occurs. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this data type - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public NClob createNClob() throws SQLException { - - checkClosed(); - - return new JDBCNClob(); - } - - /** - * Constructs an object that implements the SQLXML interface. The object - * returned initially contains no data. The createXmlStreamWriter object and - * setString method of the SQLXML interface may be used to add data to the SQLXML - * object. - * @return An object that implements the SQLXML interface - * @throws SQLException if an object that implements the SQLXML interface can not - * be constructed, this method is - * called on a closed connection or a database access error occurs. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this data type - * @since JDK 1.6, HSQLDB 2.0 - */ - public SQLXML createSQLXML() throws SQLException { - - checkClosed(); - - return new JDBCSQLXML(); - } - - /* @todo: ThreadPool? HsqlTimer with callback? */ - - /** - * - * - * Returns true if the connection has not been closed and is still valid. - * The driver shall submit a query on the connection or use some other - * mechanism that positively verifies the connection is still valid when - * this method is called. - *

    - * The query submitted by the driver to validate the connection shall be - * executed in the context of the current transaction. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB uses a maximum timeout of 60 seconds if timeout has been specified - * as zero. - * - *

    - * - * @param timeout - The time in seconds to wait for the database operation - * used to validate the connection to complete. If - * the timeout period expires before the operation - * completes, this method returns false. A value of - * 0 indicates a timeout is not applied to the - * database operation. - * - * @return true if the connection is valid, false otherwise - * @exception SQLException if the value supplied for timeout - * is less than 0 - * @since JDK 1.6, HSQLDB 2.0 - * - * @see JDBCDatabaseMetaData#getClientInfoProperties - */ - public boolean isValid(int timeout) throws SQLException { - - if (timeout < 0) { - throw JDBCUtil.outOfRangeArgument("timeout: " + timeout); - } - - if (this.isInternal) { - return true; - } else if (!this.isNetConn) { - return !this.isClosed(); - } else if (this.isClosed()) { - return false; - } - - final boolean[] flag = new boolean[]{ true }; - Thread t = new Thread() { - - public void run() { - - try { - getMetaData().getDatabaseMajorVersion(); - } catch (Throwable e) { - flag[0] = false; - } - } - }; - - if (timeout > 60) { - timeout = 60; - } - - // Remember: param is in *seconds* - timeout *= 1000; - - try { - t.start(); - - final long start = System.currentTimeMillis(); - - t.join(timeout); - - try { - t.setContextClassLoader(null); - } catch (Throwable th) {} - - if (timeout == 0) { - return flag[0]; - } - - return flag[0] && (System.currentTimeMillis() - start) < timeout; - } catch (Throwable e) { - return false; - } - } - - /* @todo 20051207 */ - - /** - * Sets the value of the client info property specified by name to the - * value specified by value. - *

    - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver - * and the maximum length that may be specified for each property. - *

    - * The driver stores the value specified in a suitable location in the - * database. For example in a special register, session parameter, or - * system table column. For efficiency the driver may defer setting the - * value in the database until the next time a statement is executed or - * prepared. Other than storing the client information in the appropriate - * place in the database, these methods shall not alter the behavior of - * the connection in any way. The values supplied to these methods are - * used for accounting, diagnostics and debugging purposes only. - *

    - * The driver shall generate a warning if the client info name specified - * is not recognized by the driver. - *

    - * If the value specified to this method is greater than the maximum - * length for the property the driver may either truncate the value and - * generate a warning or generate a SQLClientInfoException. If the driver - * generates a SQLClientInfoException, the value specified was not set on the - * connection. - *

    - * The following are standard client info properties. Drivers are not - * required to support these properties however if the driver supports a - * client info property that can be described by one of the standard - * properties, the standard property name should be used. - * - *

      - *
    • ApplicationName - The name of the application currently utilizing - * the connection
    • - *
    • ClientUser - The name of the user that the application using - * the connection is performing work for. This may - * not be the same as the user name that was used - * in establishing the connection.
    • - *
    • ClientHostname - The host name of the computer the application - * using the connection is running on.
    • - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0, throws an SQLClientInfoException when this method is - * called. - *

    - * - * - * @param name The name of the client info property to set - * @param value The value to set the client info property to. If the - * value is null, the current value of the specified - * property is cleared. - *

    - * @throws SQLClientInfoException if the database server returns an error while - * setting the client info value on the database server or this method - * is called on a closed connection - *

    - * @since JDK 1.6, HSQLDB 2.0 - */ - public void setClientInfo(String name, - String value) throws SQLClientInfoException { - - SQLClientInfoException ex = new SQLClientInfoException(); - - ex.initCause(JDBCUtil.notSupported()); - - throw ex; - } - - /* @todo 20051207 */ - - /** - * Sets the value of the connection's client info properties. The - * Properties object contains the names and values of the client info - * properties to be set. The set of client info properties contained in - * the properties list replaces the current set of client info properties - * on the connection. If a property that is currently set on the - * connection is not present in the properties list, that property is - * cleared. Specifying an empty properties list will clear all of the - * properties on the connection. See setClientInfo (String, String) for - * more information. - *

    - * If an error occurs in setting any of the client info properties, a - * SQLClientInfoException is thrown. The SQLClientInfoException - * contains information indicating which client info properties were not set. - * The state of the client information is unknown because - * some databases do not allow multiple client info properties to be set - * atomically. For those databases, one or more properties may have been - * set before the error occurred. - *

    - * - * @param properties the list of client info properties to set - *

    - * @see java.sql.Connection#setClientInfo(String, String) setClientInfo(String, String) - * @since JDK 1.6, HSQLDB 2.0 - *

    - * @throws SQLClientInfoException if the database server returns an error while - * setting the clientInfo values on the database server or this method - * is called on a closed connection - * - */ - public void setClientInfo(Properties properties) - throws SQLClientInfoException { - - if (!this.isClosed && (properties == null || properties.isEmpty())) { - return; - } - - SQLClientInfoException ex = new SQLClientInfoException(); - - if (this.isClosed) { - ex.initCause(JDBCUtil.connectionClosedException()); - } else { - ex.initCause(JDBCUtil.notSupported()); - } - - throw ex; - } - - /* @todo 1.9.0 */ - - /** - * Returns the value of the client info property specified by name. This - * method may return null if the specified client info property has not - * been set and does not have a default value. This method will also - * return null if the specified client info property name is not supported - * by the driver. - *

    - * Applications may use the DatabaseMetaData.getClientInfoProperties - * method to determine the client info properties supported by the driver. - *

    - * @param name The name of the client info property to retrieve - *

    - * @return The value of the client info property specified - *

    - * @throws SQLException if the database server returns an error when - * fetching the client info value from the database - * or this method is called on a closed connection - *

    - * @since JDK 1.6, HSQLDB 2.0 - * - * @see java.sql.DatabaseMetaData#getClientInfoProperties - */ - public String getClientInfo(String name) throws SQLException { - - checkClosed(); - - return null; - } - - /* @todo - 1.9 */ - - /** - * Returns a list containing the name and current value of each client info - * property supported by the driver. The value of a client info property - * may be null if the property has not been set and does not have a - * default value. - *

    - * @return A Properties object that contains the name and current value of - * each of the client info properties supported by the driver. - *

    - * @throws SQLException if the database server returns an error when - * fetching the client info values from the database - * or this method is called on a closed connection - *

    - * @since JDK 1.6, HSQLDB 2.0 - */ - public Properties getClientInfo() throws SQLException { - - checkClosed(); - - return null; - } - -// --------------------------- Added: Mustang Build 80 ------------------------- - - /** - * Factory method for creating Array objects. - *

    - * Note: When createArrayOf is used to create an array object - * that maps to a primitive data type, then it is implementation-defined - * whether the Array object is an array of that primitive - * data type or an array of Object. - *

    - * Note: The JDBC driver is responsible for mapping the elements - * Object array to the default JDBC SQL type defined in - * java.sql.Types for the given class of Object. The default - * mapping is specified in Appendix B of the JDBC specification. If the - * resulting JDBC type is not the appropriate type for the given typeName then - * it is implementation defined whether an SQLException is - * thrown or the driver supports the resulting conversion. - * - * @param typeName the SQL name of the type the elements of the array map to. The typeName is a - * database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This - * is the value returned by Array.getBaseTypeName - * @param elements the elements that populate the returned object - * @return an Array object whose elements map to the specified SQL type - * @throws SQLException if a database error occurs, the JDBC type is not - * appropriate for the typeName and the conversion is not supported, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - * @since 1.6 - */ - public Array createArrayOf(String typeName, - Object[] elements) throws SQLException { - - checkClosed(); - - if (typeName == null) { - throw JDBCUtil.nullArgument(); - } - - typeName = typeName.toUpperCase(); - - int typeNumber = Type.getTypeNr(typeName); - - if (typeNumber == Integer.MIN_VALUE) { - throw JDBCUtil.invalidArgument(typeName); - } - - Type type = Type.getDefaultType(typeNumber); - - if (type.isArrayType() || type.isLobType() || type.isRowType()) { - throw JDBCUtil.invalidArgument(typeName); - } - - Object[] newData = new Object[elements.length]; - - try { - for (int i = 0; i < elements.length; i++) { - Object o = type.convertJavaToSQL(sessionProxy, elements[i]); - - newData[i] = type.convertToTypeLimits(sessionProxy, o); - } - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - Type arrayType = new ArrayType(type, newData.length); - - return new JDBCArray(newData, type, arrayType, this); - } - - /** - * Factory method for creating Struct objects. - * @param typeName the SQL type name of the SQL structured type that this Struct - * object maps to. The typeName is the name of a user-defined type that - * has been defined for this database. It is the value returned by - * Struct.getSQLTypeName. - * @param attributes the attributes that populate the returned object - * @return a Struct object that maps to the given SQL type and is populated with the given attributes - * @throws SQLException if a database error occurs, the typeName is null or this method is called on a closed connection - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this data type - * @since JDK 1.6_b80, HSQLDB 2.0 - */ - public Struct createStruct(String typeName, - Object[] attributes) throws SQLException { - - checkClosed(); - - throw JDBCUtil.notSupported(); - } - -// ------------------- java.sql.Wrapper implementation --------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return - * the result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param by which the return type is inferred from input parameter. - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 2.0 - */ - @SuppressWarnings("unchecked") - public T unwrap(Class iface) throws java.sql.SQLException { - - checkClosed(); - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isWrapperFor(Class iface) throws SQLException { - - checkClosed(); - - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - - //--------------------------JDBC 4.1 ----------------------------- - - /** - * Sets the given schema name to access. - *

    - * If the driver does not support schemas, it will - * silently ignore this request. - *

    - * Calling {@code setSchema} has no effect on previously created or prepared - * {@code Statement} objects. It is implementation defined whether a DBMS - * prepare operation takes place immediately when the {@code Connection} - * method {@code prepareStatement} or {@code prepareCall} is invoked. - * For maximum portability, {@code setSchema} should be called before a - * {@code Statement} is created or prepared. - * - * @param schema the name of a schema in which to work - * @exception SQLException if a database access error occurs - * or this method is called on a closed connection - * @see #getSchema - * @since JDK 1.7, HSQLDB 2.0.1 - */ - public synchronized void setSchema(String schema) throws SQLException { - - checkClosed(); - - if (schema == null) { - throw JDBCUtil.nullArgument("schema"); - } else if (schema.length() == 0) { - throw JDBCUtil.invalidArgument("Zero-length schema"); - } else { - (new JDBCDatabaseMetaData(this)).setConnectionDefaultSchema( - schema); - } - } - - /** - * Retrieves this Connection object's current schema name. - * - * @return the current schema name or null if there is none - * @exception SQLException if a database access error occurs - * or this method is called on a closed connection - * @see #setSchema - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public String getSchema() throws SQLException { - - checkClosed(); - - return new JDBCDatabaseMetaData(this).getConnectionDefaultSchema(); - } - - /** - * Terminates an open connection. Calling abort results in: - *

      - *
    • The connection marked as closed - *
    • Closes any physical connection to the database - *
    • Releases resources used by the connection - *
    • Insures that any thread that is currently accessing the connection - * will either progress to completion or throw an SQLException. - *
    - *

    - * Calling abort marks the connection closed and releases any - * resources. Calling abort on a closed connection is a - * no-op. - *

    - * It is possible that the aborting and releasing of the resources that are - * held by the connection can take an extended period of time. When the - * abort method returns, the connection will have been marked as - * closed and the Executor that was passed as a parameter to abort - * may still be executing tasks to release resources. - *

    - * This method checks to see that there is an SQLPermission - * object before allowing the method to proceed. If a - * SecurityManager exists and its - * checkPermission method denies calling abort, - * this method throws a - * java.lang.SecurityException. - * @param executor The Executor implementation which will - * be used by abort. - * @throws java.sql.SQLException if a database access error occurs or - * the {@code executor} is {@code null}, - * @throws java.lang.SecurityException if a security manager exists and its - * checkPermission method denies calling abort - * @see SecurityManager#checkPermission - * @see java.util.concurrent.Executor - * @since JDK 1.7, HSQLDB 2.0.1 - */ - public void abort(java.util.concurrent.Executor executor) - throws SQLException { - - if (executor == null) { - throw JDBCUtil.nullArgument("executor"); - } - - close(); - } - - /** - * - * Sets the maximum period a Connection or - * objects created from the Connection - * will wait for the database to reply to any one request. If any - * request remains unanswered, the waiting method will - * return with a SQLException, and the Connection - * or objects created from the Connection will be marked as - * closed. Any subsequent use of - * the objects, with the exception of the close, - * isClosed or Connection.isValid - * methods, will result in a SQLException. - *

    - * Note: This method is intended to address a rare but serious - * condition where network partitions can cause threads issuing JDBC calls - * to hang uninterruptedly in socket reads, until the OS TCP-TIMEOUT - * (typically 10 minutes). This method is related to the - * {@link #abort abort() } method which provides an administrator - * thread a means to free any such threads in cases where the - * JDBC connection is accessible to the administrator thread. - * The setNetworkTimeout method will cover cases where - * there is no administrator thread, or it has no access to the - * connection. This method is severe in its effects, and should be - * given a high enough value so it is never triggered before any more - * normal timeouts, such as transaction timeouts. - *

    - * JDBC driver implementations may also choose to support the - * {@code setNetworkTimeout} method to impose a limit on database - * response time, in environments where no network is present. - *

    - * Drivers may internally implement some or all of their API calls with - * multiple internal driver-database transmissions, and it is left to the - * driver implementation to determine whether the limit will be - * applied always to the response to the API call, or to any - * single request made during the API call. - *

    - * - * This method can be invoked more than once, such as to set a limit for an - * area of JDBC code, and to reset to the default on exit from this area. - * Invocation of this method has no impact on already outstanding - * requests. - *

    - * The {@code Statement.setQueryTimeout()} timeout value is independent of the - * timeout value specified in {@code setNetworkTimeout}. If the query timeout - * expires before the network timeout then the - * statement execution will be canceled. If the network is still - * active the result will be that both the statement and connection - * are still usable. However if the network timeout expires before - * the query timeout or if the statement timeout fails due to network - * problems, the connection will be marked as closed, any resources held by - * the connection will be released and both the connection and - * statement will be unusable. - *

    - * When the driver determines that the {@code setNetworkTimeout} timeout - * value has expired, the JDBC driver marks the connection - * closed and releases any resources held by the connection. - *

    - * - * This method checks to see that there is an SQLPermission - * object before allowing the method to proceed. If a - * SecurityManager exists and its - * checkPermission method denies calling - * setNetworkTimeout, this method throws a - * java.lang.SecurityException. - * - * @param executor The Executor implementation which will - * be used by setNetworkTimeout. - * @param milliseconds The time in milliseconds to wait for the database - * operation - * to complete. If the JDBC driver does not support milliseconds, the - * JDBC driver will round the value up to the nearest second. If the - * timeout period expires before the operation - * completes, a SQLException will be thrown. - * A value of 0 indicates that there is no timeout for database operations. - * @throws java.sql.SQLException if a database access error occurs, this - * method is called on a closed connection, - * the {@code executor} is {@code null}, - * or the value specified for seconds is less than 0. - * @throws java.lang.SecurityException if a security manager exists and its - * checkPermission method denies calling - * setNetworkTimeout. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see SecurityManager#checkPermission - * @see Statement#setQueryTimeout - * @see #getNetworkTimeout - * @see #abort - * @see java.util.concurrent.Executor - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public void setNetworkTimeout(java.util.concurrent.Executor executor, - int milliseconds) throws SQLException { - - checkClosed(); - - throw JDBCUtil.notSupported(); - } - - /** - * Retrieves the number of milliseconds the driver will - * wait for a database request to complete. - * If the limit is exceeded, a - * SQLException is thrown. - * - * @return the current timeout limit in milliseconds; zero means there is - * no limit - * @throws SQLException if a database access error occurs or - * this method is called on a closed Connection - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see #setNetworkTimeout - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public int getNetworkTimeout() throws SQLException { - return 0; - } - -//---------------------- internal implementation --------------------------- -// -------------------------- Common Attributes ------------------------------ - /** Shared, reused local TimeZone which should not be modified*/ - TimeZone timeZone = TimeZone.getDefault(); - - /** Initial holdability */ - int rsHoldability = JDBCResultSet.HOLD_CURSORS_OVER_COMMIT; - - /** Properties for the connection */ - HsqlProperties connProperties; - - /** Properties for the session */ - HsqlProperties clientProperties; - - /** - * This connection's interface to the corresponding Session - * object in the database engine. - */ - SessionInterface sessionProxy; - - /** - * Is this an internal connection? - */ - boolean isInternal; - - /** Is this connection to a network server instance. */ - protected boolean isNetConn; - - /** - * Is this connection closed? - */ - boolean isClosed; - - /** The first warning in the chain. Null if there are no warnings. */ - private SQLWarning rootWarning; - - /** Synchronizes concurrent modification of the warning chain */ - private final Object rootWarning_mutex = new Object(); - - /** ID sequence for unnamed savepoints */ - private int savepointIDSequence; - - /** reuse count in ConnectionPool */ - int incarnation; - - /** used by a JDBCPool or other custom ConnectionPool instance */ - boolean isPooled; - - /** used by a JDBCPool or other custom ConnectionPool instance */ - JDBCConnectionEventListener poolEventListener; - - /** connection URL property close_result indicates to close old result when Statement is reused */ - boolean isCloseResultSet; - - /** connection URL property defult_schema for use with OpenOffic indicates to use PUBLIC schema by default */ - boolean isDefaultSchema; - - /** connection URL property memory_lobs indicates to load lobs fully into memory in ResultSet */ - boolean isMemoryLobs; - - /** connection URL property use_column_name indicates to return column name in ResultMetadata */ - boolean isUseColumnName = true; - - /** database property for translation of INTERVAL types to VARCHAR */ - boolean isTranslateTTIType = true; - - /** connection URL property allow_empty_batch indicates to accept executeBatch() when the batch is empty */ - boolean isAllowEmptyBatch = false; - - /** database URL property hsqldb.live_object indicates to store non-serialized object in OTHER columns */ - boolean isStoreLiveObject = false; - - /** - * Constructs a new external Connection to an HSQLDB - * Database.

    - * - * This constructor is called on behalf of the - * java.sql.DriverManager when getting a - * Connection for use in normal (external) - * client code.

    - * - * Internal client code, that being code located in HSQLDB SQL - * functions and stored procedures, receives an INTERNAL - * connection constructed by the {@link - * #JDBCConnection(org.hsqldb.SessionInterface) - * JDBCConnection(SessionInterface)} constructor.

    - * - * @param props A Properties object containing the connection - * properties - * @exception SQLException when the user/password combination is - * invalid, the connection url is invalid, or the - * Database is unavailable.

    - * - * The Database may be unavailable for a number - * of reasons, including network problems or the fact that it - * may already be in use by another process. - */ - public JDBCConnection(HsqlProperties props) throws SQLException { - - String user = props.getProperty("user"); - String password = props.getProperty("password"); - String connType = props.getProperty("connection_type"); - String host = props.getProperty("host"); - int port = props.getIntegerProperty("port", 0); - String path = props.getProperty("path"); - String database = props.getProperty("database"); - boolean isTLS = (DatabaseURL.S_HSQLS.equals(connType) - || DatabaseURL.S_HTTPS.equals(connType)); - boolean isTLSWrapper = - props.isPropertyTrue(HsqlDatabaseProperties.url_tls_wrapper, - false); - - isTLSWrapper &= isTLS; - - if (user == null) { - user = "SA"; - } - - if (password == null) { - password = ""; - } - - try { - if (DatabaseURL.isInProcessDatabaseType(connType)) { - /* - * @todo - fredt - this should be the only static reference to - * a core class (apart form references to the Type package) - * from the jdbc package - we might make it dynamic - */ - sessionProxy = DatabaseManager.newSession(connType, database, - user, password, props, timeZone); - } else if (DatabaseURL.S_HSQL.equals(connType) - || DatabaseURL.S_HSQLS.equals(connType)) { - sessionProxy = new ClientConnection(host, port, path, - database, isTLS, - isTLSWrapper, user, - password, timeZone); - isNetConn = true; - } else if (DatabaseURL.S_HTTP.equals(connType) - || DatabaseURL.S_HTTPS.equals(connType)) { - sessionProxy = new ClientConnectionHTTP(host, port, path, - database, isTLS, isTLSWrapper, user, password, timeZone); - isNetConn = true; - } else { // alias: type not yet implemented - throw JDBCUtil.invalidArgument(connType); - } - - sessionProxy.setJDBCConnection(this); - - connProperties = props; - clientProperties = sessionProxy.getClientProperties(); - - setLocalVariables(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * Constructs an INTERNAL Connection, - * using the specified {@link org.hsqldb.SessionInterface - * SessionInterface}.

    - * - * This constructor is called only on behalf of an existing - * Session (the internal parallel of a - * Connection), to be used as a parameter to a SQL - * function or stored procedure that needs to execute in the context - * of that Session.

    - * - * When a Java SQL function or stored procedure is called and its - * first parameter is of type Connection, HSQLDB - * automatically notices this and constructs an INTERNAL - * Connection using the current Session. - * HSQLDB then passes this Connection in the first - * parameter position, moving any other parameter values - * specified in the SQL statement to the right by one position. - *

    - * - * To read more about this, see - * {@link org.hsqldb.Routine Routine}.

    - * - * Notes:

    - * - * Starting with HSQLDB 1.7.2, INTERNAL connections are not - * closed by a call to close() or by a SQL DISCONNECT. - * - * For HSQLDB developers not involved with writing database - * internals, this change only applies to connections obtained - * automatically from the database as the first parameter to - * Java stored procedures and functions. This is mainly an issue - * to developers writing custom SQL function and stored procedure - * libraries for HSQLDB. Presently, it is recommended that SQL function and - * stored procedure code avoid depending on closing or issuing a - * DISCONNECT on a connection obtained in this manner.

    - * - * @param c the Session requesting the construction of this - * Connection - * @exception HsqlException never (reserved for future use); - * @see org.hsqldb.Routine - */ - public JDBCConnection(SessionInterface c) { - - // PRE: SessionInterface is non-null - isInternal = true; - sessionProxy = c; - } - - /** - * Constructor for use with connection pooling and XA. - * - * @param c the connection - * @param eventListener the listener - */ - public JDBCConnection(JDBCConnection c, - JDBCConnectionEventListener eventListener) { - - sessionProxy = c.sessionProxy; - connProperties = c.connProperties; - clientProperties = c.clientProperties; - isPooled = true; - poolEventListener = eventListener; - - setLocalVariables(); - } - - private void setLocalVariables() { - - if (connProperties == null) { - return; - } - - isMemoryLobs = connProperties.isPropertyTrue( - HsqlDatabaseProperties.url_memory_lobs, false); - isCloseResultSet = connProperties.isPropertyTrue( - HsqlDatabaseProperties.url_close_result, false); - isDefaultSchema = connProperties.isPropertyTrue( - HsqlDatabaseProperties.url_default_schema, false); - isAllowEmptyBatch = connProperties.isPropertyTrue( - HsqlDatabaseProperties.url_allow_empty_batch, false); - isUseColumnName = connProperties.isPropertyTrue( - HsqlDatabaseProperties.url_get_column_name, true); - isTranslateTTIType = clientProperties.isPropertyTrue( - HsqlDatabaseProperties.jdbc_translate_tti_types, true); - isStoreLiveObject = clientProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_live_object, false); - if (isStoreLiveObject) { - String connType = connProperties.getProperty("connection_type"); - - if (!DatabaseURL.S_MEM.equals(connType)) { - isStoreLiveObject = false; - } - } - } - - synchronized int getSavepointID() { - return savepointIDSequence++; - } - - /** - * Retrieves this connection's JDBC url. - * - * This method is in support of the JDBCDatabaseMetaData.getURL() method. - * @return the database connection url with which this object was - * constructed - * @throws SQLException if this connection is closed - */ - synchronized public String getURL() throws SQLException { - - checkClosed(); - - return isInternal ? sessionProxy.getInternalConnectionURL() - : connProperties.getProperty("url"); - } - - /** - * An internal check for closed connections.

    - * - * @throws SQLException when the connection is closed - */ - synchronized void checkClosed() throws SQLException { - - if (isClosed) { - throw JDBCUtil.connectionClosedException(); - } - } - - /** - * Adds another SQLWarning to this Connection object's warning chain. - * - * @param w the SQLWarning to add to the chain - */ - void addWarning(SQLWarning w) { - - // PRE: w is never null - synchronized (rootWarning_mutex) { - if (rootWarning == null) { - rootWarning = w; - } else { - rootWarning.setNextWarning(w); - } - } - } - - /** - * Sets the warning chain - */ - void setWarnings(SQLWarning w) { - - synchronized (rootWarning_mutex) { - rootWarning = w; - } - } - - /** - * Resets this connection so it can be used again. Used when connections are - * returned to a connection pool. - * - * @throws SQLException if a database access error occurs - */ - public void reset() throws SQLException { - - try { - incarnation++; - - this.sessionProxy.resetSession(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(ErrorCode.X_08006, e.getMessage(), e); - } - } - - /** - * Completely closes a pooled connection - */ - public void closeFully() { - - try { - close(); - } catch (Throwable t) { - - // - } - - try { - if (sessionProxy != null) { - sessionProxy.close(); - - sessionProxy = null; - } - } catch (Throwable t) { - - // - } - } - - /** - * provides cross-package access to the proprietary (i.e. non-JDBC) - * HSQLDB session interface.

    - * - * @return the underlying sessionProxy for this connection - */ - public SessionInterface getSession() { - return sessionProxy; - } - - /** - * is called from within nativeSQL when the start of an JDBC escape sequence is encountered - */ - private int onStartEscapeSequence(String sql, StringBuilder sb, - int i) throws SQLException { - - sb.append(' '); - - i++; - - i = StringUtil.skipSpaces(sql, i); - - if (sql.regionMatches(true, i, "fn ", 0, 3) - || sql.regionMatches(true, i, "oj ", 0, 3)) { - i += 2; - } else if (sql.regionMatches(true, i, "ts ", 0, 3)) { - sb.append("TIMESTAMP"); - - i += 2; - } else if (sql.regionMatches(true, i, "d ", 0, 2)) { - sb.append("DATE"); - - i++; - } else if (sql.regionMatches(true, i, "t ", 0, 2)) { - sb.append("TIME"); - - i++; - } else if (sql.regionMatches(true, i, "call ", 0, 5)) { - sb.append("CALL"); - - i += 4; - } else if (sql.regionMatches(true, i, "?= call ", 0, 8)) { - sb.append("CALL"); - - i += 7; - } else if (sql.regionMatches(true, i, "? = call ", 0, 8)) { - sb.append("CALL"); - - i += 8; - } else if (sql.regionMatches(true, i, "escape ", 0, 7)) { - i += 6; - } else { - i--; - - throw JDBCUtil.sqlException(ErrorCode.JDBC_CONNECTION_NATIVE_SQL, - sql.substring(i)); - } - - return i; - } - - public boolean isInternal() { - return isInternal; - } - - public boolean isNetwork() { - return isNetConn; - } - - public HsqlProperties getConnProperties() { - - HsqlProperties props = new HsqlProperties(); - - props.addProperties(connProperties); - - return props; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCConnectionEventListener.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCConnectionEventListener.java deleted file mode 100644 index 4d0a09d1..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCConnectionEventListener.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.SQLException; - -public interface JDBCConnectionEventListener { - - void connectionClosed(); - - void connectionErrorOccurred(SQLException e); -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDataSource.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCDataSource.java deleted file mode 100644 index 357f7e34..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDataSource.java +++ /dev/null @@ -1,249 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Wrapper; -import java.util.Properties; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; -import javax.sql.DataSource; - -/** - *

    A factory for connections to the physical data source that this - * DataSource object represents. An alternative to the - * DriverManager facility, a DataSource object - * is the preferred means of getting a connection. An object that implements - * the DataSource interface will typically be - * registered with a naming service based on the - * Java™ Naming and Directory (JNDI) API. - *

    - * The DataSource interface is implemented by a driver vendor. - * There are three types of implementations: - *

      - *
    1. Basic implementation -- produces a standard Connection - * object - *
    2. Connection pooling implementation -- produces a Connection - * object that will automatically participate in connection pooling. This - * implementation works with a middle-tier connection pooling manager. - *
    3. Distributed transaction implementation -- produces a - * Connection object that may be used for distributed - * transactions and almost always participates in connection pooling. - * This implementation works with a middle-tier - * transaction manager and almost always with a connection - * pooling manager. - *
    - *

    - * A DataSource object has properties that can be modified - * when necessary. For example, if the data source is moved to a different - * server, the property for the server can be changed. The benefit is that - * because the data source's properties can be changed, any code accessing - * that data source does not need to be changed. - *

    - * A driver that is accessed via a DataSource object does not - * register itself with the DriverManager. Rather, a - * DataSource object is retrieved though a lookup operation - * and then used to create a Connection object. With a basic - * implementation, the connection obtained through a DataSource - * object is identical to a connection obtained through the - * DriverManager facility. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This implementation of data source is a basic implementation and does not - * perform connection pooling.

    - * - * The getter and setter methods of the parent class, {@link JDBCCommonDataSource}, - * can be used.

    - *

    - * - * @since JDK 1.4 - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.2 - * @since 1.7.2 - */ - -@SuppressWarnings("serial") -public class JDBCDataSource extends JDBCCommonDataSource implements DataSource, - Serializable, Referenceable, Wrapper { - - /** - * Retrieves a new connection using the properties that have already been - * set. - * - * @return a connection to the data source - * @exception SQLException if a database access error occurs - */ - public Connection getConnection() throws SQLException { - - if (url == null) { - throw JDBCUtil.nullArgument("url"); - } - - if (connectionProps == null) { - if (user == null) { - throw JDBCUtil.invalidArgument("user"); - } - - if (password == null) { - throw JDBCUtil.invalidArgument("password"); - } - - return getConnection(user, password); - } - - return getConnection(url, connectionProps); - } - - /** - * Retrieves a new connection using the given username and password, - * and the database url that has been set. No other properties are - * used for the connection - * - * @param username the database user on whose behalf the connection is - * being made - * @param password the user's password - * @return a connection to the data source - * @exception SQLException if a database access error occurs - */ - public Connection getConnection(String username, - String password) throws SQLException { - - if (username == null) { - throw JDBCUtil.invalidArgument("user"); - } - - if (password == null) { - throw JDBCUtil.invalidArgument("password"); - } - - Properties props = new Properties(); - - props.setProperty("user", username); - props.setProperty("password", password); - props.setProperty("loginTimeout", Integer.toString(loginTimeout)); - - return getConnection(url, props); - } - - private Connection getConnection(String url, - Properties props) throws SQLException { - - if (!url.startsWith("jdbc:hsqldb:")) { - url = "jdbc:hsqldb:" + url; - } - - return JDBCDriver.getConnection(url, props); - } - - //------------------------- JDBC 4.0 ----------------------------------- - // ------------------- java.sql.Wrapper implementation --------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return - * the result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 2.0 - */ - @SuppressWarnings("unchecked") - public T unwrap(java.lang.Class iface) throws java.sql.SQLException { - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isWrapperFor( - java.lang.Class iface) throws java.sql.SQLException { - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - - /** - * Retrieves the Reference of this object. - * - * @return The non-null Reference of this object. - * @exception NamingException If a naming exception was encountered - * while retrieving the reference. - */ - public Reference getReference() throws NamingException { - - String cname = "org.hsqldb.jdbc.JDBCDataSourceFactory"; - Reference ref = new Reference(getClass().getName(), cname, null); - - ref.add(new StringRefAddr("database", getDatabase())); - ref.add(new StringRefAddr("user", getUser())); - ref.add(new StringRefAddr("password", password)); - ref.add(new StringRefAddr("loginTimeout", - Integer.toString(loginTimeout))); - - return ref; - } - - // ------------------------ custom public methods ------------------------ - public JDBCDataSource() { - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDataSourceFactory.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCDataSourceFactory.java deleted file mode 100644 index edd0be68..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDataSourceFactory.java +++ /dev/null @@ -1,239 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.util.Hashtable; -import java.util.Properties; - -import javax.naming.Context; -import javax.naming.Name; -import javax.naming.Reference; -import javax.naming.RefAddr; -import javax.naming.spi.ObjectFactory; -import javax.sql.DataSource; - -/** - * A JNDI ObjectFactory for creating data sources supported by HyperSQL - * {@link org.hsqldb.jdbc.JDBCDataSource JDBCDataSource} for plain - * connections for the end user. - * {@link org.hsqldb.jdbc.JDBCPool JDBCPool} for pooled plain - * connections for the end user. - * {@link org.hsqldb.jdbc.pool.JDBCPooledDataSource JDBCPooledDataSource} for - * PooleConnection objects used - * by external connection pooling software. - * {@link org.hsqldb.jdbc.pool.JDBCXADataSource JDBCXADataSource} for - * XAConnection objects used by external connection pooling software. - * - * @author Darin DeForest (deforest@users dot sourceforge.net) original version - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @version 2.0.0 - */ -public class JDBCDataSourceFactory implements ObjectFactory { - - /** - * Static method to create a JDBCDataSource instance using the - * given properties for url, user, password, etc. - * - * @param props properties - * @return the data source instance - * @throws Exception on any error - */ - public static DataSource createDataSource(Properties props) - throws Exception { - - Class cl = Class.forName(bdsClassName); - JDBCDataSource ds = - (JDBCDataSource) cl.getDeclaredConstructor().newInstance(); - String value = props.getProperty(databaseName); - - if (value == null) { - value = props.getProperty(urlName); - } - - ds.setDatabase(value); - - value = props.getProperty(userName); - - if (value == null) { - value = props.getProperty(userNameName); - } - - ds.setUser(value); - - value = props.getProperty(passwordName); - - ds.setPassword(value); - - value = props.getProperty(loginTimeoutName); - - if (value != null) { - value = value.trim(); - - if (value.length() > 0) { - try { - ds.setLoginTimeout(Integer.parseInt(value)); - } catch (NumberFormatException nfe) {} - } - } - - return ds; - } - - /** - * Creates a DataSource object using the javax.naming.Reference object - * specified.

    - * - * The Reference object's class name should be one of the four supported - * data source class names and it must support the properties, database, - * user and password. It may optionally support the loginTimeout property. - * - * HyperSQL's JDBCPooledDataSource and JDBCXADataSource object are intended - * as factories used by a connection pooling DataSource.

    - * JDBCDataSource is a factory for normal connections and can be accessed - * directly by user applications.

    - * JDBCPool is a connection pool accessed directly by user applications.

    - * - * @param obj The reference information used in creating a - * Datasource object. - * @param name ignored - * @param nameCtx ignored - * @param environment ignored - * @return A newly created JDBCDataSource object; null if an object - * cannot be created. - * @exception Exception is thrown if database or user is null or invalid - */ - public Object getObjectInstance(Object obj, Name name, Context nameCtx, - Hashtable environment) throws Exception { - - if (!(obj instanceof Reference)) { - return null; - } - - Reference ref = (Reference) obj; - String className = ref.getClassName(); - - if (bdsClassName.equals(className) || poolClassName.equals(className) - || pdsClassName.equals(className) - || xdsClassName.equals(className)) { - RefAddr refAddr; - Object value; - Class cl = Class.forName(bdsClassName); - JDBCCommonDataSource ds = - (JDBCDataSource) cl.getDeclaredConstructor().newInstance(); - - refAddr = ref.get("database"); - - if (refAddr == null) { - throw new Exception(className + ": RefAddr not set: database"); - } - - value = refAddr.getContent(); - - if (!(value instanceof String)) { - throw new Exception(className + ": invalid RefAddr: database"); - } - - ds.setDatabase((String) value); - - refAddr = ref.get("user"); - - if (refAddr == null) { - throw new Exception(className + ": RefAddr not set: user"); - } - - value = ref.get("user").getContent(); - - if (!(value instanceof String)) { - throw new Exception(className + ": invalid RefAddr: user"); - } - - ds.setUser((String) value); - - refAddr = ref.get("password"); - - if (refAddr == null) { - value = ""; - } else { - value = ref.get("password").getContent(); - - if (!(value instanceof String)) { - throw new Exception(className - + ": invalid RefAddr: password"); - } - } - - ds.setPassword((String) value); - - refAddr = ref.get("loginTimeout"); - - if (refAddr != null) { - value = refAddr.getContent(); - - if (value instanceof String) { - String loginTimeoutContent = ((String) value).trim(); - - if (loginTimeoutContent.length() > 0) { - try { - ds.setLoginTimeout( - Integer.parseInt(loginTimeoutContent)); - } catch (NumberFormatException nfe) {} - } - } - } - - return ds; - } else { - return null; - } - } - - /** - * supported properties - */ - private static final String urlName = "url"; - private static final String databaseName = "database"; - private static final String userName = "user"; - private static final String userNameName = "username"; - private static final String passwordName = "password"; - private static final String loginTimeoutName = "loginTimeout"; - - /** - * class names - */ - private static final String bdsClassName = "org.hsqldb.jdbc.JDBCDataSource"; - private static final String poolClassName = "org.hsqldb.jdbc.JDBCPool"; - private static final String pdsClassName = "org.hsqldb.jdbc.pool.JDBCPooledDataSource"; - private static final String xdsClassName = "org.hsqldb.jdbc.pool.JDBCXADataSource"; - - public JDBCDataSourceFactory() {} -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDatabaseMetaData.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCDatabaseMetaData.java deleted file mode 100644 index 67cdb69e..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDatabaseMetaData.java +++ /dev/null @@ -1,6220 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.SQLException; - -import org.hsqldb.lib.StringConverter; -import org.hsqldb.lib.StringUtil; -import org.hsqldb.persist.HsqlDatabaseProperties; -import org.hsqldb.types.BlobType; -import org.hsqldb.types.Type; - -/* $Id: JDBCDatabaseMetaData.java 6550 2022-06-08 11:09:08Z fredt $ */ - -// fredt@users 20020320 - patch 1.7.0 - JDBC 2 support and error trapping -// JDBC 2 methods can now be called from jdk 1.1.x - see javadoc comments -// -// boucherb & 20020409 - extensive review and update of docs and behaviour -// fredt@users - 20020505 to comply with previous and latest java.sql -// specification -// campbell-burnet@users 20020509 - update to JDK 1.4 / JDBC3 methods and docs -// campbell-burnet@users 2002 - extensive rewrite to support new -// - 20030121 1.7.2 system table and metadata features. -// campbell-burnet@users 20040422 - doc 1.7.2 - javadoc updates toward 1.7.2 final -// fredt@users 20050505 - patch 1.8.0 - enforced JDBC rules for non-pattern params -// campbell-burnet@users 20051207 - update to JDK 1.6 JDBC 4.0 methods and docs -// - 20060709 -// fredt@users 20080805 - full review and update to doc and method return values - -// Revision 1.20 2006/07/12 12:06:54 boucherb -// patch 1.9.0 -// - java.sql.Wrapper implementation section title added -// Revision 1.19 2006/07/09 07:07:01 boucherb -// - getting the CVS Log variable output format right -// -// Revision 1.18 2006/07/09 07:02:38 boucherb -// - patch 1.9.0 full synch up to Mustang Build 90 -// - getColumns() (finally!!!) officially includes IS_AUTOINCREMENT -// - -/** - * Comprehensive information about the database as a whole. - *

    - * This interface is implemented by driver vendors to let users know the capabilities - * of a Database Management System (DBMS) in combination with - * the driver based on JDBC technology - * ("JDBC driver") that is used with it. Different relational DBMSs often support - * different features, implement features in different ways, and use different - * data types. In addition, a driver may implement a feature on top of what the - * DBMS offers. Information returned by methods in this interface applies - * to the capabilities of a particular driver and a particular DBMS working - * together. Note that as used in this documentation, the term "database" is - * used generically to refer to both the driver and DBMS. - *

    - * A user for this interface is commonly a tool that needs to discover how to - * deal with the underlying DBMS. This is especially true for applications - * that are intended to be used with more than one DBMS. For example, a tool might use the method - * getTypeInfo to find out what data types can be used in a - * CREATE TABLE statement. Or a user might call the method - * supportsCorrelatedSubqueries to see if it is possible to use - * a correlated subquery or supportsBatchUpdates to see if it is - * possible to use batch updates. - *

    - * Some DatabaseMetaData methods return lists of information - * in the form of ResultSet objects. - * Regular ResultSet methods, such as - * getString and getInt, can be used - * to retrieve the data from these ResultSet objects. If - * a given form of metadata is not available, an empty ResultSet - * will be returned. Additional columns beyond the columns defined to be - * returned by the ResultSet object for a given method - * can be defined by the JDBC driver vendor and must be accessed - * by their column label. - *

    - * Some DatabaseMetaData methods take arguments that are - * String patterns. These arguments all have names such as fooPattern. - * Within a pattern String, "%" means match any substring of 0 or more - * characters, and "_" means match any one character. Only metadata - * entries matching the search pattern are returned. If a search pattern - * argument is set to null, that argument's criterion will - * be dropped from the search. - *

    - * A method that gets information about a feature that the driver does not - * support will throw an SQLException. - * In the case of methods that return a ResultSet - * object, either a ResultSet object (which may be empty) is - * returned or an SQLException is thrown. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - *

    Metadata Table Production

    - * - * Starting with HSQLDB 1.7.2, the metadata table (a.k.a system table) production - * implementation provided in the default build filters metadata based on each - * SQL session user's access rights which in turn lifts the pre-HSQLDB 1.7.2 - * restriction that only users with the DBA role - * ('admin' users in older HSQLDB parlance) could expect trouble-free access to - * all metadata.

    - * - * Also starting with HSQLDB 1.7.2, the metadata table production implementation - * classes are loaded dynamically, using a precedence policy to find and load - * the richest producer available at runtime. In the event that no better - * alternative is found, the default minimal (completely restricted) provider - * is selected. Under this scheme, it is possible for third party packagers to - * create custom distributions targeted at supporting full (design-time), - * custom-written (proprietary / micro environment), minimal (production-time) - * or completely-restricted (space-constrained | device embedded | real-time | - * hostile environment) metadata table production scenarios. To learn more - * about this option, interested parties can review the documentation and source - * code for the org.hsqldb.dbinfo.DatabaseInformation class.

    - * - * Please also note that in addition to the metadata tables produced to - * directly support this class, starting with HSQLDB 1.7.2, the default build - * provides many additional tables covering all or most HSQLDB features, such - * as descriptions of the triggers and aliases defined in the database.

    - * - * For instance, in the default build, a fairly comprehensive description of - * each INFORMATION_SCHEMA table and each INFORMATION_SCHEMA table - * column is included in the REMARKS column of the {@link #getTables( - * java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) - * getTables(...)} and {@link #getColumns(java.lang.String, java.lang.String, - * java.lang.String, java.lang.String) getColumns(...)} results, which derive - * from INFORMATION_SCHEMA.SYSTEM_TABLES and INFORMATION_SCHEMA.SYSTEM_COLUMNS, - * respectively.

    - * - * Since HSQLDB 2.0 the INFORMATION_SCHEMA views have been vastly expanded - * in compliance with the SQL:2011 Standard and report the properties of all - * database objects.

    - * - *

    Schema Metadata

    - * - * The SQL SCHEMA concept became fully supported in the HSQLDB 1.8.x series and - * this fact is reflected in the all subsequent versions of this class. - * - *

    Catalog Metadata

    - * - * Starting with HSQLDB 2.0, SQL standards compliance up to SQL:2008 and beyond - * is a major theme which is reflected in the provision of the majority of the - * standard-defined full-name INFORMATION_SCHEMA views.

    - * - * However, just as CATALOG semantics and handling are still considered to be - * implementation defined by the most recent SQL standard (SQL:2011), so is the - * HSQLDB CATALOG concept still in the process of being defined and refined in - * HSQLDB 2.x. and beyond.

    - * - * Similarly, starting with HSQLDB 2.x, from the perspective - * of SQL identification, an HSQLDB JDBC URL connects to a single HSQLDB - * database instance which consists of a single, default CATALOG - * named PUBLIC in which each SCHEMA instance of the database resides. The name of - * this catalog can be changed with the ALTER CATALOG <name> RENAME TO statement. - * As of version 2.1.0, HSQLDB supports qualification by the containing CATALOG of - * database objects at the syntactic level, but does not yet support operations - * such as opening, manipulating or querying against multiple database - * catalogs within a single session, not even in a one-at-a-time fashion. - * - *

    Index Metadata

    - * - * It must still be noted that as of the most recent release, HSQLDB continues - * to ignore the approximate argument of {@link #getIndexInfo - * getIndexInfo()} as no data is returned for CARDINALITY and PAGES coloumns. - * - *

    Notes for developers extending metadata table production

    - * - * Note that in the absence of an ORDER BY clause, queries against the metadata - * tables that directly support this class are expected to return rows in JDBC - * contract order. The reason for this is that results typically come - * back much faster when no "ORDER BY" clause is used.

    - * - * As such, when adding, extending or replacing a JDBC database metadata table - * production routine, developers need to be aware of this fact and either add the - * contract "ORDER BY" clause to the driving SQL or, when possible, - * preferably maintain rows in the contract order by correctly coding the - * primary index definition in the table producer class. - * - *


    - * - * (fredt@users)
    - * (campbell-burnet@users) - *
    - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since HSQLDB 1.9.0 - * @see org.hsqldb.dbinfo.DatabaseInformation - */ -public class JDBCDatabaseMetaData implements DatabaseMetaData, - java.sql.Wrapper { - - private static final String[] openGroupNumericFunctions = { - "ABS", "ACOS", "ASIN", "ATAN", "ATAN2", "BITAND", "BITOR", "BITXOR", - "CEILING", "COS", "COT", "DEGREES", "EXP", "FLOOR", "LOG", "LOG10", - "MOD", "PI", "POWER", "RADIANS", "RAND", "ROUND", "ROUNDMAGIC", "SIGN", - "SIN", "SQRT", "TAN", "TRUNCATE" - }; - private static final String[] openGroupStringFunctions = { - "ASCII", "CHAR", "CONCAT", "DIFFERENCE", "HEXTORAW", "INSERT", "LCASE", - "LEFT", "LENGTH", "LOCATE", "LTRIM", "RAWTOHEX", "REPEAT", "REPLACE", - "RIGHT", "RTRIM", "SOUNDEX", "SPACE", "SUBSTR", "UCASE", - }; - private static final String[] openGroupDateTimeFunctions = { - "CURDATE", "CURTIME", "DATEDIFF", "DAYNAME", "DAYOFMONTH", "DAYOFWEEK", - "DAYOFYEAR", "HOUR", "MINUTE", "MONTH", "MONTHNAME", "NOW", "QUARTER", - "SECOND", "SECONDS_SINCE_MIDNIGHT", "TIMESTAMPADD", "TIMESTAMPDIFF", - "TO_CHAR", "WEEK", "YEAR" - }; - private static final String[] openGroupSystemFunctions = { - "DATABASE", "IFNULL", "USER" - }; - - //---------------------------------------------------------------------- - // First, a variety of minor information about the target database. - - /** - * Retrieves whether the current user can call all the procedures - * returned by the method getProcedures. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * This method always returns - * true because the listed procedures are those which - * the current user can use.

    - *

    - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean allProceduresAreCallable() throws SQLException { - return true; - } - - /** - * Retrieves whether the current user can use all the tables returned - * by the method getTables in a SELECT - * statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always reports true.

    - * - * The getTables call returns the list of tables to which the - * invoking user has some access rights.

    - * - *

    - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean allTablesAreSelectable() throws SQLException { - return true; - } - - /** - * Retrieves the URL for this DBMS. - * - * @return the URL for this DBMS or null if it cannot be - * generated - * @exception SQLException if a database access error occurs - */ - public String getURL() throws SQLException { - return connection.getURL(); - } - - /** - * Retrieves the user name as known to this database. - * - * @return the database user name - * @exception SQLException if a database access error occurs - */ - public String getUserName() throws SQLException { - - ResultSet rs = execute("CALL USER()"); - - rs.next(); - - String result = rs.getString(1); - - rs.close(); - - return result; - } - - /** - * Retrieves whether this database is in read-only mode. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * This makes an SQL call to the isReadOnlyDatabase function - * which provides correct determination of the read-only status for - * both local and remote database instances. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isReadOnly() throws SQLException { - - ResultSet rs = execute("CALL IS_READONLY_DATABASE()"); - - rs.next(); - - boolean result = rs.getBoolean(1); - - rs.close(); - - return result; - } - - /** - * Retrieves whether NULL values are sorted high. - * Sorted high means that NULL values - * sort higher than any other value in a domain. In an ascending order, - * if this method returns true, NULL values - * will appear at the end. By contrast, the method - * nullsAreSortedAtEnd indicates whether NULL values - * are sorted at the end regardless of sort order. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * By default HSQLDB sorts null at start and - * this method returns false. - * But a different value is returned if sql.nulls_first or - * sql.nulls_lasst properties have a non-default value. - *

    - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean nullsAreSortedHigh() throws SQLException { - setCurrentProperties(); - return !nullsFirst && !nullsOrder; - } - - /** - * Retrieves whether NULL values are sorted low. - * Sorted low means that NULL values - * sort lower than any other value in a domain. In an ascending order, - * if this method returns true, NULL values - * will appear at the beginning. By contrast, the method - * nullsAreSortedAtStart indicates whether NULL values - * are sorted at the beginning regardless of sort order. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * By default HSQLDB sorts null at start and - * this method returns false. - * But a different value is returned if sql.nulls_first or - * sql.nulls_lasst properties have a non-default value. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean nullsAreSortedLow() throws SQLException { - setCurrentProperties(); - return nullsFirst && !nullsOrder; - } - - /** - * Retrieves whether NULL values are sorted at the start regardless - * of sort order. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * By default HSQLDB sorts null at start and - * this method returns true. - * But a different value is returned if sql.nulls_first or - * sql.nulls_last properties have a non-default value.

    - * Use NULLS LAST in the ORDER BY clause to sort null at the end. - *

    - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean nullsAreSortedAtStart() throws SQLException { - setCurrentProperties(); - return nullsFirst && nullsOrder; - } - - /** - * Retrieves whether NULL values are sorted at the end regardless of - * sort order. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * By default HSQLDB sorts null at start and - * this method returns false. - * But a different value is returned if sql.nulls_first or - * sql.nulls_last properties have a non-default value.

    - * Use NULLS LAST in the ORDER BY clause to sort null at the end. - *

    - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean nullsAreSortedAtEnd() throws SQLException { - setCurrentProperties(); - return !nullsFirst && nullsOrder; - } - - /** - * Retrieves the name of this database product. - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Returns the name of the HSQLDB engine. - *

    - * - * @return database product name - * @exception SQLException if a database access error occurs - */ - public String getDatabaseProductName() throws SQLException { - return HsqlDatabaseProperties.PRODUCT_NAME; - } - - /** - * Retrieves the version number of this database product. - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Returns the full version string. - *

    - * - * @return database version number - * @exception SQLException if a database access error occurs - */ - public String getDatabaseProductVersion() throws SQLException { - - ResultSet rs = execute("CALL DATABASE_VERSION()"); - - rs.next(); - - return rs.getString(1); - } - - /** - * Retrieves the name of this JDBC driver. - * - * @return JDBC driver name - * @exception SQLException if a database access error occurs - */ - public String getDriverName() throws SQLException { - return HsqlDatabaseProperties.PRODUCT_NAME + " Driver"; - } - - /** - * Retrieves the version number of this JDBC driver as a String. - * - * @return JDBC driver version - * @exception SQLException if a database access error occurs - */ - public String getDriverVersion() throws SQLException { - return THIS_VERSION; - } - - /** - * Retrieves this JDBC driver's major version number. - * - * @return JDBC driver major version - */ - public int getDriverMajorVersion() { - return HsqlDatabaseProperties.MAJOR; - } - - /** - * Retrieves this JDBC driver's minor version number. - * - * @return JDBC driver minor version number - */ - public int getDriverMinorVersion() { - return HsqlDatabaseProperties.MINOR; - } - - /** - * Retrieves whether this database stores tables in a local file. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * From HSQLDB 1.7.2 it is assumed that this refers to data being stored - * by the JDBC client. This method always returns false. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean usesLocalFiles() throws SQLException { - return false; - } - - /** - * Retrieves whether this database uses a file for each table. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not use a file for each table. - * This method always returns false. - *

    - * - * @return true if this database uses a local file for each table; - * false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean usesLocalFilePerTable() throws SQLException { - return false; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as - * case sensitive and as a result stores them in mixed case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsMixedCaseIdentifiers() throws SQLException { - return false; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as - * case insensitive and stores them in upper case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean storesUpperCaseIdentifiers() throws SQLException { - return true; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as - * case insensitive and stores them in lower case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean storesLowerCaseIdentifiers() throws SQLException { - return false; - } - - /** - * Retrieves whether this database treats mixed case unquoted SQL identifiers as - * case insensitive and stores them in mixed case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean storesMixedCaseIdentifiers() throws SQLException { - return false; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as - * case sensitive and as a result stores them in mixed case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { - return true; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as - * case insensitive and stores them in upper case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { - return false; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as - * case insensitive and stores them in lower case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns false. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { - return false; - } - - /** - * Retrieves whether this database treats mixed case quoted SQL identifiers as - * case insensitive and stores them in mixed case. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB treats unquoted identifiers as case insensitive and stores - * them in upper case. It treats quoted identifiers as case sensitive and - * stores them verbatim; this method always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { - return false; - } - - /** - * Retrieves the string used to quote SQL identifiers. - * This method returns a space " " if identifier quoting is not supported. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB uses the standard SQL identifier quote character - * (the double quote character); this method always returns ". - *

    - * - * @return the quoting string or a space if quoting is not supported - * @exception SQLException if a database access error occurs - */ - public String getIdentifierQuoteString() throws SQLException { - return "\""; - } - - /** - * Retrieves a comma-separated list of all of this database's SQL keywords - * that are NOT also SQL:2003 keywords. - * (JDBC4 modified to SQL:2003) - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The list is empty. However, HSQLDB also supports SQL:2008 keywords - * and disallows them for database object names without double quoting. - *

    - * - * - * - * @return the list of this database's keywords that are not also - * SQL:2003 keywords - * (JDBC4 modified to SQL:2003) - * @exception SQLException if a database access error occurs - */ - public String getSQLKeywords() throws SQLException { - return ""; - } - - /** - * Retrieves a comma-separated list of math functions available with - * this database. These are the Open /Open CLI math function names used in - * the JDBC function escape clause. - * - * @return the list of math functions supported by this database - * @exception SQLException if a database access error occurs - */ - public String getNumericFunctions() throws SQLException { - return StringUtil.getList(openGroupNumericFunctions, ",", ""); - } - - /** - * Retrieves a comma-separated list of string functions available with - * this database. These are the Open Group CLI string function names used - * in the JDBC function escape clause. - * - * @return the list of string functions supported by this database - * @exception SQLException if a database access error occurs - */ - public String getStringFunctions() throws SQLException { - return StringUtil.getList(openGroupStringFunctions, ",", ""); - } - - /** - * Retrieves a comma-separated list of system functions available with - * this database. These are the Open Group CLI system function names used - * in the JDBC function escape clause. - * - * @return a list of system functions supported by this database - * @exception SQLException if a database access error occurs - */ - public String getSystemFunctions() throws SQLException { - return StringUtil.getList(openGroupSystemFunctions, ",", ""); - } - - /** - * Retrieves a comma-separated list of the time and date functions available - * with this database. - * - * @return the list of time and date functions supported by this database - * @exception SQLException if a database access error occurs - */ - public String getTimeDateFunctions() throws SQLException { - return StringUtil.getList(openGroupDateTimeFunctions, ",", ""); - } - - /** - * Retrieves the string that can be used to escape wildcard characters. - * This is the string that can be used to escape '_' or '%' in - * the catalog search parameters that are a pattern (and therefore use one - * of the wildcard characters). - * - *

    The '_' character represents any single character; - * the '%' character represents any sequence of zero or - * more characters. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB uses the "\" character to escape wildcard characters. - *

    - * - * - * - * @return the string used to escape wildcard characters - * @exception SQLException if a database access error occurs - */ - public String getSearchStringEscape() throws SQLException { - return "\\"; - } - - /** - * Retrieves all the "extra" characters that can be used in unquoted - * identifier names (those beyond a-z, A-Z, 0-9 and _). - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * By default HSQLDB does not support using any "extra" characters in - * unquoted identifier names; this method always returns the empty String. - *

    - * - * - * - * @return the string containing the extra characters - * @exception SQLException if a database access error occurs - */ - public String getExtraNameCharacters() throws SQLException { - return ""; - } - - //-------------------------------------------------------------------- - // Functions describing which features are supported. - - /** - * Retrieves whether this database supports ALTER TABLE - * with add column. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this type of - * ALTER TABLE statement; this method always - * returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsAlterTableWithAddColumn() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports ALTER TABLE - * with drop column. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this type of - * ALTER TABLE statement; this method always - * returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsAlterTableWithDropColumn() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports column aliasing. - * - *

    If so, the SQL AS clause can be used to provide names for - * computed columns or to provide alias names for columns as - * required. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports column aliasing; this method always - * returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsColumnAliasing() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports concatenations between - * NULL and non-NULL values being - * NULL. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * By default HSQLDB returns NULL when NULL and non-NULL values - * are concatenated. - * By default this method returns false. - * But a different value is returned if the sql.concat_nulls - * property has a non-default value.

    - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean nullPlusNonNullIsNull() throws SQLException { - return concatNulls; - } - - /** - * (JDBC4 clarification:) - * Retrieves whether this database supports the JDBC scalar function - * CONVERT for the conversion of one JDBC type to another. - * The JDBC types are the generic SQL data types defined - * in java.sql.Types. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports conversions; this method always - * returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsConvert() throws SQLException { - return true; - } - - /* @todo needs the full conversion matrix here. Should use org.hsqldb.types */ - - /** - * (JDBC4 clarification:) - * Retrieves whether this database supports the JDBC scalar function - * CONVERT for conversions between the JDBC types fromType - * and toType. The JDBC types are the generic SQL data types defined - * in java.sql.Types. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports conversion according to SQL standards. In addition, - * it supports conversion between values of BOOLEAN and BIT types. - *

    - * - * - * - * @param fromType the type to convert from; one of the type codes from - * the class java.sql.Types - * @param toType the type to convert to; one of the type codes from - * the class java.sql.Types - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @see java.sql.Types - */ - public boolean supportsConvert(int fromType, - int toType) throws SQLException { - - Type from = - Type.getDefaultTypeWithSize(Type.getHSQLDBTypeCode(fromType)); - Type to = Type.getDefaultTypeWithSize(Type.getHSQLDBTypeCode(toType)); - - if (from == null || to == null) { - return false; - } - - if (fromType == java.sql.Types.NULL - && toType == java.sql.Types.ARRAY) { - return true; - } - - return to.canConvertFrom(from); - } - - /** - * Retrieves whether this database supports table correlation names. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports table correlation names; this method always - * returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsTableCorrelationNames() throws SQLException { - return true; - } - - /** - * Retrieves whether, when table correlation names are supported, they - * are restricted to being different from the names of the tables. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not require that table correlation names are different from the - * names of the tables; this method always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsDifferentTableCorrelationNames() throws SQLException { - return false; - } - - /** - * Retrieves whether this database supports expressions in - * ORDER BY lists. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports expressions in ORDER BY lists; this - * method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsExpressionsInOrderBy() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports using a column that is - * not in the SELECT statement in an - * ORDER BY clause. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports using a column that is not in the SELECT - * statement in an ORDER BY clause; this method always - * returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsOrderByUnrelated() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports some form of - * GROUP BY clause. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports using the GROUP BY clause; this method - * always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsGroupBy() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports using a column that is - * not in the SELECT statement in a - * GROUP BY clause. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports using a column that is - * not in the SELECT statement in a - * GROUP BY clause; this method - * always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsGroupByUnrelated() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports using columns not included in - * the SELECT statement in a GROUP BY clause - * provided that all of the columns in the SELECT statement - * are included in the GROUP BY clause. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports using columns not included in - * the SELECT statement in a GROUP BY clause - * provided that all of the columns in the SELECT statement - * are included in the GROUP BY clause; this method - * always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsGroupByBeyondSelect() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports specifying a - * LIKE escape clause. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports specifying a - * LIKE escape clause; this method - * always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsLikeEscapeClause() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports getting multiple - * ResultSet objects from a single call to the - * method execute. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports getting multiple - * ResultSet objects from a single call to the method - * execute of the CallableStatement interface; - * this method returns true.

    - * - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsMultipleResultSets() throws SQLException { - return true; - } - - /** - * Retrieves whether this database allows having multiple - * transactions open at once (on different connections). - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB allows having multiple - * transactions open at once (on different connections); this method - * always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsMultipleTransactions() throws SQLException { - return true; - } - - /** - * Retrieves whether columns in this database may be defined as non-nullable. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the specification of non-nullable columns; this method - * always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsNonNullableColumns() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports the ODBC Minimum SQL grammar. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports the ODBC Minimum SQL grammar; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsMinimumSQLGrammar() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports the ODBC Core SQL grammar. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports the ODBC Core SQL grammar; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsCoreSQLGrammar() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports the ODBC Extended SQL grammar. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports the ODBC Extended SQL grammar; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsExtendedSQLGrammar() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports the ANSI92 entry level SQL - * grammar. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports the ANSI92 entry level SQL grammar; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsANSI92EntryLevelSQL() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports the ANSI92 intermediate SQL grammar supported. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports the ANSI92 intermediate SQL grammar; - * this method always returns true. - *

    - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsANSI92IntermediateSQL() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports the ANSI92 full SQL grammar supported. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports the ANSI92 full SQL grammar. The exceptions, - * such as support for ASSERTION, are not considered grammar issues. - * This method always returns true.

    - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsANSI92FullSQL() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports the SQL Integrity - * Enhancement Facility. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * This method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsIntegrityEnhancementFacility() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports some form of outer join. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports outer joins; this method always returns - * true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsOuterJoins() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports full nested outer joins. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports full nested outer - * joins; this method always returns true.

    - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsFullOuterJoins() throws SQLException { - return true; - } - - /** - * Retrieves whether this database provides limited support for outer - * joins. (This will be true if the method - * supportsFullOuterJoins returns true). - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the LEFT OUTER join syntax; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsLimitedOuterJoins() throws SQLException { - return true; - } - - /** - * Retrieves the database vendor's preferred term for "schema". - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 1.8.0, HSQLDB supports schemas. - *

    - * - * @return the vendor term for "schema" - * @exception SQLException if a database access error occurs - */ - public String getSchemaTerm() throws SQLException { - return "SCHEMA"; - } - - /** - * Retrieves the database vendor's preferred term for "procedure". - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports declaration of - * functions or procedures directly in SQL.

    - *

    - * - * @return the vendor term for "procedure" - * @exception SQLException if a database access error occurs - */ - public String getProcedureTerm() throws SQLException { - return "PROCEDURE"; - } - - /** - * Retrieves the database vendor's preferred term for "catalog". - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB uses the standard name CATALOG. - *

    - * - * - * @return the vendor term for "catalog" - * @exception SQLException if a database access error occurs - */ - public String getCatalogTerm() throws SQLException { - return "CATALOG"; - } - - /** - * Retrieves whether a catalog appears at the start of a fully qualified - * table name. If not, the catalog appears at the end. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * When allowed, a catalog appears at the start of a fully qualified - * table name; this method always returns true. - *

    - * - * @return true if the catalog name appears at the beginning - * of a fully qualified table name; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isCatalogAtStart() throws SQLException { - return true; - } - - /** - * Retrieves the String that this database uses as the - * separator between a catalog and table name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * When used, a catalog name is separated with period; - * this method always returns a period - *

    - * - * - * @return the separator string - * @exception SQLException if a database access error occurs - */ - public String getCatalogSeparator() throws SQLException { - return "."; - } - - /** - * Retrieves whether a schema name can be used in a data manipulation statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports schemas where allowed by the standard; - * this method always returns true. - * - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSchemasInDataManipulation() throws SQLException { - - // false for OOo client server compatibility - // otherwise schema name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a schema name can be used in a procedure call statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports schemas where allowed by the standard; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSchemasInProcedureCalls() throws SQLException { - - // false for OOo client server compatibility - // otherwise schema name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a schema name can be used in a table definition statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports schemas where allowed by the standard; - * this method always returns true. - * - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSchemasInTableDefinitions() throws SQLException { - - // false for OOo client server compatibility - // otherwise schema name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a schema name can be used in an index definition statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports schemas where allowed by the standard; - * this method always returns true. - * - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSchemasInIndexDefinitions() throws SQLException { - - // false for OOo client server compatibility - // otherwise schema name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a schema name can be used in a privilege definition statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports schemas where allowed by the standard; - * this method always returns true. - * - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { - - // false for OOo client server compatibility - // otherwise schema name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a catalog name can be used in a data manipulation statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports catalog names where allowed by the standard; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsCatalogsInDataManipulation() throws SQLException { - - // false for OOo client server compatibility - // otherwise catalog name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a catalog name can be used in a procedure call statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports catalog names where allowed by the standard; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsCatalogsInProcedureCalls() throws SQLException { - - // false for OOo client server compatibility - // otherwise catalog name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a catalog name can be used in a table definition statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports catalog names where allowed by the standard; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsCatalogsInTableDefinitions() throws SQLException { - - // false for OOo client server compatibility - // otherwise catalog name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a catalog name can be used in an index definition statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports catalog names where allowed by the standard; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsCatalogsInIndexDefinitions() throws SQLException { - - // false for OOo client server compatibility - // otherwise catalog name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether a catalog name can be used in a privilege definition statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB supports catalog names where allowed by the standard; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { - - // false for OOo client server compatibility - // otherwise catalog name is used by OOo in column references - return !useSchemaDefault; - } - - /** - * Retrieves whether this database supports positioned DELETE - * statements. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports updatable result sets; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsPositionedDelete() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports positioned UPDATE - * statements. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports updatable result sets; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsPositionedUpdate() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports SELECT FOR UPDATE - * statements. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports updatable result sets; - * this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSelectForUpdate() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports stored procedure calls - * that use the stored procedure escape syntax. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports calling public static Java methods in the context of SQL - * Stored Procedures; this method always returns true. - *

    - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @see JDBCParameterMetaData - * @see JDBCConnection#prepareCall - */ - public boolean supportsStoredProcedures() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports subqueries in comparison - * expressions. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB has always supported subqueries in comparison expressions; - * this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSubqueriesInComparisons() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports subqueries in - * EXISTS expressions. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB has always supported subqueries in EXISTS - * expressions; this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSubqueriesInExists() throws SQLException { - return true; - } - - /** - * (JDBC4 correction:) - * Retrieves whether this database supports subqueries in - * IN expressions. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB has always supported subqueries in IN - * statements; this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSubqueriesInIns() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports subqueries in quantified - * expressions. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB has always supported subqueries in quantified - * expressions; this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsSubqueriesInQuantifieds() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports correlated subqueries. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB has always supported correlated subqueries; - * this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsCorrelatedSubqueries() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports SQL UNION. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports SQL UNION; - * this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsUnion() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports SQL UNION ALL. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports SQL UNION ALL; - * this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsUnionAll() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports keeping cursors open - * across commits. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports keeping cursors open across commits. - * This method always returns true. - *

    - * - * @return true if cursors always remain open; - * false if they might not remain open - * @exception SQLException if a database access error occurs - */ - public boolean supportsOpenCursorsAcrossCommit() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports keeping cursors open - * across rollbacks. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 closes open cursors at rollback. - * This method always returns false. - *

    - * - * @return true if cursors always remain open; - * false if they might not remain open - * @exception SQLException if a database access error occurs - */ - public boolean supportsOpenCursorsAcrossRollback() throws SQLException { - return false; - } - - /** - * Retrieves whether this database supports keeping statements open - * across commits. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports keeping statements open across commits; - * this method always returns true. - *

    - * - * - * - * @return true if statements always remain open; - * false if they might not remain open - * @exception SQLException if a database access error occurs - */ - public boolean supportsOpenStatementsAcrossCommit() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports keeping statements open - * across rollbacks. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports keeping statements open across rollbacks; - * this method always returns true. - *

    - * - * - * - * @return true if statements always remain open; - * false if they might not remain open - * @exception SQLException if a database access error occurs - */ - public boolean supportsOpenStatementsAcrossRollback() throws SQLException { - return true; - } - - //---------------------------------------------------------------------- - // The following group of methods exposes various limitations - // based on the target database with the current driver. - // Unless otherwise specified, a result of zero means there is no - // limit, or the limit is not known. - - /** - * Retrieves the maximum number of hex characters this database allows in an - * inline binary literal. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * - * @return max the maximum length (in hex characters) for a binary literal; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxBinaryLiteralLength() throws SQLException { - - // hard limit is Integer.MAX_VALUE - return 0; - } - - /** - * Retrieves the maximum number of characters this database allows - * for a character literal. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of characters allowed for a character literal; - * a result of zero means that there is no limit or the limit is - * not known - * @exception SQLException if a database access error occurs - */ - public int getMaxCharLiteralLength() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of characters this database allows - * for a column name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - * all names. - *

    - * - * - * @return the maximum number of characters allowed for a column name; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxColumnNameLength() throws SQLException { - return 128; - } - - /** - * Retrieves the maximum number of columns this database allows in a - * GROUP BY clause. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of columns allowed; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxColumnsInGroupBy() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of columns this database allows in an index. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of columns allowed; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxColumnsInIndex() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of columns this database allows in an - * ORDER BY clause. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of columns allowed; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxColumnsInOrderBy() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of columns this database allows in a - * SELECT list. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of columns allowed; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxColumnsInSelect() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of columns this database allows in a table. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of columns allowed; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxColumnsInTable() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of concurrent connections to this - * database that are possible. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of active connections possible at one time; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxConnections() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of characters that this database allows in a - * cursor name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - * all names. - *

    - * - * - * @return the maximum number of characters allowed in a cursor name; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxCursorNameLength() throws SQLException { - return 128; - } - - /** - * Retrieves the maximum number of bytes this database allows for an - * index, including all of the parts of the index. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory and disk availability; this method always returns 0. - *

    - * - * - * @return the maximum number of bytes allowed; this limit includes the - * composite of all the constituent parts of the index; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxIndexLength() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of characters that this database allows in a - * schema name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - * all names. - *

    - * - * @return the maximum number of characters allowed in a schema name; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxSchemaNameLength() throws SQLException { - return 128; - } - - /** - * Retrieves the maximum number of characters that this database allows in a - * procedure name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - * all names. - *

    - * - * - * @return the maximum number of characters allowed in a procedure name; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxProcedureNameLength() throws SQLException { - return 128; - } - - /** - * Retrieves the maximum number of characters that this database allows in a - * catalog name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - * all names. - *

    - * - * - * @return the maximum number of characters allowed in a catalog name; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxCatalogNameLength() throws SQLException { - return 128; - } - - /** - * Retrieves the maximum number of bytes this database allows in - * a single row. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory and disk availability; this method always returns 0. - *

    - * - * - * @return the maximum number of bytes allowed for a row; a result of - * zero means that there is no limit or the limit is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxRowSize() throws SQLException { - return 0; - } - - /** - * Retrieves whether the return value for the method - * getMaxRowSize includes the SQL data types - * LONGVARCHAR and LONGVARBINARY. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, {@link #getMaxRowSize} always returns - * 0, indicating that the maximum row size is unknown or has no limit. - * This applies to the above types as well; this method always - * returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { - return true; - } - - /** - * Retrieves the maximum number of characters this database allows in - * an SQL statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of characters allowed for an SQL statement; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxStatementLength() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of active statements to this database - * that can be open at the same time. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of statements that can be open at one time; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxStatements() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of characters this database allows in - * a table name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Up to and including 1.8.0.x, HSQLDB did not impose a "known" limit. Th - * hard limit was the maximum length of a java.lang.String - * (java.lang.Integer.MAX_VALUE); this method always returned - * 0. - * - * Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - * all names. - *

    - * - * - * @return the maximum number of characters allowed for a table name; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxTableNameLength() throws SQLException { - return 128; - } - - /** - * Retrieves the maximum number of tables this database allows in a - * SELECT statement. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not impose a "known" limit. The limit is subject to - * memory availability; this method always returns 0. - *

    - * - * - * @return the maximum number of tables allowed in a SELECT - * statement; a result of zero means that there is no limit or - * the limit is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxTablesInSelect() throws SQLException { - return 0; - } - - /** - * Retrieves the maximum number of characters this database allows in - * a user name. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB implements the SQL standard, which is 128 for - * all names. - *

    - * - * - * @return the maximum number of characters allowed for a user name; - * a result of zero means that there is no limit or the limit - * is not known - * @exception SQLException if a database access error occurs - */ - public int getMaxUserNameLength() throws SQLException { - return 128; - } - - //---------------------------------------------------------------------- - - /** - * Retrieves this database's default transaction isolation level. The - * possible values are defined in java.sql.Connection. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Default isolation mode in version 2.0 is TRANSACTION_READ_COMMITTED. - *
    - * - * - * @return the default isolation level - * @exception SQLException if a database access error occurs - * @see JDBCConnection - */ - public int getDefaultTransactionIsolation() throws SQLException { - - ResultSet rs = execute("CALL DATABASE_ISOLATION_LEVEL()"); - - rs.next(); - - String result = rs.getString(1); - - rs.close(); - - if (result.startsWith("READ COMMITTED")) { - return Connection.TRANSACTION_READ_COMMITTED; - } - - if (result.startsWith("READ UNCOMMITTED")) { - return Connection.TRANSACTION_READ_UNCOMMITTED; - } - - if (result.startsWith("SERIALIZABLE")) { - return Connection.TRANSACTION_SERIALIZABLE; - } - - return Connection.TRANSACTION_READ_COMMITTED; - } - - /** - * Retrieves whether this database supports transactions. If not, invoking the - * method commit is a noop, and the isolation level is - * TRANSACTION_NONE. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports transactions; - * this method always returns true. - *

    - * - * @return true if transactions are supported; - * false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsTransactions() throws SQLException { - return true; - } - - /* @todo update javadoc */ - - /** - * Retrieves whether this database supports the given transaction isolation level. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * HSQLDB supports all levels. - *
    - * - * - * - * @param level one of the transaction isolation levels defined in - * java.sql.Connection - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @see JDBCConnection - */ - public boolean supportsTransactionIsolationLevel( - int level) throws SQLException { - - return level == Connection.TRANSACTION_READ_UNCOMMITTED - || level == Connection.TRANSACTION_READ_COMMITTED - || level == Connection.TRANSACTION_REPEATABLE_READ - || level == Connection.TRANSACTION_SERIALIZABLE; - } - - /** - * Retrieves whether this database supports both data definition and - * data manipulation statements within a transaction. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support a mix of both data definition and - * data manipulation statements within a transaction. DDL commits the - * current transaction before proceeding; - * this method always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException { - return false; - } - - /** - * Retrieves whether this database supports only data manipulation - * statements within a transaction. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports only data manipulation - * statements within a transaction. DDL commits the - * current transaction before proceeding, while DML does not; - * this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean supportsDataManipulationTransactionsOnly() throws SQLException { - return true; - } - - /** - * Retrieves whether a data definition statement within a transaction forces - * the transaction to commit. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, a data definition statement within a transaction forces - * the transaction to commit; this method always returns true. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean dataDefinitionCausesTransactionCommit() throws SQLException { - return true; - } - - /** - * Retrieves whether this database ignores a data definition statement - * within a transaction. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, a data definition statement is not ignored within a - * transaction. Rather, a data definition statement within a - * transaction forces the transaction to commit; this method - * always returns false. - *

    - * - * - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean dataDefinitionIgnoredInTransactions() throws SQLException { - return false; - } - - /** - * Retrieves a description of the stored procedures available in the given - * catalog. - *

    - * Only procedure descriptions matching the schema and - * procedure name criteria are returned. They are ordered by - * JDBC 4.1[PROCEDURE_CAT,] PROCEDURE_SCHEM, - * PROCEDURE_NAME and (new to JDBC4)[SPECIFIC_ NAME]. - * - *

    Each procedure description has the the following columns: - *

      - *
    1. PROCEDURE_CAT String {@code =>} procedure catalog (may be null) - *
    2. PROCEDURE_SCHEM String {@code =>} procedure schema (may be null) - *
    3. PROCEDURE_NAME String {@code =>} procedure name - *
    4. reserved for future use - * (HSQLDB-specific: NUM_INPUT_PARAMS) - *
    5. reserved for future use - * (HSQLDB-specific: NUM_OUTPUT_PARAMS) - *
    6. reserved for future use - * (HSQLDB-specific: NUM_RESULT_SETS) - *
    7. REMARKS String {@code =>} explanatory comment on the procedure - *
    8. PROCEDURE_TYPE short {@code =>} kind of procedure: - *
        - *
      • procedureResultUnknown - (JDBC4 clarification:) Cannot determine if a return value - * will be returned - *
      • procedureNoResult - (JDBC4 clarification:) Does not return a return value - *
      • procedureReturnsResult - (JDBC4 clarification:) Returns a return value - *
      - *
    9. SPECIFIC_NAME String {@code =>} (JDBC4 new:) The name which uniquely identifies this - * procedure within its schema. - *
    - *

    - * A user may not have permissions to execute any of the procedures that are - * returned by getProcedures - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database.

    - * - * In version 1.9, the rows returned by this method are based on rows in - * the INFORMATION_SCHEMA.ROUTINES table. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param procedureNamePattern a procedure name pattern; must match the - * procedure name as it is stored in the database - * @return ResultSet - each row is a procedure description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getProcedures( - String catalog, String schemaPattern, - String procedureNamePattern) throws SQLException { - - String baseSelect = "select " + - "procedure_cat, procedure_schem, procedure_name, " + - "col_4, col_5, col_6, remarks, procedure_type, specific_name " + - "from information_schema.system_procedures " + - "where procedure_type = 1 "; - - if (wantsIsNull(procedureNamePattern)) { - return execute(baseSelect + "and 1=0"); - } - catalog = translateCatalog(catalog); - schemaPattern = translateSchema(schemaPattern); - - StringBuilder select = new StringBuilder(baseSelect); - select.append(and("PROCEDURE_CAT", - "=", catalog)).append(and("PROCEDURE_SCHEM", "LIKE", - schemaPattern)).append(and("PROCEDURE_NAME", "LIKE", - procedureNamePattern)); - - select.append(" ORDER BY PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME, SPECIFIC_NAME"); - return execute(select.toString()); - } - - /* - * Indicates that it is not known whether the procedure returns - * a result. - *

    - * A possible value for column PROCEDURE_TYPE in the - * ResultSet object returned by the method - * getProcedures. - */ - -// int procedureResultUnknown = 0; - - /* - * Indicates that the procedure does not return a result. - *

    - * A possible value for column PROCEDURE_TYPE in the - * ResultSet object returned by the method - * getProcedures. - */ -// int procedureNoResult = 1; - - /* - * Indicates that the procedure returns a result. - *

    - * A possible value for column PROCEDURE_TYPE in the - * ResultSet object returned by the method - * getProcedures. - */ -// int procedureReturnsResult = 2; - - /** - * Retrieves a description of the given catalog's stored procedure parameter - * and result columns. - * - *

    Only descriptions matching the schema, procedure and - * parameter name criteria are returned. They are ordered by - * JDBC 4.1[PROCEDURE_CAT,] PROCEDURE_SCHEM, PROCEDURE_NAME and SPECIFIC_NAME. Within this, the return value, - * if any, is first. Next are the parameter descriptions in call - * order. The column descriptions follow in column number order. - * - *

    Each row in the ResultSet is a parameter description or - * column description with the following fields: - *

      - *
    1. PROCEDURE_CAT String {@code =>} procedure catalog (may be null) - *
    2. PROCEDURE_SCHEM String {@code =>} procedure schema (may be null) - *
    3. PROCEDURE_NAME String {@code =>} procedure name - *
    4. COLUMN_NAME String {@code =>} column/parameter name - *
    5. COLUMN_TYPE Short {@code =>} kind of column/parameter: - *
        - *
      • procedureColumnUnknown - nobody knows - *
      • procedureColumnIn - IN parameter - *
      • procedureColumnInOut - INOUT parameter - *
      • procedureColumnOut - OUT parameter - *
      • procedureColumnReturn - procedure return value - *
      • procedureColumnResult - result column in ResultSet - *
      - *
    6. DATA_TYPE int {@code =>} SQL type from java.sql.Types - *
    7. TYPE_NAME String {@code =>} SQL type name, for a UDT type the - * type name is fully qualified - *
    8. PRECISION int {@code =>} precision - *
    9. LENGTH int {@code =>} length in bytes of data - *
    10. SCALE short {@code =>} scale - null is returned for data types where - * SCALE is not applicable. - *
    11. RADIX short {@code =>} radix - *
    12. NULLABLE short {@code =>} can it contain NULL. - *
        - *
      • procedureNoNulls - does not allow NULL values - *
      • procedureNullable - allows NULL values - *
      • procedureNullableUnknown - nullability unknown - *
      - *
    13. REMARKS String {@code =>} comment describing parameter/column - *
    14. COLUMN_DEF String {@code =>} default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null) - *
        - *
      • The string NULL (not enclosed in quotes) - if NULL was specified as the default value - *
      • TRUNCATE (not enclosed in quotes) - if the specified default value cannot be represented without truncation - *
      • NULL - if a default value was not specified - *
      - *
    15. SQL_DATA_TYPE int {@code =>} (JDBC4 new:) Reserved for future use - * - *

      HSQLDB-specific: CLI type from SQL 2003 Table 37, - * tables 6-9 Annex A1, and/or addenda in other - * documents, such as:
      - * SQL 2003 Part 9: Management of External Data (SQL/MED) : DATALINK
      - * SQL 2003 Part 14: XML-Related Specifications (SQL/XML) : XML - * - *

    16. SQL_DATETIME_SUB int {@code =>} (JDBC4 new:) reserved for future use - * - *

      HSQLDB-specific: CLI SQL_DATETIME_SUB from SQL 2003 Table 37 - * - *

    17. CHAR_OCTET_LENGTH int {@code =>} (JDBC4 new:) the maximum length of binary and character based columns. For any other datatype the returned value is a - * NULL - *
    18. ORDINAL_POSITION int {@code =>} (JDBC4 new:) the ordinal position, starting from 1, for the input and output parameters for a procedure. A value of 0 - * is returned if this row describes the procedure's return value. JDBC 4.1[For result set columns, it is the - * ordinal position of the column in the result set starting from 1. If there are - * multiple result sets, the column ordinal positions are implementation - * defined.] - *
    19. IS_NULLABLE String {@code =>} ISO rules are used to determine the nullability for a column. - *
        - *
      • YES --- if the parameter or result column can include NULLs - *
      • NO --- if the parameter or result column cannot include NULLs - *
      • empty string --- if the nullability for the - * parameter or result column is unknown - *
      - *
    20. SPECIFIC_NAME String {@code =>} (JDBC4 new:) the name which uniquely identifies this procedure within its schema. - *
    - * - *

    Note: Some databases may not return the column - * descriptions for a procedure. Additional columns beyond (JDBC4 modified:) - * SPECIFIC_NAME can be defined by the database and must be accessed by their column name. - * - *

    (JDBC4 clarification:) - *

    The PRECISION column represents the specified column size for the given column. - * For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - * For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - * this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - * column size is not applicable. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param procedureNamePattern a procedure name pattern; must match the - * procedure name as it is stored in the database - * @param columnNamePattern a column name pattern; must match the column name - * as it is stored in the database - * @return ResultSet - each row describes a stored procedure parameter or - * column - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getProcedureColumns(String catalog, String schemaPattern, - String procedureNamePattern, - String columnNamePattern) throws SQLException { - - if (wantsIsNull(procedureNamePattern) - || wantsIsNull(columnNamePattern)) { - return executeSelect("SYSTEM_PROCEDURECOLUMNS", "0=1"); - } - catalog = translateCatalog(catalog); - schemaPattern = translateSchema(schemaPattern); - - StringBuilder select = toQueryPrefix("SYSTEM_PROCEDURECOLUMNS").append( - and("PROCEDURE_CAT", "=", catalog)).append( - and("PROCEDURE_SCHEM", "LIKE", schemaPattern)).append( - and("PROCEDURE_NAME", "LIKE", procedureNamePattern)).append( - and("COLUMN_NAME", "LIKE", columnNamePattern)); - - select.append(" ORDER BY PROCEDURE_CAT, PROCEDURE_SCHEM, PROCEDURE_NAME, SPECIFIC_NAME"); - return execute(select.toString()); - } - - /** - * Retrieves a description of the tables available in the given catalog. - * Only table descriptions matching the catalog, schema, table - * name and type criteria are returned. They are ordered by - * TABLE_TYPE, JDBC 4.1[TABLE_CAT,] - * TABLE_SCHEM and TABLE_NAME. - *

    - * Each table description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} table catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} table schema (may be null) - *
    3. TABLE_NAME String {@code =>} table name - *
    4. TABLE_TYPE String {@code =>} table type. Typical types are "TABLE", - * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - *
    5. REMARKS String {@code =>} explanatory comment on the table - *
    6. TYPE_CAT String {@code =>} the types catalog (may be null) - *
    7. TYPE_SCHEM String {@code =>} the types schema (may be null) - *
    8. TYPE_NAME String {@code =>} type name (may be null) - *
    9. SELF_REFERENCING_COL_NAME String {@code =>} name of the designated - * "identifier" column of a typed table (may be null) - *
    10. REF_GENERATION String {@code =>} specifies how values in - * SELF_REFERENCING_COL_NAME are created. Values are - * "SYSTEM", "USER", "DERIVED". (may be null) - *
    - * - *

    Note: Some databases may not return information for - * all tables. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database.

    - * - * HSQLDB returns extra information on TEXT tables in the REMARKS column.

    - * - * HSQLDB includes the JDBC3 columns TYPE_CAT, TYPE_SCHEM, TYPE_NAME and - * SELF_REFERENCING_COL_NAME in anticipation of JDBC3 compliant tools.

    - * - * Since 1.7.2, this feature is supported by default. If the jar is - * compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - * not supported. The default implementation is - * the org.hsqldb.dbinfo.DatabaseInformationMain class. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param tableNamePattern a table name pattern; must match the - * table name as it is stored in the database - * @param types a list of table types, which must be from the list of table types - * returned from {@link #getTableTypes},to include; null returns - * all types - * @return ResultSet - each row is a table description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getTables(String catalog, String schemaPattern, - String tableNamePattern, - String[] types) throws SQLException { - - if (wantsIsNull(tableNamePattern) - || (types != null && types.length == 0)) { - return executeSelect("SYSTEM_TABLES", "0=1"); - } - catalog = translateCatalog(catalog); - schemaPattern = translateSchema(schemaPattern); - - StringBuilder select = - toQueryPrefix("SYSTEM_TABLES").append(and("TABLE_CAT", "=", - catalog)).append(and("TABLE_SCHEM", "LIKE", - schemaPattern)).append(and("TABLE_NAME", - "LIKE", tableNamePattern)); - - if (types == null) { - - // do not use to narrow search - } else { - - // JDBC4 clarification: - // fredt - we shouldn't impose this test as it breaks compatibility with tools -/* - String[] allowedTypes = new String[] { - "GLOBAL TEMPORARY", "SYSTEM TABLE", "TABLE", "VIEW" - }; - int illegalIndex = 0; - String illegalType = null; - - outer_loop: - for (int i = 0; i < types.length; i++) { - for (int j = 0; j < allowedTypes.length; j++) { - if (allowedTypes[j].equals(types[i])) { - continue outer_loop; - } - } - - illegalIndex = i; - illegalType = types[illegalIndex]; - - break; - } - - if (illegalType != null) { - throw Util.sqlException(Trace.JDBC_INVALID_ARGUMENT, - "types[" + illegalIndex + "]{@code =>}\"" - + illegalType + "\""); - } -*/ - - // end JDBC4 clarification - // - select.append(" AND TABLE_TYPE IN (").append( - StringUtil.getList(types, ",", "'")).append(')'); - } - - select.append(" ORDER BY TABLE_TYPE, TABLE_CAT, TABLE_SCHEM, TABLE_NAME"); - return execute(select.toString()); - } - - /** - * Retrieves the schema names available in this database. The results - * are ordered by JDBC 4.1[TABLE_CATALOG] and - * TABLE_SCHEM. - * - *

    The schema columns are: - *

      - *
    1. TABLE_SCHEM String {@code =>} schema name - *
    2. TABLE_CATALOG String {@code =>} catalog name (may be null) - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 1.8.0, the list of schemas is returned. - *

    - * - * - * @return a ResultSet object in which each row is a - * schema description - * @exception SQLException if a database access error occurs - * - */ - public ResultSet getSchemas() throws SQLException { - - // By default, query already returns the result in contract order - return executeSelect("SYSTEM_SCHEMAS", null); - } - - /** - * Retrieves the catalog names available in this database. The results - * are ordered by catalog name. - * - *

    The catalog column is: - *

      - *
    1. TABLE_CAT String {@code =>} catalog name - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.2, this feature is supported by default. If the jar is - * compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - * not supported. The default implementation is - * the org.hsqldb.dbinfo.DatabaseInformationMain class. - *

    - * - * - * @return a ResultSet object in which each row has a - * single String column that is a catalog name - * @exception SQLException if a database access error occurs - */ - public ResultSet getCatalogs() throws SQLException { - - String select = - "SELECT CATALOG_NAME AS TABLE_CAT FROM INFORMATION_SCHEMA.INFORMATION_SCHEMA_CATALOG_NAME"; - - return execute(select); - } - - /** - * Retrieves the table types available in this database. The results - * are ordered by table type. - * - *

    The table type is: - *

      - *
    1. TABLE_TYPE String {@code =>} table type. Typical types are "TABLE", - * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", - * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.1, HSQLDB reports: "TABLE", "VIEW" and "GLOBAL TEMPORARY" - * types. - * - * Since 1.7.2, this feature is supported by default. If the jar is - * compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - * not supported. The default implementation is - * the org.hsqldb.dbinfo.DatabaseInformationMain class. - *

    - * - * - * @return a ResultSet object in which each row has a - * single String column that is a table type - * @exception SQLException if a database access error occurs - */ - public ResultSet getTableTypes() throws SQLException { - - // system table producer returns rows in contract order - return executeSelect("SYSTEM_TABLETYPES", null); - } - - /** - * Retrieves a description of table columns available in - * the specified catalog. - * - *

    Only column descriptions matching the catalog, schema, table - * and column name criteria are returned. They are ordered by - * JDBC 4.1[TABLE_CAT, ]TABLE_SCHEM, - * TABLE_NAME, and ORDINAL_POSITION. - * - *

    Each column description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} table catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} table schema (may be null) - *
    3. TABLE_NAME String {@code =>} table name - *
    4. COLUMN_NAME String {@code =>} column name - *
    5. DATA_TYPE int {@code =>} SQL type from java.sql.Types - *
    6. TYPE_NAME String {@code =>} Data source dependent type name, - * for a UDT the type name is fully qualified - *
    7. COLUMN_SIZE int {@code =>} column size. - *
    8. BUFFER_LENGTH is not used. - *
    9. DECIMAL_DIGITS int {@code =>} the number of fractional digits. Null is returned for data types where - * DECIMAL_DIGITS is not applicable. - *
    10. NUM_PREC_RADIX int {@code =>} Radix (typically either 10 or 2) - *
    11. NULLABLE int {@code =>} is NULL allowed. - *
        - *
      • columnNoNulls - might not allow NULL values - *
      • columnNullable - definitely allows NULL values - *
      • columnNullableUnknown - nullability unknown - *
      - *
    12. REMARKS String {@code =>} comment describing column (may be null) - *
    13. COLUMN_DEF String {@code =>} (JDBC4 clarification:) default value for the column, which should be interpreted as a string when the value is enclosed in quotes (may be null) - *
    14. SQL_DATA_TYPE int {@code =>} unused - * - *

      HSQLDB-specific: CLI type from SQL 2003 Table 37, - * tables 6-9 Annex A1, and/or addendums in other - * documents, such as:
      - * SQL 2003 Part 9: Management of External Data (SQL/MED) : DATALINK
      - * SQL 2003 Part 14: XML-Related Specifications (SQL/XML) : XML - * - *

    15. SQL_DATETIME_SUB int {@code =>} unused (HSQLDB-specific: SQL 2003 CLI datetime/interval subcode) - *
    16. CHAR_OCTET_LENGTH int {@code =>} for char types the - * maximum number of bytes in the column - *
    17. ORDINAL_POSITION int {@code =>} index of column in table - * (starting at 1) - *
    18. IS_NULLABLE String {@code =>} ISO rules are used to determine the nullability for a column. - *
        - *
      • YES --- if the column can include NULLs - *
      • NO --- if the column cannot include NULLs - *
      • empty string --- if the nullability for the - * column is unknown - *
      - *
    19. JDBC 4.1 Deleted[SCOPE_CATLOG] JDBC 4.1 Added[SCOPE_CATALOG] String {@code =>} catalog of table that is the scope - * of a reference attribute (null if DATA_TYPE isn't REF) - *
    20. SCOPE_SCHEMA String {@code =>} schema of table that is the scope - * of a reference attribute (null if the DATA_TYPE isn't REF) - *
    21. SCOPE_TABLE String {@code =>} table name that this the scope - * of a reference attribute (null if the DATA_TYPE isn't REF) - *
    22. SOURCE_DATA_TYPE short {@code =>} source type of a distinct type or user-generated - * Ref type, SQL type from java.sql.Types (null if DATA_TYPE - * isn't DISTINCT or user-generated REF) - *
    23. IS_AUTOINCREMENT String {@code =>} Indicates whether this column is auto incremented - *
        - *
      • YES --- if the column is auto incremented - *
      • NO --- if the column is not auto incremented - *
      • empty string --- if it cannot be determined whether the column is auto incremented - *
      - *
    24. (JDBC 4.1 New:)IS_GENERATEDCOLUMN String {@code =>} Indicates whether this is a generated column - *
        - *
      • YES --- if this a generated column - *
      • NO --- if this not a generated column - *
      • empty string --- if it cannot be determined whether this is a generated column - *
      - *
    - * - *

    (JDBC4 clarification:) The COLUMN_SIZE column represents the specified column size for the given column. - * For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - * For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - * this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - * column size is not applicable. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database.

    - * - * This feature is supported by default. If the jar is - * compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - * not supported. The default implementation is - * the org.hsqldb.dbinfo.DatabaseInformationMain class. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param tableNamePattern a table name pattern; must match the - * table name as it is stored in the database - * @param columnNamePattern a column name pattern; must match the column - * name as it is stored in the database - * @return ResultSet - each row is a column description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getColumns(String catalog, String schemaPattern, - String tableNamePattern, - String columnNamePattern) throws SQLException { - - if (wantsIsNull(tableNamePattern) || wantsIsNull(columnNamePattern)) { - return executeSelect("SYSTEM_COLUMNS", "0=1"); - } - catalog = translateCatalog(catalog); - schemaPattern = translateSchema(schemaPattern); - - StringBuilder select = toQueryPrefix("SYSTEM_COLUMNS").append( - and("TABLE_CAT", "=", catalog)).append( - and("TABLE_SCHEM", "LIKE", schemaPattern)).append( - and("TABLE_NAME", "LIKE", tableNamePattern)).append( - and("COLUMN_NAME", "LIKE", columnNamePattern)); - - select.append(" ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION"); - return execute(select.toString()); - } - - /** - * Retrieves a description of the access rights for a table's columns. - * - *

    Only privileges matching the column name criteria are - * returned. They are ordered by COLUMN_NAME and PRIVILEGE. - * - *

    Each privilege description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} table catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} table schema (may be null) - *
    3. TABLE_NAME String {@code =>} table name - *
    4. COLUMN_NAME String {@code =>} column name - *
    5. GRANTOR String {@code =>} grantor of access (may be null) - *
    6. GRANTEE String {@code =>} grantee of access - *
    7. PRIVILEGE String {@code =>} name of access (SELECT, - * INSERT, UPDATE, REFRENCES, ...) - *
    8. IS_GRANTABLE String {@code =>} "YES" if grantee is permitted - * to grant to others; "NO" if not; null if unknown - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database.

    - * - * This feature is supported by default. The default implementation is - * the org.hsqldb.dbinfo.DatabaseInformationMain class. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schema a schema name; must match the schema name as it is - * stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param table a table name; must match the table name as it is - * stored in the database - * @param columnNamePattern a column name pattern; must match the column - * name as it is stored in the database - * @return ResultSet - each row is a column privilege description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getColumnPrivileges(String catalog, String schema, - String table, String columnNamePattern) throws SQLException { - - if (table == null) { - throw JDBCUtil.nullArgument("table"); - } -/* - if (wantsIsNull(columnNamePattern)) { - return executeSelect("SYSTEM_COLUMNPRIVILEGES", "0=1"); - } -*/ - catalog = translateCatalog(catalog); - schema = translateSchema(schema); - - String sql = - "SELECT TABLE_CATALOG TABLE_CAT, TABLE_SCHEMA TABLE_SCHEM," - + "TABLE_NAME, COLUMN_NAME, GRANTOR, GRANTEE, PRIVILEGE_TYPE PRIVILEGE, IS_GRANTABLE " - + "FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES WHERE TRUE " - + and("TABLE_CATALOG", "=", catalog) - + and("TABLE_SCHEMA", "=", schema) + and("TABLE_NAME", "=", table) - + and("COLUMN_NAME", "LIKE", columnNamePattern) - + " ORDER BY COLUMN_NAME, PRIVILEGE" - ; - - return execute(sql); - } - - /** - * Retrieves a description of the access rights for each table available - * in a catalog. Note that a table privilege applies to one or - * more columns in the table. It would be wrong to assume that - * this privilege applies to all columns (this may be true for - * some systems but is not true for all.) - * - *

    Only privileges matching the schema and table name - * criteria are returned. They are ordered by - * JDBC 4.1[TABLE_CAT,] - * TABLE_SCHEM, TABLE_NAME, - * and PRIVILEGE. - * - *

    Each privilege description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} table catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} table schema (may be null) - *
    3. TABLE_NAME String {@code =>} table name - *
    4. GRANTOR String {@code =>} grantor of access (may be null) - *
    5. GRANTEE String {@code =>} grantee of access - *
    6. PRIVILEGE String {@code =>} name of access (SELECT, - * INSERT, UPDATE, REFRENCES, ...) - *
    7. IS_GRANTABLE String {@code =>} "YES" if grantee is permitted - * to grant to others; "NO" if not; null if unknown - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param tableNamePattern a table name pattern; must match the - * table name as it is stored in the database - * @return ResultSet - each row is a table privilege description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - */ - public ResultSet getTablePrivileges( - String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { - - catalog = translateCatalog(catalog); - schemaPattern = translateSchema(schemaPattern); - - String sql = - "SELECT TABLE_CATALOG TABLE_CAT, TABLE_SCHEMA TABLE_SCHEM," - + "TABLE_NAME, GRANTOR, GRANTEE, PRIVILEGE_TYPE PRIVILEGE, IS_GRANTABLE " - + "FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES WHERE TRUE " - + and("TABLE_CATALOG", "=", catalog) - + and("TABLE_SCHEMA", "LIKE", schemaPattern) - + and("TABLE_NAME", "LIKE", tableNamePattern) - + " ORDER BY TABLE_SCHEM, TABLE_NAME, PRIVILEGE"; - -/* - if (wantsIsNull(tableNamePattern)) { - return executeSelect("SYSTEM_TABLEPRIVILEGES", "0=1"); - } -*/ - - return execute(sql); - } - - /** - * Retrieves a description of a table's optimal set of columns that - * uniquely identifies a row. They are ordered by SCOPE. - * - *

    Each column description has the following columns: - *

      - *
    1. SCOPE short {@code =>} actual scope of result - *
        - *
      • bestRowTemporary - very temporary, while using row - *
      • bestRowTransaction - valid for remainder of current transaction - *
      • bestRowSession - valid for remainder of current session - *
      - *
    2. COLUMN_NAME String {@code =>} column name - *
    3. DATA_TYPE int {@code =>} SQL data type from java.sql.Types - *
    4. TYPE_NAME String {@code =>} Data source dependent type name, - * for a UDT the type name is fully qualified - *
    5. COLUMN_SIZE int {@code =>} precision - *
    6. BUFFER_LENGTH int {@code =>} not used - *
    7. DECIMAL_DIGITS short {@code =>} scale - Null is returned for data types where - * DECIMAL_DIGITS is not applicable. - *
    8. PSEUDO_COLUMN short {@code =>} is this a pseudo column - * like an Oracle ROWID - *
        - *
      • bestRowUnknown - may or may not be pseudo column - *
      • bestRowNotPseudo - is NOT a pseudo column - *
      • bestRowPseudo - is a pseudo column - *
      - *
    - * - *

    (JDBC4 clarification:) - *

    The COLUMN_SIZE column represents the specified column size for the given column. - * For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - * For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - * this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - * column size is not applicable. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database.

    - * - * If the name of a column is defined in the database without double - * quotes, an all-uppercase name must be specified when calling this - * method. Otherwise, the name must be specified in the exact case of - * the column definition in the database. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schema a schema name; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param table a table name; must match the table name as it is stored - * in the database - * @param scope the scope of interest; use same values as SCOPE - * @param nullable include columns that are nullable. - * @return ResultSet - each row is a column description - * @exception SQLException if a database access error occurs - */ - public ResultSet getBestRowIdentifier(String catalog, String schema, - String table, int scope, boolean nullable) throws SQLException { - - if (table == null) { - throw JDBCUtil.nullArgument("table"); - } - - String scopeIn; - - switch (scope) { - - case bestRowTemporary : - scopeIn = BRI_TEMPORARY_SCOPE_IN_LIST; - - break; - case bestRowTransaction : - scopeIn = BRI_TRANSACTION_SCOPE_IN_LIST; - - break; - case bestRowSession : - scopeIn = BRI_SESSION_SCOPE_IN_LIST; - - break; - default : - throw JDBCUtil.invalidArgument("scope"); - } - catalog = translateCatalog(catalog); - schema = translateSchema(schema); - - Integer Nullable = (nullable) ? null - : INT_COLUMNS_NO_NULLS; - StringBuilder select = - toQueryPrefix("SYSTEM_BESTROWIDENTIFIER").append(and("TABLE_CAT", - "=", catalog)).append(and("TABLE_SCHEM", "=", - schema)).append(and("TABLE_NAME", "=", - table)).append(and("NULLABLE", "=", - Nullable)).append(" AND SCOPE IN ").append( - scopeIn); - - // By default, query already returns rows in contract order. - // However, the way things are set up, there should never be - // a result where there is > 1 distinct scope value: most requests - // will want only one table and the system table producer (for - // now) guarantees that a maximum of one BRI scope column set is - // produced for each table - select.append(" ORDER BY SCOPE"); - return execute(select.toString()); - } - - /** - * Retrieves a description of a table's columns that are automatically - * updated when any value in a row is updated. They are - * unordered. - * - *

    Each column description has the following columns: - *

      - *
    1. SCOPE short {@code =>} is not used - *
    2. COLUMN_NAME String {@code =>} column name - *
    3. DATA_TYPE int {@code =>} SQL data type from java.sql.Types - *
    4. TYPE_NAME String {@code =>} Data source-dependent type name - *
    5. COLUMN_SIZE int {@code =>} precision - *
    6. BUFFER_LENGTH int {@code =>} length of column value in bytes - *
    7. DECIMAL_DIGITS short {@code =>} scale - Null is returned for data types where - * DECIMAL_DIGITS is not applicable. - *
    8. PSEUDO_COLUMN short {@code =>} whether this is pseudo column - * like an Oracle ROWID - *
        - *
      • versionColumnUnknown - may or may not be pseudo column - *
      • versionColumnNotPseudo - is NOT a pseudo column - *
      • versionColumnPseudo - is a pseudo column - *
      - *
    - * - *

    (JDBC4 clarification:) - *

    The COLUMN_SIZE column represents the specified column size for the given column. - * For numeric data, this is the maximum precision. For character data, this is the [declared or implicit maximum] length in characters. - * For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - * this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0], JDBC 4.1 Added[Null] is returned for data types where the - * column size is not applicable. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.5.0 and later returns information on auto-updated - * TIMESTAMP columns defined with ON UPDATE CURRENT_TIMESTAMP, and the - * columns of SYSTEM_TIME periods. Columns defined as GENERATED AS IDENTITY, - * SEQUENCE, or an expression are not returned as they are not always - * automatically updated when other columns in a row are updated. - * - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schema a schema name; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param table a table name; must match the table name as it is stored - * in the database - * @return a ResultSet object in which each row is a - * column description - * @exception SQLException if a database access error occurs - */ - public ResultSet getVersionColumns(String catalog, String schema, - String table) throws SQLException { - - if (table == null) { - throw JDBCUtil.nullArgument("table"); - } - catalog = translateCatalog(catalog); - schema = translateSchema(schema); - - StringBuilder select = - toQueryPrefix("SYSTEM_VERSIONCOLUMNS").append(and("TABLE_CAT", - "=", catalog)).append(and("TABLE_SCHEM", "=", - schema)).append(and("TABLE_NAME", "=", table)); - - // result does not need to be ordered - return execute(select.toString()); - } - - /** - * Retrieves a description of the given table's primary key columns. They - * are ordered by COLUMN_NAME. - * - *

    Each primary key column description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} table catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} table schema (may be null) - *
    3. TABLE_NAME String {@code =>} table name - *
    4. COLUMN_NAME String {@code =>} column name - *
    5. KEY_SEQ short {@code =>} (JDBC4 Clarification:) sequence number within primary key( a value - * of 1 represents the first column of the primary key, a value of 2 would - * represent the second column within the primary key). - *
    6. PK_NAME String {@code =>} primary key name (may be null) - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schema a schema name; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param table a table name; must match the table name as it is stored - * in the database - * @return ResultSet - each row is a primary key column description - * @exception SQLException if a database access error occurs - * @see #supportsMixedCaseQuotedIdentifiers - * @see #storesUpperCaseIdentifiers - */ - public ResultSet getPrimaryKeys(String catalog, String schema, - String table) throws SQLException { - - if (table == null) { - throw JDBCUtil.nullArgument("table"); - } - catalog = translateCatalog(catalog); - schema = translateSchema(schema); - - StringBuilder select = - toQueryPrefix("SYSTEM_PRIMARYKEYS").append(and("TABLE_CAT", "=", - catalog)).append(and("TABLE_SCHEM", "=", - schema)).append(and("TABLE_NAME", "=", - table)); - - select.append(" ORDER BY COLUMN_NAME"); - - return execute(select.toString()); - } - - /** - * Retrieves a description of the primary key columns that are - * referenced by the given table's foreign key columns (the primary keys - * imported by a table). They are ordered by PKTABLE_CAT, - * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. - * - *

    Each primary key column description has the following columns: - *

      - *
    1. PKTABLE_CAT String {@code =>} primary key table catalog - * being imported (may be null) - *
    2. PKTABLE_SCHEM String {@code =>} primary key table schema - * being imported (may be null) - *
    3. PKTABLE_NAME String {@code =>} primary key table name - * being imported - *
    4. PKCOLUMN_NAME String {@code =>} primary key column name - * being imported - *
    5. FKTABLE_CAT String {@code =>} foreign key table catalog (may be null) - *
    6. FKTABLE_SCHEM String {@code =>} foreign key table schema (may be null) - *
    7. FKTABLE_NAME String {@code =>} foreign key table name - *
    8. FKCOLUMN_NAME String {@code =>} foreign key column name - *
    9. KEY_SEQ short {@code =>} (JDBC4 clarification) sequence number within a foreign key (a value - * of 1 represents the first column of the foreign key, a value of 2 would - * represent the second column within the foreign key). - *
    10. UPDATE_RULE short {@code =>} What happens to a - * foreign key when the primary key is updated: - *
        - *
      • importedNoAction - do not allow update of primary - * key if it has been imported - *
      • importedKeyCascade - change imported key to agree - * with primary key update - *
      • importedKeySetNull - change imported key to NULL - * if its primary key has been updated - *
      • importedKeySetDefault - change imported key to default values - * if its primary key has been updated - *
      • importedKeyRestrict - same as importedKeyNoAction - * (for ODBC 2.x compatibility) - *
      - *
    11. DELETE_RULE short {@code =>} What happens to - * the foreign key when primary is deleted. - *
        - *
      • importedKeyNoAction - do not allow delete of primary - * key if it has been imported - *
      • importedKeyCascade - delete rows that import a deleted key - *
      • importedKeySetNull - change imported key to NULL if - * its primary key has been deleted - *
      • importedKeyRestrict - same as importedKeyNoAction - * (for ODBC 2.x compatibility) - *
      • importedKeySetDefault - change imported key to default if - * its primary key has been deleted - *
      - *
    12. FK_NAME String {@code =>} foreign key name (may be null) - *
    13. PK_NAME String {@code =>} primary key name (may be null) - *
    14. DEFERRABILITY short {@code =>} can the evaluation of foreign key - * constraints be deferred until commit - *
        - *
      • importedKeyInitiallyDeferred - see SQL92 for definition - *
      • importedKeyInitiallyImmediate - see SQL92 for definition - *
      • importedKeyNotDeferrable - see SQL92 for definition - *
      - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schema a schema name; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param table a table name; must match the table name as it is stored - * in the database - * @return ResultSet - each row is a primary key column description - * @exception SQLException if a database access error occurs - * @see #getExportedKeys - * @see #supportsMixedCaseQuotedIdentifiers - * @see #storesUpperCaseIdentifiers - */ - public ResultSet getImportedKeys(String catalog, String schema, - String table) throws SQLException { - - if (table == null) { - throw JDBCUtil.nullArgument("table"); - } - catalog = translateCatalog(catalog); - schema = translateSchema(schema); - - StringBuilder select = toQueryPrefix("SYSTEM_CROSSREFERENCE").append( - and("FKTABLE_CAT", "=", catalog)).append( - and("FKTABLE_SCHEM", "=", schema)).append( - and("FKTABLE_NAME", "=", table)).append( - " ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, KEY_SEQ"); - - return execute(select.toString()); - } - - /** - * Retrieves a description of the foreign key columns that reference the - * given table's primary key columns (the foreign keys exported by a - * table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, - * FKTABLE_NAME, and KEY_SEQ. - * - *

    Each foreign key column description has the following columns: - *

      - *
    1. PKTABLE_CAT String {@code =>} primary key table catalog (may be null) - *
    2. PKTABLE_SCHEM String {@code =>} primary key table schema (may be null) - *
    3. PKTABLE_NAME String {@code =>} primary key table name - *
    4. PKCOLUMN_NAME String {@code =>} primary key column name - *
    5. FKTABLE_CAT String {@code =>} foreign key table catalog (may be null) - * being exported (may be null) - *
    6. FKTABLE_SCHEM String {@code =>} foreign key table schema (may be null) - * being exported (may be null) - *
    7. FKTABLE_NAME String {@code =>} foreign key table name - * being exported - *
    8. FKCOLUMN_NAME String {@code =>} foreign key column name - * being exported - *
    9. KEY_SEQ short {@code =>} (JDBC4 clarification:) sequence number within foreign key( a value - * of 1 represents the first column of the foreign key, a value of 2 would - * represent the second column within the foreign key). - *
    10. UPDATE_RULE short {@code =>} What happens to - * foreign key when primary is updated: - *
        - *
      • importedNoAction - do not allow update of primary - * key if it has been imported - *
      • importedKeyCascade - change imported key to agree - * with primary key update - *
      • importedKeySetNull - change imported key to NULL if - * its primary key has been updated - *
      • importedKeySetDefault - change imported key to default values - * if its primary key has been updated - *
      • importedKeyRestrict - same as importedKeyNoAction - * (for ODBC 2.x compatibility) - *
      - *
    11. DELETE_RULE short {@code =>} What happens to - * the foreign key when primary is deleted. - *
        - *
      • importedKeyNoAction - do not allow delete of primary - * key if it has been imported - *
      • importedKeyCascade - delete rows that import a deleted key - *
      • importedKeySetNull - change imported key to NULL if - * its primary key has been deleted - *
      • importedKeyRestrict - same as importedKeyNoAction - * (for ODBC 2.x compatibility) - *
      • importedKeySetDefault - change imported key to default if - * its primary key has been deleted - *
      - *
    12. FK_NAME String {@code =>} foreign key name (may be null) - *
    13. PK_NAME String {@code =>} primary key name (may be null) - *
    14. DEFERRABILITY short {@code =>} can the evaluation of foreign key - * constraints be deferred until commit - *
        - *
      • importedKeyInitiallyDeferred - see SQL92 for definition - *
      • importedKeyInitiallyImmediate - see SQL92 for definition - *
      • importedKeyNotDeferrable - see SQL92 for definition - *
      - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in this database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schema a schema name; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param table a table name; must match the table name as it is stored - * in this database - * @return a ResultSet object in which each row is a - * foreign key column description - * @exception SQLException if a database access error occurs - * @see #getImportedKeys - * @see #supportsMixedCaseQuotedIdentifiers - * @see #storesUpperCaseIdentifiers - */ - public ResultSet getExportedKeys(String catalog, String schema, - String table) throws SQLException { - - if (table == null) { - throw JDBCUtil.nullArgument("table"); - } - catalog = translateCatalog(catalog); - schema = translateSchema(schema); - - StringBuilder select = - toQueryPrefix("SYSTEM_CROSSREFERENCE").append(and("PKTABLE_CAT", - "=", catalog)).append(and("PKTABLE_SCHEM", "=", - schema)).append(and("PKTABLE_NAME", "=", table)); - - select.append(" ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, KEY_SEQ"); - return execute(select.toString()); - } - - /** - * (JDBC4 clarification:) - * Retrieves a description of the foreign key columns in the given foreign key - * table that reference the primary key or the columns representing a unique constraint of the parent table (could be the same or a different table). - * The number of columns returned from the parent table must match the number of - * columns that make up the foreign key. They - * are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and - * KEY_SEQ. - * - *

    Each foreign key column description has the following columns: - *

      - *
    1. PKTABLE_CAT String {@code =>} parent key table catalog (may be null) - *
    2. PKTABLE_SCHEM String {@code =>} parent key table schema (may be null) - *
    3. PKTABLE_NAME String {@code =>} parent key table name - *
    4. PKCOLUMN_NAME String {@code =>} parent key column name - *
    5. FKTABLE_CAT String {@code =>} foreign key table catalog (may be null) - * being exported (may be null) - *
    6. FKTABLE_SCHEM String {@code =>} foreign key table schema (may be null) - * being exported (may be null) - *
    7. FKTABLE_NAME String {@code =>} foreign key table name - * being exported - *
    8. FKCOLUMN_NAME String {@code =>} foreign key column name - * being exported - *
    9. KEY_SEQ short {@code =>} sequence number within foreign key( a value - * of 1 represents the first column of the foreign key, a value of 2 would - * represent the second column within the foreign key). - *
    10. UPDATE_RULE short {@code =>} What happens to - * foreign key when parent key is updated: - *
        - *
      • importedNoAction - do not allow update of parent - * key if it has been imported - *
      • importedKeyCascade - change imported key to agree - * with parent key update - *
      • importedKeySetNull - change imported key to NULL if - * its parent key has been updated - *
      • importedKeySetDefault - change imported key to default values - * if its parent key has been updated - *
      • importedKeyRestrict - same as importedKeyNoAction - * (for ODBC 2.x compatibility) - *
      - *
    11. DELETE_RULE short {@code =>} What happens to - * the foreign key when parent key is deleted. - *
        - *
      • importedKeyNoAction - do not allow delete of parent - * key if it has been imported - *
      • importedKeyCascade - delete rows that import a deleted key - *
      • importedKeySetNull - change imported key to NULL if - * its primary key has been deleted - *
      • importedKeyRestrict - same as importedKeyNoAction - * (for ODBC 2.x compatibility) - *
      • importedKeySetDefault - change imported key to default if - * its parent key has been deleted - *
      - *
    12. FK_NAME String {@code =>} foreign key name (may be null) - *
    13. PK_NAME String {@code =>} parent key name (may be null) - *
    14. DEFERRABILITY short {@code =>} can the evaluation of foreign key - * constraints be deferred until commit - *
        - *
      • importedKeyInitiallyDeferred - see SQL92 for definition - *
      • importedKeyInitiallyImmediate - see SQL92 for definition - *
      • importedKeyNotDeferrable - see SQL92 for definition - *
      - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database. - *

    - * - * - * @param parentCatalog a catalog name; must match the catalog name - * as it is stored in the database; "" retrieves those without a - * catalog; null means drop catalog name from the selection criteria - * @param parentSchema a schema name; must match the schema name as - * it is stored in the database; "" retrieves those without a schema; - * null means drop schema name from the selection criteria - * @param parentTable the name of the table that exports the key; must match - * the table name as it is stored in the database - * @param foreignCatalog a catalog name; must match the catalog name as - * it is stored in the database; "" retrieves those without a - * catalog; null means drop catalog name from the selection criteria - * @param foreignSchema a schema name; must match the schema name as it - * is stored in the database; "" retrieves those without a schema; - * null means drop schema name from the selection criteria - * @param foreignTable the name of the table that imports the key; must match - * the table name as it is stored in the database - * @return ResultSet - each row is a foreign key column description - * @exception SQLException if a database access error occurs - * @see #getImportedKeys - * @see #supportsMixedCaseQuotedIdentifiers - * @see #storesUpperCaseIdentifiers - */ - public ResultSet getCrossReference( - String parentCatalog, String parentSchema, String parentTable, - String foreignCatalog, String foreignSchema, - String foreignTable) throws SQLException { - - if (parentTable == null) { - throw JDBCUtil.nullArgument("parentTable"); - } - - if (foreignTable == null) { - throw JDBCUtil.nullArgument("foreignTable"); - } - parentCatalog = translateCatalog(parentCatalog); - foreignCatalog = translateCatalog(foreignCatalog); - parentSchema = translateSchema(parentSchema); - foreignSchema = translateSchema(foreignSchema); - - StringBuilder select = - toQueryPrefix("SYSTEM_CROSSREFERENCE").append(and("PKTABLE_CAT", - "=", parentCatalog)).append(and("PKTABLE_SCHEM", "=", - parentSchema)).append(and("PKTABLE_NAME", "=", - parentTable)).append(and("FKTABLE_CAT", "=", - foreignCatalog)).append(and("FKTABLE_SCHEM", "=", - foreignSchema)).append(and("FKTABLE_NAME", - "=", foreignTable)); - - select.append(" ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, KEY_SEQ"); - return execute(select.toString()); - } - - /** - * Retrieves a description of all the (JDBC4 clarification:) data types supported by - * this database. They are ordered by DATA_TYPE and then by how - * closely the data type maps to the corresponding JDBC SQL type. - * - *

    (JDBC4 clarification:) If the database supports SQL distinct types, then getTypeInfo() will return - * a single row with a TYPE_NAME of DISTINCT and a DATA_TYPE of Types.DISTINCT. - * If the database supports SQL structured types, then getTypeInfo() will return - * a single row with a TYPE_NAME of STRUCT and a DATA_TYPE of Types.STRUCT. - * - *

    (JDBC4 clarification:) - *

    If SQL distinct or structured types are supported, then information on the - * individual types may be obtained from the getUDTs() method. - * - * - *

    Each type description has the following columns: - *

      - *
    1. TYPE_NAME String {@code =>} Type name - *
    2. DATA_TYPE int {@code =>} SQL data type from java.sql.Types - *
    3. PRECISION int {@code =>} maximum precision - *
    4. LITERAL_PREFIX String {@code =>} prefix used to quote a literal - * (may be null) - *
    5. LITERAL_SUFFIX String {@code =>} suffix used to quote a literal - * (may be null) - *
    6. CREATE_PARAMS String {@code =>} parameters used in creating - * the type (may be null) - *
    7. NULLABLE short {@code =>} can you use NULL for this type. - *
        - *
      • typeNoNulls - does not allow NULL values - *
      • typeNullable - allows NULL values - *
      • typeNullableUnknown - nullability unknown - *
      - *
    8. CASE_SENSITIVE boolean{@code =>} is it case sensitive. - *
    9. SEARCHABLE short {@code =>} can you use "WHERE" based on this type: - *
        - *
      • typePredNone - No support - *
      • typePredChar - Only supported with WHERE .. LIKE - *
      • typePredBasic - Supported except for WHERE .. LIKE - *
      • typeSearchable - Supported for all WHERE .. - *
      - *
    10. UNSIGNED_ATTRIBUTE boolean {@code =>} is it unsigned. - *
    11. FIXED_PREC_SCALE boolean {@code =>} can it be a money value. - *
    12. AUTO_INCREMENT boolean {@code =>} can it be used for an - * auto-increment value. - *
    13. LOCAL_TYPE_NAME String {@code =>} localized version of type name - * (may be null) - *
    14. MINIMUM_SCALE short {@code =>} minimum scale supported - *
    15. MAXIMUM_SCALE short {@code =>} maximum scale supported - *
    16. SQL_DATA_TYPE int {@code =>} unused - *
    17. SQL_DATETIME_SUB int {@code =>} unused - *
    18. NUM_PREC_RADIX int {@code =>} usually 2 or 10 - *
    - * - *

    (JDBC4 clarification:) The PRECISION column represents the maximum column size that the server supports for the given datatype. - * For numeric data, this is the maximum precision. For character data, this is the [maximum] length in characters. - * For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - * this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. JDBC 4.1 Deleted[0] JDBC 4.1 Added[Null] is returned for data types where the - * column size is not applicable. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This feature is supported. - *

    - * - * - * @return a ResultSet object in which each row is an SQL - * type description - * @exception SQLException if a database access error occurs - */ - public ResultSet getTypeInfo() throws SQLException { - - // system table producer returns rows in contract order - return executeSelect("SYSTEM_TYPEINFO", null); - } - - /** - * Retrieves a description of the given table's indices and statistics. They are - * ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. - * - *

    Each index column description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} table catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} table schema (may be null) - *
    3. TABLE_NAME String {@code =>} table name - *
    4. NON_UNIQUE boolean {@code =>} Can index values be non-unique. - * false when TYPE is tableIndexStatistic - *
    5. INDEX_QUALIFIER String {@code =>} index catalog (may be null); - * null when TYPE is tableIndexStatistic - *
    6. INDEX_NAME String {@code =>} index name; null when TYPE is - * tableIndexStatistic - *
    7. TYPE short {@code =>} index type: - *
        - *
      • tableIndexStatistic - this identifies table statistics that are - * returned in conjunction with a table's index descriptions - *
      • tableIndexClustered - this is a clustered index - *
      • tableIndexHashed - this is a hashed index - *
      • tableIndexOther - this is some other style of index - *
      - *
    8. ORDINAL_POSITION short {@code =>} column sequence number - * within index; zero when TYPE is tableIndexStatistic - *
    9. COLUMN_NAME String {@code =>} column name; null when TYPE is - * tableIndexStatistic - *
    10. ASC_OR_DESC String {@code =>} column sort sequence, "A" {@code =>} ascending, - * "D" {@code =>} descending, may be null if sort sequence is not supported; - * null when TYPE is tableIndexStatistic - *
    11. CARDINALITY int {@code =>} When TYPE is tableIndexStatistic, then - * this is the number of rows in the table; otherwise, it is the - * number of unique values in the index. - *
    12. PAGES int {@code =>} When TYPE is tableIndexStatistic then - * this is the number of pages used for the table, otherwise it - * is the number of pages used for the current index. - *
    13. FILTER_CONDITION String {@code =>} Filter condition, if any. - * (may be null) - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in this database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schema a schema name; must match the schema name - * as it is stored in this database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param table a table name; must match the table name as it is stored - * in this database - * @param unique when true, return only indices for unique values; - * when false, return indices regardless of whether unique or not - * @param approximate when true, result is allowed to reflect approximate - * or out of data values; when false, results are requested to be - * accurate - * @return ResultSet - each row is an index column description - * @exception SQLException if a database access error occurs - * @see #supportsMixedCaseQuotedIdentifiers - * @see #storesUpperCaseIdentifiers - */ - public ResultSet getIndexInfo(String catalog, String schema, String table, - boolean unique, - boolean approximate) throws SQLException { - - if (table == null) { - throw JDBCUtil.nullArgument("table"); - } - catalog = translateCatalog(catalog); - schema = translateSchema(schema); - - Boolean nu = (unique) ? Boolean.FALSE - : null; - StringBuilder select = - toQueryPrefix("SYSTEM_INDEXINFO").append(and("TABLE_CAT", "=", - catalog)).append(and("TABLE_SCHEM", "=", - schema)).append(and("TABLE_NAME", "=", - table)).append(and("NON_UNIQUE", "=", - nu)); - - select.append(" ORDER BY NON_UNIQUE, TYPE, INDEX_NAME, ORDINAL_POSITION"); - return execute(select.toString()); - } - - //--------------------------JDBC 2.0----------------------------- - - /** - * Retrieves whether this database supports the given result set type. - * - * @param type defined in java.sql.ResultSet - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @see JDBCConnection - * @since JDK 1.2 - */ - public boolean supportsResultSetType(int type) throws SQLException { - return (type == ResultSet.TYPE_FORWARD_ONLY - || type == ResultSet.TYPE_SCROLL_INSENSITIVE); - } - - /** - * Retrieves whether this database supports the given concurrency type - * in combination with the given result set type. - * - * @param type defined in java.sql.ResultSet - * @param concurrency type defined in java.sql.ResultSet - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @see JDBCConnection - * @since JDK 1.2 - */ - public boolean supportsResultSetConcurrency(int type, - int concurrency) throws SQLException { - - return supportsResultSetType(type) - && (concurrency == ResultSet.CONCUR_READ_ONLY - || concurrency == ResultSet.CONCUR_UPDATABLE); - } - - /** - * - * Retrieves whether for the given type of ResultSet object, - * the result set's own updates are visible. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * Updates to ResultSet rows are not visible after moving from the updated - * row. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if updates are visible for the given result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean ownUpdatesAreVisible(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether a result set's own deletes are visible. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Rows deleted from the ResultSet are still visible after moving from the - * deleted row. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if deletes are visible for the given result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean ownDeletesAreVisible(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether a result set's own inserts are visible. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Rows added to a ResultSet are not visible after moving from the - * insert row; this method always returns false. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if inserts are visible for the given result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean ownInsertsAreVisible(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether updates made by others are visible. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Updates made by other connections or the same connection while the - * ResultSet is open are not visible in the ResultSet. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if updates made by others - * are visible for the given result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean othersUpdatesAreVisible(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether deletes made by others are visible. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Deletes made by other connections or the same connection while the - * ResultSet is open are not visible in the ResultSet. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if deletes made by others - * are visible for the given result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean othersDeletesAreVisible(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether inserts made by others are visible. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Inserts made by other connections or the same connection while the - * ResultSet is open are not visible in the ResultSet. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if inserts made by others - * are visible for the given result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean othersInsertsAreVisible(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether or not a visible row update can be detected by - * calling the method ResultSet.rowUpdated. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Updates made to the rows of the ResultSet are not detected by - * calling the ResultSet.rowUpdated. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if changes are detected by the result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean updatesAreDetected(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether or not a visible row delete can be detected by - * calling the method ResultSet.rowDeleted. If the method - * deletesAreDetected returns false, it means that - * deleted rows are removed from the result set. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Deletes made to the rows of the ResultSet are not detected by - * calling the ResultSet.rowDeleted. - *

    - * - * - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if deletes are detected by the given result set type; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean deletesAreDetected(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether or not a visible row insert can be detected - * by calling the method ResultSet.rowInserted. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Inserts made into the ResultSet are not visible and thus not detected by - * calling the ResultSet.rowInserted. - *

    - * - * @param type the ResultSet type; one of - * ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @return true if changes are detected by the specified result - * set type; false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean insertsAreDetected(int type) throws SQLException { - return false; - } - - /** - * Retrieves whether this database supports batch updates. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports batch updates; - * this method always returns true. - *

    - * - * @return true if this database supports batch updates; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public boolean supportsBatchUpdates() throws SQLException { - return true; - } - - /** - * Retrieves a description of the user-defined types (UDTs) defined - * in a particular schema. Schema-specific UDTs may have type - * JAVA_OBJECT, STRUCT, - * or DISTINCT. - * - *

    Only types matching the catalog, schema, type name and type - * criteria are returned. They are ordered by DATA_TYPE, - * JDBC 4.1[TYPE_CAT,] TYPE_SCHEM and - * TYPE_NAME. The type name parameter may be a fully-qualified - * name. In this case, the catalog and schemaPattern parameters are - * ignored. - * - *

    Each type description has the following columns: - *

      - *
    1. TYPE_CAT String {@code =>} the type's catalog (may be null) - *
    2. TYPE_SCHEM String {@code =>} type's schema (may be null) - *
    3. TYPE_NAME String {@code =>} type name - *
    4. CLASS_NAME String {@code =>} Java class name - *
    5. DATA_TYPE int {@code =>} type value defined in java.sql.Types. - * One of JAVA_OBJECT, STRUCT, or DISTINCT - *
    6. REMARKS String {@code =>} explanatory comment on the type - *
    7. BASE_TYPE short {@code =>} type code of the source type of a - * DISTINCT type or the type that implements the user-generated - * reference type of the SELF_REFERENCING_COLUMN of a structured - * type as defined in java.sql.Types (null if DATA_TYPE is not - * DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) - *
    - * - *

    Note: If the driver does not support UDTs, an empty - * result set is returned. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database.

    - * - * Starting with 2.0, DISTICT types are supported and are reported by this - * method. - *

    - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema pattern name; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param typeNamePattern a type name pattern; must match the type name - * as it is stored in the database; may be a fully qualified name - * @param types a list of user-defined types (JAVA_OBJECT, - * STRUCT, or DISTINCT) to include; null returns all types - * @return ResultSet object in which each row describes a UDT - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape (JDBC4 clarification) - * @since JDK 1.2 - */ - public ResultSet getUDTs(String catalog, String schemaPattern, - String typeNamePattern, - int[] types) throws SQLException { - - if (wantsIsNull(typeNamePattern) - || (types != null && types.length == 0)) { - executeSelect("SYSTEM_UDTS", "0=1"); - } - catalog = translateCatalog(catalog); - schemaPattern = translateSchema(schemaPattern); - - StringBuilder select = - toQueryPrefix("SYSTEM_UDTS").append(and("TYPE_CAT", "=", - catalog)).append(and("TYPE_SCHEM", "LIKE", - schemaPattern)).append(and("TYPE_NAME", - "LIKE", typeNamePattern)); - - if (types == null) { - - // do not use to narrow search - } else { - select.append(" AND DATA_TYPE IN (").append( - StringUtil.getList(types, ",", "")).append(')'); - } - - select.append(" ORDER BY DATA_TYPE, TYPE_CAT, TYPE_SCHEM, TYPE_NAME"); - return execute(select.toString()); - } - - /** - * Retrieves the connection that produced this metadata object. - *

    - * @return the connection that produced this metadata object - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public Connection getConnection() throws SQLException { - return connection; - } - - // ------------------- JDBC 3.0 ------------------------- - - /** - * Retrieves whether this database supports savepoints. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This SQL feature is supported through JDBC as well as SQL. - * - *

    - * - * @return true if savepoints are supported; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public boolean supportsSavepoints() throws SQLException { - return true; - } - - /** - * Retrieves whether this database supports named parameters to callable - * statements. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports JDBC named parameters to - * callable statements; this method returns true. - * - *

    - * - * @return true if named parameters are supported; - * false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public boolean supportsNamedParameters() throws SQLException { - return true; - } - - /** - * Retrieves whether it is possible to have multiple ResultSet objects - * returned from a CallableStatement object - * simultaneously. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports multiple ResultSet - * objects returned from a CallableStatement; - * this method always returns true.

    - *

    - * - * @return true if a CallableStatement object - * can return multiple ResultSet objects - * simultaneously; false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public boolean supportsMultipleOpenResults() throws SQLException { - return true; - } - - /** - * Retrieves whether auto-generated keys can be retrieved after - * a statement has been executed - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports retrieval of - * autogenerated keys through the JDBC interface; - * this method always returns true.

    - *

    - * - * @return true if auto-generated keys can be retrieved - * after a statement has executed; false otherwise - *

    (JDBC4 Clarification:) - *

    If true is returned, the JDBC driver must support the - * returning of auto-generated keys for at least SQL INSERT statements - *

    - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public boolean supportsGetGeneratedKeys() throws SQLException { - return true; - } - - /** - * Retrieves a description of the user-defined type (UDT) hierarchies defined in a - * particular schema in this database. Only the immediate super type - * sub type relationship is modeled. - *

    - * Only supertype information for UDTs matching the catalog, - * schema, and type name is returned. The type name parameter - * may be a fully-qualified name. When the UDT name supplied is a - * fully-qualified name, the catalog and schemaPattern parameters are - * ignored. - *

    - * If a UDT does not have a direct super type, it is not listed here. - * A row of the ResultSet object returned by this method - * describes the designated UDT and a direct supertype. A row has the following - * columns: - *

      - *
    1. TYPE_CAT String {@code =>} the UDT's catalog (may be null) - *
    2. TYPE_SCHEM String {@code =>} UDT's schema (may be null) - *
    3. TYPE_NAME String {@code =>} type name of the UDT - *
    4. SUPERTYPE_CAT String {@code =>} the direct super type's catalog - * (may be null) - *
    5. SUPERTYPE_SCHEM String {@code =>} the direct super type's schema - * (may be null) - *
    6. SUPERTYPE_NAME String {@code =>} the direct super type's name - *
    - * - *

    Note: If the driver does not support type hierarchies, an - * empty result set is returned. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports the SQL Standard. It treats unquoted identifiers as - * case insensitive in SQL and stores - * them in upper case; it treats quoted identifiers as case sensitive and - * stores them verbatim. All JDBCDatabaseMetaData methods perform - * case-sensitive comparison between name (pattern) arguments and the - * corresponding identifier values as they are stored in the database. - * Therefore, care must be taken to specify name arguments precisely - * (including case) as they are stored in the database.

    - * - * From 2.0, this feature is supported by default and return supertypes - * for DOMAIN and DISTINCT types.

    - * - * If the jar is - * compiled without org.hsqldb.dbinfo.DatabaseInformationMain, the feature is - * not supported. The default implementation is - * the org.hsqldb.dbinfo.DatabaseInformationMain class. - *

    - * - * - * @param catalog a catalog name; "" retrieves those without a catalog; - * null means drop catalog name from the selection criteria - * @param schemaPattern a schema name pattern; "" retrieves those - * without a schema - * @param typeNamePattern a UDT name pattern; may be a fully-qualified - * name - * @return a ResultSet object in which a row gives information - * about the designated UDT - * @throws SQLException if a database access error occurs - * @see #getSearchStringEscape (JDBC4 clarification) - * @since JDK 1.4, HSQLDB 1.7 - */ - public ResultSet getSuperTypes( - String catalog, String schemaPattern, - String typeNamePattern) throws SQLException { - - if (wantsIsNull(typeNamePattern)) { - return executeSelect("SYSTEM_SUPERTYPES", "0=1"); - } - catalog = translateCatalog(catalog); - schemaPattern = translateSchema(schemaPattern); - - StringBuilder select = toQueryPrefixNoSelect( - "SELECT * FROM (SELECT USER_DEFINED_TYPE_CATALOG, USER_DEFINED_TYPE_SCHEMA, USER_DEFINED_TYPE_NAME," - + "CAST (NULL AS INFORMATION_SCHEMA.SQL_IDENTIFIER), CAST (NULL AS INFORMATION_SCHEMA.SQL_IDENTIFIER), DATA_TYPE " - + "FROM INFORMATION_SCHEMA.USER_DEFINED_TYPES " - + "UNION SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME,NULL,NULL, DATA_TYPE " - + "FROM INFORMATION_SCHEMA.DOMAINS) " - + "AS SUPERTYPES(TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SUPERTYPE_CAT, SUPERTYPE_SCHEM, SUPERTYPE_NAME) ").append( - and("TYPE_CAT", "=", catalog)).append( - and("TYPE_SCHEM", "LIKE", schemaPattern)).append( - and("TYPE_NAME", "LIKE", typeNamePattern)); - - return execute(select.toString()); - } - - /** - * Retrieves a description of the table hierarchies defined in a particular - * schema in this database. - * - *

    Only supertable information for tables matching the catalog, schema - * and table name are returned. The table name parameter may be a fully- - * qualified name, in which case, the catalog and schemaPattern parameters - * are ignored. If a table does not have a super table, it is not listed here. - * Supertables have to be defined in the same catalog and schema as the - * sub tables. Therefore, the type description does not need to include - * this information for the supertable. - * - *

    Each type description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} the type's catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} type's schema (may be null) - *
    3. TABLE_NAME String {@code =>} type name - *
    4. SUPERTABLE_NAME String {@code =>} the direct super type's name - *
    - * - *

    Note: If the driver does not support type hierarchies, an - * empty result set is returned. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This method is intended for tables of structured types. - * From 2.0 this method returns an empty ResultSet. - * the org.hsqldb.dbinfo.DatabaseInformationMain class. - *

    - * - * - * @param catalog a catalog name; "" retrieves those without a catalog; - * null means drop catalog name from the selection criteria - * @param schemaPattern a schema name pattern; "" retrieves those - * without a schema - * @param tableNamePattern a table name pattern; may be a fully-qualified - * name - * @return a ResultSet object in which each row is a type description - * @throws SQLException if a database access error occurs - * @see #getSearchStringEscape (JDBC4 clarification) - * @since JDK 1.4, HSQLDB 1.7 - */ - public ResultSet getSuperTables( - String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { - - // query with no result - StringBuilder select = toQueryPrefixNoSelect( - "SELECT TABLE_NAME AS TABLE_CAT, TABLE_NAME AS TABLE_SCHEM, TABLE_NAME, TABLE_NAME AS SUPERTABLE_NAME " - + "FROM INFORMATION_SCHEMA.TABLES ").append( - and("TABLE_NAME", "=", "")); - - return execute(select.toString()); - } - - /** - * Retrieves a description of the given attribute of the given type - * for a user-defined type (UDT) that is available in the given schema - * and catalog. - *

    - * Descriptions are returned only for attributes of UDTs matching the - * catalog, schema, type, and attribute name criteria. They are ordered by - * JDBC 4.1[TYPE_CAT, ]TYPE_SCHEM, - * TYPE_NAME and ORDINAL_POSITION. This description - * does not contain inherited attributes. - *

    - * The ResultSet object that is returned has the following - * columns: - *

      - *
    1. TYPE_CAT String {@code =>} type catalog (may be null) - *
    2. TYPE_SCHEM String {@code =>} type schema (may be null) - *
    3. TYPE_NAME String {@code =>} type name - *
    4. ATTR_NAME String {@code =>} attribute name - *
    5. DATA_TYPE int {@code =>} attribute type SQL type from java.sql.Types - *
    6. ATTR_TYPE_NAME String {@code =>} Data source dependent type name. - * For a UDT, the type name is fully qualified. For a REF, the type name is - * fully qualified and represents the target type of the reference type. - *
    7. ATTR_SIZE int {@code =>} column size. For char or date - * types this is the maximum number of characters; for numeric or - * decimal types this is precision. - *
    8. DECIMAL_DIGITS int {@code =>} the number of fractional digits. Null is returned for data types where - * DECIMAL_DIGITS is not applicable. - *
    9. NUM_PREC_RADIX int {@code =>} Radix (typically either 10 or 2) - *
    10. NULLABLE int {@code =>} whether NULL is allowed - *
        - *
      • attributeNoNulls - might not allow NULL values - *
      • attributeNullable - definitely allows NULL values - *
      • attributeNullableUnknown - nullability unknown - *
      - *
    11. REMARKS String {@code =>} comment describing column (may be null) - *
    12. ATTR_DEF String {@code =>} default value (may be null) - *
    13. SQL_DATA_TYPE int {@code =>} unused - *
    14. SQL_DATETIME_SUB int {@code =>} unused - *
    15. CHAR_OCTET_LENGTH int {@code =>} for char types the - * maximum number of bytes in the column - *
    16. ORDINAL_POSITION int {@code =>} index of JDBC 4.1 correction[the attribute in the UDT] - * (starting at 1) - *
    17. IS_NULLABLE String {@code =>} ISO rules are used to determine - * the nullability for a column. - *
        - *
      • YES --- if the JDBC 4.1 correction[attribute] can include NULLs - *
      • NO --- if the JDBC 4.1 correction[attribute] cannot include NULLs - *
      • empty string --- if the nullability for the - * JDBC 4.1 correction[attribute] is unknown - *
      - *
    18. SCOPE_CATALOG String {@code =>} catalog of table that is the - * scope of a reference attribute (null if DATA_TYPE isn't REF) - *
    19. SCOPE_SCHEMA String {@code =>} schema of table that is the - * scope of a reference attribute (null if DATA_TYPE isn't REF) - *
    20. SCOPE_TABLE String {@code =>} table name that is the scope of a - * reference attribute (null if the DATA_TYPE isn't REF) - *
    21. SOURCE_DATA_TYPE short {@code =>} source type of a distinct type or user-generated - * Ref type,SQL type from java.sql.Types (null if DATA_TYPE - * isn't DISTINCT or user-generated REF) - *
    - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * This method is intended for attributes of structured types. - * From 2.0 this method returns an empty ResultSet. - *

    - * - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param typeNamePattern a type name pattern; must match the - * type name as it is stored in the database - * @param attributeNamePattern an attribute name pattern; must match the attribute - * name as it is declared in the database - * @return a ResultSet object in which each row is an - * attribute description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - * @since JDK 1.4, HSQLDB 1.7 - */ - public ResultSet getAttributes( - String catalog, String schemaPattern, String typeNamePattern, - String attributeNamePattern) throws SQLException { - - if (wantsIsNull(typeNamePattern) - || wantsIsNull(attributeNamePattern)) { - return executeSelect("SYSTEM_UDTATTRIBUTES", "0=1"); - } - schemaPattern = translateSchema(schemaPattern); - - StringBuilder select = toQueryPrefix("SYSTEM_UDTATTRIBUTES").append( - and("TYPE_CAT", "=", catalog)).append( - and("TYPE_SCHEM", "LIKE", schemaPattern)).append( - and("TYPE_NAME", "LIKE", typeNamePattern)).append( - and("ATTR_NAME", "LIKE", attributeNamePattern)); - - select.append(" ORDER BY TYPE_CAT, TYPE_SCHEM, TYPE_NAME, ORDINAL_POSITION"); - return execute(select.toString()); - } - - /** - * Retrieves whether this database supports the given result set holdability. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB returns true for both alternatives.

    - * - *

    - * - * @param holdability one of the following constants: - * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @see JDBCConnection - * @since JDK 1.4, HSQLDB 1.7 - */ - public boolean supportsResultSetHoldability( - int holdability) throws SQLException { - return holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT - || holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT; - } - - /** - * (JDBC4 clarification:) - * Retrieves this database's default holdability for ResultSet - * objects. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB defaults to HOLD_CURSORS_OVER_COMMIT for CONSUR_READ_ONLY - * ResultSet objects. - * If the ResultSet concurrency is CONCUR_UPDATABLE, then holdability is - * is enforced as CLOSE_CURSORS_AT_COMMIT.

    - * - *

    - * - * - * @return the default holdability; either - * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public int getResultSetHoldability() throws SQLException { - return ResultSet.HOLD_CURSORS_OVER_COMMIT; - } - - /** - * Retrieves the major version number of the underlying database. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * Returns the major version - *

    - * - * @return the underlying database's major version - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public int getDatabaseMajorVersion() throws SQLException { - - ResultSet rs = execute("call database_version()"); - - rs.next(); - - String v = rs.getString(1); - - rs.close(); - - return Integer.parseInt(v.substring(0, v.indexOf("."))); - } - - /** - * Retrieves the minor version number of the underlying database. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * This returns the digit after the first point in version. - *

    - * - * @return underlying database's minor version - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public int getDatabaseMinorVersion() throws SQLException { - - ResultSet rs = execute("call database_version()"); - - rs.next(); - - String v = rs.getString(1); - - rs.close(); - - int start = v.indexOf(".") + 1; - - return Integer.parseInt(v.substring(start, v.indexOf(".", start))); - } - - /** - * Retrieves the major JDBC version number for this - * driver. - * - * - *
    - *

    HSQLDB-Specific Information:

    - *

    - * - * - * @return JDBC version major number - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public int getJDBCMajorVersion() throws SQLException { - return JDBC_MAJOR; - } - - /** - * Retrieves the minor JDBC version number for this - * driver. - * - * - *
    - *

    HSQLDB-Specific Information:

    - *

    - * - * @return JDBC version minor number - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public int getJDBCMinorVersion() throws SQLException { - return JDBC_MINOR; - } - - /** - * (JDBC4 modified:) - * Indicates whether the SQLSTATE returned by SQLException.getSQLState - * is X/Open (now known as Open Group) SQL CLI or SQL:2003. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB returns sqlStateSQL under JDBC4 which is equivalent - * to JDBC3 value of sqlStateSQL99.

    - *

    - * - * @return the type of SQLSTATE; one of: - * sqlStateXOpen or - * sqlStateSQL - * - *

    sqlStateSQL is new in JDBC4 and its value is the same as JDBC3 sqlStateSQL99 - * @throws SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public int getSQLStateType() throws SQLException { - return sqlStateSQL99; - } - - /** - * Indicates whether updates made to a LOB are made on a copy or directly - * to the LOB. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Updates to a LOB are made directly. This means the lobs in an updatable - * ResultSet can be updated and the change is applied when the updateRow() - * method is applied. Lobs created by calling the Connection methods - * createClob() and createBlob() can be updated. The lob can then be sent to - * the database in a PreparedStatement with an UPDATE or INSERT SQL - * statement. - * - *

    - * - * - * @return true if updates are made to a copy of the LOB; - * false if updates are made directly to the LOB - * @throws SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public boolean locatorsUpdateCopy() throws SQLException { - return false; - } - - /** - * Retrieves whether this database supports statement pooling. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB supports statement pooling when built under - * JDK 1.6+.

    - *

    - * - * - * @return true if so; false otherwise - * @throws SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7 - */ - public boolean supportsStatementPooling() throws SQLException { - return (JDBC_MAJOR >= 4); - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * Indicates whether or not this data source supports the SQL ROWID type, - * and if so the lifetime for which a RowId object remains valid. - *

    - * The returned int values have the following relationship: - *

    {@code
    -     *     ROWID_UNSUPPORTED < ROWID_VALID_OTHER < ROWID_VALID_TRANSACTION
    -     *         < ROWID_VALID_SESSION < ROWID_VALID_FOREVER
    -     * }
    - * so conditional logic such as - *
    {@code
    -     *     if (metadata.getRowIdLifetime() > DatabaseMetaData.ROWID_VALID_TRANSACTION)
    -     * }
    - * can be used. Valid Forever means valid across all Sessions, and valid for - * a Session means valid across all its contained Transactions. - * - * @return the status indicating the lifetime of a RowId - * @throws SQLException if a database access error occurs - * @since JDK 1.6, HSQLDB 1.9 - */ - public RowIdLifetime getRowIdLifetime() throws SQLException { - return RowIdLifetime.ROWID_UNSUPPORTED; - } - - /** - * Retrieves the schema names available in this database. The results - * are ordered by JDBC 4.1[TABLE_CATALOG] and - * TABLE_SCHEM. - * - *

    The schema columns are: - *

      - *
    1. TABLE_SCHEM String {@code =>} schema name - *
    2. TABLE_CATALOG String {@code =>} catalog name (may be null) - *
    - * - * - * @param catalog a catalog name; must match the catalog name as it is stored - * in the database;"" retrieves those without a catalog; null means catalog - * name should not be used to narrow down the search. - * @param schemaPattern a schema name; must match the schema name as it is - * stored in the database; null means - * schema name should not be used to narrow down the search. - * @return a ResultSet object in which each row is a - * schema description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - * @since JDK 1.6, HSQLDB 1.9 - */ - public ResultSet getSchemas(String catalog, - String schemaPattern) throws SQLException { - - StringBuilder select = - toQueryPrefix("SYSTEM_SCHEMAS").append(and("TABLE_CATALOG", "=", - catalog)).append(and("TABLE_SCHEM", "LIKE", schemaPattern)); - - select.append(" ORDER BY TABLE_CATALOG, TABLE_SCHEM"); - return execute(select.toString()); - } - - /** - * Retrieves whether this database supports invoking user-defined or vendor functions - * using the stored procedure escape syntax. - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.6, HSQLDB 1.9 - */ - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { - return true; - } - - /* @todo */ - - /** - * Retrieves whether a SQLException while autoCommit is true indicates - * that all open ResultSets are closed, even ones that are holdable. When a SQLException occurs while - * autocommit is true, it is vendor specific whether the JDBC driver responds with a commit operation, a - * rollback operation, or by doing neither a commit nor a rollback. A potential result of this difference - * is in whether or not holdable ResultSets are closed. - * - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.6, HSQLDB 1.9 - */ - public boolean autoCommitFailureClosesAllResultSets() throws SQLException { - return false; - } - - /** - * Retrieves a list of the client info properties - * that the driver supports. The result set contains the following columns - *
      - *
    1. NAME String{@code =>} The name of the client info property
      - *
    2. MAX_LEN int{@code =>} The maximum length of the value for the property
      - *
    3. DEFAULT_VALUE String{@code =>} The default value of the property
      - *
    4. DESCRIPTION String{@code =>} A description of the property. This will typically - * contain information as to where this property is - * stored in the database. - *
    - *

    - * The ResultSet is sorted by the NAME column - *

    - * @return A ResultSet object; each row is a supported client info - * property - *

    - * @exception SQLException if a database access error occurs - *

    - * @since JDK 1.6, HSQLDB 1.9 - */ - public ResultSet getClientInfoProperties() throws SQLException { - - String s = - "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_CONNECTION_PROPERTIES"; - - return execute(s); - } - - /** - * Retrieves a description of the JDBC 4.1[ system and ]user functions available - * in the given catalog. - *

    - * Only system and user function descriptions matching the schema and - * function name criteria are returned. They are ordered by - * FUNCTION_CAT, FUNCTION_SCHEM, - * FUNCTION_NAME and - * SPECIFIC_ NAME. - * - *

    Each function description has the following columns: - *

      - *
    1. FUNCTION_CAT String {@code =>} function catalog (may be null) - *
    2. FUNCTION_SCHEM String {@code =>} function schema (may be null) - *
    3. FUNCTION_NAME String {@code =>} function name. This is the name - * used to invoke the function - *
    4. REMARKS String {@code =>} explanatory comment on the function - *
    5. FUNCTION_TYPE short {@code =>} kind of function: - *
        - *
      • functionResultUnknown - Cannot determine if a return value - * or table will be returned - *
      • functionNoTable- Does not return a table - *
      • functionReturnsTable - Returns a table - *
      - *
    6. SPECIFIC_NAME String {@code =>} the name which uniquely identifies - * this function within its schema. This is a user specified, or DBMS - * generated, name that may be different then the FUNCTION_NAME - * for example with overload functions - *
    - *

    - * A user may not have permission to execute any of the functions that are - * returned by getFunctions - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param functionNamePattern a function name pattern; must match the - * function name as it is stored in the database - * @return ResultSet - each row is a function description - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - * @since JDK 1.6, HSQLDB 1.9 - */ - public ResultSet getFunctions( - String catalog, String schemaPattern, - String functionNamePattern) throws SQLException { - - String baseSelect = "select " + - "sp.procedure_cat as FUNCTION_CAT," + - "sp.procedure_schem as FUNCTION_SCHEM," + - "sp.procedure_name as FUNCTION_NAME," + - "sp.remarks as REMARKS," + - "sp.function_type as FUNCTION_TYPE," + - "sp.specific_name as SPECIFIC_NAME " + - "from information_schema.system_procedures sp " + - "where sp.procedure_type = 2 "; - - if (wantsIsNull(functionNamePattern)) { - return execute(baseSelect + "and 1=0"); - } - schemaPattern = translateSchema(schemaPattern); - - StringBuilder sb = new StringBuilder(baseSelect); - sb.append(and("sp.procedure_cat", "=", - catalog)).append(and("sp.procedure_schem", "LIKE", - schemaPattern)).append(and("sp.procedure_name", - "LIKE", functionNamePattern)); - - // By default, query already returns the result ordered by - // FUNCTION_SCHEM, FUNCTION_NAME... - return execute(sb.toString()); - } - - /** - * Retrieves a description of the given catalog's system or user - * function parameters and return type. - * - *

    Only descriptions matching the schema, function and - * parameter name criteria are returned. They are ordered by - * FUNCTION_CAT, FUNCTION_SCHEM, - * FUNCTION_NAME and - * SPECIFIC_ NAME. Within this, the return value, - * if any, is first. Next are the parameter descriptions in call - * order. The column descriptions follow in column number order. - * - *

    Each row in the ResultSet - * is a parameter description, column description or - * return type description with the following fields: - *

      - *
    1. FUNCTION_CAT String {@code =>} function catalog (may be null) - *
    2. FUNCTION_SCHEM String {@code =>} function schema (may be null) - *
    3. FUNCTION_NAME String {@code =>} function name. This is the name - * used to invoke the function - *
    4. COLUMN_NAME String {@code =>} column/parameter name - *
    5. COLUMN_TYPE Short {@code =>} kind of column/parameter: - *
        - *
      • functionColumnUnknown - nobody knows - *
      • functionColumnIn - IN parameter - *
      • functionColumnInOut - INOUT parameter - *
      • functionColumnOut - OUT parameter - *
      • functionColumnReturn - function return value - *
      • functionColumnResult - Indicates that the parameter or column - * is a column in the ResultSet - *
      - *
    6. DATA_TYPE int {@code =>} SQL type from java.sql.Types - *
    7. TYPE_NAME String {@code =>} SQL type name, for a UDT type the - * type name is fully qualified - *
    8. PRECISION int {@code =>} precision - *
    9. LENGTH int {@code =>} length in bytes of data - *
    10. SCALE short {@code =>} scale - null is returned for data types where - * SCALE is not applicable. - *
    11. RADIX short {@code =>} radix - *
    12. NULLABLE short {@code =>} can it contain NULL. - *
        - *
      • functionNoNulls - does not allow NULL values - *
      • functionNullable - allows NULL values - *
      • functionNullableUnknown - nullability unknown - *
      - *
    13. REMARKS String {@code =>} comment describing column/parameter - *
    14. CHAR_OCTET_LENGTH int {@code =>} the maximum length of binary - * and character based parameters or columns. For any other datatype the returned value - * is a NULL - *
    15. ORDINAL_POSITION int {@code =>} the ordinal position, starting - * from 1, for the input and output parameters. A value of 0 - * is returned if this row describes the function's return value. - * For result set columns, it is the - * ordinal position of the column in the result set starting from 1. - *
    16. IS_NULLABLE String {@code =>} ISO rules are used to determine - * the nullability for a parameter or column. - *
        - *
      • YES --- if the parameter or column can include NULLs - *
      • NO --- if the parameter or column cannot include NULLs - *
      • empty string --- if the nullability for the - * parameter or column is unknown - *
      - *
    17. SPECIFIC_NAME String {@code =>} the name which uniquely identifies - * this function within its schema. This is a user specified, or DBMS - * generated, name that may be different then the FUNCTION_NAME - * for example with overload functions - *
    - * - *

    The PRECISION column represents the specified column size for the given - * parameter or column. - * For numeric data, this is the maximum precision. For character data, this is the length in characters. - * For datetime datatypes, this is the length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - * this is the length in bytes. Null is returned for data types where the - * column size is not applicable. - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param functionNamePattern a procedure name pattern; must match the - * function name as it is stored in the database - * @param columnNamePattern a parameter name pattern; must match the - * parameter or column name as it is stored in the database - * @return ResultSet - each row describes a - * user function parameter, column or return type - * - * @exception SQLException if a database access error occurs - * @see #getSearchStringEscape - * @since JDK 1.6, HSQLDB 1.9 - */ - public ResultSet getFunctionColumns( - String catalog, String schemaPattern, String functionNamePattern, - String columnNamePattern) throws SQLException { - - StringBuilder sb = new StringBuilder(256); - - sb.append("select pc.procedure_cat as FUNCTION_CAT,").append( - "pc.procedure_schem as FUNCTION_SCHEM,").append( - "pc.procedure_name as FUNCTION_NAME,").append( - "pc.column_name as COLUMN_NAME,").append( - "case pc.column_type").append(" when 3 then 5").append( - " when 4 then 3").append(" when 5 then 4").append( - " else pc.column_type").append(" end as COLUMN_TYPE,").append( - "pc.DATA_TYPE,").append("pc.TYPE_NAME,").append( - "pc.PRECISION,").append("pc.LENGTH,").append("pc.SCALE,").append( - "pc.RADIX,").append("pc.NULLABLE,").append("pc.REMARKS,").append( - "pc.CHAR_OCTET_LENGTH,").append("pc.ORDINAL_POSITION,").append( - "pc.IS_NULLABLE,").append("pc.SPECIFIC_NAME,").append( - "case pc.column_type").append(" when 3 then 1").append( - " else 0").append(" end AS COLUMN_GROUP ").append( - "from information_schema.system_procedurecolumns pc ").append( - "join (select procedure_schem,").append("procedure_name,").append( - "specific_name ").append( - "from information_schema.system_procedures ").append( - "where procedure_type = 2) p ").append( - "on pc.procedure_schem = p.procedure_schem ").append( - "and pc.procedure_name = p.procedure_name ").append( - "and pc.specific_name = p.specific_name ").append( - "and ((pc.column_type = 3 and pc.column_name = '@p0') ").append( - "or ").append("(pc.column_type <> 3)) "); - - if (wantsIsNull(functionNamePattern) - || wantsIsNull(columnNamePattern)) { - return execute(sb.append("where 1=0").toString()); - } - schemaPattern = translateSchema(schemaPattern); - - sb.append("where 1=1 ").append( - and("pc.procedure_cat", "=", catalog)).append( - and("pc.procedure_schem", "LIKE", schemaPattern)).append( - and("pc.procedure_name", "LIKE", functionNamePattern)).append( - and("pc.column_name", "LIKE", columnNamePattern)).append( - " order by 1, 2, 3, 17, 18 , 15"); - - // Order by FUNCTION_CAT, FUNCTION_SCHEM, FUNCTION_NAME, SPECIFIC_NAME - // COLUMN_GROUP and ORDINAL_POSITION - return execute(sb.toString()); - } - - /** - * Returns an object that implements the given interface to allow access to non-standard methods, - * or standard methods not exposed by the proxy. - * The result may be either the object found to implement the interface or a proxy for that object. - * If the receiver implements the interface then that is the object. If the receiver is a wrapper - * and the wrapped object implements the interface then that is the object. Otherwise the object is - * the result of calling unwrap recursively on the wrapped object. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 1.9 - */ - @SuppressWarnings("unchecked") - public T unwrap(java.lang.Class iface) throws java.sql.SQLException { - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 1.9 - */ - public boolean isWrapperFor( - java.lang.Class iface) throws java.sql.SQLException { - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - - //--------------------------JDBC 4.1 ----------------------------- - - /** - * Retrieves a description of the pseudo or hidden columns available - * in a given table within the specified catalog and schema. - * Pseudo or hidden columns may not always be stored within - * a table and are not visible in a ResultSet unless they are - * specified in the query's outermost SELECT list. Pseudo or hidden - * columns may not necessarily be able to be modified. If there are - * no pseudo or hidden columns, an empty ResultSet is returned. - * - *

    Only column descriptions matching the catalog, schema, table - * and column name criteria are returned. They are ordered by - * TABLE_CAT,TABLE_SCHEM, TABLE_NAME - * and COLUMN_NAME. - * - *

    Each column description has the following columns: - *

      - *
    1. TABLE_CAT String {@code =>} table catalog (may be null) - *
    2. TABLE_SCHEM String {@code =>} table schema (may be null) - *
    3. TABLE_NAME String {@code =>} table name - *
    4. COLUMN_NAME String {@code =>} column name - *
    5. DATA_TYPE int {@code =>} SQL type from java.sql.Types - *
    6. COLUMN_SIZE int {@code =>} column size. - *
    7. DECIMAL_DIGITS int {@code =>} the number of fractional digits. Null is returned for data types where - * DECIMAL_DIGITS is not applicable. - *
    8. NUM_PREC_RADIX int {@code =>} Radix (typically either 10 or 2) - *
    9. COLUMN_USAGE String {@code =>} The allowed usage for the column. The - * value returned will correspond to the enum name returned by {@link java.sql.PseudoColumnUsage PseudoColumnUsage.name()} - *
    10. REMARKS String {@code =>} comment describing column (may be null) - *
    11. CHAR_OCTET_LENGTH int {@code =>} for char types the - * maximum number of bytes in the column - *
    12. IS_NULLABLE String {@code =>} ISO rules are used to determine the nullability for a column. - *
        - *
      • YES --- if the column can include NULLs - *
      • NO --- if the column cannot include NULLs - *
      • empty string --- if the nullability for the column is unknown - *
      - *
    - * - *

    The COLUMN_SIZE column specifies the column size for the given column. - * For numeric data, this is the maximum precision. For character data, this is the length in characters. - * For datetime datatypes, this is the length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - * this is the length in bytes. Null is returned for data types where the - * column size is not applicable. - * - * @param catalog a catalog name; must match the catalog name as it - * is stored in the database; "" retrieves those without a catalog; - * null means that the catalog name should not be used to narrow - * the search - * @param schemaPattern a schema name pattern; must match the schema name - * as it is stored in the database; "" retrieves those without a schema; - * null means that the schema name should not be used to narrow - * the search - * @param tableNamePattern a table name pattern; must match the - * table name as it is stored in the database - * @param columnNamePattern a column name pattern; must match the column - * name as it is stored in the database - * @return ResultSet - each row is a column description - * @exception SQLException if a database access error occurs - * @see java.sql.PseudoColumnUsage - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public ResultSet getPseudoColumns( - String catalog, String schemaPattern, String tableNamePattern, - String columnNamePattern) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Retrieves whether a generated key will always be returned if the column - * name(s) or index(es) specified for the auto generated key column(s) - * are valid and the statement succeeds. The key that is returned may or - * may not be based on the column(s) for the auto generated key. - * Consult your JDBC driver documentation for additional details. - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public boolean generatedKeyAlwaysReturned() throws SQLException { - return true; - } - - //--------------------------JDBC 4.2 ----------------------------- - - /** - * - * Retrieves the maximum number of bytes this database allows for - * the logical size for a {@code LOB}. - * - * @return the maximum number of bytes allowed; a result of zero - * means that there is no limit or the limit is not known - * @exception SQLException if a database access error occurs - * @since 1.8 - */ - public long getMaxLogicalLobSize() throws SQLException { - return BlobType.maxBlobPrecision; - } - - /** - * Retrieves whether this database supports REF CURSOR. - - * @return {@code true} if this database supports REF CURSOR; - * {@code false} otherwise - * @exception SQLException if a database access error occurs - * @since 1.8 - */ - public boolean supportsRefCursors() throws SQLException { - return false; - } - - //----------------------- Internal Implementation -------------------------- - - /** Used by getBestRowIdentifier to avoid extra object construction */ - static final Integer INT_COLUMNS_NO_NULLS = Integer.valueOf(columnNoNulls); - - // ----------------------------------------------------------------------- - // private attributes - // ----------------------------------------------------------------------- - - /** - * The connection this object uses to retrieve database instance-specific - * metadata. - */ - private JDBCConnection connection; - - /** - * Connection property for schema reporting. - */ - final private boolean useSchemaDefault; - - /** - * NULL related properties are updated on each call. - */ - private boolean concatNulls = true; - private boolean nullsFirst = true; - private boolean nullsOrder = true; - - /** - * A CSV list representing the SQL IN list to use when generating - * queries for getBestRowIdentifier when the - * scope argument is bestRowSession. - */ - private static final String BRI_SESSION_SCOPE_IN_LIST = "(" - + bestRowSession + ")"; - - /** - * A CSV list representing the SQL IN list to use when generating - * queries for getBestRowIdentifier when the - * scope argument is bestRowTemporary. - */ - private static final String BRI_TEMPORARY_SCOPE_IN_LIST = "(" - + bestRowTemporary + "," + bestRowTransaction + "," + bestRowSession - + ")"; - - /** - * A CSV list representing the SQL IN list to use when generating - * queries for getBestRowIdentifier when the - * scope argument is bestRowTransaction. - */ - private static final String BRI_TRANSACTION_SCOPE_IN_LIST = "(" - + bestRowTransaction + "," + bestRowSession + ")"; - - /** - * "SELECT * FROM ".

    - * - * This attribute is in support of methods that use SQL SELECT statements to - * generate returned ResultSet objects. - */ - private static final String selstar = "SELECT * FROM INFORMATION_SCHEMA."; - - /** - * " WHERE TRUE ".

    - * - * This attribute is in support of methods that use SQL SELECT statements to - * generate returned ResultSet objects.

    - * - * The optimizer will simply drop this when parsing a condition - * expression. And it makes our code much easier to write, since we don't - * have to check our "WHERE" clause productions as strictly for proper - * conjunction: we just stick additional conjunctive predicates on the - * end of this and Presto! Everything works :-) - */ - private static final String whereTrue = " WHERE TRUE"; - - public static final int JDBC_MAJOR = 4; - -//#ifdef JAVA8 - public static final int JDBC_MINOR = 2; - -//#else -/* - public static final int JDBC_MINOR = 0; -*/ - -//#endif JAVA8 - - public static final String THIS_VERSION = HsqlDatabaseProperties.THIS_VERSION; - - /** - * Constructs a new JDBCDatabaseMetaData object using the - * specified connection. This contructor is used by JDBCConnection - * when producing a DatabaseMetaData object from a call to - * {@link JDBCConnection#getMetaData() getMetaData}. - * @param c the connection this object will use to retrieve - * instance-specific metadata - * @throws SQLException never - reserved for future use - */ - JDBCDatabaseMetaData(JDBCConnection c) throws SQLException { - - // PRE: is non-null and not closed - connection = c; - useSchemaDefault = c.isInternal ? false - : c.isDefaultSchema; - } - - /** - * Retrieves an "AND" predicate based on the (column) id, - * op(erator) andval(ue) arguments to be - * included in an SQL "WHERE" clause, using the conventions laid out for - * JDBC DatabaseMetaData filter parameter values.

    - * - * @return an "AND" predicate built from the arguments - * @param id the simple, non-quoted identifier of a system table - * column upon which to filter.

    - * - * No checking is done for column name validity.
    - * It is assumed the system table column name is correct.

    - * - * @param op the conditional operation to perform using the system table - * column name value and the val argument.

    - * - * @param val an object representing the value to use in some conditional - * operation, op, between the column identified by the id argument - * and this argument. - * - *

      - *
    • null causes the empty string to be returned. - * - *
    • toString().length() == 0 causes the returned expression - * to be built so that the IS NULL operation will occur - * against the specified column. - * - *
    • instanceof String causes the returned expression to be - * built so that the specified operation will occur between - * the specified column and the specified value, converted to - * an SQL string (single quoted, with internal single quotes - * escaped by doubling). If op is "LIKE" and - * val does not contain any "%" or "_" wild - * card characters, then op is silently - * converted to "=". - * - *
    • !instanceof String causes an expression to built so that - * the specified operation will occur between the specified - * column and String.valueOf(val).

      - * - *

    - */ - private static String and(String id, String op, Object val) { - - // The JDBC standard for pattern arguments seems to be: - // - // - pass null to mean ignore (do not include in query), - // - pass "" to mean filter on IS NULL, - // - pass "%" to filter on IS NOT NULL. - // - pass sequence with "%" and "_" for wildcard matches - // - when searching on values reported directly from DatabaseMetaData - // results, typically an exact match is desired. In this case, it - // is the client's responsibility to escape any reported "%" and "_" - // characters using whatever DatabaseMetaData returns from - // getSearchEscapeString(). In our case, this is the standard escape - // character: '\'. Typically, '%' will rarely be encountered, but - // certainly '_' is to be expected on a regular basis. - // - checkme: what about the (silly) case where an identifier - // has been declared such as: 'create table "xxx\_yyy"(...)'? - // Must the client still escape the Java string like this: - // "xxx\\\\_yyy"? - // Yes: because otherwise the driver is expected to - // construct something like: - // select ... where ... like 'xxx\_yyy' escape '\' - // which will try to match 'xxx_yyy', not 'xxx\_yyy' - // Testing indicates that indeed, higher quality popular JDBC - // database browsers do the escapes "properly." - if (val == null) { - return ""; - } - - StringBuilder sb = new StringBuilder(); - boolean isStr = (val instanceof String); - - if (isStr && ((String) val).isEmpty()) { - return sb.append(" AND ").append(id).append(" IS NULL").toString(); - } - - String v = isStr ? Type.SQL_VARCHAR.convertToSQLString(val) - : String.valueOf(val); - - sb.append(" AND ").append(id).append(' '); - - // add the escape to like if required - if (isStr && "LIKE".equalsIgnoreCase(op)) { - if (v.indexOf('_') < 0 && v.indexOf('%') < 0) { - - // then we can optimize. - sb.append("=").append(' ').append(v); - } else { - sb.append("LIKE").append(' ').append(v); - - if (v.contains("\\_") || v.contains("\\%")) { - - // then client has requested at least one escape. - sb.append(" ESCAPE '\\'"); - } - } - } else { - sb.append(op).append(' ').append(v); - } - - return sb.toString(); - } - - /** - * The main SQL statement executor. All SQL destined for execution - * ultimately goes through this method.

    - * - * The sqlStatement field for the result is set autoClose to comply with - * ResultSet.getStatement() semantics for result sets that are not from - * a user supplied Statement object. (fredt)

    - * - * @param sql SQL statement to execute - * @return the result of issuing the statement - * @throws SQLException is a database error occurs - */ - private ResultSet execute(String sql) throws SQLException { - - // NOTE: - // Need to create a JDBCStatement here so JDBCResultSet can return - // its Statement object on call to getStatement(). - // The native JDBCConnection.execute() method does not - // automatically assign a Statement object for the ResultSet, but - // JDBCStatement does. That is, without this, there is no way for the - // JDBCResultSet to find its way back to its Connection (or Statement) - // Also, cannot use single, shared JDBCStatement object, as each - // fetchResult() closes any old JDBCResultSet before fetching the - // next, causing the JDBCResultSet's Result object to be nullified - final int scroll = ResultSet.TYPE_SCROLL_INSENSITIVE; - final int concur = ResultSet.CONCUR_READ_ONLY; - JDBCStatement st = (JDBCStatement) connection.createStatement(scroll, - concur); - - st.maxRows = -1; - - ResultSet r = st.executeQuery(sql); - - ((JDBCResultSet) r).autoClose = true; - - return r; - } - - /** - * An SQL statement executor that knows how to create a "SELECT - * * FROM" statement, given a table name and a where clause.

    - * - * If the where clause is null, it is omitted.

    - * - * It is assumed that the table name is non-null, since this is a private - * method. No check is performed.

    - * - * @return the result of executing "SELECT * FROM " + table " " + where - * @param table the name of a table to "select * from" - * @param where the where condition for the select - * @throws SQLException if database error occurs - */ - private ResultSet executeSelect(String table, - String where) throws SQLException { - - String select = selstar + table; - - if (where != null) { - select += " WHERE " + where; - } - - return execute(select); - } - - /** - * Retrieves "SELECT * FROM INFORMATION_SCHEMA.<table> WHERE 1=1" in string - * buffer form.

    - * - * This is a convenience method provided because, for most - * DatabaseMetaData queries, this is the most suitable - * thing upon which to start building.

    - * - * @return an StringBuilder whose content is: - * "SELECT * FROM <table> WHERE 1=1" - * @param t the name of the table - */ - private StringBuilder toQueryPrefix(String t) { - - StringBuilder sb = new StringBuilder(255); - - return sb.append(selstar).append(t).append(whereTrue); - } - - /** - * Retrieves "<expression> WHERE 1=1" in string - */ - private StringBuilder toQueryPrefixNoSelect(String t) { - - StringBuilder sb = new StringBuilder(255); - - return sb.append(t).append(whereTrue); - } - - /** - * Retrieves whether the JDBC DatabaseMetaData contract - * specifies that the argument s is filter parameter - * value that requires a corresponding IS NULL predicate.

    - * - * @param s the filter parameter to test - * @return true if the argument, s, is filter parameter value that - * requires a corresponding IS NULL predicate - */ - private static boolean wantsIsNull(String s) { - return (s != null && s.isEmpty()); - } - - private void setCurrentProperties() throws SQLException { - ResultSet rs = executeSelect("SYSTEM_PROPERTIES", - "PROPERTY_NAME IN "+ - "('sql.concat_nulls', 'sql.nulls_first' , 'sql.nulls_order')"); - - while(rs.next()) { - String prop = rs.getString(2); - boolean value = Boolean.valueOf(rs.getString(3)); - - if (prop.equals("sql.concat_nulls")) { - concatNulls = value; - } else - - if (prop.equals("sql.nulls_first")) { - nullsFirst = value; - } else - - if (prop.equals("sql.nulls_order")) { - nullsOrder = value; - } - } - - rs.close(); - } - - /** - * Returns the name of the default collation for database. - * @return name of collation - */ - public String getDatabaseDefaultCollation() { - - String value = null; - try { - ResultSet rs = executeSelect("SYSTEM_PROPERTIES", - "PROPERTY_NAME = 'sql.default_collation'"); - - if (rs.next()) { - value = rs.getString(4); - } - - rs.close(); - } catch (Exception e) { - } - - return value; - } - - /** - * Returns the name of the default schema for database. - */ - String getDatabaseDefaultSchema() throws SQLException { - - final ResultSet rs = executeSelect("SYSTEM_SCHEMAS", - "IS_DEFAULT=TRUE"); - - String value = rs.next() ? rs.getString(1) - : null; - rs.close(); - return value; - } - - String getConnectionDefaultSchema() throws SQLException { - - ResultSet rs = execute("CALL CURRENT_SCHEMA"); - - rs.next(); - - String result = rs.getString(1); - - rs.close(); - - return result; - } - - void setConnectionDefaultSchema(String schemaName) throws SQLException { - - execute("SET SCHEMA " - + StringConverter.toQuotedString(schemaName, - '"', true)); - } - - /** - * For compatibility, when the connection property "default_schema=true" - * is present, any DatabaseMetaData call with an empty string as the - * schema parameter will use the default schema (normally "PUBLIC"). - */ - private String translateSchema(String schemaName) throws SQLException { - - if (useSchemaDefault && schemaName != null - && schemaName.isEmpty()) { - final String result = getDatabaseDefaultSchema(); - - if (result != null) { - schemaName = result; - } - } - - return schemaName; - } - - /** - * Returns the name of the catalog of the default schema. - */ - String getDatabaseDefaultCatalog() throws SQLException { - - final ResultSet rs = executeSelect("SYSTEM_SCHEMAS", - "IS_DEFAULT=TRUE"); - - String value = rs.next() ? rs.getString(2) - : null; - rs.close(); - return value; - } - - /** - * For compatibility, when the connection property "default_schema=true" - * is present, any DatabaseMetaData call with an empty string as the - * catalog parameter will use the default catalog "PUBLIC". - */ - private String translateCatalog(String catalogName) throws SQLException { - - if (useSchemaDefault && catalogName != null - && catalogName.isEmpty()) { - String result = getDatabaseDefaultCatalog(); - - if (result != null) { - catalogName = result; - } - } - - return catalogName; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDriver.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCDriver.java deleted file mode 100644 index 9adf3025..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCDriver.java +++ /dev/null @@ -1,529 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Properties; - -import java.sql.SQLFeatureNotSupportedException; - -//#ifdef JAVA8 -import java.sql.DriverAction; - -//#endif JAVA8 - -import org.hsqldb.DatabaseURL; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.persist.HsqlDatabaseProperties; -import org.hsqldb.persist.HsqlProperties; - -// fredt@users 20011220 - patch 1.7.0 by fredt -// new version numbering scheme -// fredt@users 20020320 - patch 1.7.0 - JDBC 2 support and error trapping -// fredt@users 20030528 - patch 1.7.2 suggested by Gerhard Hiller - support for properties in URL -// campbell-burnet@users 20051207 - patch 1.8.x initial JDBC 4.0 support work - -/** - * Provides the java.sql.Driver interface implementation required by - * the JDBC specification.

    - * - * The Java SQL framework allows for multiple database drivers.

    - * - * The DriverManager will try to load as many drivers as it can find and - * then for any given connection request, it will ask each driver in turn - * to try to connect to the target URL.

    - * - * The application developer will normally not need to call any function of - * the Driver directly. All required calls are made by the DriverManager. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * When the HSQL Database Engine Driver class is loaded, it creates an - * instance of itself and register it with the DriverManager. This means - * that a user can load and register the HSQL Database Engine driver by - * calling: - *

    - *  Class.forName("org.hsqldb.jdbc.JDBCDriver")
    - *  
    - * - * For detailed information about how to obtain HSQLDB JDBC Connections, - * please see {@link org.hsqldb.jdbc.JDBCConnection JDBCConnection}. - * - *
    - * - * JDBC 4.0 notes:

    - * - * Starting with JDBC 4.0 (JDK 1.6), the DriverManager methods - * getConnection and getDrivers have been - * enhanced to support the Java Standard Edition Service Provider mechanism. - * When built under a Java runtime that supports JDBC 4.0, HSQLDB distribution - * jars containing the Driver implementation also include the file - * META-INF/services/java.sql.Driver. This file contains the fully - * qualified class name ('org.hsqldb.jdbc.JDBCDriver') of the HSQLDB implementation - * of java.sql.Driver.

    - * - * Hence, under JDBC 4.0 or greater, applications no longer need to explicitly - * load the HSQLDB JDBC driver using Class.forName(). Of course, - * existing programs which do load JDBC drivers using - * Class.forName() will continue to work without modification.

    - * - * JDBC 4.2 methods added in Java 8 are generally supported when the HSQLDB jar - * is compiled with JDK 8 - *


    - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since HSQLDB 1.9.0 - *
    - * - * @see org.hsqldb.jdbc.JDBCConnection - */ -public class JDBCDriver implements Driver { - - - /** - * name of loginTimeout property, can not change - */ - static final String conn_loginTimeout = "loginTimeout"; - /** - * Default constructor - */ - public JDBCDriver() { - } - - /** - * Attempts to make a database connection to the given URL.

    - * - * Returns "null" if this is the wrong kind of driver to connect to the - * given URL. This will be common, as when the JDBC driver manager is asked - * to connect to a given URL it passes the URL to each loaded driver in - * turn. - * - *

    The driver throws an SQLException if it is the right - * driver to connect to the given URL but has trouble connecting to - * the database. - * - *

    The java.util.Properties argument can be used to pass - * arbitrary string tag/value pairs as connection arguments. - * Normally at least "user" and "password" properties should be - * included in the Properties object. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * For the HSQL Database Engine, at least "user" and - * "password" properties should be included in the Properties.

    - * - * From version 1.7.1, two optional properties are supported: - * - *

      - *
    • get_column_name (default true) - if set to false, - * a ResultSetMetaData.getColumnName() call will return the user - * defined label (getColumnLabel()) instead of the column - * name.
      - * - * This property is available in order to achieve - * compatibility with certain non-HSQLDB JDBC driver - * implementations.
    • - * - *
    • strict_md if set to true, some ResultSetMetaData - * methods return more strict values for compatibility - * reasons.
    • - *

    - * - * From version 1.8.0.x, strict_md is deprecated (ignored) - * because metadata reporting is always strict (JDBC-compliant), and - * three new optional properties are supported: - * - *

      - *
    • ifexits (default false) - when true, an exception - * is raised when attempting to connect to an in-process - * file: or mem: scheme database instance if it has not yet been - * created. When false, an in-process file: or mem: scheme - * database instance is created automatically if it has not yet - * been created. This property does not apply to requests for - * network or res: (i.e. files_in_jar) scheme connections.
    • - * - *
    • shutdown (default false) - when true, the - * the target database mimics the behaviour of 1.7.1 and older - * versions. When the last connection to a database is closed, - * the database is automatically shut down. The property takes - * effect only when the first connection is made to the database. - * This means the connection that opens the database. It has no - * effect if used with subsequent, simultaneous connections.
      - * - * This command has two uses. One is for test suites, where - * connections to the database are made from one JVM context, - * immediately followed by another context. The other use is for - * applications where it is not easy to configure the environment - * to shutdown the database. Examples reported by users include - * web application servers, where the closing of the last - * connection coincides with the web application being shut down. - *
    • - * - *
    • default_schema - backwards compatibility feature. - * To be used for clients written before HSQLDB schema support. - * Denotes whether to use the default schema when a schema - * qualifier is not included in a database object's SQL identifier - * character sequence. Also affects the semantics of - * DatabaseMetaData calls that supply null-valued schemaNamePattern - * parameter values.
    • - *
    - * - * - *
    - * @param url the URL of the database to which to connect - * @param info a list of arbitrary string tag/value pairs as connection - * arguments. Normally at least a "user" and "password" property - * should be included. - * @return a Connection object that represents a - * connection to the URL - * @exception SQLException if a database access error occurs - */ - public Connection connect(String url, - Properties info) throws SQLException { - - if (url.regionMatches(true, 0, DatabaseURL.S_URL_INTERNAL, 0, - DatabaseURL.S_URL_INTERNAL.length())) { - JDBCConnection conn = threadConnection.get(); - - return conn; - } - - return getConnection(url, info); - } - - /** - * The static equivalent of the connect(String,Properties) - * method.

    - * - * @param url the URL of the database to which to connect - * @param info a list of arbitrary string tag/value pairs as connection - * arguments including at least at a "user" and a "password" property - * @throws java.sql.SQLException if a database access error occurs - * @return a Connection object that represents a - * connection to the URL - */ - - @SuppressWarnings("deprecation") - public static Connection getConnection(String url, - Properties info) throws SQLException { - - final HsqlProperties props = DatabaseURL.parseURL(url, true, false); - - if (props == null) { - - // supposed to be an HSQLDB driver url but has errors - throw JDBCUtil.invalidArgument(); - } else if (props.isEmpty()) { - - // is not an HSQLDB driver url - return null; - } - - long timeout = 0; - - if (info != null) { - timeout = HsqlProperties.getIntegerProperty(info, conn_loginTimeout, 0); - } - - props.addProperties(info); - - if (timeout == 0) { - timeout = DriverManager.getLoginTimeout(); - } - - // @todo: maybe impose some sort of sane restriction - // on network connections regardless of user - // specification? - if (timeout == 0) { - - // no timeout restriction - return new JDBCConnection(props); - } - - String connType = props.getProperty("connection_type"); - - if (DatabaseURL.isInProcessDatabaseType(connType)) { - return new JDBCConnection(props); - } - - // @todo: Better: ThreadPool? HsqlTimer with callback? - final JDBCConnection[] conn = new JDBCConnection[1]; - final SQLException[] ex = new SQLException[1]; - Thread t = new Thread() { - - public void run() { - - try { - conn[0] = new JDBCConnection(props); - } catch (SQLException se) { - ex[0] = se; - } - } - }; - - t.start(); - - try { - t.join(1000 * timeout); - } catch (InterruptedException ie) { - } - - if (ex[0] != null) { - throw ex[0]; - } - - if (conn[0] != null) { - return conn[0]; - } - - throw JDBCUtil.sqlException(ErrorCode.X_08501); - } - - /** - * Returns true if the driver thinks that it can open a connection to - * the given URL. Typically drivers will return true if they understand - * the subprotocol specified in the URL and false if they don't. - * - * @param url the URL of the database - * @return true if this driver can connect to the given URL - */ - -// fredt@users - patch 1.7.0 - allow mixedcase url's - public boolean acceptsURL(String url) { - - if (url == null) { - return false; - } - - if (url.regionMatches(true, 0, DatabaseURL.S_URL_PREFIX, 0, - DatabaseURL.S_URL_PREFIX.length())) { - return true; - } - - if (url.regionMatches(true, 0, DatabaseURL.S_URL_INTERNAL, 0, - DatabaseURL.S_URL_INTERNAL.length())) { - return true; - } - - return false; - } - - /** - * Gets information about the possible properties for this driver.

    - * - * The getPropertyInfo method is intended to allow a generic GUI tool - * to discover what properties it should prompt a human for in order to - * get enough information to connect to a database. Note that depending - * on the values the human has supplied so far, additional values may - * become necessary, so it may be necessary to iterate though several - * calls to getPropertyInfo. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB uses the values submitted in info to set the value for - * each DriverPropertyInfo object returned. It does not use the default - * value that it would use for the property if the value is null.

    - * - *

    - * - * @param url the URL of the database to which to connect - * @param info a proposed list of tag/value pairs that will be sent on - * connect open - * @return an array of DriverPropertyInfo objects describing possible - * properties. This array may be an empty array if no properties - * are required. - */ - public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) { - - if (!acceptsURL(url)) { - return new DriverPropertyInfo[0]; - } - - String[] choices = new String[] { - "true", "false" - }; - DriverPropertyInfo[] pinfo = new DriverPropertyInfo[6]; - DriverPropertyInfo p; - - if (info == null) { - info = new Properties(); - } - p = new DriverPropertyInfo("user", null); - p.value = info.getProperty("user"); - p.required = true; - pinfo[0] = p; - p = new DriverPropertyInfo("password", null); - p.value = info.getProperty("password"); - p.required = true; - pinfo[1] = p; - p = new DriverPropertyInfo("get_column_name", null); - p.value = info.getProperty("get_column_name", "true"); - p.required = false; - p.choices = choices; - pinfo[2] = p; - p = new DriverPropertyInfo("ifexists", null); - p.value = info.getProperty("ifexists", "false"); - p.required = false; - p.choices = choices; - pinfo[3] = p; - p = new DriverPropertyInfo("default_schema", null); - p.value = info.getProperty("default_schema", "false"); - p.required = false; - p.choices = choices; - pinfo[4] = p; - p = new DriverPropertyInfo("shutdown", null); - p.value = info.getProperty("shutdown", "false"); - p.required = false; - p.choices = choices; - pinfo[5] = p; - - return pinfo; - } - - /** - * Gets the driver's major version number. - * - * @return this driver's major version number - */ - public int getMajorVersion() { - return HsqlDatabaseProperties.MAJOR; - } - - /** - * Gets the driver's minor version number. - * - * @return this driver's minor version number - */ - public int getMinorVersion() { - return HsqlDatabaseProperties.MINOR; - } - - /** - * Reports whether this driver is a genuine JDBC Compliant™ driver. - * A driver may only report - * true here if it passes the JDBC compliance tests; otherwise - * it is required to return false.

    - * - * JDBC compliance requires full support for the JDBC API and full support - * for SQL 92 Entry Level. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 is aimed to be compliant with JDBC 4.2 specification. - * It supports SQL 92 Entry Level and beyond. - *

    - * - * This method is not intended to encourage the development of non-JDBC - * compliant drivers, but is a recognition of the fact that some vendors - * are interested in using the JDBC API and framework for lightweight - * databases that do not support full database functionality, or for - * special databases such as document information retrieval where a SQL - * implementation may not be feasible. - * - * @return true if this driver is JDBC Compliant; - * false otherwise - */ - public boolean jdbcCompliant() { - return true; - } - - //------------------------- JDBC 4.1 ----------------------------------- - - /** - * Return the parent Logger of all the Loggers used by this driver. This - * should be the Logger farthest from the root Logger that is - * still an ancestor of all of the Loggers used by this driver. Configuring - * this Logger will affect all of the log messages generated by the driver. - * In the worst case, this may be the root Logger. - * - * @return the parent Logger for this driver - * @throws SQLFeatureNotSupportedException if the driver does not use java.util.logging. - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public java.util.logging - .Logger getParentLogger() throws java.sql - .SQLFeatureNotSupportedException { - throw (java.sql.SQLFeatureNotSupportedException) JDBCUtil.notSupported(); - } - - public static final JDBCDriver driverInstance = new JDBCDriver(); - - static { - try { - -//#ifdef JAVA8 - DriverManager.registerDriver(driverInstance, new EmptyDiverAction()); -//#else -/* - DriverManager.registerDriver(driverInstance); -*/ - -//#endif JAVA8 - - } catch (Exception e) { - } - } - - /** - * As a separate instance of this class is registered with DriverManager - * for each class loader, the threadConnection is not declared as static. - * The registered instance is kept to allow access to its threadConnection. - * - */ - - public final ThreadLocal threadConnection = - new ThreadLocal(); - - //------------------------- JDBC 4.2 ----------------------------------- - -//#ifdef JAVA8 - - private static class EmptyDiverAction implements java.sql.DriverAction { - public void deregister() {} - - } -//#endif JAVA8 - -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCNClob.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCNClob.java deleted file mode 100644 index af317896..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCNClob.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.NClob; - -/** - * The mapping in the Java™ programming language - * for the SQL NCLOB type. - * An SQL NCLOB is a built-in type - * that stores a Character Large Object using the National Character Set - * as a column value in a row of a database table. - *

    The NClob interface extends the Clob interface - * which provides methods for getting the - * length of an SQL NCLOB value, - * for materializing a NCLOB value on the client, and for - * searching for a substring or NCLOB object within a - * NCLOB value. A NClob object, just like a Clob object, is valid for the duration - * of the transaction in which it was created. - * Methods in the interfaces {@link java.sql.ResultSet}, - * {@link java.sql.CallableStatement}, and {@link java.sql.PreparedStatement}, such as - * getNClob and setNClob allow a programmer to - * access an SQL NCLOB value. In addition, this interface - * has methods for updating a NCLOB value. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * First, it should be noted that since HSQLDB represents all character data - * internally as Java UNICODE (UTF16) String objects, there is not currently any - * appreciable difference between the HSQLDB XXXCHAR types and the SQL 2003 - * NXXXCHAR and NCLOB types.

    - * - * See {@link org.hsqldb.jdbc.JDBCClob} for further information. - * - *

    - * - * - * @since JDK 1.6, HSQLDB 2.0 - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @see JDBCClob - * @see JDBCClobClient - */ -public class JDBCNClob extends JDBCClob implements NClob { - - protected JDBCNClob() { - super(); - } - - public JDBCNClob(String data) throws java.sql.SQLException { - super(data); - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCParameterMetaData.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCParameterMetaData.java deleted file mode 100644 index ed333ba5..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCParameterMetaData.java +++ /dev/null @@ -1,439 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.sql.ParameterMetaData; -import java.sql.SQLException; - -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.types.IntervalType; -import org.hsqldb.types.Type; - -/* $Id: JDBCParameterMetaData.java 6509 2022-05-17 13:18:08Z fredt $ */ - -/* @todo 1.9.0 - implement internal support for INOUT, OUT return parameter */ - -// fredt@users 20040412 - removed DITypeInfo dependencies -// fredt@users 1.9.0 - utilise the new type support -// campbell-burnet@users 20051207 - patch 1.8.0.x initial JDBC 4.0 support work -// campbell-burnet@users 20060522 - doc 1.9.0 full synch up to Mustang Build 84 -// Revision 1.14 2006/07/12 12:20:49 boucherb -// - remove unused imports -// - full synch up to Mustang b90 - -/** - * An object that can be used to get information about the types - * and properties for each parameter marker in a - * {@code PreparedStatement} object. (JDBC4 Clarification:) For some queries and driver - * implementations, the data that would be returned by a {@code ParameterMetaData} - * object may not be available until the {@code PreparedStatement} has - * been executed. - *

    - * Some driver implementations may not be able to provide information about the - * types and properties for each parameter marker in a {@code CallableStatement} - * object. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.0 - * @since JDK 1.4, HSQLDB 1.7.2 - */ -public class JDBCParameterMetaData implements ParameterMetaData, - java.sql.Wrapper { - - /** - * Retrieves the number of parameters in the PreparedStatement - * object for which this ParameterMetaData object contains - * information. - * - * @return the number of parameters - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int getParameterCount() throws SQLException { - return parameterCount; - } - - /** - * Retrieves whether null values are allowed in the designated parameter. - * - * @param param the first parameter is 1, the second is 2, ... - * @return the nullability status of the given parameter; one of - * ParameterMetaData.parameterNoNulls, - * ParameterMetaData.parameterNullable, or - * ParameterMetaData.parameterNullableUnknown - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int isNullable(int param) throws SQLException { - - checkRange(param); - - return ParameterMetaData.parameterNullableUnknown; - } - - /** - * Retrieves whether values for the designated parameter can be signed numbers. - * - * @param param the first parameter is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public boolean isSigned(int param) throws SQLException { - - checkRange(param); - - Type type = translateType(rmd.columnTypes[--param]); - - return type.isNumberType(); - } - - /** - * Retrieves the designated parameter's specified column size. - * - *

    The returned value represents the maximum column size for the given parameter. - * For numeric data, this is the maximum precision. For character data, this is the length in characters. - * For datetime datatypes, this is the length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, - * this is the length in bytes. 0 is returned for data types where the - * column size is not applicable. - * - * @param param the first parameter is 1, the second is 2, ... - * @return precision - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int getPrecision(int param) throws SQLException { - - checkRange(param); - - Type type = translateType(rmd.columnTypes[--param]); - - if (type.isDateTimeType()) { - return type.displaySize(); - } else { - long size = type.precision; - - if (size > Integer.MAX_VALUE) { - size = 0; - } - - return (int) size; - } - } - - /** - * Retrieves the designated parameter's number of digits to right of the decimal point. - * 0 is returned for data types where the scale is not applicable. - * - * @param param the first parameter is 1, the second is 2, ... - * @return scale - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int getScale(int param) throws SQLException { - - checkRange(param); - - Type type = translateType(rmd.columnTypes[--param]); - - return type.scale; - } - - /** - * Retrieves the designated parameter's SQL type. - * - * @param param the first parameter is 1, the second is 2, ... - * @return SQL type from java.sql.Types - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - * @see java.sql.Types - */ - public int getParameterType(int param) throws SQLException { - - checkRange(param); - - Type type = translateType(rmd.columnTypes[--param]); - - return type.getJDBCTypeCode(); - } - - /** - * Retrieves the designated parameter's database-specific type name. - * - * @param param the first parameter is 1, the second is 2, ... - * @return type the name used by the database. If the parameter type is - * a user-defined type, then a fully-qualified type name is returned. - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public String getParameterTypeName(int param) throws SQLException { - - checkRange(param); - - Type type = translateType(rmd.columnTypes[--param]); - - return type.getNameString(); - } - - /** - * Retrieves the fully-qualified name of the Java class whose instances - * should be passed to the method PreparedStatement.setObject. - * - * @param param the first parameter is 1, the second is 2, ... - * @return the fully-qualified name of the class in the Java programming - * language that would be used by the method - * PreparedStatement.setObject to set the value - * in the specified parameter. This is the class name used - * for custom mapping. - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public String getParameterClassName(int param) throws SQLException { - - checkRange(param); - - Type type = translateType(rmd.columnTypes[--param]); - - return type.getJDBCClassName(); - } - - /** - * Retrieves the designated parameter's mode. - * - * @param param the first parameter is 1, the second is 2, ... - * @return mode of the parameter; one of - * ParameterMetaData.parameterModeIn, - * ParameterMetaData.parameterModeOut, or - * ParameterMetaData.parameterModeInOut - * ParameterMetaData.parameterModeUnknown. - * @exception SQLException if a database access error occurs - * @since JDK 1.4, HSQLDB 1.7.2 - */ - public int getParameterMode(int param) throws SQLException { - - checkRange(param); - - return rmd.paramModes[--param]; - } - - //----------------------------- JDBC 4.0 ----------------------------------- - // ------------------- java.sql.Wrapper implementation --------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return - * the result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 2.0 - */ - @SuppressWarnings("unchecked") - public T unwrap(Class iface) throws java.sql.SQLException { - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isWrapperFor( - Class iface) throws java.sql.SQLException { - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - - // -------------------------- Internal Implementation ---------------------- - - /** The metadata object with which this object is constructed */ - ResultMetaData rmd; - - /** The number of parameters in the described statement */ - int parameterCount; - private boolean translateTTIType; - - /** - * Creates a new instance of JDBCParameterMetaData.

    - * - * @param metaData A ResultMetaData object describing the statement parameters - */ - JDBCParameterMetaData(JDBCConnection conn, - ResultMetaData metaData) { - - rmd = metaData; - parameterCount = rmd.getColumnCount(); - translateTTIType = conn.isTranslateTTIType; - } - - /** - * Translates an INTERVAL type to VARCHAR. - * Removes time zone from datetime types. - * - */ - private Type translateType(Type type) { - - if (this.translateTTIType) { - if (type.isIntervalType()) { - type = ((IntervalType) type).getCharacterType(); - } - } - - return type; - } - - /** - * Checks if the value of the param argument is a valid parameter - * position.

    - * - * @param param position to check - * @throws SQLException if the value of the param argument is not a - * valid parameter position - */ - void checkRange(int param) throws SQLException { - - if (param < 1 || param > parameterCount) { - String msg = param + " is out of range"; - - throw JDBCUtil.outOfRangeArgument(msg); - } - } - - /** - * Retrieves a String representation of this object.

    - * - * @return a String representation of this object - */ - public String toString() { - - try { - return toStringImpl(); - } catch (Throwable t) { - return super.toString() + "[toStringImpl_exception=" + t + "]"; - } - } - - /** - * Provides the implementation of the toString() method.

    - * - * @return a String representation of this object - * @throws Exception if a reflection error occurs - */ - private String toStringImpl() throws Exception { - - StringBuilder sb; - Method[] methods; - Method method; - int count; - - sb = new StringBuilder(); - - sb.append(super.toString()); - - count = getParameterCount(); - - if (count == 0) { - sb.append("[parameterCount=0]"); - - return sb.toString(); - } - methods = getClass().getDeclaredMethods(); - - sb.append('['); - - int len = methods.length; - - for (int i = 0; i < count; i++) { - sb.append('\n'); - sb.append(" parameter_"); - sb.append(i + 1); - sb.append('='); - sb.append('['); - - for (int j = 0; j < len; j++) { - method = methods[j]; - - if (!Modifier.isPublic(method.getModifiers())) { - continue; - } - - if (method.getParameterTypes().length != 1) { - continue; - } - sb.append(method.getName()); - sb.append('='); - sb.append(method.invoke(this, - new Object[] { Integer.valueOf(i + 1) })); - - if (j + 1 < len) { - sb.append(','); - sb.append(' '); - } - } - sb.append(']'); - - if (i + 1 < count) { - sb.append(','); - sb.append(' '); - } - } - sb.append('\n'); - sb.append(']'); - - return sb.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCPool.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCPool.java deleted file mode 100644 index 1f6b1da4..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCPool.java +++ /dev/null @@ -1,568 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.sql.Wrapper; -import java.util.Arrays; -import java.util.Properties; -import java.util.concurrent.atomic.AtomicIntegerArray; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; -import javax.sql.ConnectionEvent; -import javax.sql.ConnectionEventListener; -import javax.sql.DataSource; -import javax.sql.PooledConnection; -import javax.sql.StatementEvent; -import javax.sql.StatementEventListener; - -import org.hsqldb.jdbc.pool.JDBCPooledConnection; -import org.hsqldb.jdbc.pool.JDBCPooledDataSource; - -/** - * - * A fast connection pool. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * A connection pool for HyperSQL connections. This implementation of - * {@link javax.sql.DataSource DataSource} is dedicated to HyperSQL and - * guarantees all connection states are automatically reset when a connection - * is reused.

    - * - * The methods of the parent class, - * {@link JDBCCommonDataSource} are used to specify the database URL, user, - * password, and / or connection properties.

    - * - *

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 2.2.9 - */ -@SuppressWarnings("serial") -public class JDBCPool implements DataSource, - Referenceable, ConnectionEventListener, - StatementEventListener, Wrapper { - - /** - * Retrieves a new connection using the properties that have already been - * set. - * - * @return a connection to the data source - * @exception SQLException if a database access error occurs - */ - public Connection getConnection() throws SQLException { - - int retries = 300; - - if (source.loginTimeout != 0){ - retries = source.loginTimeout * 10; - } - - if (closed) { - throw new SQLException("connection pool is closed"); - } - - for (int count = 0; count < retries; count++) { - for (int i = 0; i < states.length(); i++) { - if (states.compareAndSet(i, RefState.available, - RefState.allocated)) { - return connections[i].getConnection(); - } - - if (states.compareAndSet(i, RefState.empty, - RefState.allocated)) { - try { - JDBCPooledConnection connection = - (JDBCPooledConnection) source.getPooledConnection(); - - connection.addConnectionEventListener(this); - connection.addStatementEventListener(this); - connections[i] = connection; - - return connections[i].getConnection(); - } catch (SQLException e) { - states.set(i, RefState.empty); - } - } - } - - try { - Thread.sleep(100); - } catch (InterruptedException e) {} - } - - throw JDBCUtil.invalidArgument(); - } - - /** - * Retrieves a new connection using the given username and password, - * and the database url that has been set. No other properties are - * used for the connection. - * - * This method can be used only with the same username and password used - * for the connection pool. The first call to this method sets the user name - * and password for the connection pool. - * - * @param username the database user on whose behalf the connection is - * being made - * @param password the user's password - * @return a connection to the data source - * @exception SQLException if a database access error occurs - */ - public Connection getConnection(String username, String password) - throws SQLException { - - String user = getUser(); - - if (username == null || password == null) { - throw JDBCUtil.nullArgument(); - } - - if ( user == null) { - setUser(username); - setPassword(password); - } else if (!user.equals(username)) { - throw JDBCUtil.invalidArgument("user name does not match"); - } - - return getConnection(); - } - - // ------------------------- JDBC 4.0 ----------------------------------- - // ------------------- java.sql.Wrapper implementation --------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return the - * result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 2.0 - */ - @SuppressWarnings("unchecked") - public T unwrap(java.lang.Class iface) throws java.sql.SQLException { - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isWrapperFor(java.lang.Class iface) - throws java.sql.SQLException { - return ((iface != null) && iface.isAssignableFrom(this.getClass())); - } - - /** - * Retrieves the Reference of this object. - * - * @return The non-null Reference of this object. - * @exception NamingException If a naming exception was encountered - * while retrieving the reference. - */ - public Reference getReference() throws NamingException { - String cname = "org.hsqldb.jdbc.JDBCDataSourceFactory"; - Reference ref = new Reference(getClass().getName(), cname, null); - - ref.add(new StringRefAddr("database", source.getDatabase())); - ref.add(new StringRefAddr("user", source.getUser())); - ref.add(new StringRefAddr("password", source.password)); - ref.add(new StringRefAddr("loginTimeout", - Integer.toString(source.loginTimeout))); - ref.add(new StringRefAddr("poolSize", Integer.toString(connections.length))); - - return ref; - } - - // ------------------------ event listener ------------------------ - public void connectionClosed(ConnectionEvent event) { - PooledConnection connection = (PooledConnection) event.getSource(); - - for (int i = 0; i < connections.length; i++) { - if (connections[i] == connection) { - states.set(i, RefState.available); - - break; - } - } - } - - public void connectionErrorOccurred(ConnectionEvent event) { - PooledConnection connection = (PooledConnection) event.getSource(); - - for (int i = 0; i < connections.length; i++) { - if (connections[i] == connection) { - states.set(i, RefState.allocated); - connections[i] = null; - states.set(i, RefState.empty); - break; - } - } - } - - public void statementClosed(StatementEvent event) {} - - public void statementErrorOccurred(StatementEvent event) {} - - - // ------------------------ event listener ------------------------ - /** - *

    Retrieves the log writer for this DataSource - * object. - * - *

    The log writer is a character output stream to which all logging - * and tracing messages for this data source will be - * printed. This includes messages printed by the methods of this - * object, messages printed by methods of other objects manufactured - * by this object, and so on. Messages printed to a data source - * specific log writer are not printed to the log writer associated - * with the java.sql.DriverManager class. When a - * DataSource object is - * created, the log writer is initially null; in other words, the - * default is for logging to be disabled. - * - * @return the log writer for this data source or null if - * logging is disabled - * @exception java.sql.SQLException if a database access error occurs - * @see #setLogWriter - * @since 1.4 - */ - public PrintWriter getLogWriter() throws SQLException { - return source.getLogWriter(); - } - - /** - *

    Sets the log writer for this DataSource - * object to the given java.io.PrintWriter object. - * - *

    The log writer is a character output stream to which all logging - * and tracing messages for this data source will be - * printed. This includes messages printed by the methods of this - * object, messages printed by methods of other objects manufactured - * by this object, and so on. Messages printed to a data source- - * specific log writer are not printed to the log writer associated - * with the java.sql.DriverManager class. When a - * DataSource object is created the log writer is - * initially null; in other words, the default is for logging to be - * disabled. - * - * @param out the new log writer; to disable logging, set to null - * @exception SQLException if a database access error occurs - * @see #getLogWriter - * @since 1.4 - */ - public void setLogWriter(java.io.PrintWriter out) throws SQLException { - source.setLogWriter(out); - } - - /** - *

    Sets the maximum time in seconds that this data source will wait - * while attempting to connect to a database. A value of zero - * specifies that the timeout is the default system timeout - * if there is one; otherwise, it specifies that there is no timeout. - * When a DataSource object is created, the login timeout is - * initially zero. - * - * @param seconds the data source login time limit - * @exception SQLException if a database access error occurs. - * @see #getLoginTimeout - * @since 1.4 - */ - public void setLoginTimeout(int seconds) throws SQLException { - source.setLoginTimeout(seconds); - } - - /** - * Gets the maximum time in seconds that this data source can wait - * while attempting to connect to a database. A value of zero - * means that the timeout is the default system timeout - * if there is one; otherwise, it means that there is no timeout. - * When a DataSource object is created, the login timeout is - * initially zero. - * - * @return the data source login time limit - * @exception SQLException if a database access error occurs. - * @see #setLoginTimeout - * @since 1.4 - */ - public int getLoginTimeout() throws SQLException { - return source.getLoginTimeout(); - } - - // ------------------------ custom public methods ------------------------ - - /** - * Retrieves the description of the data source.

    - * - * @return the description - */ - public String getDescription() { - return "org.hsqldb.jdbc.JDBCPool max size " + connections.length; - } - - /** - * Retrieves the name of the data source.

    - * - * @return the description - */ - public String getDataSourceName() { - return "org.hsqldb.jdbc.JDBCPool"; - } - - /** - * Synonym for getUrl(). - * - * @return the jdbc database connection url attribute - */ - public String getDatabaseName() { - return source.getUrl(); - } - - /** - * Synonym for getUrl(). - * - * @return the jdbc database connection url attribute - */ - public String getDatabase() { - return source.getDatabase(); - } - - /** - * Retrieves the jdbc database connection url attribute.

    - * - * @return the jdbc database connection url attribute - */ - public String getUrl() { - return source.getUrl(); - } - - /** - * Retrieves the jdbc database connection url attribute.

    - * - * @return the jdbc database connection url attribute - */ - public String getURL() { - return source.getUrl(); - } - - /** - * Retrieves the user name for the connection.

    - * - * @return the username for the connection - */ - public String getUser() { - return source.getUser(); - } - - /** - * Synonym for setUrl(String).

    - * - * @param databaseName the new value for the attribute - */ - public void setDatabaseName(String databaseName) { - source.setDatabaseName(databaseName); - } - - /** - * Synonym for setUrl(String).

    - * - * @param database the new value for the attribute - */ - public void setDatabase(String database) { - source.setDatabase(database); - } - - /** - * Sets the jdbc database URL.

    - * - * @param url the new value of this object's jdbc database connection - * url attribute - */ - public void setUrl(String url) { - source.setUrl(url); - } - - /** - * Sets the jdbc database URL.

    - * - * @param url the new value of this object's jdbc database connection - * url attribute - */ - public void setURL(String url) { - source.setUrl(url); - } - - /** - * Sets the password for the user name. - * - * @param password the password - */ - public void setPassword(String password) { - source.setPassword(password); - } - - /** - * Sets the user name. - * - * @param user the user id - */ - public void setUser(String user) { - source.setUser(user); - } - - /** - * Sets connection properties. If user / password / loginTimeout has been - * set with one of the setXXX() methods it will be added to the Properties - * object. - * - * @param props properties. If null, then existing properties will be - * cleared/replaced. - */ - public void setProperties(Properties props) { - source.setProperties(props); - } - - //------------------------- JDBC 4.1 ----------------------------------- - - /** - * Return the parent Logger of all the Loggers used by this data source. This - * should be the Logger farthest from the root Logger that is - * still an ancestor of all of the Loggers used by this data source. Configuring - * this Logger will affect all of the log messages generated by the data source. - * In the worst case, this may be the root Logger. - * - * @return the parent Logger for this data source - * @throws SQLFeatureNotSupportedException if the data source does not use java.util.logging. - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.2.9 - */ - public java.util.logging.Logger getParentLogger() - throws java.sql.SQLFeatureNotSupportedException { - throw (java.sql.SQLFeatureNotSupportedException) JDBCUtil.notSupported(); - } - - // ------------------------ custom public methods ------------------------ - - /** - * Creates a connection pool with the maximum size of 8. The database and - * connection settings are made before the {@link #getConnection()} is called. - */ - public JDBCPool() { - this(10); - } - - /** - * Creates a connection pool with the given maximum size. The database and - * connection settings are made before the {@link #getConnection()} is called. - * - * @param size int maximum size of the pool - */ - public JDBCPool(int size) { - source = new JDBCPooledDataSource(); - connections = new JDBCPooledConnection[size]; - states = new AtomicIntegerArray(size); } - - /** - * Closes the pool immediately. Waits the given number of seconds before - * closing all existing connections in the pool. - * - * @param wait int number of seconds to wait before closing the connections, maximum 60 seconds - * @throws SQLException on any error - */ - public void close(int wait) throws SQLException { - - if (wait <0 || wait > 60) { - throw JDBCUtil.outOfRangeArgument(); - } - if (closed) { - return; - } - - closed = true; - - try { - Thread.sleep(1000 * wait); - } catch (Throwable t) {} - - for (int i = 0; i < connections.length; i++) { - if (connections[i] != null) { - connections[i].release(); - } - } - - Arrays.fill(connections, null); - } - // ------------------------ internal ------------------------ - interface RefState { - int empty = 0; - int available = 1; - int allocated = 2; - } - - - AtomicIntegerArray states; - JDBCPooledConnection[] connections; - JDBCPooledDataSource source; - volatile boolean closed; -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCPreparedStatement.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCPreparedStatement.java deleted file mode 100644 index de0b319a..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCPreparedStatement.java +++ /dev/null @@ -1,4966 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.Serializable; -import java.io.StringWriter; -import java.math.BigDecimal; -import java.sql.Array; -import java.sql.BatchUpdateException; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.Date; -import java.sql.NClob; -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLTimeoutException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.BitSet; -import java.util.Calendar; -import java.util.UUID; - -import org.hsqldb.HsqlException; -import org.hsqldb.SchemaObject; -import org.hsqldb.SessionInterface; -import org.hsqldb.StatementTypes; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.CharArrayWriter; -import org.hsqldb.lib.CountdownInputStream; -import org.hsqldb.lib.HsqlByteArrayOutputStream; -import org.hsqldb.lib.StringConverter; -import org.hsqldb.navigator.RowSetNavigator; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultConstants; -import org.hsqldb.result.ResultLob; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.result.ResultProperties; -import org.hsqldb.types.BinaryData; -import org.hsqldb.types.BinaryUUIDType; -import org.hsqldb.types.BlobDataID; -import org.hsqldb.types.BlobInputStream; -import org.hsqldb.types.ClobDataID; -import org.hsqldb.types.ClobInputStream; -import org.hsqldb.types.DateTimeType; -import org.hsqldb.types.JavaObjectData; -import org.hsqldb.types.JavaObjectDataInternal; -import org.hsqldb.types.Type; -import org.hsqldb.types.Types; - -//#ifdef JAVA8 -import java.sql.JDBCType; -import java.sql.SQLType; - -//#endif JAVA8 - -/* $Id: JDBCPreparedStatement.java 6656 2023-05-29 15:55:53Z fredt $ */ - -// changes by fredt -// SimpleDateFormat objects moved out of methods to improve performance -// this is safe because only one thread at a time should access a -// PreparedStatement object until it has finished executing the statement -// -// fredt@users 20020215 - patch 517028 by peterhudson@users - method defined -// minor changes by fredt -// fredt@users 20020320 - patch 1.7.0 - JDBC 2 support and error trapping; -// JDBC 2 methods can now be called from jdk 1.1.x -// - see javadoc comments -// fredt@users 20020414 - patch 517028 by peterhudson@users - setDate method defined -// - setTime method defined -// - setTimestamp method defined -// changes by fredt - moved conversion to HsqlDateTime -// fredt@users 20020429 - patch 1.7.0 - setCharacterStream method defined -// -// boucherb & 20020409 - extensive review and update of docs and behaviour -// fredt@users - 20020505 to comply with previous and latest java.sql specification -// -// campbell-burnet@users 20020509 - added "throws SQLException" to all methods where it -// was missing here but specified in the java.sql.PreparedStatement and -// java.sqlCallableStatement interfaces, updated generic documentation to -// JDK 1.4, and added JDBC3 methods and docs -// fredt@users 20020627 - patch 574234 for setCharacterStream by ohioedge@users -// fredt@users 20030620 - patch 1.7.2 - rewritten to support real prepared statements -// campbell-burnet@users 20030801 - patch 1.7.2 - support for batch execution -// campbell-burnet@users 20030801 - patch 1.7.2 - support for getMetaData and getParameterMetadata -// campbell-burnet@users 20030801 - patch 1.7.2 - updated some setXXX methods, incl. setCharacterStream -// campbell-burnet@users 20030801 - patch 1.7.2 - setBlob method implemented -// campbell-burnet@users 200403/4 - doc 1.7.2 - javadoc updates toward 1.7.2 final -// campbell-burnet@users 200403/4 - patch 1.7.2 - eliminate eager buffer allocation from setXXXStream/Blob/Clob -// campbell-burnet@users 20051207 - patch 1.8.0.x initial JDBC 4.0 support work -// fredt@users 20060215 - patch 1.8.0 - check for unset parameters -// fredt@users 20061008 - patch 1.9.0 - partial rewrite with enhancements - separated from jdbcStatement -// campbell-burnet@users 20060424 - patch 1.8.x - Mustang Build 81 JDBC 4.0 support -// campbell-burnet@users 20060424 - doc 1.9.0 - Full synch up to Mustang Build 84 -// Revision 1.19 2006/07/12 12:24:17 boucherb -// patch 1.9.0 -// - full synch up to Mustang b90 - -/** - * - * - * An object that represents a precompiled SQL statement. - *

    A SQL statement is precompiled and stored in a - * PreparedStatement object. This object can then be used to - * efficiently execute this statement multiple times. - * - *

    Note: The setter methods (setShort, setString, - * and so on) for setting IN parameter values - * must specify types that are compatible with the defined SQL type of - * the input parameter. For instance, if the IN parameter has SQL type - * INTEGER, then the method setInt should be used. - * - *

    If arbitrary parameter type conversions are required, the method - * setObject should be used with a target SQL type. - *

    - * In the following example of setting a parameter, con represents - * an active connection: - *

    - *   PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
    - *                                     SET SALARY = ? WHERE ID = ?");
    - *   pstmt.setBigDecimal(1, 153833.00)
    - *   pstmt.setInt(2, 110592)
    - * 
    - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From version 2.0, the implementation meets the JDBC specification - * requirement that any existing ResultSet is closed when execute() or - * executeQuery() methods are called. The connection property close_result=true - * is required for this behaviour. - *

    - * JDBCPreparedStatement objects are backed by - * a true compiled parametric representation. Hence, there are now significant - * performance gains to be had by using a JDBCPreparedStatement object in - * preference to a JDBCStatement object when a short-running SQL statement is - * to be executed more than once.

    - * - * When it can be otherwise avoided, it should be considered poor practice to - * fully prepare (construct), parameterize, execute, fetch and close a - * JDBCParameterMetaData object for each execution cycle. Indeed, - * because the prepare and execute phases - * both represent a round-trip to the engine, this practice is likely to be - * noticeably less performant for short-running statements (and - * possibly even orders of magnitude less performant over network connections - * for short-running statements) than the equivalent process using JDBCStatement - * objects, albeit far more convenient, less error prone and certainly much - * less resource-intensive, especially when large binary and character values - * are involved, due to the optimized parameterization facility.

    - * - * Instead, when developing an application that is not totally oriented toward - * the execution of ad hoc SQL, it is recommended to expend some effort toward - * identifying the SQL statements that are good candidates for regular reuse and - * adapting the structure of the application accordingly. Often, this is done - * by recording the text of candidate SQL statements in an application resource - * object (which has the nice side-benefit of isolating and hiding differences - * in SQL dialects across different drivers) and caching for possible reuse the - * PreparedStatement objects derived from the recorded text.

    - * - * Starting with 2.0, when built under a JDBC 4 environment, statement caching - * can be transparently enabled or disabled on a statement-by-statement basis by - * invoking setPoolable(true | false), respectively, upon Statement objects of - * interest.

    - * - * Multi thread use:

    - * - * A PreparedStatement object is stateful and should not normally be shared - * by multiple threads. If it has to be shared, the calls to set the - * parameters, calls to add batch statements, the execute call and any - * post-execute calls should be made within a block synchronized on the - * PreparedStatement Object.

    - * - * (fredt@users)
    - * (campbell-burnet@users)

    - * - *

    - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since 1.9.0 - * @see JDBCConnection#prepareStatement - * @see JDBCResultSet - */ -public class JDBCPreparedStatement extends JDBCStatementBase -implements PreparedStatement { - - /** - * - * Executes the SQL query in this PreparedStatement object - * and returns the ResultSet object generated by the query. - * - * - * @return a ResultSet object that contains the data produced by the - * query; never null - * @exception SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement or the SQL - * statement does not return a ResultSet object - */ - public synchronized ResultSet executeQuery() throws SQLException { - - if (statementRetType != StatementTypes.RETURN_RESULT) { - checkStatementType(StatementTypes.RETURN_RESULT); - } - - fetchResult(); - - return getResultSet(); - } - - /** - * - * Executes the SQL statement in this PreparedStatement object, - * (JDBC4 clarification:) - * which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * - * - * @return (JDBC4 clarification:) either (1) the row count for SQL Data Manipulation Language (DML) statements - * or (2) 0 for SQL statements that return nothing - * @exception SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement - * or the SQL - * statement returns a ResultSet object - */ - public synchronized int executeUpdate() throws SQLException { - - if (statementRetType != StatementTypes.RETURN_COUNT) { - checkStatementType(StatementTypes.RETURN_COUNT); - } - - fetchResult(); - - return resultIn.getUpdateCount(); - } - - /** - * - * Sets the designated parameter to SQL NULL. - * - *

    Note: You must specify the parameter's SQL type. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB currently ignores the sqlType argument. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param sqlType the SQL type code defined in java.sql.Types - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - */ - public synchronized void setNull(int parameterIndex, - int sqlType) throws SQLException { - setParameter(parameterIndex, null); - } - - /** - * - * Sets the designated parameter to the given Java boolean value. - * The driver converts this - * (JDBC4 Modified:) - * to an SQL BIT or BOOLEAN value when it sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports BOOLEAN type for boolean values. This method can also - * be used to set the value of a parameter of the SQL type BIT(1), which is - * a bit string consisting of a 0 or 1. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setBoolean(int parameterIndex, - boolean x) throws SQLException { - - Boolean b = x ? Boolean.TRUE - : Boolean.FALSE; - - setParameter(parameterIndex, b); - } - - /** - * - * Sets the designated parameter to the given Java byte value. - * The driver converts this - * to an SQL TINYINT value when it sends it to the database. - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setByte(int parameterIndex, - byte x) throws SQLException { - setIntParameter(parameterIndex, x); - } - - /** - * - * Sets the designated parameter to the given Java short value. - * The driver converts this - * to an SQL SMALLINT value when it sends it to the database. - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setShort(int parameterIndex, - short x) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - setIntParameter(parameterIndex, x); - } - - /** - * - * Sets the designated parameter to the given Java int value. - * The driver converts this - * to an SQL INTEGER value when it sends it to the database. - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setInt(int parameterIndex, - int x) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - setIntParameter(parameterIndex, x); - } - - /** - * - * Sets the designated parameter to the given Java long value. - * The driver converts this - * to an SQL BIGINT value when it sends it to the database. - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setLong(int parameterIndex, - long x) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - setLongParameter(parameterIndex, x); - } - - /** - * - * Sets the designated parameter to the given Java float value. - * The driver converts this - * (JDBC4 correction:) - * to an SQL REAL value when it sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.1, HSQLDB handles Java positive/negative Infinity - * and NaN float values consistent with the Java Language - * Specification; these special values are now correctly stored - * to and retrieved from the database. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setFloat(int parameterIndex, - float x) throws SQLException { - setDouble(parameterIndex, (double) x); - } - - /** - * - * Sets the designated parameter to the given Java double value. - * The driver converts this - * to an SQL DOUBLE value when it sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.1, HSQLDB handles Java positive/negative Infinity - * and NaN double values consistent with the Java Language - * Specification; these special values are now correctly stored - * to and retrieved from the database. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setDouble(int parameterIndex, - double x) throws SQLException { - - Double d = Double.valueOf(x); - - setParameter(parameterIndex, d); - } - - /** - * - * Sets the designated parameter to the given java.math.BigDecimal value. - * The driver converts this to an SQL NUMERIC value when - * it sends it to the database. - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setBigDecimal(int parameterIndex, - BigDecimal x) throws SQLException { - setParameter(parameterIndex, x); - } - - /** - * - * Sets the designated parameter to the given Java String value. - * The driver converts this - * to an SQL VARCHAR or LONGVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on VARCHAR values) - * when it sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, HSQLDB represents all XXXCHAR values internally as - * java.lang.String objects; there is no appreciable difference between - * CHAR, VARCHAR and LONGVARCHAR. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setString(int parameterIndex, - String x) throws SQLException { - setParameter(parameterIndex, x); - } - - /** - * - * Sets the designated parameter to the given Java array of bytes. The driver converts - * this to an SQL VARBINARY or LONGVARBINARY - * (depending on the argument's size relative to the driver's limits on - * VARBINARY values) when it sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, HSQLDB represents all XXXBINARY values the same way - * internally; there is no appreciable difference between BINARY, - * VARBINARY and LONGVARBINARY as far as JDBC is concerned. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setBytes(int parameterIndex, - byte[] x) throws SQLException { - setParameter(parameterIndex, x); - } - - /** - * - * (JDBC4 clarification:) - * Sets the designated parameter to the given java.sql.Date value - * using the default time zone of the virtual machine that is running - * the application. - * The driver converts this - * to an SQL DATE value when it sends it to the database. - * - *
    - *

    HSQLDB-Specific Information:

    - * - * When a setXXX method is used to set a parameter of type - * TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone of the - * client application is used as time zone - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setDate(int parameterIndex, - Date x) throws SQLException { - setDate(parameterIndex, x, null); - } - - /** - * - * Sets the designated parameter to the given java.sql.Time value. - * The driver converts this - * to an SQL TIME value when it sends it to the database. - * - *
    - *

    HSQLDB-Specific Information:

    - * - * When a setXXX method is used to set a parameter of type - * TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone of the - * client application is used as time zone - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setTime(int parameterIndex, - Time x) throws SQLException { - setTime(parameterIndex, x, null); - } - - /** - * - * Sets the designated parameter to the given java.sql.Timestamp value. - * The driver - * converts this to an SQL TIMESTAMP value when it sends it to the - * database. - * - *
    - *

    HSQLDB-Specific Information:

    - * - * When a setXXX method is used to set a parameter of type - * TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone of the - * client application is used as time zone.

    - * - * When this method is used to set a parameter of type TIME or - * TIME WITH TIME ZONE, then the nanosecond value of the Timestamp object - * will be used if the TIME parameter accepts fractional seconds. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setTimestamp(int parameterIndex, - Timestamp x) throws SQLException { - setTimestamp(parameterIndex, x, null); - } - - /* @todo 1.9.0 - implement streaming */ - - /** - * - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * From HSQLDB 2.0 this method uses the US-ASCII character encoding to convert bytes - * from the stream into the characters of a String.

    - * This method does not use streaming to send the data, - * whether the target is a CLOB or other binary object.

    - * - * For long streams (larger than a few megabytes) with CLOB targets, - * it is more efficient to use a version of setCharacterStream which takes - * the a length parameter. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setAsciiStream(int parameterIndex, - java.io.InputStream x, int length) throws SQLException { - setAsciiStream(parameterIndex, x, (long) length); - } - - /** - * - * Sets the designated parameter to the given input stream, which - * will have the specified number of bytes. - * (JDBC4 deleted:) - * [A Unicode character has two bytes, with the first byte being the high - * byte, and the second being the low byte.]

    - * - * When a very large Unicode value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from Unicode to the database char format. - * - * (JDBC4 added:) - * The byte format of the Unicode stream must be a Java UTF-8, as defined in the - * Java Virtual Machine Specification. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, this method behaves according to the JDBC4 - * specification (the stream is treated as though it has UTF-8 encoding. - * This method is deprecated: please use setCharacterStream(...) instead. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x a java.io.InputStream object that contains the - * Unicode parameter value - * (JDBC4 deleted:) - * [as two-byte Unicode characters] - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @deprecated - * Sun does not include a reason, but presumably - * this is because setCharacterStream is now preferred - */ - -//#ifdef DEPRECATEDJDBC - @Deprecated - public synchronized void setUnicodeStream(int parameterIndex, - java.io.InputStream x, int length) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - final int ver = JDBCDatabaseMetaData.JDBC_MAJOR; - - if (x == null) { - throw JDBCUtil.nullArgument("x"); - } - - String encoding = "UTF8"; - StringWriter writer = new StringWriter(); - - try { - CountdownInputStream cis = new CountdownInputStream(x); - InputStreamReader reader = new InputStreamReader(cis, encoding); - char[] buff = new char[1024]; - int charsRead; - - cis.setCount(length); - - while (-1 != (charsRead = reader.read(buff))) { - writer.write(buff, 0, charsRead); - } - } catch (IOException ex) { - throw JDBCUtil.sqlException(ErrorCode.SERVER_TRANSFER_CORRUPTED, - ex.toString(), ex); - } - - setParameter(parameterIndex, writer.toString()); - } - -//#endif DEPRECATEDJDBC - - /** - * - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.2, this method works according to the standard. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void setBinaryStream(int parameterIndex, - java.io.InputStream x, int length) throws SQLException { - setBinaryStream(parameterIndex, x, (long) length); - } - - /** - * - * Clears the current parameter values immediately. - *

    In general, parameter values remain in force for repeated use of a - * statement. Setting a parameter value automatically clears its - * previous value. However, in some cases it is useful to immediately - * release the resources used by the current parameter values; this can - * be done by calling the method clearParameters. - * - * - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - */ - public synchronized void clearParameters() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - Arrays.fill(parameterValues, null); - Arrays.fill(parameterSet, false); - Arrays.fill(streamLengths, 0, streamLengths.length, 0); - } - - //---------------------------------------------------------------------- - // Advanced features: - - /** - *

    Sets the value of the designated parameter with the given object. The second - * argument must be an object type; for integral values, the - * java.lang equivalent objects should be used. - * - * If the second argument is an InputStream then the stream must contain - * the number of bytes specified by scaleOrLength. If the second argument is a - * Reader then the reader must contain the number of characters specified - * by scaleOrLength. If these conditions are not true the driver will generate a - * SQLException when the prepared statement is executed. - * - *

    The given Java object will be converted to the given targetSqlType - * before being sent to the database. - * - * If the object has a custom mapping (is of a class implementing the - * interface SQLData), - * the JDBC driver should call the method SQLData.writeSQL to - * write it to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, NClob, - * Struct, java.net.URL, - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - * - *

    Note that this method may be used to pass database-specific - * abstract data types. - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database. The scale argument may further qualify this type. - * @param scaleOrLength for java.sql.Types.DECIMAL - * or java.sql.Types.NUMERIC types, - * this is the number of digits after the decimal point. For - * Java Object types InputStream and Reader, - * this is the length - * of the data in the stream or reader. For all other types, - * this value will be ignored. - * @exception SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement or - * if the Java Object specified by x is an InputStream - * or Reader object and the value of the scale parameter is less - * than zero - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see java.sql.Types - */ - public synchronized void setObject(int parameterIndex, Object x, - int targetSqlType, - int scaleOrLength) throws SQLException { - - if (x instanceof InputStream) { - setBinaryStream(parameterIndex, (InputStream) x, scaleOrLength); - } else if (x instanceof Reader) { - setCharacterStream(parameterIndex, (Reader) x, scaleOrLength); - } else { - setObject(parameterIndex, x); - } - } - - /** - * - * Sets the value of the designated parameter with the given object. - * This method is like the method setObject - * above, except that it assumes a scale of zero. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.2, this method supports conversions listed in the - * conversion table B-5 of the JDBC 3 specification. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type (as defined in java.sql.Types) to be - * sent to the database - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @exception SQLFeatureNotSupportedException if targetSqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type - * @see #setObject(int,Object) - */ - public synchronized void setObject(int parameterIndex, Object x, - int targetSqlType) throws SQLException { - setObject(parameterIndex, x); - } - - /** - * - *

    Sets the value of the designated parameter using the given object. - * The second parameter must be of type Object; therefore, the - * java.lang equivalent objects should be used for built-in types. - * - *

    The JDBC specification specifies a standard mapping from - * Java Object types to SQL types. The given argument - * will be converted to the corresponding SQL type before being - * sent to the database. - * - *

    Note that this method may be used to pass database- - * specific abstract data types, by using a driver-specific Java - * type. - * - * If the object is of a class implementing the interface SQLData, - * the JDBC driver should call the method SQLData.writeSQL - * to write it to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * Ref, Blob, Clob, (JDBC4 new:) [ NClob ], - * Struct, java.net.URL, (JDBC4 new:) [ RowId, SQLXML ] - * or Array, the driver should pass it to the database as a - * value of the corresponding SQL type. - *

    - * Note: Not all databases allow for a non-typed Null to be sent to - * the backend. For maximum portability, the setNull or the - * setObject(int parameterIndex, Object x, int sqlType) - * method should be used - * instead of setObject(int parameterIndex, Object x). - *

    - * Note: This method throws an exception if there is an ambiguity, for example, if the - * object is of a class implementing more than one of the interfaces named above. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.2, this method supports conversions listed in the conversion - * table B-5 of the JDBC 3 specification. - *

    - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the object containing the input parameter value - * @exception SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement - * or the type of the given object is ambiguous - */ - public synchronized void setObject(int parameterIndex, - Object x) throws SQLException { - setParameter(parameterIndex, x); - } - - /** - * - * Executes the SQL statement in this PreparedStatement object, - * which may be any kind of SQL statement. - * Some prepared statements return multiple results; the execute - * method handles these complex statements as well as the simpler - * form of statements handled by the methods executeQuery - * and executeUpdate. - *

    - * The execute method returns a boolean to - * indicate the form of the first result. You must call either the method - * getResultSet or getUpdateCount - * to retrieve the result; you must call getMoreResults to - * move to any subsequent result(s). - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * If the statement is a call to a PROCEDURE, it may return multiple - * multiple fetchable results.

    - * - *

    - * - * @return true if the first result is a ResultSet - * object; false if the first result is an update - * count or there is no result - * @exception SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement - * or an argument is supplied to this method - * @see JDBCStatement#execute - * @see JDBCStatement#getResultSet - * @see JDBCStatement#getUpdateCount - * @see JDBCStatement#getMoreResults - * - */ - public synchronized boolean execute() throws SQLException { - - fetchResult(); - - return statementRetType == StatementTypes.RETURN_RESULT; - } - - //--------------------------JDBC 2.0----------------------------- - - /** - * - * Adds a set of parameters to this PreparedStatement - * object's batch of commands. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.2, this feature is supported. - *

    - * - * - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @see JDBCStatement#addBatch - * @since JDK 1.2 - */ - public synchronized void addBatch() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - checkParametersSet(); - - if (!isBatch) { - resultOut.setBatchedPreparedExecuteRequest(); - - isBatch = true; - } - - try { - performPreExecute(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - int len = parameterValues.length; - Object[] batchParamValues = new Object[len]; - - System.arraycopy(parameterValues, 0, batchParamValues, 0, len); - resultOut.addBatchedPreparedExecuteRequest(batchParamValues); - } - - /** - * - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * From HSQLDB 2.0 this method uses streaming to send data - * when the target is a CLOB.

    - * HSQLDB represents CHARACTER and related SQL types as UTF16 Unicode - * internally, so this method does not perform any conversion. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param reader the java.io.Reader object that contains the - * Unicode data - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @since JDK 1.2 - */ - public synchronized void setCharacterStream(int parameterIndex, - java.io.Reader reader, int length) throws SQLException { - setCharacterStream(parameterIndex, reader, (long) length); - } - - /** - * - * Sets the designated parameter to the given - * REF(<structured-type>) value. - * The driver converts this to an SQL REF value when it - * sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0 HSQLDB does not support the SQL REF type. Calling this method - * throws an exception. - * - *

    - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x an SQL REF value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.2 - */ - public void setRef(int parameterIndex, Ref x) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Sets the designated parameter to the given java.sql.Blob object. - * The driver converts this to an SQL BLOB value when it - * sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * For parameters of type Blob, setBlob works normally.

    - * - * In addition since 1.7.2, setBlob is supported for BINARY and VARBINARY - * parameters. In this context, the Blob object is - * hard-limited to those of length less than or equal to Integer.MAX_VALUE. - * In practice, soft limits such as available heap and maximum disk usage - * per file (such as the transaction log) dictate a much smaller maximum - * length.

    - * - * For BINARY and VARBINARY parameter types setBlob(i,x) is roughly - * equivalent (null and length handling not shown) to: - * - *

    -     * setBinaryStream(i, x.getBinaryStream(), (int) x.length());
    -     * 
    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x a Blob object that maps an SQL BLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.2 - */ - public synchronized void setBlob(int parameterIndex, - Blob x) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - Type outType = parameterTypes[parameterIndex - 1]; - - switch (outType.typeCode) { - - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - setBlobForBinaryParameter(parameterIndex, x); - - return; - - case Types.SQL_BLOB : - setBlobParameter(parameterIndex, x); - break; - - default : - throw JDBCUtil.invalidArgument(); - } - } - - /** - * Converts a blob to binary data for non-blob binary parameters. - */ - private void setBlobForBinaryParameter(int parameterIndex, - Blob x) throws SQLException { - - if (x instanceof JDBCBlob) { - setParameter(parameterIndex, ((JDBCBlob) x).data()); - - return; - } else if (x == null) { - setParameter(parameterIndex, null); - - return; - } - - final long length = x.length(); - - if (length > Integer.MAX_VALUE) { - String msg = "Maximum Blob input octet length exceeded: " + length; // NOI18N - - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg); - } - - try { - java.io.InputStream in = x.getBinaryStream(); - HsqlByteArrayOutputStream out = new HsqlByteArrayOutputStream(in, - (int) length); - - setParameter(parameterIndex, out.toByteArray()); - out.close(); - } catch (Throwable e) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, - e.toString(), e); - } - } - - /** - * - * Sets the designated parameter to the given java.sql.Clob object. - * The driver converts this to an SQL CLOB value when it - * sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * For parameters of type Clob, setClob works normally.

    - * - * In addition since 1.7.2, setClob is supported for CHARACTER and VARCHAR - * parameters. In this context, the Clob object is - * hard-limited to those of length less than or equal to Integer.MAX_VALUE. - * In practice, soft limits such as available heap and maximum disk usage - * per file (such as the transaction log) dictate a much smaller maximum - * length.

    - * - * For CHARACTER and VARCHAR parameter types setClob(i,x) is roughly - * equivalent (null and length handling not shown) to: - * - *

    -     * setCharacterStream(i, x.getCharacterStream(), (int) x.length());
    -     * 
    - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x a Clob object that maps an SQL CLOB value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.2 - */ - public synchronized void setClob(int parameterIndex, - Clob x) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - Type outType = parameterTypes[parameterIndex - 1]; - - switch (outType.typeCode) { - - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : - setClobForStringParameter(parameterIndex, x); - - return; - - case Types.SQL_CLOB : - setClobParameter(parameterIndex, x); - - return; - - default : - throw JDBCUtil.invalidArgument(); - } - } - - private void setClobForStringParameter(int parameterIndex, - Clob x) throws SQLException { - - if (x instanceof JDBCClob) { - setParameter(parameterIndex, ((JDBCClob) x).getData()); - - return; - } else if (x == null) { - setParameter(parameterIndex, null); - - return; - } - - final long length = x.length(); - - if (length > Integer.MAX_VALUE) { - String msg = "Max Clob input character length exceeded: " + length; // NOI18N - - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg); - } - - try { - java.io.Reader reader = x.getCharacterStream(); - CharArrayWriter writer = new CharArrayWriter(reader, (int) length); - - setParameter(parameterIndex, writer.toString()); - } catch (Throwable e) { - throw JDBCUtil.sqlException(ErrorCode.SERVER_TRANSFER_CORRUPTED, - e.toString(), e); - } - } - - /** - * - * Sets the designated parameter to the given java.sql.Array object. - * The driver converts this to an SQL ARRAY value when it - * sends it to the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From version 2.0, HSQLDB supports the SQL ARRAY type. - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x an Array object that maps an SQL ARRAY value - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.2 - */ - public synchronized void setArray(int parameterIndex, - Array x) throws SQLException { - - checkParameterIndex(parameterIndex); - - int index = parameterIndex - 1; - Type type = parameterMetaData.columnTypes[index]; - - if (!type.isArrayType()) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - if (x == null) { - parameterValues[index] = null; - parameterSet[index] = true; - - return; - } - - Object[] data = null; - - if (x instanceof JDBCArray) { - Type baseType = type.collectionBaseType(); - Object[] array = ((JDBCArray) x).getArrayInternal(); - Type otherType = ((JDBCArray) x).arrayType; - - data = (Object[]) type.convertToType(session, array, otherType); - } else { - Object object = x.getArray(); - - if (object instanceof Object[]) { - Type baseType = type.collectionBaseType(); - Object[] array = (Object[]) object; - - data = new Object[array.length]; - - for (int i = 0; i < data.length; i++) { - data[i] = baseType.convertJavaToSQL(session, array[i]); - } - } else { - - // if foreign data is not Object[] - throw JDBCUtil.notSupported(); - } - } - - parameterValues[index] = data; - parameterSet[index] = true; - } - - /** - * - * Retrieves a ResultSetMetaData object that contains - * information about the columns of the ResultSet object - * that will be returned when this PreparedStatement object - * is executed. - *

    - * Because a PreparedStatement object is pre-compiled, it is - * possible to know about the ResultSet object that it will - * return without having to execute it. Consequently, it is possible - * to invoke the method getMetaData on a - * PreparedStatement object rather than waiting to execute - * it and then invoking the ResultSet.getMetaData method - * on the ResultSet object that is returned. - *

    - * NOTE: Using this method may be expensive for some drivers due - * to the lack of underlying DBMS support. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.2, this feature is supported and is inexpensive as - * it is backed by underlying DBMS support. If the statement - * generates an update count, then null is returned. - *

    - * - * @return the description of a ResultSet object's columns or - * null if the driver cannot return a - * ResultSetMetaData object - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public synchronized ResultSetMetaData getMetaData() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (statementRetType != StatementTypes.RETURN_RESULT) { - return null; - } - - if (resultSetMetaData == null) { - boolean isUpdatable = ResultProperties.isUpdatable(rsProperties); - boolean isInsertable = isUpdatable; - - if (isInsertable) { - for (int i = 0; i < resultMetaData.colIndexes.length; i++) { - if (resultMetaData.colIndexes[i] < 0) { - isInsertable = false; - - break; - } - } - } - - resultSetMetaData = new JDBCResultSetMetaData(resultMetaData, - isUpdatable, isInsertable, connection); - } - - return resultSetMetaData; - } - - /** - * - * Sets the designated parameter to the given java.sql.Date value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL DATE value, - * which the driver then sends to the database. With - * a Calendar object, the driver can calculate the date - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the date - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @since JDK 1.2 - */ - public synchronized void setDate(int parameterIndex, Date x, - Calendar cal) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - int index = parameterIndex - 1; - - if (x == null) { - parameterValues[index] = null; - parameterSet[index] = true; - - return; - } - - Type outType = parameterTypes[index]; - Object value; - - switch (outType.typeCode) { - - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - value = ((DateTimeType)outType).convertJavaToSQL(session, x, cal); - break; - - case Types.SQL_CHAR: - case Types.SQL_VARCHAR: - value = Type.SQL_DATE.convertJavaToSQL(session, x); - value = outType.castToType(session, value, Type.SQL_DATE); - break; - - default : - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - parameterValues[index] = value; - parameterSet[index] = true; - } - - /** - * - * Sets the designated parameter to the given java.sql.Time value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIME value, - * which the driver then sends to the database. With - * a Calendar object, the driver can calculate the time - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - *
    - *

    HSQLDB-Specific Information:

    - * - * When a setXXX method is used to set a parameter of type - * TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone (including - * Daylight Saving Time) of the Calendar is used as time zone for the - * value.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the time - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @since JDK 1.2 - */ - public synchronized void setTime(int parameterIndex, Time x, - Calendar cal) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - int index = parameterIndex - 1; - - if (x == null) { - parameterValues[index] = null; - parameterSet[index] = true; - - return; - } - - Type outType = parameterTypes[index]; - Object value; - - switch (outType.typeCode) { - - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP: - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - value = ((DateTimeType)outType).convertJavaToSQL(session, x, cal); - break; - - case Types.SQL_CHAR: - case Types.SQL_VARCHAR: - value = Type.SQL_TIME_WITH_TIME_ZONE_MAX.convertJavaToSQL(session, x); - value = outType.castToType(session, value, Type.SQL_TIME_WITH_TIME_ZONE_MAX); - break; - - default : - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - - parameterValues[index] = value; - parameterSet[index] = true; - } - - /** - * - * Sets the designated parameter to the given java.sql.Timestamp value, - * using the given Calendar object. The driver uses - * the Calendar object to construct an SQL TIMESTAMP value, - * which the driver then sends to the database. With a - * Calendar object, the driver can calculate the timestamp - * taking into account a custom timezone. If no - * Calendar object is specified, the driver uses the default - * timezone, which is that of the virtual machine running the application. - * - *
    - *

    HSQLDB-Specific Information:

    - * - * When a setXXX method is used to set a parameter of type - * TIMESTAMP WITH TIME ZONE or TIME WITH TIME ZONE the time zone (including - * Daylight Saving Time) of the Calendar is used as time zone.

    - * In this case, if the Calendar argument is null, then the default Calendar - * for the clients JVM is used as the Calendar

    - * - * When this method is used to set a parameter of type TIME or - * TIME WITH TIME ZONE, then the nanosecond value of the Timestamp object - * is used if the TIME parameter accepts fractional seconds.

    - * - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @param cal the Calendar object the driver will use - * to construct the timestamp - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @since JDK 1.2 - */ - public synchronized void setTimestamp(int parameterIndex, Timestamp x, - Calendar cal) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - int index = parameterIndex - 1; - - if (x == null) { - parameterValues[index] = null; - parameterSet[index] = true; - - return; - } - - Type outType = parameterTypes[index]; - Object value; - - switch (outType.typeCode) { - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_DATE : - value = ((DateTimeType)outType).convertJavaToSQL(session, x, cal); - break; - - case Types.SQL_CHAR: - case Types.SQL_VARCHAR: - value = Type.SQL_TIMESTAMP_WITH_TIME_ZONE_MAX.convertJavaToSQL(session, x); - value = outType.castToType(session, value, Type.SQL_TIMESTAMP_WITH_TIME_ZONE_MAX); - break; - - default : - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - parameterValues[index] = value; - parameterSet[index] = true; - } - - /** - * - * Sets the designated parameter to SQL NULL. - * This version of the method setNull should - * be used for user-defined types and REF type parameters. Examples - * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and - * named array types. - * - *

    Note: To be portable, applications must give the - * SQL type code and the fully-qualified SQL type name when specifying - * a NULL user-defined or REF parameter. In the case of a user-defined type - * the name is the type name of the parameter itself. For a REF - * parameter, the name is the type name of the referenced type. If - * a JDBC driver does not need the type code or type name information, - * it may ignore it. - * - * Although it is intended for user-defined and Ref parameters, - * this method may be used to set a null parameter of any JDBC type. - * If the parameter does not have a user-defined or REF type, the given - * typeName is ignored. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB simply ignores the sqlType and typeName arguments. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param sqlType a value from java.sql.Types - * @param typeName the fully-qualified name of an SQL user-defined type; - * ignored if the parameter is not a user-defined type or REF - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @exception SQLFeatureNotSupportedException if sqlType is - * a ARRAY, BLOB, CLOB, - * DATALINK, JAVA_OBJECT, NCHAR, - * NCLOB, NVARCHAR, LONGNVARCHAR, - * REF, ROWID, SQLXML - * or STRUCT data type and the JDBC driver does not support - * this data type or if the JDBC driver does not support this method - * @since JDK 1.2 - */ - public synchronized void setNull(int parameterIndex, int sqlType, - String typeName) throws SQLException { - setParameter(parameterIndex, null); - } - - //------------------------- JDBC 2.0 - overridden methods ------------------- - - /** - * - * Submits a batch of commands to the database for execution and - * if all commands execute successfully, returns an array of update counts. - * The int elements of the array that is returned are ordered - * to correspond to the commands in the batch, which are ordered - * according to the order in which they were added to the batch. - * The elements in the array returned by the method executeBatch - * may be one of the following: - *
      - *
    1. A number greater than or equal to zero -- indicates that the - * command was processed successfully and is an update count giving the - * number of rows in the database that were affected by the command's - * execution - *
    2. A value of SUCCESS_NO_INFO -- indicates that the command was - * processed successfully but that the number of rows affected is - * unknown - *

      - * If one of the commands in a batch update fails to execute properly, - * this method throws a BatchUpdateException, and a JDBC - * driver may or may not continue to process the remaining commands in - * the batch. However, the driver's behavior must be consistent with a - * particular DBMS, either always continuing to process commands or never - * continuing to process commands. If the driver continues processing - * after a failure, the array returned by the method - * BatchUpdateException.getUpdateCounts - * will contain as many elements as there are commands in the batch, and - * at least one of the elements will be the following: - *

    3. A value of EXECUTE_FAILED -- indicates that the command failed - * to execute successfully and occurs only if a driver continues to - * process commands after a command fails - *
    - *

    - * A driver is not required to implement this method. - * The possible implementations and return values have been modified in - * the Java 2 SDK, Standard Edition, version 1.3 to - * accommodate the option of continuing to process commands in a batch - * update after a BatchUpdateException object has been thrown. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 1.7.2, this feature is supported.

    - * - * HSQLDB stops execution of commands in a batch when one of the commands - * results in an exception. The size of the returned array equals the - * number of commands that were executed successfully.

    - * - *

    - * - * - * @return an array of update counts containing one element for each - * command in the batch. The elements of the array are ordered according - * to the order in which commands were added to the batch. - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * driver does not support batch statements. Throws {@link BatchUpdateException} - * (a subclass of SQLException) if one of the commands sent to the - * database fails to execute properly or attempts to return a result set. - * - * - * @see #addBatch - * @see java.sql.DatabaseMetaData#supportsBatchUpdates() - * @since JDK 1.3 - */ - public synchronized int[] executeBatch() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - checkStatementType(StatementTypes.RETURN_COUNT); - - if (!isBatch) { - if (connection.isAllowEmptyBatch) { - return new int[]{}; - } - - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_07506); - } - - generatedResult = null; - - int batchCount = resultOut.getNavigator().getSize(); - - resultIn = null; - - try { - resultIn = session.execute(resultOut); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } finally { - performPostExecute(); - resultOut.getNavigator().clear(); - - isBatch = false; - } - - if (resultIn.mode == ResultConstants.ERROR) { - throw JDBCUtil.sqlException(resultIn); - } - - RowSetNavigator navigator = resultIn.getNavigator(); - int[] updateCounts = new int[navigator.getSize()]; - - for (int i = 0; navigator.next(); i++) { - Object[] data = navigator.getCurrent(); - - updateCounts[i] = ((Integer) data[0]).intValue(); - } - - if (updateCounts.length != batchCount) { - if (errorResult == null) { - throw new BatchUpdateException(updateCounts); - } else { - throw new BatchUpdateException(errorResult.getMainString(), - errorResult.getSubString(), - errorResult.getErrorCode(), - updateCounts); - } - } - - return updateCounts; - } - - /** - * - * Sets escape processing on or off. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * As per JDBC spec, calling this method has no effect. - *

    - * - * - * @param enable true to enable escape processing; - * false to disable it - * @exception SQLException if a database access error occurs - */ - public void setEscapeProcessing(boolean enable) throws SQLException { - checkClosed(); - } - - /** - * This method should always throw if called for a PreparedStatement or - * CallableStatement. - * - * @param sql ignored - * @throws SQLException always - */ - public void addBatch(String sql) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * This method should always throw if called for a PreparedStatement or - * CallableStatement. - * - * @param sql ignored - * @throws SQLException always - * @return nothing - */ - public synchronized ResultSet executeQuery(String sql) - throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * This method should always throw if called for a PreparedStatement or - * CallableStatement. - * - * @param sql ignored - * @throws SQLException always - * @return nothing - */ - public boolean execute(String sql) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * This method should always throw if called for a PreparedStatement or - * CallableStatement. - * - * @param sql ignored - * @throws SQLException always - * @return nothing - */ - public int executeUpdate(String sql) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Does the specialized work required to free this object's resources and - * that of its parent class.

    - * - * @throws SQLException if a database access error occurs - */ - public synchronized void close() throws SQLException { - - if (isClosed()) { - return; - } - - closeResultData(); - - HsqlException he = null; - - try { - - // fredt - if this is called by Connection.close() then there's no - // need to free the prepared statements on the server - it is done - // by Connection.close() - if (!connection.isClosed) { - session.execute(Result.newFreeStmtRequest(statementID)); - } - } catch (HsqlException e) { - he = e; - } - - parameterValues = null; - parameterSet = null; - parameterTypes = null; - parameterModes = null; - resultMetaData = null; - parameterMetaData = null; - resultSetMetaData = null; - pmd = null; - connection = null; - session = null; - resultIn = null; - resultOut = null; - isClosed = true; - - if (he != null) { - throw JDBCUtil.sqlException(he); - } - } - - /** - * Retrieves a String representation of this object.

    - * - * The representation is of the form:

    - * - * class-name@hash[sql=[char-sequence], parameters=[p1, ...pi, ...pn]]

    - * - * p1, ...pi, ...pn are the String representations of the currently set - * parameter values that will be used with the non-batch execution - * methods.

    - * - * @return a String representation of this object - */ - public synchronized String toString() { - - StringBuilder sb = new StringBuilder(); - String sql; - Object[] pv; - - sb.append(super.toString()); - - sql = this.sql; - pv = parameterValues; - - if (sql == null || pv == null) { - sb.append("[closed]"); - - return sb.toString(); - } - - sb.append("[sql=[").append(sql).append("]"); - - if (pv.length > 0) { - sb.append(", parameters=["); - - for (int i = 0; i < pv.length; i++) { - sb.append('['); - sb.append(pv[i]); - sb.append("], "); - } - - sb.setLength(sb.length() - 2); - sb.append(']'); - } - - sb.append(']'); - - return sb.toString(); - } - - //------------------------- JDBC 3.0 ----------------------------------- - - /** - * - * Sets the designated parameter to the given java.net.URL value. - * The driver converts this to an SQL DATALINK value - * when it sends it to the database. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, HSQLDB does not support the DATALINK SQL type for which this - * method is intended. Calling this method throws an exception. - * - *

    - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java.net.URL object to be set - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.4, HSQL 1.7.0 - */ - public void setURL(int parameterIndex, - java.net.URL x) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Retrieves the number, types and properties of this - * PreparedStatement object's parameters. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Since 1.7.2, this feature is supported. - *

    - * - * - * @return a ParameterMetaData object that contains information - * about the number, types and properties for each - * parameter marker of this PreparedStatement object - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @see java.sql.ParameterMetaData - * @since JDK 1.4, HSQL 1.7.0 - */ - public synchronized ParameterMetaData getParameterMetaData() - throws SQLException { - - checkClosed(); - - if (pmd == null) { - pmd = new JDBCParameterMetaData(connection, parameterMetaData); - } - - return pmd; - } - - /** - * Statement methods that must be overridden in this class and throw - * an exception. - */ - public int executeUpdate(String sql, - int autoGeneratedKeys) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public boolean execute(String sql, - int autoGeneratedKeys) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public int executeUpdate(String sql, - int[] columnIndexes) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public boolean execute(String sql, - int[] columnIndexes) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public int executeUpdate(String sql, - String[] columnNames) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public boolean execute(String sql, - String[] columnNames) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Moves to this Statement object's next result, deals with - * any current ResultSet object(s) according to the instructions - * specified by the given flag, and returns - * true if the next result is a ResultSet object. - * - *

    There are no more results when the following is true: - *

    {@code
    -     *     // stmt is a Statement object
    -     *     ((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1))
    -     * }
    - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - * This is used with CallableStatement objects that return multiple - * ResultSet objects. - *

    - * - * - * @param current one of the following Statement - * constants indicating what should happen to current - * ResultSet objects obtained using the method - * getResultSet: - * Statement.CLOSE_CURRENT_RESULT, - * Statement.KEEP_CURRENT_RESULT, or - * Statement.CLOSE_ALL_RESULTS - * @return true if the next result is a ResultSet - * object; false if it is an update count or there are no - * more results - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the argument - * supplied is not one of the following: - * Statement.CLOSE_CURRENT_RESULT, - * Statement.KEEP_CURRENT_RESULT, or - * Statement.CLOSE_ALL_RESULTS - * @since JDK 1.4, HSQLDB 1.7 - * @see #execute - */ - public synchronized boolean getMoreResults(int current) - throws SQLException { - return super.getMoreResults(current); - } - - /** - * - * Retrieves any auto-generated keys created as a result of executing this - * Statement object. If this Statement object did - * not generate any keys, an empty ResultSet - * object is returned. - *

    (JDBC4 clarification:) - *

    Note:If the columns which represent the auto-generated keys were not specified, - * the JDBC driver implementation will determine the columns which best represent the auto-generated keys. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports this feature with single-row and - * multi-row insert, update and merge statements.

    - * - * This method returns a result set only if - * the executeUpdate methods that was used is one of the three methods that - * have the extra parameter indicating return of generated keys

    - * - * If the executeUpdate method did not specify the columns which represent - * the auto-generated keys the IDENTITY column or GENERATED column(s) of the - * table are returned.

    - * - * The executeUpdate methods with column indexes or column names return the - * post-insert or post-update values of the specified columns, whether the - * columns are generated or not. This allows values that have been modified - * by execution of triggers to be returned.

    - * - * If column names or indexes provided by the user in the executeUpdate() - * method calls do not correspond to table columns (incorrect names or - * indexes larger than the column count), an empty result is returned. - * - *

    - * - * - * @return a ResultSet object containing the auto-generated key(s) - * generated by the execution of this Statement object - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized ResultSet getGeneratedKeys() throws SQLException { - return getGeneratedResultSet(); - } - - /** - * - * Retrieves the result set holdability for ResultSet objects - * generated by this Statement object. - * - * - * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized int getResultSetHoldability() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return ResultProperties.getJDBCHoldability(rsProperties); - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * Retrieves whether this Statement object has been closed. A Statement is closed if the - * method close has been called on it, or if it is automatically closed. - * @return true if this Statement object is closed; false if it is still open - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized boolean isClosed() { - return isClosed; - } - - /** - * Sets the designated parameter to the given java.sql.RowId object. The - * driver converts this to a SQL ROWID value when it sends it - * to the database - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the parameter value - * @throws SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public void setRowId(int parameterIndex, RowId x) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Sets the designated parameter to the given String object. - * The driver converts this to a SQL NCHAR or - * NVARCHAR or LONGNVARCHAR value - * (depending on the argument's - * size relative to the driver's limits on NVARCHAR values) - * when it sends it to the database. - * - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNString(int parameterIndex, - String value) throws SQLException { - setString(parameterIndex, value); - } - - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNCharacterStream(int parameterIndex, - Reader value, long length) throws SQLException { - setCharacterStream(parameterIndex, value, length); - } - - /** - * Sets the designated parameter to a java.sql.NClob object. The driver converts this to a - * SQL NCLOB value when it sends it to the database. - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur ; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNClob(int parameterIndex, - NClob value) throws SQLException { - setClob(parameterIndex, value); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if a database access error occurs, this method is called on - * a closed PreparedStatement, if parameterIndex does not correspond to a parameter - * marker in the SQL statement, or if the length specified is less than zero. - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setClob(int parameterIndex, Reader reader, - long length) throws SQLException { - setCharacterStream(parameterIndex, reader, length); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to a InputStream object. The input stream must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * This method differs from the setBinaryStream (int, InputStream, int) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - *
    - *

    HSQLDB-Specific Information:

    - * - * In HSQLDB 2.0, this method uses streaming to send the data when the - * stream is assigned to a BLOB target. For other binary targets the - * stream is read on the client side and a byte array is sent. - *

    - * - * - * @param parameterIndex index of the first parameter is 1, - * the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @throws SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement, - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, if the length specified - * is less than zero or if the number of bytes in the input stream does not match - * the specified length. - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setBlob(int parameterIndex, - InputStream inputStream, - long length) throws SQLException { - setBinaryStream(parameterIndex, inputStream, length); - } - - /** - * Sets the designated parameter to a Reader object. The reader must contain the number - * of characters specified by length otherwise a SQLException will be - * generated when the PreparedStatement is executed. - * This method differs from the setCharacterStream (int, Reader, int) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the length specified is less than zero; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setNClob(int parameterIndex, Reader reader, - long length) throws SQLException { - setClob(parameterIndex, reader, length); - } - - /** - * Sets the designated parameter to the given java.sql.SQLXML object. - * The driver converts this to an - * SQL XML value when it sends it to the database. - *

    - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param xmlObject a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs, - * this method is called on a closed PreparedStatement - * or the java.xml.transform.Result, - * Writer or OutputStream has not been closed for - * the SQLXML object - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * @since JDK 1.6, HSQLDB 2.0 - */ - public void setSQLXML(int parameterIndex, - SQLXML xmlObject) throws SQLException { - throw JDBCUtil.notSupported(); - } - -// --------------------------- Added: Mustang Build 86 ------------------------- - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * From HSQLDB 2.0 this method uses the US-ASCII character encoding to convert bytes - * from the stream into the characters of a String.

    - * This method does not use streaming to send the data, - * whether the target is a CLOB or other binary object.

    - * - * For long streams (larger than a few megabytes) with CLOB targets, - * it is more efficient to use a version of setCharacterStream which takes - * the a length parameter. - *

    - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the Java input stream that contains the ASCII parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setAsciiStream(int parameterIndex, - java.io.InputStream x, long length) throws SQLException { - - if (length < 0) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, - "length: " + length); - } - - setAscStream(parameterIndex, x, length); - } - - void setAscStream(int parameterIndex, java.io.InputStream x, - long length) throws SQLException { - - if (length > Integer.MAX_VALUE) { - throw JDBCUtil.sqlException(ErrorCode.X_22001); - } - - if (x == null) { - throw JDBCUtil.nullArgument("x"); - } - - try { - String s = StringConverter.inputStreamToString(x, "US-ASCII"); - - if (length >= 0 && s.length() > length) { - s = s.substring(0, (int) length); - } - - setParameter(parameterIndex, s); - } catch (IOException e) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, - null, e); - } - } - - /** - * Sets the designated parameter to the given input stream, which will have - * the specified number of bytes. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This method uses streaming to send the data when the - * stream is assigned to a BLOB target. For other binary targets the - * stream is read on the client side and a byte array is sent. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java input stream which contains the binary parameter value - * @param length the number of bytes in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setBinaryStream(int parameterIndex, - java.io.InputStream x, long length) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (length < 0) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, - "length: " + length); - } - - if (length > parameterTypes[parameterIndex - 1].precision) { - throw JDBCUtil.sqlException(ErrorCode.X_22001, - "length: " + length); - } - - // ignore length as client/server cannot handle incorrect data length entered by user - setBinStream(parameterIndex, x, -1); - } - - private void setBinStream(int parameterIndex, java.io.InputStream x, - long length) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (parameterTypes[parameterIndex - 1].typeCode == Types.SQL_BLOB) { - setBlobParameter(parameterIndex, x, length); - - return; - } - - if (length > Integer.MAX_VALUE) { - String msg = "Maximum Blob input length exceeded: " + length; - - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg); - } - - try { - HsqlByteArrayOutputStream output; - - if (length < 0) { - output = new HsqlByteArrayOutputStream(x); - } else { - output = new HsqlByteArrayOutputStream(x, (int) length); - } - - setParameter(parameterIndex, output.toByteArray()); - } catch (Throwable e) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, - e.toString(), e); - } - } - - /** - * Sets the designated parameter to the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This method uses streaming to send data - * when the target is a CLOB.

    - *

    - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param reader the java.io.Reader object that contains the - * Unicode data - * @param length the number of characters in the stream - * @exception SQLException if a database access error occurs or - * this method is called on a closed PreparedStatement - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setCharacterStream(int parameterIndex, - java.io.Reader reader, long length) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (length < 0) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, - "length: " + length); - } - - if (length > parameterTypes[parameterIndex - 1].precision) { - throw JDBCUtil.sqlException(ErrorCode.X_22001, - "length: " + length); - } - - // ignore length as client/server cannot handle incorrect data length entered by user - setCharStream(parameterIndex, reader, -1); - } - - private void setCharStream(int parameterIndex, java.io.Reader reader, - long length) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - if (parameterTypes[parameterIndex - 1].typeCode == Types.SQL_CLOB) { - setClobParameter(parameterIndex, reader, length); - - return; - } - - if (length > Integer.MAX_VALUE) { - String msg = "Maximum Clob input length exceeded: " + length; - - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg); - } - - try { - CharArrayWriter writer; - - if (length < 0) { - writer = new CharArrayWriter(reader); - } else { - writer = new CharArrayWriter(reader, (int) length); - } - - setParameter(parameterIndex, writer.toString()); - } catch (Throwable e) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, - e.toString(), e); - } - } - - /** - * Sets the designated parameter to the given input stream. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setAsciiStream which takes a length parameter. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * In HSQLDB 2.0, this method does not use streaming to send the data, - * whether the target is a CLOB or other binary object. - * - * For long streams (larger than a few megabytes), it is more efficient to - * use a version of setCharacterStream which takes the a length parameter. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the Java input stream that contains the ASCII parameter value - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since 1.6 - */ - public synchronized void setAsciiStream(int parameterIndex, - java.io.InputStream x) throws SQLException { - setAscStream(parameterIndex, x, -1); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to the given input stream. - * When a very large binary value is input to a LONGVARBINARY - * parameter, it may be more practical to send it via a - * java.io.InputStream object. The data will be read from the - * stream as needed until end-of-file is reached. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBinaryStream which takes a length parameter. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * This method does not use streaming to send the data, - * whether the target is a CLOB or other binary object.

    - * - * For long streams (larger than a few megabytes) with CLOB targets, - * it is more efficient to use a version of setCharacterStream which takes - * the a length parameter. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the java input stream which contains the binary parameter value - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since 1.6 - */ - public synchronized void setBinaryStream(int parameterIndex, - java.io.InputStream x) throws SQLException { - setBinStream(parameterIndex, x, -1); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to the given Reader - * object. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setCharacterStream which takes a length parameter. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * In HSQLDB 2.0, this method does not use streaming to send the data, - * whether the target is a CLOB or other binary object. - * - * For long streams (larger than a few megabytes), it is more efficient to - * use a version of setCharacterStream which takes the a length parameter. - *

    - * - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param reader the java.io.Reader object that contains the - * Unicode data - * @exception SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since 1.6 - */ - public synchronized void setCharacterStream(int parameterIndex, - java.io.Reader reader) throws SQLException { - setCharStream(parameterIndex, reader, -1); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to a Reader object. The - * Reader reads the data till end-of-file is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNCharacterStream which takes a length parameter. - * - * @param parameterIndex of the first parameter is 1, the second is 2, ... - * @param value the parameter value - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; if a database access error occurs; or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since 1.6 - */ - public synchronized void setNCharacterStream(int parameterIndex, - Reader value) throws SQLException { - setCharStream(parameterIndex, value, -1); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a CLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARCHAR or a CLOB - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setClob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs; this method is called on - * a closed PreparedStatementor if parameterIndex does not correspond to a parameter - * marker in the SQL statement - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since 1.6 - */ - public synchronized void setClob(int parameterIndex, - Reader reader) throws SQLException { - setCharStream(parameterIndex, reader, -1); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to a InputStream object. - * This method differs from the setBinaryStream (int, InputStream) - * method because it informs the driver that the parameter value should be - * sent to the server as a BLOB. When the setBinaryStream method is used, - * the driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGVARBINARY or a BLOB - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setBlob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, - * the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; if a database access error occurs; - * this method is called on a closed PreparedStatement or - * if parameterIndex does not correspond - * to a parameter marker in the SQL statement, - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * @since 1.6 - */ - public synchronized void setBlob(int parameterIndex, - InputStream inputStream) - throws SQLException { - setBinStream(parameterIndex, inputStream, -1); - } - - /* @todo 1.9.0 - implement streaming and remove length limits */ - - /** - * Sets the designated parameter to a Reader object. - * This method differs from the setCharacterStream (int, Reader) method - * because it informs the driver that the parameter value should be sent to - * the server as a NCLOB. When the setCharacterStream method is used, the - * driver may have to do extra work to determine whether the parameter - * data should be sent to the server as a LONGNVARCHAR or a NCLOB - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * setNClob which takes a length parameter. - * - * @param parameterIndex index of the first parameter is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if parameterIndex does not correspond to a parameter - * marker in the SQL statement; - * if the driver does not support national character sets; - * if the driver can detect that a data conversion - * error could occur; if a database access error occurs or - * this method is called on a closed PreparedStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * - * @since 1.6 - */ - public synchronized void setNClob(int parameterIndex, - Reader reader) throws SQLException { - setCharStream(parameterIndex, reader, -1); - } - - /** - * - * Retrieves the maximum number of bytes that can be - * returned for character and binary column values in a ResultSet - * object produced by this Statement object. - * This limit applies only to BINARY, VARBINARY, - * LONGVARBINARY, CHAR, VARCHAR, - * (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR - * and LONGVARCHAR columns. If the limit is exceeded, the - * excess data is silently discarded. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB always returns zero, meaning there is no limit. - *

    - * - * - * @return the current column size limit for columns storing character and - * binary values; zero means there is no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setMaxFieldSize - */ - public synchronized int getMaxFieldSize() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return 0; - } - - /** - * - * (JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - * Sets the limit for the maximum number of bytes that can be returned for - * character and binary column values in a ResultSet - * object produced by this Statement object. - * - * This limit applies - * only to BINARY, VARBINARY, - * LONGVARBINARY, CHAR, VARCHAR, - * (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR and - * LONGVARCHAR fields. If the limit is exceeded, the excess data - * is silently discarded. For maximum portability, use values - * greater than 256. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * To present, calls to this method are simply ignored; HSQLDB always - * stores the full number of bytes when dealing with any of the field types - * mentioned above. These types all have an absolute maximum element upper - * bound determined by the Java array index limit - * java.lang.Integer.MAX_VALUE. For XXXBINARY types, this translates to - * Integer.MAX_VALUE bytes. For XXXCHAR types, this translates to - * 2 * Integer.MAX_VALUE bytes (2 bytes / character).

    - * - * In practice, field sizes are limited to values much smaller than the - * absolute maximum element upper bound, in particular due to limits imposed - * on the maximum available Java heap memory. - *

    - * - * - * @param max the new column size limit in bytes; zero means there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code max >= 0} is not satisfied - * @see #getMaxFieldSize - */ - public synchronized void setMaxFieldSize(int max) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (max < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - } - - /** - * - * Retrieves the maximum number of rows that a - * ResultSet object produced by this - * Statement object can contain. If this limit is exceeded, - * the excess rows are silently dropped. - * - * - * @return the current maximum number of rows for a ResultSet - * object produced by this Statement object; - * zero means there is no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setMaxRows - */ - public synchronized int getMaxRows() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return maxRows; - } - - /** - * - * (JDBC4 clarification:) - * Sets the limit for the maximum number of rows that any - * ResultSet object generated by this Statement - * object can contain to the given number. - * If the limit is exceeded, the excess - * rows are silently dropped. - * - * - * @param max the new max rows limit; zero means there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code max >= 0} is not satisfied - * @see #getMaxRows - */ - public synchronized void setMaxRows(int max) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (max < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - - maxRows = max; - } - - /** - * - * Retrieves the number of seconds the driver will - * wait for a Statement object to execute. - * If the limit is exceeded, a - * SQLException is thrown. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * To present, HSQLDB always returns zero, meaning there - * is no limit. - *

    - * - * - * @return the current query timeout limit in seconds; zero means there is - * no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setQueryTimeout - */ - public synchronized int getQueryTimeout() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return queryTimeout; - } - - /** - * - * Sets the number of seconds the driver will wait for a - * Statement object to execute to the given number of seconds. - * If the limit is exceeded, an SQLException is thrown. A JDBC - * (JDBC4 clarification:) - * driver must apply this limit to the execute, - * executeQuery and executeUpdate methods. JDBC driver - * implementations may also apply this limit to ResultSet methods - * (consult your driver vendor documentation for details). - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The maximum number of seconds to wait is 32767. - *

    - * - * - * @param seconds the new query timeout limit in seconds; zero means - * there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code seconds >= 0} is not satisfied - * @see #getQueryTimeout - */ - public synchronized void setQueryTimeout(int seconds) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (seconds < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - - if (seconds > Short.MAX_VALUE) { - seconds = Short.MAX_VALUE; - } - - queryTimeout = seconds; - } - - /** - * - * Cancels this Statement object if both the DBMS and - * driver support aborting an SQL statement. - * This method can be used by one thread to cancel a statement that - * is being executed by another thread. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB version 2.3.4 and later supports aborting an SQL query - * or data update statement. - *

    - * - * - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public synchronized void cancel() throws SQLException { - - checkClosed(); - - String sql = resultOut.getMainString(); - int randomId = connection.sessionProxy.getRandomId(); - Result request = Result.newCancelRequest(randomId, -1, sql); - - try { - Result response = connection.sessionProxy.cancel(request); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * Retrieves the first warning reported by calls on this Statement object. - * Subsequent Statement object warnings will be chained to this - * SQLWarning object. - * - *

    The warning chain is automatically cleared each time - * a statement is (re)executed. This method may not be called on a closed - * Statement object; doing so will cause an SQLException - * to be thrown. - * - *

    Note: If you are processing a ResultSet object, any - * warnings associated with reads on that ResultSet object - * will be chained on it rather than on the Statement - * object that produced it. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * From 1.9 HSQLDB, produces Statement warnings. - *

    - * - * - * @return the first SQLWarning object or null - * if there are no warnings - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - */ - public synchronized SQLWarning getWarnings() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return rootWarning; - } - - /** - * - * Clears all the warnings reported on this Statement - * object. After a call to this method, - * the method getWarnings will return - * null until a new warning is reported for this - * Statement object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Supported in HSQLDB 1.9. - *

    - * - * - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - */ - public synchronized void clearWarnings() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - rootWarning = null; - } - - /* @todo 1.9.0 - implement */ - - /** - * - * Sets the SQL cursor name to the given String, which - * will be used by subsequent Statement object - * execute methods. This name can then be - * used in SQL positioned update or delete statements to identify the - * current row in the ResultSet object generated by this - * statement. If the database does not support positioned update/delete, - * this method is a noop. To ensure that a cursor has the proper isolation - * level to support updates, the cursor's SELECT statement - * should have the form SELECT FOR UPDATE. If - * FOR UPDATE is not present, positioned updates may fail. - * - *

    Note: By definition, the execution of positioned updates and - * deletes must be done by a different Statement object than - * the one that generated the ResultSet object being used for - * positioning. Also, cursor names must be unique within a connection. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, HSQLDB does not support named cursors; - * calls to this method are ignored. - *

    - * - * - * @param name the new cursor name, which must be unique within - * a connection - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCursorName(String name) throws SQLException { - checkClosed(); - } - - //----------------------- Multiple Results -------------------------- - - /** - * - * Retrieves the current result as a ResultSet object. - * This method should be called only once per result. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Without an interceding call to executeXXX, each invocation of this - * method will produce a new, initialized ResultSet instance referring to - * the current result, if any. - *

    - * - * - * @return the current result as a ResultSet object or - * null if the result is an update count or there are no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - */ - public synchronized ResultSet getResultSet() throws SQLException { - return super.getResultSet(); - } - - /** - * - * Retrieves the current result as an update count; - * if the result is a ResultSet object or there are no more results, -1 - * is returned. This method should be called only once per result. - * - * - * @return the current result as an update count; -1 if the current result is a - * ResultSet object or there are no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - */ - public synchronized int getUpdateCount() throws SQLException { - return super.getUpdateCount(); - } - - /** - * - * Moves to this Statement object's next result, returns - * true if it is a ResultSet object, and - * implicitly closes any current ResultSet - * object(s) obtained with the method getResultSet. - * - *

    There are no more results when the following is true: - *

    {@code
    -     *     // stmt is a Statement object
    -     *     ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
    -     * }
    - * - * - * @return true if the next result is a ResultSet - * object; false if it is an update count or there are - * no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - */ - public synchronized boolean getMoreResults() throws SQLException { - return getMoreResults(JDBCStatementBase.CLOSE_CURRENT_RESULT); - } - - //--------------------------JDBC 2.0----------------------------- - - /** - * - * Gives the driver a hint as to the direction in which - * rows will be processed in ResultSet - * objects created using this Statement object. The - * default value is ResultSet.FETCH_FORWARD. - *

    - * Note that this method sets the default fetch direction for - * result sets generated by this Statement object. - * Each result set has its own methods for getting and setting - * its own fetch direction. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Up to 1.8.0.x, HSQLDB supports only FETCH_FORWARD; - * Setting any other value would throw an SQLException - * stating that the operation is not supported.

    - * - * Starting with 2.0, HSQLDB accepts any valid value. - *

    - * - * - * @param direction the initial direction for processing rows - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the given direction - * is not one of ResultSet.FETCH_FORWARD, - * ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN - * @since JDK 1.2 - * @see #getFetchDirection - */ - public synchronized void setFetchDirection(int direction) - throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (direction != ResultSet.FETCH_FORWARD - && direction != ResultSet.FETCH_REVERSE - && direction != ResultSet.FETCH_UNKNOWN) { - throw JDBCUtil.notSupported(); - } - - fetchDirection = direction; - } - - /** - * - * Retrieves the direction for fetching rows from - * database tables that is the default for result sets - * generated from this Statement object. - * If this Statement object has not set - * a fetch direction by calling the method setFetchDirection, - * the return value is implementation-specific. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Up to 1.8.0.x, HSQLDB always returned FETCH_FORWARD. - * - * Starting with 2.0, HSQLDB returns FETCH_FORWARD by default, or - * whatever value has been explicitly assigned by invoking - * setFetchDirection. - * . - *

    - * - * - * @return the default fetch direction for result sets generated - * from this Statement object - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - * @see #setFetchDirection - */ - public synchronized int getFetchDirection() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return fetchDirection; - } - - /** - * - * (JDBC4 clarification:) - * Gives the JDBC driver a hint as to the number of rows that should - * be fetched from the database when more rows are needed for - * ResultSet objects generated by this Statement. - * If the value specified is zero, then the hint is ignored. - * The default value is zero. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB uses the specified value as a hint, but may process more or fewer - * rows than specified. - *

    - * - * - * @param rows the number of rows to fetch - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * (JDBC4 modified:) - * condition {@code rows >= 0} is not satisfied. - * @since JDK 1.2 - * @see #getFetchSize - */ - public synchronized void setFetchSize(int rows) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (rows < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - - fetchSize = rows; - } - - /** - * - * Retrieves the number of result set rows that is the default - * fetch size for ResultSet objects - * generated from this Statement object. - * If this Statement object has not set - * a fetch size by calling the method setFetchSize, - * the return value is implementation-specific. - * - * - * - *
    - * HSQLDB-Specific Information

    - * - * HSQLDB returns 0 by default, or the fetch size specified by setFetchSize - *

    - * - * - * @return the default fetch size for result sets generated - * from this Statement object - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - * @see #setFetchSize - */ - public synchronized int getFetchSize() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return fetchSize; - } - - /** - * - * Retrieves the result set concurrency for ResultSet objects - * generated by this Statement object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports CONCUR_READ_ONLY and - * CONCUR_READ_UPDATEBLE concurrency. - *

    - * - * - * @return either ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - */ - public synchronized int getResultSetConcurrency() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return ResultProperties.getJDBCConcurrency(rsProperties); - } - - /** - * - * Retrieves the result set type for ResultSet objects - * generated by this Statement object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 1.7.0 and later versions support TYPE_FORWARD_ONLY - * and TYPE_SCROLL_INSENSITIVE. - *

    - * - * - * @return one of ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - */ - public synchronized int getResultSetType() throws SQLException { - - // fredt - omit checkClosed() in order to be able to handle the result of a - // SHUTDOWN query - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return ResultProperties.getJDBCScrollability(rsProperties); - } - - /** - * - * Empties this Statement object's current list of - * SQL commands. - *

    - * (JDBC4 clarification:)

    - * NOTE: Support of an ability to batch updates is optional. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 1.7.2, this feature is supported. - *

    - * - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * driver does not support batch updates - * @see #addBatch - * @since JDK 1.2 - */ - public synchronized void clearBatch() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (isBatch) { - resultOut.getNavigator().clear(); - } - } - - /** - * - * Retrieves the Connection object - * that produced this Statement object. - * - * - * @return the connection that produced this statement - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - */ - public synchronized Connection getConnection() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return connection; - } - - //----------------------------- JDBC 4.0 ----------------------------------- - boolean poolable = true; - - /** - * Requests that a Statement be pooled or not pooled. The value - * specified is a hint to the statement pool implementation indicating - * whether the application wants the statement to be pooled. It is up to - * the statement pool manager as to whether the hint is used. - *

    - * The poolable value of a statement is applicable to both internal - * statement caches implemented by the driver and external statement caches - * implemented by application servers and other applications. - *

    - * By default, a Statement is not poolable when created, and - * a PreparedStatement and CallableStatement - * are poolable when created. - *

    - * @param poolable requests that the statement be pooled if true and - * that the statement not be pooled if false - *

    - * @throws SQLException if this method is called on a closed - * Statement - *

    - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized void setPoolable(boolean poolable) - throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - this.poolable = poolable; - } - - /** - * Returns a value indicating whether the Statement - * is poolable or not. - *

    - * @return true if the Statement - * is poolable; false otherwise - * @throws SQLException if this method is called on a closed - * Statement - *

    - * @since JDK 1.6, HSQLDB 2.0 - *

    - * @see #setPoolable(boolean) setPoolable(boolean) - */ - public synchronized boolean isPoolable() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - return this.poolable; - } - - // ------------------- java.sql.Wrapper implementation --------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return the - * result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 2.0 - */ - @SuppressWarnings("unchecked") - public T unwrap(Class iface) throws java.sql.SQLException { - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isWrapperFor( - java.lang.Class iface) throws java.sql.SQLException { - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - - //------------------------- JDBC 4.2 ----------------------------------- - - /** - * Retrieves the current result as an update count; if the result - * is a ResultSet object or there are no more results, -1 - * is returned. This method should be called only once per result. - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The public implementation will throw {@code UnsupportedOperationException} - * - * @return the current result as an update count; -1 if the current result - * is a ResultSet object or there are no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - * @since 1.8 - */ -//#ifdef JAVA8 - public synchronized long getLargeUpdateCount() throws SQLException { - return super.getUpdateCount(); - } - -//#endif JAVA8 - - /** - * Sets the limit for the maximum number of rows that any - * ResultSet object generated by this Statement - * object can contain to the given number. - * If the limit is exceeded, the excess - * rows are silently dropped. - *

    - * This method should be used when the row limit may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The default implementation will throw {@code UnsupportedOperationException} - * - * @param max the new max rows limit; zero means there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code max >= 0} is not satisfied - * @see #getMaxRows - * @since 1.8 - */ -//#ifdef JAVA8 - public synchronized void setLargeMaxRows(long max) throws SQLException { - - int maxRows = max > Integer.MAX_VALUE ? Integer.MAX_VALUE : - (int) max; - setMaxRows(maxRows); - } - -//#endif JAVA8 - - /** - * Retrieves the maximum number of rows that a - * ResultSet object produced by this - * Statement object can contain. If this limit is exceeded, - * the excess rows are silently dropped. - *

    - * This method should be used when the returned row limit may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The default implementation will return {@code 0} - * - * @return the current maximum number of rows for a ResultSet - * object produced by this Statement object; - * zero means there is no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setMaxRows - * @since 1.8 - */ -//#ifdef JAVA8 - public synchronized long getLargeMaxRows() throws SQLException { - return maxRows; - } - -//#endif JAVA8 - - /** - * Submits a batch of commands to the database for execution and - * if all commands execute successfully, returns an array of update counts. - * The long elements of the array that is returned are ordered - * to correspond to the commands in the batch, which are ordered - * according to the order in which they were added to the batch. - * The elements in the array returned by the method {@code executeLargeBatch} - * may be one of the following: - *

      - *
    1. A number greater than or equal to zero -- indicates that the - * command was processed successfully and is an update count giving the - * number of rows in the database that were affected by the command's - * execution - *
    2. A value of SUCCESS_NO_INFO -- indicates that the command was - * processed successfully but that the number of rows affected is - * unknown - *

      - * If one of the commands in a batch update fails to execute properly, - * this method throws a BatchUpdateException, and a JDBC - * driver may or may not continue to process the remaining commands in - * the batch. However, the driver's behavior must be consistent with a - * particular DBMS, either always continuing to process commands or never - * continuing to process commands. If the driver continues processing - * after a failure, the array returned by the method - * BatchUpdateException.getLargeUpdateCounts - * will contain as many elements as there are commands in the batch, and - * at least one of the elements will be the following: - * - *

    3. A value of EXECUTE_FAILED -- indicates that the command failed - * to execute successfully and occurs only if a driver continues to - * process commands after a command fails - *
    - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The default implementation will throw {@code UnsupportedOperationException} - * - * @return an array of update counts containing one element for each - * command in the batch. The elements of the array are ordered according - * to the order in which commands were added to the batch. - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * driver does not support batch statements. Throws {@link BatchUpdateException} - * (a subclass of SQLException) if one of the commands sent to the - * database fails to execute properly or attempts to return a result set. - * @throws SQLTimeoutException when the driver has determined that the - * timeout value that was specified by the {@code setQueryTimeout} - * method has been exceeded and has at least attempted to cancel - * the currently running {@code Statement} - * - * @see #addBatch - * @see DatabaseMetaData#supportsBatchUpdates - * @since 1.8 - */ -//#ifdef JAVA8 - public synchronized long[] executeLargeBatch() throws SQLException { - int[] updateCounts = executeBatch(); - - long[] longCounts = new long[updateCounts.length]; - - for(int i = 0; i < updateCounts.length; i++) { - longCounts[i] = updateCounts[i]; - } - - return longCounts; - } - -//#endif JAVA8 - - /** - *

    Sets the value of the designated parameter with the given object. - * - * If the second argument is an {@code InputStream} then the stream - * must contain the number of bytes specified by scaleOrLength. - * If the second argument is a {@code Reader} then the reader must - * contain the number of characters specified by scaleOrLength. If these - * conditions are not true the driver will generate a - * {@code SQLException} when the prepared statement is executed. - * - *

    The given Java object will be converted to the given targetSqlType - * before being sent to the database. - * - * If the object has a custom mapping (is of a class implementing the - * interface {@code SQLData}), - * the JDBC driver should call the method {@code SQLData.writeSQL} to - * write it to the SQL data stream. - * If, on the other hand, the object is of a class implementing - * {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob}, - * {@code Struct}, {@code java.net.URL}, - * or {@code Array}, the driver should pass it to the database as a - * value of the corresponding SQL type. - * - *

    Note that this method may be used to pass database-specific - * abstract data types. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type to be sent to the database. The - * scale argument may further qualify this type. - * @param scaleOrLength for {@code java.sql.JDBCType.DECIMAL} - * or {@code java.sql.JDBCType.NUMERIC types}, - * this is the number of digits after the decimal point. For - * Java Object types {@code InputStream} and {@code Reader}, - * this is the length - * of the data in the stream or reader. For all other types, - * this value will be ignored. - * @exception SQLException if parameterIndex does not correspond to a - * parameter marker in the SQL statement; if a database access error occurs - * or this method is called on a closed {@code PreparedStatement} or - * if the Java Object specified by x is an InputStream - * or Reader object and the value of the scale parameter is less - * than zero - * @exception SQLFeatureNotSupportedException if - * the JDBC driver does not support the specified targetSqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public synchronized void setObject(int parameterIndex, Object x, SQLType targetSqlType, - int scaleOrLength) throws SQLException { - int typeNo = targetSqlType.getVendorTypeNumber().intValue(); - setObject(parameterIndex, x, typeNo, scaleOrLength); - } - -//#endif JAVA8 - - /** - * Sets the value of the designated parameter with the given object. - * - * This method is similar to {@link #setObject(int parameterIndex, - * Object x, SQLType targetSqlType, int scaleOrLength)}, - * except that it assumes a scale of zero. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param parameterIndex the first parameter is 1, the second is 2, ... - * @param x the object containing the input parameter value - * @param targetSqlType the SQL type to be sent to the database - * @exception SQLException if parameterIndex does not correspond to a - * parameter marker in the SQL statement; if a database access error occurs - * or this method is called on a closed {@code PreparedStatement} - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * the specified targetSqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public synchronized void setObject(int parameterIndex, Object x, SQLType targetSqlType) - throws SQLException { - int typeNo = targetSqlType.getVendorTypeNumber().intValue(); - setObject(parameterIndex, x, typeNo); - } - -//#endif JAVA8 - - /** - * Executes the SQL statement in this PreparedStatement object, - * which must be an SQL Data Manipulation Language (DML) statement, - * such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The default implementation will throw {@code UnsupportedOperationException} - * - * @return either (1) the row count for SQL Data Manipulation Language - * (DML) statements or (2) 0 for SQL statements that return nothing - * @exception SQLException if a database access error occurs; - * this method is called on a closed PreparedStatement - * or the SQL statement returns a ResultSet object - * @throws SQLTimeoutException when the driver has determined that the - * timeout value that was specified by the {@code setQueryTimeout} - * method has been exceeded and has at least attempted to cancel - * the currently running {@code Statement} - * @since 1.8 - */ - public synchronized long executeLargeUpdate() throws SQLException { - return executeUpdate(); - } - - //-------------------- Internal Implementation ----------------------------- - - /** - * Constructs a statement that produces results of the requested - * type.

    - * - * A prepared statement must be a single SQL statement.

    - * - * @param c the Connection used execute this statement - * @param sql the SQL statement this object represents - * @param resultSetType the type of result this statement will produce (scrollability) - * @param resultSetConcurrency (updatability) - * @param resultSetHoldability (validity beyond commit) - * @param generatedKeys internal mode of handling generated key reporting - * @param generatedIndexes column indexes for generated keys - * @param generatedNames column names for generated keys are given - * @throws HsqlException if the statement is not accepted by the database - * @throws SQLException if preprocessing by driver fails - */ - JDBCPreparedStatement(JDBCConnection c, String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability, - int generatedKeys, int[] generatedIndexes, - String[] generatedNames) - throws HsqlException, SQLException { - - isResult = false; - connection = c; - connectionIncarnation = connection.incarnation; - session = c.sessionProxy; - sql = c.nativeSQL(sql); - resultOut = Result.newPrepareStatementRequest(); - - int props = ResultProperties.getValueForJDBC(resultSetType, - resultSetConcurrency, resultSetHoldability); - - resultOut.setPrepareOrExecuteProperties(sql, 0, 0, 0, queryTimeout, - props, generatedKeys, generatedIndexes, generatedNames); - - Result in = session.execute(resultOut); - - if (in.mode == ResultConstants.ERROR) { - throw JDBCUtil.sqlException(in); - } - - rootWarning = null; - - Result current = in; - - while (current.getChainedResult() != null) { - current = current.getUnlinkChainedResult(); - - if (current.isWarning()) { - SQLWarning w = JDBCUtil.sqlWarning(current); - - if (rootWarning == null) { - rootWarning = w; - } else { - rootWarning.setNextWarning(w); - } - } - } - - connection.setWarnings(rootWarning); - - statementID = in.getStatementID(); - statementRetType = in.getStatementType(); - resultMetaData = in.metaData; - parameterMetaData = in.parameterMetaData; - parameterTypes = parameterMetaData.getParameterTypes(); - parameterModes = parameterMetaData.paramModes; - rsProperties = in.rsProperties; - - // - int paramCount = parameterMetaData.getColumnCount(); - - parameterValues = new Object[paramCount]; - parameterSet = new boolean[paramCount]; - streamLengths = new long[paramCount]; - - for (int i = 0; i < paramCount; i++) { - if (parameterTypes[i].isLobType()) { - hasLOBs = true; - - break; - } - } - - // - resultOut = Result.newPreparedExecuteRequest(parameterTypes, - statementID); - - resultOut.setStatement(in.getStatement()); - - // for toString() - this.sql = sql; - } - - /** - * Constructor for updatable ResultSet - */ - JDBCPreparedStatement(JDBCConnection c, Result result) { - - isResult = true; - connection = c; - connectionIncarnation = connection.incarnation; - session = c.sessionProxy; - - int paramCount = result.metaData.getExtendedColumnCount(); - - parameterMetaData = result.metaData; - parameterTypes = result.metaData.columnTypes; - parameterModes = new byte[paramCount]; - parameterValues = new Object[paramCount]; - parameterSet = new boolean[paramCount]; - streamLengths = new long[paramCount]; - - // - for (int i = 0; i < paramCount; i++) { - parameterModes[i] = SchemaObject.ParameterModes.PARAM_IN; - - if (parameterTypes[i].isLobType()) { - hasLOBs = true; - } - } - - // - resultOut = Result.newUpdateResultRequest(parameterTypes, - result.getResultId()); - } - - /** - * Checks if execution does or does not generate a single row - * update count, throwing if the argument, yes, does not match.

    - * - * @param type type of statement regarding what it returns - * something other than a single row update count. - * @throws SQLException if the argument, yes, does not match - */ - protected void checkStatementType(int type) throws SQLException { - - if (type != statementRetType) { - if (statementRetType == StatementTypes.RETURN_COUNT) { - throw JDBCUtil.sqlException(ErrorCode.X_07504); - } else { - throw JDBCUtil.sqlException(ErrorCode.X_07503); - } - } - } - - protected void checkParameterIndex(int i) throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (i < 1 || i > parameterValues.length) { - String msg = "parameter index out of range: " + i; - - throw JDBCUtil.outOfRangeArgument(msg); - } - } - - /** - * Checks if the specified parameter index value is valid in terms of - * setting an IN or IN OUT parameter value.

    - * - * @param parameterIndex The parameter index to check - * @throws SQLException if the specified parameter index is invalid - */ - protected void checkSetParameterIndex(int parameterIndex) - throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (parameterIndex < 1 || parameterIndex > parameterValues.length) { - String msg = "parameter index out of range: " + parameterIndex; - - throw JDBCUtil.outOfRangeArgument(msg); - } - - if (parameterModes[parameterIndex - 1] - == SchemaObject.ParameterModes.PARAM_OUT) { - String msg = "Not IN or INOUT mode for parameter: " - + parameterIndex; - - throw JDBCUtil.invalidArgument(msg); - } - } - - /** - * Checks if the specified parameter index value is valid in terms of - * getting an OUT or INOUT parameter value.

    - * - * @param parameterIndex The parameter index to check - * @throws SQLException if the specified parameter index is invalid - */ - protected void checkGetParameterIndex(int parameterIndex) - throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - if (parameterIndex < 1 || parameterIndex > parameterValues.length) { - String msg = "parameter index out of range: " + parameterIndex; - - throw JDBCUtil.outOfRangeArgument(msg); - } - - int mode = parameterModes[parameterIndex - 1]; - - switch (mode) { - - case SchemaObject.ParameterModes.PARAM_UNKNOWN : - case SchemaObject.ParameterModes.PARAM_OUT : - case SchemaObject.ParameterModes.PARAM_INOUT : - break; - - case SchemaObject.ParameterModes.PARAM_IN : - default : - String msg = "Not OUT or INOUT mode for parameter: " - + parameterIndex; - - throw JDBCUtil.invalidArgument(msg); - } - } - - /** - * Called just before execution or adding to batch, this ensures all the - * parameters have been set.

    - * - * If a parameter has been set using a stream method, it should be set - * again for the next reuse. When set using other methods, the parameter - * setting is retained for the next use. - * @throws SQLException if a parameter has not been set - */ - private void checkParametersSet() throws SQLException { - - if (isResult) { - return; - } - - for (int i = 0; i < parameterSet.length; i++) { - if (parameterModes[i] != SchemaObject.ParameterModes.PARAM_OUT) { - if (!parameterSet[i]) { - throw JDBCUtil.sqlException( - ErrorCode.JDBC_PARAMETER_NOT_SET); - } - } - } - } - - /** - * The internal parameter value setter always converts the parameter to - * the type required for data transmission. - * - * @param parameterIndex parameter index - * @param o object - * @throws SQLException if either argument is not acceptable. - */ - void setParameter(int parameterIndex, Object o) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - int index = parameterIndex - 1; - - if (o == null) { - parameterValues[index] = null; - parameterSet[index] = true; - - return; - } - - Type outType = parameterTypes[index]; - - switch (outType.typeCode) { - - case Types.OTHER : - try { - if (connection.isStoreLiveObject) { - o = new JavaObjectDataInternal(o); - - break; - } - - if (o instanceof Serializable) { - o = new JavaObjectData((Serializable) o); - - break; - } - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42563); - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - try { - if (o instanceof Boolean) { - o = outType.convertToDefaultType(session, o); - - break; - } - - if (o instanceof Integer) { - o = outType.convertToDefaultType(session, o); - - break; - } - - if (o instanceof byte[]) { - o = outType.convertToDefaultType(session, o); - - break; - } - - if (o instanceof String) { - o = outType.convertToDefaultType(session, o); - - break; - } - - if (o instanceof BitSet) { - o = outType.convertToDefaultType(session, o); - - break; - } - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42563); - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_GUID : - if (o instanceof byte[]) { - o = new BinaryData((byte[]) o, !connection.isNetConn); - - break; - } - - if (o instanceof UUID) { - o = BinaryUUIDType.getBinary((UUID) o); - - break; - } - - try { - if (o instanceof String) { - o = outType.convertToDefaultType(session, o); - - break; - } - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42563); - case Types.SQL_ARRAY : - if (o instanceof Array) { - setArray(parameterIndex, (Array) o); - - return; - } - - if (o instanceof ArrayList) { - o = ((ArrayList) o).toArray(); - } - - if (o instanceof Object[]) { - Type baseType = outType.collectionBaseType(); - Object[] array = (Object[]) o; - Object[] data = new Object[array.length]; - - for (int j = 0; j < data.length; j++) { - data[j] = baseType.convertJavaToSQL(session, array[j]); - } - - o = data; - - break; - } - - throw JDBCUtil.sqlException(ErrorCode.X_42563); - case Types.SQL_BLOB : - setBlobParameter(parameterIndex, o); - - return; - - case Types.SQL_CLOB : - setClobParameter(parameterIndex, o); - - return; - - case Types.SQL_DATE : - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIME : - case Types.SQL_TIMESTAMP : { - try { - if (o instanceof String) { - o = outType.convertToType(session, o, - Type.SQL_VARCHAR); - - break; - } - - o = outType.convertJavaToSQL(session, o); - - break; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - try { - if (o instanceof String) { - o = outType.convertToType(session, o, - Type.SQL_VARCHAR); - - break; - } else if (o instanceof Boolean) { - boolean value = ((Boolean) o).booleanValue(); - - o = value ? Integer.valueOf(1) - : Integer.valueOf(0); - } - - o = outType.convertToDefaultType(session, o); - - break; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - case Types.SQL_VARCHAR : { - if (o instanceof String) { - break; - } - - try { - o = outType.convertToDefaultType(session, o); - - break; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - case Types.SQL_CHAR : { - if (o instanceof String) { - break; - } - - if (outType.precision == 1) { - if (o instanceof Character) { - o = String.valueOf(((Character) o).charValue()); - - break; - } else if (o instanceof Boolean) { - o = ((Boolean) o).booleanValue() ? "1" - : "0"; - - break; - } - } - - try { - o = outType.convertToDefaultType(session, o); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - break; - } - default : - try { - if (outType.isIntervalType()) { - o = outType.convertJavaToSQL(session, o); - break; - } - - o = outType.convertToDefaultType(session, o); - - break; - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - parameterValues[index] = o; - parameterSet[index] = true; - } - - void setClobParameter(int i, Object o) throws SQLException { - setClobParameter(i, o, 0); - } - - void setClobParameter(int i, Object o, - long streamLength) throws SQLException { - - if (o instanceof JDBCClobClient) { - JDBCClobClient clob = (JDBCClobClient) o; - - if (!clob.session.getDatabaseUniqueName().equals( - session.getDatabaseUniqueName())) { - streamLength = clob.length(); - - Reader is = clob.getCharacterStream(); - - parameterValues[i - 1] = is; - streamLengths[i - 1] = streamLength; - parameterSet[i - 1] = true; - - return; - } - - parameterValues[i - 1] = o; - parameterSet[i - 1] = Boolean.TRUE; - - return; - } else if (o instanceof Clob) { - parameterValues[i - 1] = o; - parameterSet[i - 1] = Boolean.TRUE; - - return; - } else if (o instanceof ClobInputStream) { - ClobInputStream is = (ClobInputStream) o; - - if (is.session.getDatabaseUniqueName().equals( - session.getDatabaseUniqueName())) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, - "invalid Reader"); - } - - parameterValues[i - 1] = o; - streamLengths[i - 1] = streamLength; - parameterSet[i - 1] = true; - - return; - } else if (o instanceof Reader) { - parameterValues[i - 1] = o; - streamLengths[i - 1] = streamLength; - parameterSet[i - 1] = true; - - return; - } else if (o instanceof String) { - JDBCClob clob = new JDBCClob((String) o); - - parameterValues[i - 1] = clob; - parameterSet[i - 1] = true; - - return; - } - - throw JDBCUtil.invalidArgument(); - } - - /** - * setParameterForBlob - * - * @param i int - * @param o Object - */ - void setBlobParameter(int i, Object o) throws SQLException { - setBlobParameter(i, o, 0); - } - - void setBlobParameter(int i, Object o, - long streamLength) throws SQLException { - - if (o instanceof JDBCBlobClient) { - JDBCBlobClient blob = (JDBCBlobClient) o; - - if (!blob.session.getDatabaseUniqueName().equals( - session.getDatabaseUniqueName())) { - streamLength = blob.length(); - - InputStream is = blob.getBinaryStream(); - - parameterValues[i - 1] = is; - streamLengths[i - 1] = streamLength; - parameterSet[i - 1] = true; - - return; - } - - // in the same database - parameterValues[i - 1] = o; - parameterSet[i - 1] = Boolean.TRUE; - - return; - } else if (o instanceof Blob) { - parameterValues[i - 1] = o; - parameterSet[i - 1] = true; - - return; - } else if (o instanceof BlobInputStream) { - BlobInputStream is = (BlobInputStream) o; - - if (is.session.getDatabaseUniqueName().equals( - session.getDatabaseUniqueName())) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, - "invalid Reader"); - } - - // in the same database ? see if it blocks in - parameterValues[i - 1] = o; - streamLengths[i - 1] = streamLength; - parameterSet[i - 1] = true; - - return; - } else if (o instanceof InputStream) { - parameterValues[i - 1] = o; - streamLengths[i - 1] = streamLength; - parameterSet[i - 1] = true; - - return; - } else if (o instanceof byte[]) { - JDBCBlob blob = new JDBCBlob((byte[]) o); - - parameterValues[i - 1] = blob; - parameterSet[i - 1] = true; - - return; - } - - throw JDBCUtil.invalidArgument(); - } - - /** - * Used with int and narrower integral primitives - * @param parameterIndex parameter index - * @param value object to set - * @throws SQLException if either argument is not acceptable - */ - void setIntParameter(int parameterIndex, int value) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - int index = parameterIndex - 1; - int outType = parameterTypes[index].typeCode; - - switch (outType) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : { - Object o = Integer.valueOf(value); - - parameterValues[index] = o; - parameterSet[index] = true; - - break; - } - case Types.SQL_BIGINT : { - Object o = Long.valueOf(value); - - parameterValues[index] = o; - parameterSet[index] = true; - - break; - } - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.OTHER : - throw JDBCUtil.sqlException(ErrorCode.X_42563); - default : - setParameter(parameterIndex, Integer.valueOf(value)); - } - } - - /** - * Used with long and narrower integral primitives. Conversion to BINARY - * or OTHER types will throw here and not passed to setParameter(). - * - * @param parameterIndex parameter index - * @param value object to set - * @throws SQLException if either argument is not acceptable - */ - void setLongParameter(int parameterIndex, long value) throws SQLException { - - checkSetParameterIndex(parameterIndex); - - int index = parameterIndex - 1; - int outType = parameterTypes[index].typeCode; - - switch (outType) { - - case Types.SQL_BIGINT : - Object o = Long.valueOf(value); - - parameterValues[index] = o; - parameterSet[index] = true; - break; - - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.OTHER : - throw JDBCUtil.sqlException(ErrorCode.X_42563); - default : - setParameter(parameterIndex, Long.valueOf(value)); - } - } - - private void performPreExecute() throws SQLException, HsqlException { - - if (!hasLOBs) { - return; - } - - for (int i = 0; i < parameterValues.length; i++) { - Object value = parameterValues[i]; - - if (value == null) { - continue; - } - - if (parameterTypes[i].typeCode == Types.SQL_BLOB) { - long id; - BlobDataID blob = null; - - if (value instanceof JDBCBlobClient) { - - // check or fix id mismatch - blob = ((JDBCBlobClient) value).blob; - id = blob.getId(); - } else if (value instanceof Blob) { - long length = ((Blob) value).length(); - - blob = session.createBlob(length); - id = blob.getId(); - - InputStream stream = ((Blob) value).getBinaryStream(); - ResultLob resultLob = - ResultLob.newLobCreateBlobRequest(session.getId(), id, - stream, length); - - session.allocateResultLob(resultLob); - resultOut.addLobResult(resultLob); - } else if (value instanceof InputStream) { - long length = streamLengths[i]; - long createLength = length > 0 ? length - : 0; - - blob = session.createBlob(createLength); - id = blob.getId(); - - InputStream stream = (InputStream) value; - ResultLob resultLob = - ResultLob.newLobCreateBlobRequest(session.getId(), id, - stream, length); - - session.allocateResultLob(resultLob); - resultOut.addLobResult(resultLob); - } else if (value instanceof BlobDataID) { - blob = (BlobDataID) value; - } - - parameterValues[i] = blob; - } else if (parameterTypes[i].typeCode == Types.SQL_CLOB) { - long id; - ClobDataID clob = null; - - if (value instanceof JDBCClobClient) { - - // check or fix id mismatch - clob = ((JDBCClobClient) value).clob; - id = clob.getId(); - } else if (value instanceof Clob) { - long length = ((Clob) value).length(); - Reader reader = ((Clob) value).getCharacterStream(); - - clob = session.createClob(length); - id = clob.getId(); - - ResultLob resultLob = - ResultLob.newLobCreateClobRequest(session.getId(), id, - reader, length); - - session.allocateResultLob(resultLob); - resultOut.addLobResult(resultLob); - } else if (value instanceof Reader) { - long length = streamLengths[i]; - long createLength = length > 0 ? length - : 0; - - clob = session.createClob(createLength); - id = clob.getId(); - - Reader reader = (Reader) value; - ResultLob resultLob = - ResultLob.newLobCreateClobRequest(session.getId(), id, - reader, length); - - session.allocateResultLob(resultLob); - resultOut.addLobResult(resultLob); - } else if (value instanceof ClobDataID) { - clob = (ClobDataID) value; - } - - parameterValues[i] = clob; - } - } - } - - /** - * Internal result producer for JDBCStatement (sqlExecDirect mode). - *

    - * - * @throws SQLException when a database access error occurs - */ - void fetchResult() throws SQLException { - - if (isClosed || connection.isClosed) { - checkClosed(); - } - - closeResultData(); - checkParametersSet(); - - if (isBatch) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_07505); - } - - // - if (isResult) { - resultOut.setPreparedResultUpdateProperties(parameterValues); - } else { - resultOut.setPreparedExecuteProperties(parameterValues, maxRows, - fetchSize, rsProperties, - queryTimeout); - } - - try { - performPreExecute(); - - resultIn = session.execute(resultOut); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } finally { - performPostExecute(); - } - - if (resultIn.mode == ResultConstants.ERROR) { - throw JDBCUtil.sqlException(resultIn); - } - - if (resultIn.isData()) { - currentResultSet = new JDBCResultSet(connection, this, resultIn, - resultIn.metaData); - } else if (statementRetType == StatementTypes.RETURN_RESULT) { - getMoreResults(); - } - } - - /** - * processes chained warnings and any generated columns result set - */ - void performPostExecute() throws SQLException { - super.performPostExecute(); - } - - /** The parameter values for the next non-batch execution. */ - protected Object[] parameterValues; - - /** Flags for bound variables. */ - protected boolean[] parameterSet; - - /** The SQL types of the parameters. */ - protected Type[] parameterTypes; - - /** The (IN, IN OUT, or OUT) modes of parameters */ - protected byte[] parameterModes; - - /** Lengths for streams. */ - protected long[] streamLengths; - - /** Has one or more CLOB / BLOB type parameters. */ - protected boolean hasLOBs; - - /** Is in batch mode. */ - protected boolean isBatch; - - /** Description of result set metadata. */ - protected ResultMetaData resultMetaData; - - /** Description of parameter metadata. */ - protected ResultMetaData parameterMetaData; - - /** This object's one and one ResultSetMetaData object. */ - protected JDBCResultSetMetaData resultSetMetaData; - - /** This object's one and only ParameterMetaData object. */ - protected ParameterMetaData pmd; - - /** The SQL character sequence that this object represents. */ - protected String sql; - - /** ID of the statement. */ - protected long statementID; - - /** Statement type - whether it generates a row update count or a result set. */ - protected int statementRetType; - - /** Is part of a Result. */ - protected final boolean isResult; - - /** The session attribute of the connection */ - protected SessionInterface session; - - public String getSQL() { - return sql; - } - - public long getStatementID() { - return statementID; - } - - public boolean isRowCount() { - return statementRetType == StatementTypes.RETURN_COUNT; - } - - public JDBCResultSetMetaData getResultSetMetaData() { - return resultSetMetaData; - } - - public ResultMetaData getParameterMetaDataDirect() { - return parameterMetaData; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCResultSet.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCResultSet.java deleted file mode 100644 index d4d22f73..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCResultSet.java +++ /dev/null @@ -1,7783 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.NClob; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Map; - -import org.hsqldb.ColumnBase; -import org.hsqldb.HsqlException; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.IntValueHashMap; -import org.hsqldb.lib.StringInputStream; -import org.hsqldb.lib.java.JavaSystem; -import org.hsqldb.navigator.RowSetNavigator; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultConstants; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.result.ResultProperties; -import org.hsqldb.types.BinaryData; -import org.hsqldb.types.BinaryUUIDType; -import org.hsqldb.types.BlobData; -import org.hsqldb.types.BlobDataID; -import org.hsqldb.types.ClobDataID; -import org.hsqldb.types.DateTimeType; -import org.hsqldb.types.IntervalMonthData; -import org.hsqldb.types.IntervalSecondData; -import org.hsqldb.types.IntervalType; -import org.hsqldb.types.JavaObjectData; -import org.hsqldb.types.TimeData; -import org.hsqldb.types.TimestampData; -import org.hsqldb.types.Type; -import org.hsqldb.types.Types; - -//#ifdef JAVA8 -import java.sql.JDBCType; -import java.sql.SQLType; -import java.time.Duration; -import java.time.Period; -//#endif JAVA8 - - -/* $Id: JDBCResultSet.java 6656 2023-05-29 15:55:53Z fredt $ */ - -//campbell-burnet@users 20051207 - patch 1.9.0 - initial JDBC 4.0 support work -//fredt@users 20060431 - patch 1.9.0 rewrite with RowSetNavigator -//campbell-burnet@users 20060522 - doc 1.9.0 - full synch up to Mustang Build 84 -// Revision 1.21 2006/07/12 12:27:25 boucherb -// patch 1.9.0 -// - full synch up to Mustang b90 - -/** - * - * A table of data representing a database result set, which - * is usually generated by executing a statement that queries the database. - * - *

    A ResultSet object maintains a cursor pointing - * to its current row of data. Initially the cursor is positioned - * before the first row. The next method moves the - * cursor to the next row, and because it returns false - * when there are no more rows in the ResultSet object, - * it can be used in a while loop to iterate through - * the result set. - *

    - * A default ResultSet object is not updatable and - * has a cursor that moves forward only. Thus, you can - * iterate through it only once and only from the first row to the - * last row. It is possible to - * produce ResultSet objects that are scrollable and/or - * updatable. The following code fragment, in which con - * is a valid Connection object, illustrates how to make - * a result set that is scrollable and insensitive to updates by others, and - * that is updatable. See ResultSet fields for other - * options. - *

    - *
    - *       Statement stmt = con.createStatement(
    - *                                      ResultSet.TYPE_SCROLL_INSENSITIVE,
    - *                                      ResultSet.CONCUR_UPDATABLE);
    - *       ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
    - *       // rs will be scrollable, will not show changes made by others,
    - *       // and will be updatable
    - *
    - * 
    - * The ResultSet interface provides - * getter methods (getBoolean, getLong, and so on) - * for retrieving column values from the current row. - * Values can be retrieved using either the index number of the - * column or the name of the column. In general, using the - * column index will be more efficient. Columns are numbered from 1. - * For maximum portability, result set columns within each row should be - * read in left-to-right order, and each column should be read only once. - * - *

    For the getter methods, a JDBC driver attempts - * to convert the underlying data to the Java type specified in the - * getter method and returns a suitable Java value. The JDBC specification - * has a table showing the allowable mappings from SQL types to Java types - * that can be used by the ResultSet getter methods. - * - *

    Column names used as input to getter methods are case - * insensitive. When a getter method is called with - * a column name and several columns have the same name, - * the value of the first matching column will be returned. - * The column name option is - * designed to be used when column names are used in the SQL - * query that generated the result set. - * For columns that are NOT explicitly named in the query, it - * is best to use column numbers. (JDBC4 clarification:) If column names are used, the - * programmer should take care to guarantee that they uniquely refer to - * the intended columns, which can be assured with the SQL AS clause. - *

    - * A set of updater methods were added to this interface - * in the JDBC 2.0 API (Java™ 2 SDK, - * Standard Edition, version 1.2). The comments regarding parameters - * to the getter methods also apply to parameters to the - * updater methods. - *

    - * The updater methods may be used in two ways: - *

      - *
    1. to update a column value in the current row. In a scrollable - * ResultSet object, the cursor can be moved backwards - * and forwards, to an absolute position, or to a position - * relative to the current row. - * The following code fragment updates the NAME column - * in the fifth row of the ResultSet object - * rs and then uses the method updateRow - * to update the data source table from which rs was derived. - *
      - *
      - *       rs.absolute(5); // moves the cursor to the fifth row of rs
      - *       rs.updateString("NAME", "AINSWORTH"); // updates the
      - *          // NAME column of row 5 to be AINSWORTH
      - *       rs.updateRow(); // updates the row in the data source
      - *
      - * 
      - *
    2. - *
    3. to insert column values into the insert row. An updatable - * ResultSet object has a special row associated with - * it that serves as a staging area for building a row to be inserted. - * The following code fragment moves the cursor to the insert row, builds - * a three-column row, and inserts it into rs and into - * the data source table using the method insertRow. - *
      - *
      - *       rs.moveToInsertRow(); // moves cursor to the insert row
      - *       rs.updateString(1, "AINSWORTH"); // updates the
      - *          // first column of the insert row to be AINSWORTH
      - *       rs.updateInt(2,35); // updates the second column to be 35
      - *       rs.updateBoolean(3, true); // updates the third column to true
      - *       rs.insertRow();
      - *       rs.moveToCurrentRow();
      - *
      - * 
      - *
    4. - *
    - *

    A ResultSet object is automatically closed when the - * Statement object that - * generated it is closed, re-executed, or used - * to retrieve the next result from a sequence of multiple results. - * - *

    The number, types and properties of a ResultSet - * object's columns are provided by the ResultSetMetaData - * object returned by the ResultSet.getMetaData method. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * A ResultSet object generated by HSQLDB is by default of - * ResultSet.TYPE_FORWARD_ONLY (as is standard JDBC behavior) - * and does not allow the use of absolute and relative positioning - * methods. If a statement is created with: - * - *

    - * Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    - * 
    - * - * then the ResultSet objects it produces support - * using all of the absolute and relative positioning methods of JDBC2 - * to set the position of the current row, for example: - * - *
    - * rs.absolute(5);
    - * String fifthRowValue = rs.getString(1);
    - * rs.relative(4);
    - * String ninthRowValue = rs.getString(1);
    - * 
    - * - * Note: An HSQLDB ResultSet object stays open if it is not - * explicitly closed, even after its - * connection is closed. This is regardless of the operational mode of - * the {@link org.hsqldb.Database Database} from which it came. That is, they - * persist whether originating from a Server, - * WebServer or in-process mode Database. A connection - * opened with the property setting close_result=true closes - * any remaining open results when the connection is closed. - *

    - * - * From HSQLDB 2.0, there is full support for updatable result sets. - * Supported methods - * include all updateXXX methods for the supported types, as well as the - * {@link #insertRow}, - * {@link #updateRow}, {@link #deleteRow}, {@link #moveToInsertRow} - * methods.

    - * - * The Statement must be created with ResultSet.CONCUR_UPDATABLE instead of - * CONCUR_READ_ONLY.

    - * - * Updatability of a result set follows the SQL standards. Some or all columns - * of an updatable result set can be updated. The current row in such result sets - * can be deleted using the {@link #deleteRow} method. Some updatable result set - * can also be inserted into and support {@link #moveToInsertRow}.

    - * - * A result set is updatable if the SELECT statement - * is updatable. This includes SELECT from TABLE and updatable VIEW objects. - * An updatable SELECT statement has a single underlying table or view. - * HSQLDB supports both scrollable and forward-only result sets for updatability. - * - *

    - * -- In the SELECT below, columns A and B are updatable, any row can be
    - * -- deleted, but it is not insertable-into as column C is not directly from
    - * -- the table.
    - * SELECT A, B, A + B AS C FROM T WHERE ...
    - *
    - * -- The SELECT below can be insertable-into so long as other columns of the
    - * -- table that do not appear in the SELECT list have a default value.
    - * SELECT A, B FROM T WHERE ...
    - * 
    - * - * (fredt@users)
    - * (campbell-burnet@users)

    - * - *

    - * @see JDBCStatement#executeQuery - * @see JDBCStatement#getResultSet - * @see java.sql.ResultSetMetaData - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public class JDBCResultSet implements ResultSet { - - /** - * - * Moves the cursor froward one row from its current position. - * A ResultSet cursor is initially positioned - * before the first row; the first call to the method - * next makes the first row the current row; the - * second call makes the second row the current row, and so on. - *

    (JDBC4 clarification:) - * When a call to the next method returns false, - * the cursor is positioned after the last row. Any - * invocation of a ResultSet method which requires a - * current row will result in a SQLException being thrown. - * If the result set type is TYPE_FORWARD_ONLY, it is vendor specified - * whether their JDBC driver implementation will return false or - * throw an SQLException on a - * subsequent call to next. - * - *

    If an input stream is open for the current row, a call - * to the method next will - * implicitly close it. A ResultSet object's - * warning chain is cleared when a new row is read. - * - * - * @return true if the new current row is valid; - * false if there are no more rows - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public boolean next() throws SQLException { - - checkClosed(); - - rootWarning = null; - - return navigator.next(); - } - - /** - * - * Releases this ResultSet object's database and - * JDBC resources immediately instead of waiting for - * this to happen when it is automatically closed. - * - *

    (JDBC4 clarification:) - * The closing of a ResultSet object does not close the Blob, - * Clob or NClob objects created by the ResultSet. Blob, - * Clob or NClob objects remain valid for at least the duration of the - * transaction in which they are created, unless their free method is invoked. - *

    - * (JDBC4 clarification:) - * When a ResultSet is closed, any ResultSetMetaData - * instances that were created by calling the getMetaData - * method remain accessible. - * - *

    Note: A ResultSet object - * is automatically closed by the - * Statement object that generated it when - * that Statement object is closed, - * re-executed, or is used to retrieve the next result from a - * sequence of multiple results. - * (JDBC4 deleted:) [A ResultSet object is also automatically - * closed when it is garbage collected.] - *

    - * Calling the method close on a ResultSet - * object that is already closed is a no-op. - * - *

    - * - * - * @exception SQLException if a database access error occurs - */ - public void close() throws SQLException { - - if (navigator == null) { - return; - } - - if (ResultProperties.isHeld(rsProperties)) { - session.closeNavigator(navigator.getId()); - } else { - navigator.release(); - } - - navigator = null; - - if (autoClose && statement != null) { - statement.close(); - } - } - - /** - * - * Reports whether - * the last column read had a value of SQL NULL. - * Note that you must first call one of the getter methods - * on a column to try to read its value and then call - * the method wasNull to see if the value read was - * SQL NULL. - * - * - * @return true if the last column value read was SQL - * NULL and false otherwise - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public boolean wasNull() throws SQLException { - - checkClosed(); - - return wasNullValue; - } - - //====================================================================== - // Methods for accessing results by column index - //====================================================================== - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public String getString(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - - if (sourceType.typeCode == Types.SQL_CLOB) { - ClobDataID x = (ClobDataID) getColumnInType(columnIndex, - sourceType); - - if (x == null) { - return null; - } - - long length = x.length(session); - - if (length > Integer.MAX_VALUE) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - return x.getSubString(session, 0, (int) length); - } - - return (String) getColumnInType(columnIndex, Type.SQL_VARCHAR); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a boolean in the Java programming language. - * - * - *

    (JDBC4 clarification:) - *

    If the designated column has a datatype of CHAR or VARCHAR - * and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - * and contains a 0, a value of false is returned. If the designated column has a datatype - * of CHAR or VARCHAR - * and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - * and contains a 1, a value of true is returned. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is false - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public boolean getBoolean(int columnIndex) throws SQLException { - - Object o = getColumnInType(columnIndex, Type.SQL_BOOLEAN); - - return o == null ? false - : ((Boolean) o).booleanValue(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a byte in the Java programming language. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the numeric value to the return type. If the value is - * out of the range for the return type, an error is returned. For example, - * this can happen if getByte() or getShort() is used to retrieve a value - * of type INTEGER or BIGINT and the value is beyond the range covered by - * the return type. - * - *

    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public byte getByte(int columnIndex) throws SQLException { - - Object o = getColumnInType(columnIndex, Type.TINYINT); - - return o == null ? 0 - : ((Number) o).byteValue(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a short in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the numeric value to the return type. If the value is - * out of the range for the return type, an error is returned. For example, - * this can happen if getByte() or getShort() is used to retrieve a value - * of type INTEGER or BIGINT and the value is beyond the range covered by - * the return type. - * - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public short getShort(int columnIndex) throws SQLException { - - Object o = getColumnInType(columnIndex, Type.SQL_SMALLINT); - - return o == null ? 0 - : ((Number) o).shortValue(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * an int in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the numeric value to the return type. If the value is - * out of the range for the return type, an error is returned. For example, - * this can happen if getInt() or getLong() is used to retrieve a value - * of type DECIMAL or NUMERIC with a large precision and the value is beyond - * the range covered by the return type. - * - *

    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public int getInt(int columnIndex) throws SQLException { - - Object o = getColumnInType(columnIndex, Type.SQL_INTEGER); - - return o == null ? 0 - : ((Number) o).intValue(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a long in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the numeric value to the return type. If the value is - * out of the range for the return type, an error is returned. For example, - * this can happen if getInt() or getLong() is used to retrieve a value - * of type DECIMAL or NUMERIC with a large precision and the value is beyond - * the range covered by the return type. - * - *

    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public long getLong(int columnIndex) throws SQLException { - - Object o = getColumnInType(columnIndex, Type.SQL_BIGINT); - - return o == null ? 0 - : ((Number) o).longValue(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a float in the Java programming language. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the numeric value to the return type. If the value is - * out of the range for the return type, an error is returned. For example, - * this can happen if getFloat() or getDouble() is used to retrieve a value - * of type DECIMAL or NUMERIC with a large precision and the value is beyond - * the range covered by the return type. - * - *

    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public float getFloat(int columnIndex) throws SQLException { - - Object o = getColumnInType(columnIndex, Type.SQL_DOUBLE); - - return o == null ? (float) 0.0 - : ((Number) o).floatValue(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a double in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the numeric value to the return type. If the value is - * out of the range for the return type, an error is returned. For example, - * this can happen if getFloat() or getDouble() is used to retrieve a value - * of type DECIMAL or NUMERIC with a large precision and the value is beyond - * the range covered by the return type. - * - *

    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public double getDouble(int columnIndex) throws SQLException { - - Object o = getColumnInType(columnIndex, Type.SQL_DOUBLE); - - return o == null ? 0.0 - : ((Number) o).doubleValue(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.sql.BigDecimal in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the result and sets the scale - * with BigDecimal.ROUND_HALF_DOWN. - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param scale the number of digits to the right of the decimal point - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @deprecated - * by java.sun.com as of JDK 1.2 - */ - -//#ifdef DEPRECATEDJDBC - @Deprecated - public BigDecimal getBigDecimal(int columnIndex, - int scale) throws SQLException { - - if (scale < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - - BigDecimal bd = getBigDecimal(columnIndex); - - if (bd != null) { - bd = bd.setScale(scale, RoundingMode.DOWN); - } - - return bd; - } - -//#endif DEPRECATEDJDBC - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a byte array in the Java programming language. - * The bytes represent the raw values returned by the driver. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB returns correct values for columns of binary types - * BINARY, BIT, BLOB - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public byte[] getBytes(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - - if (sourceType.typeCode == Types.SQL_BLOB) { - BlobData x = (BlobData) getColumnInType(columnIndex, - sourceType); - - if (x == null) { - return null; - } - - long length = x.length(session); - - if (length > Integer.MAX_VALUE) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - return x.getBytes(session, 0, (int) length); - } - - Object x = getColumnInType(columnIndex, Type.SQL_VARBINARY); - - if (x == null) { - return null; - } - - return ((BinaryData) x).getBytes(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.sql.Date object in the Java programming language. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Date getDate(int columnIndex) throws SQLException { - - Object t = getColumnInType(columnIndex, Type.SQL_DATE); - - if (t == null) { - return null; - } - - return (Date) Type.SQL_DATE.convertSQLToJava(session, t); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.sql.Time object in the Java programming language. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Time getTime(int columnIndex) throws SQLException { - - Object t = getColumnInType(columnIndex, Type.SQL_TIME); - - if (t == null) { - return null; - } - - return (Time) Type.SQL_TIME.convertSQLToJava(session, t); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.sql.Timestamp object in the Java programming language. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Timestamp getTimestamp(int columnIndex) throws SQLException { - - Object t = getColumnInType(columnIndex, Type.SQL_TIMESTAMP); - - if (t == null) { - return null; - } - - return (Timestamp) Type.SQL_TIMESTAMP.convertSQLToJava(session, t); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a stream of ASCII characters. The value can then be read in chunks from the - * stream. This method is particularly - * suitable for retrieving large LONGVARCHAR values. - * The JDBC driver will - * do any necessary conversion from the database format into ASCII. - * - *

    Note: All the data in the returned stream must be - * read prior to getting the value of any other column. The next - * call to a getter method implicitly closes the stream. Also, a - * stream may return 0 when the method - * InputStream.available - * is called whether there is data available or not. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * The limitation noted above does not apply to HSQLDB.

    - * - * When the column is of type CHAR and its variations, it requires no - * conversion since it is represented internally already as a - * Java String object. When the column is not of type CHAR and its - * variations, the returned stream is based on a conversion to the - * Java String representation of the value. In either case, - * the obtained stream is always equivalent to a stream of the low order - * bytes from the value's String representation.

    - * - * HSQLDB SQL CHAR and its variations are all Unicode strings - * internally, so the recommended alternatives to this method are - * {@link #getString(int) getString}, - * {@link #getUnicodeStream(int) getUnicodeStream} (deprecated) - * and new to 1.7.0: {@link #getCharacterStream(int) getCharacterStream} - * (now preferred over the deprecated getUnicodeStream alternative). - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a Java input stream that delivers the database column value - * as a stream of one-byte ASCII characters; - * if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public java.io.InputStream getAsciiStream( - int columnIndex) throws SQLException { - - Object o = getColumnValue(columnIndex); - - if (o == null) { - return null; - } - - if (o instanceof ClobDataID) { - JDBCClobClient clob = new JDBCClobClient(session, (ClobDataID) o); - - return clob.getAsciiStream(); - } else if (o instanceof Clob) { - return ((Clob) o).getAsciiStream(); - } - - String s = getString(columnIndex); - - try { - return new ByteArrayInputStream(s.getBytes(JavaSystem.CS_US_ASCII)); - } catch (Throwable e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object - * as a stream of two-byte Unicode characters. The first byte is - * the high byte; the second byte is the low byte. - * - * The value can then be read in chunks from the - * stream. This method is particularly - * suitable for retrieving large LONGVARCHARvalues. The - * JDBC driver will do any necessary conversion from the database - * format into Unicode. - * - *

    Note: All the data in the returned stream must be - * read prior to getting the value of any other column. The next - * call to a getter method implicitly closes the stream. - * Also, a stream may return 0 when the method - * InputStream.available - * is called, whether there is data available or not. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * The limitation noted above does not apply to HSQLDB.

    - * - * When the column is of type CHAR and its variations, it requires no - * conversion since it is represented internally already as - * Java Strings. When the column is not of type CHAR and its variations, - * the returned stream is based on a conversion to the - * Java String representation of the value. In either case, - * the obtained stream is always equivalent to a stream of - * bytes from the value's String representation, with high-byte first. - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a Java input stream that delivers the database column value - * as a stream of two-byte Unicode characters; - * if the value is SQL NULL, the value returned is - * null - * - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @deprecated use getCharacterStream in place of - * getUnicodeStream - */ - -//#ifdef DEPRECATEDJDBC - @Deprecated - public java.io.InputStream getUnicodeStream( - int columnIndex) throws SQLException { - - String s = getString(columnIndex); - - if (s == null) { - return null; - } - - return new StringInputStream(s); - } - -//#endif DEPRECATEDJDBC - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a stream of - * uninterpreted bytes. The value can then be read in chunks from the - * stream. This method is particularly - * suitable for retrieving large LONGVARBINARY values. - * - *

    Note: All the data in the returned stream must be - * read prior to getting the value of any other column. The next - * call to a getter method implicitly closes the stream. Also, a - * stream may return 0 when the method - * InputStream.available - * is called whether there is data available or not. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a Java input stream that delivers the database column value - * as a stream of uninterpreted bytes; - * if the value is SQL NULL, the value returned is - * null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public java.io.InputStream getBinaryStream( - int columnIndex) throws SQLException { - - Object o = getColumnValue(columnIndex); - - if (o == null) { - return null; - } - - if (o instanceof BlobDataID) { - return ((BlobDataID) o).getBinaryStream(session); - } else if (o instanceof Blob) { - return ((Blob) o).getBinaryStream(); - } else if (o instanceof BinaryData) { - byte[] b = getBytes(columnIndex); - - return new ByteArrayInputStream(b); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - //====================================================================== - // Methods for accessing results by column label - //====================================================================== - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public String getString(String columnLabel) throws SQLException { - return getString(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a boolean in the Java programming language. - * - *

    (JDBC4 clarification:) If the designated column has a datatype of CHAR or VARCHAR - * and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - * and contains a 0, a value of false is returned. If the designated column has a datatype - * of CHAR or VARCHAR - * and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT - * and contains a 1, a value of true is returned. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is false - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public boolean getBoolean(String columnLabel) throws SQLException { - return getBoolean(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a byte in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public byte getByte(String columnLabel) throws SQLException { - return getByte(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a short in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public short getShort(String columnLabel) throws SQLException { - return getShort(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * an int in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public int getInt(String columnLabel) throws SQLException { - return getInt(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a long in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public long getLong(String columnLabel) throws SQLException { - return getLong(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a float in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public float getFloat(String columnLabel) throws SQLException { - return getFloat(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a double in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is 0 - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public double getDouble(String columnLabel) throws SQLException { - return getDouble(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.math.BigDecimal in the Java programming language. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB converts the result and sets the scale - * with BigDecimal.ROUND_HALF_DOWN. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param scale the number of digits to the right of the decimal point - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @deprecated - * by java.sun.com as of JDK 1.2 - */ - -//#ifdef DEPRECATEDJDBC - @Deprecated - public BigDecimal getBigDecimal(String columnLabel, - int scale) throws SQLException { - return getBigDecimal(findColumn(columnLabel), scale); - } - -//#endif DEPRECATEDJDBC - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a byte array in the Java programming language. - * The bytes represent the raw values returned by the driver. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public byte[] getBytes(String columnLabel) throws SQLException { - return getBytes(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.sql.Date object in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Date getDate(String columnLabel) throws SQLException { - return getDate(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.sql.Time object in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; - * if the value is SQL NULL, - * the value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Time getTime(String columnLabel) throws SQLException { - return getTime(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a java.sql.Timestamp object in the Java programming language. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Timestamp getTimestamp(String columnLabel) throws SQLException { - return getTimestamp(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a stream of - * ASCII characters. The value can then be read in chunks from the - * stream. This method is particularly - * suitable for retrieving large LONGVARCHAR values. - * The JDBC driver will - * do any necessary conversion from the database format into ASCII. - * - *

    Note: All the data in the returned stream must be - * read prior to getting the value of any other column. The next - * call to a getter method implicitly closes the stream. Also, a - * stream may return 0 when the method available - * is called whether there is data available or not. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a Java input stream that delivers the database column value - * as a stream of one-byte ASCII characters. - * If the value is SQL NULL, - * the value returned is null. - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @see #getAsciiStream(int) - */ - public java.io.InputStream getAsciiStream( - String columnLabel) throws SQLException { - return getAsciiStream(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a stream of two-byte - * Unicode characters. The first byte is the high byte; the second - * byte is the low byte. - * - * The value can then be read in chunks from the - * stream. This method is particularly - * suitable for retrieving large LONGVARCHAR values. - * The JDBC technology-enabled driver will - * do any necessary conversion from the database format into Unicode. - * - *

    Note: All the data in the returned stream must be - * read prior to getting the value of any other column. The next - * call to a getter method implicitly closes the stream. - * Also, a stream may return 0 when the method - * InputStream.available is called, whether there - * is data available or not. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a Java input stream that delivers the database column value - * as a stream of two-byte Unicode characters. - * If the value is SQL NULL, the value returned - * is null. - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @deprecated use getCharacterStream instead - * @see #getUnicodeStream(int) - */ - -//#ifdef DEPRECATEDJDBC - @Deprecated - public java.io.InputStream getUnicodeStream( - String columnLabel) throws SQLException { - return getUnicodeStream(findColumn(columnLabel)); - } - -//#endif DEPRECATEDJDBC - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a stream of uninterpreted - * bytes. - * The value can then be read in chunks from the - * stream. This method is particularly - * suitable for retrieving large LONGVARBINARY - * values. - * - *

    Note: All the data in the returned stream must be - * read prior to getting the value of any other column. The next - * call to a getter method implicitly closes the stream. Also, a - * stream may return 0 when the method available - * is called whether there is data available or not. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a Java input stream that delivers the database column value - * as a stream of uninterpreted bytes; - * if the value is SQL NULL, the result is null - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public java.io.InputStream getBinaryStream( - String columnLabel) throws SQLException { - return getBinaryStream(findColumn(columnLabel)); - } - - //===================================================================== - // Advanced features: - //===================================================================== - - /** - * - * Retrieves the first warning reported by calls on this - * ResultSet object. - * Subsequent warnings on this ResultSet object - * will be chained to the SQLWarning object that - * this method returns. - * - *

    The warning chain is automatically cleared each time a new - * row is read. This method may not be called on a ResultSet - * object that has been closed; doing so will cause an - * SQLException to be thrown. - *

    - * Note: This warning chain only covers warnings caused - * by ResultSet methods. Any warning caused by - * Statement methods - * (such as reading OUT parameters) will be chained on the - * Statement object. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not produce SQLWarning - * objects on any ResultSet object warning chain; this - * method always returns null. - *

    - * - * - * @return the first SQLWarning object reported or - * null if there are none - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public SQLWarning getWarnings() throws SQLException { - - checkClosed(); - - return rootWarning; - } - - /** - * - * Clears all warnings reported on this ResultSet object. - * After this method is called, the method getWarnings - * returns null until a new warning is - * reported for this ResultSet object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not produce SQLWarning - * objects on any ResultSet object warning chain; calls to this method - * are ignored. - *

    - * - * - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public void clearWarnings() throws SQLException { - - checkClosed(); - - rootWarning = null; - } - - /** - * - * Retrieves the name of the SQL cursor used by this ResultSet - * object. - * - *

    In SQL, a result table is retrieved through a cursor that is - * named. The current row of a result set can be updated or deleted - * using a positioned update/delete statement that references the - * cursor name. To ensure that the cursor has the proper isolation - * level to support update, the cursor's SELECT statement - * should be of the form SELECT FOR UPDATE. If - * FOR UPDATE is omitted, the positioned updates may fail. - * - *

    The JDBC API supports this SQL feature by providing the name of the - * SQL cursor used by a ResultSet object. - * The current row of a ResultSet object - * is also the current row of this SQL cursor. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature when the cursor has a name.

    - * - *

    - * - * - * @return the SQL name for this ResultSet object's cursor - * @exception SQLException if a database access error occurs or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public String getCursorName() throws SQLException { - - checkClosed(); - - if (result == null) { - return ""; - } - - return result.getMainString(); - } - - /** - * - * Retrieves the number, types and properties of - * this ResultSet object's columns. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Example:

    - * - * The following code fragment creates a ResultSet object rs, - * creates a ResultSetMetaData object rsmd, and uses rsmd - * to find out how many columns rs has and whether the first column - * in rs can be used in a WHERE clause. - * - *

    -     * ResultSet rs   = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
    -     * ResultSetMetaData rsmd = rs.getMetaData();
    - * int numberOfColumns = rsmd.getColumnCount();
    - * boolean b = rsmd.isSearchable(1);
    - *
    - * - *
    - * - * Changes:

    - * - * With version 2.0, the engine's SQL implementation has been - * completely rewritten. Changes to this class and the implementation of - * ResultSetMetaData reflect the engine's new capabilities and provide - * more accurate information.

    - * - * changes to consider: - * - *

      - *
    1. isAutoIncrement(int) always returned false
    2. - *
    3. isNullable(int) returns the nullability of a real table or view - * column in the ResultSet and returns - * columnNoNulls for non-base-column ResultSet columns - * (columns of the ResultSet that are based on expressions or - * aggregates).
    4. - *
    5. getColumnDisplaySize(int) returns correct results even for expression - * columns.
    6. - *
    7. getPrecision(int) returns the correct precision even for expression - * columns.
    8. - *
    9. getScale(int) returns the correct precision even for expression - * columns.
    10. - *
    11. getCatalogName(int) returns the catalog name of the database.
    12. - *
    - * - *
    - *
    - * - * - * @return the description of this ResultSet object's columns - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @see JDBCResultSetMetaData - */ - public ResultSetMetaData getMetaData() throws SQLException { - - checkClosed(); - - if (resultSetMetaData == null) { - resultSetMetaData = new JDBCResultSetMetaData(resultMetaData, - isUpdatable, isInsertable, connection); - } - - return resultSetMetaData; - } - - /** - * - *

    Gets the value of the designated column in the current row - * of this ResultSet object as - * an Object in the Java programming language. - * - *

    This method will return the value of the given column as a - * Java object. The type of the Java object will be the default - * Java object type corresponding to the column's SQL type, - * following the mapping for built-in types specified in the JDBC - * specification. If the value is an SQL NULL, - * the driver returns a Java null. - * - *

    This method may also be used to read database-specific - * abstract data types. - * - * In the JDBC 2.0 API, the behavior of method - * getObject is extended to materialize - * data of SQL user-defined types. - *

    - * If Connection.getTypeMap does not throw a - * SQLFeatureNotSupportedException, - * then when a column contains a structured or distinct value, - * the behavior of this method is as - * if it were a call to: getObject(columnIndex, - * this.getStatement().getConnection().getTypeMap()). - * - * If Connection.getTypeMap does throw a - * SQLFeatureNotSupportedException, - * then structured values are not supported, and distinct values - * are mapped to the default Java class as determined by the - * underlying SQL type of the DISTINCT type. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a java.lang.Object holding the column value - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Object getObject(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - - switch (sourceType.typeCode) { - - case Types.SQL_ARRAY : - return getArray(columnIndex); - case Types.SQL_DATE : - return getDate(columnIndex); - case Types.SQL_TIME : - return getTime(columnIndex); - case Types.SQL_TIME_WITH_TIME_ZONE : - return getTimeWithZone(columnIndex); - case Types.SQL_TIMESTAMP : - return getTimestamp(columnIndex); - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return getTimestampWithZone(columnIndex); - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - return getBytes(columnIndex); - case Types.SQL_GUID : { - BinaryData bd = (BinaryData) getColumnValue(columnIndex); - return BinaryUUIDType.getJavaUUID(bd); - } - case Types.SQL_BIT : { - BinaryData bd = (BinaryData) getColumnValue(columnIndex); - - if (wasNull()) { - return null; - } - - byte[] bytes = bd.getBytes(); - - if (bytes.length == 0) { - return Boolean.FALSE; - } - - return bytes[0] == 0 ? Boolean.FALSE - : Boolean.TRUE; - } - case Types.SQL_CLOB : - return getClob(columnIndex); - case Types.SQL_BLOB : - return getBlob(columnIndex); - case Types.OTHER : - case Types.JAVA_OBJECT : { - Object o = getColumnInType(columnIndex, sourceType); - - if (o == null) { - return null; - } - - try { - return ((JavaObjectData) o).getObject(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - default : - return getColumnInType(columnIndex, sourceType); - } - } - - /** - * - *

    Gets the value of the designated column in the current row - * of this ResultSet object as - * an Object in the Java programming language. - * - *

    This method will return the value of the given column as a - * Java object. The type of the Java object will be the default - * Java object type corresponding to the column's SQL type, - * following the mapping for built-in types specified in the JDBC - * specification. If the value is an SQL NULL, - * the driver returns a Java null. - *

    - * This method may also be used to read database-specific - * abstract data types. - *

    - * In the JDBC 2.0 API, the behavior of the method - * getObject is extended to materialize - * data of SQL user-defined types. When a column contains - * a structured or distinct value, the behavior of this method is as - * if it were a call to: getObject(columnIndex, - * this.getStatement().getConnection().getTypeMap()). - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a java.lang.Object holding the column value - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - */ - public Object getObject(String columnLabel) throws SQLException { - return getObject(findColumn(columnLabel)); - } - - //---------------------------------------------------------------- - - /** - * - * Maps the given ResultSet column label to its - * ResultSet column index. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 1.9.x, HSQLDB does an exhaustive search, backed by - * a cache lookup (to improve performance for subsequent invocations with - * a given input).

    - * - * Upon careful investigation of the JDBC specification and the behaviour - * of existing JDBC drivers, there is actually nothing preventing the - * findColumn method from doing an exhaustive search, as long as it conforms - * to the following rules (which describe the new implementation): - * - *

      - *
    1. the entire search is case insensitive - *
    2. each search iteration occurs from leftmost to rightmost column, - * returning the first match encountered - *
    3. the first pass matches only bare column labels - *
    4. the second pass matches only simple column names - *
    5. further passes conform to the identifier qualification - * and identifier quoting rules of the engine - *
    - * - * In this implementation, the SQL tokenizer is not employed, both because - * it does not yet correctly handle greater than two part qualification - * and also because is is not immediately considered important to do a - * truly exhaustive search, handling the full range of possibly mixed quoted - * and unquoted identifier components.

    - * - * Instead: - *

      - *
    • a third pass matches simple table-dot-column qualified names - *
    • a fourth pass matches simple schema-dot-table-dot-column qualified column names - *
    - *
    - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column index of the given column name - * @exception SQLException if the ResultSet object - * does not contain a column labeled columnLabel, a database access error occurs - * or this method is called on a closed result set - */ - public int findColumn(final String columnLabel) throws SQLException { - - checkClosed(); - - if (columnLabel == null) { - throw JDBCUtil.nullArgument(); - } - - int columnIndex; - - // faster lookup for subsequent access - if (columnMap != null) { - columnIndex = columnMap.get(columnLabel, -1); - - if (columnIndex != -1) { - return columnIndex; - } - } - - final String[] colLabels = resultMetaData.columnLabels; - - columnIndex = -1; - - // column labels first, to preference column aliases - for (int i = 0; i < columnCount; i++) { - if (columnLabel.equalsIgnoreCase(colLabels[i])) { - columnIndex = i; - - break; - } - } - - final ColumnBase[] columns = resultMetaData.columns; - - // then bare column names, to preference simple - // quoted column idents that *may* contain "." - if (columnIndex < 0) { - for (int i = 0; i < columnCount; i++) { - if (columnLabel.equalsIgnoreCase(columns[i].getNameString())) { - columnIndex = i; - - break; - } - } - } - - // then table-qualified column names (again, quoted - // table idents *may* contain "." - // As a last resort, "fully" qualified column names - // (we don't yet bother with catalog qualification) - if (columnIndex < 0) { - int position = columnLabel.indexOf('.'); - - if (position < 0) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_COLUMN_NOT_FOUND, - columnLabel); - } - - for (int i = 0; i < columnCount; i++) { - final String tabName = columns[i].getTableNameString(); - - if (tabName == null || tabName.isEmpty()) { - continue; - } - - final String colName = columns[i].getNameString(); - - if (columnLabel.equalsIgnoreCase(tabName + '.' + colName)) { - columnIndex = i; - - break; - } - - final String schemName = columns[i].getSchemaNameString(); - - if (schemName == null || schemName.length() == 0) { - continue; - } - - String match = new StringBuilder(schemName).append('.').append( - tabName).append('.').append(colName).toString(); - - if (columnLabel.equalsIgnoreCase(match)) { - columnIndex = i; - - break; - } - } - } - - if (columnIndex < 0) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_COLUMN_NOT_FOUND, - columnLabel); - } - columnIndex++; - - if (columnMap == null) { - columnMap = new IntValueHashMap(); - } - columnMap.put(columnLabel, columnIndex); - - return columnIndex; - } - - //--------------------------JDBC 2.0----------------------------------- - //--------------------------------------------------------------------- - // Getters and Setters - //--------------------------------------------------------------------- - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnIndex the first column is 1, the second is 2, ... - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @since JDK 1.2 - */ - public java.io.Reader getCharacterStream( - int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - Object o = getColumnInType(columnIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof ClobDataID) { - return ((ClobDataID) o).getCharacterStream(session); - } else if (o instanceof Clob) { - return ((Clob) o).getCharacterStream(); - } else if (o instanceof String) { - return new StringReader((String) o); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @since JDK 1.2 - */ - public java.io.Reader getCharacterStream( - String columnLabel) throws SQLException { - return getCharacterStream(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.math.BigDecimal with full precision. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value (full precision); - * if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @since JDK 1.2 - */ - public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type targetType = resultMetaData.columnTypes[columnIndex - 1]; - - switch (targetType.typeCode) { - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - break; - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - targetType = Type.SQL_DECIMAL; - - break; - case Types.SQL_DOUBLE : - default : - targetType = Type.SQL_DECIMAL_DEFAULT; - - break; - } - - return (BigDecimal) getColumnInType(columnIndex, targetType); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.math.BigDecimal with full precision. - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return the column value (full precision); - * if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @since JDK 1.2 - */ - public BigDecimal getBigDecimal(String columnLabel) throws SQLException { - return getBigDecimal(findColumn(columnLabel)); - } - - //--------------------------------------------------------------------- - // Traversal/Positioning - //--------------------------------------------------------------------- - - /** - * - * Retrieves whether the cursor is before the first row in - * this ResultSet object. - *

    - * (JDBC4 Clarification:)

    - * Note:Support for the isBeforeFirst method - * is optional for ResultSets with a result - * set type of TYPE_FORWARD_ONLY - * - * - * @return true if the cursor is before the first row; - * false if the cursor is at any other position or the - * result set contains no rows - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean isBeforeFirst() throws SQLException { - - checkClosed(); - - if (isOnInsertRow) { - return false; - } - - return navigator.isBeforeFirst(); - } - - /** - * - * Retrieves whether the cursor is after the last row in - * this ResultSet object. - *

    - * (JDBC4 Clarification:)

    - * Note:Support for the isAfterLast method - * is optional for ResultSets with a result - * set type of TYPE_FORWARD_ONLY - * - * - * @return true if the cursor is after the last row; - * false if the cursor is at any other position or the - * result set contains no rows - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean isAfterLast() throws SQLException { - - // At afterLast condition exists when resultset has been traversed and - // the current row is null. iCurrentRow should also be set to - // afterlast but no need to test - checkClosed(); - - if (isOnInsertRow) { - return false; - } - - return navigator.isAfterLast(); - } - - /** - * - * Retrieves whether the cursor is on the first row of - * this ResultSet object. - *

    - * (JDBC4 Clarification:)

    - * Note:Support for the isFirst method - * is optional for ResultSets with a result - * set type of TYPE_FORWARD_ONLY - * - * - * @return true if the cursor is on the first row; - * false otherwise - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean isFirst() throws SQLException { - - checkClosed(); - - if (isOnInsertRow) { - return false; - } - - return navigator.isFirst(); - } - - /** - * - * Retrieves whether the cursor is on the last row of - * this ResultSet object. - * Note: Calling the method isLast may be expensive - * because the JDBC driver - * might need to fetch ahead one row in order to determine - * whether the current row is the last row in the result set. - *

    - * (JDBC4 Clarification:)

    - * Note: Support for the isLast method - * is optional for ResultSets with a result - * set type of TYPE_FORWARD_ONLY - * - * - * @return true if the cursor is on the last row; - * false otherwise - * @exception SQLException if a database access error occurs or this method is - * called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean isLast() throws SQLException { - - checkClosed(); - - if (isOnInsertRow) { - return false; - } - - return navigator.isLast(); - } - - /** - * - * Moves the cursor to the front of - * this ResultSet object, just before the - * first row. This method has no effect if the result set contains no rows. - * - * - * @exception SQLException if a database access error - * occurs, this method is called on a closed result set or the - * result set type is TYPE_FORWARD_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void beforeFirst() throws SQLException { - - checkClosed(); - checkNotForwardOnly(); - - if (isOnInsertRow || isRowUpdated) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24513); - } - navigator.beforeFirst(); - } - - /** - * - * Moves the cursor to the end of - * this ResultSet object, just after the - * last row. This method has no effect if the result set contains no rows. - * - * - * @exception SQLException if a database access error - * occurs, this method is called on a closed result set - * or the result set type is TYPE_FORWARD_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void afterLast() throws SQLException { - - checkClosed(); - checkNotForwardOnly(); - - if (isOnInsertRow || isRowUpdated) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24513); - } - navigator.afterLast(); - } - - /** - * - * Moves the cursor to the first row in - * this ResultSet object. - * - * - * @return true if the cursor is on a valid row; - * false if there are no rows in the result set - * @exception SQLException if a database access error - * occurs, this method is called on a closed result set - * or the result set type is TYPE_FORWARD_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean first() throws SQLException { - - checkClosed(); - checkNotForwardOnly(); - - if (isOnInsertRow || isRowUpdated) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24513); - } - - return navigator.first(); - } - - /** - * - * Moves the cursor to the last row in - * this ResultSet object. - * - * - * @return true if the cursor is on a valid row; - * false if there are no rows in the result set - * @exception SQLException if a database access error - * occurs, this method is called on a closed result set - * or the result set type is TYPE_FORWARD_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean last() throws SQLException { - - checkClosed(); - checkNotForwardOnly(); - - if (isOnInsertRow || isRowUpdated) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24513); - } - - return navigator.last(); - } - - /** - * - * Retrieves the current row number. The first row is number 1, the - * second number 2, and so on. - *

    - * (JDBC4 Clarification:)

    - * Note:Support for the getRow method - * is optional for ResultSets with a result - * set type of TYPE_FORWARD_ONLY - * - * - * @return the current row number; 0 if there is no current row - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public int getRow() throws SQLException { - - checkClosed(); - - if (navigator.isAfterLast()) { - return 0; - } - - return navigator.getRowNumber() + 1; - } - - /** - * - * Moves the cursor to the given row number in - * this ResultSet object. - * - *

    If the row number is positive, the cursor moves to - * the given row number with respect to the - * beginning of the result set. The first row is row 1, the second - * is row 2, and so on. - * - *

    If the given row number is negative, the cursor moves to - * an absolute row position with respect to - * the end of the result set. For example, calling the method - * absolute(-1) positions the - * cursor on the last row; calling the method absolute(-2) - * moves the cursor to the next-to-last row, and so on. - * - *

    An attempt to position the cursor beyond the first/last row in - * the result set leaves the cursor before the first row or after - * the last row. - * - *

    Note: Calling absolute(1) is the same - * as calling first(). Calling absolute(-1) - * is the same as calling last(). - * - * - * @param row the number of the row to which the cursor should move. - * A positive number indicates the row number counting from the - * beginning of the result set; a negative number indicates the - * row number counting from the end of the result set - * @return true if the cursor is moved to a position in this - * ResultSet object; - * false if the cursor is before the first row or after the - * last row - * @exception SQLException if a database access error - * occurs, this method is called on a closed result set - * or the result set type is TYPE_FORWARD_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean absolute(int row) throws SQLException { - - checkClosed(); - checkNotForwardOnly(); - - if (isOnInsertRow || isRowUpdated) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24513); - } - - if (row > 0) { - row--; - } else if (row == 0) { - return navigator.beforeFirst(); - } else { - row += navigator.getSize(); - - if (row < 0) { - navigator.beforeFirst(); - return false; - } - } - - return navigator.absolute(row); - } - - /** - * - * Moves the cursor a relative number of rows, either positive or negative. - * Attempting to move beyond the first/last row in the - * result set positions the cursor before/after - * the first/last row. Calling relative(0) is valid, but does - * not change the cursor position. - * - *

    Note: Calling the method relative(1) - * is identical to calling the method next() and - * calling the method relative(-1) is identical - * to calling the method previous(). - * - * - * @param rows an int specifying the number of rows to - * move from the current row; a positive number moves the cursor - * forward; a negative number moves the cursor backward - * @return true if the cursor is on a row; - * false otherwise - * @exception SQLException if a database access error occurs, this method - * is called on a closed result set, - * there is no current row, or the result set type is - * TYPE_FORWARD_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean relative(int rows) throws SQLException { - - checkClosed(); - checkNotForwardOnly(); - - if (isOnInsertRow || isRowUpdated) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24513); - } - - return navigator.relative(rows); - } - - /** - * - * Moves the cursor to the previous row in this - * ResultSet object. - *

    - * (JDBC4 clarification:) - * When a call to the previous method returns false, - * the cursor is positioned before the first row. Any invocation of a - * ResultSet method which requires a current row will result in a - * SQLException being thrown. - *

    - * (JDBC4 clarification:) - * If an input stream is open for the current row, a call to the method - * previous will implicitly close it. A ResultSet - * object's warning change is cleared when a new row is read. - *

    - * - * - * @return (JDBC4 clarification:) true if the cursor is now positioned on a valid row; - * false if the cursor is positioned before the first row - * @exception SQLException if a database access error - * occurs; this method is called on a closed result set - * or the result set type is TYPE_FORWARD_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public boolean previous() throws SQLException { - - checkClosed(); - checkNotForwardOnly(); - - if (isOnInsertRow || isRowUpdated) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24513); - } - rootWarning = null; - - return navigator.previous(); - } - - //--------------------------------------------------------------------- - // Properties - //--------------------------------------------------------------------- - - /** - * - * Gives a hint as to the direction in which the rows in this - * ResultSet object will be processed. - * The initial value is determined by the - * Statement object - * that produced this ResultSet object. - * The fetch direction may be changed at any time. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not need this hint. However, as mandated by the JDBC standard, - * an SQLException is thrown if the result set type is TYPE_FORWARD_ONLY - * and a fetch direction other than FETCH_FORWARD is requested.

    - *

    - * - * - * @param direction an int specifying the suggested - * fetch direction; one of ResultSet.FETCH_FORWARD, - * ResultSet.FETCH_REVERSE, or - * ResultSet.FETCH_UNKNOWN - * @exception SQLException if a database access error occurs; this - * method is called on a closed result set or - * the result set type is TYPE_FORWARD_ONLY and the fetch - * direction is not FETCH_FORWARD - * @since JDK 1.2 - * @see JDBCStatement#setFetchDirection - * @see #getFetchDirection - */ - public void setFetchDirection(int direction) throws SQLException { - - checkClosed(); - - switch (direction) { - - case ResultSet.FETCH_FORWARD : { - break; - } - case ResultSet.FETCH_REVERSE : { - checkNotForwardOnly(); - - break; - } - case ResultSet.FETCH_UNKNOWN : { - checkNotForwardOnly(); - - break; - } - default : { - throw JDBCUtil.notSupported(); - } - } - } - - /** - * - * Retrieves the fetch direction for this - * ResultSet object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not depend on fetch direction and always returns - * FETCH_FORWARD, but the value has no real meaning.

    - *

    - * - * - * @return the current fetch direction for this ResultSet object - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - * @see #setFetchDirection - */ - public int getFetchDirection() throws SQLException { - - checkClosed(); - - return ResultSet.FETCH_FORWARD; - } - - /** - * - * Gives the JDBC driver a hint as to the number of rows that should - * be fetched from the database when more rows are needed for this - * ResultSet object. - * If the fetch size specified is zero, the JDBC driver - * ignores the value and is free to make its own best guess as to what - * the fetch size should be. The default value is set by the - * Statement object - * that created the result set. The fetch size may be changed at any time. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB may not build and return a result set as a - * whole. Therefore the supplied, non-zero, fetch size value is used for - * some ResultSet objects. - *

    - * - * - * @param rows the number of rows to fetch - * @exception SQLException if a database access error occurs; this method - * (JDBC4 Clarification:) - * is called on a closed result set or the - * (JDBC4 clarification:) - * condition {@code rows >= 0} is not satisfied - * @since JDK 1.2 - * @see #getFetchSize - * @see JDBCStatement#setFetchSize - * @see JDBCStatement#getFetchSize - */ - public void setFetchSize(int rows) throws SQLException { - - if (rows < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - } - - /** - * - * Retrieves the fetch size for this - * ResultSet object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB may not build and return a result set as a - * whole. The actual fetch size for this result set is returned. - *

    - * - * - * @return the current fetch size for this ResultSet object - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - * @see #setFetchSize - * @see JDBCStatement#getFetchSize - * @see JDBCStatement#setFetchSize - */ - public int getFetchSize() throws SQLException { - - checkClosed(); - - return fetchSize; - } - - /** - * - * Retrieves the type of this ResultSet object. - * The type is determined by the Statement object - * that created the result set. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB accurately - * reports the actual runtime scrollability of this result set instance. - *

    - * - * - * @return ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, - * or ResultSet.TYPE_SCROLL_SENSITIVE - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public int getType() throws SQLException { - - checkClosed(); - - return ResultProperties.getJDBCScrollability(rsProperties); - } - - /** - * - * Retrieves the concurrency mode of this ResultSet object. - * The concurrency used is determined by the - * Statement object that created the result set. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports updatable result sets and accurately reports the actual - * runtime concurrency of this result set instance. - *

    - * - * - * @return the concurrency type, either - * ResultSet.CONCUR_READ_ONLY - * or ResultSet.CONCUR_UPDATABLE - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public int getConcurrency() throws SQLException { - - checkClosed(); - - return ResultProperties.getJDBCConcurrency(rsProperties); - } - - //--------------------------------------------------------------------- - // Updates - //--------------------------------------------------------------------- - - /** - * - * Retrieves whether the current row has been updated. The value returned - * depends on whether or not the result set can detect updates. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports updatable result sets and accurately reports the actual - * value. - *

    - * - * - * @return true if the current row is detected to - * have been visibly updated by the owner or another; false otherwise - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see JDBCDatabaseMetaData#updatesAreDetected - * @since JDK 1.2 - */ - public boolean rowUpdated() throws SQLException { - - checkClosed(); - - return isRowUpdated; - } - - /** - * - * Retrieves whether the current row has had an insertion. - * The value returned depends on whether or not this - * ResultSet object can detect visible inserts. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports updatable result sets and accurately reports the actual - * value. - *

    - * - * - * @return true if the current row is detected to - * have been inserted; false otherwise - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see JDBCDatabaseMetaData#insertsAreDetected - * @since JDK 1.2 - */ - public boolean rowInserted() throws SQLException { - - checkClosed(); - - return false; - } - - /** - * - * Retrieves whether a row has been deleted. A deleted row may leave - * a visible "hole" in a result set. This method can be used to - * detect holes in a result set. The value returned depends on whether - * or not this ResultSet object can detect deletions. - *

    - * (JDBC4 Clarification:)

    - * Note: Support for the rowDeleted method is optional with a result set - * concurrency of CONCUR_READ_ONLY - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports updatable result sets and accurately reports the actual - * value. - *

    - * - * @return true if the current row is detected to - * have been deleted by the owner or another; false otherwise - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @see JDBCDatabaseMetaData#deletesAreDetected - * @since JDK 1.2 - */ - public boolean rowDeleted() throws SQLException { - - checkClosed(); - - return false; - } - - /** - * - * (JDBC4 clarification:) - * Updates the designated column with a null value. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow - * or insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateNull(int columnIndex) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, null); - } - - /** - * - * Updates the designated column with a boolean value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBoolean(int columnIndex, boolean x) throws SQLException { - - Boolean value = x ? Boolean.TRUE - : Boolean.FALSE; - - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, value); - } - - /** - * - * Updates the designated column with a byte value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateByte(int columnIndex, byte x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setIntParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a short value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateShort(int columnIndex, short x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setIntParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with an int value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateInt(int columnIndex, int x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setIntParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a long value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateLong(int columnIndex, long x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setLongParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a float value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateFloat(int columnIndex, float x) throws SQLException { - - Double value = Double.valueOf(x); - - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, value); - } - - /** - * - * Updates the designated column with a double value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateDouble(int columnIndex, double x) throws SQLException { - - Double value = Double.valueOf(x); - - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, value); - } - - /** - * - * Updates the designated column with a java.math.BigDecimal - * value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBigDecimal(int columnIndex, - BigDecimal x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a String value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateString(int columnIndex, String x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a byte array value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBytes(int columnIndex, byte[] x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Date value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateDate(int columnIndex, Date x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Time value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateTime(int columnIndex, Time x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Timestamp - * value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateTimestamp(int columnIndex, - Timestamp x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * (JDBC4 clarification:) - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateAsciiStream(int columnIndex, java.io.InputStream x, - int length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setAsciiStream(columnIndex, x, length); - } - - /** - * - * (JDBC4 clarification:) - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBinaryStream(int columnIndex, java.io.InputStream x, - int length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setBinaryStream(columnIndex, x, length); - } - - /** - * - * (JDBC4 clarification:) - * Updates the designated column with a character stream value, which will have - * the specified number of (CHECKME: characters?) bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateCharacterStream(int columnIndex, java.io.Reader x, - int length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, x, length); - } - - /** - * - * Updates the designated column with an Object value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - *

    - * (JDBC clarification:) - * If the second argument is an InputStream then the stream must contain - * the number of bytes specified by scaleOrLength. If the second argument is a - * Reader then the reader must contain the number of characters specified - * by scaleOrLength. If these conditions are not true the driver will generate a - * SQLException when the statement is executed. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param scaleOrLength for an object of java.math.BigDecimal , - * this is the number of digits after the decimal point. For - * Java Object types InputStream and Reader, - * this is the length - * of the data in the stream or reader. For all other types, - * this value will be ignored. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateObject(int columnIndex, Object x, - int scaleOrLength) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setObject(columnIndex, x, 0, scaleOrLength); - } - - /** - * - * Updates the designated column with an Object value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateObject(int columnIndex, Object x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a null value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateNull(String columnLabel) throws SQLException { - updateNull(findColumn(columnLabel)); - } - - /** - * - * Updates the designated column with a boolean value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBoolean(String columnLabel, - boolean x) throws SQLException { - updateBoolean(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a byte value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateByte(String columnLabel, byte x) throws SQLException { - updateByte(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a short value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateShort(String columnLabel, short x) throws SQLException { - updateShort(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with an int value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateInt(String columnLabel, int x) throws SQLException { - updateInt(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a long value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateLong(String columnLabel, long x) throws SQLException { - updateLong(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a float value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateFloat(String columnLabel, float x) throws SQLException { - updateFloat(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a double value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateDouble(String columnLabel, - double x) throws SQLException { - updateDouble(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a java.sql.BigDecimal - * value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBigDecimal(String columnLabel, - BigDecimal x) throws SQLException { - updateBigDecimal(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a String value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateString(String columnLabel, - String x) throws SQLException { - updateString(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a byte array value. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow - * or insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBytes(String columnLabel, byte[] x) throws SQLException { - updateBytes(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a java.sql.Date value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateDate(String columnLabel, Date x) throws SQLException { - updateDate(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a java.sql.Time value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateTime(String columnLabel, Time x) throws SQLException { - updateTime(findColumn(columnLabel), x); - } - - /** - * - * Updates the designated column with a java.sql.Timestamp - * value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateTimestamp(String columnLabel, - Timestamp x) throws SQLException { - updateTimestamp(findColumn(columnLabel), x); - } - - /** - * - * (JDBC4 clarification:) - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateAsciiStream(String columnLabel, java.io.InputStream x, - int length) throws SQLException { - updateAsciiStream(findColumn(columnLabel), x, length); - } - - /** - * - * (JDBC4 clarification:) - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateBinaryStream(String columnLabel, java.io.InputStream x, - int length) throws SQLException { - updateBinaryStream(findColumn(columnLabel), x, length); - } - - /** - * - * (JDBC4 clarification) - * Updates the designated column with a character stream value, which will have - * the specified number of (CHECKME: characters?) bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateCharacterStream(String columnLabel, - java.io.Reader reader, - int length) throws SQLException { - updateCharacterStream(findColumn(columnLabel), reader, length); - } - - /** - * - * Updates the designated column with an Object value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - *

    - * (JDBC4 Clarification:) - * If the second argument is an InputStream then the stream must contain - * the number of bytes specified by scaleOrLength. If the second argument is a - * Reader then the reader must contain the number of characters specified - * by scaleOrLength. If these conditions are not true the driver will generate a - * SQLException when the statement is executed. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @param scaleOrLength for an object of java.math.BigDecimal , - * this is the number of digits after the decimal point. For - * Java Object types InputStream and Reader, - * this is the length - * of the data in the stream or reader. For all other types, - * this value will be ignored. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateObject(String columnLabel, Object x, - int scaleOrLength) throws SQLException { - updateObject(findColumn(columnLabel), x, scaleOrLength); - } - - /** - * - * Updates the designated column with an Object value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateObject(String columnLabel, - Object x) throws SQLException { - updateObject(findColumn(columnLabel), x); - } - - /** - * - * Inserts the contents of the insert row into this - * ResultSet object and into the database. - * The cursor must be on the insert row when this method is called. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY, - * this method is called on a closed result set, - * if this method is called when the cursor is not on the insert row, - * or if not all of non-nullable columns in - * the insert row have been given a non-null value - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void insertRow() throws SQLException { - performInsert(); - } - - /** - * - * Updates the underlying database with the new contents of the - * current row of this ResultSet object. - * This method cannot be called when the cursor is on the insert row. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - * After updating any values in the current row, it is not possible to - * move the cursor position without calling this method, or alternatively - * calling cancelRowUpdates() to abandon the row update. - *

    - * - * - * @exception SQLException if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY; - * this method is called on a closed result set or - * if this method is called when the cursor is on the insert row - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void updateRow() throws SQLException { - performUpdate(); - } - - /** - * - * Deletes the current row from this ResultSet object - * and from the underlying database. This method cannot be called when - * the cursor is on the insert row. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - * - * After a successful call to this method, the row is deleted. - *

    - * - * - * @exception SQLException if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY; - * this method is called on a closed result set - * or if this method is called when the cursor is on the insert row - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void deleteRow() throws SQLException { - performDelete(); - } - - /** - * - * Refreshes the current row with its most recent value in - * the database. This method cannot be called when - * the cursor is on the insert row. - * - *

    The refreshRow method provides a way for an - * application to - * explicitly tell the JDBC driver to refetch a row(s) from the - * database. An application may want to call refreshRow when - * caching or prefetching is being done by the JDBC driver to - * fetch the latest value of a row from the database. The JDBC driver - * may actually refresh multiple rows at once if the fetch size is - * greater than one. - * - *

    All values are refetched subject to the transaction isolation - * level and cursor sensitivity. If refreshRow is called after - * calling an updater method, but before calling - * the method updateRow, then the - * updates made to the row are lost. Calling the method - * refreshRow frequently will likely slow performance. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @exception SQLException if a database access error - * occurs; this method is called on a closed result set; - * the result set type is TYPE_FORWARD_ONLY or if this - * method is called when the cursor is on the insert row - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method or this method is not supported for the specified result - * set type and result set concurrency. - * @since JDK 1.2 - */ - public void refreshRow() throws SQLException { - clearUpdates(); - } - - /** - * - * Cancels the updates made to the current row in this - * ResultSet object. - * This method may be called after calling an - * updater method(s) and before calling - * the method updateRow to roll back - * the updates made to a row. If no updates have been made or - * updateRow has already been called, this method has no - * effect. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @exception SQLException if a database access error - * occurs; this method is called on a closed result set; - * the result set concurrency is CONCUR_READ_ONLY - * or if this method is called when the cursor is - * on the insert row - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void cancelRowUpdates() throws SQLException { - clearUpdates(); - } - - /** - * - * Moves the cursor to the insert row. The current cursor position is - * remembered while the cursor is positioned on the insert row. - * - * The insert row is a special row associated with an updatable - * result set. It is essentially a buffer where a new row may - * be constructed by calling the updater methods prior to - * inserting the row into the result set. - * - * Only the updater, getter, - * and insertRow methods may be - * called when the cursor is on the insert row. All of the columns in - * a result set must be given a value each time this method is - * called before calling insertRow. - * An updater method must be called before a - * getter method can be called on a column value. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * - * @exception SQLException if a database access error occurs; this - * method is called on a closed result set - * or the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void moveToInsertRow() throws SQLException { - startInsert(); - } - - /** - * - * Moves the cursor to the remembered cursor position, usually the - * current row. This method has no effect if the cursor is not on - * the insert row. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature.

    - *

    - * - * @exception SQLException if a database access error occurs, this - * method is called on a closed result set - * or the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public void moveToCurrentRow() throws SQLException { - endInsert(); - } - - /** - * - * Retrieves the Statement object that produced this - * ResultSet object. - * If the result set was generated some other way, such as by a - * DatabaseMetaData method, this method may return - * null. - * - * - * @return the Statement object that produced - * this ResultSet object or null - * if the result set was produced some other way - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public Statement getStatement() throws SQLException { - - checkClosed(); - - return (Statement) statement; - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as an Object - * in the Java programming language. - * If the value is an SQL NULL, - * the driver returns a Java null. - * This method uses the given Map object - * for the custom mapping of the - * SQL structured or distinct type that is being retrieved. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature, but ignores the map.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param map a java.util.Map object that contains the mapping - * from SQL type names to classes in the Java programming language - * @return an Object in the Java programming language - * representing the SQL value - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Object getObject(int columnIndex, Map map) throws SQLException { - return getObject(columnIndex); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a Ref object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support this feature; this method always - * throws an SQLException stating that the operation is not - * supported. - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a Ref object representing an SQL REF - * value - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Ref getRef(int columnIndex) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a Blob object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for objects of type BLOB and BINARY. - * The Blob returned for BINARY objects is a memory object. The Blob - * return for BLOB objects is not held entirely in memory. Its contents are - * fetched from the database when its getXXX() methods are called.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a Blob object representing the SQL - * BLOB value in the specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Blob getBlob(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - Object o = getColumnInType(columnIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof BlobDataID) { - if (memoryLobs) { - long length = ((BlobDataID) o).length(session); - - if (length > Integer.MAX_VALUE) { - throw JDBCUtil.sqlException(ErrorCode.X_22001); - } - - byte[] bytes = ((BlobDataID) o).getBytes(session, 0, - (int) length); - - return new JDBCBlob(bytes); - } - - JDBCBlobClient blob = new JDBCBlobClient(session, (BlobDataID) o); - - if (isUpdatable) { - if (resultMetaData.colIndexes[columnIndex - 1] > 0 - && resultMetaData.columns[columnIndex - 1] - .isWriteable()) { - blob.setWritable(this, columnIndex - 1); - } - } - - return blob; - } else if (o instanceof Blob) { - return (Blob) o; - } else if (o instanceof BinaryData) { - byte[] b = getBytes(columnIndex); - - return new JDBCBlob(b); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a Clob object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for objects of type CLOB and - * the variations of CHAR. - * The Clob returned for CHAR objects is a memory object. The Clob - * return for CLOB objects is not held entirely in memory. Its contents are - * fetched from the database when its getXXX() methods are called.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a Clob object representing the SQL - * CLOB value in the specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Clob getClob(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - Object o = getColumnInType(columnIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof ClobDataID) { - if (memoryLobs) { - long length = ((ClobDataID) o).length(session); - - if (length > Integer.MAX_VALUE) { - throw JDBCUtil.sqlException(ErrorCode.X_22001); - } - - String s = ((ClobDataID) o).getSubString(session, 0, - (int) length); - - return new JDBCClob(s); - } - - JDBCClobClient clob = new JDBCClobClient(session, (ClobDataID) o); - - if (isUpdatable) { - if (resultMetaData.colIndexes[columnIndex - 1] > 0 - && resultMetaData.columns[columnIndex - 1] - .isWriteable()) { - clob.setWritable(this, columnIndex - 1); - } - } - - return clob; - } else if (o instanceof Clob) { - return (Clob) o; - } else if (o instanceof String) { - return new JDBCClob((String) o); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as an Array object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From version 2.0, HSQLDB supports array types. - * - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return an Array object representing the SQL - * ARRAY value in the specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Array getArray(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type type = resultMetaData.columnTypes[columnIndex - 1]; - Object[] data = (Object[]) getCurrent()[columnIndex - 1]; - - if (!type.isArrayType()) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - if (trackNull(data)) { - return null; - } - - return new JDBCArray(data, type.collectionBaseType(), type, - connection); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as an Object - * in the Java programming language. - * If the value is an SQL NULL, - * the driver returns a Java null. - * This method uses the specified Map object for - * custom mapping if appropriate. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports this feature. But the Map parameter is ignored.

    - * - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param map a java.util.Map object that contains the mapping - * from SQL type names to classes in the Java programming language - * @return an Object representing the SQL value in the - * specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Object getObject(String columnLabel, Map map) throws SQLException { - return getObject(findColumn(columnLabel), map); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a Ref object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, HSQLDB does not support reference types; this method - * always throws an SQLException stating that the operation - * is not supported. - *

    - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a Ref object representing the SQL REF - * value in the specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Ref getRef(String columnLabel) throws SQLException { - return getRef(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a Blob object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for objects of type BLOB and BINARY. - * The Blob returned for BINARY objects is a memory object. The Blob - * return for BLOB objects is not held entirely in memory. Its contents are - * fetched from the database when its getXXX() methods are called.

    - * - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a Blob object representing the SQL BLOB - * value in the specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Blob getBlob(String columnLabel) throws SQLException { - return getBlob(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a Clob object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for objects of type CLOB and - * the variations of CHAR. - * The Clob returned for CHAR objects is a memory object. The Clob - * return for CLOB objects is not held entirely in memory. Its contents are - * fetched from the database when its getXXX() methods are called.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return a Clob object representing the SQL CLOB - * value in the specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Clob getClob(String columnLabel) throws SQLException { - return getClob(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as an Array object - * in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From version 2.0, HSQLDB supports array types. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @return an Array object representing the SQL ARRAY value in - * the specified column - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.2 - */ - public Array getArray(String columnLabel) throws SQLException { - return getArray(findColumn(columnLabel)); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.sql.Date object - * in the Java programming language. - * This method uses the given calendar to construct an appropriate millisecond - * value for the date if the underlying database does not store - * timezone information. - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param cal the java.util.Calendar object - * to use in constructing the date - * @return the column value as a java.sql.Date object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public Date getDate(int columnIndex, Calendar cal) throws SQLException { - - TimestampData t = (TimestampData) getColumnInType(columnIndex, - Type.SQL_DATE); - - if (t == null) { - return null; - } - - return (Date) Type.SQL_DATE.convertSQLToJava(session, t, cal); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.sql.Date object - * in the Java programming language. - * This method uses the given calendar to construct an appropriate millisecond - * value for the date if the underlying database does not store - * timezone information. - * - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param cal the java.util.Calendar object - * to use in constructing the date - * @return the column value as a java.sql.Date object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public Date getDate(String columnLabel, Calendar cal) throws SQLException { - return getDate(findColumn(columnLabel), cal); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.sql.Time - * object in the Java programming language. - * This method uses the given calendar to construct an appropriate millisecond - * value for the time if the underlying database does not store - * timezone information. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The JDBC specification for this method is vague. HSQLDB interprets the - * specification as follows: - * - *

      - *
    1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - * of the returned java.sql.Time object is the UTC of the SQL value without - * modification. In other words, the Calendar object is not used.
    2. - *
    3. If the SQL type of the column is WITHOUT TIME ZONE, then the UTC - * value of the returned java.sql.Time is correct for the given Calendar's - * time zone.
    4. - *
    5. If the cal argument is null, it it ignored and the method returns - * the same Object as the method without the Calendar parameter.
    6. - *
    - *
    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param cal the java.util.Calendar object - * to use in constructing the time - * @return the column value as a java.sql.Time object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public Time getTime(int columnIndex, Calendar cal) throws SQLException { - - TimeData t = (TimeData) getColumnInType(columnIndex, Type.SQL_TIME); - - if (t == null) { - return null; - } - - return (Time) Type.SQL_TIME.convertSQLToJava(session, t, cal); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.sql.Time object - * in the Java programming language. - * This method uses the given calendar to construct an appropriate millisecond - * value for the time if the underlying database does not store - * timezone information. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The JDBC specification for this method is vague. HSQLDB interprets the - * specification as follows: - * - *

      - *
    1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - * of the returned java.sql.Time object is the UTC of the SQL value without - * modification. In other words, the Calendar object is not used.
    2. - *
    3. If the SQL type of the column is WITHOUT TIME ZONE, then the - * UTC value of the returned java.sql.Time will represent the correct - * time for the time zone (including daylight saving time) of the given - * Calendar.
    4. - *
    5. If the cal argument is null, it it ignored and the method returns - * the same Object as the method without the Calendar parameter.
    6. - *
    - *
    - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param cal the java.util.Calendar object - * to use in constructing the time - * @return the column value as a java.sql.Time object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public Time getTime(String columnLabel, Calendar cal) throws SQLException { - return getTime(findColumn(columnLabel), cal); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.sql.Timestamp object - * in the Java programming language. - * This method uses the given calendar to construct an appropriate millisecond - * value for the timestamp if the underlying database does not store - * timezone information. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The JDBC specification for this method is vague. HSQLDB interprets the - * specification as follows: - * - *

      - *
    1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - * of the returned java.sql.Timestamp object is the UTC of the SQL value - * without modification. In other words, the Calendar object is not used. - *
    2. - *
    3. If the SQL type of the column is WITHOUT TIME ZONE, then the - * UTC value of the returned java.sql.Timestamp will represent the correct - * timestamp for the time zone (including daylight saving time) of the given - * Calendar object.
    4. - *
    5. In this case, if the cal argument is null, then the default Calendar - * of the JVM is used, which results in the same Object as one returned by the - * getTimestamp() methods without the Calendar parameter.
    6. - *
    - *
    - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param cal the java.util.Calendar object - * to use in constructing the timestamp - * @return the column value as a java.sql.Timestamp object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public Timestamp getTimestamp(int columnIndex, - Calendar cal) throws SQLException { - TimestampData t = (TimestampData) getColumnInType(columnIndex, - Type.SQL_TIMESTAMP); - - if (t == null) { - return null; - } - - return (Timestamp) Type.SQL_TIMESTAMP.convertSQLToJava(session, t, cal); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.sql.Timestamp object - * in the Java programming language. - * This method uses the given calendar to construct an appropriate millisecond - * value for the timestamp if the underlying database does not store - * timezone information. - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The JDBC specification for this method is vague. HSQLDB interprets the - * specification as follows: - * - *

      - *
    1. If the SQL type of the column is WITH TIME ZONE, then the UTC value - * of the returned java.sql.Timestamp object is the UTC of the SQL value - * without modification. In other words, the Calendar object is not used. - *
    2. - *
    3. If the SQL type of the column is WITHOUT TIME ZONE, then the UTC - * value of the returned java.sql.Timestamp is correct for the given - * Calendar object.
    4. - *
    5. If the cal argument is null, it it ignored and the method returns - * the same Object as the method without the Calendar parameter.
    6. - *
    - *
    - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param cal the java.util.Calendar object - * to use in constructing the date - * @return the column value as a java.sql.Timestamp object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.2 - */ - public Timestamp getTimestamp(String columnLabel, - Calendar cal) throws SQLException { - return getTimestamp(findColumn(columnLabel), cal); - } - - //-------------------------- JDBC 3.0 ---------------------------------------- - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.net.URL - * object in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support the datalink type; this method - * always throws an SQLException stating that the operation is - * not supported. - *

    - * - * - * @param columnIndex the index of the column 1 is the first, 2 is the second,... - * @return the column value as a java.net.URL object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occurs; this method - * is called on a closed result set or if a URL is malformed - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public java.net.URL getURL(int columnIndex) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a java.net.URL - * object in the Java programming language. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support the datalink type; this method - * always throws an SQLException stating that the operation is - * not supported. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @return the column value as a java.net.URL object; - * if the value is SQL NULL, - * the value returned is null in the Java programming language - * @exception SQLException if a database access error occur; this method - * is called on a closed result set or if a URL is malformed - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public java.net.URL getURL(String columnLabel) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Updates the designated column with a java.sql.Ref value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support reference types; this method - * always throws an SQLException stating that the operation is - * not supported. - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateRef(int columnIndex, - java.sql.Ref x) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Updates the designated column with a java.sql.Ref value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support reference types; this method - * always throws an SQLException stating that the operation is - * not supported. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateRef(String columnLabel, - java.sql.Ref x) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * - * Updates the designated column with a java.sql.Blob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for columns of type BLOB. - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateBlob(int columnIndex, - java.sql.Blob x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setBlobParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Blob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for columns of type BLOB. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateBlob(String columnLabel, - java.sql.Blob x) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - updateBlob(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Clob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for columns of type CLOB.

    - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateClob(int columnIndex, - java.sql.Clob x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setClobParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Clob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 supports this feature for columns of type CLOB.

    - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateClob(String columnLabel, - java.sql.Clob x) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - updateClob(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Array value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support array types; this method always - * throws an SQLException stating that the operation is not - * supported. - *

    - * - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateArray(int columnIndex, - java.sql.Array x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setParameter(columnIndex, x); - } - - /** - * - * Updates the designated column with a java.sql.Array value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support array types; this method always - * throws an SQLException stating that the operation is not - * supported. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param x the new column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.4, HSQLDB 1.7.0 - */ - public void updateArray(String columnLabel, - java.sql.Array x) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - updateArray(columnIndex, x); - } - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * @param columnIndex the first column is 1, the second 2, ... - * @return the column value; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public RowId getRowId(int columnIndex) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Retrieves the value of the designated column in the current row of this - * ResultSet object as a java.sql.RowId object in the Java - * programming language. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support the RowId type; this method always - * throws an SQLException stating that the operation is not - * supported. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @return the column value ; if the value is a SQL NULL the - * value returned is null - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public RowId getRowId(String columnLabel) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Updates the designated column with a RowId value. The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support the RowId type; this method always - * throws an SQLException stating that the operation is not - * supported. - *

    - * - * - * @param columnIndex the first column is 1, the second 2, ... - * @param x the column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateRowId(int columnIndex, RowId x) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Updates the designated column with a RowId value. The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - * - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB does not support the RowId type; this method always - * throws an SQLException stating that the operation is not - * supported. - *

    - * - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param x the column value - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateRowId(String columnLabel, RowId x) throws SQLException { - throw JDBCUtil.notSupported(); - } - - /** - * Retrieves the holdability of this ResultSet object - * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @since JDK 1.6, HSQLDB 2.0 - */ - public int getHoldability() throws SQLException { - - checkClosed(); - - return ResultProperties.getJDBCHoldability(rsProperties); - } - - /** - * Retrieves whether this ResultSet object has been closed. - * A ResultSet is closed if the - * method close has been called on it, or if it is automatically closed. - * - * @return true if this ResultSet object is closed; false if it is still open - * @throws SQLException if a database access error occurs - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isClosed() throws SQLException { - return navigator == null; - } - - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * the result set concurrency is CONCUR_READ_ONLY - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - - public void updateNString(int columnIndex, - String nString) throws SQLException { - updateString(columnIndex, nString); - } - - /** - * Updates the designated column with a String value. - * It is intended for use when updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param nString the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * the result set concurrency is CONCUR_READ_ONLY - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateNString(String columnLabel, - String nString) throws SQLException { - updateString(columnLabel, nString); - } - - /** - * Updates the designated column with a java.sql.NClob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param nClob the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateNClob(int columnIndex, NClob nClob) throws SQLException { - updateClob(columnIndex, nClob); - } - - /** - * Updates the designated column with a java.sql.NClob value. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param nClob the value for the column to be updated - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateNClob(String columnLabel, - NClob nClob) throws SQLException { - updateClob(columnLabel, nClob); - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a NClob object representing the SQL - * NCLOB value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public NClob getNClob(int columnIndex) throws SQLException { - - String s = getString(columnIndex); - - return s == null ? null - : new JDBCNClob(s); - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a NClob object - * in the Java programming language. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @return a NClob object representing the SQL NCLOB - * value in the specified column - * @exception SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set - * or if a database access error occurs - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public NClob getNClob(String columnLabel) throws SQLException { - return getNClob(findColumn(columnLabel)); - } - - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public SQLXML getSQLXML(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - SQLXML sqlxml; - int type = resultMetaData.columnTypes[columnIndex - 1].typeCode; - - switch (type) { - - case Types.SQL_XML : { - Object object = getObject(columnIndex); - - if (object == null) { - sqlxml = null; - } else if (object instanceof SQLXML) { - sqlxml = (SQLXML) object; - } else { - throw JDBCUtil.notSupported(); - } - - break; - } - case Types.SQL_CLOB : { - Clob clob = getClob(columnIndex); - - if (clob == null) { - sqlxml = null; - } else { - sqlxml = new JDBCSQLXML(clob.getCharacterStream()); - } - - break; - } - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : { - java.io.Reader reader = getCharacterStream(columnIndex); - - if (reader == null) { - sqlxml = null; - } else { - sqlxml = new JDBCSQLXML(reader); - } - - break; - } - case Types.SQL_NCHAR : - case Types.SQL_NVARCHAR : { - java.io.Reader nreader = getNCharacterStream(columnIndex); - - if (nreader == null) { - sqlxml = null; - } else { - sqlxml = new JDBCSQLXML(nreader); - } - - break; - } - case Types.SQL_BLOB : { - Blob blob = getBlob(columnIndex); - - if (blob == null) { - sqlxml = null; - } else { - sqlxml = new JDBCSQLXML(blob.getBinaryStream()); - } - - break; - } - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : { - java.io.InputStream inputStream = getBinaryStream(columnIndex); - - if (inputStream == null) { - sqlxml = null; - } else { - sqlxml = new JDBCSQLXML(inputStream); - } - - break; - } - case Types.OTHER : - case Types.JAVA_OBJECT : { - Object data = getObject(columnIndex); - - if (data == null) { - sqlxml = null; - } else if (data instanceof SQLXML) { - sqlxml = (SQLXML) data; - } else if (data instanceof String) { - sqlxml = new JDBCSQLXML((String) data); - } else if (data instanceof byte[]) { - sqlxml = new JDBCSQLXML((byte[]) data); - } else if (data instanceof Blob) { - Blob blob = (Blob) data; - - sqlxml = new JDBCSQLXML(blob.getBinaryStream()); - } else if (data instanceof Clob) { - Clob clob = (Clob) data; - - sqlxml = new JDBCSQLXML(clob.getCharacterStream()); - } else { - throw JDBCUtil.notSupported(); - } - - break; - } - default : { - throw JDBCUtil.notSupported(); - } - } - - return sqlxml; - } - - /** - * Retrieves the value of the designated column in the current row of - * this ResultSet as a - * java.sql.SQLXML object in the Java programming language. - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @return a SQLXML object that maps an SQL XML value - * @throws SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public SQLXML getSQLXML(String columnLabel) throws SQLException { - return getSQLXML(findColumn(columnLabel)); - } - - /** - * Updates the designated column with a java.sql.SQLXML value. - * The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - *

    - * - * @param columnIndex the first column is 1, the second 2, ... - * @param xmlObject the value for the column to be updated - * @throws SQLException if a database access error occurs, this method - * is called on a closed result set, - * the java.xml.transform.Result, - * Writer or OutputStream has not been closed - * for the SQLXML object, - * if there is an error processing the XML value or - * the result set concurrency is CONCUR_READ_ONLY. The getCause method - * of the exception may provide a more detailed exception, for example, if the - * stream does not contain valid XML. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateSQLXML(int columnIndex, - SQLXML xmlObject) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setSQLXML(columnIndex, xmlObject); - } - - /** - * Updates the designated column with a java.sql.SQLXML value. - * The updater - * methods are used to update column values in the current row or the insert - * row. The updater methods do not update the underlying database; instead - * the updateRow or insertRow methods are called - * to update the database. - *

    - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param xmlObject the column value - * @throws SQLException if a database access error occurs, this method - * is called on a closed result set, - * the java.xml.transform.Result, - * Writer or OutputStream has not been closed - * for the SQLXML object, - * if there is an error processing the XML value or - * the result set concurrency is CONCUR_READ_ONLY. The getCause method - * of the exception may provide a more detailed exception, for example, if the - * stream does not contain valid XML. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateSQLXML(String columnLabel, - SQLXML xmlObject) throws SQLException { - updateSQLXML(findColumn(columnLabel), xmlObject); - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public String getNString(int columnIndex) throws SQLException { - return getString(columnIndex); - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as - * a String in the Java programming language. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @return the column value; if the value is SQL NULL, the - * value returned is null - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public String getNString(String columnLabel) throws SQLException { - return getString(findColumn(columnLabel)); - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language. - * @param columnIndex the first column is 1, the second is 2, ... - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public java.io.Reader getNCharacterStream( - int columnIndex) throws SQLException { - return getCharacterStream(columnIndex); - } - - /** - * Retrieves the value of the designated column in the current row - * of this ResultSet object as a - * java.io.Reader object. - * It is intended for use when - * accessing NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @return a java.io.Reader object that contains the column - * value; if the value is SQL NULL, the value returned is - * null in the Java programming language - * @exception SQLException if a database access error occurs - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public java.io.Reader getNCharacterStream( - String columnLabel) throws SQLException { - return getCharacterStream(findColumn(columnLabel)); - } - - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateNCharacterStream(int columnIndex, java.io.Reader x, - long length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, x, length); - } - - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateNCharacterStream(String columnLabel, - java.io.Reader reader, - long length) throws SQLException { - updateCharacterStream(columnLabel, reader, length); - } - -// --------------------------- Added: Mustang Build 86 ------------------------- - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateAsciiStream(int columnIndex, java.io.InputStream x, - long length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setAsciiStream(columnIndex, x, length); - } - - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateBinaryStream(int columnIndex, java.io.InputStream x, - long length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setBinaryStream(columnIndex, x, length); - } - - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateCharacterStream(int columnIndex, java.io.Reader x, - long length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, x, length); - } - - /** - * Updates the designated column with an ascii stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateAsciiStream(String columnLabel, java.io.InputStream x, - long length) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setAsciiStream(columnIndex, x, length); - } - - /** - * Updates the designated column with a binary stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param x the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateBinaryStream(String columnLabel, java.io.InputStream x, - long length) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setBinaryStream(columnIndex, x, length); - } - - /** - * Updates the designated column with a character stream value, which will have - * the specified number of bytes. - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @param length the length of the stream - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateCharacterStream(String columnLabel, - java.io.Reader reader, - long length) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, reader, length); - } - - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateBlob(int columnIndex, InputStream inputStream, - long length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setBlob(columnIndex, inputStream, length); - } - - /** - * Updates the designated column using the given input stream, which - * will have the specified number of bytes. - * When a very large ASCII value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.InputStream. Data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from ASCII to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @param length the number of bytes in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateBlob(String columnLabel, InputStream inputStream, - long length) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setBlob(columnIndex, inputStream, length); - } - - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateClob(int columnIndex, Reader reader, - long length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader, length); - } - - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @exception SQLException if a database access error occurs, - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateClob(String columnLabel, Reader reader, - long length) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader, length); - } - - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateNClob(int columnIndex, Reader reader, - long length) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader, length); - } - - /** - * Updates the designated column using the given Reader - * object, which is the given number of characters long. - * When a very large UNICODE value is input to a LONGVARCHAR - * parameter, it may be more practical to send it via a - * java.io.Reader object. The data will be read from the stream - * as needed until end-of-file is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    Note: This stream object can either be a standard - * Java stream object or your own subclass that implements the - * standard interface. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is the - * name of the column - * @param reader An object that contains the data to set the parameter value to. - * @param length the number of characters in the parameter data. - * @throws SQLException if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6, HSQLDB 2.0 - */ - public void updateNClob(String columnLabel, Reader reader, - long length) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader, length); - } - - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param reader the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateNCharacterStream( - int columnIndex, java.io.Reader reader) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, reader); - } - - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. The - * driver does the necessary conversion from Java character format to - * the national character set in the database. - * It is intended for use when - * updating NCHAR,NVARCHAR - * and LONGNVARCHAR columns. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateNCharacterStream( - String columnLabel, java.io.Reader reader) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, reader); - } - - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateAsciiStream(int columnIndex, - java.io.InputStream x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setAsciiStream(columnIndex, x); - } - - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateBinaryStream(int columnIndex, - java.io.InputStream x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setBinaryStream(columnIndex, x); - } - - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateCharacterStream(int columnIndex, - java.io.Reader x) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, x); - } - - /** - * Updates the designated column with an ascii stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateAsciiStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateAsciiStream(String columnLabel, - java.io.InputStream x) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setAsciiStream(columnIndex, x); - } - - /** - * Updates the designated column with a binary stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBinaryStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param x the new column value - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateBinaryStream(String columnLabel, - java.io.InputStream x) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setBinaryStream(columnIndex, x); - } - - /** - * Updates the designated column with a character stream value. - * The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateCharacterStream which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader the java.io.Reader object containing - * the new column value - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateCharacterStream( - String columnLabel, java.io.Reader reader) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setCharacterStream(columnIndex, reader); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnIndex is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateBlob(int columnIndex, - InputStream inputStream) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setBlob(columnIndex, inputStream); - } - - /** - * Updates the designated column using the given input stream. The data will be read from the stream - * as needed until end-of-stream is reached. - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateBlob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param inputStream An object that contains the data to set the parameter - * value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateBlob(String columnLabel, - InputStream inputStream) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setBlob(columnIndex, inputStream); - } - - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateClob(int columnIndex, - Reader reader) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader); - } - - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @exception SQLException if the columnLabel is not valid; if a database access error occurs; - * the result set concurrency is CONCUR_READ_ONLY - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateClob(String columnLabel, - Reader reader) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader); - } - - /** - * Updates the designated column using the given Reader - * - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnIndex the first column is 1, the second 2, ... - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnIndex is not valid; - * if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set, - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateNClob(int columnIndex, - Reader reader) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader); - } - - /** - * Updates the designated column using the given Reader - * object. - * The data will be read from the stream - * as needed until end-of-stream is reached. The JDBC driver will - * do any necessary conversion from UNICODE to the database char format. - * - *

    - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the updateRow or - * insertRow methods are called to update the database. - * - *

    Note: Consult your JDBC driver documentation to determine if - * it might be more efficient to use a version of - * updateNClob which takes a length parameter. - * - * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column - * @param reader An object that contains the data to set the parameter value to. - * @throws SQLException if the columnLabel is not valid; if the driver does not support national - * character sets; if the driver can detect that a data conversion - * error could occur; this method is called on a closed result set; - * if a database access error occurs or - * the result set concurrency is CONCUR_READ_ONLY - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since 1.6 - */ - public void updateNClob(String columnLabel, - Reader reader) throws SQLException { - - int columnIndex = findColumn(columnLabel); - - startUpdate(columnIndex); - preparedStatement.setClob(columnIndex, reader); - } - - // --------------------- java.sql.Wrapper implementation ------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return the - * the result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 2.0 - */ - @SuppressWarnings("unchecked") - public T unwrap(java.lang.Class iface) throws java.sql.SQLException { - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isWrapperFor( - java.lang.Class iface) throws java.sql.SQLException { - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - -//------------------------- JDBC 4.1 ----------------------------------- - - /** - *

    Retrieves the value of the designated column in the current row - * of this ResultSet object and will convert from the - * SQL type of the column to the requested Java data type, if the - * conversion is supported. If the conversion is not - * supported or null is specified for the type, a - * SQLException is thrown. - *

    - * At a minimum, an implementation must support the conversions defined in - * Appendix B, Table B-3 and conversion of appropriate user defined SQL - * types to a Java type which implements {@code SQLData}, or {@code Struct}. - * Additional conversions may be supported and are vendor defined. - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param type Class representing the Java data type to convert the designated - * column to. - * @return an instance of {@code type} holding the column value - * @throws SQLException if conversion is not supported, type is null or - * another error occurs. The getCause() method of the - * exception may provide a more detailed exception, for example, if - * a conversion error occurs - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - -//#ifdef JAVA8 - public T getObject(int columnIndex, Class type) throws SQLException { - - if (type == null) { - throw JDBCUtil.nullArgument(); - } - - final Object source = getColumnValue(columnIndex); - - if (wasNullValue) { - return null; - } - - Object o = null; - - switch(type.getName()){ - case "int": - case "java.lang.Integer": - o = getInt(columnIndex); - break; - case "double": - case "java.lang.Double": - o = getDouble(columnIndex); - break; - case "boolean": - case "java.lang.Boolean": - o = getBoolean(columnIndex); - break; - case "byte": - case "java.lang.Byte": - o = getByte(columnIndex); - break; - case "short": - case "java.lang.Short": - o = getShort(columnIndex); - break; - case "long": - case "java.lang.Long": - o = getLong(columnIndex); - break; - case "[B": - o = getBytes(columnIndex); - break; - case "java.lang.Object": - o = getObject(columnIndex); - break; - case "java.math.BigDecimal": - o = getBigDecimal(columnIndex); - break; - case "java.sql.Blob": - o = getBlob(columnIndex); - break; - - case "java.sql.Clob": - o = getClob(columnIndex); - break; - case "java.lang.String": - case "java.lang.CharSequence": - o = getString(columnIndex); - break; - - case "java.sql.Date": { - o = getDate(columnIndex); - break; - } - case "java.sql.Time": { - o = getTime(columnIndex); - break; - } - case "java.sql.Timestamp": { - o = getTimestamp(columnIndex); - break; - } - case "java.util.UUID": { - Type columnType = resultMetaData.columnTypes[columnIndex - 1]; - if (columnType.isUUIDType()) { - o = Type.SQL_GUID.convertSQLToJava(session, source); - } else { - Object value = Type.SQL_GUID.convertToTypeJDBC(session, - source, columnType); - o = Type.SQL_GUID.convertSQLToJava(session, value); - } - break; - } - case "java.time.Instant": { - Type columnType = resultMetaData.columnTypes[columnIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toInstant(session, v); - } - break; - } - case "java.time.LocalDate": { - Type columnType = resultMetaData.columnTypes[columnIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toLocalDate(session, v); - } - break; - } - case "java.time.LocalTime": { - Type columnType = resultMetaData.columnTypes[columnIndex - 1]; - if (columnType.isTimeType()) { - TimeData v = (TimeData) source; - o = ((DateTimeType) columnType).toLocalTime(session, v); - } else if (columnType.isTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toLocalTime(session, v); - } - break; - } - case "java.time.LocalDateTime": { - Type columnType = resultMetaData.columnTypes[columnIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toLocalDateTime(session, v); - } - break; - } - case "java.time.OffsetTime": { - Type columnType = resultMetaData.columnTypes[columnIndex - 1]; - if (columnType.isTimeType()) { - TimeData v = (TimeData) source; - o = ((DateTimeType) columnType).toOffsetTime(session, v); - } else if (columnType.isTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toOffsetTime(session, v); - } - - break; - } - case "java.time.OffsetDateTime": { - Type columnType = resultMetaData.columnTypes[columnIndex - 1]; - if (columnType.isDateOrTimestampType()) { - TimestampData v = (TimestampData) source; - o = ((DateTimeType) columnType).toOffsetDateTime(session, v); - } - break; - } - case "java.time.Duration": { - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - - if (!sourceType.isIntervalDaySecondType()) { - break; - } - IntervalSecondData v = (IntervalSecondData) source; - o = Duration.ofSeconds(v.getSeconds(), v.getNanos()); - break; - } - case "java.time.Period": { - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - - if (!sourceType.isIntervalYearMonthType()) { - break; - } - IntervalMonthData v = (IntervalMonthData) source; - int months = v.getMonths(); - - if (sourceType.typeCode == Types.SQL_INTERVAL_MONTH) { - o = Period.ofMonths(months); - } else { - o = Period.of(months / 12, months % 12, 0); - } - break; - } - case "java.sql.Array": { - o = getArray(columnIndex); - break; - } - } - - if (o == null) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - return (T) o; - } -//#else -/* - public T getObject(int columnIndex, Class type) throws SQLException { - throw JDBCUtil.notSupported(); - } -*/ - -//#endif JAVA8 - - /** - *

    Retrieves the value of the designated column in the current row - * of this ResultSet object and will convert from the - * SQL type of the column to the requested Java data type, if the - * conversion is supported. If the conversion is not - * supported or null is specified for the type, a - * SQLException is thrown. - *

    - * At a minimum, an implementation must support the conversions defined in - * Appendix B, Table B-3 and conversion of appropriate user defined SQL - * types to a Java type which implements {@code SQLData}, or {@code Struct}. - * Additional conversions may be supported and are vendor defined. - * - * @param columnLabel the label for the column specified with the SQL AS clause. - * If the SQL AS clause was not specified, then the label is the name - * of the column - * @param type Class representing the Java data type to convert the designated - * column to. - * @return an instance of {@code type} holding the column value - * @throws SQLException if conversion is not supported, type is null or - * another error occurs. The getCause() method of the - * exception may provide a more detailed exception, for example, if - * a conversion error occurs - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public T getObject(String columnLabel, - Class type) throws SQLException { - return getObject(findColumn(columnLabel), type); - } - -//------------------------- JDBC 4.2 ----------------------------------- - - /** - * Updates the designated column with an {@code Object} value. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the {@code updateRow} or - * {@code insertRow} methods are called to update the database. - *

    - * If the second argument is an {@code InputStream} then the stream must contain - * the number of bytes specified by scaleOrLength. If the second argument is a - * {@code Reader} then the reader must contain the number of characters specified - * by scaleOrLength. If these conditions are not true the driver will generate a - * {@code SQLException} when the statement is executed. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param targetSqlType the SQL type to be sent to the database - * @param scaleOrLength for an object of {@code java.math.BigDecimal} , - * this is the number of digits after the decimal point. For - * Java Object types {@code InputStream} and {@code Reader}, - * this is the length - * of the data in the stream or reader. For all other types, - * this value will be ignored. - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is {@code CONCUR_READ_ONLY} - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not - * support this method; if the JDBC driver does not support the specified targetSqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void updateObject(int columnIndex, Object x, - SQLType targetSqlType, int scaleOrLength) throws SQLException { - startUpdate(columnIndex); - preparedStatement.setObject(columnIndex, x, targetSqlType, scaleOrLength); - } - -//#endif JAVA8 - - /** - * Updates the designated column with an {@code Object} value. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the {@code updateRow} or - * {@code insertRow} methods are called to update the database. - *

    - * If the second argument is an {@code InputStream} then the stream must - * contain number of bytes specified by scaleOrLength. If the second - * argument is a {@code Reader} then the reader must contain the number - * of characters specified by scaleOrLength. If these conditions are not - * true the driver will generate a - * {@code SQLException} when the statement is executed. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is - * the name of the column - * @param x the new column value - * @param targetSqlType the SQL type to be sent to the database - * @param scaleOrLength for an object of {@code java.math.BigDecimal} , - * this is the number of digits after the decimal point. For - * Java Object types {@code InputStream} and {@code Reader}, - * this is the length - * of the data in the stream or reader. For all other types, - * this value will be ignored. - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is {@code CONCUR_READ_ONLY} - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not - * support this method; if the JDBC driver does not support the specified targetSqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void updateObject(String columnLabel, Object x, - SQLType targetSqlType, int scaleOrLength) throws SQLException { - updateObject(findColumn(columnLabel), x, targetSqlType, scaleOrLength); - } - -//#endif JAVA8 - - /** - * Updates the designated column with an {@code Object} value. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the {@code updateRow} or - * {@code insertRow} methods are called to update the database. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param columnIndex the first column is 1, the second is 2, ... - * @param x the new column value - * @param targetSqlType the SQL type to be sent to the database - * @exception SQLException if the columnIndex is not valid; - * if a database access error occurs; - * the result set concurrency is {@code CONCUR_READ_ONLY} - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not - * support this method; if the JDBC driver does not support the specified targetSqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void updateObject(int columnIndex, Object x, SQLType targetSqlType) - throws SQLException { - preparedStatement.setObject(columnIndex, x, targetSqlType); - } - -//#endif JAVA8 - - /** - * Updates the designated column with an {@code Object} value. - * - * The updater methods are used to update column values in the - * current row or the insert row. The updater methods do not - * update the underlying database; instead the {@code updateRow} or - * {@code insertRow} methods are called to update the database. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param columnLabel the label for the column specified with the SQL AS - * clause. If the SQL AS clause was not specified, then the label is - * the name of the column - * @param x the new column value - * @param targetSqlType the SQL type to be sent to the database - * @exception SQLException if the columnLabel is not valid; - * if a database access error occurs; - * the result set concurrency is {@code CONCUR_READ_ONLY} - * or this method is called on a closed result set - * @exception SQLFeatureNotSupportedException if the JDBC driver does not - * support this method; if the JDBC driver does not support the specified targetSqlType - * @see JDBCType - * @see SQLType - * @since 1.8 - */ -//#ifdef JAVA8 - public void updateObject(String columnLabel, Object x, - SQLType targetSqlType) throws SQLException { - updateObject(findColumn(columnLabel), x, targetSqlType); - } - -//#endif JAVA8 - - private Object getTimestampWithZone(int columnIndex) throws SQLException { - TimestampData v = (TimestampData) getColumnInType(columnIndex, - Type.SQL_TIMESTAMP_WITH_TIME_ZONE); - - if (v == null) { - return null; - } - return Type.SQL_TIMESTAMP_WITH_TIME_ZONE.convertSQLToJava(session, v); - } - - private Object getTimeWithZone(int columnIndex) throws SQLException { - DateTimeType columnType = (DateTimeType) resultMetaData.columnTypes[columnIndex - 1]; - TimeData v = (TimeData) getColumnValue(columnIndex); - - if (v == null) { - return null; - } - return columnType.convertSQLToJava(session, v); - } - -//------------------------ Internal Implementation ----------------------------- - - /** The internal representation. */ - private RowSetNavigator navigator; - - /** The internal representation. */ - protected ResultMetaData resultMetaData; - - /** - * Translation of INTERVAL types - */ - private boolean translateTTIType; - - /** How many columns does this ResultSet have? */ - private int columnCount; - - /** Did the last getXXX method encounter a null value? */ - private boolean wasNullValue; - - /** The ResultSetMetaData object for this ResultSet */ - private ResultSetMetaData resultSetMetaData; - - /** Accelerates fineColumn {@code Map} */ - private IntValueHashMap columnMap; - - /** The first warning in the chain. Null if there are no warnings. */ - private SQLWarning rootWarning; - - /** If true, retrieves a lob as an in-memory object - this breaks updatability*/ - private boolean memoryLobs; - - // -------------------------- Package Attributes ---------------------------- - - /** - * The Statement that generated this result. Null if the result is - * from DatabaseMetaData - */ - JDBCStatementBase statement; - - /** - * Session or ClientConnection - */ - SessionInterface session; - - /** JDBCConnection for this. */ - JDBCConnection connection; - - /** - * The scrollability / scroll sensitivity type of this result. - */ - boolean isScrollable; - - /** The updatability of this result. */ - boolean isUpdatable; - - /** The insertability of this result. */ - boolean isInsertable; - int rsProperties; - int fetchSize; - - /** Statement is closed when its result set is closed */ - boolean autoClose; - - /** The underlying result. */ - public Result result; - - //-------------------------- Private Methods ------------------------------- - - /** - * Fetches the current row of the result set. - * - * @throws SQLException when result set is closed; result set is empty; - * result set is before first; result set is after last; no row data is - * available. - * @return Object[] - */ - protected Object[] getCurrent() throws SQLException { - - final RowSetNavigator lnavigator = this.navigator; - - if (lnavigator == null) { - throw JDBCUtil.sqlException(ErrorCode.X_24501); - } else if (lnavigator.isEmpty()) { - throw JDBCUtil.sqlException(ErrorCode.X_24504, ErrorCode.M_RS_EMPTY); - } else if (lnavigator.isBeforeFirst()) { - throw JDBCUtil.sqlException(ErrorCode.X_24504, - ErrorCode.M_RS_BEFORE_FIRST); - } else if (lnavigator.isAfterLast()) { - throw JDBCUtil.sqlException(ErrorCode.X_24504, - ErrorCode.M_RS_AFTER_LAST); - } - - Object[] data = lnavigator.getCurrent(); - - if (data == null) { - throw JDBCUtil.sqlException(ErrorCode.X_24501); - } - - return data; - } - - /** - * Internal closed state check. - * - * @throws SQLException when this result set is closed - */ - private void checkClosed() throws SQLException { - - if (navigator == null) { - throw JDBCUtil.sqlException(ErrorCode.X_24501); - } - } - - /** - * Internal column index validity check. - * - * @param columnIndex to check - * @throws SQLException when this ResultSet has no such column - */ - protected void checkColumn(int columnIndex) throws SQLException { - - if (navigator == null) { - throw JDBCUtil.sqlException(ErrorCode.X_24501); - } - - if (columnIndex < 1 || columnIndex > columnCount) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_COLUMN_NOT_FOUND, - String.valueOf(columnIndex)); - } - } - - /** - * Internal wasNull tracker. - * - * @param o the Object to track - * @return boolean - */ - protected boolean trackNull(Object o) { - return (wasNullValue = (o == null)); - } - - /** - * Internal get value. - */ - protected Object getColumnValue(int columnIndex) throws SQLException { - - Object[] rowData = getCurrent(); - Object value; - - checkColumn(columnIndex); - - value = rowData[columnIndex - 1]; - - trackNull(value); - - return value; - } - - /** - * Internal value converter.

    - * - * All trivially successful getXXX methods eventually go through this - * method, converting if necessary from the source type to the - * requested type.

    - * - * Conversion to the JDBC representation, if different, is handled by the - * calling methods. - * - * @param columnIndex of the column value for which to perform the - * conversion - * @param targetType the org.hsqldb.types.Type object for targetType - * @return an Object of the requested targetType, representing the value of the - * specified column - * @throws SQLException when there is no rowData, the column index is - * invalid, or the conversion cannot be performed - */ - protected Object getColumnInType(int columnIndex, - Type targetType) throws SQLException { - - Object value = getColumnValue(columnIndex); - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - - if (value == null) { - return null; - } - - if (translateTTIType && targetType.isIntervalType()) { - targetType = ((IntervalType) targetType).getCharacterType(); - } - - if (sourceType.typeCode != targetType.typeCode) { - try { - value = targetType.convertToTypeJDBC(session, value, - sourceType); - } catch (Exception e) { - String stringValue = (value instanceof Number - || value - instanceof String) ? value.toString() - : "instance of " + value.getClass().getName(); - String msg = "from SQL type " + sourceType.getNameString() - + " to " + targetType.getJDBCClassName() - + ", value: " + stringValue; - - throw JDBCUtil.sqlException(ErrorCode.X_42561, msg); - } - } - - return value; - } - - private void checkNotForwardOnly() throws SQLException { - - if (!isScrollable) { - throw JDBCUtil.notSupported(); - } - } - - //-------------------------- Updates -------------------------------------- - JDBCPreparedStatement preparedStatement; - boolean isRowUpdated; - boolean isOnInsertRow; - - /** - * -2 after moveToInsertRow() - * -1 before any updateXXX() - * row number after any updateXXX() - * -1 after updateRow(), clearUpdate() or moveToCurrentRow(); - */ - int currentUpdateRowNumber = -1; - - private void checkUpdatable() throws SQLException { - - checkClosed(); - - if (!isUpdatable) { - throw JDBCUtil.notUpdatableColumn(); - } - } - - private void checkUpdatable(int columnIndex) throws SQLException { - - checkClosed(); - checkColumn(columnIndex); - - if (!isUpdatable) { - throw JDBCUtil.notUpdatableColumn(); - } - - if (resultMetaData.colIndexes[--columnIndex] == -1) { - throw JDBCUtil.notUpdatableColumn(); - } - - if (!resultMetaData.columns[columnIndex].isWriteable()) { - throw JDBCUtil.notUpdatableColumn(); - } - } - - void startUpdate(int columnIndex) throws SQLException { - - checkUpdatable(columnIndex); - - if (!isOnInsertRow) { - if (currentUpdateRowNumber != navigator.getRowNumber()) { - preparedStatement.clearParameters(); - } - currentUpdateRowNumber = navigator.getRowNumber(); - } - isRowUpdated = true; - } - - private void clearUpdates() throws SQLException { - - checkUpdatable(); - preparedStatement.clearParameters(); - currentUpdateRowNumber = -1; - isRowUpdated = false; - } - - private void startInsert() throws SQLException { - - checkUpdatable(); - - // check insertable - currentUpdateRowNumber = -2; - isOnInsertRow = true; - } - - private void endInsert() throws SQLException { - - checkUpdatable(); - preparedStatement.clearParameters(); - - currentUpdateRowNumber = -1; - isOnInsertRow = false; - } - - private void performUpdate() throws SQLException { - - preparedStatement.parameterValues[columnCount] = - getCurrent()[columnCount]; - - for (int i = 0; i < columnCount; i++) { - boolean set = preparedStatement.parameterSet[i]; - - preparedStatement.resultOut.metaData.columnTypes[i] = set - ? preparedStatement.parameterTypes[i] - : Type.SQL_ALL_TYPES; - } - preparedStatement.resultOut.setActionType( - ResultConstants.UPDATE_CURSOR); - preparedStatement.fetchResult(); - preparedStatement.clearParameters(); - - rootWarning = preparedStatement.getWarnings(); - - preparedStatement.clearWarnings(); - - isRowUpdated = false; - } - - private void performInsert() throws SQLException { - - checkUpdatable(); - - for (int i = 0; i < columnCount; i++) { - boolean set = preparedStatement.parameterSet[i]; - - if (!set) { - if(!resultMetaData.columns[i].isIdentity()) { - throw JDBCUtil.sqlException(ErrorCode.X_24515); - } - } - preparedStatement.resultOut.metaData.columnTypes[i] = - preparedStatement.parameterTypes[i]; - } - preparedStatement.resultOut.setActionType( - ResultConstants.INSERT_CURSOR); - preparedStatement.fetchResult(); - preparedStatement.clearParameters(); - - rootWarning = preparedStatement.getWarnings(); - - preparedStatement.clearWarnings(); - - isRowUpdated = false; - } - - private void performDelete() throws SQLException { - - checkUpdatable(); - - if (isOnInsertRow) { - throw JDBCUtil.sqlExceptionSQL(ErrorCode.X_24504); - } - - preparedStatement.parameterValues[columnCount] = - getCurrent()[columnCount]; - preparedStatement.resultOut.metaData.columnTypes[columnCount] = - resultMetaData.columnTypes[columnCount]; - - preparedStatement.resultOut.setActionType( - ResultConstants.DELETE_CURSOR); - preparedStatement.fetchResult(); - preparedStatement.clearParameters(); - - rootWarning = preparedStatement.getWarnings(); - - preparedStatement.clearWarnings(); - } - - //-------------------------- Other Methods -------------------------------- - // HSQLDB Specific - RowSetNavigator getNavigator() { - return navigator; - } - - void setNavigator(RowSetNavigator navigator) { - this.navigator = navigator; - } - - //------------------------------ Constructors ------------------------------- - - /** - * Constructs a new JDBCResultSet object using the specified - * navigator and org.hsqldb.result.ResultMetaData. - *

    - * - * @param conn JDBCConnection - * @param s the statement - * @param r the internal result form that the new - * JDBCResultSet represents - * @param metaData the connection properties - */ - public JDBCResultSet(JDBCConnection conn, JDBCStatementBase s, Result r, - ResultMetaData metaData) { - this(conn, r, metaData); - this.statement = s; - - isScrollable = ResultProperties.isScrollable(rsProperties); - - if (ResultProperties.isUpdatable(rsProperties)) { - isUpdatable = true; - isInsertable = true; - - for (int i = 0; i < metaData.colIndexes.length; i++) { - if (metaData.colIndexes[i] < 0) { - isInsertable = false; - - break; - } - } - - preparedStatement = new JDBCPreparedStatement(s.connection, result); - } - } - - public JDBCResultSet(JDBCConnection conn, Result r, - ResultMetaData metaData) { - - this.session = conn == null ? null - : conn.sessionProxy; - this.result = r; - this.connection = conn; - rsProperties = r.rsProperties; - navigator = r.getNavigator(); - resultMetaData = metaData; - columnCount = resultMetaData.getColumnCount(); - - if (conn != null) { - translateTTIType = conn.isTranslateTTIType; - memoryLobs = conn.isMemoryLobs; - } - } - - /** - * Factory method returns a new JDBCResultSet object for - * use with user defined functions that return a ResultSet object. - * See org.hsqldb.jdbc.JDBCArrayBasic for usage example. - *

    - * - * @param r the internal result form that the new - * JDBCResultSet represents - * @param metaData the connection properties - * @return ResultSet - */ - public static JDBCResultSet newJDBCResultSet(Result r, - ResultMetaData metaData) { - return new JDBCResultSetBasic(r, metaData); - } - - public static JDBCResultSet newEmptyResultSet() { - ResultMetaData md = ResultMetaData.newResultMetaData(1); - - ColumnBase column = - new ColumnBase(null, null, null, "C1"); - column.setType(Type.SQL_INTEGER); - md.columnTypes[0] = Type.SQL_INTEGER; - - md.columns[0] = column; - - Result r = Result.newSingleColumnResult(md); - - return newJDBCResultSet(r, md); - } - - static class JDBCResultSetBasic extends JDBCResultSet { - - JDBCResultSetBasic(Result r, ResultMetaData metaData) { - super(null, r, metaData); - } - - protected Object getColumnInType(int columnIndex, - Type targetType) throws SQLException { - - Object[] rowData = getCurrent(); - Type sourceType; - Object value; - - checkColumn(columnIndex); - - sourceType = resultMetaData.columnTypes[--columnIndex]; - value = rowData[columnIndex]; - - if (trackNull(value)) { - return null; - } - - if (sourceType.typeCode != targetType.typeCode) { - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - return value; - } - - public Date getDate(int columnIndex) throws SQLException { - return (Date) getColumnInType(columnIndex, Type.SQL_DATE); - } - - public Time getTime(int columnIndex) throws SQLException { - return (Time) getColumnInType(columnIndex, Type.SQL_DATE); - } - - public Timestamp getTimestamp(int columnIndex) throws SQLException { - return (Timestamp) getColumnInType(columnIndex, Type.SQL_DATE); - } - - public java.io.InputStream getBinaryStream( - int columnIndex) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public java.io.Reader getCharacterStream( - int columnIndex) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public Blob getBlob(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - Object o = getColumnInType(columnIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof Blob) { - return (Blob) o; - } else if (o instanceof byte[]) { - return new JDBCBlob((byte[]) o); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - public Clob getClob(int columnIndex) throws SQLException { - - checkColumn(columnIndex); - - Type sourceType = resultMetaData.columnTypes[columnIndex - 1]; - Object o = getColumnInType(columnIndex, sourceType); - - if (o == null) { - return null; - } - - if (o instanceof Clob) { - return (Clob) o; - } else if (o instanceof String) { - return new JDBCClob((String) o); - } - - throw JDBCUtil.sqlException(ErrorCode.X_42561); - } - - public Time getTime(int columnIndex, - Calendar cal) throws SQLException { - throw JDBCUtil.notSupported(); - } - - public Timestamp getTimestamp(int columnIndex, - Calendar cal) throws SQLException { - throw JDBCUtil.notSupported(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCResultSetMetaData.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCResultSetMetaData.java deleted file mode 100644 index 255ad0a3..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCResultSetMetaData.java +++ /dev/null @@ -1,1022 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.ResultSetMetaData; -import java.sql.SQLException; - -import org.hsqldb.error.ErrorCode; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.types.IntervalType; -import org.hsqldb.types.Type; -import org.hsqldb.types.Types; - -/* $Id: JDBCResultSetMetaData.java 6492 2022-04-21 07:30:40Z fredt $ */ - -// fredt@users - 20040412 - removed DITypeInfo dependencies -// campbell-burnet@users - 200404xx - removed unused imports;refinement for better -// usability of getColumnDisplaySize; -// javadoc updates -// campbell-burnet@users - 20051207 - patch 1.8.0.x initial JDBC 4.0 support work -// campbell-burnet@users - 20060522 - doc 1.9.0 full synch up to Mustang Build 84 -// fredt@users - 1.9.0 usage of types and new ResultMetadata and ColumnMetaData -// Revision 1.15 2006/07/12 12:29:42 boucherb -// patch 1.9.0 -// - full synch up to Mustang b90 -// - minor update to toString - -/** - * - * An object that can be used to get information about the types - * and properties of the columns in a ResultSet object. - * The following code fragment creates the ResultSet object rs, - * creates the ResultSetMetaData object rsmd, and uses rsmd - * to find out how many columns rs has and whether the first column in rs - * can be used in a WHERE clause. - *

    - *
    - *     ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
    - *     ResultSetMetaData rsmd = rs.getMetaData();
    - *     int numberOfColumns = rsmd.getColumnCount();
    - *     boolean b = rsmd.isSearchable(1);
    - *
    - * 
    - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports a subset of the {@code ResultSetMetaData} interface.

    - * - * The JDBC specification for {@code ResultSetMetaData} is in part very - * vague. This causes potential incompatibility between interpretations of the - * specification as realized in different JDBC driver implementations. As such, - * deciding to what degree reporting ResultSetMetaData is accurate has been - * considered very carefully. Hopefully, the design decisions made in light of - * these considerations have yielded precisely the subset of full - * ResultSetMetaData support that is most commonly needed and that is most - * important, while also providing, under the most common use-cases, the - * fastest access with the least overhead and the best compromise between - * speed, accuracy, jar-footprint and retention of JDBC resources.

    - * - * (fredt@users)
    - * (campbell-burnet@users)

    - *

    - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.2.6 - * @see JDBCStatement#executeQuery - * @see JDBCStatement#getResultSet - * @see java.sql.ResultSetMetaData - */ -public class JDBCResultSetMetaData implements ResultSetMetaData { - - /** - * - * Returns the number of columns in this ResultSet object. - * - * - * @return the number of columns - * @exception SQLException if a database access error occurs - */ - public int getColumnCount() throws SQLException { - return resultMetaData.getColumnCount(); - } - - /** - * - * Indicates whether the designated column is automatically numbered. - *

    (JDBC4 deleted:)[, thus read-only.] - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 fully supports SQL Standard features T174 and T176 that - * define identity column support. - * - *


    - * - * However, it must be stated here that contrary to the generic - * documentation previous to the JDBC4 specification, HSQLDB automatically - * numbered columns (IDENTITY columns, in HSQLDB parlance) are not - * read-only.

    - * - * In fact, the generic documentation previous to the JDBC4 specification - * seems to contradict the general definition of what, at minimum, - * an auto-increment column is:

    - * - * Simply, an auto-increment column is one that guarantees it has a - * autogenerated value after a successful insert or update operation, - * even if no value is supplied, or DEFAULT is specified.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isAutoIncrement(int column) throws SQLException { - - checkColumn(column); - - return resultMetaData.columns[--column].isIdentity(); - } - - /** - * - * Indicates whether a column's case matters. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 1.7.1 did not report this value accurately.

    - * - * Starting with 1.7.2, this feature is better supported.

    - * - * This method returns true for any column whose data type is a character - * type, with the exception of VARCHAR_IGNORECASE for which it returns - * false. It also returns false for any column whose data type is a - * not a character data type.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isCaseSensitive(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - if (type.isCharacterType()) { - return type.getCollation().isCaseSensitive(); - } - - return false; - } - - /** - * - * Indicates whether the designated column can be used in a where clause. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 handles this differently from previous versions.

    - * - * If the column in question is a database table or view column, and the - * type of the column allows searching, then returns true, otherwise false. - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isSearchable(int column) throws SQLException { - - checkColumn(column); - - return resultMetaData.columns[--column].isSearchable(); - } - - /** - * - * Indicates whether the designated column is a cash value. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 fully supports this feature and returns true for - * NUMERIC and DECIMAL columns.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isCurrency(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - return (type.typeCode == Types.SQL_DECIMAL - || type.typeCode == Types.SQL_NUMERIC) && type.scale > 0; - } - - /** - * - * Indicates the nullability of values in the designated column. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.2 fully supports this feature.

    - * - * {@code columnNoNulls} is always returned for result set columns - * that represent constants, sequences or table columns known - * to be not null. {@code columnNullable} is returned for NULL constants, - * or nullable table columns. {@code columnNullableUnknown} is returned - * for all other columns such as aggregates and computed values.

    - * - * To determine the nullable status of a table column in isolation from - * ResultSetMetaData and in a DBMS-independent fashion, the - * DatabaseMetaData.getColumns() method can be invoked with the - * appropriate filter values and the result should be inspected at the - * position described in the DatabaseMetaData.getColumns() API - * documentation. - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return the nullability status of the given column; one of columnNoNulls, - * columnNullable or columnNullableUnknown - * @exception SQLException if a database access error occurs - */ - public int isNullable(int column) throws SQLException { - - checkColumn(column); - - return resultMetaData.columns[--column].getNullability(); - } - - /** - * - * Indicates whether values in the designated column are signed numbers. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 fully supports this feature.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isSigned(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - return type.isNumberType(); - } - - /** - * - * Indicates the designated column's normal maximum width in characters. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 fully supports this feature.

    - * - * The current calculation follows these rules: - * - *

      - *
    1. Long character types and datetime types:

      - * - * The maximum length/precision, respectively. - * - *

    2. CHAR and VARCHAR types: - * - *
        - *
      • If the result set column is a direct pass through of a table - * column value and column size was declared, then the declared - * value is returned. - * - *
      • Otherwise, the computed length according to SQL Standard is - * returned. For very large values, the value of the system property - * hsqldb.max_xxxchar_display_size or the magic value - * 32766 (0x7FFE) (tested usable/accepted by most tools and - * compatible with assumptions made by java.io read/write - * UTF) when the system property is not defined or is not - * accessible, due to security constraints.

        - * - *

      - * - * It must be noted that the latter value in no way affects the - * ability of the HSQLDB JDBC driver to retrieve longer values - * and serves only as the current best effort at providing a - * value that maximizes usability across a wide range of tools, - * given that the HSQLDB database engine allows very large - * lengths to be declared. - * - *
    3. Number types:

      - * - * The max precision, plus the length of the negation character (1), - * plus (if applicable) the maximum number of characters that may - * occupy the exponent character sequence. Note that some legacy tools - * do not correctly handle BIGINT values of greater than 18 digits. - * - *

    4. BOOLEAN type:

      - * - * The length of the character sequence "false" (5), the longer of the - * two boolean value String representations. - * - *

    5. Remaining types:

      - * - * The maximum length/precision, respectively, as reported by - * DatabaseMetaData.getTypeInfo(), when applicable. If the maximum - * display size is unknown, unknowable or inapplicable, then zero is - * returned.

      - * - *

    - * - *
    - * - * - * @param column the first column is 1, the second is 2, ... - * @return the normal maximum number of characters allowed as the width - * of the designated column - * @exception SQLException if a database access error occurs - */ - public int getColumnDisplaySize(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - return type.displaySize(); - } - - /** - * - * Gets the designated column's suggested title for use in printouts and - * displays. (JDBC4 clarification:) The suggested title is usually specified by the SQL AS - * clause. If a SQL AS is not specified, the value returned from - * getColumnLabel will be the same as the value returned by the - * getColumnName method. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * In HSQLDB, a {@code ResultSet} column label is determined using the - * following order of precedence: - * - *

      - *
    1. The label (alias) specified in the generating query.
    2. - *
    3. The name of the underlying column, if no label is specified.
      - *
    4. C1, C2, etc. for computed columns that have no label.
    5. - *

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return the suggested column title - * @exception SQLException if a database access error occurs - */ - public String getColumnLabel(int column) throws SQLException { - - checkColumn(column--); - - String label = resultMetaData.columnLabels[column]; - - if (label != null && label.length() > 0) { - return label; - } - - return resultMetaData.columns[column].getNameString(); - } - - /** - * - * Get the designated column's name. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * In HSQLDB, a ResultSet column name is determined using the following - * order of precedence: - * - *

      - *
    1. The name of the underlying column, if the ResultSet column - * represents a column in a table.
    2. - *
    3. The label or alias specified in the generating query.
    4. - *
    5. C1, C2, etc. for computed columns that have no label.
    6. - *

    - * - * If the jdbc.get_column_name property of the JDBC Connection - * has been set to false, this method returns the same value as - * {@link #getColumnLabel(int)}.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return column name - * @exception SQLException if a database access error occurs - */ - public String getColumnName(int column) throws SQLException { - - checkColumn(column--); - - if (useColumnName) { - String name = resultMetaData.columns[column].getNameString(); - - if (name != null && name.length() > 0) { - return name; - } - } - - String label = resultMetaData.columnLabels[column]; - - return label == null ? resultMetaData.columns[column].getNameString() - : label; - } - - /** - * - * Get the designated column's table's schema. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Since 1.8.0.x, HSQLDB implements standard SQL SCHEMA support; - * this method returns the actual schema of the column's table. - * Columns generated in queries have no schema name. - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return schema name or "" if not applicable - * @exception SQLException if a database access error occurs - */ - public String getSchemaName(int column) throws SQLException { - - checkColumn(column); - - String name = resultMetaData.columns[--column].getSchemaNameString(); - - return name == null ? "" - : name; - } - - /** - * - * (JDBC4 clarification:) - * Get the designated column's specified column size. - * For numeric data, this is the maximum precision. For character data, this is the [maximum] length in characters. - * For datetime datatypes, this is the [maximum] length in characters of the String representation (assuming the - * maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes. For the ROWID datatype, - * this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. 0 is returned for data types where the - * column size is not applicable. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 reports the correct length or precision for - * all columns. For DOUBLE, the binary precision of 64 is returned, while - * for other numeric types the decimal precision is returned.

    - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return precision - * @exception SQLException if a database access error occurs - */ - public int getPrecision(int column) throws SQLException { - - checkColumn(column); - - // type in columnTypes overrides column type - Type type = translateType(resultMetaData.columnTypes[--column]); - return type.getJDBCPrecision(); - } - - /** - * - * Gets the designated column's number of digits to right of the decimal point. - * 0 is returned for data types where the scale is not applicable. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 reports the correct scale for all columns.

    - * - * For datetime and interval types such as Timestamp or Time, the - * fractional second precision is reported.

    - * - * The reported scale for INTEGER, BIGINT and DOUBLE is 0

    - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return scale - * @exception SQLException if a database access error occurs - */ - public int getScale(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - return type.getJDBCScale(); - } - - /** - * - * Gets the designated column's table name. - * - * - * @param column the first column is 1, the second is 2, ... - * @return table name or "" if not applicable - * @exception SQLException if a database access error occurs - */ - public String getTableName(int column) throws SQLException { - - checkColumn(column); - - String name = resultMetaData.columns[--column].getTableNameString(); - - return name == null ? "" - : name; - } - - /** - * - * Gets the designated column's table's catalog name. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0, HSQLDB returns the name of the catalog. The default name is - * PUBLIC. - * This value can be changed for the database using an SQL command.

    - * - * HSQLDB supports use of catalog qualification in DLL or DML when it is - * allowed by the Standard.

    - * - * However, not all clients respect the SQL Standard and may use a - * catalog qualifier in a context where it is not supported by the Standard. - *

    - * - * For greater detail, see discussion at: - * {@link JDBCDatabaseMetaData}.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return the name of the catalog for the table in which the given column - * appears or "" if not applicable - * @exception SQLException if a database access error occurs - */ - public String getCatalogName(int column) throws SQLException { - - checkColumn(column); - - String name = resultMetaData.columns[--column].getCatalogNameString(); - - return name == null ? "" - : name; - } - - /** - * - * Retrieves the designated column's SQL type. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * This reports the SQL type code of the column. For time and timestamp - * types that are WITH TIME ZONE, the values as the SQL Standard CLI - * codes.

    - * - *

    - * - * - * - * @param column the first column is 1, the second is 2, ... - * @return SQL type from java.sql.Types - * @exception SQLException if a database access error occurs - * @see java.sql.Types - */ - public int getColumnType(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - return type.getJDBCTypeCode(); - } - - /** - * - * Retrieves the designated column's database-specific type name. - * - * - * @param column the first column is 1, the second is 2, ... - * @return type name used by the database. If the column type is - * a user-defined type, then a fully-qualified type name is returned. - * @exception SQLException if a database access error occurs - */ - public String getColumnTypeName(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - return type.getNameString(); - } - - /** - * - * Indicates whether the designated column is definitely not writable. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0 this method returns true if the ResultSet is not updatable - * or the column in question is not updatable.

    - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isReadOnly(int column) throws SQLException { - - checkColumn(column); - - return !resultMetaData.columns[--column].isWriteable(); - } - - /** - * - * Indicates whether it is possible for a write on the designated column to - * succeed. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0 this method returns false if the ResultSet is not updatable - * or the column in question is not updatable.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isWritable(int column) throws SQLException { - - checkColumn(column); - - return resultMetaData.colIndexes != null - && resultMetaData.colIndexes[--column] > -1; - } - - /** - * - * Indicates whether a write on the designated column will definitely succeed. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * From 2.0 this method returns false if the ResultSet is not updatable - * or the column in question is not updatable.

    - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return true if so; false otherwise - * @exception SQLException if a database access error occurs - */ - public boolean isDefinitelyWritable(int column) throws SQLException { - - checkColumn(column); - - return resultMetaData.colIndexes != null - && resultMetaData.colIndexes[--column] > -1; - } - - //--------------------------JDBC 2.0----------------------------------- - - /** - * - *

    Returns the fully-qualified name of the Java class whose instances - * are manufactured if the method ResultSet.getObject - * is called to retrieve a value - * from the column. ResultSet.getObject may return a subclass of the - * class returned by this method. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 2.0 fully supports this feature.

    - * - * For columns of type OTHER, there is no specific class name and - * java.lang.Object is returned. - * - *

    - * - * - * @param column the first column is 1, the second is 2, ... - * @return the fully-qualified name of the class in the Java programming - * language that would be used by the method - * ResultSet.getObject to retrieve the value in the specified - * column. This is the class name used for custom mapping. - * @exception SQLException if a database access error occurs - * @since JDK 1.2 - */ - public String getColumnClassName(int column) throws SQLException { - - checkColumn(column); - - Type type = translateType(resultMetaData.columnTypes[--column]); - - return type.getJDBCClassName(); - } - - //----------------------------- JDBC 4.0 ----------------------------------- - // ------------------- java.sql.Wrapper implementation --------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return the - * result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6 - */ - @SuppressWarnings("unchecked") - public T unwrap(java.lang.Class iface) throws java.sql.SQLException { - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6 - */ - public boolean isWrapperFor( - java.lang.Class iface) throws java.sql.SQLException { - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - -// ------------------------- Internal Implementation --------------------------- - private ResultMetaData resultMetaData; - - /** - * Whether to use the underlying column name or label when reporting - * getColumnName(). - */ - private boolean useColumnName; - private boolean translateTTIType; - private int columnCount; - - /** - * Constructs a new JDBCResultSetMetaData object from the specified - * object. - * - * @param meta the ResultMetaData object from which to construct a new - * JDBCResultSetMetaData object - * @throws SQLException if a database access error occurs - */ - JDBCResultSetMetaData(ResultMetaData meta, boolean isUpdatable, - boolean isInsertable, - JDBCConnection conn) throws SQLException { - init(meta, conn); - } - - /** - * Initializes this JDBCResultSetMetaData object from the specified - * Result and HsqlProperties objects. - * - * @param meta the ResultMetaData object from which to initialize this - * JDBCResultSetMetaData object - * @param conn the JDBCConnection - * @throws SQLException if a database access error occurs - */ - void init(ResultMetaData meta, JDBCConnection conn) throws SQLException { - - resultMetaData = meta; - columnCount = resultMetaData.getColumnCount(); - - // fredt - props is null for internal connections, so always use the - // default behaviour in this case - // JDBCDriver.getPropertyInfo says - // default is true - useColumnName = true; - - if (conn == null) { - return; - } - - useColumnName = conn.isUseColumnName; - translateTTIType = conn.isTranslateTTIType; - } - - /** - * Performs an internal check for column index validity.

    - * - * @param column index of column to check - * @throws SQLException when this object's parent ResultSet has - * no such column - */ - private void checkColumn(int column) throws SQLException { - - if (column < 1 || column > columnCount) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_COLUMN_NOT_FOUND, - String.valueOf(column)); - } - } - - /** - * Translates an INTERVAL type to VARCHAR. - * Removes time zone from datetime types. - * - */ - private Type translateType(Type type) { - - if (this.translateTTIType) { - if (type.isIntervalType()) { - type = ((IntervalType) type).getCharacterType(); - } - } - - return type; - } - - /** - * Returns a string representation of the object.

    - * - * The string consists of the name of the class of which the - * object is an instance, the at-sign character `{@code @}', - * the unsigned hexadecimal representation of the hash code of the - * object and a comma-delimited list of this object's indexed attributes, - * enclosed in square brackets. - * - * @return a string representation of the object. - */ - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append(super.toString()); - - if (columnCount == 0) { - sb.append("[columnCount=0]"); - - return sb.toString(); - } - sb.append('['); - - for (int i = 0; i < columnCount; i++) { - JDBCColumnMetaData meta = getColumnMetaData(i + 1); - - sb.append('\n'); - sb.append(" column_"); - sb.append(i + 1); - sb.append('='); - sb.append(meta); - - if (i + 1 < columnCount) { - sb.append(','); - sb.append(' '); - } - } - sb.append('\n'); - sb.append(']'); - - return sb.toString(); - } - - JDBCColumnMetaData getColumnMetaData(int i) { - - JDBCColumnMetaData meta = new JDBCColumnMetaData(); - - try { - meta.catalogName = getCatalogName(i); - meta.columnClassName = getColumnClassName(i); - meta.columnDisplaySize = getColumnDisplaySize(i); - meta.columnLabel = getColumnLabel(i); - meta.columnName = getColumnName(i); - meta.columnType = getColumnType(i); - meta.isAutoIncrement = isAutoIncrement(i); - meta.isCaseSensitive = isCaseSensitive(i); - meta.isCurrency = isCurrency(i); - meta.isDefinitelyWritable = isDefinitelyWritable(i); - meta.isNullable = isNullable(i); - meta.isReadOnly = isReadOnly(i); - meta.isSearchable = isSearchable(i); - meta.isSigned = isSigned(i); - meta.isWritable = isWritable(i); - meta.precision = getPrecision(i); - meta.scale = getScale(i); - meta.schemaName = getSchemaName(i); - meta.tableName = getTableName(i); - } catch (SQLException e) { - } - - return meta; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCRowId.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCRowId.java deleted file mode 100644 index be8edb15..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCRowId.java +++ /dev/null @@ -1,223 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.StringConverter; - -import java.io.IOException; -import java.sql.RowId; -import java.sql.SQLException; -import java.util.Arrays; - -/* $Id: JDBCRowId.java 6492 2022-04-21 07:30:40Z fredt $ */ - -//campbell-burnet@users 20060522 - doc 1.8.1 full synch up to Mustang Build 84 - -/** - * - * The representation (mapping) in the Java programming language of an SQL ROWID - * value. An SQL ROWID is a built-in type, a value of which can be thought of as - * an address for its identified row in a database table. Whether that address - * is logical or, in any respects, physical is determined by its originating data - * source. - *

    - * Methods in the interfaces ResultSet, CallableStatement, - * and PreparedStatement, such as getRowId and setRowId - * allow a programmer to access a SQL ROWID value. The RowId - * interface provides a method - * for representing the value of the ROWID as a byte array or as a - * String. - *

    - * The method getRowIdLifetime in the interface DatabaseMetaData, - * can be used - * to determine if a RowId object remains valid for the duration of the transaction in - * which the RowId was created, the duration of the session in which - * the RowId was created, - * or, effectively, for as long as its identified row is not deleted. In addition - * to specifying the duration of its valid lifetime outside its originating data - * source, getRowIdLifetime specifies the duration of a ROWID - * value's valid lifetime - * within its originating data source. In this, it differs from a large object, - * because there is no limit on the valid lifetime of a large object within its - * originating data source. - *

    - * All methods on the RowId interface must be fully implemented if the - * JDBC driver supports the data type. - * - * @see java.sql.DatabaseMetaData - * @since JDK 1.6, HSQLDB 2.0 - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - */ -public final class JDBCRowId implements RowId { - - private int hash; - - // ------------------------- Internal Implementation ----------------------- - private final byte[] id; - - /** - * Constructs a new JDBCRowId instance wrapping the given octet sequence.

    - * - * This constructor may be used internally to retrieve result set values as - * RowId objects, yet it also may need to be public to allow access from - * other packages. As such (in the interest of efficiency) this object - * maintains a reference to the given octet sequence rather than making a - * copy; special care should be taken by external clients never to use this - * constructor with a byte array object that may later be modified - * externally. - * - * @param id the octet sequence representing the Rowid value - * @throws SQLException if the argument is null - */ - public JDBCRowId(final byte[] id) throws SQLException { - - if (id == null) { - throw JDBCUtil.nullArgument("id"); - } - this.id = id; - } - - /** - * Constructs a new JDBCRowId instance whose internal octet sequence - * is a copy of the octet sequence of the given RowId object.

    - * - * @param id the octet sequence representing the Rowid value - * @throws SQLException if the argument is null - */ - public JDBCRowId(RowId id) throws SQLException { - this(id.getBytes()); - } - - /** - * Constructs a new JDBCRowId instance whose internal octet sequence - * is that represented by the given hexadecimal character sequence.

    - * @param hex the hexadecimal character sequence from which to derive - * the internal octet sequence - * @throws java.sql.SQLException if the argument is null or is not a valid - * hexadecimal character sequence - */ - public JDBCRowId(final String hex) throws SQLException { - - if (hex == null) { - throw JDBCUtil.nullArgument("hex"); - } - - try { - this.id = StringConverter.hexStringToByteArray(hex); - } catch (IOException e) { - throw JDBCUtil.sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, - "hex: " + e); - - // .illegalHexadecimalCharacterSequenceArgumentException("hex", e); - } - } - - /** - * Compares this RowId to the specified object. The result is - * true if and only if the argument is not null and is a RowId - * object that represents the same ROWID as this object. - *

    - * It is important - * to consider both the origin and the valid lifetime of a RowId - * when comparing it to another RowId. If both are valid, and - * both are from the same table on the same data source, then if they are equal - * they identify - * the same row; if one or more is no longer guaranteed to be valid, or if - * they originate from different data sources, or different tables on the - * same data source, they may be equal but still - * not identify the same row. - * - * @param obj the Object to compare this RowId object - * against. - * @return true if the RowIds are equal; false otherwise - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean equals(Object obj) { - return (obj instanceof JDBCRowId) - && Arrays.equals(this.id, ((JDBCRowId) obj).id); - } - - /** - * Returns an array of bytes representing the value of the SQL ROWID - * designated by this java.sql.RowId object. - * - * @return an array of bytes, whose length is determined by the driver supplying - * the connection, representing the value of the ROWID designated by this - * java.sql.RowId object. - */ - public byte[] getBytes() { - return id.clone(); - } - - /** - * Returns a String representing the value of the SQL ROWID designated by this - * java.sql.RowId object. - *

    - * Like java.sql.Date.toString() - * returns the contents of its DATE as the String "2004-03-17" - * rather than as DATE literal in SQL (which would have been the String - * DATE "2004-03-17"), toString() - * returns the contents of its ROWID in a form specific to the driver supplying - * the connection, and possibly not as a ROWID literal. - * - * @return a String whose format is determined by the driver supplying the - * connection, representing the value of the ROWID designated - * by this java.sql.RowId object. - */ - public String toString() { - return StringConverter.byteArrayToHexString(id); - } - - /** - * Returns a hash code value of this RowId object. - * - * @return a hash code for the RowId - */ - public int hashCode() { - - if (hash == 0) { - hash = Arrays.hashCode(id); - } - - return hash; - } - - /** - * Direct access to id bytes for subclassing. - * - * @return direct reference to id bytes. - */ - Object id() { - return id; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCSQLXML.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCSQLXML.java deleted file mode 100644 index 1f34b34b..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCSQLXML.java +++ /dev/null @@ -1,3163 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.CharArrayReader; -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.StringReader; -import java.io.Writer; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.nio.charset.Charset; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLXML; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.FactoryConfigurationError; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stax.StAXResult; -import javax.xml.transform.stax.StAXSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ClosableByteArrayOutputStream; -import org.hsqldb.lib.StringConverter; -import org.w3c.dom.DOMException; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.EntityReference; -import org.w3c.dom.Node; -import org.w3c.dom.ProcessingInstruction; -import org.w3c.dom.Text; -import org.w3c.dom.bootstrap.DOMImplementationRegistry; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; - -/* $Id: JDBCSQLXML.java 6492 2022-04-21 07:30:40Z fredt $ */ - -/** - * - * The mapping in the JavaTM programming language for the SQL XML type. - * XML is a built-in type that stores an XML value - * as a column value in a row of a database table. - * By default drivers implement an SQLXML object as - * a logical pointer to the XML data - * rather than the data itself. - * An SQLXML object is valid for the duration of the transaction in which it was created. - *

    - * The SQLXML interface provides methods for accessing the XML value - * as a String, a Reader or Writer, or as a Stream. The XML value - * may also be accessed through a Source or set as a Result, which - * are used with XML Parser APIs such as DOM, SAX, and StAX, as - * well as with XSLT transforms and XPath evaluations. - *

    - * Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement, - * such as getSQLXML allow a programmer to access an XML value. - * In addition, this interface has methods for updating an XML value. - *

    - * The XML value of the SQLXML instance may be obtained as a BinaryStream using - *

    - *   SQLXML sqlxml = resultSet.getSQLXML(column);
    - *   InputStream binaryStream = sqlxml.getBinaryStream();
    - * 
    - * For example, to parse an XML value with a DOM parser: - *
    - *   DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    - *   Document result = parser.parse(binaryStream);
    - * 
    - * or to parse an XML value with a SAX parser to your handler: - *
    - *   SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
    - *   parser.parse(binaryStream, myHandler);
    - * 
    - * or to parse an XML value with a StAX parser: - *
    - *   XMLInputFactory factory = XMLInputFactory.newInstance();
    - *   XMLStreamReader streamReader = factory.createXMLStreamReader(binaryStream);
    - * 
    - *

    - * Because databases may use an optimized representation for the XML, - * accessing the value through getSource() and - * setResult() can lead to improved processing performance - * without serializing to a stream representation and parsing the XML. - *

    - * For example, to obtain a DOM Document Node: - *

    - *   DOMSource domSource = sqlxml.getSource(DOMSource.class);
    - *   Document document = (Document) domSource.getNode();
    - * 
    - * or to set the value to a DOM Document Node to myNode: - *
    - *   DOMResult domResult = sqlxml.setResult(DOMResult.class);
    - *   domResult.setNode(myNode);
    - * 
    - * or, to send SAX events to your handler: - *
    - *   SAXSource saxSource = sqlxml.getSource(SAXSource.class);
    - *   XMLReader xmlReader = saxSource.getXMLReader();
    - *   xmlReader.setContentHandler(myHandler);
    - *   xmlReader.parse(saxSource.getInputSource());
    - * 
    - * or, to set the result value from SAX events: - *
    - *   SAXResult saxResult = sqlxml.setResult(SAXResult.class);
    - *   ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
    - *   contentHandler.startDocument();
    - *   // set the XML elements and attributes into the result
    - *   contentHandler.endDocument();
    - * 
    - * or, to obtain StAX events: - *
    - *   StAXSource staxSource = sqlxml.getSource(StAXSource.class);
    - *   XMLStreamReader streamReader = staxSource.getXMLStreamReader();
    - * 
    - * or, to set the result value from StAX events: - *
    - *   StAXResult staxResult = sqlxml.getResult(StAXResult.class);
    - *   XMLStreamWriter streamWriter = staxResult.getXMLStreamWriter();
    - * 
    - * or, to perform XSLT transformations on the XML value using the XSLT in xsltFile - * output to file resultFile: - *
    - *   File xsltFile = new File("a.xslt");
    - *   File myFile = new File("result.xml");
    - *   Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
    - *   Source source = sqlxml.getSource(null);
    - *   Result result = new StreamResult(myFile);
    - *   xslt.transform(source, result);
    - * 
    - * or, to evaluate an XPath expression on the XML value: - *
    - *   XPath xpath = XPathFactory.newInstance().newXPath();
    - *   DOMSource domSource = sqlxml.getSource(DOMSource.class);
    - *   Document document = (Document) domSource.getNode();
    - *   String expression = "/foo/@bar";
    - *   String barValue = xpath.evaluate(expression, document);
    - * 
    - * To set the XML value to be the result of an XSLT transform: - *
    - *   File sourceFile = new File("source.xml");
    - *   Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
    - *   Source streamSource = new StreamSource(sourceFile);
    - *   Result result = sqlxml.setResult(null);
    - *   xslt.transform(streamSource, result);
    - * 
    - * Any Source can be transformed to a Result using the identity transform - * specified by calling newTransformer(): - *
    - *   Transformer identity = TransformerFactory.newInstance().newTransformer();
    - *   Source source = sqlxml.getSource(null);
    - *   File myFile = new File("result.xml");
    - *   Result result = new StreamResult(myFile);
    - *   identity.transform(source, result);
    - * 
    - * To write the contents of a Source to standard output: - *
    - *   Transformer identity = TransformerFactory.newInstance().newTransformer();
    - *   Source source = sqlxml.getSource(null);
    - *   Result result = new StreamResult(System.out);
    - *   identity.transform(source, result);
    - * 
    - * To create a DOMSource from a DOMResult: - *
    - *    DOMSource domSource = new DOMSource(domResult.getNode());
    - * 
    - *

    - * Incomplete or invalid XML values may cause an SQLException when - * set or the exception may occur when execute() occurs. All streams - * must be closed before execute() occurs or an SQLException will be thrown. - *

    - * Reading and writing XML values to or from an SQLXML object can happen at most once. - * The conceptual states of readable and not readable determine if one - * of the reading APIs will return a value or throw an exception. - * The conceptual states of writable and not writable determine if one - * of the writing APIs will set a value or throw an exception. - *

    - * The state moves from readable to not readable once free() or any of the - * reading APIs are called: getBinaryStream(), getCharacterStream(), getSource(), and getString(). - * Implementations may also change the state to not writable when this occurs. - *

    - * The state moves from writable to not writeable once free() or any of the - * writing APIs are called: setBinaryStream(), setCharacterStream(), setResult(), and setString(). - * Implementations may also change the state to not readable when this occurs. - *

    - * All methods on the SQLXML interface must be fully implemented if the - * JDBC driver supports the data type. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 2.0, a rudimentary client-side SQLXML interface - * implementation (this class) is supported for local use when the product is - * built and run under JDK 1.6+ and the SQLXML instance is constructed as the - * result of calling JDBCConnection.createSQLXML().

    - * - * SQLXML instances retrieved in such a fashion are initially write-only, with - * the lifecycle of read and write availability constrained in accordance with - * the documentation of the interface methods.

    - * - * When build and run under JDK 1.6+, it is also possible to retrieve read-only - * SQLXML instances from JDBCResultSet.getSQLXML(...), given that the underlying - * data can be converted to an XML Document Object Model (DOM).

    - * - * However, at the time of this writing (2007-06-12) it is not yet possible to - * store SQLXML objects directly into an HSQLDB database or to use them directly - * for HSQLDB statement parameterization purposes. This is because the SQLXML - * data type is not yet natively supported by the HSQLDB engine. Instead, a - * JDBCSQLXML instance must first be read as a string, binary input stream, - * character input stream and so on, which can then be used for such purposes.

    - * - * Here is the current read/write availability lifecycle for JDBCSQLXML: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Lifecycle
    - * Origin - * - * Initially - * - * After 1st Write - * - * After 1st Read - * - * After 1st Free - *
    - * {@code org.hsqldb.jdbc.JDBCConnection.createSQLXML()} - * - * Write-only - * - * Read-only - * - * Not readable or writable - * - * Not readable or writable - *
    - * {@code org.hsqldb.jdbc.JDBCResultSet.getSQLXML(...)} - * - * Read-only - * - * N/A - * - * Not readable or writable - * - * Not readable or writable - *
    - *

    - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @see javax.xml.parsers - * @see javax.xml.stream - * @see javax.xml.transform - * @see javax.xml.xpath - * @since JDK 1.6, HSQLDB 2.0 - */ -public class JDBCSQLXML implements SQLXML { - - private static String domFeatures = "XML 3.0 Traversal +Events 2.0"; - private static DOMImplementation domImplementation; - private static DOMImplementationRegistry domImplementationRegistry; - private static ThreadPoolExecutor executorService; - private static Transformer identityTransformer; - private static TransformerFactory transformerFactory; - - /** - * Precomputed Charset to reduce octet to character sequence conversion - * charset lookup overhead. - */ - private static final Charset utf8Charset; - private static ArrayBlockingQueue workQueue; - - static { - Charset charset = null; - - try { - charset = Charset.forName("UTF8"); - } catch (Exception e) { - } - utf8Charset = charset; - } - - /** - * When non-null, the SAX ContentHandler currently in use to build this - * object's SQLXML value from a SAX event sequence. - */ - private SAX2DOMBuilder builder; - - /** - * Whether this object is closed. When closed, no further reading - * or writing is possible. - */ - private boolean closed; - - // ------------------------- Internal Implementation ----------------------- - - /** - * This object's SQLXML value as a GZIPed byte array - */ - private volatile byte[] gzdata; - - /** - * When non-null, the stream currently in use to read this object's - * SQLXML value as an octet sequence. - */ - private InputStream inputStream; - - /** - * When non-null, the stream currently in use to write this object's - * SQLXML value from an octet sequence. - */ - private ClosableByteArrayOutputStream outputStream; - - /** - * When non-null, the DOMResult currently in use to build this object's - * SQLXML value. - */ - private DOMResult domResult; - - /** - * This object's public id - */ - private String publicId; - - /** - * Whether it is possible to read this object's SQLXML value. - */ - private boolean readable; - - /** - * This object's system id - */ - private String systemId; - - /** - * Whether it is possible to write this object's SQLXML value. - */ - private boolean writable; - - /** - * Constructs a new, initially write-only JDBCSQLXML object. - */ - protected JDBCSQLXML() { - setReadable(false); - setWritable(true); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given octet - * sequence. - * - * @param bytes the octet sequence representing the SQLXML value - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(byte[] bytes) throws SQLException { - this(bytes, null); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given character - * sequence. - * - * @param chars the character sequence representing the SQLXML value - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(char[] chars) throws SQLException { - this(chars, 0, chars.length, null); - } - - /** - * Constructs a new JDBCSQLXML object from the given Document. - * - * @param document the Document representing the SQLXML value - * @throws java.sql.SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(Document document) throws SQLException { - this(new DOMSource(document)); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given octet - * sequence.

    - * - * Relative URI references will be resolved against the present working - * directory reported by the Java virtual machine. - * - * @param inputStream an octet stream representing an SQLXML value - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(InputStream inputStream) throws SQLException { - this(inputStream, null); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given character - * sequence.

    - * - * Relative URI references will be resolved against the present working - * directory reported by the Java virtual machine.

    - * - * Note:Normally, a byte stream should be used rather than a reader, - * so that the XML parser can resolve character encoding specified by the - * XML declaration. However, in many cases the encoding of the input stream - * is already resolved, as in the case of reading XML from a StringReader. - * - * @param reader a character stream representing an SQLXML value - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(Reader reader) throws SQLException { - this(reader, null); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given Source - * object. - * - * @param source a Source representing an SQLXML value - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - public JDBCSQLXML(Source source) throws SQLException { - init(source); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given character - * sequence.

    - * - * Relative URI references will be resolved against the present working - * directory reported by the Java virtual machine. - * - * @param string a character sequence representing an SQLXML value - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(String string) throws SQLException { - this(new StreamSource(new StringReader(string))); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given octet - * sequence. - * - * @param bytes the octet sequence representing the SQLXML value - * @param systemId must be a String that conforms to the URI syntax; - * allows relative URIs to be processed. - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(byte[] bytes, String systemId) throws SQLException { - this(new StreamSource(new ByteArrayInputStream(bytes), systemId)); - } - - protected JDBCSQLXML(char[] chars, String systemId) throws SQLException { - this(chars, 0, chars.length, systemId); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given octet - * sequence.

    - * - * Relative URI references will be resolved against the given systemId. - * - * @param inputStream an octet stream representing an SQLXML value - * @param systemId a String that conforms to the URI syntax, indicating - * the URI from which the XML data is being read, so that relative URI - * references can be resolved - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(InputStream inputStream, - String systemId) throws SQLException { - this(new StreamSource(inputStream, systemId)); - this.inputStream = inputStream; - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given character - * sequence.

    - * - * Relative URI references will be resolved against the given systemId.

    - * - * Note:Normally, a byte stream should be used rather than a reader, - * so that the XML parser can resolve character encoding specified by the - * XML declaration. However, in many cases the encoding of the input stream - * is already resolved, as in the case of reading XML from a StringReader. - * - * @param reader a character stream representing an SQLXML value; - * @param systemId a String that conforms to the URI syntax, indicating - * the URI from which the XML data is being read, so that relative URI - * references can be resolved - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(Reader reader, String systemId) throws SQLException { - this(new StreamSource(reader, systemId)); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given character - * sequence.

    - * - * Relative URI references will be resolved against the given systemId. - * - * @param string a character sequence representing an SQLXML value - * @param systemId a String that conforms to the URI syntax, indicating - * the URI from which the XML data is being read, so that relative URI - * references can be resolved - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(String string, String systemId) throws SQLException { - this(new StreamSource(new StringReader(string), systemId)); - } - - /** - * Constructs a new read-only JDBCSQLXML object from the given gzipped octet - * sequence. - * - * @param bytes the gzipped octet sequence representing the SQLXML value - * @param clone whether to clone the given gzipped octet sequence - * @param systemId id - * @param publicId id - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected JDBCSQLXML(byte[] bytes, boolean clone, String systemId, - String publicId) throws SQLException { - - this.setGZipData(clone ? bytes.clone() - : bytes); - - this.systemId = systemId; - this.publicId = publicId; - } - - protected JDBCSQLXML(char[] chars, int offset, int length, - String systemId) throws SQLException { - this(new StreamSource(new CharArrayReader(chars, offset, length), - systemId)); - } - - /** - * This method closes this object and releases the resources that it held. - * The SQL XML object becomes invalid and neither readable nor writable - * when this method is called.

    - * - * After free has been called, any attempt to invoke a - * method other than free will result in a SQLException - * being thrown. If free is called multiple times, the subsequent - * calls to free are treated as a no-op. - * @throws SQLException if there is an error freeing the XML value. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 - */ - public void free() throws SQLException { - close(); - } - - /** - * Retrieves the XML value designated by this SQLXML instance as a stream. - * The bytes of the input stream are interpreted according to appendix F of the XML 1.0 specification. - * The behavior of this method is the same as ResultSet.getBinaryStream() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

    - * The SQL XML object becomes not readable when this method is called and - * may also become not writable depending on implementation. - * - * @return a stream containing the XML data. - * @throws SQLException if there is an error processing the XML value. - * An exception is thrown if the state is not readable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 - */ - public synchronized InputStream getBinaryStream() throws SQLException { - - checkClosed(); - checkReadable(); - - InputStream rval = getBinaryStreamImpl(); - - setReadable(false); - setWritable(false); - - return rval; - } - - /** - * Retrieves a stream that can be used to write the XML value that this SQLXML instance represents. - * The stream begins at position 0. - * The bytes of the stream are interpreted according to appendix F of the XML 1.0 specification - * The behavior of this method is the same as ResultSet.updateBinaryStream() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

    - * The SQL XML object becomes not writeable when this method is called and - * may also become not readable depending on implementation. - * - * @return a stream to which data can be written. - * @throws SQLException if there is an error processing the XML value. - * An exception is thrown if the state is not writable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 - */ - public synchronized OutputStream setBinaryStream() throws SQLException { - - checkClosed(); - checkWritable(); - - OutputStream rval = setBinaryStreamImpl(); - - setWritable(false); - setReadable(true); - - return rval; - } - - /** - * Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object. - * The format of this stream is defined by org.xml.sax.InputSource, - * where the characters in the stream represent the unicode code points for - * XML according to section 2 and appendix B of the XML 1.0 specification. - * Although an encoding declaration other than unicode may be present, - * the encoding of the stream is unicode. - * The behavior of this method is the same as ResultSet.getCharacterStream() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

    - * The SQL XML object becomes not readable when this method is called and - * may also become not writable depending on implementation. - * - * @return a stream containing the XML data. - * @throws SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not readable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 - */ - public synchronized Reader getCharacterStream() throws SQLException { - - checkClosed(); - checkReadable(); - - Reader reader = getCharacterStreamImpl(); - - setReadable(false); - setWritable(false); - - return reader; - } - - /** - * Retrieves a stream to be used to write the XML value that this SQLXML instance represents. - * The format of this stream is defined by org.xml.sax.InputSource, - * where the characters in the stream represent the unicode code points for - * XML according to section 2 and appendix B of the XML 1.0 specification. - * Although an encoding declaration other than unicode may be present, - * the encoding of the stream is unicode. - * The behavior of this method is the same as ResultSet.updateCharacterStream() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

    - * The SQL XML object becomes not writable when this method is called and - * may also become not readable depending on implementation. - * - * @return a stream to which data can be written. - * @throws SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not writable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 Build 79 - */ - public synchronized Writer setCharacterStream() throws SQLException { - - checkClosed(); - checkWritable(); - - Writer writer = setCharacterStreamImpl(); - - setReadable(true); - setWritable(false); - - return writer; - } - - /** - * Returns a string representation of the XML value designated by this SQLXML instance. - * The format of this String is defined by org.xml.sax.InputSource, - * where the characters in the stream represent the unicode code points for - * XML according to section 2 and appendix B of the XML 1.0 specification. - * Although an encoding declaration other than unicode may be present, - * the encoding of the String is unicode. - * The behavior of this method is the same as ResultSet.getString() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

    - * The SQL XML object becomes not readable when this method is called and - * may also become not writable depending on implementation. - * - * @return a string representation of the XML value designated by this SQLXML instance. - * @throws SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not readable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 - */ - public synchronized String getString() throws SQLException { - - checkClosed(); - checkReadable(); - - String value = getStringImpl(); - - setReadable(false); - setWritable(false); - - return value; - } - - /** - * Sets the XML value designated by this SQLXML instance to the given String representation. - * The format of this String is defined by org.xml.sax.InputSource, - * where the characters in the stream represent the unicode code points for - * XML according to section 2 and appendix B of the XML 1.0 specification. - * Although an encoding declaration other than unicode may be present, - * the encoding of the String is unicode. - * The behavior of this method is the same as ResultSet.updateString() - * when the designated column of the ResultSet has a type java.sql.Types of SQLXML. - *

    - * The SQL XML object becomes not writeable when this method is called and - * may also become not readable depending on implementation. - * - * @param value the XML value - * @throws SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not writable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 - */ - public synchronized void setString(String value) throws SQLException { - - if (value == null) { - throw JDBCUtil.nullArgument("value"); - } - checkWritable(); - setStringImpl(value); - setReadable(true); - setWritable(false); - } - - /** - * Returns a Source for reading the XML value designated by this SQLXML instance. - * Sources are used as inputs to XML parsers and XSLT transformers. - *

    - * Sources for XML parsers will have namespace processing on by default. - * The systemID of the Source is implementation dependent. - *

    - * The SQL XML object becomes not readable when this method is called and - * may also become not writable depending on implementation. - *

    - * Note that SAX is a callback architecture, so a returned - * SAXSource should then be set with a content handler that will - * receive the SAX events from parsing. The content handler - * will receive callbacks based on the contents of the XML. - *

    -     *   SAXSource saxSource = sqlxml.getSource(SAXSource.class);
    -     *   XMLReader xmlReader = saxSource.getXMLReader();
    -     *   xmlReader.setContentHandler(myHandler);
    -     *   xmlReader.parse(saxSource.getInputSource());
    -     * 
    - * - * @param sourceClass The class of the source, or null. - * If the class is null, a vendor specific Source implementation will be returned. - * The following classes are supported at a minimum: - *
    -     *   javax.xml.transform.dom.DOMSource - returns a DOMSource
    -     *   javax.xml.transform.sax.SAXSource - returns a SAXSource
    -     *   javax.xml.transform.stax.StAXSource - returns a StAXSource
    -     *   javax.xml.transform.stream.StreamSource - returns a StreamSource
    -     * 
    - * @return a Source for reading the XML value. - * @throws SQLException if there is an error processing the XML value - * or if this feature is not supported. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if an XML parser exception occurs. - * An exception is thrown if the state is not readable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 Build 79 - */ - @SuppressWarnings("unchecked") - public synchronized T getSource( - Class sourceClass) throws SQLException { - - checkClosed(); - checkReadable(); - - final Source source = getSourceImpl(sourceClass); - - setReadable(false); - setWritable(false); - - return (T) source; - } - - /** - * Returns a Result for setting the XML value designated by this SQLXML instance. - *

    - * The systemID of the Result is implementation dependent. - *

    - * The SQL XML object becomes not writable when this method is called and - * may also become not readable depending on implementation. - *

    - * Note that SAX is a callback architecture and the returned - * SAXResult has a content handler assigned that will receive the - * SAX events based on the contents of the XML. Call the content - * handler with the contents of the XML document to assign the values. - *

    -     *   SAXResult saxResult = sqlxml.getResult(SAXResult.class);
    -     *   ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
    -     *   contentHandler.startDocument();
    -     *   // set the XML elements and attributes into the result
    -     *   contentHandler.endDocument();
    -     * 
    - * - * @param resultClass The class of the result, or null. - * If resultClass is null, a vendor specific Result implementation will be returned. - * The following classes are supported at a minimum: - *
    -     *   javax.xml.transform.dom.DOMResult - returns a DOMResult
    -     *   javax.xml.transform.sax.SAXResult - returns a SAXResult
    -     *   javax.xml.transform.stax.StAXResult - returns a StAXResult
    -     *   javax.xml.transform.stream.StreamResult - returns a StreamResult
    -     * 
    - * @return Returns a Result for setting the XML value. - * @throws SQLException if there is an error processing the XML value - * or if this feature is not supported. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if an XML parser exception occurs. - * An exception is thrown if the state is not writable. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - * @since JDK 1.6 Build 79 - */ - public synchronized T setResult( - Class resultClass) throws SQLException { - - checkClosed(); - checkWritable(); - - final T result = createResult(resultClass); - - setReadable(true); - setWritable(false); - - return result; - } - - /** - * @return that may be used to perform processing asynchronously. - */ - protected static ExecutorService getExecutorService() { - - if (JDBCSQLXML.executorService == null) { - int corePoolSize = 1; - int maximumPoolSize = 10; - long keepAliveTime = 1; - TimeUnit unit = TimeUnit.SECONDS; - - JDBCSQLXML.workQueue = new ArrayBlockingQueue(10); - JDBCSQLXML.executorService = new ThreadPoolExecutor(corePoolSize, - maximumPoolSize, keepAliveTime, unit, workQueue); - } - - return executorService; - } - - /** - * @return with which to obtain xml transformer instances. - * @throws java.sql.SQLException when unable to obtain a factory instance. - */ - protected static TransformerFactory getTransformerFactory() throws SQLException { - - if (JDBCSQLXML.transformerFactory == null) { - try { - JDBCSQLXML.transformerFactory = - TransformerFactory.newInstance(); - } catch (TransformerFactoryConfigurationError ex) { - throw Exceptions.transformFailed(ex); - } - } - - return JDBCSQLXML.transformerFactory; - } - - /** - * @return used to perform identity transforms - * @throws java.sql.SQLException when unable to obtain the instance. - */ - protected static Transformer getIdentityTransformer() throws SQLException { - - if (JDBCSQLXML.identityTransformer == null) { - try { - JDBCSQLXML.identityTransformer = - getTransformerFactory().newTransformer(); - } catch (TransformerConfigurationException ex) { - throw Exceptions.transformFailed(ex); - } - } - - return JDBCSQLXML.identityTransformer; - } - - /** - * @return with which to construct DOM implementation instances. - * @throws java.sql.SQLException when unable to obtain a factory instance. - */ - protected static DOMImplementationRegistry getDOMImplementationRegistry() throws SQLException { - - if (domImplementationRegistry == null) { - try { - domImplementationRegistry = - DOMImplementationRegistry.newInstance(); - } catch (ClassCastException ex) { - throw Exceptions.domInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.domInstantiation(ex); - } catch (ClassNotFoundException ex) { - throw Exceptions.domInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.domInstantiation(ex); - } - } - - return domImplementationRegistry; - } - - /** - * @return with which to create document instances. - * @throws java.sql.SQLException when unable to obtain the DOM - * implementation instance. - */ - protected static DOMImplementation getDOMImplementation() throws SQLException { - - if (domImplementation == null) { - domImplementation = - getDOMImplementationRegistry().getDOMImplementation( - domFeatures); - } - - if (domImplementation == null) { - Exception ex = new RuntimeException("Not supported: " - + domFeatures); - - throw Exceptions.domInstantiation(ex); - } - - return domImplementation; - } - - /** - * @param namespaceURI of the document element to create or {@code null}. - * @param qualifiedName of the document element to be created or {@code null}. - * @param docType of document to be created or {@code null}. - * When {@code doctype} is not {@code null}, its - * {@code Node.ownerDocument} attribute is set to the document - * being created. - * @return with its document element. - * If the {@code NamespaceURI}, {@code qualifiedName}, and - * {@code doctype} are {@code null}, the returned - * {@code Document} is empty with no document element. - * @throws java.sql.SQLException wrapping any internal exception that occurs. - * @see org.w3c.dom.DOMImplementation#createDocument(String,String,DocumentType) - */ - protected static Document createDocument(String namespaceURI, - String qualifiedName, DocumentType docType) throws SQLException { - - try { - return getDOMImplementation().createDocument(namespaceURI, - qualifiedName, docType); - } catch (DOMException ex) { - throw Exceptions.domInstantiation(ex); - } - } - - /** - * @return that is empty with no document element. - * @throws java.sql.SQLException wrapping any internal exception that occurs. - */ - protected static Document createDocument() throws SQLException { - return createDocument(null, null, null); - } - - /** - * Initializes this object's SQLXML value from the given Source - * object. - * - * @param source the Source representing the SQLXML value - * @throws SQLException if the argument does not represent a - * valid SQLXML value - */ - protected void init(Source source) throws SQLException { - - if (source == null) { - throw JDBCUtil.nullArgument("source"); - } - - Transformer transformer = - JDBCSQLXML.getIdentityTransformer(); - StreamResult result = new StreamResult(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - GZIPOutputStream gzos; - - try { - gzos = new GZIPOutputStream(baos); - } catch (IOException ex) { - throw Exceptions.transformFailed(ex); - } - result.setOutputStream(gzos); - - try { - transformer.transform(source, result); - } catch (TransformerException ex) { - throw Exceptions.transformFailed(ex); - } - - try { - gzos.close(); - } catch (IOException ex) { - throw Exceptions.transformFailed(ex); - } - - byte[] data = baos.toByteArray(); - - setGZipData(data); - setReadable(true); - setWritable(false); - } - - /** - * Assigns this object's SQLXML value from the designated gzipped array - * of bytes. - * - * @param data the SQLXML value - * @throws java.sql.SQLException if the argument does not represent a - * valid SQLXML value - */ - protected void setGZipData(byte[] data) throws SQLException { - - if (data == null) { - throw JDBCUtil.nullArgument("data"); - } - this.gzdata = data; - } - - /** - * Directly retrieves this object's present SQLMXL value as a gzipped - * array of bytes.

    - * - * May be null, empty or invalid. - * - * @return this object's SQLMXL value as a gzipped byte array - */ - protected byte[] gZipData() { - return this.gzdata; - } - - /** - * Retrieves this object's SQLXML value as a gzipped array of bytes, - * possibly by terminating any in-progress write operations and converting - * accumulated intermediate data. - * - * @throws java.sql.SQLException if an underlying I/O or transform - * error occurs - * @return this object's SQLXML value - */ - protected byte[] getGZipData() throws SQLException { - - byte[] bytes = gZipData(); - - if (bytes != null) { - return bytes; - } - - if (this.domResult != null) { - DOMSource source = new DOMSource(domResult.getNode(), - domResult.getSystemId()); - OutputStream os = setBinaryStreamImpl(); - StreamResult result = new StreamResult(os); - - try { - JDBCSQLXML.identityTransformer.transform(source, result); - } catch (TransformerException ex) { - throw Exceptions.transformFailed(ex); - } - - try { - os.close(); - } catch (IOException ex) { - throw Exceptions.transformFailed(ex); - } - } - - if (this.outputStream == null) { - throw Exceptions.notReadable("No Data."); - } else if (!this.outputStream.isClosed()) { - throw Exceptions.notReadable( - "Stream used for writing must be closed but is still open."); - } else if (this.outputStream.isFreed()) { - throw Exceptions.notReadable( - "Stream used for writing was freed and is no longer valid."); - } - - try { - setGZipData(this.outputStream.toByteArray()); - - return gZipData(); - } catch (IOException ex) { - throw Exceptions.notReadable(); - } finally { - this.freeOutputStream(); - } - } - - /** - * closes this object and releases the resources that it holds. - */ - protected synchronized void close() { - - this.closed = true; - - setReadable(false); - setWritable(false); - freeOutputStream(); - freeInputStream(); - freeDomResult(); - - this.gzdata = null; - } - - /** - * Closes the input stream, if any, currently in use to read this object's - * SQLXML value and nullifies the stream reference to make it eligible - * for subsequent garbage collection. - */ - protected void freeInputStream() { - - if (this.inputStream != null) { - try { - this.inputStream.close(); - } catch (IOException ex) { - - // ex.printStackTrace(); - } finally { - this.inputStream = null; - } - } - } - - /** - * Closes the output stream, if any, currently in use to write this object's - * SQLXML value and nullifies the stream reference to make it eligible for - * subsequent garbage collection. The stream's data buffer reference may - * also be nullified, in order to make it eligible for garbage collection - * immediately, just in case an external client still holds a reference to - * the output stream. - */ - protected void freeOutputStream() { - - if (this.outputStream != null) { - this.outputStream.free(); - this.outputStream = null; - } - } - - /** - * Checks whether this object is closed (has been freed). - * - * @throws java.sql.SQLException if this object is closed. - */ - protected synchronized void checkClosed() throws SQLException { - - if (this.closed) { - throw Exceptions.inFreedState(); - } - } - - /** - * Checks whether this object is readable. - * - * @throws java.sql.SQLException if this object is not readable. - */ - protected synchronized void checkReadable() throws SQLException { - - if (!this.isReadable()) { - throw Exceptions.notReadable(); - } - } - - /** - * Assigns this object's readability status. - * - * @param readable if {@code true}, then readable; else not readable - */ - protected synchronized void setReadable(boolean readable) { - this.readable = readable; - } - - /** - * Checks whether this object is writable. - * - * @throws java.sql.SQLException if this object is not writable. - */ - protected synchronized void checkWritable() throws SQLException { - - if (!this.isWritable()) { - throw Exceptions.notWritable(); - } - } - - /** - * Assigns this object's writability status. - * - * @param writable if {@code true}, then writable; else not writable - */ - protected synchronized void setWritable(boolean writable) { - this.writable = writable; - } - - /** - * Retrieves the object's readability status. - * - * @return if {@code true}, then readable; else not readable - */ - public synchronized boolean isReadable() { - return this.readable; - } - - /** - * Retrieves the object's readability status. - * - * @return if {@code true}, then writable; else not writable - */ - public synchronized boolean isWritable() { - return this.writable; - } - - /** - * Retrieves a stream representing the XML value designated by this - * SQLXML instance. - * - * @return a stream containing the XML data. - * @throws SQLException if there is an error processing the XML value. - */ - protected InputStream getBinaryStreamImpl() throws SQLException { - - try { - byte[] data = getGZipData(); - ByteArrayInputStream bais = new ByteArrayInputStream(data); - - return new GZIPInputStream(bais); - } catch (IOException ex) { - throw Exceptions.transformFailed(ex); - } - } - - /** - * Retrieves a reader representing the XML value designated by this - * SQLXML instance. - * - * @return a reader containing the XML data. - * @throws SQLException if there is an error processing the XML value. - */ - protected Reader getCharacterStreamImpl() throws SQLException { - return new InputStreamReader(getBinaryStreamImpl()); - } - - /** - * Retrieves a string representing the XML value designated by this - * SQLXML instance. - * - * @return a string containing the XML data. - * @throws SQLException if there is an error processing the XML value. - */ - protected String getStringImpl() throws SQLException { - - try { - return StringConverter.inputStreamToString(getBinaryStreamImpl(), - "US-ASCII"); - } catch (IOException ex) { - throw Exceptions.transformFailed(ex); - } - } - - /** - * Retrieves a stream to completely write the XML value this SQLXML - * instance represents. - * - * @return a stream to which the data can be written. - * @throws SQLException if there is an error processing the XML value. - */ - protected OutputStream setBinaryStreamImpl() throws SQLException { - - this.outputStream = new ClosableByteArrayOutputStream(); - - try { - return new GZIPOutputStream(this.outputStream); - } catch (IOException ex) { - this.outputStream = null; - - throw Exceptions.resultInstantiation(ex); - } - } - - /** - * Retrieves a writer to completely write the XML value this SQLXML - * instance represents. - * - * @return a writer to which the data can be written. - * @throws SQLException if there is an error processing the XML value. - * The getCause() method of the exception may provide a more detailed exception, for example, - * if the stream does not contain valid characters. - * An exception is thrown if the state is not writable. - * @since JDK 1.6 Build 79 - */ - protected Writer setCharacterStreamImpl() throws SQLException { - return new OutputStreamWriter(setBinaryStreamImpl()); - } - - /** - * Sets the XML value designated by this SQLXML instance using the given - * String representation. - * - * @param value the XML value - * @throws SQLException if there is an error processing the XML value. - */ - protected void setStringImpl(String value) throws SQLException { - init(new StreamSource(new StringReader(value))); - } - - /** - * Returns a Source for reading the XML value designated by this SQLXML - * instance. - * - * @param sourceClass The class of the source, or null. If null, then a - * DOMSource is returned. - * @return a Source for reading the XML value. - * @throws SQLException if there is an error processing the XML value - * or if the given {@code sourceClass} is not supported. - */ - protected T getSourceImpl( - Class sourceClass) throws SQLException { - - if (StreamSource.class.isAssignableFrom(sourceClass)) { - return createStreamSource(sourceClass); - } else if ((sourceClass == null) - || DOMSource.class.isAssignableFrom(sourceClass)) { - return createDOMSource(sourceClass); - } else if (SAXSource.class.isAssignableFrom(sourceClass)) { - return createSAXSource(sourceClass); - } else if (StAXSource.class.isAssignableFrom(sourceClass)) { - return createStAXSource(sourceClass); - } - - throw JDBCUtil.invalidArgument("sourceClass: " + sourceClass); - } - - /** - * Retrieves a new StreamSource for reading the XML value designated by this - * SQLXML instance. - * - * @param sourceClass The class of the source - * @throws java.sql.SQLException if there is an error processing the XML - * value or if the given {@code sourceClass} is not supported. - * @return a new StreamSource for reading the XML value designated by this - * SQLXML instance - */ - @SuppressWarnings("unchecked") - protected T createStreamSource( - Class sourceClass) throws SQLException { - - StreamSource source; - - try { - if (sourceClass == null) source = new StreamSource(); - else { - source = (StreamSource) sourceClass.getDeclaredConstructor().newInstance(); - } - } catch (SecurityException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (ClassCastException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.sourceInstantiation(ex); - } - - Reader reader = getCharacterStreamImpl(); - - source.setReader(reader); - - return (T) source; - } - - /** - * Retrieves a new DOMSource for reading the XML value designated by this - * SQLXML instance. - * - * @param sourceClass The class of the source - * @throws java.sql.SQLException if there is an error processing the XML - * value or if the given {@code sourceClass} is not supported. - * @return a new DOMSource for reading the XML value designated by this - * SQLXML instance - */ - @SuppressWarnings("unchecked") - protected T createDOMSource( - Class sourceClass) throws SQLException { - - DOMSource source; - - try { - if (sourceClass == null) source = new DOMSource(); - else { - source = (DOMSource) sourceClass.getDeclaredConstructor().newInstance(); - } - } catch (SecurityException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (ClassCastException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.sourceInstantiation(ex); - } - - Transformer transformer = JDBCSQLXML.getIdentityTransformer(); - InputStream stream = this.getBinaryStreamImpl(); - StreamSource streamSource = new StreamSource(); - DOMResult result = new DOMResult(); - - streamSource.setInputStream(stream); - - try { - transformer.transform(streamSource, result); - } catch (TransformerException ex) { - throw Exceptions.transformFailed(ex); - } - source.setNode(result.getNode()); - source.setSystemId(result.getSystemId()); - - return (T) source; - } - - /** - * Retrieves a new SAXSource for reading the XML value designated by this - * SQLXML instance.

    - * - * @param sourceClass The class of the source - * @throws java.sql.SQLException if there is an error processing the XML - * value or if the given {@code sourceClass} is not supported. - * @return a new SAXSource for reading the XML value designated by this - * SQLXML instance - */ - @SuppressWarnings("unchecked") - protected T createSAXSource( - Class sourceClass) throws SQLException { - - SAXSource source; - - try { - if (sourceClass == null) source = new SAXSource(); - else { - source = (SAXSource) sourceClass.getDeclaredConstructor().newInstance(); - } - } catch (SecurityException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (ClassCastException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.sourceInstantiation(ex); - } - - Reader reader = getCharacterStreamImpl(); - InputSource inputSource = new InputSource(reader); - - source.setInputSource(inputSource); - - return (T) source; - } - - /** - * Retrieves a new StAXSource for reading the XML value designated by this - * SQLXML instance. - * - * @param sourceClass The class of the source - * @throws java.sql.SQLException if there is an error processing the XML - * value or if the given {@code sourceClass} is not supported. - * @return a new StAXSource for reading the XML value designated by this - * SQLXML instance - */ - @SuppressWarnings("unchecked") - protected T createStAXSource( - Class sourceClass) throws SQLException { - - StAXSource source = null; - Constructor sourceCtor = null; - Reader reader = null; - XMLInputFactory factory = null; - XMLEventReader eventReader = null; - - try { - factory = XMLInputFactory.newInstance(); - } catch (FactoryConfigurationError ex) { - throw Exceptions.sourceInstantiation(ex); - } - - try { - sourceCtor = - (sourceClass == null) - ? StAXSource.class.getConstructor(XMLEventReader.class) - : sourceClass.getConstructor(XMLEventReader.class); - } catch (SecurityException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.sourceInstantiation(ex); - } - reader = getCharacterStreamImpl(); - - try { - eventReader = factory.createXMLEventReader(reader); - } catch (XMLStreamException ex) { - throw Exceptions.sourceInstantiation(ex); - } - - try { - source = (StAXSource) sourceCtor.newInstance(eventReader); - } catch (SecurityException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (IllegalArgumentException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.sourceInstantiation(ex.getTargetException()); - } catch (ClassCastException ex) { - throw Exceptions.sourceInstantiation(ex); - } - - return (T) source; - } - - /** - * Retrieves a new Result for setting the XML value designated by this - * SQLXML instance. - * - * @param resultClass The class of the result, or null. - * @throws java.sql.SQLException if there is an error processing the XML - * value or the state is not writable - * @return for setting the XML value designated by this SQLXML instance. - */ - protected T createResult( - Class resultClass) throws SQLException { - - checkWritable(); - setWritable(false); - setReadable(true); - - if ((resultClass == null) - || StreamResult.class.isAssignableFrom(resultClass)) { - return createStreamResult(resultClass); - } else if (DOMResult.class.isAssignableFrom(resultClass)) { - return createDOMResult(resultClass); - } else if (SAXResult.class.isAssignableFrom(resultClass)) { - return createSAXResult(resultClass); - } else if (StAXResult.class.isAssignableFrom(resultClass)) { - return createStAXResult(resultClass); - } - - throw JDBCUtil.invalidArgument("resultClass: " + resultClass); - } - - /** - * Retrieves a new StreamResult for setting the XML value designated by this - * SQLXML instance. - * - * @param resultClass The class of the result, or null. - * @throws java.sql.SQLException if there is an error processing the XML - * value - * @return for setting the XML value designated by this SQLXML instance. - */ - -// @SuppressWarnings("unchecked") - protected T createStreamResult( - Class resultClass) throws SQLException { - - StreamResult result; - - try { - if (resultClass == null) result = new StreamResult(); - else { - result = (StreamResult) resultClass.getDeclaredConstructor().newInstance(); - } - } catch (SecurityException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (ClassCastException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.sourceInstantiation(ex); - } - - OutputStream stream = setBinaryStreamImpl(); - - result.setOutputStream(stream); - - return (T) result; - } - - /** - * Retrieves a new DOMResult for setting the XML value designated by this - * SQLXML instance. - * - * @param resultClass The class of the result, or null. - * @throws java.sql.SQLException if there is an error processing the XML - * value - * @return for setting the XML value designated by this SQLXML instance. - */ - @SuppressWarnings("unchecked") - protected T createDOMResult( - Class resultClass) throws SQLException { - - try { - T result; - if (resultClass == null) result = (T) new DOMResult(); - else { - result = resultClass.getDeclaredConstructor().newInstance(); - } - - this.domResult = (DOMResult) result; - - return result; - } catch (SecurityException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (ClassCastException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.sourceInstantiation(ex); - } - } - - /** - * Retrieves a new SAXResult for setting the XML value designated by this - * SQLXML instance. - * - * @param resultClass The class of the result, or null. - * @throws java.sql.SQLException if there is an error processing the XML - * value - * @return for setting the XML value designated by this SQLXML instance. - */ - @SuppressWarnings("unchecked") - protected T createSAXResult( - Class resultClass) throws SQLException { - - SAXResult result = null; - - try { - if (resultClass == null) result = new SAXResult(); - else { - result = (SAXResult) resultClass.getDeclaredConstructor().newInstance(); - } - } catch (SecurityException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (ClassCastException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.sourceInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.sourceInstantiation(ex); - } - - SAX2DOMBuilder handler = null; - - try { - handler = new SAX2DOMBuilder(); - } catch (ParserConfigurationException ex) { - throw Exceptions.resultInstantiation(ex); - } - this.domResult = new DOMResult(); - - result.setHandler(handler); - this.domResult.setNode(handler.getDocument()); - - return (T) result; - } - - /** - * Retrieves a new DOMResult for setting the XML value designated by this - * SQLXML instance. - * - * @param resultClass The class of the result, or null. - * @throws java.sql.SQLException if there is an error processing the XML - * value - * @return for setting the XML value designated by this SQLXML instance. - */ - @SuppressWarnings("unchecked") - protected T createStAXResult( - Class resultClass) throws SQLException { - - StAXResult result = null; - - try { - this.domResult = - new DOMResult((new SAX2DOMBuilder()).getDocument()); - - XMLOutputFactory factory = XMLOutputFactory.newInstance(); - XMLStreamWriter xmlStreamWriter = - factory.createXMLStreamWriter(this.domResult); - - if (resultClass == null || resultClass == StAXResult.class) { - result = new StAXResult(xmlStreamWriter); - } else { - Constructor ctor = - resultClass.getConstructor(XMLStreamWriter.class); - - result = (StAXResult) ctor.newInstance(xmlStreamWriter); - } - } catch (ParserConfigurationException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (SecurityException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (IllegalArgumentException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (IllegalAccessException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (InvocationTargetException ex) { - throw Exceptions.resultInstantiation(ex.getTargetException()); - } catch (FactoryConfigurationError ex) { - throw Exceptions.resultInstantiation(ex); - } catch (InstantiationException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (NoSuchMethodException ex) { - throw Exceptions.resultInstantiation(ex); - } catch (XMLStreamException ex) { - throw Exceptions.resultInstantiation(ex); - } - - return (T) result; - } - - protected void freeDomResult() { - this.domResult = null; - } - - /** - * Basically just a namespace to isolate SQLXML exception generation - */ - protected static class Exceptions { - - /** - * Construction Disabled. - */ - private Exceptions() { - } - - /** - * Retrieves a new SQLXML DOM instantiation exception. - * - * @param cause of the exception - */ - static SQLException domInstantiation(Throwable cause) { - - Exception ex = (cause instanceof Exception) ? (Exception) cause - : new Exception(cause); - - return JDBCUtil.sqlException(ErrorCode.GENERAL_ERROR, - "SQLXML DOM instantiation failed: " - + cause, ex); - } - - /** - * Retrieves a new SQLXML source instantiation exception. - * - * @param cause of the exception. - * @return a new SQLXML source instantiation exception - */ - static SQLException sourceInstantiation(Throwable cause) { - - Exception ex = (cause instanceof Exception) ? (Exception) cause - : new Exception(cause); - - return JDBCUtil.sqlException(ErrorCode.GENERAL_ERROR, - "SQLXML Source instantiation failed: " - + cause, ex); - } - - /** - * Retrieves a new SQLXML result instantiation exception. - * - * @param cause of the exception. - * @return a new SQLXML result instantiation exception - */ - static SQLException resultInstantiation(Throwable cause) { - - Exception ex = (cause instanceof Exception) ? (Exception) cause - : new Exception(cause); - - return JDBCUtil.sqlException(ErrorCode.GENERAL_ERROR, - "SQLXML Result instantiation failed: " - + cause, ex); - } - - /** - * Retrieves a new SQLXML parse failed exception. - * - * @param cause of the exception. - * @return a new SQLXML parse failed exception - */ - static SQLException parseFailed(Throwable cause) { - - Exception ex = (cause instanceof Exception) ? (Exception) cause - : new Exception(cause); - - return JDBCUtil.sqlException(ErrorCode.GENERAL_ERROR, - "parse failed: " + cause, ex); - } - - /** - * Retrieves a new SQLXML transform failed exception. - * - * @param cause of the exception. - * @return a new SQLXML parse failed exception - */ - static SQLException transformFailed(Throwable cause) { - - Exception ex = (cause instanceof Exception) ? (Exception) cause - : new Exception(cause); - - return JDBCUtil.sqlException(ErrorCode.GENERAL_ERROR, - "transform failed: " + cause, ex); - } - - /** - * Retrieves a new SQLXML not readable exception. - * - * @return a new SQLXML not readable exception - */ - static SQLException notReadable() { - return JDBCUtil.sqlException(ErrorCode.GENERAL_IO_ERROR, - "SQLXML in not readable state"); - } - - /** - * Retrieves a new SQLXML not readable exception. - * - * @return a new SQLXML not readable exception - */ - static SQLException notReadable(String reason) { - - return JDBCUtil.sqlException(ErrorCode.GENERAL_IO_ERROR, - "SQLXML in not readable state: " - + reason); - } - - /** - * Retrieves a new SQLXML not writable exception. - * - * @return a new SQLXML not writable exception - */ - static SQLException notWritable() { - return JDBCUtil.sqlException(ErrorCode.GENERAL_IO_ERROR, - "SQLXML in not writable state"); - } - - /** - * Currently unused. - * - * @return never - */ - static SQLException directUpdateByLocatorNotSupported() { - return JDBCUtil.sqlException(ErrorCode.X_0A000, - "SQLXML direct update by locator"); - } - - /** - * Retrieves a new SQLXML in freed state exception. - * - * @return a new SQLXML in freed state exception - */ - static SQLException inFreedState() { - return JDBCUtil.sqlException(ErrorCode.GENERAL_ERROR, - "SQLXML in freed state"); - } - } - - // ------------------------------------------------------------------------- - - /** - * Builds a DOM from SAX events. - */ - protected static class SAX2DOMBuilder implements ContentHandler, - Closeable { - - /** - * - */ - private boolean closed; - - /** - * - */ - private Element currentElement; - - // --------------------- internal implementation ----------------------- - - /** - * - */ - private Node currentNode; - - /** - * - */ - private Document document; - - /** - * - */ - private Locator locator; - - /** - * Creates a new instance of SAX2DOMBuilder, which creates - * a new document. The document is available via - * {@link #getDocument()}. - * @throws javax.xml.parsers.ParserConfigurationException exception - */ - public SAX2DOMBuilder() throws ParserConfigurationException { - - DocumentBuilderFactory documentBuilderFactory; - DocumentBuilder documentBuilder; - - documentBuilderFactory = DocumentBuilderFactory.newInstance(); - - documentBuilderFactory.setValidating(false); - documentBuilderFactory.setNamespaceAware(true); - - documentBuilder = documentBuilderFactory.newDocumentBuilder(); - this.document = documentBuilder.newDocument(); - this.currentNode = this.document; - } - - /** - * Receive an object for locating the origin of SAX document events. - * - *

    SAX parsers are strongly encouraged (though not absolutely - * required) to supply a locator: if it does so, it must supply - * the locator to the application by invoking this method before - * invoking any of the other methods in the ContentHandler - * interface.

    - * - *

    The locator allows the application to determine the end - * position of any document-related event, even if the parser is - * not reporting an error. Typically, the application will - * use this information for reporting its own errors (such as - * character content that does not match an application's - * business rules). The information returned by the locator - * is probably not sufficient for use with a search engine.

    - * - *

    Note that the locator will return correct information only - * during the invocation SAX event callbacks after - * {@link #startDocument startDocument} returns and before - * {@link #endDocument endDocument} is called. The - * application should not attempt to use it at any other time.

    - * - * @param locator an object that can return the location of - * any SAX document event - * @see org.xml.sax.Locator - */ - public void setDocumentLocator(Locator locator) { - this.locator = locator; - } - - /** - * Retrieves the Locator.

    - * @return the Locator - */ - public Locator getDocumentLocator() { - return this.locator; - } - - /** - * Receive notification of the beginning of a document. - * - *

    The SAX parser will invoke this method only once, before any - * other event callbacks (except for {@link #setDocumentLocator - * setDocumentLocator}).

    - * - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #endDocument - */ - public void startDocument() throws SAXException { - checkClosed(); - } - - /** - * Receive notification of the end of a document. - * - *

    There is an apparent contradiction between the - * documentation for this method and the documentation for {@link - * org.xml.sax.ErrorHandler#fatalError}. Until this ambiguity is - * resolved in a future major release, clients should make no - * assumptions about whether endDocument() will or will not be - * invoked when the parser has reported a fatalError() or thrown - * an exception.

    - * - *

    The SAX parser will invoke this method only once, and it will - * be the last method invoked during the parse. The parser shall - * not invoke this method until it has either abandoned parsing - * (because of an unrecoverable error) or reached the end of - * input.

    - * - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #startDocument - */ - public void endDocument() throws SAXException { - checkClosed(); - close(); - } - - /** - * Begin the scope of a prefix-URI Namespace mapping. - * - *

    The information from this event is not necessary for - * normal Namespace processing: the SAX XML reader will - * automatically replace prefixes for element and attribute - * names when the {@code http://xml.org/sax/features/namespaces} - * feature is true (the default).

    - * - *

    There are cases, however, when applications need to - * use prefixes in character data or in attribute values, - * where they cannot safely be expanded automatically; the - * start/endPrefixMapping event supplies the information - * to the application to expand prefixes in those contexts - * itself, if necessary.

    - * - *

    Note that start/endPrefixMapping events are not - * guaranteed to be properly nested relative to each other: - * all startPrefixMapping events will occur immediately before the - * corresponding {@link #startElement startElement} event, - * and all {@link #endPrefixMapping endPrefixMapping} - * events will occur immediately after the corresponding - * {@link #endElement endElement} event, - * but their order is not otherwise - * guaranteed.

    - * - *

    There should never be start/endPrefixMapping events for the - * "xml" prefix, since it is predeclared and immutable.

    - * - * @param prefix the Namespace prefix being declared. - * An empty string is used for the default element namespace, - * which has no prefix. - * @param uri the Namespace URI the prefix is mapped to - * @throws org.xml.sax.SAXException the client may throw - * an exception during processing - * @see #endPrefixMapping - * @see #startElement - */ - public void startPrefixMapping(String prefix, - String uri) throws SAXException { - checkClosed(); - } - - /** - * End the scope of a prefix-URI mapping. - * - *

    See {@link #startPrefixMapping startPrefixMapping} for - * details. These events will always occur immediately after the - * corresponding {@link #endElement endElement} event, but the order of - * {@code endPrefixMapping} events is not otherwise - * guaranteed.

    - * - * @param prefix the prefix that was being mapped. - * This is the empty string when a default mapping scope ends. - * @throws org.xml.sax.SAXException the client may throw - * an exception during processing - * @see #startPrefixMapping - * @see #endElement - */ - public void endPrefixMapping(String prefix) throws SAXException { - checkClosed(); - } - - /** - * Receive notification of the beginning of an element. - * - *

    The Parser will invoke this method at the beginning of every - * element in the XML document; there will be a corresponding - * {@link #endElement endElement} event for every startElement event - * (even when the element is empty). All of the element's content will be - * reported, in order, before the corresponding endElement - * event.

    - * - *

    This event allows up to three name components for each - * element:

    - * - *
      - *
    1. the Namespace URI;
    2. - *
    3. the local name; and
    4. - *
    5. the qualified (prefixed) name.
    6. - *
    - * - *

    Any or all of these may be provided, depending on the - * values of the http://xml.org/sax/features/namespaces - * and the http://xml.org/sax/features/namespace-prefixes - * properties:

    - * - *
      - *
    • the Namespace URI and local name are required when - * the namespaces property is true (the default), and are - * optional when the namespaces property is false (if one is - * specified, both must be);
    • - *
    • the qualified name is required when the namespace-prefixes property - * is true, and is optional when the namespace-prefixes property - * is false (the default).
    • - *
    - * - *

    Note that the attribute list provided will contain only - * attributes with explicit values (specified or defaulted): - * #IMPLIED attributes will be omitted. The attribute list - * will contain attributes used for Namespace declarations - * (xmlns* attributes) only if the - * http://xml.org/sax/features/namespace-prefixes - * property is true (it is false by default, and support for a - * true value is optional).

    - * - *

    Like {@link #characters characters()}, attribute values may have - * characters that need more than one char value.

    - * - * @param uri the Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed - * @param localName the local name (without prefix), or the - * empty string if Namespace processing is not being - * performed - * @param qName the qualified name (with prefix), or the - * empty string if qualified names are not available - * @param atts the attributes attached to the element. If - * there are no attributes, it shall be an empty - * Attributes object. The value of this object after - * startElement returns is undefined - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #endElement - * @see org.xml.sax.Attributes - * @see org.xml.sax.helpers.AttributesImpl - */ - public void startElement(String uri, String localName, String qName, - Attributes atts) throws SAXException { - - checkClosed(); - - Element element; - - if ((uri == null) || (uri.isEmpty())) { - element = getDocument().createElement(qName); - } else { - element = getDocument().createElementNS(uri, qName); - } - - if (atts != null) { - for (int i = 0; i < atts.getLength(); i++) { - String attrURI = atts.getURI(i); - String attrQName = atts.getQName(i); - String attrValue = atts.getValue(i); - - if ((attrURI == null) || attrURI.isEmpty()) { - element.setAttribute(attrQName, attrValue); - } else { - element.setAttributeNS(attrURI, attrQName, attrValue); - } - } - } - getCurrentNode().appendChild(element); - setCurrentNode(element); - - if (getCurrentElement() == null) { - setCurrentElement(element); - } - } - - /** - * Receive notification of the end of an element. - * - *

    The SAX parser will invoke this method at the end of every - * element in the XML document; there will be a corresponding - * {@link #startElement startElement} event for every endElement - * event (even when the element is empty).

    - * - *

    For information on the names, see startElement.

    - * - * @param uri the Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed - * @param localName the local name (without prefix), or the - * empty string if Namespace processing is not being - * performed - * @param qName the qualified XML name (with prefix), or the - * empty string if qualified names are not available - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void endElement(String uri, String localName, - String qName) throws SAXException { - checkClosed(); - setCurrentNode(getCurrentNode().getParentNode()); - } - - /** - * Receive notification of character data. - * - *

    The Parser will call this method to report each chunk of - * character data. SAX parsers may return all contiguous character - * data in a single chunk, or they may split it into several - * chunks; however, all of the characters in any single event - * must come from the same external entity so that the Locator - * provides useful information.

    - * - *

    The application must not attempt to read from the array - * outside of the specified range.

    - * - *

    Individual characters may consist of more than one Java - * char value. There are two important cases where this - * happens, because characters can't be represented in just sixteen bits. - * In one case, characters are represented in a Surrogate Pair, - * using two special Unicode values. Such characters are in the so-called - * "Astral Planes", with a code point above U+FFFF. A second case involves - * composite characters, such as a base character combining with one or - * more accent characters.

    - * - *

    Your code should not assume that algorithms using - * char-at-a-time idioms will be working in character - * units; in some cases they will split characters. This is relevant - * wherever XML permits arbitrary characters, such as attribute values, - * processing instruction data, and comments as well as in data reported - * from this method. It's also generally relevant whenever Java code - * manipulates internationalized text; the issue isn't unique to XML.

    - * - *

    Note that some parsers will report whitespace in element - * content using the {@link #ignorableWhitespace ignorableWhitespace} - * method rather than this one (validating parsers must - * do so).

    - * - * @param ch the characters from the XML document - * @param start the start position in the array - * @param length the number of characters to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #ignorableWhitespace - * @see org.xml.sax.Locator - */ - public void characters(char[] ch, int start, - int length) throws SAXException { - - checkClosed(); - - Node node = getCurrentNode().getLastChild(); - String s = new String(ch, start, length); - - if ((node != null) && (node.getNodeType() == Node.TEXT_NODE)) { - ((Text) node).appendData(s); - } else { - Text text = getDocument().createTextNode(s); - - getCurrentNode().appendChild(text); - } - } - - /** - * Receive notification of ignorable whitespace in element content. - * - *

    Validating Parsers must use this method to report each chunk - * of whitespace in element content (see the W3C XML 1.0 - * recommendation, section 2.10): non-validating parsers may also - * use this method if they are capable of parsing and using - * content models.

    - * - *

    SAX parsers may return all contiguous whitespace in a single - * chunk, or they may split it into several chunks; however, all of - * the characters in any single event must come from the same - * external entity, so that the Locator provides useful - * information.

    - * - *

    The application must not attempt to read from the array - * outside of the specified range.

    - * - * @param ch the characters from the XML document - * @param start the start position in the array - * @param length the number of characters to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #characters - */ - public void ignorableWhitespace(char[] ch, int start, - int length) throws SAXException { - characters(ch, start, length); - } - - /** - * Receive notification of a processing instruction. - * - *

    The Parser will invoke this method once for each processing - * instruction found: note that processing instructions may occur - * before or after the main document element.

    - * - *

    A SAX parser must never report an XML declaration (XML 1.0, - * section 2.8) or a text declaration (XML 1.0, section 4.3.1) - * using this method.

    - * - *

    Like {@link #characters characters()}, processing instruction - * data may have characters that need more than one char - * value.

    - * - * @param target the processing instruction target - * @param data the processing instruction data, or null if - * none was supplied. The data does not include any - * whitespace separating it from the target - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void processingInstruction(String target, - String data) throws SAXException { - - checkClosed(); - - ProcessingInstruction processingInstruction; - - processingInstruction = - getDocument().createProcessingInstruction(target, data); - - getCurrentNode().appendChild(processingInstruction); - } - - /** - * Receive notification of a skipped entity. - * This is not called for entity references within markup constructs - * such as element start tags or markup declarations. (The XML - * recommendation requires reporting skipped external entities. - * SAX also reports internal entity expansion/non-expansion, except - * within markup constructs.) - * - *

    The Parser will invoke this method each time the entity is - * skipped. Non-validating processors may skip entities if they - * have not seen the declarations (because, for example, the - * entity was declared in an external DTD subset). All processors - * may skip external entities, depending on the values of the - * http://xml.org/sax/features/external-general-entities - * and the - * http://xml.org/sax/features/external-parameter-entities - * properties.

    - * - * @param name the name of the skipped entity. If it is a - * parameter entity, the name will begin with '%', and if - * it is the external DTD subset, it will be the string - * "[dtd]" - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void skippedEntity(String name) throws SAXException { - - checkClosed(); - - EntityReference entityReference = - getDocument().createEntityReference(name); - - getCurrentNode().appendChild(entityReference); - } - - /** - * Closes this DOMBuilder. - */ - public void close() { - this.closed = true; - } - - /** - * Frees the DOMBuilder. - */ - public void free() { - - close(); - - this.document = null; - this.currentElement = null; - this.currentNode = null; - this.locator = null; - } - - /** - * Retrieves whether this DOMBuilder is closed. - * - * @return boolean - */ - public boolean isClosed() { - return this.closed; - } - - /** - * Checks whether this DOMBuilder is closed. - * - * @throws SAXException if this DOMBuilder is closed. - */ - protected void checkClosed() throws SAXException { - - if (isClosed()) { - throw new SAXException("content handler is closed."); // NOI18N - } - } - - /** - * Retrieves the document. - * - * @return Document - */ - public Document getDocument() { - return this.document; - } - - /** - * Retrieves the current element. - */ - protected Element getCurrentElement() { - return this.currentElement; - } - - /** - * Assigns the current element. - * @param element the element - */ - protected void setCurrentElement(Element element) { - this.currentElement = element; - } - - /** - * Retrieves the current node. - */ - protected Node getCurrentNode() { - return this.currentNode; - } - - /** - * Assigns the current node.

    - * @param node the node - */ - protected void setCurrentNode(Node node) { - this.currentNode = node; - } - } - - /** - * Writes to a {@link javax.xml.stream.XMLStreamWriter XMLStreamWriter} - * from SAX events. - */ - public static class SAX2XMLStreamWriter implements ContentHandler, - Closeable { - - /** - * Namespace declarations for an upcoming element. - */ - private List namespaces = - new ArrayList(); - - /** - * Whether this object is closed. - */ - private boolean closed; - - /** - * This object's SAX locator. - */ - private Locator locator; - - /** - * XML stream writer where events are pushed. - */ - private XMLStreamWriter writer; - - /** - * Constructs a new SAX2XMLStreamWriter that writes SAX events to the - * designated XMLStreamWriter. - * - * @param writer the writer to which to write SAX events - */ - public SAX2XMLStreamWriter(XMLStreamWriter writer) { - - if (writer == null) { - throw new NullPointerException("writer"); - } - this.writer = writer; - } - - /** - * Receive notification of the beginning of a document. - * - *

    The SAX parser will invoke this method only once, before any - * other event callbacks (except for {@link #setDocumentLocator - * setDocumentLocator}).

    - * - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #endDocument - */ - public void startDocument() throws SAXException { - - checkClosed(); - - try { - this.writer.writeStartDocument(); - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - /** - * Receive notification of the end of a document. - * - *

    There is an apparent contradiction between the - * documentation for this method and the documentation for {@link - * org.xml.sax.ErrorHandler#fatalError}. Until this ambiguity is - * resolved in a future major release, clients should make no - * assumptions about whether endDocument() will or will not be - * invoked when the parser has reported a fatalError() or thrown - * an exception.

    - * - *

    The SAX parser will invoke this method only once, and it will - * be the last method invoked during the parse. The parser shall - * not invoke this method until it has either abandoned parsing - * (because of an unrecoverable error) or reached the end of - * input.

    - * - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #startDocument - */ - public void endDocument() throws SAXException { - - checkClosed(); - - try { - this.writer.writeEndDocument(); - this.writer.flush(); - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - /** - * Receive notification of character data. - * - *

    The Parser will call this method to report each chunk of - * character data. SAX parsers may return all contiguous character - * data in a single chunk, or they may split it into several - * chunks; however, all of the characters in any single event - * must come from the same external entity so that the Locator - * provides useful information.

    - * - *

    The application must not attempt to read from the array - * outside of the specified range.

    - * - *

    Individual characters may consist of more than one Java - * char value. There are two important cases where this - * happens, because characters can't be represented in just sixteen bits. - * In one case, characters are represented in a Surrogate Pair, - * using two special Unicode values. Such characters are in the so-called - * "Astral Planes", with a code point above U+FFFF. A second case involves - * composite characters, such as a base character combining with one or - * more accent characters.

    - * - *

    Your code should not assume that algorithms using - * char-at-a-time idioms will be working in character - * units; in some cases they will split characters. This is relevant - * wherever XML permits arbitrary characters, such as attribute values, - * processing instruction data, and comments as well as in data reported - * from this method. It's also generally relevant whenever Java code - * manipulates internationalized text; the issue isn't unique to XML.

    - * - *

    Note that some parsers will report whitespace in element - * content using the {@link #ignorableWhitespace ignorableWhitespace} - * method rather than this one (validating parsers must - * do so).

    - * - * @param ch the characters from the XML document - * @param start the start position in the array - * @param length the number of characters to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #ignorableWhitespace - * @see org.xml.sax.Locator - */ - public void characters(char[] ch, int start, - int length) throws SAXException { - - checkClosed(); - - try { - this.writer.writeCharacters(ch, start, length); - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - /** - * Receive notification of the beginning of an element. - * - *

    The Parser will invoke this method at the beginning of every - * element in the XML document; there will be a corresponding - * {@link #endElement endElement} event for every startElement event - * (even when the element is empty). All of the element's content will be - * reported, in order, before the corresponding endElement - * event.

    - * - *

    This event allows up to three name components for each - * element:

    - * - *
      - *
    1. the Namespace URI;
    2. - *
    3. the local name; and
    4. - *
    5. the qualified (prefixed) name.
    6. - *
    - * - *

    Any or all of these may be provided, depending on the - * values of the http://xml.org/sax/features/namespaces - * and the http://xml.org/sax/features/namespace-prefixes - * properties:

    - * - *
      - *
    • the Namespace URI and local name are required when - * the namespaces property is true (the default), and are - * optional when the namespaces property is false (if one is - * specified, both must be);
    • - *
    • the qualified name is required when the namespace-prefixes property - * is true, and is optional when the namespace-prefixes property - * is false (the default).
    • - *
    - * - *

    Note that the attribute list provided will contain only - * attributes with explicit values (specified or defaulted): - * #IMPLIED attributes will be omitted. The attribute list - * will contain attributes used for Namespace declarations - * (xmlns* attributes) only if the - * http://xml.org/sax/features/namespace-prefixes - * property is true (it is false by default, and support for a - * true value is optional).

    - * - *

    Like {@link #characters characters()}, attribute values may have - * characters that need more than one char value.

    - * - * @param namespaceURI the Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed - * @param localName the local name (without prefix), or the - * empty string if Namespace processing is not being - * performed - * @param qName the qualified name (with prefix), or the - * empty string if qualified names are not available - * @param atts the attributes attached to the element. If - * there are no attributes, it shall be an empty - * Attributes object. The value of this object after - * startElement returns is undefined - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #endElement - * @see org.xml.sax.Attributes - * @see org.xml.sax.helpers.AttributesImpl - */ - public void startElement(String namespaceURI, String localName, - String qName, - Attributes atts) throws SAXException { - - checkClosed(); - - try { - int qi = qName.indexOf(':'); - String prefix = (qi > 0) ? qName.substring(0, qi) - : ""; - - this.writer.writeStartElement(prefix, localName, namespaceURI); - - int length = namespaces.size(); - - for (int i = 0; i < length; i++) { - QualifiedName ns = namespaces.get(i); - - this.writer.writeNamespace(ns.prefix, ns.namespaceName); - } - namespaces.clear(); - - length = atts.getLength(); - - for (int i = 0; i < length; i++) { - this.writer.writeAttribute(atts.getURI(i), - atts.getLocalName(i), atts.getValue(i)); - } - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - /** - * Receive notification of the end of an element. - * - *

    The SAX parser will invoke this method at the end of every - * element in the XML document; there will be a corresponding - * {@link #startElement startElement} event for every endElement - * event (even when the element is empty).

    - * - *

    For information on the names, see startElement.

    - * - * @param namespaceURI the Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed - * @param localName the local name (without prefix), or the - * empty string if Namespace processing is not being - * performed - * @param qName the qualified XML name (with prefix), or the - * empty string if qualified names are not available - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void endElement(String namespaceURI, String localName, - String qName) throws SAXException { - - checkClosed(); - - try { - this.writer.writeEndElement(); - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - /** - * Begin the scope of a prefix-URI Namespace mapping. - * - *

    The information from this event is not necessary for - * normal Namespace processing: the SAX XML reader will - * automatically replace prefixes for element and attribute - * names when the http://xml.org/sax/features/namespaces - * feature is true (the default).

    - * - *

    There are cases, however, when applications need to - * use prefixes in character data or in attribute values, - * where they cannot safely be expanded automatically; the - * start/endPrefixMapping event supplies the information - * to the application to expand prefixes in those contexts - * itself, if necessary.

    - * - *

    Note that start/endPrefixMapping events are not - * guaranteed to be properly nested relative to each other: - * all startPrefixMapping events will occur immediately before the - * corresponding {@link #startElement startElement} event, - * and all {@link #endPrefixMapping endPrefixMapping} - * events will occur immediately after the corresponding - * {@link #endElement endElement} event, - * but their order is not otherwise - * guaranteed.

    - * - *

    There should never be start/endPrefixMapping events for the - * "xml" prefix, since it is predeclared and immutable.

    - * - * @param prefix the Namespace prefix being declared. - * An empty string is used for the default element namespace, - * which has no prefix. - * @param uri the Namespace URI the prefix is mapped to - * @throws org.xml.sax.SAXException the client may throw - * an exception during processing - * @see #endPrefixMapping - * @see #startElement - */ - public void startPrefixMapping(String prefix, - String uri) throws SAXException { - - checkClosed(); - - try { - this.writer.setPrefix(prefix, uri); - namespaces.add(new QualifiedName(prefix, uri)); - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - /** - * End the scope of a prefix-URI mapping. - * - *

    See {@link #startPrefixMapping startPrefixMapping} for - * details. These events will always occur immediately after the - * corresponding {@link #endElement endElement} event, but the order of - * {@code endPrefixMapping} events is not otherwise - * guaranteed.

    - * - * @param prefix the prefix that was being mapped. - * This is the empty string when a default mapping scope ends. - * @throws org.xml.sax.SAXException the client may throw - * an exception during processing - * @see #startPrefixMapping - * @see #endElement - */ - public void endPrefixMapping(String prefix) throws SAXException { - - checkClosed(); - - // - } - - /** - * Receive notification of ignorable whitespace in element content. - * - *

    Validating Parsers must use this method to report each chunk - * of whitespace in element content (see the W3C XML 1.0 - * recommendation, section 2.10): non-validating parsers may also - * use this method if they are capable of parsing and using - * content models.

    - * - *

    SAX parsers may return all contiguous whitespace in a single - * chunk, or they may split it into several chunks; however, all of - * the characters in any single event must come from the same - * external entity, so that the Locator provides useful - * information.

    - * - *

    The application must not attempt to read from the array - * outside of the specified range.

    - * - * @param ch the characters from the XML document - * @param start the start position in the array - * @param length the number of characters to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see #characters - */ - public void ignorableWhitespace(char[] ch, int start, - int length) throws SAXException { - characters(ch, start, length); - } - - /** - * Receive notification of a processing instruction. - * - *

    The Parser will invoke this method once for each processing - * instruction found: note that processing instructions may occur - * before or after the main document element.

    - * - *

    A SAX parser must never report an XML declaration (XML 1.0, - * section 2.8) or a text declaration (XML 1.0, section 4.3.1) - * using this method.

    - * - *

    Like {@link #characters characters()}, processing instruction - * data may have characters that need more than one char - * value.

    - * - * @param target the processing instruction target - * @param data the processing instruction data, or null if - * none was supplied. The data does not include any - * whitespace separating it from the target - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void processingInstruction(String target, - String data) throws SAXException { - - checkClosed(); - - try { - this.writer.writeProcessingInstruction(target, data); - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - /** - * Receive an object for locating the origin of SAX document events. - * - *

    SAX parsers are strongly encouraged (though not absolutely - * required) to supply a locator: if it does so, it must supply - * the locator to the application by invoking this method before - * invoking any of the other methods in the ContentHandler - * interface.

    - * - *

    The locator allows the application to determine the end - * position of any document-related event, even if the parser is - * not reporting an error. Typically, the application will - * use this information for reporting its own errors (such as - * character content that does not match an application's - * business rules). The information returned by the locator - * is probably not sufficient for use with a search engine.

    - * - *

    Note that the locator will return correct information only - * during the invocation SAX event callbacks after - * {@link #startDocument startDocument} returns and before - * {@link #endDocument endDocument} is called. The - * application should not attempt to use it at any other time.

    - * - * @param locator an object that can return the location of - * any SAX document event - * @see org.xml.sax.Locator - */ - public void setDocumentLocator(Locator locator) { - this.locator = locator; - } - - /** - * Retrieves the Locator.

    - * @return the Locator - */ - public Locator getDocumentLocator() { - return this.locator; - } - - /** - * Receive notification of a skipped entity. - * This is not called for entity references within markup constructs - * such as element start tags or markup declarations. (The XML - * recommendation requires reporting skipped external entities. - * SAX also reports internal entity expansion/non-expansion, except - * within markup constructs.) - * - *

    The Parser will invoke this method each time the entity is - * skipped. Non-validating processors may skip entities if they - * have not seen the declarations (because, for example, the - * entity was declared in an external DTD subset). All processors - * may skip external entities, depending on the values of the - * http://xml.org/sax/features/external-general-entities - * and the - * http://xml.org/sax/features/external-parameter-entities - * properties.

    - * - * @param name the name of the skipped entity. If it is a - * parameter entity, the name will begin with '%', and if - * it is the external DTD subset, it will be the string - * "[dtd]" - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void skippedEntity(String name) throws SAXException { - - checkClosed(); - - // - } - - public void comment(char[] ch, int start, - int length) throws SAXException { - - checkClosed(); - - try { - this.writer.writeComment(new String(ch, start, length)); - } catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - public XMLStreamWriter getWriter() { - return this.writer; - } - - protected List getNamespaces() { - return this.namespaces; - } - - /** - * Closes this object. - */ - public void close() throws IOException { - - if (!this.closed) { - this.closed = true; - - try { - this.writer.close(); - } catch (XMLStreamException e) { - throw new IOException(e); - } finally { - this.writer = null; - this.locator = null; - this.namespaces = null; - } - } - } - - /** - * Retrieves whether this object is closed. - * - * @return boolean - */ - public boolean isClosed() { - return this.closed; - } - - /** - * Checks whether this object is closed. - * - * @throws SAXException if this DOMBuilder is closed. - */ - protected void checkClosed() throws SAXException { - - if (isClosed()) { - throw new SAXException("content handler is closed."); // NOI18N - } - } - - // --------------------- internal implementation ----------------------- - protected static class QualifiedName { - - public final String namespaceName; - public final String prefix; - - public QualifiedName(final String prefix, - final String namespaceName) { - this.prefix = prefix; - this.namespaceName = namespaceName; - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCSavepoint.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCSavepoint.java deleted file mode 100644 index 0e74beac..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCSavepoint.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.SQLException; -import java.sql.Savepoint; - -/* $Id: JDBCSavepoint.java 6266 2021-01-25 16:08:06Z fredt $ */ - -// Revision 1.10 2006/07/12 12:38:22 boucherb -// - full synch up to Mustang b90 - -/** - * The representation of a savepoint, which is a point within - * the current transaction that can be referenced from the - * Connection.rollback method. When a transaction - * is rolled back to a savepoint all changes made after that - * savepoint are undone. - *

    - * Savepoints can be either named or unnamed. Unnamed savepoints - * are identified by an ID generated by the underlying data source. - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * SQL 2003 standard does not support unnamed savepoints. However, this - * feature is supported from version 2.0.

    - * - * If the connection is autoCommit, setting savepoints has no effect as any - * such savepoint is cleared upon the execution of the first transactional - * statement.

    - * - *

    - * - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @since JDK 1.4, HSQLDB 1.7.2 - */ -public class JDBCSavepoint implements Savepoint { - - int id; - String name; - JDBCConnection connection; - - JDBCSavepoint(String name, JDBCConnection conn) throws SQLException { - - if (name == null) { - throw JDBCUtil.nullArgument("name"); - } - - if (conn == null) { - throw JDBCUtil.nullArgument("conn"); - } - - this.name = name; - this.id = -1; - this.connection = conn; - } - - JDBCSavepoint(JDBCConnection conn) throws SQLException { - - if (conn == null) { - throw JDBCUtil.nullArgument("conn"); - } - - this.id = conn.getSavepointID(); - this.name = "SYSTEM_SAVEPOINT_" + id; - this.connection = conn; - } - - /** - * Retrieves the generated ID for the savepoint that this - * Savepoint object represents. - * @return the numeric ID of this savepoint - * @exception SQLException if this is a named savepoint - * @since 1.4 - */ - public int getSavepointId() throws SQLException { - - if (id != -1) { - return id; - } - - throw JDBCUtil.notSupported(); - } - - /** - * Retrieves the name of the savepoint that this Savepoint - * object represents. - * - * @return the name of this savepoint - * @exception SQLException if this is an un-named savepoint - * @since 1.4 - */ - public String getSavepointName() throws SQLException { - - if (id == -1) { - return name; - } - - throw JDBCUtil.notSupported(); - } - - public String toString() { - return super.toString() + "[name=" + name + "]"; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCStatement.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCStatement.java deleted file mode 100644 index 9dbafb83..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCStatement.java +++ /dev/null @@ -1,2090 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.BatchUpdateException; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLWarning; -import java.sql.SQLTimeoutException; -import java.sql.Statement; - -import org.hsqldb.HsqlException; -import org.hsqldb.StatementTypes; -import org.hsqldb.navigator.RowSetNavigator; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultConstants; -import org.hsqldb.result.ResultProperties; - -/* $Id: JDBCStatement.java 6489 2022-04-19 18:00:13Z fredt $ */ - -// fredt@users 20020320 - patch 1.7.0 - JDBC 2 support and error trapping -// -// SCROLL_INSENSITIVE and FORWARD_ONLY types for ResultSet are now supported -// -// campbell-burnet@users 20020509 - added "throws SQLException" to all methods where -// it was missing here but specified in the -// java.sql.Statement interface, -// updated generic documentation to JDK 1.4, and -// added JDBC3 methods and docs -// boucherb & 20020505 - extensive review and update of docs and behaviour -// fredt@users to comply with java.sql specification -// fredt@users 20030620 - patch 1.7.2 - rewritten and simplified -// campbell-burnet@users 200404xx - javadoc updates toward 1.7.2 final -// campbell-burnet@users 20051207 - patch 1.8.0.x initial JDBC 4.0 support work -// campbell-burnet@users 20060522 - doc 1.9.0 full synch up to Mustang Build 84 -// Revision 1.16 2006/07/12 12:40:59 boucherb -// patch 1.9.0 -// - full synch up to Mustang b90 - -/** - * - * The object used for executing a static SQL statement - * and returning the results it produces. - *

    - * By default, only one ResultSet object per Statement - * object can be open at the same time. Therefore, if the reading of one - * ResultSet object is interleaved - * with the reading of another, each must have been generated by - * different Statement objects. All execution methods in the - * Statement interface implicitly close a statement's current - * ResultSet object if an open one exists. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * From version 2.0, the implementation meets the JDBC specification - * requirement that any existing ResultSet is closed when execute() or - * executeQuery() methods are called. The connection property close_result=true - * is required for this behaviour.

    - * - * Methods added in JAVA 8 are generally supported when the HSQLDB jar is compiled - * with JDK 8. - *

    - * - * (fredt@users)
    - * (campbell-burnet@users)

    - * - *

    - * - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since HSQLDB 1.9.0 - * @see JDBCConnection#createStatement - * @see JDBCResultSet - */ -public class JDBCStatement extends JDBCStatementBase implements Statement, - java.sql.Wrapper { - - - public final static int RETURN_PRIMARY_KEYS = ResultConstants.RETURN_PRIMARY_KEYS; - /** - * - * Executes the given SQL statement, which returns a single - * ResultSet object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * This method should not be used for statements other than SELECT queries.

    - * - * From 2.0, HSQLDB throws an exception when the statement - * is a DDL statement or an UPDATE or DELETE statement. - *

    - * - * - * @param sql an SQL statement to be sent to the database, typically a - * static SQL SELECT statement - * @return a ResultSet object that contains the data produced - * by the given query; never null - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the given - * SQL statement produces anything other than a single - * ResultSet object - */ - public synchronized ResultSet executeQuery( - String sql) throws SQLException { - - fetchResult(sql, StatementTypes.RETURN_RESULT, - JDBCStatementBase.NO_GENERATED_KEYS, null, null); - - return getResultSet(); - } - - /** - * - * Executes the given SQL statement, which may be an INSERT, - * UPDATE, or DELETE statement or an - * SQL statement that returns nothing, such as an SQL DDL statement. - * - * - * @param sql (JDBC4 clarification:) an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * - * @return (JDBC4 clarification:) either (1) the row count for SQL Data Manipulation Language (DML) statements - * or (2) 0 for SQL statements that return nothing - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the given - * SQL statement produces a ResultSet object - */ - public synchronized int executeUpdate(String sql) throws SQLException { - - fetchResult(sql, StatementTypes.RETURN_COUNT, - JDBCStatementBase.NO_GENERATED_KEYS, null, null); - - return resultIn.getUpdateCount(); - } - - /** - * - * Releases this Statement object's database - * and JDBC resources immediately instead of waiting for - * this to happen when it is automatically closed. - * It is generally good practice to release resources as soon as - * you are finished with them to avoid tying up database - * resources. - *

    - * Calling the method close on a Statement - * object that is already closed has no effect. - *

    - * Note:When a Statement object is - * closed, its current ResultSet object, if one exists, is - * also closed. - * (JDBC4 deleted:) [A Statement object is - * automatically closed when it is garbage collected.] - * - * - * @exception SQLException if a database access error occurs - */ - public synchronized void close() throws SQLException { - - if (isClosed) { - return; - } - closeResultData(); - - batchResultOut = null; - connection = null; - resultIn = null; - resultOut = null; - isClosed = true; - } - - //---------------------------------------------------------------------- - - /** - * - * Retrieves the maximum number of bytes that can be - * returned for character and binary column values in a ResultSet - * object produced by this Statement object. - * This limit applies only to BINARY, VARBINARY, - * LONGVARBINARY, CHAR, VARCHAR, - * (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR - * and LONGVARCHAR columns. If the limit is exceeded, the - * excess data is silently discarded. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Including 1.7.2, HSQLDB always returns zero, meaning there - * is no limit. - *

    - * - * - * @return the current column size limit for columns storing character and - * binary values; zero means there is no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setMaxFieldSize - */ - public synchronized int getMaxFieldSize() throws SQLException { - - checkClosed(); - - return 0; - } - - /** - * - * (JDBC4 clarification:) Sets the limit for the maximum number of bytes in a ResultSet - * Sets the limit for the maximum number of bytes that can be returned for - * character and binary column values in a ResultSet - * object produced by this Statement object. - * - * This limit applies - * only to BINARY, VARBINARY, - * LONGVARBINARY, CHAR, VARCHAR, - * (JDBC4 new:) NCHAR, NVARCHAR, LONGNVARCHAR and - * LONGVARCHAR fields. If the limit is exceeded, the excess data - * is silently discarded. For maximum portability, use values - * greater than 256. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * To present, calls to this method are simply ignored; HSQLDB always - * stores the full number of bytes when dealing with any of the field types - * mentioned above. These types all have an absolute maximum element upper - * bound determined by the Java array index limit - * java.lang.Integer.MAX_VALUE. For XXXBINARY types, this translates to - * Integer.MAX_VALUE bytes. For XXXCHAR types, this translates to - * 2 * Integer.MAX_VALUE bytes (2 bytes / character).

    - * - * In practice, field sizes are limited to values much smaller than the - * absolute maximum element upper bound, in particular due to limits imposed - * on the maximum available Java heap memory. - *

    - * - * - * @param max the new column size limit in bytes; zero means there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code max >= 0} is not satisfied - * @see #getMaxFieldSize - */ - public void setMaxFieldSize(int max) throws SQLException { - - checkClosed(); - - if (max < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - } - - /** - * - * Retrieves the maximum number of rows that a - * ResultSet object produced by this - * Statement object can contain. If this limit is exceeded, - * the excess rows are silently dropped. - * - * - * @return the current maximum number of rows for a ResultSet - * object produced by this Statement object; - * zero means there is no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setMaxRows - */ - public synchronized int getMaxRows() throws SQLException { - - checkClosed(); - - return maxRows; - } - - /** - * - * (JDBC4 clarification:) - * Sets the limit for the maximum number of rows that any - * ResultSet object generated by this Statement - * object can contain to the given number. - * If the limit is exceeded, the excess - * rows are silently dropped. - * - * - * @param max the new max rows limit; zero means there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code max >= 0} is not satisfied - * @see #getMaxRows - */ - public synchronized void setMaxRows(int max) throws SQLException { - - checkClosed(); - - if (max < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - maxRows = max; - } - - /** - * - * Sets escape processing on or off. - * If escape scanning is on (the default), the driver will do - * escape substitution before sending the SQL statement to the database. - * - * Note: Since prepared statements have usually been parsed prior - * to making this call, disabling escape processing for - * PreparedStatements objects will have no effect. - * - * - * @param enable true to enable escape processing; - * false to disable it - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - */ - public void setEscapeProcessing(boolean enable) throws SQLException { - - checkClosed(); - - isEscapeProcessing = enable; - } - - /** - * - * Retrieves the number of seconds the driver will - * wait for a Statement object to execute. - * If the limit is exceeded, a - * SQLException is thrown. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * To present, HSQLDB always returns zero, meaning there - * is no limit. - *

    - * - * - * @return the current query timeout limit in seconds; zero means there is - * no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setQueryTimeout - */ - public synchronized int getQueryTimeout() throws SQLException { - - checkClosed(); - - return queryTimeout; - } - - /** - * - * Sets the number of seconds the driver will wait for a - * Statement object to execute to the given number of seconds. - * If the limit is exceeded, an SQLException is thrown. A JDBC - * (JDBC4 clarification:) - * driver must apply this limit to the execute, - * executeQuery and executeUpdate methods. JDBC driver - * implementations may also apply this limit to ResultSet methods - * (consult your driver vendor documentation for details). - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * The maximum number of seconds to wait is 32767. - *

    - * - * - * @param seconds the new query timeout limit in seconds; zero means - * there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code seconds >= 0} is not satisfied - * @see #getQueryTimeout - */ - public void setQueryTimeout(int seconds) throws SQLException { - - checkClosed(); - - if (seconds < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - - if (seconds > Short.MAX_VALUE) { - seconds = Short.MAX_VALUE; - } - queryTimeout = seconds; - } - - /** - * - * Cancels this Statement object if both the DBMS and - * driver support aborting an SQL statement. - * This method can be used by one thread to cancel a statement that - * is being executed by another thread. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB version 2.3.4 and later supports aborting an SQL query - * or data update statement. - *

    - * - * - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method - */ - public void cancel() throws SQLException { - checkClosed(); - String sql = resultOut.getMainString(); - int randomId = connection.sessionProxy.getRandomId(); - Result request = Result.newCancelRequest(randomId, -1, sql); - - try { - Result response = connection.sessionProxy.cancel(request); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - } - - /** - * - * Retrieves the first warning reported by calls on this Statement object. - * Subsequent Statement object warnings will be chained to this - * SQLWarning object. - * - *

    The warning chain is automatically cleared each time - * a statement is (re)executed. This method may not be called on a closed - * Statement object; doing so will cause an SQLException - * to be thrown. - * - *

    Note: If you are processing a ResultSet object, any - * warnings associated with reads on that ResultSet object - * will be chained on it rather than on the Statement - * object that produced it. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * In 2.0, HSQLDB may produces Statement warnings; - * this method always returns null. - *

    - * - * - * @return the first SQLWarning object or null - * if there are no warnings - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - */ - public synchronized SQLWarning getWarnings() throws SQLException { - - checkClosed(); - - return rootWarning; - } - - /** - * - * Clears all the warnings reported on this Statement - * object. After a call to this method, - * the method getWarnings will return - * null until a new warning is reported for this - * Statement object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * In HSQLDB 2.0, SQLWarning objects may - * be produced for Statement Objects; calls to this method clear the warnings. - *

    - * - * - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - */ - public synchronized void clearWarnings() throws SQLException { - - checkClosed(); - - rootWarning = null; - } - - /* @todo 1.9.0 - implement */ - - /** - * - * Sets the SQL cursor name to the given String, which - * will be used by subsequent Statement object - * execute methods. This name can then be - * used in SQL positioned update or delete statements to identify the - * current row in the ResultSet object generated by this - * statement. If the database does not support positioned update/delete, - * this method is a noop. To ensure that a cursor has the proper isolation - * level to support updates, the cursor's SELECT statement - * should have the form SELECT FOR UPDATE. If - * FOR UPDATE is not present, positioned updates may fail. - * - *

    Note: By definition, the execution of positioned updates and - * deletes must be done by a different Statement object than - * the one that generated the ResultSet object being used for - * positioning. Also, cursor names must be unique within a connection. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Including 2.0, HSQLDB does not support named cursors; - * calls to this method are ignored. - *

    - * - * - * @param name the new cursor name, which must be unique within - * a connection - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - */ - public void setCursorName(String name) throws SQLException { - checkClosed(); - } - - //----------------------- Multiple Results -------------------------- - - /** - * - * Executes the given SQL statement, which may return multiple results. - * In some (uncommon) situations, a single SQL statement may return - * multiple result sets and/or update counts. Normally you can ignore - * this unless you are (1) executing a stored procedure that you know may - * return multiple results or (2) you are dynamically executing an - * unknown SQL string. - *

    - * The execute method executes an SQL statement and indicates the - * form of the first result. You must then use the methods - * getResultSet or getUpdateCount - * to retrieve the result, and getMoreResults to - * move to any subsequent result(s). - * - * - * @param sql any SQL statement - * @return true if the first result is a ResultSet - * object; false if it is an update count or there are - * no results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #getResultSet - * @see #getUpdateCount - * @see #getMoreResults - */ - public synchronized boolean execute(String sql) throws SQLException { - - fetchResult(sql, StatementTypes.RETURN_ANY, - JDBCStatementBase.NO_GENERATED_KEYS, null, null); - - return currentResultSet != null; - } - - /** - * - * Retrieves the current result as a ResultSet object. - * This method should be called only once per result. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - *

    - * - * - * @return the current result as a ResultSet object or - * null if the result is an update count or there are no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - */ - public synchronized ResultSet getResultSet() throws SQLException { - return super.getResultSet(); - } - - /** - * - * Retrieves the current result as an update count; - * if the result is a ResultSet object or there are no more results, -1 - * is returned. This method should be called only once per result. - * - * - * @return the current result as an update count; -1 if the current result is a - * ResultSet object or there are no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - */ - public synchronized int getUpdateCount() throws SQLException { - return super.getUpdateCount(); - } - - /** - * - * Moves to this Statement object's next result, returns - * true if it is a ResultSet object, and - * implicitly closes any current ResultSet - * object(s) obtained with the method getResultSet. - * - *

    There are no more results when the following is true: - *

    -     *     // stmt is a Statement object {@code
    -     *     ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
    -     * }
    - * - * - * @return true if the next result is a ResultSet - * object; false if it is an update count or there are - * no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - */ - public synchronized boolean getMoreResults() throws SQLException { - return getMoreResults(JDBCStatementBase.CLOSE_CURRENT_RESULT); - } - - //--------------------------JDBC 2.0----------------------------- - - /** - * - * Gives the driver a hint as to the direction in which - * rows will be processed in ResultSet - * objects created using this Statement object. The - * default value is ResultSet.FETCH_FORWARD. - *

    - * Note that this method sets the default fetch direction for - * result sets generated by this Statement object. - * Each result set has its own methods for getting and setting - * its own fetch direction. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB accepts all valid parameters.

    - *

    - * - * - * @param direction the initial direction for processing rows - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the given direction - * is not one of ResultSet.FETCH_FORWARD, - * ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN - * @since JDK 1.2 - * @see #getFetchDirection - */ - public synchronized void setFetchDirection( - int direction) throws SQLException { - - checkClosed(); - checkClosed(); - - switch (direction) { - - case ResultSet.FETCH_FORWARD : - case ResultSet.FETCH_REVERSE : - case ResultSet.FETCH_UNKNOWN : - fetchDirection = direction; - - break; - default : - throw JDBCUtil.invalidArgument(); - } - } - - /** - * - * Retrieves the direction for fetching rows from - * database tables that is the default for result sets - * generated from this Statement object. - * If this Statement object has not set - * a fetch direction by calling the method setFetchDirection, - * the return value is implementation-specific. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB returns the fetch direction.

    - *

    - * - * - * @return the default fetch direction for result sets generated - * from this Statement object - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - * @see #setFetchDirection - */ - public int getFetchDirection() throws SQLException { - - checkClosed(); - - return this.fetchDirection; - } - - /** - * - * (JDBC4 clarification:) - * Gives the JDBC driver a hint as to the number of rows that should - * be fetched from the database when more rows are needed for - * ResultSet objects generated by this Statement. - * If the value specified is zero, then the hint is ignored. - * The default value is zero. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB uses the specified value as a hint, but may process more or fewer - * rows than specified. - *

    - * - * - * @param rows the number of rows to fetch - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * (JDBC4 modified:) - * condition {@code rows >= 0} is not satisfied. - * @since JDK 1.2 - * @see #getFetchSize - */ - public synchronized void setFetchSize(int rows) throws SQLException { - - checkClosed(); - - if (rows < 0) { - throw JDBCUtil.outOfRangeArgument(); - } - fetchSize = rows; - } - - /** - * - * Retrieves the number of result set rows that is the default - * fetch size for ResultSet objects - * generated from this Statement object. - * If this Statement object has not set - * a fetch size by calling the method setFetchSize, - * the return value is implementation-specific. - * - * - * - *
    - * HSQLDB-Specific Information

    - * - * HSQLDB returns 0 by default, or the fetch size specified by setFetchSize - *

    - * - * - * @return the default fetch size for result sets generated - * from this Statement object - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - * @see #setFetchSize - */ - public synchronized int getFetchSize() throws SQLException { - - checkClosed(); - - return fetchSize; - } - - /** - * - * Retrieves the result set concurrency for ResultSet objects - * generated by this Statement object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB supports CONCUR_READ_ONLY and - * CONCUR_UPDATABLE concurrency. - *

    - * - * - * @return either ResultSet.CONCUR_READ_ONLY or - * ResultSet.CONCUR_UPDATABLE - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - */ - public synchronized int getResultSetConcurrency() throws SQLException { - - checkClosed(); - - return ResultProperties.getJDBCConcurrency(rsProperties); - } - - /** - * - * Retrieves the result set type for ResultSet objects - * generated by this Statement object. - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB 1.7.0 and later versions support TYPE_FORWARD_ONLY - * and TYPE_SCROLL_INSENSITIVE. - *

    - * - * - * @return one of ResultSet.TYPE_FORWARD_ONLY, - * ResultSet.TYPE_SCROLL_INSENSITIVE, or - * ResultSet.TYPE_SCROLL_SENSITIVE - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - */ - public synchronized int getResultSetType() throws SQLException { - - checkClosed(); - - return ResultProperties.getJDBCScrollability(rsProperties); - } - - /** - * - * Adds the given SQL command to the current list of commands for this - * Statement object. The commands in this list can be - * executed as a batch by calling the method executeBatch. - *

    - * (JDBC4 clarification:)

    - * NOTE: Support of an ability to batch updates is optional. - * - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 1.7.2, this feature is supported. - *

    - * - * - * @param sql typically this is a SQL INSERT or - * UPDATE statement - * (:JDBC4 modified) - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * driver does not support batch updates - * @see #executeBatch - * @since JDK 1.2 - */ - public synchronized void addBatch(String sql) throws SQLException { - - checkClosed(); - - if (isEscapeProcessing) { - sql = connection.nativeSQL(sql); - } - - if (batchResultOut == null) { - batchResultOut = Result.newBatchedExecuteRequest(); - } - batchResultOut.getNavigator().add(new Object[] { sql }); - } - - /** - * - * Empties this Statement object's current list of - * SQL commands. - *

    - * (JDBC4 clarification:)

    - * NOTE: Support of an ability to batch updates is optional. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 1.7.2, this feature is supported. - *

    - * - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * driver does not support batch updates - * @see #addBatch - * @since JDK 1.2 - */ - public synchronized void clearBatch() throws SQLException { - - checkClosed(); - - if (batchResultOut != null) { - batchResultOut.getNavigator().clear(); - } - } - - /** - * - * Submits a batch of commands to the database for execution and - * if all commands execute successfully, returns an array of update counts. - * The int elements of the array that is returned are ordered - * to correspond to the commands in the batch, which are ordered - * according to the order in which they were added to the batch. - * The elements in the array returned by the method executeBatch - * may be one of the following: - *
      - *
    1. A number greater than or equal to zero -- indicates that the - * command was processed successfully and is an update count giving the - * number of rows in the database that were affected by the command's - * execution - *
    2. A value of SUCCESS_NO_INFO -- indicates that the command was - * processed successfully but that the number of rows affected is - * unknown - *

      - * If one of the commands in a batch update fails to execute properly, - * this method throws a BatchUpdateException, and a JDBC - * driver may or may not continue to process the remaining commands in - * the batch. However, the driver's behavior must be consistent with a - * particular DBMS, either always continuing to process commands or never - * continuing to process commands. If the driver continues processing - * after a failure, the array returned by the method - * BatchUpdateException.getUpdateCounts - * will contain as many elements as there are commands in the batch, and - * at least one of the elements will be the following: - * - *

    3. A value of EXECUTE_FAILED -- indicates that the command failed - * to execute successfully and occurs only if a driver continues to - * process commands after a command fails - *
    - *

    - * (JDBC4 clarification:)

    - * NOTE: Support of an ability to batch updates is optional. - *

    - * The possible implementations and return values have been modified in - * the Java 2 SDK, Standard Edition, version 1.3 to - * accommodate the option of continuing to process commands in a batch - * update after a BatchUpdateException object has been thrown. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with HSQLDB 1.7.2, this feature is supported.

    - * - * HSQLDB stops execution of commands in a batch when one of the commands - * results in an exception. The size of the returned array equals the - * number of commands that were executed successfully.

    - * - *

    - * - * - * @return an array of update counts containing one element for each - * command in the batch. The elements of the array are ordered according - * to the order in which commands were added to the batch. - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * driver does not support batch statements. Throws {@link BatchUpdateException} - * (a subclass of SQLException) if one of the commands sent to the - * database fails to execute properly or attempts to return a result set. - * - * - * @see #addBatch - * @see java.sql.DatabaseMetaData#supportsBatchUpdates - * @since JDK 1.3 - */ - public synchronized int[] executeBatch() throws SQLException { - - checkClosed(); - - generatedResult = null; - - if (batchResultOut == null) { - batchResultOut = Result.newBatchedExecuteRequest(); - } - - int batchCount = batchResultOut.getNavigator().getSize(); - - try { - resultIn = connection.sessionProxy.execute(batchResultOut); - - performPostExecute(); - } catch (HsqlException e) { - batchResultOut.getNavigator().clear(); - - throw JDBCUtil.sqlException(e); - } - batchResultOut.getNavigator().clear(); - - if (resultIn.isError()) { - throw JDBCUtil.sqlException(resultIn); - } - - RowSetNavigator navigator = resultIn.getNavigator(); - int[] updateCounts = new int[navigator.getSize()]; - - for (int i = 0; navigator.next(); i++) { - Object[] data = navigator.getCurrent(); - - updateCounts[i] = ((Integer) data[0]).intValue(); - } - - if (updateCounts.length != batchCount) { - if (errorResult == null) { - throw new BatchUpdateException(updateCounts); - } else { - throw new BatchUpdateException(errorResult.getMainString(), - errorResult.getSubString(), - errorResult.getErrorCode(), updateCounts); - } - } - - return updateCounts; - } - - /** - * - * Retrieves the Connection object - * that produced this Statement object. - * - * - * @return the connection that produced this statement - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.2 - */ - public synchronized Connection getConnection() throws SQLException { - - checkClosed(); - - return connection; - } - - //--------------------------JDBC 3.0----------------------------- - - /** - * - * Moves to this Statement object's next result, deals with - * any current ResultSet object(s) according to the instructions - * specified by the given flag, and returns - * true if the next result is a ResultSet object. - * - *

    There are no more results when the following is true: - *

    -     *     // stmt is a Statement object{@code
    -     *     ((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1))
    -     * }
    - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * HSQLDB moves to the next ResultSet and returns the correct result.

    - *

    - * - * - * @param current one of the following Statement - * constants indicating what should happen to current - * ResultSet objects obtained using the method - * getResultSet: - * Statement.CLOSE_CURRENT_RESULT, - * Statement.KEEP_CURRENT_RESULT, or - * Statement.CLOSE_ALL_RESULTS - * @return true if the next result is a ResultSet - * object; false if it is an update count or there are no - * more results - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the argument - * supplied is not one of the following: - * Statement.CLOSE_CURRENT_RESULT, - * Statement.KEEP_CURRENT_RESULT, or - * Statement.CLOSE_ALL_RESULTS - * @since JDK 1.4, HSQLDB 1.7 - * @see #execute - */ - public synchronized boolean getMoreResults( - int current) throws SQLException { - return super.getMoreResults(current); - } - - /** - * - * Retrieves any auto-generated keys created as a result of executing this - * Statement object. If this Statement object did - * not generate any keys, an empty ResultSet - * object is returned. - *

    (JDBC4 clarification:) - *

    Note:If the columns which represent the auto-generated keys were not specified, - * the JDBC driver implementation will determine the columns which best represent the auto-generated keys. - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports this feature with single-row - * and multi-row insert, update and merge statements.

    - * - * This method returns a result set only if - * the executeUpdate methods that was used is one of the three methods that - * have the extra parameter indicating return of generated keys

    - * - * If the executeUdate method did not specify the columns which represent - * the auto-generated keys the IDENTITY column or GENERATED column(s) of the - * table are returned.

    - * - * The executeUpdate methods with column indexes or column names return the - * post-insert or post-update values of the specified columns, whether the - * columns are generated or not. This allows values that have been modified - * by execution of triggers to be returned.

    - * - * If column names or indexes provided by the user in the executeUpdate() - * method calls do not correspond to table columns (incorrect names or - * indexes larger than the column count), an empty result is returned. - * - *

    - * - * - * @return a ResultSet object containing the auto-generated key(s) - * generated by the execution of this Statement object - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized ResultSet getGeneratedKeys() throws SQLException { - return getGeneratedResultSet(); - } - - /** - * - * Executes the given SQL statement and signals the driver with the - * given flag about whether the - * auto-generated keys produced by this Statement object - * should be made available for retrieval. The driver will ignore the - * flag if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports returning generated columns - * with single-row and multi-row INSERT, UPDATE and MERGE statements.

    - * If the table has an IDENTITY or GENERATED column(s) the values for these - * columns are returned in the next call to getGeneratedKeys(). - * - * HSQLDB also supports returning primary key values from the rows by using the - * org.hsqldb.jdbc.JDBCStatement.RETURN_PRIMARY_KEYS constant. - * - *

    - * - * @param sql an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * (:JDBC4 clarification) - * - * @param autoGeneratedKeys a flag indicating whether auto-generated keys - * should be made available for retrieval; - * one of the following constants: - * Statement.RETURN_GENERATED_KEYS - * Statement.NO_GENERATED_KEYS - * @return either (1) the row count for SQL Data Manipulation Language (DML) statements - * or (2) 0 for SQL statements that return nothing - * (:JDBC4 clarification) - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement, the given - * SQL statement returns a ResultSet object, or - * the given constant is not one of those allowed - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method with a constant of Statement.RETURN_GENERATED_KEYS - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized int executeUpdate(String sql, - int autoGeneratedKeys) throws SQLException { - - if (autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS - && autoGeneratedKeys != Statement.NO_GENERATED_KEYS - && autoGeneratedKeys != JDBCStatement.RETURN_PRIMARY_KEYS) { - throw JDBCUtil.invalidArgument("autoGeneratedKeys"); - } - fetchResult(sql, StatementTypes.RETURN_COUNT, autoGeneratedKeys, null, - null); - - if (resultIn.isError()) { - throw JDBCUtil.sqlException(resultIn); - } - - return resultIn.getUpdateCount(); - } - - /** - * - * Executes the given SQL statement and signals the driver that the - * auto-generated keys indicated in the given array should be made available - * for retrieval. The driver will ignore the array if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * (JDBC 4 clarification) - * auto-generated keys (the list of such statements is vendor-specific). - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports returning generated columns - * with single-row and multi-row INSERT, UPDATE and MERGE statements.

    - * The columnIndexes may specify any set of columns of the table. - * - *

    - * - * - * @param sql an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * (:JDBC4 clarification) - * - * @param columnIndexes an array of column indexes indicating the columns - * that should be returned from the inserted row - * @return either (1) the row count for SQL Data Manipulation Language (DML) statements - * or (2) 0 for SQL statements that return nothing - * (:JDBC 4 clarification) - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement, the SQL - * statement returns a ResultSet object, or the - * second argument supplied to this method is not an int array - * whose elements are valid column indexes - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized int executeUpdate(String sql, - int[] columnIndexes) throws SQLException { - - if (columnIndexes == null || columnIndexes.length == 0) { - throw JDBCUtil.invalidArgument("columnIndexes"); - } - fetchResult(sql, StatementTypes.RETURN_COUNT, - ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES, - columnIndexes, null); - - return resultIn.getUpdateCount(); - } - - /** - * - * Executes the given SQL statement and signals the driver that the - * auto-generated keys indicated in the given array should be made available - * for retrieval. The driver will ignore the array if the SQL statement - * (JDBC4 clarification:) - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - * - * - * - *
    - *

    HSQLDB-Specific Information:

    - * - * Starting with version 2.0, HSQLDB supports returning generated columns - * with single-row and multi-row INSERT, UPDATE and MERGE statements.

    - * The columnNames may specify any set of columns of the table. - * - *

    - * - * - * @param sql an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * (:JDBC4 clarification) - * @param columnNames an array of the names of the columns that should be - * returned from the inserted row - * @return either the row count for INSERT, UPDATE, - * or DELETE statements, or 0 for SQL statements - * that return nothing - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement, the SQL - * statement returns a ResultSet object, or the - * second argument supplied to this method is not a String array - * whose elements are valid column names - * - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized int executeUpdate(String sql, - String[] columnNames) throws SQLException { - - if (columnNames == null || columnNames.length == 0) { - throw JDBCUtil.invalidArgument("columnIndexes"); - } - fetchResult(sql, StatementTypes.RETURN_COUNT, - ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES, null, - columnNames); - - return resultIn.getUpdateCount(); - } - - /** - * - * Executes the given SQL statement, which may return multiple results, - * and signals the driver that any - * auto-generated keys should be made available - * for retrieval. The driver will ignore this signal if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * (JDBC4 clarification) - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * In some (uncommon) situations, a single SQL statement may return - * multiple result sets and/or update counts. Normally you can ignore - * this unless you are (1) executing a stored procedure that you know may - * return multiple results or (2) you are dynamically executing an - * unknown SQL string. - *

    - * The execute method executes an SQL statement and indicates the - * form of the first result. You must then use the methods - * getResultSet or getUpdateCount - * to retrieve the result, and getMoreResults to - * move to any subsequent result(s). - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB supports this feature. - * - * HSQLDB also supports returning primary key values from the rows by using the - * org.hsqldb.result.ResultConstants.RETURN_PRIMARY_KEYS constant. - * - *

    - * - * - * @param sql any SQL statement - * @param autoGeneratedKeys a constant indicating whether auto-generated - * keys should be made available for retrieval using the method - * getGeneratedKeys; one of the following constants: - * Statement.RETURN_GENERATED_KEYS or - * Statement.NO_GENERATED_KEYS - * @return true if the first result is a ResultSet - * object; false if it is an update count or there are - * no results - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the second - * parameter supplied to this method is not - * Statement.RETURN_GENERATED_KEYS or - * Statement.NO_GENERATED_KEYS. - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method with a constant of Statement.RETURN_GENERATED_KEYS - * @see #getResultSet - * @see #getUpdateCount - * @see #getMoreResults - * @see #getGeneratedKeys - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized boolean execute( - String sql, int autoGeneratedKeys) throws SQLException { - - if (autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS - && autoGeneratedKeys != Statement.NO_GENERATED_KEYS - && autoGeneratedKeys != JDBCStatement.RETURN_PRIMARY_KEYS) { - throw JDBCUtil.invalidArgument("autoGeneratedKeys"); - } - fetchResult(sql, StatementTypes.RETURN_ANY, autoGeneratedKeys, null, - null); - - return resultIn.isData(); - } - - /** - * - * Executes the given SQL statement, which may return multiple results, - * and signals the driver that the - * auto-generated keys indicated in the given array should be made available - * for retrieval. This array contains the indexes of the columns in the - * target table that contain the auto-generated keys that should be made - * available. The driver will ignore the array if the SQL statement - * (JDBC4 clarification) - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * Under some (uncommon) situations, a single SQL statement may return - * multiple result sets and/or update counts. Normally you can ignore - * this unless you are (1) executing a stored procedure that you know may - * return multiple results or (2) you are dynamically executing an - * unknown SQL string. - *

    - * The execute method executes an SQL statement and indicates the - * form of the first result. You must then use the methods - * getResultSet or getUpdateCount - * to retrieve the result, and getMoreResults to - * move to any subsequent result(s). - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB supports this feature. - * - *

    - * - * - * @param sql any SQL statement - * @param columnIndexes an array of the indexes of the columns in the - * inserted row that should be made available for retrieval by a - * call to the method getGeneratedKeys - * @return true if the first result is a ResultSet - * object; false if it is an update count or there - * are no results - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * elements in the int array passed to this method - * are not valid column indexes - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @see #getResultSet - * @see #getUpdateCount - * @see #getMoreResults - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized boolean execute( - String sql, int[] columnIndexes) throws SQLException { - - if (columnIndexes == null || columnIndexes.length == 0) { - throw JDBCUtil.invalidArgument("columnIndexes"); - } - fetchResult(sql, StatementTypes.RETURN_ANY, - ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES, - columnIndexes, null); - - return resultIn.isData(); - } - - /** - * - * Executes the given SQL statement, which may return multiple results, - * and signals the driver that the - * auto-generated keys indicated in the given array should be made available - * for retrieval. This array contains the names of the columns in the - * target table that contain the auto-generated keys that should be made - * available. The driver will ignore the array if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * In some (uncommon) situations, a single SQL statement may return - * multiple result sets and/or update counts. Normally you can ignore - * this unless you are (1) executing a stored procedure that you know may - * return multiple results or (2) you are dynamically executing an - * unknown SQL string. - *

    - * The execute method executes an SQL statement and indicates the - * form of the first result. You must then use the methods - * getResultSet or getUpdateCount - * to retrieve the result, and getMoreResults to - * move to any subsequent result(s). - * - * - * - *

    - *

    HSQLDB-Specific Information:

    - * - * Starting with 2.0, HSQLDB supports this feature. - * - *

    - * - * - * @param sql any SQL statement - * @param columnNames an array of the names of the columns in the inserted - * row that should be made available for retrieval by a call to the - * method getGeneratedKeys - * @return true if the next result is a ResultSet - * object; false if it is an update count or there - * are no more results - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * elements of the String array passed to this - * method are not valid column names - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @see #getResultSet - * @see #getUpdateCount - * @see #getMoreResults - * @see #getGeneratedKeys - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized boolean execute( - String sql, String[] columnNames) throws SQLException { - - if (columnNames == null || columnNames.length == 0) { - throw JDBCUtil.invalidArgument("columnIndexes"); - } - fetchResult(sql, StatementTypes.RETURN_ANY, - ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES, null, - columnNames); - - return resultIn.isData(); - } - - /** - * - * Retrieves the result set holdability for ResultSet objects - * generated by this Statement object. - * - * - * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @since JDK 1.4, HSQLDB 1.7 - */ - public synchronized int getResultSetHoldability() throws SQLException { - return ResultProperties.getJDBCHoldability(rsProperties); - } - - //----------------------------- JDBC 4.0 ----------------------------------- - - /** - * Retrieves whether this Statement object has been closed. A Statement is closed if the - * method close has been called on it, or if it is automatically closed. - * @return true if this Statement object is closed; false if it is still open - * @since JDK 1.6, HSQLDB 2.0 - */ - public synchronized boolean isClosed() { - return isClosed; - } - -// --------------------------- Added: Mustang Build 81 ------------------------- - boolean poolable = false; - - /** - * Requests that a Statement be pooled or not pooled. The value - * specified is a hint to the statement pool implementation indicating - * whether the application wants the statement to be pooled. It is up to - * the statement pool manager as to whether the hint is used. - *

    - * The poolable value of a statement is applicable to both internal - * statement caches implemented by the driver and external statement caches - * implemented by application servers and other applications. - *

    - * By default, a Statement is not poolable when created, and - * a PreparedStatement and CallableStatement - * are poolable when created. - *

    - * @param poolable requests that the statement be pooled if true and - * that the statement not be pooled if false - *

    - * @throws SQLException if this method is called on a closed - * Statement - *

    - * @since JDK 1.6 Build 81, HSQLDB 2.0 - */ - - public synchronized void setPoolable( - boolean poolable) throws SQLException { - - checkClosed(); - - this.poolable = poolable; - } - - /** - * Returns a value indicating whether the Statement - * is poolable or not. - *

    - * @return true if the Statement - * is poolable; false otherwise - * @throws SQLException if this method is called on a closed - * Statement - *

    - * @since JDK 1.6 Build 81, HSQLDB 2.0 - *

    - * @see #setPoolable(boolean) setPoolable(boolean) - */ - public synchronized boolean isPoolable() throws SQLException { - - checkClosed(); - - return this.poolable; - } - - // ------------------- java.sql.Wrapper implementation --------------------- - - /** - * Returns an object that implements the given interface to allow access to - * non-standard methods, or standard methods not exposed by the proxy. - * - * If the receiver implements the interface then the result is the receiver - * or a proxy for the receiver. If the receiver is a wrapper - * and the wrapped object implements the interface then the result is the - * wrapped object or a proxy for the wrapped object. Otherwise return the - * result of calling unwrap recursively on the wrapped object - * or a proxy for that result. If the receiver is not a - * wrapper and does not implement the interface, then an SQLException is thrown. - * - * @param iface A Class defining an interface that the result must implement. - * @return an object that implements the interface. May be a proxy for the actual implementing object. - * @throws java.sql.SQLException If no object found that implements the interface - * @since JDK 1.6, HSQLDB 2.0 - */ - @SuppressWarnings("unchecked") - public T unwrap(Class iface) throws java.sql.SQLException { - - if (isWrapperFor(iface)) { - return (T) this; - } - - throw JDBCUtil.invalidArgument("iface: " + iface); - } - - /** - * Returns true if this either implements the interface argument or is directly or indirectly a wrapper - * for an object that does. Returns false otherwise. If this implements the interface then return true, - * else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped - * object. If this does not implement the interface and is not a wrapper, return false. - * This method should be implemented as a low-cost operation compared to unwrap so that - * callers can use this method to avoid expensive unwrap calls that may fail. If this method - * returns true then calling unwrap with the same argument should succeed. - * - * @param iface a Class defining an interface. - * @return true if this implements the interface or directly or indirectly wraps an object that does. - * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper - * for an object with the given interface. - * @since JDK 1.6, HSQLDB 2.0 - */ - public boolean isWrapperFor( - java.lang.Class iface) throws java.sql.SQLException { - return (iface != null && iface.isAssignableFrom(this.getClass())); - } - - //--------------------------JDBC 4.2 ----------------------------- - - /** - * Retrieves the current result as an update count; if the result - * is a ResultSet object or there are no more results, -1 - * is returned. This method should be called only once per result. - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The public implementation will throw {@code UnsupportedOperationException} - * - * @return the current result as an update count; -1 if the current result - * is a ResultSet object or there are no more results - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #execute - * @since 1.8 - */ -//#ifdef JAVA8 - public long getLargeUpdateCount() throws SQLException { - return super.getUpdateCount(); - } - -//#endif JAVA8 - /** - * Sets the limit for the maximum number of rows that any - * ResultSet object generated by this Statement - * object can contain to the given number. - * If the limit is exceeded, the excess - * rows are silently dropped. - *

    - * This method should be used when the row limit may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The default implementation will throw {@code UnsupportedOperationException} - * - * @param max the new max rows limit; zero means there is no limit - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement - * or the condition {@code max >= 0} is not satisfied - * @see #getMaxRows - * @since 1.8 - */ -//#ifdef JAVA8 - public void setLargeMaxRows(long max) throws SQLException { - - int maxRows = max > Integer.MAX_VALUE ? Integer.MAX_VALUE : - (int) max; - setMaxRows(maxRows); - } -//#endif JAVA8 - - /** - * Retrieves the maximum number of rows that a - * ResultSet object produced by this - * Statement object can contain. If this limit is exceeded, - * the excess rows are silently dropped. - *

    - * This method should be used when the returned row limit may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The default implementation will return {@code 0} - * - * @return the current maximum number of rows for a ResultSet - * object produced by this Statement object; - * zero means there is no limit - * @exception SQLException if a database access error occurs or - * this method is called on a closed Statement - * @see #setMaxRows - * @since 1.8 - */ -//#ifdef JAVA8 - public long getLargeMaxRows() throws SQLException { - return maxRows; - } -//#endif JAVA8 - - /** - * Submits a batch of commands to the database for execution and - * if all commands execute successfully, returns an array of update counts. - * The long elements of the array that is returned are ordered - * to correspond to the commands in the batch, which are ordered - * according to the order in which they were added to the batch. - * The elements in the array returned by the method {@code executeLargeBatch} - * may be one of the following: - *

      - *
    1. A number greater than or equal to zero -- indicates that the - * command was processed successfully and is an update count giving the - * number of rows in the database that were affected by the command's - * execution - *
    2. A value of SUCCESS_NO_INFO -- indicates that the command was - * processed successfully but that the number of rows affected is - * unknown - *

      - * If one of the commands in a batch update fails to execute properly, - * this method throws a BatchUpdateException, and a JDBC - * driver may or may not continue to process the remaining commands in - * the batch. However, the driver's behavior must be consistent with a - * particular DBMS, either always continuing to process commands or never - * continuing to process commands. If the driver continues processing - * after a failure, the array returned by the method - * BatchUpdateException.getLargeUpdateCounts - * will contain as many elements as there are commands in the batch, and - * at least one of the elements will be the following: - * - *

    3. A value of EXECUTE_FAILED -- indicates that the command failed - * to execute successfully and occurs only if a driver continues to - * process commands after a command fails - *
    - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * The default implementation will throw {@code UnsupportedOperationException} - * - * @return an array of update counts containing one element for each - * command in the batch. The elements of the array are ordered according - * to the order in which commands were added to the batch. - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement or the - * driver does not support batch statements. Throws {@link BatchUpdateException} - * (a subclass of SQLException) if one of the commands sent to the - * database fails to execute properly or attempts to return a result set. - * @throws SQLTimeoutException when the driver has determined that the - * timeout value that was specified by the {@code setQueryTimeout} - * method has been exceeded and has at least attempted to cancel - * the currently running {@code Statement} - * - * @see #addBatch - * @see DatabaseMetaData#supportsBatchUpdates - * @since 1.8 - */ -//#ifdef JAVA8 - public long[] executeLargeBatch() throws SQLException { - int[] updateCounts = executeBatch(); - - long[] longCounts = new long[updateCounts.length]; - - for(int i = 0; i < updateCounts.length; i++) { - longCounts[i] = updateCounts[i]; - } - - return longCounts; - } -//#endif JAVA8 - - /** - * Executes the given SQL statement, which may be an INSERT, - * UPDATE, or DELETE statement or an - * SQL statement that returns nothing, such as an SQL DDL statement. - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * Note:This method cannot be called on a - * PreparedStatement or CallableStatement. - *

    - * The default implementation will throw {@code UnsupportedOperationException} - * - * @param sql an SQL Data Manipulation Language (DML) statement, - * such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * - * @return either (1) the row count for SQL Data Manipulation Language - * (DML) statements or (2) 0 for SQL statements that return nothing - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement, the given - * SQL statement produces a ResultSet object, the method is called on a - * PreparedStatement or CallableStatement - * @throws SQLTimeoutException when the driver has determined that the - * timeout value that was specified by the {@code setQueryTimeout} - * method has been exceeded and has at least attempted to cancel - * the currently running {@code Statement} - * @since 1.8 - */ -//#ifdef JAVA8 - public long executeLargeUpdate(String sql) throws SQLException { - return executeUpdate(sql); - } -//#endif JAVA8 - - /** - * Executes the given SQL statement and signals the driver with the - * given flag about whether the - * auto-generated keys produced by this Statement object - * should be made available for retrieval. The driver will ignore the - * flag if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * Note:This method cannot be called on a - * PreparedStatement or CallableStatement. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param sql an SQL Data Manipulation Language (DML) statement, - * such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * - * @param autoGeneratedKeys a flag indicating whether auto-generated keys - * should be made available for retrieval; - * one of the following constants: - * Statement.RETURN_GENERATED_KEYS - * Statement.NO_GENERATED_KEYS - * @return either (1) the row count for SQL Data Manipulation Language (DML) statements - * or (2) 0 for SQL statements that return nothing - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement, the given - * SQL statement returns a ResultSet object, - * the given constant is not one of those allowed, the method is called on a - * PreparedStatement or CallableStatement - * @exception SQLFeatureNotSupportedException if the JDBC driver does not support - * this method with a constant of Statement.RETURN_GENERATED_KEYS - * @throws SQLTimeoutException when the driver has determined that the - * timeout value that was specified by the {@code setQueryTimeout} - * method has been exceeded and has at least attempted to cancel - * the currently running {@code Statement} - * @since 1.8 - */ -//#ifdef JAVA8 - public long executeLargeUpdate(String sql, int autoGeneratedKeys) - throws SQLException { - return executeUpdate(sql, autoGeneratedKeys); - } -//#endif JAVA8 - - /** - * Executes the given SQL statement and signals the driver that the - * auto-generated keys indicated in the given array should be made available - * for retrieval. This array contains the indexes of the columns in the - * target table that contain the auto-generated keys that should be made - * available. The driver will ignore the array if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * Note:This method cannot be called on a - * PreparedStatement or CallableStatement. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param sql an SQL Data Manipulation Language (DML) statement, - * such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * - * @param columnIndexes an array of column indexes indicating the columns - * that should be returned from the inserted row - * @return either (1) the row count for SQL Data Manipulation Language (DML) statements - * or (2) 0 for SQL statements that return nothing - * - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement, the SQL - * statement returns a ResultSet object,the second argument - * supplied to this method is not an - * int array whose elements are valid column indexes, the method is called on a - * PreparedStatement or CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @throws SQLTimeoutException when the driver has determined that the - * timeout value that was specified by the {@code setQueryTimeout} - * method has been exceeded and has at least attempted to cancel - * the currently running {@code Statement} - * @since 1.8 - */ -//#ifdef JAVA8 - public long executeLargeUpdate(String sql, int[] columnIndexes) throws SQLException { - return executeUpdate(sql, columnIndexes); - } -//#endif JAVA8 - - /** - * Executes the given SQL statement and signals the driver that the - * auto-generated keys indicated in the given array should be made available - * for retrieval. This array contains the names of the columns in the - * target table that contain the auto-generated keys that should be made - * available. The driver will ignore the array if the SQL statement - * is not an INSERT statement, or an SQL statement able to return - * auto-generated keys (the list of such statements is vendor-specific). - *

    - * This method should be used when the returned row count may exceed - * {@link Integer#MAX_VALUE}. - *

    - * Note:This method cannot be called on a - * PreparedStatement or CallableStatement. - *

    - * The default implementation will throw {@code SQLFeatureNotSupportedException} - * - * @param sql an SQL Data Manipulation Language (DML) statement, - * such as INSERT, UPDATE or - * DELETE; or an SQL statement that returns nothing, - * such as a DDL statement. - * @param columnNames an array of the names of the columns that should be - * returned from the inserted row - * @return either the row count for INSERT, UPDATE, - * or DELETE statements, or 0 for SQL statements - * that return nothing - * @exception SQLException if a database access error occurs, - * this method is called on a closed Statement, the SQL - * statement returns a ResultSet object, the - * second argument supplied to this method is not a String array - * whose elements are valid column names, the method is called on a - * PreparedStatement or CallableStatement - * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method - * @throws SQLTimeoutException when the driver has determined that the - * timeout value that was specified by the {@code setQueryTimeout} - * method has been exceeded and has at least attempted to cancel - * the currently running {@code Statement} - * @since 1.8 - */ -//#ifdef JAVA8 - public long executeLargeUpdate(String sql, String[] columnNames) - throws SQLException { - return executeUpdate(sql, columnNames); - } -//#endif JAVA8 - // -------------------- Internal Implementation ---------------------------- - - /** - * Constructs a new JDBCStatement with the specified connection and result - * type. - * - * @param c the connection on which this statement will execute - */ - JDBCStatement(JDBCConnection c, int props) { - - resultOut = Result.newExecuteDirectRequest(); - connection = c; - connectionIncarnation = connection.incarnation; - rsProperties = props; - } - - /** - * Internal result producer for JDBCStatement (sqlExecDirect mode). - * - *

    - * - * @param sql a character sequence representing the SQL to be executed - * @param statementRetType int - * @param generatedKeys int - * @param generatedIndexes int[] - * @param generatedNames String[] - * @throws SQLException when a database access error occurs - */ - private void fetchResult(String sql, int statementRetType, - int generatedKeys, int[] generatedIndexes, - String[] generatedNames) throws SQLException { - - checkClosed(); - closeResultData(); - - if (isEscapeProcessing) { - sql = connection.nativeSQL(sql); - } - resultOut.setPrepareOrExecuteProperties(sql, maxRows, fetchSize, - statementRetType, queryTimeout, rsProperties, generatedKeys, - generatedIndexes, generatedNames); - - try { - resultIn = connection.sessionProxy.execute(resultOut); - - performPostExecute(); - } catch (HsqlException e) { - throw JDBCUtil.sqlException(e); - } - - if (resultIn.isError()) { - throw JDBCUtil.sqlException(resultIn); - } - - if (resultIn.isData()) { - currentResultSet = new JDBCResultSet(connection, this, resultIn, - resultIn.metaData); - } else if (resultIn.getStatementType() - == StatementTypes.RETURN_RESULT) { - getMoreResults(); - } - } - - public int getResultSetScrollability() { - return ResultProperties.getJDBCScrollability(rsProperties); - } - -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCStatementBase.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCStatementBase.java deleted file mode 100644 index 40d6b729..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCStatementBase.java +++ /dev/null @@ -1,351 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.SQLWarning; - -import org.hsqldb.StatementTypes; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultConstants; - -/** - * Base class for HSQLDB's implementations of java.sql.Statement and - * java.sql.PreparedStatement. Contains common members and methods. - * - * @author fredt@usrs - * @version 2.4.0 - * @since 1.9.0 - */ - -/* - * JDBC specification. - * - * Closing the Statement closes the ResultSet instance returned. But: - * - * Statement can be executed multiple times and return several results. With - * normal Statement objects, each execution can be for a completely different - * query. PreparedStatement instances are specifically for multiple use over - * multiple transactions. - * - * ResultSets may be held over commits and span several transactions. - * - * There is no real relation between the current state of a Statement instance - * and the various ResultSets that it may have returned for different queries. - */ - -/* - * review the following issues: - * - * Does not always close ResultSet object directly when closed. Although RS - * objects will eventually be closed when accessed, the change is not reflected - * to the server, impacting ResultSets that are held. - */ -class JDBCStatementBase { - - /** - * Whether this Statement has been explicitly closed. A JDBCConnection - * object now explicitly closes all of its open JDBC Statement objects - * when it is closed. - */ - volatile boolean isClosed; - - /** Is escape processing enabled? */ - protected boolean isEscapeProcessing = true; - - /** The connection used to execute this statement. */ - protected JDBCConnection connection; - - /** The maximum number of rows to generate when executing this statement. */ - protected int maxRows; - - /** The number of rows returned in a chunk. */ - protected int fetchSize = 0; - - /** Direction of results fetched. */ - protected int fetchDirection = JDBCResultSet.FETCH_FORWARD; - - /** The result of executing this statement. */ - protected Result resultIn; - - /** Any error returned from a batch execute. */ - protected Result errorResult; - - /** The currently existing generated key Result */ - protected Result generatedResult; - - /** The combined result set properties obtained by executing this statement. */ - protected int rsProperties; - - /** Used by this statement to communicate non-batched requests. */ - protected Result resultOut; - - /** Used by this statement to communicate batched execution requests */ - protected Result batchResultOut; - - /** The currently existing ResultSet object */ - protected JDBCResultSet currentResultSet; - - /** The currently existing ResultSet object for generated keys */ - protected JDBCResultSet generatedResultSet; - - /** The first warning in the chain. Null if there are no warnings. */ - protected SQLWarning rootWarning; - - /** Query timeout in seconds */ - protected int queryTimeout; - - /** connection generation */ - int connectionIncarnation; - - /** Implementation in subclasses - * @throws SQLException on access error - */ - void close() throws SQLException {} - - /** - * An internal check for closed statements. - * - * @throws SQLException when the connection is closed - */ - void checkClosed() throws SQLException { - - if (isClosed) { - throw JDBCUtil.sqlException(ErrorCode.X_07501); - } - - if (connection.isClosed) { - close(); - - throw JDBCUtil.sqlException(ErrorCode.X_08503); - } - - if (connectionIncarnation != connection.incarnation) { - throw JDBCUtil.sqlException(ErrorCode.X_08503); - } - } - - /** - * processes chained warnings and any generated columns result set - */ - void performPostExecute() throws SQLException { - - resultOut.clearLobResults(); - - generatedResult = null; - - if (resultIn == null) { - return; - } - - rootWarning = null; - - Result current = resultIn; - - while (current.getChainedResult() != null) { - current = current.getUnlinkChainedResult(); - - if (current.getType() == ResultConstants.WARNING) { - SQLWarning w = JDBCUtil.sqlWarning(current); - - if (rootWarning == null) { - rootWarning = w; - } else { - rootWarning.setNextWarning(w); - } - } else if (current.getType() == ResultConstants.ERROR) { - errorResult = current; - } else if (current.getType() == ResultConstants.GENERATED) { - generatedResult = current; - } else if (current.getType() == ResultConstants.DATA) { - resultIn.addChainedResult(current); - } - } - - if (rootWarning != null) { - connection.setWarnings(rootWarning); - } - } - - int getUpdateCount() throws SQLException { - - checkClosed(); - - return (resultIn == null || resultIn.isData()) ? -1 - : resultIn - .getUpdateCount(); - } - - ResultSet getResultSet() throws SQLException { - - checkClosed(); - - ResultSet result = currentResultSet; - - if(!connection.isCloseResultSet) { - currentResultSet = null; - } - - if (result == null) { - - // if statement has been used with executeQuery and the result is update count - // return an empty result for 1.8 compatibility - if (resultOut.getStatementType() == StatementTypes.RETURN_RESULT) { - return JDBCResultSet.newEmptyResultSet(); - } - } - - return result; - } - - boolean getMoreResults() throws SQLException { - return getMoreResults(CLOSE_CURRENT_RESULT); - } - - /** - * Not yet correct for multiple ResultSets. Should keep track of all - * previous ResultSet objects to be able to close them - */ - boolean getMoreResults(int current) throws SQLException { - - checkClosed(); - - if (resultIn == null) { - return false; - } - - resultIn = resultIn.getChainedResult(); - - if (currentResultSet != null) { - if( current != KEEP_CURRENT_RESULT) { - currentResultSet.close(); - } - } - - currentResultSet = null; - - if (resultIn != null) { - currentResultSet = new JDBCResultSet(connection, this, resultIn, - resultIn.metaData); - - return true; - } - - return false; - } - - ResultSet getGeneratedResultSet() throws SQLException { - checkClosed(); - if (generatedResultSet != null) { - generatedResultSet.close(); - } - - if (generatedResult == null) { - generatedResult = Result.emptyGeneratedResult; - } - - generatedResultSet = new JDBCResultSet(connection, null, - generatedResult, - generatedResult.metaData); - - return generatedResultSet; - } - - /** - * See comment for getMoreResults. - */ - void closeResultData() throws SQLException { - - if (currentResultSet != null) { - currentResultSet.close(); - } - - if (generatedResultSet != null) { - generatedResultSet.close(); - } - - generatedResultSet = null; - generatedResult = null; - resultIn = null; - currentResultSet = null; - } - - /** - * JDBC 3 constants - */ - static final int CLOSE_CURRENT_RESULT = 1; - static final int KEEP_CURRENT_RESULT = 2; - static final int CLOSE_ALL_RESULTS = 3; - static final int SUCCESS_NO_INFO = -2; - static final int EXECUTE_FAILED = -3; - static final int RETURN_GENERATED_KEYS = 1; - static final int NO_GENERATED_KEYS = 2; - - //--------------------------JDBC 4.1 ----------------------------- - - /** - * Specifies that this {@code Statement} will be closed when all its - * dependent result sets are closed. If execution of the {@code Statement} - * does not produce any result sets, this method has no effect. - *

    - * Note: Multiple calls to {@code closeOnCompletion} do - * not toggle the effect on this {@code Statement}. However, a call to - * {@code closeOnCompletion} does effect both the subsequent execution of - * statements, and statements that currently have open, dependent, - * result sets. - * - * @throws SQLException if this method is called on a closed - * {@code Statement} - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public void closeOnCompletion() throws SQLException { - checkClosed(); - } - - /** - * Returns a value indicating whether this {@code Statement} will be - * closed when all its dependent result sets are closed. - * @return {@code true} if the {@code Statement} will be closed when all - * of its dependent result sets are closed; {@code false} otherwise - * @throws SQLException if this method is called on a closed - * {@code Statement} - * @since JDK 1.7 M11 2010/09/10 (b123), HSQLDB 2.0.1 - */ - public boolean isCloseOnCompletion() throws SQLException { - - checkClosed(); - - return false; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/JDBCUtil.java b/database/hsqldb/src/org/hsqldb/jdbc/JDBCUtil.java deleted file mode 100644 index 3bae80ff..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/JDBCUtil.java +++ /dev/null @@ -1,853 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc; - -import java.sql.SQLDataException; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.sql.SQLIntegrityConstraintViolationException; -import java.sql.SQLInvalidAuthorizationSpecException; -import java.sql.SQLNonTransientConnectionException; -import java.sql.SQLSyntaxErrorException; -import java.sql.SQLTransactionRollbackException; -import java.sql.SQLTransientConnectionException; -import java.sql.SQLWarning; - -import org.hsqldb.HsqlException; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.result.Result; - -/* $Id: JDBCUtil.java 6266 2021-01-25 16:08:06Z fredt $ */ - -// campbell-burnet@users - 20060523 - patch 1.9.0 - removed some unused imports -// Revision 1.16 2006/07/12 11:53:53 boucherb -// - merging back remaining material overwritten by Fred's type-system upgrades - -/** - * Provides driver constants and a gateway from internal HsqlExceptions to - * external SQLExceptions. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.7.2 - */ -public final class JDBCUtil { - - public static SQLException sqlException(HsqlException e) { - return sqlException(e.getMessage(), e.getSQLState(), e.getErrorCode(), - e); - } - - public static SQLException sqlException(HsqlException e, Throwable cause) { - return sqlException(e.getMessage(), e.getSQLState(), e.getErrorCode(), - cause); - } - - public static SQLException sqlException(int id) { - return sqlException(Error.error(id)); - } - - public static SQLException sqlExceptionSQL(int id) { - return sqlException(Error.error(id)); - } - - public static SQLException sqlException(int id, String message) { - return sqlException(Error.error(id, message)); - } - - public static SQLException sqlException(int id, String message, - Throwable cause) { - return sqlException(Error.error(id, message), cause); - } - - public static SQLException sqlException(int id, int add) { - return sqlException(Error.error(id, add)); - } - - static SQLException sqlException(int id, int subId, String[] add) { - return sqlException(Error.error(null, id, subId, add)); - } - - static SQLException notSupported() { - - HsqlException e = Error.error(ErrorCode.X_0A000); - - return new SQLFeatureNotSupportedException(e.getMessage(), - e.getSQLState(), -ErrorCode.X_0A000); - } - - static SQLException notUpdatableColumn() { - return sqlException(ErrorCode.X_0U000); - } - - public static SQLException nullArgument() { - return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT); - } - - static SQLException nullArgument(String name) { - return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, name + ": null"); - } - - public static SQLException invalidArgument() { - return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT); - } - - public static SQLException invalidArgument(String name) { - return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, name); - } - - public static SQLException invalidArgument(int id) { - String message = Error.getMessage(id); - return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, message); - } - - public static SQLException outOfRangeArgument() { - return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT); - } - - public static SQLException outOfRangeArgument(String name) { - return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, name); - } - - public static SQLException connectionClosedException() { - return sqlException(ErrorCode.X_08003); - } - - public static SQLWarning sqlWarning(Result r) { - return new SQLWarning(r.getMainString(), r.getSubString(), - r.getErrorCode()); - } - - public static SQLException sqlException(Throwable t) { - return new SQLException(t); - } - - public static SQLException sqlException(Result r) { - return sqlException(r.getMainString(), r.getSubString(), - r.getErrorCode(), r.getException()); - } - -// TODO: Needs review. -// -// Connection exception subclass may be an insufficient discriminator -// regarding the choice of throwing transient or non-transient -// connection exception. -// -// SQL 2003 Table 32 SQLSTATE class and subclass values -// -// connection exception 08 (no subclass) 000 -// -// SQL-client unable to establish 001 -// SQL-connection -// -// connection name in use 002 -// -// connection does not exist 003 -// -// SQL-server rejected establishment 004 -// of SQL-connection -// -// connection failure 006 -// -// transaction resolution unknown 007 -// org.hsqldb.Trace - sql-error-messages -// -// 080=08000 socket creation error - better 08001 ? -// 085=08000 Unexpected exception when setting up TLS -// -// 001=08001 The database is already in use by another process - better 08002 ? -// -// 002=08003 Connection is closed -// 003=08003 Connection is broken -// 004=08003 The database is shutdown -// 094=08003 Database does not exists - better 08001 ? -// - public static SQLException sqlException(String msg, String sqlstate, - int code, Throwable cause) { - - if (sqlstate.startsWith("08")) { - if (!sqlstate.endsWith("3")) { - - // then, e.g. - the database may spuriously cease to be "in use" - // upon retry - // - the network configuration, server availability - // may change spuriously - // - keystore location/content may change spuriously - return new SQLTransientConnectionException(msg, sqlstate, - code, cause); - } else { - - // the database is (permanently) shut down or the connection is - // (permanently) closed or broken - return new SQLNonTransientConnectionException(msg, sqlstate, - code, cause); - } - } else if (sqlstate.startsWith("22")) { - return new SQLDataException(msg, sqlstate, code, cause); - } else if (sqlstate.startsWith("23")) { - return new SQLIntegrityConstraintViolationException(msg, sqlstate, - code, cause); - } else if (sqlstate.startsWith("28")) { - return new SQLInvalidAuthorizationSpecException(msg, sqlstate, - code, cause); - } else if (sqlstate.startsWith("42") || sqlstate.startsWith("37") - || sqlstate.startsWith("2A")) { - - // TODO: - // - // First, the overview section of java.sql.SQLSyntaxErrorException - // - // "...thrown when the SQLState class value is '42'" - // - // appears to be inaccurate or not in sync with the - // SQL 2003 standard, 02 Foundation, Table 32, which states: - // - // Condition Class SubClass - // syntax error or access rule violation - 42 (no subclass) 000 - // - // SQL 2003 describes an Access Rule Violation as referring to - // the case where, in the course of preparing or executing - // an SQL statement, an Access Rule section pertaining - // to one of the elements of the statement is violated. - // - // Further, section 13.4 Calls to an - // lists: - // - // SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_NO_SUBCLASS: - // constant SQLSTATE_TYPE :="42000"; - // SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_IN_DIRECT_STATEMENT_NO_SUBCLASS: - // constant SQLSTATE_TYPE :="2A000"; - // SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_IN_DYNAMIC_STATEMENT_NO_SUBCLASS: - // constant SQLSTATE_TYPE :="37000"; - // - // Strangely, SQLSTATEs "37000" and 2A000" are not mentioned - // anywhere else in any of the SQL 2003 parts and are - // conspicuously missing from 02 - Foundation, Table 32. - // - // ----------------------------------- - /// - // Our only Access Violation SQLSTATE so far is: - // - // Error.NOT_AUTHORIZED 255=42000 User not authorized for action '$$' - // - // Our syntax exceptions are apparently all sqlstate "37000" - // - // Clearly, we should differentiate between DIRECT and DYNAMIC - // SQL forms. And clearly, our current "37000" is "wrong" in - // that we do not actually support dynamic SQL syntax, but - // rather implement similar behaviour only through JDBC - // Prepared and Callable statements. - return new SQLSyntaxErrorException(msg, sqlstate, code, cause); - } else if (sqlstate.startsWith("40")) { - - // TODO: our 40xxx exceptions are not currently used (correctly) - // for transaction rollback exceptions: - // - // 018=40001 Serialization failure - // - // - currently used to indicate Java object serialization - // failures, which is just plain wrong. - // - // 019=40001 Transfer corrupted - // - // - currently used to indicate IOExceptions related to - // PreparedStatement XXXStreamYYY operations and Result - // construction using RowInputBinary (e.g. when reading - // a result transmitted over the network), which is - // probably also just plain wrong. - // - // SQL 2003 02 - Foundation, Table 32 states: - // - // 40000 transaction rollback - no subclass - // 40001 transaction rollback - (transaction) serialization failure - // 40002 transaction rollback - integrity constraint violation - // 40003 transaction rollback - statement completion unknown - // 40004 transaction rollback - triggered action exception - // - return new SQLTransactionRollbackException(msg, sqlstate, code, - cause); - } else if (sqlstate.startsWith("0A")) { // JSR 221 2005-12-14 prd - return new SQLFeatureNotSupportedException(msg, sqlstate, code, - cause); - } else { - - // TODO resolved: - // - // JSR 221 2005-12-14 prd - // - // "Any SQLState class values which are currently not mapped to - // either a SQLNonTransientException or a SQLTransientException - // will result in a java.sql.SQLException being thrown." - // - return new SQLException(msg, sqlstate, code, cause); - } - } - -// ----------------------------------------------------------------------------- -// TODO: -// This is just reminder stuff to borrow from as error reporting is refined, -// better localized and made more standards-compliant. -// static SQLException blobDirectUpdateByLocatorNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException blobInFreedStateException() { -// return sqlException(ErrorCode.ASSERT_FAILED, "valid==true"); -// } -// -// static SQLException blobInputMaxOctetLengthExceededException(long length) { -// String msg = "Maximum Blob input octet length exceeded: " -// + length; //NOI18N -// -// return sqlException(ErrorCode.INPUTSTREAM_ERROR, msg); -// } -// -// static SQLException blobInputStreamTransferCorruptedException(Exception e) { -// // According to SQL 2003, error code 19 should not -// // have sqlstate 40001, which is supposed to indicate a -// // transaction rollback due to transaction serialization -// // failure -// return sqlException(ErrorCode.TRANSFER_CORRUPTED, String.valueOf(e)); -// } -// -// static SQLException callableStatementOutAndInOutParametersNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException callableStatementParameterIndexNotFoundException(int index) { -// //String msg = "Parameter index out of bounds: " + index; //NOI18N -// return sqlException(Error.error(ErrorCode.COLUMN_NOT_FOUND, Integer.toString(index))); -// } -// -// static SQLException callableStatementParameterNameNotFoundException(String parameterName) { -// return sqlException(Error.error(ErrorCode.COLUMN_NOT_FOUND, parameterName)); -// } -// -// static SQLException characterInputStreamIOException(Exception e) { -// return sqlException(Error.INPUTSTREAM_ERROR, String.valueOf(e)); -// } -// -// static SQLException characterInputStreamTransferCorruptedException(Exception e) { -// // According to SQL 2003, error code 19 should not -// // have sqlstate 40001, which is supposed to indicate a -// // transaction rollback due to transaction serialization -// // failure -// return sqlException(ErrorCode.TRANSFER_CORRUPTED, String.valueOf(e)); -// } -// -// static SQLException characterOutputStreamIOException(Exception e) { -// return sqlException(ErrorCode.GENERAL_IO_ERROR, String.valueOf(e)); -// } -// -// static SQLException characterSequenceIndexArgumentOutOfBoundsException(String name, long value) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, name + ": " + value); -// } -// -// static SQLException clientInfoNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED, "ClientInfo"); -// } -// -// static SQLException clobDirectUpdateByLocatorNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException clobInFreedStateException() { -// return sqlException(ErrorCode.ASSERT_FAILED, "valid==true"); -// } -// -// static SQLException clobInputMaxCharacterLengthExceededException(long length) { -// String msg = "Max Clob input character length exceeded: " -// + length; //NOI18N -// -// return sqlException(ErrorCode.INPUTSTREAM_ERROR, msg); -// } -// -// static SQLException clobInputStreamTransferCorruptedException(Exception e) { -// // According to SQL 2003, error code 19 should not -// // have sqlstate 40001, which is supposed to indicate a -// // transaction rollback due to transaction serialization -// // failure -// return sqlException(ErrorCode.TRANSFER_CORRUPTED, String.valueOf(e)); -// } -// -//// public static SQLException connectionClosedException() { -//// return sqlException(ErrorCode.CONNECTION_IS_CLOSED); -//// } -// -// -// static SQLException connectionNativeSQLException(String sql, int index) { -// boolean substitute = true; -// String msg = Error.getMessage(ErrorCode.JDBC_CONNECTION_NATIVE_SQL, -// substitute, new Object[]{ -// sql.substring(index)}); -// -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, msg); -// } -// -// static SQLException connectionResetFailureException(Exception e) { -// return sqlException(ErrorCode.GENERAL_ERROR, "Error resetting connection: " -// + e.getMessage()); -// } -// -// static SQLException deserializeToJavaObjectException(HsqlException e) { -// // TODO: This is wrong. -// // According to SQL 2003, error code 18, -// // sqlstate 40001 is supposed to indicate a -// // transaction rollback due to -// // transaction serialization failure -// return sqlException(e); -// } -// -// public static SQLException driverConnectMalformedURLException(String url) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "url: " + url); -// } -// -// public static SQLException driverConnectTimeoutException(long timeout) { -// return sqlException(ErrorCode.GENERAL_ERROR, -// "Connect operation timed out after " + timeout + " ms."); -// } -// -// -// static SQLException illegalBestRowIdentifierScopeArgumentException(int scope) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, -// Error.JDBC_ILLEGAL_BRI_SCOPE, -// new Object[] {Integer.toString(scope)}); -// } -// -// static SQLException illegalConnectionSubProtocolException(String protocol) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "protocol: " + protocol); -// } -// -// static SQLException illegalHexadecimalCharacterSequenceArgumentException(String name, Exception e) { -// return sqlException(ErrorCode.INVALID_CONVERSION, name + ": " + e); -// } -// -// static SQLException illegalNegativeIntegralArgumentException(String name, long value) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, name + ": " + value); -// } -// -// static SQLException illegalNullArgumentException(String name) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, name + ": null"); -// } -// -// static SQLException illegalResultSetConcurrencyArgumentException(int concurrency) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "concurrency: " + concurrency); -// } -// -// static SQLException illegalResultSetFetchDirectionArgumentException(int direction) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "direction: " + direction); -// } -// -// static SQLException illegalResultSetHoldabilityArgumentException(int holdability) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "holdability: " + holdability); -// } -// -// static SQLException illegalResultSetTypeArgumentException(int type) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "type: " + type); -// } -// -// static SQLException illegalTableTypeArgumentException(int index, String type) { -// String msg = "types[" + index + "]=>\"" + type + "\""; -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, msg); -// } -// -// static SQLException illegalTransactionIsolationLevelArgumentException(int level) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "level: " + level); -// } -// -// static SQLException illegalUnicodeStreamLengthArgumentException(int length) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, -// "Odd length argument for pre-JDBC4 UTF16 encoded stream: " -// + length); //NOI18N -// } -// -// static SQLException invalidDateTimeEscapeException(Exception e) { -// return sqlException(ErrorCode.INVALID_ESCAPE, e.getMessage()); -// } -// -// static SQLException invalidNullInputStreamArgumentException() { -// return sqlException(ErrorCode.error(ErrorCode.JDBC_INVALID_ARGUMENT, -// Error.JDBC_NULL_STREAM)); -// } -// -// static SQLException octetInputStreamInvalidCharacterEncodingException(Exception e) { -// return sqlException(ErrorCode.INVALID_CHARACTER_ENCODING, String.valueOf(e)); -// } -// -// static SQLException octetInputStreamTransferCorruptedException(Exception e) { -// // According to SQL 2003, error code 19 should not -// // have sqlstate 40001, which is supposed to indicate a -// // transaction rollback due to transaction serialization -// // failure -// return sqlException(ErrorCode.TRANSFER_CORRUPTED, String.valueOf(e)); -// } -// -// static SQLException octetSequenceIndexArgumentOutOfBoundsException(String name, long value) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, name + ": " + value); -// } -// -// static SQLException parameterMetaDataParameterIndexNotFoundException(int index) { -// // String msg = param + " is out of range"; //NOI18N -// return sqlException(ErrorCode.COLUMN_NOT_FOUND, Integer.toString(index)); -// } -// -// static SQLException preparedStatementFeatureNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException preparedStatementInitializationException(Exception e) { -// return sqlException(ErrorCode.GENERAL_ERROR, e.toString()); -// } -// -// static SQLException preparedStatementParameterIndexNotFoundException(int parameterIndex) { -// return sqlException(ErrorCode.COLUMN_NOT_FOUND, -// Integer.toString(parameterIndex)); -// } -// -// static SQLException resultSetClosedException() { -// return sqlException(ErrorCode.JDBC_RESULTSET_IS_CLOSED); -// } -// -// static SQLException resultSetColumnIndexNotFoundException(int columnIndex) { -// return sqlException(ErrorCode.COLUMN_NOT_FOUND, -// Integer.toString(columnIndex)); -// } -// -// static SQLException resultSetColumnNameNotFoundException(String columnName) { -// return sqlException(Error.error(ErrorCode.COLUMN_NOT_FOUND, columnName)); -// } -// -// static SQLWarning resultSetConcurrencyTranslationWarning(int requestedConcurrency, -// int translatedConcurrency) { -// String requested = toResultSetConcurrencyString(requestedConcurrency); -// String translated = toResultSetConcurrencyString(translatedConcurrency); -// String msg = requested + " => " + translated; -// -// return new SQLWarning(msg, "SOO10", Error.JDBC_INVALID_ARGUMENT); -// } -// -// static SQLException resultSetCursorNameNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException resultSetDataIsNotAvailableException() { -// return sqlException(ErrorCode.NO_DATA_IS_AVAILABLE); -// } -// -// static SQLException resultSetFetchDirectionValueNotSupportedException(int direction) { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED, -// toResultSetFetchDirectionString(direction)); -// } -// -// static SQLWarning resultSetHoldabilityTranslationWarning(int requestedHoldability, int translatedHoldability) { -// String requested = toResultSetHoldabilityString(requestedHoldability); -// String translated = toResultSetHoldabilityString(translatedHoldability); -// String msg = requested + " => " + translated; -// -// return new SQLWarning(msg, "SOO10", Error.JDBC_INVALID_ARGUMENT); -// } -// -// -// static SQLException resultSetHoldabilityValueNotSupportedException(int holdability) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, toResultSetHoldabilityString(holdability)); -// } -// -// static SQLException resultSetIsForwardOnlyException() { -// return sqlException(ErrorCode.RESULTSET_FORWARD_ONLY); -// } -// -// static SQLException resultSetMetaDataColumnIndexNotFoundException(int columnIndex) { -// return Util.sqlException(ErrorCode.COLUMN_NOT_FOUND, -// Integer.toString(columnIndex)); -// } -// -// static SQLException resultSetMetaDataInitializationNullResultArgumentException() { -// return sqlException(ErrorCode.GENERAL_ERROR, -// Error.JDBC_NO_RESULT_SET, null); -// } -// -// static SQLException resultSetMetaDataInitializationNullResultSetArgumentException() { -// return sqlException(ErrorCode.GENERAL_ERROR, -// Error.JDBC_NO_RESULT_SET_METADATA, null); -// } -// -// static SQLException resultSetNotRefreshableException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException resultSetNotUpdateableException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLWarning resultSetTypeTranslationWarning(int requestedType, int translatedType) { -// String requested = toResultSetTypeString(requestedType); -// String translated = toResultSetTypeString(translatedType); -// String msg = requested + " => " + translated; -// -// return new SQLWarning(msg, "SOO10", Error.JDBC_INVALID_ARGUMENT); -// } -// -// -// static SQLException resultSetWasNotGeneratedByStatementExecutionException() { -// String msg = "Expected but did not receive a result set"; // NOI18N -// -// return sqlException(ErrorCode.UNEXPECTED_EXCEPTION, msg); -// } -// -// static SQLException resultSetWillNotBeGeneratedByExecuteQueryException() { -// return sqlException(ErrorCode.JDBC_STATEMENT_NOT_RESULTSET); -// } -// -// static SQLException retrieveAutoGeneratedKeysFeatureNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException savepointIssuedOnDifferentConnectionException() { -// return sqlException(ErrorCode.ASSERT_FAILED, "savepoint.connection==this"); -// } -// -// static SQLException savepointNumericIdentifierNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException savepointRollbackInAutocommitException() { -// return sqlException(ErrorCode.ASSERT_FAILED, "autocommit==false"); -// } -// -// static SQLException savepointWrongObjectClassException(Class clazz) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, "savepoint: " + clazz); -// } -// -// static SQLException sqlxmlDirectUpdateByLocatorNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException sqlxmlInFreedStateException() { -// return sqlException(ErrorCode.ASSERT_FAILED, "valid==true"); -// } -// -// static SQLException sqlxmlParseException(Exception e) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, e.toString()); -// } -// -// static SQLException sqlxmlParserInitializationException(Exception e) { -// return sqlException(ErrorCode.GENERAL_ERROR, e.toString()); -// } -// -// static SQLException statementClosedException() { -// return sqlException(ErrorCode.STATEMENT_IS_CLOSED); -// } -// -// static SQLException statementGetMoreResultsWithCurrentResultSetHandlingNotSupportedException() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static int toObjectDataType(Object o) { -// if (o == null) { -// return Types.NULL; -// } -// -// if (o instanceof Binary) { -// return Types.BINARY; -// } else if (o instanceof JavaObject) { -// return Types.OTHER; -// } -// -// try { -// return org.hsqldb.Types.getTypeNr(o.getClass().getName()); -// } catch (Exception e) { -// return o instanceof Serializable ? Types.OTHER : Types.JAVA_OBJECT; -// } -// } -// -// static String toResultSetConcurrencyString(int type) { -// switch(type) { -// case JDBCResultSet.CONCUR_READ_ONLY: -// { -// return "CONCUR_READ_ONLY"; -// } -// JDBCResultSet.CONCUR_UPDATABLE: -// { -// return "CONCUR_UPDATABLE"; -// } -// default: -// { -// return "CONCUR_UNKNOWN: " + type; -// } -// } -// } -// -// static String toResultSetFetchDirectionString(int direction) { -// switch(direction) { -// case JDBCResultSet.FETCH_FORWARD: -// { -// return "FETCH_FORWARD"; -// } -// case JDBCResultSet.FETCH_REVERSE: -// { -// return "FETCH_REVERSE"; -// } -// case JDBCResultSet.FETCH_UNKNOWN: -// { -// return "FETCH_UNKNOWN"; -// } -// default: -// { -// return "direction: " + direction; -// } -// } -// } -// -// static String toResultSetHoldabilityString(int type) { -// switch(type) { -// case JDBCResultSet.CLOSE_CURSORS_AT_COMMIT: -// { -// return "CLOSE_CURSORS_AT_COMMIT"; -// } -// case JDBCResultSet.HOLD_CURSORS_OVER_COMMIT: -// { -// return "HOLD_CURSORS_OVER_COMMIT"; -// } -// default: -// { -// return "HOLDABILITY_UNKNOWN: " + type; -// } -// } -// } -// -// -// static String toResultSetTypeString(int type) { -// switch(type) { -// case JDBCResultSet.TYPE_FORWARD_ONLY: -// { -// return "TYPE_FORWARD_ONLY"; -// } -// case JDBCResultSet.TYPE_SCROLL_INSENSITIVE: -// { -// return "TYPE_SCROLL_INSENSITIVE"; -// } -// case JDBCResultSet.TYPE_SCROLL_SENSITIVE: -// { -// return "TYPE_SCROLL_SENSITIVE"; -// } -// default: -// { -// return "TYPE_UNKNOWN: " + type; -// } -// } -// } -// -// static SQLException unsupportedDataType_ARRAY_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// -// static SQLException unsupportedDataType_DATALINK_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException unsupportedDataType_DISTINCT_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException unsupportedDataType_REF_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException unsupportedDataType_ROWID_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException unsupportedDataType_SQLXML_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException unsupportedDataType_STRUCT_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// static SQLException unsupportedDataTypes_STRUCT_AND_DISTINCT_Exception() { -// return sqlException(ErrorCode.FUNCTION_NOT_SUPPORTED); -// } -// -// -// static SQLException unsupportedParameterValueConversionException(Object srcVal, int dstType) { -// return unsupportedParameterValueConversionException(toObjectDataType(srcVal), -// srcVal, -// dstType); -// } -// -// static SQLException unsupportedParameterValueConversionException(int srcType, Object srcVal, int dstType) { -// String msg = Types.getTypeString(srcType) -// + " => " -// + Types.getTypeString(dstType) -// + " : " -// + srcVal; -// -// return sqlException(ErrorCode.INVALID_CONVERSION, msg); -// } -// -// static SQLException unsupportedResultSetValueConversionException(int srcType, Object srcVal, int dstType) { -// String msg = Types.getTypeString(srcType) -// + " => " -// + Types.getTypeString(dstType) -// + " : " -// + srcVal; -// -// return sqlException(ErrorCode.INVALID_CONVERSION, msg); -// } -// -// static SQLException updateCountResultInResultSetInitializationException() { -// return sqlException(ErrorCode.ASSERT_FAILED, "result.mode != UPDATECOUNT"); -// } -// -// static SQLException updateCountWasNotGeneratedByPreparedStatementExecutionException() { -// String msg = "Expected but did not receive a row update count"; //NOI18N -// -// return sqlException(ErrorCode.UNEXPECTED_EXCEPTION, msg); -// } -// -// static SQLException updateCountWasNotGeneratedByStatementExecutionException() { -// return sqlException(ErrorCode.ASSERT_FAILED, -// Error.getMessage(ErrorCode.JDBC_STATEMENT_EXECUTE_UPDATE)); -// } -// -// static SQLException updateCountWillNotBeGeneratedByExecuteUpdateException() { -// return sqlException(ErrorCode.JDBC_STATEMENT_NOT_ROW_COUNT); -// } -// -// public static SQLException wrappedObjectNotFoundException(Class clazz) { -// return sqlException(ErrorCode.JDBC_INVALID_ARGUMENT, String.valueOf(clazz)); -// } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/package-info.java b/database/hsqldb/src/org/hsqldb/jdbc/package-info.java deleted file mode 100644 index 7549e6e9..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/package-info.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains the HyperSQL JDBC Driver, and other classes providing JDBC - * functionality and support. - */ -package org.hsqldb.jdbc; diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCPooledConnection.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCPooledConnection.java deleted file mode 100644 index be949db9..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCPooledConnection.java +++ /dev/null @@ -1,204 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc.pool; - -import java.sql.Connection; -import java.sql.SQLException; - -import javax.sql.ConnectionEvent; -import javax.sql.ConnectionEventListener; -import javax.sql.PooledConnection; -import javax.sql.StatementEventListener; - -import org.hsqldb.jdbc.JDBCConnection; -import org.hsqldb.jdbc.JDBCConnectionEventListener; -import org.hsqldb.lib.OrderedHashSet; - -/** - * An implementations of {@link javax.sql.PooledConnection PooledConnection} - * for use by connection pooling software.

    - * The class maintains a lifetime connection to the database. The - * getConnection() method establishes a lease on the lifetime connection - * and returns a special JDBCConnection (userConnection) that is - * valid until it is closed.

    - * - * This class uses a dedicated HyperSQL method to guarantee each lease on the - * connection starts with the original state of the connection.

    - * - * The ConnectionEventLister objects that have been registered with this - * PooledConnection are notified when each lease expires, or an unrecoverable - * error occurs on the connection to the database.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.0.1 - * @since JDK 1.2, HSQLDB 2.0 - */ -public class JDBCPooledConnection -implements PooledConnection, JDBCConnectionEventListener { - - synchronized public Connection getConnection() throws SQLException { - - if (isInUse) { - throw new SQLException("Connection in use"); - } - - isInUse = true; - userConnection = new JDBCConnection(connection, this); - - return userConnection; - } - - public void close() throws SQLException { - - if (connection != null) { - connection.closeFully(); - - this.connection = null; - } - } - - public void addConnectionEventListener(ConnectionEventListener listener) { - listeners.add(listener); - } - - public void removeConnectionEventListener( - ConnectionEventListener listener) { - listeners.remove(listener); - } - - public void addStatementEventListener(StatementEventListener listener) {} - - public void removeStatementEventListener( - StatementEventListener listener) {} - - // ------------------------ internal implementation ------------------------ - synchronized public void connectionClosed() { - - ConnectionEvent event = new ConnectionEvent(this); - - userConnection = null; - - reset(); - - for (int i = 0; i < listeners.size(); i++) { - ConnectionEventListener connectionEventListener = - (ConnectionEventListener) listeners.get(i); - - connectionEventListener.connectionClosed(event); - } - } - - synchronized public void connectionErrorOccurred(SQLException e) { - - ConnectionEvent event = new ConnectionEvent(this, e); - - reset(); - - for (int i = 0; i < listeners.size(); i++) { - ConnectionEventListener connectionEventListener = - (ConnectionEventListener) listeners.get(i); - - connectionEventListener.connectionErrorOccurred(event); - } - } - - /** - * Returns true if getConnection() has been called and a leas has been - * given. - * - * @return boolean - */ - synchronized public boolean isInUse() { - return isInUse; - } - - /** - * Force close the userConnection, no close event is fired. - */ - synchronized public void reset() { - - if (userConnection != null) { - - // userConnection is already closed in normal use - try { - userConnection.close(); - } catch (SQLException e) { - - // check connection problems - } - } - - try { - connection.reset(); - } catch (SQLException e) { - - // check connection problems - } - - isInUse = false; - } - - /** - * Force close the userConnection, and connection, no close event is fired. - */ - synchronized public void release() { - - if (userConnection != null) { - - // userConnection is already closed in normal use - try { - userConnection.close(); - } catch (SQLException e) { - - // check connection problems - } - } - - try { - connection.close(); - } catch (SQLException e) { - - // check connection problems - } - - isInUse = false; - } - - protected OrderedHashSet listeners = new OrderedHashSet(); - protected JDBCConnection connection; - protected JDBCConnection userConnection; - protected boolean isInUse; - - public JDBCPooledConnection(JDBCConnection connection) { - this.connection = connection; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCPooledDataSource.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCPooledDataSource.java deleted file mode 100644 index e214ec0a..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCPooledDataSource.java +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc.pool; - -import java.io.Serializable; -import java.sql.SQLException; -import java.util.Properties; - -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; -import javax.sql.CommonDataSource; -import javax.sql.ConnectionPoolDataSource; -import javax.sql.PooledConnection; - -import org.hsqldb.jdbc.JDBCCommonDataSource; -import org.hsqldb.jdbc.JDBCConnection; -import org.hsqldb.jdbc.JDBCDriver; - -/** - * A data source that implements {@link javax.sql.ConnectionPoolDataSource}.

    - * For use by connection pooling software, not by end users. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.2.9 - * @since JDK 1.2, HSQLDB 2.0 - */ -public class JDBCPooledDataSource extends JDBCCommonDataSource -implements ConnectionPoolDataSource, Serializable, Referenceable, - CommonDataSource { - - public PooledConnection getPooledConnection() throws SQLException { - - JDBCConnection connection = - (JDBCConnection) JDBCDriver.getConnection(url, connectionProps); - - return new JDBCPooledConnection(connection); - } - - public PooledConnection getPooledConnection(String user, - String password) throws SQLException { - - Properties props = new Properties(); - - props.setProperty("user", user); - props.setProperty("password", password); - - JDBCConnection connection = - (JDBCConnection) JDBCDriver.getConnection(url, props); - - return new JDBCPooledConnection(connection); - } - - /** - * Retrieves the Reference of this object. - * - * @return The non-null javax.naming.Reference of this object. - * @exception NamingException If a naming exception was encountered - * while retrieving the reference. - */ - public Reference getReference() throws NamingException { - - String cname = "org.hsqldb.jdbc.JDBCDataSourceFactory"; - Reference ref = new Reference(getClass().getName(), cname, null); - - ref.add(new StringRefAddr("database", getDatabase())); - ref.add(new StringRefAddr("user", getUser())); - ref.add(new StringRefAddr("password", password)); - ref.add(new StringRefAddr("loginTimeout", - Integer.toString(loginTimeout))); - - return ref; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAConnection.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAConnection.java deleted file mode 100644 index 0ca6147b..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAConnection.java +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc.pool; -import java.sql.Connection; -import java.sql.SQLException; -import javax.sql.XAConnection; -import javax.transaction.xa.XAResource; - -import org.hsqldb.jdbc.JDBCConnection; - -// @(#)$Id: JDBCXAConnection.java 6266 2021-01-25 16:08:06Z fredt $ - -/** - * Subclass of JDBCPooledConnection implements the XAConnection interface. - * For use by global transaction service managers.

    - * - * Each instance has an JDBCXAResource inherits the superclass's two - * JDBCConnection objects, one for internal access, and one for user access.

    - * - * The getConnection() method returns a user connection and links this with - * the JDBCXAResource. This puts the object in the inUse state. - * When the user connection is closed, the object is put in the free state. - * - * @version 2.2.9 - * @since HSQLDB 2.0 - * @author Fred Toussi (fredt at users.sourceforge.net) - * @see javax.sql.XAConnection - */ -public class JDBCXAConnection extends JDBCPooledConnection implements XAConnection { - - JDBCXAResource xaResource; - - public JDBCXAConnection(JDBCXADataSource dataSource, JDBCConnection connection) { - - super(connection); - xaResource = new JDBCXAResource(dataSource, connection); - } - - public XAResource getXAResource() throws SQLException { - return xaResource; - } - - /** - * Returns a connection that can be used by the user application. - * - * @throws SQLException if a lease has already been given on this connection - * @return Connection - */ - synchronized public Connection getConnection() throws SQLException { - - if (isInUse) { - throw new SQLException("Connection in use"); - } - - isInUse = true; - - if (connection == null) { - throw new SQLException("Connection in closed"); - } - - return new JDBCXAConnectionWrapper(xaResource, this, connection); - } - - public void close() throws SQLException { - super.close(); - - // deal with xaResource - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAConnectionWrapper.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAConnectionWrapper.java deleted file mode 100644 index 5e796546..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAConnectionWrapper.java +++ /dev/null @@ -1,202 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc.pool; - -import org.hsqldb.jdbc.JDBCConnection; - -import java.sql.SQLException; -import java.sql.Savepoint; - -// @(#)$Id: JDBCXAConnectionWrapper.java 6266 2021-01-25 16:08:06Z fredt $ - -/** - * This is a wrapper class for JDBCConnection objects (not java.sql.XAConnection - * objects). - * Purpose of this class is to intercept and handle XA-related operations - * according to chapter 12 of the JDBC 3.0 specification, by returning this - * wrapped JDBCConnection to end-users. - * Global transaction services and XAResources will not use this wrapper. - *

    - * The new implementation extends JDBCConnection. A new object is created - * based on the session / session proxy of the JDBCXAConnection object in the - * constructor. (fredt)

    - * - * @version 2.2.9 - * @since 2.0.0 - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @see org.hsqldb.jdbc.JDBCConnection - */ -public class JDBCXAConnectionWrapper extends JDBCConnection { - - /* - * A critical question: One responsibility of this - * class is to intercept invocations of commit(), rollback(), - * savePoint methods, etc. But, what about if user issues the - * corresponding SQL commands? What is the point to intercepting - * Connection.commit() here if end-users can execute the SQL command - * "COMMIT" and bypass interception? - * Similarly, what about DDL commands that cause an explicit commit? - * - blaine - * If we want, we can stop various statement categories from running - * during an XA transaction. May do so in the future - fredt - */ - - /** - * Interceptor method, because this method is prohibited within - * any global transaction. - * See section 1.2.4 of the JDBC 3.0 spec. - * - * @param autoCommit mode - * @throws SQLException on error - */ - public void setAutoCommit(boolean autoCommit) throws SQLException { - validateNotWithinTransaction(); - super.setAutoCommit(autoCommit); - } - - /** - * Interceptor method, because this method is prohibited within - * any global transaction. - * See section 1.2.4 of the JDBC 3.0 spec. - * - * @throws SQLException on error - */ - public void commit() throws SQLException { - validateNotWithinTransaction(); - super.commit(); - } - - /** - * Interceptor method, because this method is prohibited within - * any global transaction. - * See section 1.2.4 of the JDBC 3.0 spec. - * - * @throws SQLException on error - */ - public void rollback() throws SQLException { - validateNotWithinTransaction(); - super.rollback(); - } - - /** - * Interceptor method, because this method is prohibited within - * any global transaction. - * See section 1.2.4 of the JDBC 3.0 spec. - * - * @throws SQLException on error - */ - public void rollback(Savepoint savepoint) throws SQLException { - validateNotWithinTransaction(); - super.rollback(savepoint); - } - - /** - * Interceptor method, because this method is prohibited within - * any global transaction. - * See section 1.2.4 of the JDBC 3.0 spec. - * - * @throws SQLException on error - */ - public Savepoint setSavepoint() throws SQLException { - - validateNotWithinTransaction(); - - return super.setSavepoint(); - } - - /** - * Interceptor method, because this method is prohibited within - * any global transaction. - * See section 1.2.4 of the JDBC 3.0 spec. - */ - public Savepoint setSavepoint(String name) throws SQLException { - - validateNotWithinTransaction(); - - return super.setSavepoint(name); - } - - /** - * Interceptor method, because there may be XA implications to - * calling the method within a global transaction. - * See section 1.2.4 of the JDBC 3.0 spec.

    - * - * HSQLDB does not allow changing the isolation level inside a transaction - * of any kind.

    - * - * @param level isolation level - */ - public void setTransactionIsolation(int level) throws SQLException { - validateNotWithinTransaction(); - super.setTransactionIsolation(level); - } - - //---------------------- NON-INTERFACE METHODS ----------------------------- - private JDBCXAResource xaResource; - - public JDBCXAConnectionWrapper(JDBCXAResource xaResource, - JDBCXAConnection xaConnection, - JDBCConnection databaseConnection) - throws SQLException { - // todo: Review JDBCXADataSource and this class. - // Under current implementation, because we do not pass a - // JDBCXAConnection instance to the constructor to pick - // up the connectionClosed event listener callback, calling - // close() on this wrapper connection does not reset the - // physical connection or set the inUse flag to false until - // the vending JDBCXAConnection itself is closed, which marks - // the end of its useful life. - // - // In other words, due to this current implementation detail, - // JDBCXADataSource cannot cooperate with a pooling implementation - // to reuse physical connections. - // fixed - the event listener works - super(databaseConnection, xaConnection); - - xaResource.setConnection(this); - - this.xaResource = xaResource; - } - - /** - * Throws a SQLException if within a Global transaction. - * - * @throws SQLException if within a Global transaction. - */ - private void validateNotWithinTransaction() throws SQLException { - - if (xaResource.withinGlobalTransaction()) { - throw new SQLException( - "Method prohibited within a global transaction"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXADataSource.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXADataSource.java deleted file mode 100644 index cc841ff8..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXADataSource.java +++ /dev/null @@ -1,232 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc.pool; - -import java.io.Serializable; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.Referenceable; -import javax.naming.StringRefAddr; -import javax.sql.CommonDataSource; -import javax.sql.XAConnection; -import javax.sql.XADataSource; -import javax.transaction.xa.Xid; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.jdbc.JDBCCommonDataSource; -import org.hsqldb.jdbc.JDBCConnection; -import org.hsqldb.jdbc.JDBCDriver; -import org.hsqldb.jdbc.JDBCUtil; - -// @(#)$Id: JDBCXADataSource.java 6266 2021-01-25 16:08:06Z fredt $ - -/** - * Connection factory for JDBCXAConnections. - * For use by XA data source factories, not by end users.

    - * - * The {@link org.hsqldb.jdbc.JDBCDataSourceFactory} can be used to get - * instances of this class.

    - * - * The methods of the superclass, {@link org.hsqldb.jdbc.JDBCCommonDataSource}, - * are used for settings the HyperSQL server and user.

    - * - * @version 2.3.3 - * @since 2.0.0 - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @see javax.sql.XADataSource - * @see org.hsqldb.jdbc.pool.JDBCXAConnection - */ -public class JDBCXADataSource extends JDBCCommonDataSource -implements XADataSource, Serializable, Referenceable, CommonDataSource { - - /** - * Get new XAConnection connection, to be managed by a connection manager. - * - * @throws SQLException on error - */ - public XAConnection getXAConnection() throws SQLException { - - // Comment out before public release: -/* - System.err.print("Executing " + getClass().getName() - + ".getXAConnection()..."); -*/ - - // Use JDBCDriver directly so there is no need to register with DriverManager - JDBCConnection connection = - (JDBCConnection) JDBCDriver.getConnection(url, connectionProps); - JDBCXAConnection xaConnection = new JDBCXAConnection(this, connection); - - return xaConnection; - } - - /** - * Gets a new XAConnection after validating the given username - * and password. - * - * @see #getXAConnection() - * - * @param user String which must match the 'user' configured for this - * JDBCXADataSource. - * @param password String which must match the 'password' configured - * for this JDBCXADataSource. - * @throws SQLException on error - */ - public XAConnection getXAConnection(String user, - String password) throws SQLException { - - if (user == null || password == null) { - throw JDBCUtil.nullArgument(); - } - - if (user.equals(this.user) && password.equals(this.password)) { - return getXAConnection(); - } - - throw JDBCUtil.sqlException(Error.error(ErrorCode.X_28000)); - } - - /** - * Retrieves the Reference of this object. - * - * @return The non-null javax.naming.Reference of this object. - * @exception NamingException If a naming exception was encountered - * while retrieving the reference. - */ - public Reference getReference() throws NamingException { - - String cname = "org.hsqldb.jdbc.JDBCDataSourceFactory"; - Reference ref = new Reference(getClass().getName(), cname, null); - - ref.add(new StringRefAddr("database", getDatabase())); - ref.add(new StringRefAddr("user", getUser())); - ref.add(new StringRefAddr("password", password)); - ref.add(new StringRefAddr("loginTimeout", - Integer.toString(loginTimeout))); - - return ref; - } - - // ------------------------ internal implementation ------------------------ - private HashMap resources = new HashMap(); - private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); - - public void addResource(Xid xid, JDBCXAResource xaResource) { - - lock.writeLock().lock(); - - try { - resources.put(xid, xaResource); - } finally { - lock.writeLock().unlock(); - } - } - - public JDBCXADataSource() throws SQLException { - - // - } - - public JDBCXAResource removeResource(Xid xid) { - - lock.writeLock().lock(); - - try { - return (JDBCXAResource) resources.remove(xid); - } finally { - lock.writeLock().unlock(); - } - } - - /** - * Return the list of transactions currently in prepared or - * heuristically completed states. - * Need to find out what non-prepared states they are considering - * heuristically completed. - * - * @see javax.transaction.xa.XAResource#recover(int) - */ - Xid[] getPreparedXids() { - - lock.writeLock().lock(); - - try { - Iterator it = resources.keySet().iterator(); - Xid curXid; - HashSet preparedSet = new HashSet(); - - while (it.hasNext()) { - curXid = (Xid) it.next(); - - if (((JDBCXAResource) resources.get(curXid)).state - == JDBCXAResource.XA_STATE_PREPARED) { - preparedSet.add(curXid); - } - } - - Xid[] array = new Xid[preparedSet.size()]; - - preparedSet.toArray(array); - - return array; - } finally { - lock.writeLock().unlock(); - } - } - - /** - * This is needed so that XAResource.commit() and - * XAResource.rollback() may be applied to the right Connection - * (which is not necessarily that associated with that XAResource - * object). - * - * @see javax.transaction.xa.XAResource#commit(Xid, boolean) - * @see javax.transaction.xa.XAResource#rollback(Xid) - */ - JDBCXAResource getResource(Xid xid) { - - lock.readLock().lock(); - - try { - return (JDBCXAResource) resources.get(xid); - } finally { - lock.readLock().unlock(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAResource.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAResource.java deleted file mode 100644 index 895f6434..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXAResource.java +++ /dev/null @@ -1,480 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc.pool; - -import javax.transaction.xa.XAResource; -import javax.transaction.xa.XAException; -import javax.transaction.xa.Xid; - -// These require a global transaction API: -//import javax.transaction.HeuristicMixedException; -//import javax.transaction.HeuristicCommitException; -//import javax.transaction.HeuristicRollbackException; -import org.hsqldb.jdbc.JDBCConnection; - -import java.sql.SQLException; - -import org.hsqldb.HsqlException; - -// @(#)$Id: JDBCXAResource.java 6266 2021-01-25 16:08:06Z fredt $ - -/** - * Used by a global transaction service to control HSQLDB transactions. - * Not for use by end-users. - * End manage global transactions using transaction APIs such as JTA. - *

    - * According to section 12.3 of the JDBC 3.0 spec, there is a - * 1:1 correspondence between XAConnection and XAResource, and - * A given XAConnection object may be associated with at most one - * transaction at a time. - * Therefore, there may be at any time at most one transaction - * managed by a XAResource object. - * One implication is, the XAResource can track the current transaction - * state with a scalar. - * Another implication is, the Xids for most of the XAResource interface - * methods just introduce unnecessary complexity and an unnecessary point - * of failure-- there can be only one transaction for this object, so - * why track another identifier for it. - * My strategy is to just "validate" that the Xid does not change - * within a transaction. - * Exceptions to this are the commit and rollback methods, which the - * JDBC spec says can operate against any XAResource instance from - * the same XADataSource. - * N.b. The JDBC Spec does not state whether the prepare and forget - * methods are XAResource-specific or XADataSource-specific. - * - * @version 2.3.3 - * @since 2.0.0 - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @see javax.transaction.xa.XAResource - */ -public class JDBCXAResource implements XAResource { - - /* - * @todo: - * Make thread safe. - * Figure out how to ensure that orphaned transactions to do not make - * a memory leak in JDBCXADataSource.resources. I.e., - * JDBCXADataSource.removeResource() must be called even for all - * transactions, even aborted ones. Maybe tx managers are - * already obligated to call one of commit/forget/rollback for - * even transactions for which they have called start???... TEST THIS. - * (They may only need to commit/forget/rollback if prepare has been - * called?). - * The answer may be to implement Timeouts. - */ - private JDBCConnection connection; - private boolean originalAutoCommitMode; - static int XA_STATE_INITIAL = 0; - static int XA_STATE_STARTED = 1; - static int XA_STATE_ENDED = 2; - static int XA_STATE_PREPARED = 3; - static int XA_STATE_DISPOSED = 4; - int state = XA_STATE_INITIAL; - private JDBCXADataSource xaDataSource; - Xid xid = null; - - public boolean withinGlobalTransaction() { - return state == XA_STATE_STARTED; - } - - /** - * - * @throws XAException if the given Xid is the not the Xid of the current - * transaction for this XAResource object. - * @param xid Xid - */ - private void validateXid(Xid xid) throws XAException { - - if (xid == null) { - throw new XAException("Null Xid"); - } - - if (this.xid == null) { - throw new XAException( - "There is no live transaction for this XAResource"); - } - - if (!xid.equals(this.xid)) { - throw new XAException( - "Given Xid is not that associated with this XAResource object"); - } - } - - /** - * Constructs a resource using the given data source and connection. - * - * @param xaDataSource JDBCXADataSource - * @param connection A non-wrapped JDBCConnection which we need in order to - * do real (non-wrapped) commits, rollbacks, etc. This is not for the end - * user. We need the real thing. - */ - public JDBCXAResource(JDBCXADataSource xaDataSource, - JDBCConnection connection) { - this.connection = connection; - this.xaDataSource = xaDataSource; - } - - JDBCXADataSource getXADataSource() { - return xaDataSource; - } - - /** - * Per the JDBC 3.0 spec, this commits the transaction for the specified - * Xid, not necessarily for the transaction associated with this XAResource - * object. - * - * @param xid Xid - * @param onePhase boolean - * @throws XAException on error - */ - public void commit(Xid xid, boolean onePhase) throws XAException { - - // Comment out following debug statement before public release: -/* - System.err.println("Performing a " + (onePhase ? "1-phase" - : "2-phase") + " commit on " - + xid); -*/ - JDBCXAResource resource = xaDataSource.getResource(xid); - - if (resource == null) { - throw new XAException("The XADataSource has no such Xid: " + xid); - } - - resource.commitThis(onePhase); - } - - /** - * This commits the connection associated with this XAResource. - * - * @throws XAException generically, since the more specific exceptions - * require a JTA API to compile. - * @param onePhase boolean - */ - public void commitThis(boolean onePhase) throws XAException { - - if (onePhase && state == XA_STATE_PREPARED) { - throw new XAException( - "Transaction is in a 2-phase state when 1-phase is requested"); - } - - if ((!onePhase) && state != XA_STATE_PREPARED) { - throw new XAException("Attempt to do a 2-phase commit when " - + "transaction is not prepared"); - } - - //if (!onePhase) { - // throw new XAException( - // "Sorry. HSQLDB has not implemented 2-phase commits yet"); - //} - try { - - /* - * @todo: Determine if work was committed, rolled back, or both, - * and return appropriate Heuristic*Exception. - * connection.commit(); - * Commits the real, physical conn. - */ - connection.commit(); - } catch (SQLException se) { - throw new XAException(se.toString()); - } - - dispose(); - } - - private void dispose() throws XAException { - - state = XA_STATE_DISPOSED; - - xaDataSource.removeResource(xid); - - xid = null; - - try { - connection.setAutoCommit(originalAutoCommitMode); // real/phys. - } catch (SQLException se) { - throw new XAException(se.toString()); - } - } - - public void end(Xid xid, int flags) throws XAException { - - validateXid(xid); - - if (state != XA_STATE_STARTED) { - throw new XAException("Invalid XAResource state"); - } - - /* @todo - probably all flags can be ignored */ - if (flags == XAResource.TMSUCCESS) {} - - state = XA_STATE_ENDED; - } - - /** - * The XAResource API spec indicates implies that this is only for 2-phase - * transactions. I guess that one-phase transactions need to call rollback() - * to abort. I think we want this JDBCXAResource instance to be - * garbage-collectable after (a) this method is called, and (b) the tx - * manager releases its handle to it. - * - * @param xid Xid - * @throws XAException on error - */ - public void forget(Xid xid) throws XAException { - - /* - * Should this method not attempt to clean up the aborted - * transaction by rolling back or something? Maybe the - * tx manager will already have called rollback() if - * it were necessary? - */ - validateXid(xid); - - if (state != XA_STATE_PREPARED) { - throw new XAException( - "Attempted to forget a XAResource that " - + "is not in a heuristically completed state"); - } - - dispose(); - - state = XA_STATE_INITIAL; - } - - /** - * - * @throws XAException on error - * @return int - */ - public int getTransactionTimeout() throws XAException { - throw new XAException("Transaction timeouts not implemented yet"); - } - - /** - * Stub. See implementation comment in the method for why this is not - * implemented yet. - * - * @param xares XAResource - * @return false. - * @throws XAException on error - */ - public boolean isSameRM(XAResource xares) throws XAException { - - if (!(xares instanceof JDBCXAResource)) { - return false; - } - - return xaDataSource == ((JDBCXAResource) xares).getXADataSource(); - } - - /** - * Vote on whether to commit the global transaction. We assume Xid may be - * different from this, as in commit() method. - * - * @throws XAException to vote negative. - * @return commitType of XA_RDONLY or XA_OK. (Actually only XA_OK now). - * @param xid Xid - */ - public int prepare(Xid xid) throws XAException { - - JDBCXAResource resource = xaDataSource.getResource(xid); - - if (resource == null) { - throw new XAException("The XADataSource has no such Xid: " + xid); - } - - return resource.prepareThis(); - } - - public int prepareThis() throws XAException { - - /* - * @todo: This is where the real 2-phase work should be done to - * determine if a commit done here would succeed or not. - */ - - /* - * @todo: May improve performance to return XA_RDONLY whenever - * possible, but I don't know. - * Could determine this by checking if DB instance is in RO mode, - * or perhaps (with much difficulty) to determine if there have - * been any modifications performed. - */ - if (state != XA_STATE_ENDED) { - throw new XAException("Invalid XAResource state"); - } - - try { - connection.getSession().prepareCommit(); - } catch (HsqlException e) { - state = XA_STATE_PREPARED; // ??? didn't prepare - - throw new XAException(e.getMessage()); - } - - state = XA_STATE_PREPARED; - - return XA_OK; // As noted above, should check non-committed work. - } - - /** - * Obtain a list of Xids of the current resource manager for - * XAResources currently in the 'prepared' * state. According to the JDBC - * 3.0 spec, the Xids of a specific resource manager are those of the same - * XADataSource. - * - * @param flag int - * @throws XAException on error - * @return Xid[] - */ - public Xid[] recover(int flag) throws XAException { - return xaDataSource.getPreparedXids(); - } - - /** - * Per the JDBC 3.0 spec, this rolls back the transaction for the specified - * Xid, not necessarily for the transaction associated with this XAResource - * object. - * - * @param xid Xid - * @throws XAException on error - */ - public void rollback(Xid xid) throws XAException { - - JDBCXAResource resource = xaDataSource.getResource(xid); - - if (resource == null) { - throw new XAException( - "The XADataSource has no such Xid in prepared state: " + xid); - } - - resource.rollbackThis(); - } - - /** - * This rolls back the connection associated with this XAResource. - * - * @throws javax.transaction.xa.XAException generically, since the more - * specific exceptions require a JTA API to compile. - */ - /* @throws javax.transaction.HeuristicCommitException - * if work was committed. - * @throws javax.transaction.HeuristicMixedException - * if some work was committed and some work was rolled back - */ - public void rollbackThis() throws XAException { - - if (state != XA_STATE_PREPARED && state != XA_STATE_ENDED) { - throw new XAException("Invalid XAResource state"); - } - - try { - - /* - * @todo: Determine if work was committed, rolled back, or both, - * and return appropriate Heuristic Exception. - */ - connection.rollback(); // real/phys. - } catch (SQLException se) { - throw new XAException(se.toString()); - } - - dispose(); - } - - /** - * - * @param seconds int - * @throws XAException on error - * @return boolean - */ - public boolean setTransactionTimeout(int seconds) throws XAException { - return false; - } - - public void start(Xid xid, int flags) throws XAException { - - // Comment out following debug statement before public release: -/* - System.err.println("STARTING NEW Xid: " + xid); -*/ - if (state != XA_STATE_INITIAL && state != XA_STATE_DISPOSED - && state != XA_STATE_ENDED) { - throw new XAException("Invalid XAResource state"); - } - - if (xaDataSource == null) { - throw new XAException( - "JDBCXAResource has not been associated with a XADataSource"); - } - - if (xid == null) { - - // This block asserts that all JDBCXAResources with state - // >= XA_STATE_STARTED have a non-null xid. - throw new XAException("Null Xid"); - } - - try { - if (connection.getAutoCommit()) { - originalAutoCommitMode = true; // real/phys. - - connection.setAutoCommit(false); // real/phys. - } - } catch (SQLException se) { - throw new XAException(se.toString()); - } - - if (!xid.equals(this.xid)) { - this.xid = xid; - - xaDataSource.addResource(this.xid, this); - } - - state = XA_STATE_STARTED; - - // N.b. The DataSource does not have this XAResource in its list - // until right here. We can't tell DataSource before our start() - // method, because we don't know our Xid before now. - } - - JDBCConnection getConnection() { - return this.connection; - } - - void setConnection(JDBCConnection userConnection) { - connection = userConnection; - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXID.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXID.java deleted file mode 100644 index e044b5e1..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/JDBCXID.java +++ /dev/null @@ -1,252 +0,0 @@ -/* Copyright (c) 2001-2020, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.jdbc.pool; - -import java.net.Inet4Address; -import java.util.Arrays; -import java.util.Random; - -import javax.transaction.xa.Xid; - -/** - * Implementation of Xid for tests. - * - *

    - * // Example usage:
    - *
    - * JDBCXADataSource ds = new JDBCXADataSource();
    - *
    - * ds.setUser(user);
    - * ds.setPassword(password);
    - * ds.setUrl(jdbcUrl);
    - *
    - * XAConnection xaCon = ds.getConnection();
    - * Connection con = xaCon.getConnection();
    - * Xid xid = JDBCXID.getUniqueXid((int)Thread.currentThread().getId());
    - * XAResource xaRes = xaCon.getXAResource();
    - *
    - *  // Start the transaction.
    - * System.out.println("Starting XA transaction with xid = " + xid.toString());
    - *
    - * xaRes.setTransactionTimeout(0);
    - * xaRes.start(xid,XAResource.TMNOFLAGS);
    - *
    - * // Do work here ....
    - *
    - * // Commit the transaction.
    - * xaRes.end(xid,XAResource.TMSUCCESS);
    - * xaRes.commit(xid,true);
    - *
    - * // Cleanup.
    - * con.close();
    - * xaCon.close();
    - * 
    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.1 - */ -public class JDBCXID implements Xid { - - int formatID; - byte[] txID; - byte[] txBranch; - - // - int hash; - boolean hashComputed; - - public int getFormatId() { - return formatID; - } - - public byte[] getGlobalTransactionId() { - return txID; - } - - public byte[] getBranchQualifier() { - return txBranch; - } - - public JDBCXID(int formatID, byte[] txID, byte[] txBranch) { - - this.formatID = formatID; - this.txID = txID; - this.txBranch = txBranch; - } - - public int hashCode() { - - if (!hashComputed) { - hash = 7; - hash = 83 * hash + this.formatID; - hash = 83 * hash + Arrays.hashCode(this.txID); - hash = 83 * hash + Arrays.hashCode(this.txBranch); - hashComputed = true; - } - - return hash; - } - - public boolean equals(Object other) { - - if (other instanceof Xid) { - Xid o = (Xid) other; - - return formatID == o.getFormatId() - && Arrays.equals(txID, o.getGlobalTransactionId()) - && Arrays.equals(txBranch, o.getBranchQualifier()); - } - - return false; - } - - // inherit doc - public String toString() { - - StringBuilder sb = new StringBuilder(512); - - // - sb.append("formatId=").append(getFormatId()); - - // - sb.append(" globalTransactionId(").append(txID.length).append(")={0x"); - - for (int i = 0; i < txID.length; i++) { - final int hexVal = txID[i] & 0xFF; - - if (hexVal < 0x10) { - sb.append("0").append(Integer.toHexString(txID[i] & 0xFF)); - } - - sb.append(Integer.toHexString(txID[i] & 0xFF)); - } - - // - sb.append("} branchQualifier(").append(txBranch.length).append( - "))={0x"); - - for (int i = 0; i < txBranch.length; i++) { - final int hexVal = txBranch[i] & 0xFF; - - if (hexVal < 0x10) { - sb.append("0"); - } - - sb.append(Integer.toHexString(txBranch[i] & 0xFF)); - } - - sb.append("}"); - - // - return sb.toString(); - } - - private static byte[] s_localIp = null; - private static int s_txnSequenceNumber = 0; - - // - private static final int UXID_FORMAT_ID = 0xFEED; - - private static int nextTxnSequenceNumber() { - - s_txnSequenceNumber++; - - return s_txnSequenceNumber; - } - - private static byte[] getLocalIp() { - - if (null == s_localIp) { - try { - s_localIp = Inet4Address.getLocalHost().getAddress(); - } catch (Exception ex) { - s_localIp = new byte[] { - 0x7F, 0x00, 0x00, 0x01 - }; - } - } - - return s_localIp; - } - - /** - * Retrieves a randomly generated JDBCXID. - * - * The newly generated object is based on the local IP address, the given - * threadId and a randomly generated number using the current time - * in milliseconds as the random seed. - * - * Note that java.util.Random is used, not java.security.SecureRandom. - * - * @param threadId can be a real thread id or just some convenient - * tracking value. - * - * @return a randomly generated JDBCXID - */ - public static Xid getUniqueXid(final int threadId) { - - final Random random = new Random(System.currentTimeMillis()); - - // - int txnSequenceNumberValue = nextTxnSequenceNumber(); - int threadIdValue = threadId; - int randomValue = random.nextInt(); - - // - byte[] globalTransactionId = new byte[MAXGTRIDSIZE]; - byte[] branchQualifier = new byte[MAXBQUALSIZE]; - byte[] localIp = getLocalIp(); - - System.arraycopy(localIp, 0, globalTransactionId, 0, 4); - System.arraycopy(localIp, 0, branchQualifier, 0, 4); - - // Bytes 4 -> 7 - unique transaction id. - // Bytes 8 ->11 - thread id. - // Bytes 12->15 - random. - for (int i = 0; i <= 3; i++) { - globalTransactionId[i + 4] = (byte) (txnSequenceNumberValue - % 0x100); - branchQualifier[i + 4] = (byte) (txnSequenceNumberValue % 0x100); - txnSequenceNumberValue >>= 8; - globalTransactionId[i + 8] = (byte) (threadIdValue % 0x100); - branchQualifier[i + 8] = (byte) (threadIdValue % 0x100); - threadIdValue >>= 8; - globalTransactionId[i + 12] = (byte) (randomValue % 0x100); - branchQualifier[i + 12] = (byte) (randomValue % 0x100); - randomValue >>= 8; - } - - return new JDBCXID(UXID_FORMAT_ID, globalTransactionId, - branchQualifier); - } -} diff --git a/database/hsqldb/src/org/hsqldb/jdbc/pool/package-info.java b/database/hsqldb/src/org/hsqldb/jdbc/pool/package-info.java deleted file mode 100644 index 6ebbe5f8..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbc/pool/package-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains classes for connection pooling and distributed XA connections. - */ -package org.hsqldb.jdbc.pool; diff --git a/database/hsqldb/src/org/hsqldb/jdbcDriver.java b/database/hsqldb/src/org/hsqldb/jdbcDriver.java deleted file mode 100644 index 3f257207..00000000 --- a/database/hsqldb/src/org/hsqldb/jdbcDriver.java +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb; - -public class jdbcDriver extends org.hsqldb.jdbc.JDBCDriver {} diff --git a/database/hsqldb/src/org/hsqldb/lib/AbstractReadOnlyCollection.java b/database/hsqldb/src/org/hsqldb/lib/AbstractReadOnlyCollection.java deleted file mode 100644 index 40db84d7..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/AbstractReadOnlyCollection.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -abstract class AbstractReadOnlyCollection implements Collection{ - - public boolean contains(Object o) { - throw new UnsupportedOperationException(); - } - - public boolean containsAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean add(V value) { - throw new UnsupportedOperationException(); - } - - public boolean addAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean remove(Object o) { - throw new UnsupportedOperationException(); - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public Object[] toArray() { - throw new UnsupportedOperationException(); - } - - public T[] toArray(T[] a) { - throw new UnsupportedOperationException(); - } - -} diff --git a/database/hsqldb/src/org/hsqldb/lib/AppendableException.java b/database/hsqldb/src/org/hsqldb/lib/AppendableException.java deleted file mode 100644 index cf872cc5..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/AppendableException.java +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.ArrayList; -import java.util.List; - -/** - * Allows additional messages to be appended. - * - * It often makes for better (and more efficient) design to add context - * details to an exception at intermediate points in the thread. - * This class makes it easy and efficient to catch and rethrow for that purpose. - */ -public class AppendableException extends Exception { - - static final long serialVersionUID = -1002629580611098803L; - public static final String LS = System.getProperty("line.separator"); - public List appendages = null; - - public String getMessage() { - - String message = super.getMessage(); - - if (appendages == null) { - return message; - } - - StringBuilder sb = new StringBuilder(); - - if (message != null) { - sb.append(message); - } - - for (String appendage : appendages) { - if (sb.length() > 0) { - sb.append(LS); - } - - sb.append(appendage); - } - - return sb.toString(); - } - - public void appendMessage(String s) { - - if (appendages == null) { - appendages = new ArrayList(); - } - - appendages.add(s); - } - - public AppendableException() { - // Intentionally empty - } - - public AppendableException(String s) { - super(s); - } - - public AppendableException(Throwable cause) { - super(cause); - } - - public AppendableException(String string, Throwable cause) { - super(string, cause); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ArrayCounter.java b/database/hsqldb/src/org/hsqldb/lib/ArrayCounter.java deleted file mode 100644 index 11588aba..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ArrayCounter.java +++ /dev/null @@ -1,171 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Collection of routines for counting the distribution of the values - * in an int[] array. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.7.2 - * @since 1.7.2 - */ -public final class ArrayCounter { - - /** - * Returns an int[] array of length segments containing the distribution - * count of the elements in unsorted int[] array with values between min - * and max (range). Values outside the min-max range are ignored

    - * - * A usage example is determining the count of people of each age group - * in a large int[] array containing the age of each person. Called with - * (array, 16,0,79), it will return an int[16] with the first element - * the count of people aged 0-4, the second element the count of those - * aged 5-9, and so on. People above the age of 79 are excluded. If the - * range is not a multiple of segments, the last segment will be cover a - * smaller sub-range than the rest. - * - * @param array int[] - * @param elementCount int - * @param segments int - * @param interval int - * @param start int - * @param limit int - * @return int[] - */ - public static int[] countSegments(int[] array, int elementCount, - int segments, int interval, int start, - int limit) { - - int[] counts = new int[segments]; - int index; - int element; - - if (interval <= 0) { - return counts; - } - - for (int i = 0; i < elementCount; i++) { - element = array[i]; - - if (element < start || element >= limit) { - continue; - } - - index = (element - start) / interval; - - counts[index]++; - } - - return counts; - } - - /** - * With an unsorted int[] array and with target a positive integer in the - * range (1,array.length), finds the value in the range (start,limit) of the - * largest element (rank) where the count of all smaller elements in that - * range is less than or equals target. Parameter margin indicates the - * margin of error in target

    - * - * In statistics, this can be used to calculate a median or quartile value. - * A usage example applied to an array of age values is to determine - * the maximum age of a given number of people. With the example array - * given in countSegments, rank(array, c, 6000, 18, 65, 0) will return an age - * value between 18-64 (inclusive) and the count of all people aged between - * 18 and the returned value(exclusive) will be less than or equal to 6000. - * - * @param array int[] - * @param elements int - * @param target int - * @param start int - * @param limit int - * @param margin int - * @return int - */ - public static int rank(int[] array, int elements, int target, int start, - int limit, int margin) { - - final int segments = 256; - int elementCount = 0; - int currentLimit = limit; - - for (;;) { - int interval = calcInterval(segments, start, currentLimit); - int[] counts = countSegments(array, elements, segments, interval, - start, currentLimit); - - for (int i = 0; i < counts.length; i++) { - if (elementCount + counts[i] < target) { - elementCount += counts[i]; - start += interval; - } else { - break; - } - } - - if (elementCount + margin >= target) { - return start; - } - - if (interval <= 1) { - return start; - } - - currentLimit = start + interval < limit ? (start + interval) - : limit; - } - } - - /** - * Helper method to calculate the span of the sub-interval. Simply returns - * the ceiling of ((limit - start) / segments) and accounts for invalid - * start and limit combinations. - * - * @param segments int - * @param start int - * @param limit int - * @return int - */ - static int calcInterval(int segments, int start, int limit) { - - int range = limit - start; - - if (range <= 0) { - return 0; - } - - int partSegment = (range % segments) == 0 ? 0 - : 1; - - return (range / segments) + partSegment; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ArrayListIdentity.java b/database/hsqldb/src/org/hsqldb/lib/ArrayListIdentity.java deleted file mode 100644 index baa478a3..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ArrayListIdentity.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Extends HsqlArrayList. All search methods use Object identity for equality - * comparison. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 2.0.0 - */ -public class ArrayListIdentity extends HsqlArrayList { - - public ArrayListIdentity() { - super(); - - comparator = ObjectComparator.identityComparator; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ArraySort.java b/database/hsqldb/src/org/hsqldb/lib/ArraySort.java deleted file mode 100644 index 1f7ea573..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ArraySort.java +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Comparator; - -/** - * FastQSorts the [l,r] partition (inclusive) of the specified array of - * Rows, using the comparator.

    - * - * Searches an ordered array.

    - * - * @author Tony Lai (tony_lai@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public final class ArraySort { - - /** - * Returns the index of the lowest element == the given search target, or - * when not found, a negative value -(insert position + 1) - * - * @return index or a negative value if not found - * @param array Object[] - * @param start int - * @param limit int - * @param value Object - * @param c Comparator - */ - public static int searchFirst(Object[] array, int start, int limit, - Object value, Comparator c) { - - int low = start; - int high = limit; - int found = limit; - int mid; - int compare; - - while (low < high) { - mid = (low + high) >>> 1; - compare = c.compare(value, array[mid]); - - if (compare < 0) { - high = mid; - } else if (compare > 0) { - low = mid + 1; - } else { - high = mid; - found = mid; - } - } - - return found == limit ? -low - 1 - : found; - } - - public static int deDuplicate(Object[] array, int limit, - Comparator comparator) { - - int baseIndex = 0; - int currentIndex = 1; - - if (limit < 2) { - return limit; - } - - for (; currentIndex < limit; currentIndex++) { - int compare = comparator.compare(array[baseIndex], - array[currentIndex]); - - if (compare == 0) { - continue; - } - - baseIndex++; - - array[baseIndex] = array[currentIndex]; - } - - return baseIndex + 1; - } - - public static void sort(Object[] array, int limit, Comparator comparator) { - - if (limit < 2) { - return; - } - - quickSort(array, comparator, 0, limit - 1); - insertionSort(array, comparator, 0, limit - 1); - } - - static void quickSort(Object[] array, Comparator comparator, int l, - int r) { - - int M = 16; - int i; - int j; - int v; - - if ((r - l) > M) { - i = (r + l) >>> 1; - - if (comparator.compare(array[i], array[l]) < 0) { - swap(array, l, i); // Tri-Median Method! - } - - if (comparator.compare(array[r], array[l]) < 0) { - swap(array, l, r); - } - - if (comparator.compare(array[r], array[i]) < 0) { - swap(array, i, r); - } - - j = r - 1; - - swap(array, i, j); - - i = l; - v = j; - - for (;;) { - while (comparator.compare(array[++i], array[v]) < 0) {} - - while (comparator.compare(array[v], array[--j]) < 0) {} - - if (j < i) { - break; - } - - swap(array, i, j); - } - - swap(array, i, r - 1); - quickSort(array, comparator, l, j); - quickSort(array, comparator, i + 1, r); - } - } - - public static void insertionSort(Object[] array, Comparator comparator, - int lo0, int hi0) { - - int i; - int j; - - for (i = lo0 + 1; i <= hi0; i++) { - j = i; - - while ((j > lo0) - && comparator.compare(array[i], array[j - 1]) < 0) { - j--; - } - - if (i != j) { - moveAndInsertRow(array, i, j); - } - } - } - - private static void swap(Object[] array, int i1, int i2) { - - Object val = array[i1]; - - array[i1] = array[i2]; - array[i2] = val; - } - - private static void moveAndInsertRow(Object[] array, int i, int j) { - - Object val = array[i]; - - moveRows(array, j, j + 1, i - j); - - array[j] = val; - } - - private static void moveRows(Object[] array, int fromIndex, int toIndex, - int rows) { - System.arraycopy(array, fromIndex, array, toIndex, rows); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ArrayUtil.java b/database/hsqldb/src/org/hsqldb/lib/ArrayUtil.java deleted file mode 100644 index 15af1998..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ArrayUtil.java +++ /dev/null @@ -1,2194 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.lang.reflect.Array; -import java.util.Arrays; - -/** - * Collection of static methods for operations on arrays - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.1 - * @since 1.7.2 - */ -public final class ArrayUtil { - - public static final int CLASS_CODE_BYTE = 'B'; - public static final int CLASS_CODE_CHAR = 'C'; - public static final int CLASS_CODE_DOUBLE = 'D'; - public static final int CLASS_CODE_FLOAT = 'F'; - public static final int CLASS_CODE_INT = 'I'; - public static final int CLASS_CODE_LONG = 'J'; - public static final int CLASS_CODE_OBJECT = 'L'; - public static final int CLASS_CODE_SHORT = 'S'; - public static final int CLASS_CODE_BOOLEAN = 'Z'; - private static final IntValueHashMap classCodeMap = new IntValueHashMap(16); - - static { - classCodeMap.put(byte.class, ArrayUtil.CLASS_CODE_BYTE); - classCodeMap.put(char.class, ArrayUtil.CLASS_CODE_SHORT); - classCodeMap.put(short.class, ArrayUtil.CLASS_CODE_SHORT); - classCodeMap.put(int.class, ArrayUtil.CLASS_CODE_INT); - classCodeMap.put(long.class, ArrayUtil.CLASS_CODE_LONG); - classCodeMap.put(float.class, ArrayUtil.CLASS_CODE_FLOAT); - classCodeMap.put(double.class, ArrayUtil.CLASS_CODE_DOUBLE); - classCodeMap.put(boolean.class, ArrayUtil.CLASS_CODE_BOOLEAN); - classCodeMap.put(Object.class, ArrayUtil.CLASS_CODE_OBJECT); - } - - /** - * Returns a distinct int code for each primitive type and for all Object - * types. - * - * @param cla Class - * @return int - */ - static int getClassCode(Class cla) { - - if (!cla.isPrimitive()) { - return ArrayUtil.CLASS_CODE_OBJECT; - } - - return classCodeMap.get(cla, -1); - } - - /** - * Clears an area of the given array of the given type. - * - * @param type int - * @param data Object - * @param from int - * @param to int - */ - public static void clearArray(int type, Object data, int from, int to) { - - switch (type) { - - case ArrayUtil.CLASS_CODE_BYTE : { - byte[] array = (byte[]) data; - - Arrays.fill(array, from, to, (byte) 0); - - return; - } - case ArrayUtil.CLASS_CODE_CHAR : { - char[] array = (char[]) data; - - Arrays.fill(array, from, to, (char) 0); - - return; - } - case ArrayUtil.CLASS_CODE_SHORT : { - short[] array = (short[]) data; - - Arrays.fill(array, from, to, (short) 0); - - return; - } - case ArrayUtil.CLASS_CODE_INT : { - int[] array = (int[]) data; - - Arrays.fill(array, from, to, 0); - - return; - } - case ArrayUtil.CLASS_CODE_LONG : { - long[] array = (long[]) data; - - Arrays.fill(array, from, to, 0L); - - return; - } - case ArrayUtil.CLASS_CODE_FLOAT : { - float[] array = (float[]) data; - - Arrays.fill(array, from, to, 0); - - return; - } - case ArrayUtil.CLASS_CODE_DOUBLE : { - double[] array = (double[]) data; - - Arrays.fill(array, from, to, 0); - - return; - } - case ArrayUtil.CLASS_CODE_BOOLEAN : { - boolean[] array = (boolean[]) data; - - Arrays.fill(array, from, to, false); - - return; - } - default : { - Object[] array = (Object[]) data; - - Arrays.fill(array, from, to, null); - - return; - } - } - } - - /** - * Moves the contents of an array to allow both addition and removal of - * elements. Used arguments must be in range. - * - * @param type class type of the array - * @param array the array - * @param usedElements count of elements of array in use - * @param index point at which to add or remove elements - * @param count number of elements to add or remove - */ - public static void adjustArray(int type, Object array, int usedElements, - int index, int count) { - - if (index >= usedElements || count == 0) { - return; - } - - int newCount = usedElements + count; - int source; - int target; - int size; - - if (count >= 0) { - source = index; - target = index + count; - size = usedElements - index; - } else { - source = index - count; - target = index; - size = usedElements - index + count; - } - - if (size > 0) { - System.arraycopy(array, source, array, target, size); - } - - if (count < 0) { - clearArray(type, array, newCount, usedElements); - } - } - - /** - * Basic sort for small arrays of int. - * - * @param array int[] - */ - public static void sortArray(int[] array) { - - boolean swapped; - - do { - swapped = false; - - for (int i = 0; i < array.length - 1; i++) { - if (array[i] > array[i + 1]) { - int temp = array[i + 1]; - - array[i + 1] = array[i]; - array[i] = temp; - swapped = true; - } - } - } while (swapped); - } - - /** - * Basic find for small arrays of Object. - * - * @param array Object[] - * @param object Object - * @return int - */ - public static int find(Object[] array, Object object) { - - for (int i = 0; i < array.length; i++) { - if (array[i] == object) { - - // handles both nulls - return i; - } - - if (object != null && object.equals(array[i])) { - return i; - } - } - - return -1; - } - - /** - * Finds index of value in small array. - * - * @param array int[] - * @param value int - * @return int - */ - public static int find(int[] array, int value) { - - for (int i = 0; i < array.length; i++) { - if (array[i] == value) { - return i; - } - } - - return -1; - } - - /** - * Finds index of value in the first count elements of small array. - * - * @param array int[] - * @param count int - * @param value int - * @return int - */ - public static int find(int[] array, int count, int value) { - - for (int i = 0; i < count; i++) { - if (array[i] == value) { - return i; - } - } - - return -1; - } - - public static int find(short[] array, int value) { - - for (int i = 0; i < array.length; i++) { - if (array[i] == value) { - return i; - } - } - - return -1; - } - - public static int find(short[] array, int value, int offset, int count) { - - for (int i = offset; i < offset + count; i++) { - if (array[i] == value) { - return i; - } - } - - return -1; - } - - public static int find(char[] array, int value) { - - for (int i = 0; i < array.length; i++) { - if (array[i] == value) { - return i; - } - } - - return -1; - } - /** - * Finds the first element of the array that is not equal to the given value. - * - * @param array int[] - * @param value int - * @return int - */ - public static int findNot(int[] array, int value) { - - for (int i = 0; i < array.length; i++) { - if (array[i] != value) { - return i; - } - } - - return -1; - } - - /** - * Returns true if arra and arrb contain the same set of integers, not - * necessarily in the same order. This implies the arrays are of the same - * length. - * - * @param arra int[] - * @param arrb int[] - * @return boolean - */ - public static boolean areEqualSets(int[] arra, int[] arrb) { - return arra.length == arrb.length - && ArrayUtil.haveEqualSets(arra, arrb, arra.length); - } - - /** - * Returns true if the first count elements of arra and arrb are identical - * sets of integers (not necessarily in the same order). - * - * @param arra int[] - * @param arrb int[] - * @param count int - * @return boolean - */ - public static boolean haveEqualSets(int[] arra, int[] arrb, int count) { - - if (count > arra.length || count > arrb.length) { - return false; - } - - outerloop: - for (int i = 0; i < count; i++) { - int val = arra[i]; - - for (int j = 0; j < count; j++) { - if (arrb[j] == val) { - continue outerloop; - } - } - - return false; - } - - return true; - } - - /** - * Returns true if the first count elements of arra and arrb are identical - * subarrays of integers - * - * @param arra int[] - * @param arrb int[] - * @param count int - * @return boolean - */ - public static boolean haveEqualArrays(int[] arra, int[] arrb, int count) { - - if (count > arra.length || count > arrb.length) { - return false; - } - - for (int j = 0; j < count; j++) { - if (arra[j] != arrb[j]) { - return false; - } - } - - return true; - } - - /** - * Returns true if the first count elements of arra and arrb are identical - * subarrays of Objects - * - * @param arra Object[] - * @param arrb Object[] - * @param count int - * @return boolean - */ - public static boolean haveEqualArrays(Object[] arra, Object[] arrb, - int count) { - - if (count > arra.length || count > arrb.length) { - return false; - } - - for (int j = 0; j < count; j++) { - if (arra[j] != arrb[j]) { - if (arra[j] == null || !arra[j].equals(arrb[j])) { - return false; - } - } - } - - return true; - } - - /** - * Returns true if arra and arrb share any element. - * - *

    Used for checks for any overlap between two arrays of column indexes. - * - * @param arra int[] - * @param arrb int[] - * @return boolean - */ - public static boolean haveCommonElement(int[] arra, int[] arrb) { - - if (arra == null || arrb == null) { - return false; - } - - for (int i = 0; i < arra.length; i++) { - int c = arra[i]; - - for (int j = 0; j < arrb.length; j++) { - if (c == arrb[j]) { - return true; - } - } - } - - return false; - } - - /** - * Returns an int[] containing elements shared between the two arrays - * arra and arrb. The arrays contain sets (no value is repeated). - * - * Used to find the overlap between two arrays of column indexes. - * Ordering of the result arrays will be the same as in array - * arra. The method assumes that each index is only listed - * once in the two input arrays. - *

    - * e.g. - * - * - * - * - * - * - * - *
    Example
    The arrays
    int []arra={2,11,5,8}
    int []arrb={20,8,10,11,28,12}
    will result in:
    int []arrc={11,8}
    - * - * @param arra int[] first column indexes - * @param arrb int[] second column indexes - * @return int[] common indexes or null if there is no overlap. - */ - public static int[] commonElements(int[] arra, int[] arrb) { - - int[] c = null; - int n = countCommonElements(arra, arrb); - - if (n > 0) { - c = new int[n]; - - int k = 0; - - for (int i = 0; i < arra.length; i++) { - for (int j = 0; j < arrb.length; j++) { - if (arra[i] == arrb[j]) { - c[k++] = arra[i]; - } - } - } - } - - return c; - } - - /** - * Returns the number of elements shared between the two arrays containing - * sets.

    - * - * Returns the number of elements shared by two column index arrays. - * This method assumes that each of these arrays contains a set (each - * element index is listed only once in each index array). Otherwise the - * returned number will NOT represent the number of unique column indexes - * shared by both index array. - * - * @param arra int[] first array of column indexes. - * - * @param arrb int[] second array of column indexes - * - * @return int number of elements shared by arra and arrb - */ - public static int countCommonElements(int[] arra, int[] arrb) { - - int k = 0; - - for (int i = 0; i < arra.length; i++) { - for (int j = 0; j < arrb.length; j++) { - if (arra[i] == arrb[j]) { - k++; - - break; - } - } - } - - return k; - } - - public static int countCommonElements(Object[] arra, int alen, - Object[] arrb) { - - int k = 0; - - for (int i = 0; i < alen; i++) { - for (int j = 0; j < arrb.length; j++) { - if (arra[i] == arrb[j]) { - k++; - - break; - } - } - } - - return k; - } - - /** - * Returns the count of elements in arra from position start that are - * sequentially equal to the elements of arrb. - * - * @param arra byte[] - * @param start int - * @param arrb byte[] - * @return int - */ - public static int countSameElements(byte[] arra, int start, byte[] arrb) { - - int k = 0; - int limit = arra.length - start; - - if (limit > arrb.length) { - limit = arrb.length; - } - - for (int i = 0; i < limit; i++) { - if (arra[i + start] == arrb[i]) { - k++; - } else { - break; - } - } - - return k; - } - - /** - * Returns the count of elements in arra from position start that are - * sequentially equal to the elements of arrb. - * - * @param arra char[] - * @param start int - * @param arrb char[] - * @return int - */ - public static int countSameElements(char[] arra, int start, char[] arrb) { - - int k = 0; - int limit = arra.length - start; - - if (limit > arrb.length) { - limit = arrb.length; - } - - for (int i = 0; i < limit; i++) { - if (arra[i + start] == arrb[i]) { - k++; - } else { - break; - } - } - - return k; - } - - /** - * Returns the count of elements in arra from position start that are - * sequentially equal to the elements of arrb. - * - * @param arra int[] - * @param start int - * @param arrb int[] - * @return int - */ - public static int countSameElements(int[] arra, int start, int[] arrb) { - - int k = 0; - int limit = arra.length - start; - - if (limit > arrb.length) { - limit = arrb.length; - } - - for (int i = 0; i < limit; i++) { - if (arra[i + start] == arrb[i]) { - k++; - } else { - break; - } - } - - return k; - } - - /** - * Returns the count of elements in arra that are smaller than the value. - * - * @param arra int[] - * @param value int - * @return int - */ - public static int countSmallerElements(int[] arra, int value) { - - int count = 0; - - for (int i = 0; i < arra.length; i++) { - if (arra[i] < value) { - count++; - } - } - - return count; - } - - /** - * Returns the count of elements in arra that are smaller/equal than the - * value. - * - * @param arra int[] - * @param value int - * @return int - */ - public static int countSmallerEqualElements(int[] arra, int value) { - - int count = 0; - - for (int i = 0; i < arra.length; i++) { - if (arra[i] <= value) { - count++; - } - } - - return count; - } - - /** - * Returns an array that contains all the elements of the two arrays. - * Each array contains a set. - * - * @param arra int[] containing unique vlaues - * @param arrb int[] containing unique values - * @return int[] - */ - public static int[] union(int[] arra, int[] arrb) { - - int commonSize = ArrayUtil.countCommonElements(arra, arrb); - - if (commonSize == arrb.length) { - return arra; - } - - if (commonSize == arra.length) { - return arrb; - } - - int newSize = arra.length + arrb.length - commonSize; - int[] arrn = Arrays.copyOf(arra, newSize); - int pos = arra.length; - - mainloop: - for (int i = 0; i < arrb.length; i++) { - for (int j = 0; j < arra.length; j++) { - if (arrb[i] == arra[j]) { - continue mainloop; - } - } - - arrn[pos++] = arrb[i]; - } - - return arrn; - } - - /** - * Returns an array that contains all the elements of the two arrays. - * - * @param arra int[] - * @param arrb int[] - * @return int[] - */ - public static int[] concat(int[] arra, int[] arrb) { - int newSize = arra.length + arrb.length; - - int[] arrn = Arrays.copyOf(arra, newSize); - int pos = arra.length; - - for (int i = 0; i < arrb.length; i++) { - arrn[pos++] = arrb[i]; - } - - return arrn; - - } - - /** - * Returns the index of the first occurrence of arrb in arra. Or -1 if not - * found. - * - * @param arra byte[] - * @param start int - * @param limit int - * @param arrb byte[] - * @return int - */ - public static int find(byte[] arra, int start, int limit, byte[] arrb) { - - int k = start; - - limit = limit - arrb.length + 1; - - int value = arrb[0]; - - for (; k < limit; k++) { - if (arra[k] == value) { - if (arrb.length == 1) { - return k; - } - - if (containsAt(arra, k, arrb)) { - return k; - } - } - } - - return -1; - } - - /** - * Returns an index into arra (or -1) where the character is not in the - * charset byte array. - * - * @param arra byte[] - * @param start int - * @param limit int - * @param byteSet byte[] - * @return int - */ - public static int findNotIn(byte[] arra, int start, int limit, - byte[] byteSet) { - - mainloop: - for (int k = start; k < limit; k++) { - for (int i = 0; i < byteSet.length; i++) { - if (arra[k] == byteSet[i]) { - continue mainloop; - } - } - - return k; - } - - return -1; - } - - /** - * Returns an index into arra (or -1) where the character is in the byteSet - * byte array. - * - * @param arra byte[] - * @param start int - * @param limit int - * @param byteSet byte[] - * @return int - */ - public static int findIn(byte[] arra, int start, int limit, - byte[] byteSet) { - - for (int k = start; k < limit; k++) { - for (int i = 0; i < byteSet.length; i++) { - if (arra[k] == byteSet[i]) { - return k; - } - } - } - - return -1; - } - - /** - * Returns the index of b or c in arra. Or -1 if not found. - * - * @param arra byte[] - * @param start int - * @param limit int - * @param b int - * @param c int - * @return int - */ - public static int find(byte[] arra, int start, int limit, int b, int c) { - - int k = 0; - - for (; k < limit; k++) { - if (arra[k] == b || arra[k] == c) { - return k; - } - } - - return -1; - } - - /** - * Set elements of arrb true if their indexes appear in arrb. - * - * @param arrb boolean[] - * @return int[] - */ - public static int[] booleanArrayToIntIndexes(boolean[] arrb) { - - int count = 0; - - for (int i = 0; i < arrb.length; i++) { - if (arrb[i]) { - count++; - } - } - - int[] intarr = new int[count]; - - count = 0; - - for (int i = 0; i < arrb.length; i++) { - if (arrb[i]) { - intarr[count++] = i; - } - } - - return intarr; - } - - /** - * Set elements of arrb true if their indexes appear in arrb. - * - * @param arra int[] - * @param arrb boolean[] - */ - public static void intIndexesToBooleanArray(int[] arra, boolean[] arrb) { - - for (int i = 0; i < arra.length; i++) { - if (arra[i] < arrb.length) { - arrb[arra[i]] = true; - } - } - } - - /** - * Return array of indexes of boolean elements that are true. - * - * @param arra int[] - * @param arrb boolean[] - * @return int - */ - public static int countStartIntIndexesInBooleanArray(int[] arra, - boolean[] arrb) { - - int k = 0; - - for (int i = 0; i < arra.length; i++) { - if (arrb[arra[i]]) { - k++; - } else { - break; - } - } - - return k; - } - - public static void orBooleanArray(boolean[] source, boolean[] dest) { - - for (int i = 0; i < dest.length; i++) { - dest[i] |= source[i]; - } - } - - /** - * Returns true if all indexes and no other positions are true in arrb. arra - * must have no duplicates. - * - * arra must have no duplicates. - * - * @param arra int[] - * @param arrb boolean[] - * @return boolean - */ - public static boolean areAllIntIndexesAsBooleanArray(int[] arra, - boolean[] arrb) { - - for (int i = 0; i < arra.length; i++) { - if (arrb[arra[i]]) { - continue; - } - - return false; - } - - return arra.length == countTrueElements(arrb); - } - - public static boolean areAllIntIndexesInBooleanArray(int[] arra, - boolean[] arrb) { - - for (int i = 0; i < arra.length; i++) { - if (arrb[arra[i]]) { - continue; - } - - return false; - } - - return true; - } - - public static boolean isAnyIntIndexInBooleanArray(int[] arra, - boolean[] arrb) { - - for (int i = 0; i < arra.length; i++) { - if (arrb[arra[i]]) { - return true; - } - } - - return false; - } - - /** - * Return true if for each true element in arrb, the corresponding element - * in arra is true - * - * @param arra boolean[] - * @param arrb boolean[] - * @return boolean - */ - public static boolean containsAllTrueElements(boolean[] arra, - boolean[] arrb) { - - for (int i = 0; i < arra.length; i++) { - if (arrb[i] && !arra[i]) { - return false; - } - } - - return true; - } - - /** - * Return count of true elements in array - * - * @param arra boolean[] - * @return int - */ - public static int countTrueElements(boolean[] arra) { - - int count = 0; - - for (int i = 0; i < arra.length; i++) { - if (arra[i]) { - count++; - } - } - - return count; - } - - /** - * Determines if the array has a null column for any of the positions given - * in the rowColMap array. - * - * @param array Object[] - * @param columnMap int[] - * @return boolean - */ - public static boolean hasNull(Object[] array, int[] columnMap) { - - int count = columnMap.length; - - for (int i = 0; i < count; i++) { - if (array[columnMap[i]] == null) { - return true; - } - } - - return false; - } - - public static boolean hasAllNull(Object[] array, int[] columnMap) { - - int count = columnMap.length; - - for (int i = 0; i < count; i++) { - if (array[columnMap[i]] != null) { - return false; - } - } - - return true; - } - - /** - * Returns true if arra from position start contains all elements of arrb in - * sequential order. - * - * @param arra byte[] - * @param start int - * @param arrb byte[] - * @return boolean - */ - public static boolean containsAt(byte[] arra, int start, byte[] arrb) { - return countSameElements(arra, start, arrb) == arrb.length; - } - - /** - * Returns the count of elements in arra from position start that are among - * the elements of arrb. Stops at any element not in arrb. - * - * @param arra byte[] - * @param start int - * @param arrb byte[] - * @return int - */ - public static int countStartElementsAt(byte[] arra, int start, - byte[] arrb) { - - int k = 0; - - mainloop: - for (int i = start; i < arra.length; i++) { - for (int j = 0; j < arrb.length; j++) { - if (arra[i] == arrb[j]) { - k++; - - continue mainloop; - } - } - - break; - } - - return k; - } - - /** - * Returns true if arra from position start contains all elements of arrb in - * sequential order. - * - * @param arra char[] - * @param start int - * @param arrb char[] - * @return boolean - */ - public static boolean containsAt(char[] arra, int start, char[] arrb) { - return countSameElements(arra, start, arrb) == arrb.length; - } - - /** - * Returns the count of elements in arra from position start that are not - * among the elements of arrb. - * - * @param arra byte[] - * @param start int - * @param arrb byte[] - * @return int - */ - public static int countNonStartElementsAt(byte[] arra, int start, - byte[] arrb) { - - int k = 0; - - mainloop: - for (int i = start; i < arra.length; i++) { - for (int j = 0; j < arrb.length; j++) { - if (arra[i] == arrb[j]) { - break mainloop; - } - } - - k++; - } - - return k; - } - - /** - * Byte arrays source and dest each begin at an offset in the common space. - * If there is an overlap between dest and the first sourceLength elements - * of the source, the overlapping elements are copied to dest. Returns count - * of copied bytes. - * - * @param sourceOffset long - * @param source byte[] - * @param sourceOff int - * @param sourceLength int - * @param destOffset long - * @param dest byte[] - * @param destLength int - * @return int - */ - public static int copyBytes(long sourceOffset, byte[] source, - int sourceOff, int sourceLength, - long destOffset, byte[] dest, int destLength) { - - if (sourceOff >= source.length) { - return 0; - } - - if (sourceOff + sourceLength > source.length) { - sourceLength = source.length - sourceOff; - } - - if (destLength > dest.length) { - destLength = dest.length; - } - - if (sourceOffset + sourceOff >= destOffset + destLength - || sourceOffset + sourceOff + sourceLength <= destOffset) { - return 0; - } - - long sourceIndex = destOffset - sourceOffset; - long destIndex = 0; - int sourceLimit = sourceOff + sourceLength; - - if (sourceIndex >= 0) { - if (sourceIndex < sourceOff) { - sourceIndex = sourceOff; - } - } else { - destIndex = -sourceIndex + sourceOff; - sourceIndex = sourceOff; - } - - sourceLength = sourceLimit - (int) sourceIndex; - - if (sourceLength > destLength - destIndex) { - sourceLength = destLength - (int) destIndex; - } - - System.arraycopy(source, (int) sourceIndex, dest, (int) destIndex, - sourceLength); - - return sourceLength; - } - - /** - * Copy the source to dest, returning dest or an enlarged array of result is - * larger than dest. - * - * @param source byte[] - * @param dest byte[] - * @param destOffset int - * @return byte[] - */ - public static byte[] copyBytes(byte[] source, byte[] dest, - int destOffset) { - - if (source.length + destOffset > dest.length) { - byte[] newDest = new byte[source.length + destOffset]; - - System.arraycopy(dest, 0, newDest, 0, dest.length); - - dest = newDest; - } - - System.arraycopy(source, 0, dest, destOffset, source.length); - - return dest; - } - - /** - * Convenience wrapper for System.arraycopy(). - * - * @param source Object - * @param dest Object - * @param count int - */ - public static void copyArray(Object source, Object dest, int count) { - System.arraycopy(source, 0, dest, 0, count); - } - - public static void copyMoveSegment(Object source, Object dest, int size, - int index, int segmentSize, - int destIndex) { - - boolean forward = index < destIndex; - int sliceSize = forward ? index - : destIndex; - - System.arraycopy(source, 0, dest, 0, sliceSize); - - sliceSize = forward ? size - destIndex - segmentSize - : size - index - segmentSize; - - int sliceIndex = forward ? destIndex + segmentSize - : index + segmentSize; - - System.arraycopy(source, sliceIndex, dest, sliceIndex, sliceSize); - System.arraycopy(source, index, dest, destIndex, segmentSize); - - sliceSize = Math.abs(index - destIndex); - sliceIndex = forward ? index + segmentSize - : destIndex; - - int targetSliceIndex = forward ? index - : destIndex + segmentSize; - - System.arraycopy(source, sliceIndex, dest, targetSliceIndex, - sliceSize); - } - - /** - * Returns a range of elements of source from start to end of the array. - * - * @param source int[] - * @param start int - * @param count int - * @return int[] - */ - public static int[] arraySlice(int[] source, int start, int count) { - - int[] slice = new int[count]; - - System.arraycopy(source, start, slice, 0, count); - - return slice; - } - - /** - * Fills part of the array with a value. - * - * @param array char[] - * @param offset int - * @param value char - */ - public static void fillArray(char[] array, int offset, char value) { - - int to = array.length; - - while (--to >= offset) { - array[to] = value; - } - } - - /** - * Fills part of the array with a value. - * - * @param array byte[] - * @param offset int - * @param value byte - */ - public static void fillArray(byte[] array, int offset, byte value) { - - int to = array.length; - - while (--to >= offset) { - array[to] = value; - } - } - - /** - * Fills the array with a value. - * - * @param array Object[] - * @param value Object - */ - public static void fillArray(Object[] array, Object value) { - - int to = array.length; - - while (--to >= 0) { - array[to] = value; - } - } - - /** - * Fills the int array with a value - * - * @param array int[] - * @param value int - */ - public static void fillArray(int[] array, int value) { - - int to = array.length; - - while (--to >= 0) { - array[to] = value; - } - } - - /** - * Fills the double array with a value - * - * @param array double[] - * @param value double - */ - public static void fillArray(double[] array, double value) { - - int to = array.length; - - while (--to >= 0) { - array[to] = value; - } - } - - /** - * Fills the int array with a value - * - * @param array boolean[] - * @param value boolean - */ - public static void fillArray(boolean[] array, boolean value) { - - int to = array.length; - - while (--to >= 0) { - array[to] = value; - } - } - - /** - * Returns a duplicates of an array. - * - * @param source Object - * @return Object - */ - public static Object duplicateArray(Object source) { - - int size = Array.getLength(source); - Object newarray = - Array.newInstance(source.getClass().getComponentType(), size); - - System.arraycopy(source, 0, newarray, 0, size); - - return newarray; - } - - /** - * Returns the given array if newsize is the same as existing. Returns a new - * array of given size, containing as many elements of the original array as - * it can hold. - * - * @param source Object - * @param newsize int - * @return Object - */ - public static Object resizeArrayIfDifferent(Object source, int newsize) { - - int oldsize = Array.getLength(source); - - if (oldsize == newsize) { - return source; - } - - Object newarray = - Array.newInstance(source.getClass().getComponentType(), newsize); - - if (oldsize < newsize) { - newsize = oldsize; - } - - System.arraycopy(source, 0, newarray, 0, newsize); - - return newarray; - } - - /** - * Returns a new array of given size, containing as many elements of the - * original array as it can hold. N.B. Always returns a new array even if - * newsize parameter is the same as the old size. - * - * @param source Object - * @param newsize int - * @return Object - */ - public static Object resizeArray(Object source, int newsize) { - - Object newarray = - Array.newInstance(source.getClass().getComponentType(), newsize); - int oldsize = Array.getLength(source); - - if (oldsize < newsize) { - newsize = oldsize; - } - - System.arraycopy(source, 0, newarray, 0, newsize); - - return newarray; - } - - /** - * Returns a new array containing the elements of parameter source with an - * added element at the end. Parameter addition is an Object to add. - * - * @param type of array element - * @param source T[] - * @param addition element to append to array - * @return T[] - */ - public static T[] toAdjustedArray(T[] source, T addition) { - - int size = source.length; - T[] newArray = Arrays.copyOf(source, size + 1); - - newArray[size] = addition; - - return newArray; - } - - /** - * Returns an array containing the elements of parameter source, with one - * element removed or added. Parameter adjust {-1, +1} indicates the - * operation. Parameter colindex indicates the position at which an element - * is removed or added. Parameter addition is an Object to add when adjust - * is +1. - * - * @param source Object - * @param addition Object - * @param colindex int - * @param adjust int - * @return Object - */ - public static Object toAdjustedArray(Object source, Object addition, - int colindex, int adjust) { - - int newsize = Array.getLength(source) + adjust; - Object newarray = - Array.newInstance(source.getClass().getComponentType(), newsize); - - copyAdjustArray(source, newarray, addition, colindex, adjust); - - return newarray; - } - - /** - * Copies elements of source to dest. If adjust is -1 the element at - * colindex is not copied. If adjust is +1 that element is filled with the - * Object addition. All the rest of the elements in source are shifted left - * or right accordingly when they are copied. If adjust is 0 the addition is - * copied over the element at colindex. No checks are performed on array - * sizes and an exception is thrown if they are not consistent with the - * other arguments. - * - * @param source Object - * @param dest Object - * @param addition Object - * @param colindex int - * @param adjust int - */ - public static void copyAdjustArray(Object source, Object dest, - Object addition, int colindex, - int adjust) { - - int length = Array.getLength(source); - - if (colindex < 0) { - System.arraycopy(source, 0, dest, 0, length); - - return; - } - - System.arraycopy(source, 0, dest, 0, colindex); - - if (adjust == 0) { - int endcount = length - colindex - 1; - - Array.set(dest, colindex, addition); - - if (endcount > 0) { - System.arraycopy(source, colindex + 1, dest, colindex + 1, - endcount); - } - } else if (adjust < 0) { - int endcount = length - colindex - 1; - - if (endcount > 0) { - System.arraycopy(source, colindex + 1, dest, colindex, - endcount); - } - } else { - int endcount = length - colindex; - - Array.set(dest, colindex, addition); - - if (endcount > 0) { - System.arraycopy(source, colindex, dest, colindex + 1, - endcount); - } - } - } - - /** - * Similar to single slot adjusted copy, with multiple slots added or - * removed. The colindex array is the ordered lists the slots to be added or - * removed. The adjust argument can be {-1, +1) for remove or add. No checks - * are performed on array sizes and no exception is thrown if they are not - * consistent with the other arguments. - * - * @param source Object[] - * @param dest Object[] - * @param colindex int[] - * @param adjust int - */ - public static void copyAdjustArray(Object[] source, Object[] dest, - int[] colindex, int adjust) { - - if (adjust == 0) { - System.arraycopy(source, 0, dest, 0, source.length); - - return; - } - - for (int i = 0, j = 0, counter = 0; - i < source.length && j < dest.length; i++, j++) { - - if (counter < colindex.length) { - int adjustPos = colindex[counter]; - - if (adjust > 0) { - if (adjustPos == j) { - j++; - counter++; - } - } else { - if (adjustPos == i) { - i++; - counter++; - } - } - } - - dest[j] = source[i]; - } - } - - /** - * Returns a new array with the elements in collar adjusted to reflect - * changes at colindex.

    - * - * Each element in collarr represents an index into another array - * otherarr.

    - * - * colindex is the index at which an element is added or removed. - * Each element in the result array represents the new, - * adjusted index.

    - * - * For each element of collarr that represents an index equal to - * colindex and adjust is -1, the result will not contain that element - * and will be shorter than collar by one element. - * - * @param colarr the source array - * @param colindex index at which to perform adjustment - * @param adjust +1, 0 or -1 - * @return new, adjusted array - */ - public static int[] toAdjustedColumnArray(int[] colarr, int colindex, - int adjust) { - - if (colarr == null) { - return null; - } - - if (colindex < 0) { - return colarr; - } - - int[] intarr = new int[colarr.length]; - int j = 0; - - for (int i = 0; i < colarr.length; i++) { - if (colarr[i] > colindex) { - intarr[j] = colarr[i] + adjust; - - j++; - } else if (colarr[i] == colindex) { - if (adjust < 0) { - - // skip an element from colarr - } else { - intarr[j] = colarr[i] + adjust; - - j++; - } - } else { - intarr[j] = colarr[i]; - - j++; - } - } - - if (colarr.length != j) { - int[] newarr = new int[j]; - - copyArray(intarr, newarr, j); - - return newarr; - } - - return intarr; - } - - /** - * similar to the function with single colindex, but with multiple - * adjustments. - * - * @param colarr int[] - * @param colindex int[] - * @param adjust int - * @return int[] - */ - public static int[] toAdjustedColumnArray(int[] colarr, int[] colindex, - int adjust) { - - if (colarr == null) { - return null; - } - - int[] intarr = new int[colarr.length]; - - if (adjust == 0) { - for (int i = 0; i < colarr.length; i++) { - intarr[i] = colarr[i]; - } - } else if (adjust < 0) { - for (int i = 0; i < colarr.length; i++) { - int count = countSmallerElements(colindex, colarr[i]); - - intarr[i] = colarr[i] - count; - } - } else { - for (int i = 0; i < colarr.length; i++) { - int count = countSmallerEqualElements(colindex, colarr[i]); - - intarr[i] = colarr[i] + count; - } - } - - return intarr; - } - - /** - * Copies some elements of row into newRow by using columnMap as - * the list of indexes into row.

    - * - * columnMap and newRow are of equal length and are normally - * shorter than row.

    - * - * @param row the source array - * @param columnMap the list of indexes into row - * @param newRow the destination array - */ - public static void projectRow(Object[] row, int[] columnMap, - Object[] newRow) { - - for (int i = 0; i < columnMap.length; i++) { - newRow[i] = row[columnMap[i]]; - } - } - - public static void projectRow(int[] row, int[] columnMap, int[] newRow) { - - for (int i = 0; i < columnMap.length; i++) { - newRow[i] = row[columnMap[i]]; - } - } - - /** - * As above but copies in reverse direction.

    - * - * @param row the target array - * @param columnMap the list of indexes into row - * @param newRow the source array - */ - public static void projectRowReverse(Object[] row, int[] columnMap, - Object[] newRow) { - - for (int i = 0; i < columnMap.length; i++) { - row[columnMap[i]] = newRow[i]; - } - } - -/* - public static void copyColumnValues(int[] row, int[] colindex, - int[] colobject) { - - for (int i = 0; i < colindex.length; i++) { - colobject[i] = row[colindex[i]]; - } - } - - public static void copyColumnValues(boolean[] row, int[] colindex, - boolean[] colobject) { - - for (int i = 0; i < colindex.length; i++) { - colobject[i] = row[colindex[i]]; - } - } - - public static void copyColumnValues(byte[] row, int[] colindex, - byte[] colobject) { - - for (int i = 0; i < colindex.length; i++) { - colobject[i] = row[colindex[i]]; - } - } -*/ - public static void projectMap(int[] mainMap, int[] subMap, - int[] newSubMap) { - - for (int i = 0; i < subMap.length; i++) { - for (int j = 0; j < mainMap.length; j++) { - if (subMap[i] == mainMap[j]) { - newSubMap[i] = j; - - break; - } - } - } - } - - public static void reorderMaps(int[] mainMap, int[] firstMap, - int[] secondMap) { - - for (int i = 0; i < mainMap.length; i++) { - for (int j = i; j < firstMap.length; j++) { - if (mainMap[i] == firstMap[j]) { - int temp = firstMap[i]; - - firstMap[i] = firstMap[j]; - firstMap[j] = temp; - temp = secondMap[i]; - secondMap[i] = secondMap[j]; - secondMap[j] = temp; - - break; - } - } - } - } - - public static void fillSequence(int[] colindex) { - - for (int i = 0; i < colindex.length; i++) { - colindex[i] = i; - } - } - - public static char[] byteArrayToChars(byte[] bytes) { - return byteArrayToChars(bytes, bytes.length); - } - - public static char[] byteArrayToChars(byte[] bytes, int bytesLength) { - - char[] chars = new char[bytesLength / 2]; - - for (int i = 0, j = 0; j < chars.length; i += 2, j++) { - chars[j] = (char) ((bytes[i] << 8) + (bytes[i + 1] & 0xff)); - } - - return chars; - } - - public static byte[] charArrayToBytes(char[] chars) { - return charArrayToBytes(chars, chars.length); - } - - public static byte[] charArrayToBytes(char[] chars, int length) { - - byte[] bytes = new byte[length * 2]; - - for (int i = 0, j = 0; j < length; i += 2, j++) { - int c = chars[j]; - - bytes[i] = (byte) (c >> 8); - bytes[i + 1] = (byte) c; - } - - return bytes; - } - - /** - * Returns true if char argument is in array. - * - * @param ch char - * @param array char[] - * @return boolean - */ - public static boolean isInSortedArray(char ch, char[] array) { - - if (array.length == 0 || ch < array[0] - || ch > array[array.length - 1]) { - return false; - } - - int low = 0; - int high = array.length; - - while (low < high) { - int mid = (low + high) >>> 1; - - if (ch < array[mid]) { - high = mid; - } else if (ch > array[mid]) { - low = mid + 1; - } else { - return true; - } - } - - return false; - } - - /** - * returns true if arra contains all elements of arrb - * - * @param arra Object[] - * @param arrb Object[] - * @return boolean - */ - public static boolean containsAll(Object[] arra, Object[] arrb) { - - mainLoop: - for (int i = 0; i < arrb.length; i++) { - for (int j = 0; j < arra.length; j++) { - if (arrb[i] == arra[j] || arrb[i].equals(arra[j])) { - continue mainLoop; - } - } - - return false; - } - - return true; - } - - /** - * returns true if arra contains any element of arrb - * - * @param arra Object[] - * @param arrb Object[] - * @return boolean - */ - public static boolean containsAny(Object[] arra, Object[] arrb) { - - for (int i = 0; i < arrb.length; i++) { - for (int j = 0; j < arra.length; j++) { - if (arrb[i] == arra[j] || arrb[i].equals(arra[j])) { - return true; - } - } - } - - return false; - } - - /** - * returns true if arra contains all elements of arrb - * - * @param arra int[] - * @param arrb int[] - * @return boolean - */ - public static boolean containsAll(int[] arra, int[] arrb) { - - mainLoop: - for (int i = 0; i < arrb.length; i++) { - for (int j = 0; j < arra.length; j++) { - if (arrb[i] == arra[j]) { - continue mainLoop; - } - } - - return false; - } - - return true; - } - - /** - * returns true if arra contains all elements of arrb at its start - * - * @param arra int[] - * @param arrb int[] - * @return boolean - */ - public static boolean containsAllAtStart(int[] arra, int[] arrb) { - - if (arrb.length > arra.length) { - return false; - } - - mainLoop: - for (int i = 0; i < arra.length; i++) { - if (i == arrb.length) { - return true; - } - - for (int j = 0; j < arrb.length; j++) { - if (arra[i] == arrb[j]) { - continue mainLoop; - } - } - - return false; - } - - return true; - } - - /** - * converts two longs to a byte[] - * - * @param hi long - * @param lo long - * @return byte[] - */ - public static byte[] toByteArray(long hi, long lo) { - - byte[] bytes = new byte[16]; - int count = 0; - int v; - - while (count < 16) { - if (count == 0) { - v = (int) (hi >>> 32); - } else if (count == 4) { - v = (int) hi; - } else if (count == 8) { - v = (int) (lo >>> 32); - } else { - v = (int) lo; - } - - bytes[count++] = (byte) (v >>> 24); - bytes[count++] = (byte) (v >>> 16); - bytes[count++] = (byte) (v >>> 8); - bytes[count++] = (byte) v; - } - - return bytes; - } - - public static long byteSequenceToLong(byte[] bytes, int pos) { - - long val = 0; - - for (int i = 0; i < 8; i++) { - long b = bytes[pos + i] & 0xff; - - val += (b << ((7 - i) * 8)); - } - - return val; - } - - /** - * Compares two arrays. Returns -1, 0, +1. If one array is shorter and all - * the elements are equal to the other's elements, -1 is returned. - * - * @param a byte[] - * @param b byte[] - * @return int - */ - public static int compare(byte[] a, byte[] b) { - return compare(a, 0, a.length, b, 0, b.length); - } - - public static int compare(byte[] a, int aOffset, int aLength, byte[] b, - int bOffset, int bLength) { - - int length = aLength; - - if (length > bLength) { - length = bLength; - } - - for (int i = 0; i < length; i++) { - if (a[aOffset + i] == b[bOffset + i]) { - continue; - } - - return (((int) a[aOffset + i]) & 0xff) - > (((int) b[bOffset + i]) & 0xff) ? 1 - : -1; - } - - if (aLength == bLength) { - return 0; - } - - return aLength < bLength ? -1 - : 1; - } - - /** - * uses 2**scale form and returns a multiple of unit that is larger or equal - * to value - * - * @param value long - * @param unit long - * @return long - */ - public static long getBinaryMultipleCeiling(long value, long unit) { - - long newSize = value & -unit; - - if (newSize != value) { - newSize += unit; - } - - return newSize; - } - - /** - * uses 2**scale form and returns a multiple of this that is larger or equal - * to value - * - * @param value long - * @param scale int - * @return long - */ - public static long getBinaryNormalisedCeiling(long value, int scale) { - - long mask = 0xffffffffffffffffL << scale; - long newSize = value & mask; - - if (newSize != value) { - newSize = newSize + (1L << scale); - } - - return newSize; - } - - /** - * returns the smallest value that is a power of 2 and larger or equal to - * value - * - * @param value long - * @return long - */ - public static long getBinaryNormalisedCeiling(long value) { - - long newSize = 2; - - while (newSize < value) { - newSize <<= 1; - } - - return newSize; - } - - /** - * returns true if log2 n is in the range (0, max) - * - * @param n int - * @param max int - * @return boolean - */ - public static boolean isTwoPower(int n, int max) { - - for (int i = 0; i <= max; i++) { - if ((n & 1) != 0) { - return n == 1; - } - - n >>= 1; - } - - return false; - } - - /** - * returns the largest value that is 0 or a power of 2 and is smaller or - * equal to n - * - * @param n int - * @return int - */ - public static int getTwoPowerFloor(int n) { - - int shift = getTwoPowerScale(n); - - if (shift == 0) { - return 0; - } - - return 1 << shift; - } - - /** - * returns the log2 of largest value that is 0 or a power of 2 and is - * smaller or equal to n - * - * @param n int - * @return int - */ - public static int getTwoPowerScale(int n) { - - int shift = 0; - - if (n == 0) { - return 0; - } - - for (int i = 0; i < 32; i++) { - if ((n & 1) != 0) { - shift = i; - } - - n >>= 1; - } - - return shift; - } - - /** - * a and b must be both positive returns (a / b) or (a / b) + 1 if remainder - * is larger than zero - * - * @param a int - * @param b int - * @return int - */ - public static int cdiv(int a, int b) { - - int c = a / b; - - if (a % b != 0) { - c++; - } - - return c; - } - - public static long cdiv(long a, long b) { - - long c = a / b; - - if (a % b != 0) { - c++; - } - - return c; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/AsciiInputStream.java b/database/hsqldb/src/org/hsqldb/lib/AsciiInputStream.java deleted file mode 100644 index 9f6cb7bf..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/AsciiInputStream.java +++ /dev/null @@ -1,132 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.util.Objects; - -/** - * An input stream that reads US-ASCII values from a Reader, in compliance - * with the Java US_ASCII Charset encoder, including - * - * utf-16-surrogate-pairs. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.1 - * @since 2.7.1 - */ -public class AsciiInputStream extends InputStream { - - /** - * is 7; - */ - public static final int ASCII_BITS = 7; - /** - * is 0b01111111 - */ - public static final int ASCII_MASK = 0b01111111; - /** - * is 2^7 - 1 (127) - */ - public static final int ASCII_MAX = 127; - /** - * is 2^7 (128) - */ - public static final int NON_ASCII_MIN = 128; - /** - * is '?' - */ - public static final int NON_ASCII_REPLACEMENT = '?'; - - private boolean hasNextChar = false; - private int nextChar = 0; - private final Reader reader; - - /** - * Constructs a new instance for the given reader. - * - * @param reader from which to read - */ - public AsciiInputStream(final Reader reader) { - this.reader = Objects.requireNonNull(reader, "reader must not be null"); - } - - @Override - public void close() throws IOException { - reader.close(); - } - - /** - * Reads the next byte of data from the input stream. The value byte is - * returned as an int in the range 0 to - * {@link #ASCII_MAX}. If no byte is available because the end of the stream - * has been reached, the value -1 is returned. This method - * blocks until input data is available, the end of the stream is detected, - * or an exception is thrown. - *

    - * UTF-16 characters above {@link #ASCII_MAX} produce a - * {@link #NON_ASCII_REPLACEMENT} value when read. - *

    - * Surrogate pairs are correctly counted as a single character and produce a - * single {@link #NON_ASCII_REPLACEMENT} value when read. - * - * @return the next byte of data, or -1 if the end of the - * stream is reached. - * @exception IOException if an I/O error occurs. - */ - public synchronized int read() throws IOException { - if (hasNextChar) { - hasNextChar = false; - return nextChar; - } - - final int c = reader.read(); - - if (c < 0) { - return -1; - } - - if (Character.isHighSurrogate((char) c)) { - final int nc = reader.read(); - hasNextChar = !Character.isLowSurrogate((char) nc); - if (hasNextChar) { - nextChar = nc < NON_ASCII_MIN - ? nc & ASCII_MASK - : NON_ASCII_REPLACEMENT; - } - } - - return c < NON_ASCII_MIN - ? c & ASCII_MASK - : NON_ASCII_REPLACEMENT; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/AsciiOutputStream.java b/database/hsqldb/src/org/hsqldb/lib/AsciiOutputStream.java deleted file mode 100644 index d471c6ba..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/AsciiOutputStream.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; -import java.util.Objects; - -/** - * An OutputStream that writes 7-bit US-ASCII values to a Writer, in compliance - * with the Java US_ASCII Charset decoder. - *

    - * In particular, values greater than {@link #ASCII_MAX) are written as - * {@link #NON_ASCII_REPLACEMENT}. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.1 - * @since 2.7.1 - */ -public class AsciiOutputStream extends OutputStream { - - /** - * is 7; - */ - public static final int ASCII_BITS = 7; - /** - * is 0b01111111 - */ - public static final int ASCII_MASK = 0b01111111; - /** - * is 2^7 - 1 (127) - */ - public static final int ASCII_MAX = 127; - /** - * is 2^7 (128) - */ - public static final int NON_ASCII_MIN = 128; - /** - * is '\uFFFD' (65533), the Unicode replacement character. - * - * @see https://www.fileformat.info/info/unicode/char/fffd/index.htm - */ - public static final int NON_ASCII_REPLACEMENT = '\uFFFD'; - - private final Writer writer; - - public AsciiOutputStream(Writer writer) { - this.writer = Objects.requireNonNull(writer, "writer must not be null."); - } - - @Override - public void close() throws IOException { - writer.close(); - } - - @Override - public void flush() throws IOException { - writer.flush(); - } - - @Override - public void write(int b) throws IOException { - writer.write(b < NON_ASCII_MIN ? b & ASCII_MASK : NON_ASCII_REPLACEMENT); - } - -} diff --git a/database/hsqldb/src/org/hsqldb/lib/BaseList.java b/database/hsqldb/src/org/hsqldb/lib/BaseList.java deleted file mode 100644 index c6d694c2..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/BaseList.java +++ /dev/null @@ -1,207 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -/** - * Abstract base for Lists - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.0 - */ -abstract class BaseList { - - protected ObjectComparator comparator = ObjectComparator.defaultComparator; - - protected int elementCount; - - public abstract E get(int index); - - public abstract E remove(int index); - - public abstract boolean add(E element); - - public abstract int size(); - - public boolean contains(Object element) { - - for (int i = 0, size = size(); i < size; i++) { - Object current = get(i); - - if (comparator.equals(current, element)) { - return true; - } - } - return false; - } - - public boolean remove(Object element) { - - for (int i = 0, size = size(); i < size; i++) { - Object current = get(i); - - if (comparator.equals(current, element)) { - remove(i); - - return true; - } - } - - return false; - } - - public int indexOf(E element) { - - for (int i = 0, size = size(); i < size; i++) { - Object current = get(i); - - if (comparator.equals(current, element)) { - return i; - } - } - - return -1; - } - - public boolean addAll(Collection other) { - - boolean result = false; - Iterator it = other.iterator(); - - while (it.hasNext()) { - result = true; - - add(it.next()); - } - - return result; - } - - public boolean addAll(E[] array) { - - boolean result = false; - for ( E object : array ) { - result = true; - - add(object); - } - - return result; - } - - public boolean isEmpty() { - return elementCount == 0; - } - - public String toString() { - - StringBuilder sb = new StringBuilder(32 + elementCount * 3); - - sb.append("List : size="); - sb.append(elementCount); - sb.append(' '); - sb.append('{'); - - Iterator it = iterator(); - - while (it.hasNext()) { - sb.append(it.next()); - - if (it.hasNext()) { - sb.append(','); - sb.append(' '); - } - } - - sb.append('}'); - - return sb.toString(); - } - - public Iterator iterator() { - return new BaseListIterator(); - } - - private class BaseListIterator implements Iterator { - - int counter = 0; - boolean removed; - - public boolean hasNext() { - return counter < elementCount; - } - - public E next() { - - if (counter < elementCount) { - removed = false; - - E returnValue = get(counter); - - counter++; - - return returnValue; - } - - throw new NoSuchElementException(); - } - - public int nextInt() { - throw new NoSuchElementException(); - } - - public long nextLong() { - throw new NoSuchElementException(); - } - - public void remove() { - - if (removed) { - throw new NoSuchElementException("Iterator"); - } - - removed = true; - - if (counter != 0) { - BaseList.this.remove(counter - 1); - - counter--; // above can throw, so decrement if successful - - return; - } - - throw new NoSuchElementException(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/BasicTextJdkLogFormatter.java b/database/hsqldb/src/org/hsqldb/lib/BasicTextJdkLogFormatter.java deleted file mode 100644 index 3398f5af..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/BasicTextJdkLogFormatter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.logging.Formatter; -import java.util.logging.LogRecord; - -/** - * An implementation of java.util.logging.Formatter very close to - * SimpleFormatter. - * - * The features here are optional timestamping, sortable numeric time stamp - * text, and no indication of invoking source code location (logger ID, - * class name, method name, etc.). - * - * @see Formatter - * @see java.util.logging.SimpleFormatter - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ -public class BasicTextJdkLogFormatter extends Formatter { - public static final String LS = System.getProperty("line.separator"); - protected boolean withTime = true; - - protected SimpleDateFormat sdf = - new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); - - - public BasicTextJdkLogFormatter(boolean withTime) { - this.withTime = withTime; - } - - public BasicTextJdkLogFormatter() { - // Intentionally empty - } - - public String format(LogRecord record) { - StringBuilder sb = new StringBuilder(); - if (withTime) { - sb.append(sdf.format(new Date(record.getMillis())) + " "); - } - sb.append(record.getLevel() + " " + formatMessage(record)); - if (record.getThrown() != null) { - StringWriter sw = new StringWriter(); - record.getThrown().printStackTrace(new PrintWriter(sw)); - sb.append(LS + sw); - } - return sb.toString() + LS; - // This uses platform-specific line-separator, the same as - // SimpleLogger does. - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/CharArrayWriter.java b/database/hsqldb/src/org/hsqldb/lib/CharArrayWriter.java deleted file mode 100644 index cc6b5984..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/CharArrayWriter.java +++ /dev/null @@ -1,185 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.EOFException; -import java.io.IOException; -import java.io.Reader; - -/** - * A writer for char strings. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 1.9.0 - */ -public class CharArrayWriter { - - protected char[] buffer; - protected int count; - - public CharArrayWriter(int size) { - this.buffer = new char[size]; - } - - public CharArrayWriter(char[] buffer) { - this.buffer = buffer; - } - - public CharArrayWriter(Reader reader, int length) throws IOException { - - buffer = new char[length]; - - for (int left = length; left > 0; ) { - int read = reader.read(buffer, count, left); - - if (read == -1) { - reader.close(); - throw new EOFException(); - } - - left -= read; - count += read; - } - } - - public CharArrayWriter(Reader reader) throws IOException { - - buffer = new char[128]; - - for (;;) { - int read = reader.read(buffer, count, buffer.length - count); - - if (read == -1) { - break; - } - - count += read; - - if (count == buffer.length) { - ensureRoom(count * 2); - } - } - } - - public void write(int c) { - - if (count == buffer.length) { - ensureRoom(count + 1); - } - - buffer[count++] = (char) c; - } - - public int write(Reader reader, int length) throws IOException { - - int left = length; - - while (left > 0) { - int read = reader.read(buffer, count, left); - - if (read == -1) { - break; - } - - left -= read; - count += read; - } - - return length - left; - } - - void ensureRoom(int size) { - - if (size <= buffer.length) { - return; - } - - int newSize = buffer.length; - - while (newSize < size) { - newSize *= 2; - } - - char[] newBuffer = new char[newSize]; - - System.arraycopy(buffer, 0, newBuffer, 0, count); - - buffer = newBuffer; - } - - public void write(String str, int off, int len) { - - ensureRoom(count + len); - str.getChars(off, off + len, buffer, count); - - count += len; - } - - public void reset() { - count = 0; - } - - public void reset(char[] buffer) { - count = 0; - this.buffer = buffer; - } - - public char[] toCharArray() { - - char[] newBuffer = new char[count]; - - System.arraycopy(buffer, 0, newBuffer, 0, count); - - return newBuffer; - } - - public char[] getBuffer() { - return buffer; - } - - public int size() { - return count; - } - - public void setSize(int newPos) { - if (newPos > buffer.length) { - throw new ArrayIndexOutOfBoundsException(); - } - - count = newPos; - } - - public String toString() { - return new String(buffer, 0, count); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ClosableByteArrayOutputStream.java b/database/hsqldb/src/org/hsqldb/lib/ClosableByteArrayOutputStream.java deleted file mode 100644 index 7e5e1e6d..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ClosableByteArrayOutputStream.java +++ /dev/null @@ -1,449 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; - -/* $Id: ClosableByteArrayOutputStream.java 6299 2021-02-09 17:10:48Z fredt $ */ - -/* - * @todo - finer-grained synchronization to reduce average - * potential monitor contention - */ - -/** - * Provides true Closable semantics ordinarily missing in a - * {@link java.io.ByteArrayOutputStream}.

    - * - * Accumulates output in a byte array that automatically grows as needed.

    - * - * Data is retrieved using {@code toByteArray()}, - * {@code toByteArrayInputStream()}, {@code toString()} and - * {@code toString(encoding)}.

    - * - * {@link #close() Closing} a {@code ClosableByteArrayOutputStream} prevents - * further write operations, but all other operations may succeed until after - * the first invocation of {@link #free() free()}.

    - * - * Freeing a {@code ClosableByteArrayOutputStream} closes the stream and - * releases the internal buffer, preventing successful invocation of all - * operations, with the exception of {@code size()}, {@code close()}, - * {@code isClosed()}, {@code free()} and {@code isFreed()}.

    - * - * This class is especially useful when an accumulating output stream must be - * handed off to an external client under contract that the stream should - * exhibit true Closable behaviour in response both to internally tracked - * events and to client invocation of the {@code OutputStream.close()} method. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.9.0 - */ -public class ClosableByteArrayOutputStream extends OutputStream { - - /** - * Data buffer. - */ - protected byte[] buf; - - /** - * # of valid bytes in buffer. - */ - protected int count; - - /** - * Whether this stream is closed. - */ - protected boolean closed; - - /** - * Whether this stream is freed. - */ - protected boolean freed; - - /** - * Creates a new output stream.

    - * - * The buffer capacity is initially 32 bytes, though its size increases - * if necessary. - */ - public ClosableByteArrayOutputStream() { - this(32); - } - - /** - * Creates a new output stream with a buffer capacity of the specified - * {@code size}, in bytes. - * - * @param size the initial size. - * @exception IllegalArgumentException if size is negative. - */ - public ClosableByteArrayOutputStream(int size) - throws IllegalArgumentException { - - if (size < 0) { - throw new IllegalArgumentException("Negative initial size: " - + size); // NOI18N - } - - buf = new byte[size]; - } - - /** - * Writes the specified single byte. - * - * @param b the single byte to be written. - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #close() closed}. - */ - public synchronized void write(int b) throws IOException { - - checkClosed(); - - int newcount = count + 1; - - if (newcount > buf.length) { - buf = copyOf(buf, Math.max(buf.length << 1, newcount)); - } - - buf[count] = (byte) b; - count = newcount; - } - - /** - * Writes the specified portion of the designated octet sequence.

    - * - * @param b the data. - * @param off the start offset in the data. - * @param len the number of bytes to write. - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #close() closed}. - */ - public synchronized void write(byte[] b, int off, - int len) throws IOException { - - checkClosed(); - - if ((off < 0) || (off > b.length) || (len < 0) - || ((off + len) > b.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return; - } - - int newcount = count + len; - - if (newcount > buf.length) { - buf = copyOf(buf, Math.max(buf.length << 1, newcount)); - } - - System.arraycopy(b, off, buf, count, len); - - count = newcount; - } - - /** - * By default, does nothing.

    - * - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #close() closed}. - */ - public void flush() throws IOException { - checkClosed(); - } - - /** - * Writes the complete contents of this stream's accumulated data to the - * specified output stream.

    - * - * The operation occurs as if by calling {@code out.write(buf, 0, count)}. - * - * @param out the output stream to which to write the data. - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #free() freed}. - */ - public synchronized void writeTo(OutputStream out) throws IOException { - checkFreed(); - out.write(buf, 0, count); - } - - /** - * Returns the current capacity of this stream's data buffer. - * - * @return the length of the internal data array - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #free() freed}. - */ - public synchronized int capacity() throws IOException { - - checkFreed(); - - return buf.length; - } - - /** - * Resets the {@code count} field of this output stream to zero, so that - * all currently accumulated data is effectively discarded.

    - * - * Further write operations will reuse the allocated buffer space.

    - * - * @see #count - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #close() closed}. - */ - public synchronized void reset() throws IOException { - - checkClosed(); - - count = 0; - } - - /** - * Attempts to reduce this stream's capacity to its current size.

    - * - * If the data buffer is larger than necessary to hold its current sequence - * of bytes, then it may be resized to become more space efficient. - * Calling this method may, but is not required to, affect the value - * returned by a subsequent call to the {@link #capacity()} method.

    - * - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #free() freed}. - */ - public synchronized void trimToSize() throws IOException { - - checkFreed(); - - if (buf.length > count) { - buf = copyOf(buf, count); - } - } - - /** - * Retrieves a copy of this stream's accumulated data, as a byte array. - * - * @return a copy of this stream's accumulated data, as a byte array. - * @see #size() - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #free() freed}. - */ - public synchronized byte[] toByteArray() throws IOException { - - checkFreed(); - - return copyOf(buf, count); - } - - /** - * Returns the current size of this stream's accumulated data. - * - * @return the value of the {@code count} field, which is the number - * of valid bytes in this output stream. - * @see #count - */ - public synchronized int size() { - return count; - } - - /** - * Sets the size of this stream's accumulated data.

    - * - * @param newSize the new size - * @throws ArrayIndexOutOfBoundsException if new size is negative - */ - public synchronized void setSize(int newSize) { - - if (newSize < 0) { - throw new ArrayIndexOutOfBoundsException(newSize); - } else if (newSize > buf.length) { - buf = copyOf(buf, Math.max(buf.length << 1, newSize)); - } - - count = newSize; - } - - /** - * Performs an efficient (zero-copy) conversion of the data accumulated in - * this output stream to an input stream.

    - * - * To ensure the future integrity of the resulting input stream, {@link - * #free() free} is invoked upon this output stream as a side-effect. - * - * @return an input stream representing this output stream's accumulated - * data - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #free() freed}. - */ - public synchronized ByteArrayInputStream toByteArrayInputStream() - throws IOException { - - checkFreed(); - - ByteArrayInputStream inputStream = new ByteArrayInputStream(buf, 0, - count); - - free(); - - return inputStream; - } - - /** - * Converts this stream's accumulated data into a string, translating bytes - * into characters according to the platform's default character encoding. - * - * @return String translated from this stream's accumulated data. - * @throws RuntimeException may be thrown if this output stream has been - * {@link #free() freed}. - */ - public synchronized String toString() { - - try { - checkFreed(); - } catch (IOException ex) { - throw new RuntimeException(ex.toString()); - } - - return new String(buf, 0, count); - } - - /** - * Converts this stream's accumulated data into a string, translating bytes - * into characters according to the specified character encoding. - * - * @return String translated from the buffer's contents. - * @param enc a character-encoding name. - * @throws java.io.IOException may be thrown if this output stream has been - * {@link #free() freed}. - * @throws UnsupportedEncodingException If the named encoding is not - * supported. - */ - public synchronized String toString(String enc) - throws IOException, UnsupportedEncodingException { - - checkFreed(); - - return new String(buf, 0, count, enc); - } - - /** - * Closes this object for further writing.

    - * - * Other operations may continue to succeed until after the first invocation - * of {@link #free() free()}. - */ - public synchronized void close() { - closed = true; - } - - /** - * Retrieves whether this stream is closed.

    - * @return {@code true} if this stream is closed, else {@code false} - */ - public synchronized boolean isClosed() { - return closed; - } - - /** - * Closes this object and releases the underlying buffer for - * garbage collection. - */ - public synchronized void free() { - - closed = true; - freed = true; - buf = null; - count = 0; - } - - /** - * Retrieves whether this stream is freed.

    - * - * @return {@code true} if this stream is freed; else {@code false}. - */ - public synchronized boolean isFreed() { - return freed; - } - - /** - * Tests whether this stream is closed.

    - * - * @throws java.io.IOException if this stream is closed. - */ - protected synchronized void checkClosed() throws IOException { - - if (closed) { - - throw new IOException("stream is closed."); // NOI18N - } - } - - /** - * Tests whether this stream is freed.

    - * - * @throws java.io.IOException if this stream is freed. - */ - protected synchronized void checkFreed() throws IOException { - - if (freed) { - throw new IOException("stream buffer is freed."); // NOI18N - } - } - - /** - * Retrieves a copy of {@code original} with the given - * {@code newLength}.

    - * - * @param original the object to copy - * @param newLength the length of the copy - * @return copy of {@code original} with the given {@code newLength} - */ - protected byte[] copyOf(byte[] original, int newLength) { - - byte[] copy = new byte[newLength]; - - System.arraycopy(original, 0, copy, 0, - Math.min(original.length, newLength)); - - return copy; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ClosableCharArrayWriter.java b/database/hsqldb/src/org/hsqldb/lib/ClosableCharArrayWriter.java deleted file mode 100644 index eaaa47b3..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ClosableCharArrayWriter.java +++ /dev/null @@ -1,458 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.CharArrayReader; -import java.io.IOException; -import java.io.Writer; - -/* - * @todo - finer-grained synchronization to reduce average - * potential monitor contention - */ - -/** - * Provides Closable semantics ordinarily missing in a - * {@link java.io.CharArrayWriter}.

    - * - * Accumulates output in a character array that automatically grows as needed.

    - * - * Data is retrieved using {@code toCharArray()}, {@code toCharArrayReader()} - * and {@code toString()}.

    - * - * {@link #close() Closing} a {@code ClosableCharArrayWriter} prevents - * further write operations, but all other operations will succeed until after - * the first invocation of {@link #free() free()}.

    - * - * Freeing a {@code ClosableCharArrayWriter} closes the writer and - * releases its internal buffer, preventing successful invocation of all - * operations, with the exception of {@code size()}, {@code close()}, - * {@code isClosed()}, {@code free()} and {@code isFreed()}.

    - * - * This class is especially useful when an accumulating writer must be - * handed off to an extenal client under contract that the writer should - * exhibit true Closable behaviour, both in response to internally tracked - * events and to client invocation of the {@code Writer.close()} method. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.8.x - * @since 1.8.x - */ -public class ClosableCharArrayWriter extends Writer { - - /** - * Data buffer. - */ - protected char[] buf; - - /** - * # of valid characters in buffer. - */ - protected int count; - - /** - * Whether this writer is closed. - */ - protected boolean closed; - - /** - * Whether this writer is freed. - */ - protected boolean freed; - - /** - * Creates a new writer.

    - * - * The buffer capacity is initially 32 characters, although its size - * automatically increases when necessary. - */ - public ClosableCharArrayWriter() { - this(32); - } - - /** - * Creates a new writer with a buffer capacity of the specified - * {@code size}, in characters. - * - * @param size the initial size. - * @exception IllegalArgumentException if {@code size} is negative. - */ - public ClosableCharArrayWriter(int size) throws IllegalArgumentException { - - if (size < 0) { - throw new IllegalArgumentException("Negative initial size: " - + size); // NOI18N - } - - buf = new char[size]; - } - - /** - * Writes the specified single character. - * - * @param c the single character to be written. - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #close() closed}. - */ - public synchronized void write(int c) throws IOException { - - checkClosed(); - - int newcount = count + 1; - - if (newcount > buf.length) { - buf = copyOf(buf, Math.max(buf.length << 1, newcount)); - } - - buf[count] = (char) c; - count = newcount; - } - - /** - * Writes the designated portion of the designated character array

    . - * - * @param c the source character sequence. - * @param off the start offset in the source character sequence. - * @param len the number of characters to write. - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #close() closed}. - */ - public synchronized void write(char[] c, int off, - int len) throws IOException { - - checkClosed(); - - if ((off < 0) || (off > c.length) || (len < 0) - || ((off + len) > c.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return; - } - - int newcount = count + len; - - if (newcount > buf.length) { - buf = copyOf(buf, Math.max(buf.length << 1, newcount)); - } - - System.arraycopy(c, off, buf, count, len); - - count = newcount; - } - - /** - * Efficiently writes the designated portion of the designated string.

    - * - * The operation occurs as if by calling - * {@code str.getChars(off, off + len, buf, count)}.

    - * - * @param str the string from which to write - * @param off the start offset in the string. - * @param len the number of characters to write. - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #close() closed}. - */ - public synchronized void write(String str, int off, - int len) throws IOException { - - checkClosed(); - - int strlen = str.length(); - - if ((off < 0) || (off > strlen) || (len < 0) || ((off + len) > strlen) - || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return; - } - - int newcount = count + len; - - if (newcount > buf.length) { - buf = copyOf(buf, Math.max(buf.length << 1, newcount)); - } - - str.getChars(off, off + len, buf, count); - - count = newcount; - } - - /** - * By default, does nothing.

    - * - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #close() closed}. - */ - public void flush() throws IOException { - checkClosed(); - } - - /** - * Writes the complete contents of this writer's buffered data to the - * specified writer.

    - * - * The operation occurs as if by calling {@code out.write(buf, 0, count)}. - * - * @param out the writer to which to write the data. - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #free() freed}. - */ - public synchronized void writeTo(Writer out) throws IOException { - - checkFreed(); - - if (count > 0) { - out.write(buf, 0, count); - } - } - - /** - * Returns the current capacity of this writer's data buffer. - * - * @return the current capacity (the length of the internal - * data array) - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #free() freed}. - */ - public synchronized int capacity() throws IOException { - - checkFreed(); - - return buf.length; - } - - /** - * Resets the {@code count} field of this writer to zero, so that all - * currently accumulated output is effectively discarded. Further write - * operations will reuse the allocated buffer space. - * - * @see #count - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this output stream has been {@link #close() closed}. - */ - public synchronized void reset() throws IOException { - - checkClosed(); - - count = 0; - } - - /** - * Attempts to reduce this writer's buffer capacity to its current size.

    - * - * If the buffer is larger than necessary to hold its current sequence of - * characters, then it may be resized to become more space efficient. - * Calling this method may, but is not required to, affect the value - * returned by a subsequent call to the {@link #capacity()} method. - * - * @throws IOException if buffer is freed - */ - public synchronized void trimToSize() throws IOException { - - checkFreed(); - - if (buf.length > count) { - buf = copyOf(buf, count); - } - } - - /** - * Creates a newly allocated character array. Its size is the current - * size of this writer and the valid contents of the buffer - * have been copied into it. - * - * @return the current contents of this writer, as a character array. - * @see #size() - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #free() freed}. - */ - public synchronized char[] toCharArray() throws IOException { - - checkFreed(); - - return copyOf(buf, count); - } - - /** - * Returns the current size of this writer's accumulated character data. - * - * @return the value of the {@code count} field, which is the number - * of valid characters accumulated in this writer. - * @see #count - */ - public synchronized int size() { - return count; - } - - /** - * Sets the size of this writer's accumulated character data.

    - * - * @param newSize the new size of this writer's accumulated data - * @throws ArrayIndexOutOfBoundsException if new size is negative - */ - public synchronized void setSize(int newSize) { - - if (newSize < 0) { - throw new ArrayIndexOutOfBoundsException(newSize); - } else if (newSize > buf.length) { - buf = copyOf(buf, Math.max(buf.length << 1, newSize)); - } - - count = newSize; - } - - /** - * Performs an efficient (zero-copy) conversion of the character data - * accumulated in this writer to a reader.

    - * - * To ensure the integrity of the resulting reader, {@link #free() - * free} is invoked upon this writer as a side-effect. - * - * @return a reader representing this writer's accumulated - * character data - * @throws java.io.IOException if an I/O error occurs. - * In particular, an {@code IOException} may be thrown - * if this writer has been {@link #free() freed}. - */ - public synchronized CharArrayReader toCharArrayReader() - throws IOException { - - checkFreed(); - - CharArrayReader reader = new CharArrayReader(buf, 0, count); - - //System.out.println("toCharArrayReader::buf.length: " + buf.length); - free(); - - return reader; - } - - /** - * Converts this writer's accumulated data into a string. - * - * @return String constructed from this writer's accumulated data - * @throws RuntimeException may be thrown if this writer has been - * {@link #free() freed}. - */ - public synchronized String toString() { - - try { - checkFreed(); - } catch (IOException ex) { - throw new RuntimeException(ex.toString()); - } - - return new String(buf, 0, count); - } - - /** - * Closes this object for further writing.

    - * - * Other operations may continue to succeed until after the first invocation - * of {@link #free() free()}. - */ - public synchronized void close() { - closed = true; - } - - /** - * @return {@code true} if this writer is closed, else {@code false} - */ - public synchronized boolean isClosed() { - return closed; - } - - /** - * Closes this object and releases the underlying buffer for - * garbage collection. - */ - public synchronized void free() { - - closed = true; - freed = true; - buf = null; - count = 0; - } - - /** - * @return {@code true} if this writer is freed; else {@code false}. - */ - public synchronized boolean isFreed() { - return freed; - } - - /** - * @throws java.io.IOException if this writer is closed. - */ - protected synchronized void checkClosed() throws IOException { - - if (closed) { - throw new IOException("writer is closed."); // NOI18N - } - } - - /** - * @throws java.io.IOException if this writer is freed. - */ - protected synchronized void checkFreed() throws IOException { - - if (freed) { - throw new IOException("write buffer is freed."); // NOI18N - } - } - - /** - * Retrieves a copy of {@code original} with the given - * {@code newLength}.

    - * - * @param original the object to copy - * @param newLength the length of the copy - * @return copy of {@code original} with the given {@code newLength} - */ - protected char[] copyOf(char[] original, int newLength) { - - char[] copy = new char[newLength]; - - System.arraycopy(original, 0, copy, 0, - Math.min(original.length, newLength)); - - return copy; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/Collection.java b/database/hsqldb/src/org/hsqldb/lib/Collection.java deleted file mode 100644 index 7ce6c04f..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/Collection.java +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * A basic collection of values. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public interface Collection { - - int size(); - - boolean isEmpty(); - - boolean contains(Object o); - - Iterator iterator(); - - boolean add(E o); - - boolean remove(Object o); - - boolean addAll(Collection c); - - void clear(); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/CountUpDownLatch.java b/database/hsqldb/src/org/hsqldb/lib/CountUpDownLatch.java deleted file mode 100644 index efd64d36..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/CountUpDownLatch.java +++ /dev/null @@ -1,493 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.AbstractQueuedSynchronizer; - -/** - * A variation on {@link java.util.concurrent.CountDownLatch} to allow counting up as well - * as down. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.5.0 - */ -public class CountUpDownLatch { - - private final Sync sync; - - /** - * Default constructor. - *

    - * Equivalent to {@code new} - * {@link CountUpDownLatch(int) CountUpDownLatch}{@code (0)} - */ - public CountUpDownLatch() { - this(0); - } - - /** - * Constructs a new {@code CountUpDownLatch} initialized with the given - * {@code initialCount}. - * - * @param initialCount the initial {@code count} - * @throws IllegalArgumentException if {@code initialCount} is negative - */ - public CountUpDownLatch(int initialCount) { - - if (initialCount < 0) { - throw new IllegalArgumentException("count < 0"); - } - - this.sync = new Sync(initialCount); - } - - /** - * Causes the current thread to wait until {@code count} reaches zero, - * unless the thread is {@linkplain Thread#interrupt interrupted}. - *

    - * If the current {@code count} is already zero, then this method returns - * immediately. - *

    - * If the current {@code count} is greater than zero, then the current - * thread becomes disabled for thread scheduling purposes and lies dormant - * until either: - *

      - *
    • The count reaches zero due an invocation of {@link #countDown() - * countDown()}, {@link #countDown(int) countDown(int}}, or {@link - * #setCount(int) setCount(int)}. - *
    • Some other thread {@linkplain Thread#interrupt interrupts} the - * current thread. - *
    - * If the current thread: - *
      - *
    • has its interrupted status set on entry to this method; or - *
    • is {@linkplain Thread#interrupt interrupted} while waiting, - *
    - * then {@link InterruptedException} is thrown and the current thread's - * interrupted status is cleared. - * - * @throws InterruptedException if the current thread is interrupted - * while waiting - */ - public void await() throws InterruptedException { - sync.acquireSharedInterruptibly(1); - } - - /** - * Causes the current thread to wait until {@code count} reaches zero, - * unless the thread is {@linkplain Thread#interrupt interrupted}, or the - * specified waiting time elapses. - *

    - * If the current {@code count} is zero, then this method returns - * immediately with the value {@code true}. - *

    - * If the current {@code count} is greater than zero, then the current - * thread becomes disabled for thread scheduling purposes and lies dormant - * until either: - *

      - *
    • The {@code count} reaches zero due to an invocation of {@link - * #countDown countDown()}, {@link #countDown(int) countDown(int}}, or - * {@link #setCount(int)} setCount(int)} - *
    • Some other thread {@linkplain Thread#interrupt interrupts} the - * current thread - *
    • The specified waiting time elapses. - *
    - * If the count reaches zero then the method returns with the value - * {@code true}. - *

    - * If the current thread: - *

      - *
    • has its interrupted status set on entry to this method; or - *
    • is {@linkplain Thread#interrupt interrupted} while waiting, - *
    - * then {@link InterruptedException} is thrown and the current thread's - * interrupted status is cleared. - *

    - * If the specified waiting time elapses then the value {@code false} is - * returned. If the time is less than or equal to zero, the method will not - * wait at all. - * - * @param timeout the maximum time to wait - * @param unit the time unit of the {@code timeout} argument - * @return {@code true} if the count reached zero and {@code false} if the - * waiting time elapsed before the count reached zero - * @throws InterruptedException if the current thread is interrupted while - * waiting - */ - public boolean await(long timeout, - TimeUnit unit) throws InterruptedException { - return sync.tryAcquireSharedNanos(1, unit.toNanos(timeout)); - } - - /** - * Increments the count of the latch. - *

    - * @return {@code true} if {@code count} transitioned from zero to a new - * value - * @throws ArithmeticException when the operation would otherwise cause a - * silent numeric overflow, resulting in a - * negative {@code count}. - */ - public boolean countUp() { - return sync.countUp(); - } - - /** - * Increments the count of the latch by the given {@code amount}. - *

    - * @param amount by which to increment {@code count} - * @return {@code true} if {@code count} transitioned from zero to a new - * value - * @throws ArithmeticException when the operation would otherwise cause - * a silent numeric overflow, resulting in - * a negative {@code count}. - * @throws IllegalArgumentException if {@code amount} is less than one. - */ - public boolean countUp(int amount) { - return sync.countUp(amount); - } - - /** - * Decrements the count of the latch, releasing all waiting threads if the - * count transitions to zero. - *

    - * If the current count is zero, no action occurs and false is returned - * immediately; - * - * @return {@code true} if {@code count} transitions to zero - */ - public boolean countDown() { - return sync.countDown(); - } - - /** - * Decrements the {@code count} of the latch by the given {@code amount}, - * releasing all waiting threads if {@code count} transitions to zero. - *

    - * If the current {@code count} is zero, no action occurs and false is - * returned immediately; otherwise, {@code count} is decremented by the - * lesser of {@code amount} and current {@code count} (i.e. if - * {@code amount} is greater than current {@code count}, then new - * {@code count} is zero, else new {@code count} is current {@code count} - * minus {@code amount}. - * - * @param amount by which to decrement the {@code count} - * @return {@code true} if {@code count} transitions to zero - * @throws IllegalArgumentException when {@code amount} is non-positive - */ - public boolean countDown(int amount) { - return sync.countDown(amount); - } - - /** - * Returns the current count. - *

    - * Because another thread may update {@code count} at any time, typically - * this should not be used to compute input values for any of the @{code - * count} mutating methods and instead should be reserved for debugging and - * testing purposes (e.g. to assert that the current count is the expected - * count, given a set of know operations has occurred and given that it is - * known no other threads could be updating the count) - * - * @return the current count - */ - public int getCount() { - return sync.getCount(); - } - - /** - * Updates {@code count} to the requested {@code newCount}, returning - * {@code true} on transition to zero. - *

    - * If {@code newCount} is zero and the current {@code count} is zero, no - * action occurs and false is returned immediately. immediately; - * - * @param newCount to which to update {@code count}; must be non-negative. - * @return {@code true} if {@code count} transitions to zero. - * @throws IllegalArgumentException when {@code newCount} is negative - */ - public boolean setCount(int newCount) { - return sync.setCount(newCount); - } - - /** - * Returns a string representation of this object. - *

    - * - * @return a string identifying this latch, as well as its current - * {@code count}. - */ - public String toString() { - return String.format("%s[count=%d]", super.toString(), - sync.getCount()); - } - - /** - * As much as is reasonably practical, returns distinct integers for - * distinct objects. - * - * @return a hash code value for this latch. This method is supported for - * the benefit of hash tables - */ - - //@Override - public int hashCode() { - return super.hashCode(); - } - - /** - * Returns true if and only if {@code this} and {@code obj} refer to the - * same object ({@code this == obj} has the value {@code true}). - * - * @param other to test. - * @return if and only if {@code this == obj} - */ - public boolean equals(final CountUpDownLatch other) { - return this == other; - } - - /** - * Returns true if and only if {@code this} and {@code obj} refer to the - * same object ({@code this == obj} has the value {@code true}). - * - * @param obj to test. - * @return if and only if {@code this == obj} - */ - - //@Override - //@SuppressWarnings("EqualsWhichDoesntCheckParameterClass") - public boolean equals(Object obj) { - return this == obj; - } - - /** - * Synchronization control For {@link CountUpDownLatch}. - *

    - * Uses {@link AbstractQueuedSynchronizer} {@code state} property to - * represent count. - */ - private static class Sync extends AbstractQueuedSynchronizer { - - private static final long serialVersionUID = 7224851200740908493L; - - Sync(int count) { - setState(count); - } - - //@Override - protected boolean tryReleaseShared(int arg) { - return arg == 0; - } - - int getCount() { - return getState(); - } - - /** - * Queries if the state of this synchronizer permits it to be acquired - * in the shared mode, and if so to acquire it. - *

    - * This implementation supports the required semantics of the - * {@code await(...)} methods of the enclosing {@link CountUpDownLatch} - * class. - * - * @param ignored ignored param - * @return -1 on failure; 1 if acquisition in shared mode succeeded and - * subsequent shared-mode acquires might also succeed, in which - * case a subsequent waiting thread must check availability. - */ - protected int tryAcquireShared(int ignored) { - return getState() == 0 ? 1 - : -1; - } - - /** - * Updates {@code count} to {@code newCount}, returning {@code true} on - * transition to zero. - *

    - * If {@code newCount} is zero and the current {@code count} is zero, no - * action occurs and false is returned immediately. immediately; - * - * @param newCount to which to update {@code count}; must be - * non-negative. - * @return {@code true} if {@code count} transitions to zero. - * @throws IllegalArgumentException when {@code newCount} is negative - */ - boolean setCount(int newCount) { - - if (newCount < 0) { - throw new IllegalArgumentException( - String.format( - "amount must be non-negative: %d", newCount)); - } - - boolean requestedZero = newCount == 0; - - for (;;) { - int c = getState(); - - if (requestedZero && c == 0) { - return false; - } - - // assert newCount >= 0; - if (compareAndSetState(c, newCount)) { - return requestedZero ? releaseShared(0) - : false; - } - } - } - - /** - * by one. - * - * @return true if {#code count} transitioned to zero. - */ - boolean countDown() { - - for (;;) { - int c = getState(); - - if (c == 0) { - return false; - } - - // assert: nextc >= 0; - int nextc = c - 1; - - if (super.compareAndSetState(c, nextc)) { - if (nextc == 0) { - return releaseShared(0); - } else { - return false; - } - } - } - } - - /** - * Counts down by {@code amount}. - * - * @param amount by which to decrement the {@code count} - * @return true if {#code count} transitioned to zero. - * @throws IllegalArgumentException when {@code amount} is non-positive - */ - boolean countDown(int amount) { - - if (amount < 1) { - throw new IllegalArgumentException( - String.format("Amount must be positive: %d", amount)); - } - - for (;;) { - int c = getState(); - - if (c == 0) { - return false; - } - - int nextc = amount >= c ? 0 - : c - amount; - - // assert nextc >= 0; - if (super.compareAndSetState(c, nextc)) { - return nextc == 0 ? releaseShared(0) - : false; - } - } - } - - /** - * Counts up by one. - * - * @return true if count transitioned to zero - * @throws ArithmeticException when the operation would otherwise cause - * a silent numeric overflow, resulting in a - * negative {@code count}. - */ - boolean countUp() { - - for (;;) { - int c = getState(); - - if (c == Integer.MAX_VALUE) { - throw new ArithmeticException( - String.format("integer overflow: %d + 1", c)); - } - - int nextc = c + 1; - - // assert: nextc >= 0; - if (super.compareAndSetState(c, nextc)) { - return c == 0; - } - } - } - - /** - * Counts up by {@code amount}. - * - * @param amount by which to increment {@code count} - * @return true if count transitioned from zero to a new value - * @throws ArithmeticException when the operation would otherwise - * cause a silent numeric overflow, - * resulting in a negative - * {@code count}. - * @throws IllegalArgumentException if {@code amount is less than one} - * - */ - boolean countUp(int amount) { - - if (amount < 1) { - throw new IllegalArgumentException( - String.format("amount must be positive: %d", amount)); - } - - for (;;) { - int c = getState(); - - if (amount > Integer.MAX_VALUE - c) { - throw new ArithmeticException( - String.format("integer overflow: %d", amount)); - } - - int nextc = c + amount; - - // assert: nextc >= 0; - if (super.compareAndSetState(c, nextc)) { - return c == 0; - } - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/CountdownInputStream.java b/database/hsqldb/src/org/hsqldb/lib/CountdownInputStream.java deleted file mode 100644 index 4324e8a9..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/CountdownInputStream.java +++ /dev/null @@ -1,149 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; - -// fredt@users - 1.9.0 corrected read(byte[], int, int) - -/** - * Counts down from a specified value the number of bytes actually read - * from the wrapped InputStream.

    - * - * Returns minus one (-1) early from readXXX methods if the count - * down reaches zero (0) before the end of the wrapped InputStream - * is encountered.

    - * - * This class is especially useful when a fixed number of bytes is to be read - * from an InputStream that is in turn to be used as the source for an - * {@link java.io.InputStreamReader InputStreamReader}. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.1.1 - * @since 1.9.0 - */ -public final class CountdownInputStream extends InputStream { - - private long m_count; - private InputStream m_input; - - public CountdownInputStream(final InputStream is) { - m_input = is; - } - - public int read() throws IOException { - - if (m_count <= 0) { - return -1; - } - - final int b = m_input.read(); - - if (b >= 0) { - m_count--; - } - - return b; - } - - public int read(final byte[] buf) throws IOException { - - if (buf == null) { - throw new NullPointerException(); - } - - if (m_count <= 0) { - return -1; - } - - int len = buf.length; - - if (len > m_count) { - len = (int) m_count; - } - - final int r = m_input.read(buf, 0, len); - - if (r > 0) { - m_count -= r; - } - - return r; - } - - public int read(final byte[] buf, final int off, - int len) throws IOException { - - if (buf == null) { - throw new NullPointerException(); - } - - if (m_count <= 0) { - return -1; - } - - if (len > m_count) { - len = (int) m_count; - } - - final int r = m_input.read(buf, off, len); - - if (r > 0) { - m_count -= r; - } - - return r; - } - - public void close() throws IOException { - m_input.close(); - } - - public int available() throws IOException { - return Math.min(m_input.available(), - (int) Math.min(Integer.MAX_VALUE, m_count)); - } - - public long skip(long count) throws IOException { - return (count <= 0) ? 0 - : m_input.skip(Math.min(m_count, count)); - } - - public long getCount() { - return m_count; - } - - public void setCount(long count) { - m_count = count; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/DataOutputStream.java b/database/hsqldb/src/org/hsqldb/lib/DataOutputStream.java deleted file mode 100644 index 5edfa26a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/DataOutputStream.java +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.DataOutput; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.UTFDataFormatException; - -/** - * A wrapper for OutputStream - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.9.0 - */ -public class DataOutputStream extends java.io.BufferedOutputStream -implements DataOutput { - - byte[] tempBuffer = new byte[8]; - - public DataOutputStream(OutputStream stream) { - super(stream, 8); - } - - public final void writeByte(int v) throws IOException { - write(v); - } - - public final void writeInt(int v) throws IOException { - - int count = 0; - - tempBuffer[count++] = (byte) (v >>> 24); - tempBuffer[count++] = (byte) (v >>> 16); - tempBuffer[count++] = (byte) (v >>> 8); - tempBuffer[count++] = (byte) v; - - write(tempBuffer, 0, count); - } - - public final void writeLong(long v) throws IOException { - writeInt((int) (v >>> 32)); - writeInt((int) v); - } - - public void writeChar(int v) throws IOException { - - int count = 0; - - tempBuffer[count++] = (byte) (v >>> 8); - tempBuffer[count++] = (byte) v; - - write(tempBuffer, 0, count); - } - - public void writeChars(String s) throws IOException { - - int len = s.length(); - - for (int i = 0; i < len; i++) { - int v = s.charAt(i); - int count = 0; - - tempBuffer[count++] = (byte) (v >>> 8); - tempBuffer[count++] = (byte) v; - - write(tempBuffer, 0, count); - } - } - - public void writeChars(char[] c) throws IOException { - writeChars(c, c.length); - } - - public void writeChars(char[] c, int length) throws IOException { - - for (int i = 0; i < length; i++) { - int v = c[i]; - int count = 0; - - tempBuffer[count++] = (byte) (v >>> 8); - tempBuffer[count++] = (byte) v; - - write(tempBuffer, 0, count); - } - } - - public long write(Reader reader, long length) throws IOException { - - InputStream inputStream = new ReaderInputStream(reader); - - return write(inputStream, length * 2) / 2; - } - - public long write(InputStream inputStream, - long length) throws IOException { - - byte[] data = new byte[1024]; - long totalCount = 0; - - while (true) { - long count = length - totalCount; - - if (count > data.length) { - count = data.length; - } - - count = inputStream.read(data, 0, (int) count); - - if (count < 1) { - break; - } - - write(data, 0, (int) count); - - totalCount += count; - } - - return totalCount; - } - - public void writeBoolean(boolean v) throws IOException { - - int val = v ? 1 - : 0; - - write(val); - } - - public void writeShort(int v) throws IOException { - - int count = 0; - - tempBuffer[count++] = (byte) (v >> 8); - tempBuffer[count++] = (byte) v; - - write(tempBuffer, 0, count); - } - - public void writeFloat(float v) throws IOException { - writeInt(Float.floatToIntBits(v)); - } - - public void writeDouble(double v) throws IOException { - writeLong(Double.doubleToLongBits(v)); - } - - public void writeBytes(String s) throws IOException { - - int length = s.length(); - - for (int i = 0; i < length; i++) { - out.write((byte) s.charAt(i)); - } - } - - public void writeUTF(String str) throws IOException { - - int len = str.length(); - - if (len > 0xffff) { - throw new UTFDataFormatException(); - } - - int bytecount = StringConverter.getUTFSize(str); - - if (bytecount > 0xffff) { - throw new UTFDataFormatException(); - } - - // - writeChar(bytecount); - - HsqlByteArrayOutputStream bao = - new HsqlByteArrayOutputStream(bytecount); - - StringConverter.stringToUTFBytes(str, bao); - this.write(bao.getBuffer(), 0, bao.size()); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/DoubleIntIndex.java b/database/hsqldb/src/org/hsqldb/lib/DoubleIntIndex.java deleted file mode 100644 index 2ebbed88..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/DoubleIntIndex.java +++ /dev/null @@ -1,1140 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Arrays; -import java.util.NoSuchElementException; - -/** - * Maintains an ordered {@code integer->integer} lookup table, consisting of two - * columns, one for keys, the other for values. Equal keys are allowed. - * - * The table is sorted on either the key or value column, depending on the calls to - * setKeysSearchTarget() or setValuesSearchTarget(). By default, the table is - * sorted on values. Equal values are sorted by key.

    - * - * findXXX() methods return the array index into the list - * pair containing a matching key or value, or or -1 if not found.

    - * - * Sorting methods originally contributed by Tony Lai (tony_lai@users dot sourceforge.net). - * Non-recursive implementation of fast quicksort added by Sergio Bossa sbtourist@users dot sourceforge.net) - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.8.0 - */ -public class DoubleIntIndex implements LongLookup { - - private int count = 0; - private int capacity; - private boolean sorted = true; - private boolean sortOnValues = false; - private final boolean fixedSize; - private int[] keys; - private int[] values; - -// - private int targetSearchValue; - - public DoubleIntIndex(int capacity) { - this(capacity, false); - } - - public DoubleIntIndex(int capacity, boolean fixedSize) { - - this.capacity = capacity; - keys = new int[capacity]; - values = new int[capacity]; - this.fixedSize = fixedSize; - } - - public int getKey(int i) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - return keys[i]; - } - - public long getLongKey(int i) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - return keys[i] & 0xffffffffL; - } - - public long getLongValue(int i) { - return values[i]; - } - - public int getValue(int i) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - return values[i]; - } - - /** - * Modifies an existing pair at the given index. - * @param i the index - * @param key the new key - */ - public void setKey(int i, int key) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - if (!sortOnValues) { - sorted = false; - } - - keys[i] = key; - } - - /** - * Modifies an existing pair at the given index. - * @param i the index - * @param value the new value - */ - public void setValue(int i, int value) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - if (sortOnValues) { - sorted = false; - } - - values[i] = value; - } - - /** - * Modifies an existing pair at the given index. - * @param i the index - * @param value the new value - */ - public void setLongValue(int i, long value) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - if (sortOnValues) { - sorted = false; - } - - values[i] = (int) value; - } - - public int size() { - return count; - } - - public int capacity() { - return capacity; - } - - public int[] getKeys() { - return keys; - } - - public int[] getValues() { - return values; - } - - public long getTotalValues() { - - long total = 0; - - for (int i = 0; i < count; i++) { - total += values[i]; - } - - return total; - } - - public void setSize(int newSize) { - count = newSize; - } - - public boolean addUnsorted(long key, long value) { - - if (key > Integer.MAX_VALUE || key < Integer.MIN_VALUE) { - throw new IllegalArgumentException(); - } - - if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) { - throw new IllegalArgumentException(); - } - - return addUnsorted((int) key, (int) value); - } - - /** - * Adds a pair into the table. - * - * @param key the key - * @param value the value - * @return true or false depending on success - */ - public boolean addUnsorted(int key, int value) { - - if (count == capacity) { - if (fixedSize) { - return false; - } else { - doubleCapacity(); - } - } - - if (sorted && count != 0) { - if (sortOnValues) { - if (value < values[count - 1]) { - sorted = false; - } - } else { - if (key < keys[count - 1]) { - sorted = false; - } - } - } - - keys[count] = key; - values[count] = value; - - count++; - - return true; - } - - public boolean addUnsorted(LongLookup other) { - - if (!ensureCapacityToAdd(other.size())) { - return false; - } - - sorted = false; - - for (int i = 0; i < other.size(); i++) { - long key = other.getLongKey(i); - long value = other.getLongValue(i); - - this.addUnsorted(key, value); - } - - return true; - } - - private boolean ensureCapacityToAdd(int extra) { - - if (count + extra > capacity) { - if (fixedSize) { - return false; - } else { - while (count + extra > capacity) { - doubleCapacity(); - } - } - } - - return true; - } - - /** - * Adds a key, value pair into the table with the guarantee that the key - * is equal or larger than the largest existing key. This prevents a sort - * from taking place on next call to find() - * - * @param key the key - * @param value the value - * @return true or false depending on success - */ - public boolean addSorted(int key, int value) { - - if (count == capacity) { - if (fixedSize) { - return false; - } else { - doubleCapacity(); - } - } - - if (count != 0) { - if (sortOnValues) { - if (value < values[count - 1]) { - return false; - } else if (value == values[count - 1] - && key < keys[count - 1]) { - return false; - } - } else { - if (key < keys[count - 1]) { - return false; - } - } - } - - keys[count] = key; - values[count] = value; - - count++; - - return true; - } - - /** - * Adds a pair, ensuring no duplicate key xor value already exists in the - * current search target column. - * @param key the key - * @param value the value - * @return true or false depending on success - */ - public boolean addUnique(int key, int value) { - - if (sortOnValues) { - throw new IllegalArgumentException(); - } - - if (count == capacity) { - if (fixedSize) { - return false; - } else { - doubleCapacity(); - } - } - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = sortOnValues ? value - : key; - - int i = binaryEmptySlotSearch(); - - if (i == -1) { - return false; - } - - if (count != i) { - moveRows(i, i + 1, count - i); - } - - keys[i] = key; - values[i] = value; - - count++; - - return true; - } - - /** - * Removes the (unique) key and its value. Must be sorted on key. - * - * @param key the key to remove - * @return true or false depending on success - */ - public boolean removeKey(int key) { - - if (sortOnValues) { - throw new IllegalArgumentException(); - } - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = key; - - int i = binarySlotSearch(false); - - if (i == count) { - return false; - } - - if (keys[i] != key) { - return false; - } - - remove(i); - - return true; - } - - /** - * Updates the value if key is present, or adds the key/value paire. - * Must be sorted on key. - * - * @param key the key to add or find - * @param value the value to add or update - * @return true or false depending on success - */ - public boolean addOrReplaceUnique(int key, int value) { - - if (sortOnValues) { - throw new IllegalArgumentException(); - } - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = key; - - int i = binarySlotSearch(false); - - if (i < count) { - if (keys[i] == key) { - values[i] = value; - - return true; - } - - if (count == capacity) { - if (fixedSize) { - return false; - } else { - doubleCapacity(); - } - } - - moveRows(i, i + 1, count - i); - } - - keys[i] = key; - values[i] = value; - - count++; - - return true; - } - - /** - * Used for values as counters. Adds the value to the existing value for the - * key. Or adds the key - value pair. - * - * @param key the key to update or add - * @param value the count to add - * @return the new count for the key - */ - public int addCount(int key, int value) { - - sortOnValues = false; - - if (addUnique(key, value)) { - return value; - } - - targetSearchValue = key; - - int i = this.binarySlotSearch(false); - - values[i] += value; - - return values[i]; - } - - public int addCount(int key) { - return addCount(key, 1); - } - - public int add(long key, long value) { - - if (key > Integer.MAX_VALUE || key < Integer.MIN_VALUE) { - throw new IllegalArgumentException(); - } - - if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) { - throw new IllegalArgumentException(); - } - - return add((int) key, (int) value); - } - - /** - * Adds a pair, maintaining sort order on - * current search target column. - * @param key the key - * @param value the value - * @return index of added key or -1 if full - */ - public int add(int key, int value) { - - if (count == capacity) { - if (fixedSize) { - return -1; - } else { - doubleCapacity(); - } - } - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = sortOnValues ? value - : key; - - int i = binarySlotSearch(true); - - if (count != i) { - moveRows(i, i + 1, count - i); - } - - keys[i] = key; - values[i] = value; - - count++; - - return i; - } - - public long lookup(long key) throws NoSuchElementException { - - if (key > Integer.MAX_VALUE || key < Integer.MIN_VALUE) { - throw new NoSuchElementException(); - } - - return lookup((int) key); - } - - public int lookup(int key) throws NoSuchElementException { - - if (sortOnValues) { - sorted = false; - sortOnValues = false; - } - - int i = findFirstEqualKeyIndex(key); - - if (i == -1) { - throw new NoSuchElementException(); - } - - return getValue(i); - } - - public long lookup(long key, long def) { - - if (key > Integer.MAX_VALUE || key < Integer.MIN_VALUE) { - return def; - } - - if (sortOnValues) { - sorted = false; - sortOnValues = false; - } - - int i = findFirstEqualKeyIndex((int) key); - - if (i == -1) { - return def; - } - - return getValue(i); - } - - public int lookup(int key, int def) { - - if (sortOnValues) { - sorted = false; - sortOnValues = false; - } - - int i = findFirstEqualKeyIndex(key); - - if (i == -1) { - return def; - } - - return getValue(i); - } - - public void clear() { - removeAll(); - } - - public LongLookup duplicate() { - - DoubleIntIndex duplicate = new DoubleIntIndex(capacity); - - copyTo(duplicate); - - return duplicate; - } - - public int lookupFirstGreaterEqual(int key) throws NoSuchElementException { - - if (sortOnValues) { - sorted = false; - sortOnValues = false; - } - - int i = findFirstGreaterEqualKeyIndex(key); - - if (i == -1) { - throw new NoSuchElementException(); - } - - return getValue(i); - } - - public void setValuesSearchTarget() { - - if (!sortOnValues) { - sorted = false; - } - - sortOnValues = true; - } - - public void setKeysSearchTarget() { - - if (sortOnValues) { - sorted = false; - } - - sortOnValues = false; - } - - /** - * @param value the value - * @return the index - */ - public int findFirstGreaterEqualKeyIndex(int value) { - - int index = findFirstGreaterEqualSlotIndex(value); - - return index == count ? -1 - : index; - } - - /** - * @param value the value - * @return the index - */ - public int findFirstEqualKeyIndex(int value) { - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = value; - - return binaryFirstSearch(); - } - - public boolean compactLookupAsIntervals() { - - if (size() == 0) { - return false; - } - - setKeysSearchTarget(); - - if (!sorted) { - fastQuickSort(); - } - - int base = 0; - - for (int i = 1; i < count; i++) { - long limit = keys[base] + values[base]; - - if (limit == keys[i]) { - values[base] += values[i]; // base updated - } else { - base++; - - keys[base] = keys[i]; - values[base] = values[i]; - } - } - - for (int i = base + 1; i < count; i++) { - keys[i] = 0; - values[i] = 0; - } - - if (count != base + 1) { - setSize(base + 1); - - return true; - } - - return false; - } - - /** - * This method is similar to findFirstGreaterEqualKeyIndex(int) but - * returns the index of the empty row past the end of the array if - * the search value is larger than all the values / keys in the searched - * column. - * @param value the value - * @return the index - */ - public int findFirstGreaterEqualSlotIndex(int value) { - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = value; - - return binarySlotSearch(false); - } - - /** - * Returns the index of the lowest element == the given search target, - * or -1 - * @return index or -1 if not found - */ - private int binaryFirstSearch() { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - int found = count; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare < 0) { - high = mid; - } else if (compare > 0) { - low = mid + 1; - } else { - high = mid; - found = mid; - } - } - - return found == count ? -1 - : found; - } - - /** - * Returns the index of the lowest element {@code >=} the given search target, or - * count. - * - * @return the index or count. - * @param fullCompare ignored - */ - private int binarySlotSearch(boolean fullCompare) { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare <= 0) { - high = mid; - } else { - low = mid + 1; - } - } - - return low; - } - - /** - * Returns the index of the lowest element {@code >} the given search target - * or count or -1 if target is found - * @return the index - */ - private int binaryEmptySlotSearch() { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare < 0) { - high = mid; - } else if (compare > 0) { - low = mid + 1; - } else { - return -1; - } - } - - return low; - } - - public void sortOnKeys() { - - sortOnValues = false; - - fastQuickSort(); - } - - public void sortOnValues() { - - sortOnValues = true; - - fastQuickSort(); - } - - public void sort() { - - if (sortOnValues || count <= 1024 * 16) { - fastQuickSortRecursive(); - } else { - fastQuickSort(); - } - } - - /** - * fast quicksort using a stack on the heap to reduce stack use - */ - private void fastQuickSort() { - - DoubleIntIndex indices = new DoubleIntIndex(32768); - int threshold = 16; - - indices.push(0, count - 1); - - while (indices.size() > 0) { - int start = indices.peekKey(); - int end = indices.peekValue(); - - indices.pop(); - - if (end - start >= threshold) { - int pivot = partition(start, end); - - indices.push(start, pivot - 1); - indices.push(pivot + 1, end); - } - } - - insertionSort(0, count - 1); - - sorted = true; - } - - private int partition(int start, int end) { - - int pivot = (start + end) >>> 1; - - // pivot is median of three values - if (keys[pivot] < keys[(start + pivot) >>> 1]) { - swap(pivot, (start + pivot) >>> 1); - } - - if (keys[(end + pivot) >>> 1] < keys[(start + pivot) >>> 1]) { - swap((end + pivot) >>> 1, (start + pivot) >>> 1); - } - - if (keys[(end + pivot) >>> 1] < keys[pivot]) { - swap((end + pivot) >>> 1, pivot); - } - - int pivotValue = keys[pivot]; - int i = start - 1; - int j = end; - - swap(pivot, end); - - for (;;) { - while (keys[++i] < pivotValue) {} - - while (pivotValue < keys[--j]) {} - - if (j < i) { - break; - } - - swap(i, j); - } - - swap(i, end); - - return i; - } - - /** - * fast quicksort with recursive quicksort implementation - */ - private void fastQuickSortRecursive() { - - quickSort(0, count - 1); - insertionSort(0, count - 1); - - sorted = true; - } - - private void quickSort(int l, int r) { - - int M = 16; - int i; - int j; - int v; - - if ((r - l) > M) { - i = (r + l) >>> 1; - - if (lessThan(i, l)) { - swap(l, i); // Tri-Median Method! - } - - if (lessThan(r, l)) { - swap(l, r); - } - - if (lessThan(r, i)) { - swap(i, r); - } - - j = r - 1; - - swap(i, j); - - i = l; - v = j; - - for (;;) { - while (lessThan(++i, v)) {} - - while (lessThan(v, --j)) {} - - if (j < i) { - break; - } - - swap(i, j); - } - - swap(i, r - 1); - quickSort(l, j); - quickSort(i + 1, r); - } - } - - private void insertionSort(int lo0, int hi0) { - - int i; - int j; - - for (i = lo0 + 1; i <= hi0; i++) { - j = i; - - while ((j > lo0) && lessThan(i, j - 1)) { - j--; - } - - if (i != j) { - moveAndInsertRow(i, j); - } - } - } - - protected void moveAndInsertRow(int i, int j) { - - int col1 = keys[i]; - int col2 = values[i]; - - moveRows(j, j + 1, i - j); - - keys[j] = col1; - values[j] = col2; - } - - protected void swap(int i1, int i2) { - - int col1 = keys[i1]; - int col2 = values[i1]; - - keys[i1] = keys[i2]; - values[i1] = values[i2]; - keys[i2] = col1; - values[i2] = col2; - } - - /** - * Check if targeted column value in the row indexed i is less than the - * search target object. - * @param i the index - * @return -1, 0 or +1 - */ - protected int compare(int i) { - - if (sortOnValues) { - if (targetSearchValue > values[i]) { - return 1; - } else if (targetSearchValue < values[i]) { - return -1; - } else { - return 0; - } - } - - if (targetSearchValue > keys[i]) { - return 1; - } else if (targetSearchValue < keys[i]) { - return -1; - } - - return 0; - } - - /** - * Check if row indexed i is less than row indexed j - * @param i the first index - * @param j the second index - * @return true or false - */ - protected boolean lessThan(int i, int j) { - - if (sortOnValues) { - if (values[i] < values[j]) { - return true; - } else if (values[i] > values[j]) { - return false; - } - } - - if (keys[i] < keys[j]) { - return true; - } - - return false; - } - - protected void moveRows(int fromIndex, int toIndex, int rows) { - System.arraycopy(keys, fromIndex, keys, toIndex, rows); - System.arraycopy(values, fromIndex, values, toIndex, rows); - } - - protected void doubleCapacity() { - - keys = (int[]) ArrayUtil.resizeArray(keys, capacity * 2); - values = (int[]) ArrayUtil.resizeArray(values, capacity * 2); - capacity *= 2; - } - - public void removeRange(int start, int limit) { - - ArrayUtil.adjustArray(ArrayUtil.CLASS_CODE_INT, keys, count, start, - start - limit); - ArrayUtil.adjustArray(ArrayUtil.CLASS_CODE_INT, values, count, start, - start - limit); - - count -= (limit - start); - } - - public void removeAll() { - - Arrays.fill(keys, 0); - Arrays.fill(values, 0); - - count = 0; - sorted = true; - } - - public void copyTo(DoubleIntIndex other) { - - System.arraycopy(keys, 0, other.keys, 0, count); - System.arraycopy(values, 0, other.values, 0, count); - other.setSize(count); - other.sorted = false; - } - - public final void remove(int position) { - - moveRows(position + 1, position, count - position - 1); - - count--; - - keys[count] = 0; - values[count] = 0; - } - - /** - * peek the key at top of stack. Uses the data structure as a stack. - * @return int key - */ - int peekKey() { - return getKey(count - 1); - } - - /** - * peek the value at top of stack - * @return int value - */ - int peekValue() { - return getValue(count - 1); - } - - /** - * pop the pair at top of stack - * @return boolean if there was an element - */ - boolean pop() { - - if (count > 0) { - count--; - - return true; - } - - return false; - } - - /** - * push key - value pair - * - * @return boolean true if successful - * @param key the key - * @param value the value - */ - boolean push(int key, int value) { - return addUnsorted(key, value); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/DoubleLongIndex.java b/database/hsqldb/src/org/hsqldb/lib/DoubleLongIndex.java deleted file mode 100644 index f89c1237..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/DoubleLongIndex.java +++ /dev/null @@ -1,606 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Arrays; -import java.util.NoSuchElementException; - -/** - * Maintains an ordered {@code long->long} lookup table, consisting of two - * columns, one for keys, the other for values. Equal keys are allowed.

    - * - * The table is sorted on key column.

    - * - * findXXX() methods return the array index into the list - * pair containing a matching key or value, or or -1 if not found.

    - * - * Based on org.hsqldb.lib.DoubleIntIndex - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.8.0 - */ -public final class DoubleLongIndex implements LongLookup { - - private int count = 0; - private int capacity; - private boolean sorted = true; - private long[] keys; - private long[] values; - -// - private long targetSearchValue; - - public DoubleLongIndex(int capacity) { - - this.capacity = capacity; - keys = new long[capacity]; - values = new long[capacity]; - } - - public long getLongKey(int i) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - return keys[i]; - } - - public long getLongValue(int i) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - return values[i]; - } - - /** - * Modifies an existing pair. - * @param i the index - * @param value the value - */ - public void setLongValue(int i, long value) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - values[i] = value; - } - - public int size() { - return count; - } - - public long getTotalValues() { - - long total = 0; - - for (int i = 0; i < count; i++) { - total += values[i]; - } - - return total; - } - - public void setSize(int newSize) { - count = newSize; - } - - public boolean addUnsorted(long key, long value) { - - if (count == capacity) { - doubleCapacity(); - } - - if (sorted && count != 0) { - if (key < keys[count - 1]) { - sorted = false; - } - } - - keys[count] = key; - values[count] = value; - - count++; - - return true; - } - - public int add(long key, long value) { - - if (count == capacity) { - doubleCapacity(); - } - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = key; - - int i = binarySlotSearch(true); - - if (count != i) { - moveRows(i, i + 1, count - i); - } - - keys[i] = key; - values[i] = value; - - count++; - - return i; - } - - public long lookup(long key) throws NoSuchElementException { - - int i = findFirstEqualKeyIndex(key); - - if (i == -1) { - throw new NoSuchElementException(); - } - - return getLongValue(i); - } - - public long lookup(long key, long def) { - - int i = findFirstEqualKeyIndex(key); - - if (i == -1) { - return def; - } - - return getLongValue(i); - } - - public void clear() { - - Arrays.fill(keys, 0); - Arrays.fill(values, 0); - - count = 0; - sorted = true; - } - - public LongLookup duplicate() { - - DoubleLongIndex duplicate = new DoubleLongIndex(capacity); - - copyTo(duplicate); - - return duplicate; - } - - /** - * @param value the value - * @return the index - */ - public int findFirstGreaterEqualKeyIndex(long value) { - - int index = findFirstGreaterEqualSlotIndex(value); - - return index == count ? -1 - : index; - } - - /** - * @param value the value - * @return the index - */ - public int findFirstEqualKeyIndex(long value) { - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = value; - - return binaryFirstSearch(); - } - - /** - * This method is similar to findFirstGreaterEqualKeyIndex(int) but - * returns the index of the empty row past the end of the array if - * the search value is larger than all the values / keys in the searched - * column. - * @param value the value - * @return the index - */ - public int findFirstGreaterEqualSlotIndex(long value) { - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = value; - - return binarySlotSearch(false); - } - - public boolean compactLookupAsIntervals() { - - if (size() == 0) { - return false; - } - - if (!sorted) { - fastQuickSort(); - } - - int base = 0; - - for (int i = 1; i < count; i++) { - long limit = keys[base] + values[base]; - - if (limit == keys[i]) { - values[base] += values[i]; // base updated - } else { - base++; - - keys[base] = keys[i]; - values[base] = values[i]; - } - } - - for (int i = base + 1; i < count; i++) { - keys[i] = 0; - values[i] = 0; - } - - if (count != base + 1) { - setSize(base + 1); - - return true; - } - - return false; - } - - /** - * Returns the index of the lowest element == the given search target, - * or -1 - * @return index or -1 if not found - */ - private int binaryFirstSearch() { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - int found = count; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare < 0) { - high = mid; - } else if (compare > 0) { - low = mid + 1; - } else { - high = mid; - found = mid; - } - } - - return found == count ? -1 - : found; - } - - /** - * Returns the index of the lowest element {@code >=} the given search target, or - * count - * - * @return the index or count - * @param fullCompare ignored - */ - private int binarySlotSearch(boolean fullCompare) { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare <= 0) { - high = mid; - } else { - low = mid + 1; - } - } - - return low; - } - - public void sort() { - - if (count <= 1024 * 16) { - fastQuickSortRecursive(); - } else { - fastQuickSort(); - } - } - - /** - * fast quicksort using a stack on the heap to reduce stack use - */ - private void fastQuickSort() { - - DoubleIntIndex indices = new DoubleIntIndex(32768); - int threshold = 16; - - indices.push(0, count - 1); - - while (indices.size() > 0) { - int start = indices.peekKey(); - int end = indices.peekValue(); - - indices.pop(); - - if (end - start >= threshold) { - int pivot = partition(start, end); - - indices.push(start, pivot - 1); - indices.push(pivot + 1, end); - } - } - - insertionSort(0, count - 1); - - sorted = true; - } - - private int partition(int start, int end) { - - int pivot = (start + end) >>> 1; - - // pivot is median of three values - if (keys[pivot] < keys[(start + pivot) >>> 1]) { - swap(pivot, (start + pivot) >>> 1); - } - - if (keys[(end + pivot) >>> 1] < keys[(start + pivot) >>> 1]) { - swap((end + pivot) >>> 1, (start + pivot) >>> 1); - } - - if (keys[(end + pivot) >>> 1] < keys[pivot]) { - swap((end + pivot) >>> 1, pivot); - } - - long pivotValue = keys[pivot]; - int i = start - 1; - int j = end; - - swap(pivot, end); - - for (;;) { - while (keys[++i] < pivotValue) {} - - while (pivotValue < keys[--j]) {} - - if (j < i) { - break; - } - - swap(i, j); - } - - swap(i, end); - - return i; - } - - /** - * fast quicksort with recursive quicksort implementation - */ - private void fastQuickSortRecursive() { - - quickSort(0, count - 1); - insertionSort(0, count - 1); - - sorted = true; - } - - private void quickSort(int l, int r) { - - int M = 16; - int i; - int j; - int v; - - if ((r - l) > M) { - i = (r + l) >>> 1; - - if (lessThan(i, l)) { - swap(l, i); // Tri-Median Method! - } - - if (lessThan(r, l)) { - swap(l, r); - } - - if (lessThan(r, i)) { - swap(i, r); - } - - j = r - 1; - - swap(i, j); - - i = l; - v = j; - - for (;;) { - while (lessThan(++i, v)) {} - - while (lessThan(v, --j)) {} - - if (j < i) { - break; - } - - swap(i, j); - } - - swap(i, r - 1); - quickSort(l, j); - quickSort(i + 1, r); - } - } - - private void insertionSort(int lo0, int hi0) { - - int i; - int j; - - for (i = lo0 + 1; i <= hi0; i++) { - j = i; - - while ((j > lo0) && lessThan(i, j - 1)) { - j--; - } - - if (i != j) { - moveAndInsertRow(i, j); - } - } - } - - private void moveAndInsertRow(int i, int j) { - - long col1 = keys[i]; - long col2 = values[i]; - - moveRows(j, j + 1, i - j); - - keys[j] = col1; - values[j] = col2; - } - - private void swap(int i1, int i2) { - - long col1 = keys[i1]; - long col2 = values[i1]; - - keys[i1] = keys[i2]; - values[i1] = values[i2]; - keys[i2] = col1; - values[i2] = col2; - } - - /** - * Check if targeted column value in the row indexed i is less than the - * search target object. - * @param i the index - * @return -1, 0 or +1 - */ - private int compare(int i) { - - if (targetSearchValue > keys[i]) { - return 1; - } else if (targetSearchValue < keys[i]) { - return -1; - } - - return 0; - } - - /** - * Check if row indexed i is less than row indexed j - * @param i the first index - * @param j the second index - * @return true or false - */ - private boolean lessThan(int i, int j) { - - if (keys[i] < keys[j]) { - return true; - } - - return false; - } - - private void moveRows(int fromIndex, int toIndex, int rows) { - System.arraycopy(keys, fromIndex, keys, toIndex, rows); - System.arraycopy(values, fromIndex, values, toIndex, rows); - } - - private void doubleCapacity() { - - keys = (long[]) ArrayUtil.resizeArray(keys, capacity * 2); - values = (long[]) ArrayUtil.resizeArray(values, capacity * 2); - capacity *= 2; - } - - public void copyTo(DoubleLongIndex other) { - - System.arraycopy(keys, 0, other.keys, 0, count); - System.arraycopy(values, 0, other.values, 0, count); - other.setSize(count); - } - - public boolean addUnsorted(LongLookup other) { - - if (!ensureCapacityToAdd(other.size())) { - return false; - } - - sorted = false; - - for (int i = 0; i < other.size(); i++) { - long key = other.getLongKey(i); - long value = other.getLongValue(i); - - this.addUnsorted(key, value); - } - - return true; - } - - private boolean ensureCapacityToAdd(int extra) { - - if (count + extra > capacity) { - while (count + extra > capacity) { - doubleCapacity(); - } - } - - return true; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/EventLogInterface.java b/database/hsqldb/src/org/hsqldb/lib/EventLogInterface.java deleted file mode 100644 index 245b5453..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/EventLogInterface.java +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public interface EventLogInterface { - - void logSevereEvent(String message, Throwable t); - - void logWarningEvent(String message, Throwable t); - - void logInfoEvent(String message); - - void logDetailEvent(String message); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/FileAccess.java b/database/hsqldb/src/org/hsqldb/lib/FileAccess.java deleted file mode 100644 index 7abf55f1..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/FileAccess.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * Interface for abstraction of file access. - * - * @author Ocke Janssen oj@openoffice.org - * @version 2.7.0 - * @since 1.8.0 - */ -public interface FileAccess { - - int ELEMENT_READ = 1; - int ELEMENT_SEEKABLEREAD = 3; - int ELEMENT_WRITE = 4; - int ELEMENT_READWRITE = 7; - int ELEMENT_TRUNCATE = 8; - - InputStream openInputStreamElement(String streamName) throws IOException; - - OutputStream openOutputStreamElement(String streamName) throws IOException; - - OutputStream openOutputStreamElementAppend(String streamName) - throws IOException; - - boolean isStreamElement(String elementName); - - void createParentDirs(String filename); - - boolean removeElement(String filename); - - boolean renameElement(String oldName, String newName); - - boolean renameElementOrCopy(String oldName, String newName, - EventLogInterface logger); - - interface FileSync { - void sync() throws IOException; - } - - FileSync getFileSync(OutputStream os) throws IOException; -} diff --git a/database/hsqldb/src/org/hsqldb/lib/FileAccessRes.java b/database/hsqldb/src/org/hsqldb/lib/FileAccessRes.java deleted file mode 100644 index 4edc5cc4..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/FileAccessRes.java +++ /dev/null @@ -1,127 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; - -/** -* @author Fred Toussi (fredt@users dot sourceforge.net) -* @version 2.7.0 -* @since 1.8.0 -*/ -public class FileAccessRes implements FileAccess { - - public boolean isStreamElement(String fileName) { - - URL url = null; - - try { - url = getClass().getResource(fileName); - - if (url == null) { - ClassLoader cl = - Thread.currentThread().getContextClassLoader(); - - if (cl != null) { - url = cl.getResource(fileName); - } - } - } catch (Throwable t) { - - // - } - - return url != null; - } - - public InputStream openInputStreamElement(final String fileName) - throws IOException { - - InputStream fis = null; - - try { - fis = getClass().getResourceAsStream(fileName); - - if (fis == null) { - ClassLoader cl = - Thread.currentThread().getContextClassLoader(); - - if (cl != null) { - fis = cl.getResourceAsStream(fileName); - } - } - } catch (Throwable t) { - - // - } finally { - if (fis == null) { - throw new FileNotFoundException(fileName); - } - } - - return fis; - } - - public void createParentDirs(String filename) {} - - public boolean removeElement(String filename) { - return false; - } - - public boolean renameElement(String oldName, String newName) { - return false; - } - - public boolean renameElementOrCopy(String oldName, String newName, - EventLogInterface logger) { - return false; - } - - public OutputStream openOutputStreamElement(String streamName) - throws IOException { - throw new IOException(); - } - - public OutputStream openOutputStreamElementAppend(String streamName) - throws IOException { - throw new IOException(); - } - - public FileAccess.FileSync getFileSync(OutputStream os) - throws IOException { - throw new IOException(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/FileArchiver.java b/database/hsqldb/src/org/hsqldb/lib/FileArchiver.java deleted file mode 100644 index 8b08e0f5..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/FileArchiver.java +++ /dev/null @@ -1,242 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.Deflater; -import java.util.zip.DeflaterOutputStream; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; -import java.util.zip.Inflater; -import java.util.zip.InflaterInputStream; - -import org.hsqldb.lib.java.JavaSystem; - -/** - * Creates a direct, compressed or decompressed copy of a file. - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @version 1.9.0 - * @since 1.9.0 - */ -public class FileArchiver { - - public static final int COMPRESSION_NONE = 0; - public static final int COMPRESSION_ZIP = 1; - public static final int COMPRESSION_GZIP = 2; - private static final int COPY_BLOCK_SIZE = 1 << 16; - - /* - public static void compressFile(String infilename, String outfilename, - FileAccess storage) throws IOException { - FileArchiver.archive(infilename, outfilename, storage, COMPRESSION_ZIP); - } - - public static void decompressFile(String infilename, String outfilename, - FileAccess storage) throws IOException { - FileArchiver.unarchive( - infilename, outfilename, storage, COMPRESSION_ZIP); - } - - public static void restoreFile(String infilename, String outfilename, - FileAccess storage) throws IOException { - FileArchiver.unarchive( - infilename, outfilename, storage, COMPRESSION_NONE); - } - */ - public static void copyFile(String infilename, String outfilename, - FileAccess storage) throws IOException { - FileArchiver.archive(infilename, outfilename, storage, - COMPRESSION_NONE); - } - - public static void archive(String infilename, String outfilename, - FileAccess storage, - int compressionType) throws IOException { - - InputStream in = null; - OutputStream f = null; - OutputStream fOut = null; - DeflaterOutputStream deflater = null; - boolean completed = false; - - // if there is no file - if (!storage.isStreamElement(infilename)) { - return; - } - - try { - byte[] b = new byte[COPY_BLOCK_SIZE]; - - in = storage.openInputStreamElement(infilename); - f = storage.openOutputStreamElementAppend(outfilename); - fOut = f; - - switch (compressionType) { - - case COMPRESSION_ZIP : - f = deflater = new DeflaterOutputStream(f, - new Deflater(Deflater.BEST_SPEED), b.length); - break; - - case COMPRESSION_GZIP : - f = deflater = new GZIPOutputStream(f, b.length); - break; - - case COMPRESSION_NONE : - break; - - default : - throw new RuntimeException("FileArchiver" - + compressionType); - } - - while (true) { - int l = in.read(b, 0, b.length); - - if (l == -1) { - break; - } - - f.write(b, 0, l); - } - - completed = true; - } catch (Throwable e) { - throw JavaSystem.toIOException(e); - } finally { - try { - if (in != null) { - in.close(); - } - - if (f != null) { - if (deflater != null) { - deflater.finish(); - } - - if (fOut instanceof FileOutputStream) { - storage.getFileSync(fOut).sync(); - } - - f.close(); - } - - if (!completed && storage.isStreamElement(outfilename)) { - storage.removeElement(outfilename); - } - } catch (Throwable e) { - throw JavaSystem.toIOException(e); - } - } - } - - public static void unarchive(String infilename, String outfilename, - FileAccess storage, - int compressionType) throws IOException { - - InputStream f = null; - OutputStream outstream = null; - boolean completed = false; - - try { - if (!storage.isStreamElement(infilename)) { - return; - } - - storage.removeElement(outfilename); - - byte[] b = new byte[COPY_BLOCK_SIZE]; - - f = storage.openInputStreamElement(infilename); - - switch (compressionType) { - - case COMPRESSION_ZIP : - f = new InflaterInputStream(f, new Inflater()); - break; - - case COMPRESSION_GZIP : - f = new GZIPInputStream(f, b.length); - break; - - case COMPRESSION_NONE : - break; - - default : - throw new RuntimeException("FileArchiver: " - + compressionType); - } - - outstream = storage.openOutputStreamElement(outfilename); - - while (true) { - int l = f.read(b, 0, b.length); - - if (l == -1) { - break; - } - - outstream.write(b, 0, l); - } - - completed = true; - } catch (Throwable e) { - throw JavaSystem.toIOException(e); - } finally { - try { - if (f != null) { - f.close(); - } - - if (outstream != null) { - outstream.flush(); - - if (outstream instanceof FileOutputStream) { - storage.getFileSync(outstream).sync(); - } - - outstream.close(); - } - - if (!completed && storage.isStreamElement(outfilename)) { - storage.removeElement(outfilename); - } - } catch (Throwable e) { - throw JavaSystem.toIOException(e); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/FileUtil.java b/database/hsqldb/src/org/hsqldb/lib/FileUtil.java deleted file mode 100644 index 1c70ce14..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/FileUtil.java +++ /dev/null @@ -1,610 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.File; -import java.io.FileDescriptor; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Random; - -import org.hsqldb.lib.java.JavaSystem; - -/** - * A collection of file management methods.

    - * Also provides the default FileAccess implementation - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @author Ocke Janssen oj@openoffice.org - * @version 2.7.0 - * @since 1.7.2 - */ -public class FileUtil implements FileAccess { - - private static FileUtil fileUtil = new FileUtil(); - private static FileAccessRes fileAccessRes = new FileAccessRes(); - - /** Creates a new instance of FileUtil */ - FileUtil() {} - - public static FileUtil getFileUtil() { - return fileUtil; - } - - public static FileAccess getFileAccess(boolean isResource) { - return isResource ? fileAccessRes - : fileUtil; - } - - public boolean isStreamElement(String elementName) { - return new File(elementName).exists(); - } - - public InputStream openInputStreamElement(String streamName) - throws IOException { - - try { - return new FileInputStream(streamName); - } catch (Throwable e) { - throw JavaSystem.toIOException(e); - } - } - - public void createParentDirs(String filename) { - makeParentDirectories(new File(filename)); - } - - public boolean removeElement(String filename) { - - if (isStreamElement(filename)) { - return delete(filename); - } - - return true; - } - - public boolean renameElement(String oldName, String newName) { - return renameWithOverwrite(oldName, newName); - } - - public boolean renameElementOrCopy(String oldName, String newName, - EventLogInterface logger) { - - if (renameWithOverwrite(oldName, newName)) { - return true; - } - - InputStream inputStream = null; - OutputStream outputStream = null; - - try { - inputStream = openInputStreamElement(oldName); - outputStream = openOutputStreamElement(newName); - - InOutUtil.copy(inputStream, outputStream); - getFileSync(outputStream).sync(); - } catch (IOException e) { - String message = String.format( - "Platform does not allow renaming files and failed to copy file contents from %s to %s", - oldName, newName); - - logger.logSevereEvent(message, e); - - return false; - } finally { - try { - if (inputStream != null) { - inputStream.close(); - } - } catch (IOException e) { - logger.logWarningEvent("Failed to dispose streams", e); - } - - try { - if (outputStream != null) { - outputStream.close(); - } - } catch (IOException e) { - logger.logDetailEvent("Failed to dispose streams"); - } - } - - if (!delete(oldName)) { - logger.logWarningEvent("Failed to delete renamed file " + oldName, - null); - } - - String message = String.format( - "Platform does not allow renaming files. Copied file from %s to %s instead", - oldName, newName); - - logger.logDetailEvent(message); - - return true; - } - - public OutputStream openOutputStreamElement(String streamName) - throws IOException { - return new FileOutputStream(streamName, false); - } - - public OutputStream openOutputStreamElementAppend(String streamName) - throws IOException { - return new FileOutputStream(streamName, true); - } - - // end of FileAccess implementation - // a new File("...")'s path is not canonicalized, only resolved - // and normalized (e.g. redundant separator chars removed), - // so as of JDK 1.4.2, this is a valid test for case insensitivity, - // at least when it is assumed that we are dealing with a configuration - // that only needs to consider the host platform's native file system, - // even if, unlike for File.getCanonicalPath(), (new File("a")).exists() or - // (new File("A")).exits(), regardless of the hosting system's - // file path case sensitivity policy. - public final boolean fsIsIgnoreCase = - (new File("A")).equals(new File("a")); - - // posix separator normalized to File.separator? - // CHECKME: is this true for every file system under Java? - public final boolean fsNormalizesPosixSeparator = - (new File("/")).getPath().endsWith(File.separator); - - // for JDK 1.1 createTempFile - final Random random = new Random(System.currentTimeMillis()); - - /** - * Delete the named file - * - * @param filename String - * @return true if deleted - */ - public boolean delete(String filename) { - return new File(filename).delete(); - } - - /** - * Requests, in a JDK 1.1 compliant way, that the file or directory denoted - * by the given abstract pathname be deleted when the virtual machine - * terminates.

    - * - * Deletion will be attempted only for JDK 1.2 and greater runtime - * environments and only upon normal termination of the virtual - * machine, as defined by the Java Language Specification.

    - * - * Once deletion has been sucessfully requested, it is not possible to - * cancel the request. This method should therefore be used with care.

    - * - * @param f the abstract pathname of the file be deleted when the virtual - * machine terminates - */ - public void deleteOnExit(File f) { - f.deleteOnExit(); - } - - /** - * Return true or false based on whether the named file exists. - * - * @param filename String - * @return true if exists - */ - public boolean exists(String filename) { - return new File(filename).exists(); - } - - public boolean exists(String fileName, boolean resource, Class cla) { - - if (fileName == null || fileName.isEmpty()) { - return false; - } - - return resource ? null != cla.getResource(fileName) - : FileUtil.getFileUtil().exists(fileName); - } - - /** - * Rename the file with oldname to newname. If a file with newname already - * exists, it is deleted before the renaming operation proceeds.

    - * - * If a file with oldname does not exist, no file will exist after the - * operation. - * - * @param oldname String - * @param newname String - * @return true if successful - */ - private boolean renameWithOverwrite(String oldname, String newname) { - - File file = new File(oldname); - - delete(newname); - - boolean renamed = file.renameTo(new File(newname)); - - if (renamed) { - return true; - } - - delete(newname); - - if (exists(newname)) { - new File(newname).renameTo(new File(newDiscardFileName(newname))); - } - - return file.renameTo(new File(newname)); - } - - /** - * Retrieves the absolute path, given some path specification. - * - * @param path the path for which to retrieve the absolute path - * @return the absolute path - */ - public String absolutePath(String path) { - return new File(path).getAbsolutePath(); - } - - /** - * Retrieves the canonical file for the given file, in a JDK 1.1 compliant - * way. - * - * @param f the File for which to retrieve the absolute File - * @return the canonical File - * @throws IOException on error - */ - public File canonicalFile(File f) throws IOException { - return new File(f.getCanonicalPath()); - } - - /** - * Retrieves the canonical file for the given path, in a JDK 1.1 compliant - * way. - * - * @param path the path for which to retrieve the canonical File - * @return the canonical File - * @throws IOException on error - */ - public File canonicalFile(String path) throws IOException { - return new File(new File(path).getCanonicalPath()); - } - - /** - * Retrieves the canonical path for the given File, in a JDK 1.1 compliant - * way. - * - * @param f the File for which to retrieve the canonical path - * @return the canonical path - * @throws IOException on error - */ - public String canonicalPath(File f) throws IOException { - return f.getCanonicalPath(); - } - - /** - * Retrieves the canonical path for the given path, in a JDK 1.1 compliant - * way. - * - * @param path the path for which to retrieve the canonical path - * @return the canonical path - * @throws IOException on error - */ - public String canonicalPath(String path) throws IOException { - return new File(path).getCanonicalPath(); - } - - /** - * Retrieves the canonical path for the given path, or the absolute - * path if attempting to retrieve the canonical path fails. - * - * @param path the path for which to retrieve the canonical or - * absolute path - * @return the canonical or absolute path - */ - public String canonicalOrAbsolutePath(String path) { - - try { - return canonicalPath(path); - } catch (Exception e) { - return absolutePath(path); - } - } - - public void makeParentDirectories(File f) { - - String parent = f.getParent(); - - if (parent != null) { - new File(parent).mkdirs(); - } else { - - // workaround for jdk 1.1 bug (returns null when there is a parent) - parent = f.getPath(); - - int index = parent.lastIndexOf('/'); - - if (index > 0) { - parent = parent.substring(0, index); - - new File(parent).mkdirs(); - } - } - } - - public static String makeDirectories(String path) { - - try { - File file = new File(path); - - file.mkdirs(); - - return file.getCanonicalPath(); - } catch (IOException e) { - return null; - } - } - - public FileAccess.FileSync getFileSync(java.io.OutputStream os) - throws IOException { - return new FileSync((FileOutputStream) os); - } - - public static class FileSync implements FileAccess.FileSync { - - FileDescriptor outDescriptor; - - FileSync(FileOutputStream os) throws IOException { - outDescriptor = os.getFD(); - } - - public void sync() throws IOException { - outDescriptor.sync(); - } - } - - /** - * Utility method for user applications. Attempts to delete all the files - * for the database as listed by the getDatabaseFileList() method. If any - * of the current, main database files cannot be deleted, it is renamed - * by adding a suffix containing a hexadecimal timestamp portion and - * the ".old" extension. Also deletes the ".tmp" directory. - * - * @param dbNamePath full path or name of database (without a file extension) - * @return currently always true - */ - public static boolean deleteOrRenameDatabaseFiles(String dbNamePath) { - - DatabaseFilenameFilter filter = new DatabaseFilenameFilter(dbNamePath); - File[] fileList = filter.getExistingFileListInDirectory(); - - for (int i = 0; i < fileList.length; i++) { - fileList[i].delete(); - } - - File tempDir = new File(filter.canonicalFile.getPath() + ".tmp"); - - if (tempDir.isDirectory()) { - File[] tempList = tempDir.listFiles(); - - if (tempList != null) { - for (int i = 0; i < tempList.length; i++) { - tempList[i].delete(); - } - } - - tempDir.delete(); - } - - fileList = filter.getExistingMainFileSetList(); - - if (fileList.length == 0) { - return true; - } - - for (int i = 0; i < fileList.length; i++) { - fileList[i].delete(); - } - - fileList = filter.getExistingMainFileSetList(); - - for (int i = 0; i < fileList.length; i++) { - fileList[i].renameTo( - new File(newDiscardFileName(fileList[i].getPath()))); - } - - return true; - } - - /** - * Utility method for user applications. Returns a list of files that - * currently exist for a database. The list includes current database files - * as well as ".new", and ".old" versions of the files, plus any app logs. - * - * @param dbNamePath full path or name of database (without a file - * extension) - * @return File[] - */ - public static File[] getDatabaseFileList(String dbNamePath) { - - DatabaseFilenameFilter filter = new DatabaseFilenameFilter(dbNamePath); - - return filter.getExistingFileListInDirectory(); - } - - /** - * Returns a list of existing main files for a database. The list excludes - * non-essential files. - * - * @param dbNamePath full path or name of database (without a file - * extension) - * @return File[] - */ - public static File[] getDatabaseMainFileList(String dbNamePath) { - - DatabaseFilenameFilter filter = new DatabaseFilenameFilter(dbNamePath, - false); - - return filter.getExistingFileListInDirectory(); - } - - static int discardSuffixLength = 9; - - public static String newDiscardFileName(String filename) { - - String timestamp = StringUtil.toPaddedString( - Integer.toHexString((int) System.currentTimeMillis()), - discardSuffixLength - 1, '0', true); - String discardName = filename + "." + timestamp + ".old"; - - return discardName; - } - - static class DatabaseFilenameFilter implements FilenameFilter { - - String[] suffixes = new String[] { - ".backup", ".properties", ".script", ".data", ".log", ".lobs" - }; - String[] extraSuffixes = new String[] { - ".lck", ".sql.log", ".app.log" - }; - private String dbName; - private File parent; - private File canonicalFile; - private boolean extraFiles; - - DatabaseFilenameFilter(String dbNamePath) { - this(dbNamePath, true); - } - - DatabaseFilenameFilter(String dbNamePath, boolean extras) { - - canonicalFile = new File(dbNamePath); - - try { - canonicalFile = canonicalFile.getCanonicalFile(); - } catch (Exception e) {} - - dbName = canonicalFile.getName(); - parent = canonicalFile.getParentFile(); - extraFiles = extras; - } - - public File[] getCompleteMainFileSetList() { - - File[] fileList = new File[suffixes.length]; - - for (int i = 0; i < suffixes.length; i++) { - fileList[i] = new File(canonicalFile.getPath() + suffixes[i]); - } - - return fileList; - } - - public File[] getExistingMainFileSetList() { - - File[] fileList = getCompleteMainFileSetList(); - HsqlArrayList list = new HsqlArrayList(); - - for (int i = 0; i < fileList.length; i++) { - if (fileList[i].exists()) { - list.add(fileList[i]); - } - } - - fileList = new File[list.size()]; - - list.toArray(fileList); - - return fileList; - } - - public File[] getExistingFileListInDirectory() { - - File[] list = parent.listFiles(this); - - return list == null ? new File[]{} - : list; - } - - /** - * Accepts all HSQLDB main persistence files as well as ".new" and ".old" versions. - * - * @param dir the directory - * @param name file name - * @return true if an accepted file - */ - public boolean accept(File dir, String name) { - - if (parent.equals(dir) && name.indexOf(dbName) == 0) { - String suffix = name.substring(dbName.length()); - - if (extraFiles) { - for (int i = 0; i < extraSuffixes.length; i++) { - if (suffix.equals(extraSuffixes[i])) { - return true; - } - } - } - - for (int i = 0; i < suffixes.length; i++) { - if (suffix.equals(suffixes[i])) { - return true; - } - - if (!extraFiles) { - continue; - } - - if (suffix.startsWith(suffixes[i])) { - if (name.endsWith(".new")) { - if (suffix.length() == suffixes[i].length() + 4) { - return true; - } - } else if (name.endsWith(".old")) { - if (suffix.length() - == suffixes[i].length() - + discardSuffixLength + 4) { - return true; - } - } - } - } - } - - return false; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/FilteredIterator.java b/database/hsqldb/src/org/hsqldb/lib/FilteredIterator.java deleted file mode 100644 index 961d673d..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/FilteredIterator.java +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -/** - * An iterator with an added filter. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 2.5.1 - */ -public class FilteredIterator implements Iterator { - - private final Iterator it; - private final Filter filter; - private E nextValue; - - public FilteredIterator (Iterator iterator, Filter filter ) { - this.it = iterator; - this.filter = filter; - - moveNext(); - } - - public boolean hasNext() { - - return nextValue != null; - } - - public E next() throws NoSuchElementException { - E returnValue = nextValue; - - moveNext(); - return returnValue; - } - - private void moveNext() { - while(it.hasNext()) { - E unfilteredValue = it.next(); - - if (filter.test(unfilteredValue)) { - nextValue = unfilteredValue; - return; - } - } - - nextValue = null; - } - - public int nextInt() throws NoSuchElementException { - throw new NoSuchElementException("Iterator"); - } - - public long nextLong() throws NoSuchElementException { - throw new NoSuchElementException("Iterator"); - } - - public void remove() throws NoSuchElementException { - throw new NoSuchElementException("Iterator"); - } - - public interface Filter { - boolean test(E object); - } - -} diff --git a/database/hsqldb/src/org/hsqldb/lib/FrameworkLogger.java b/database/hsqldb/src/org/hsqldb/lib/FrameworkLogger.java deleted file mode 100644 index b009e135..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/FrameworkLogger.java +++ /dev/null @@ -1,727 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.LogManager; -import java.util.logging.Logger; - -/** - * A logging framework wrapper that supports java.util.logging and log4j. - *

    - * Logger hierarchies are stored at the Class level. - * Log4j will be used if the Log4j system (not necessarily config files) are - * found in the runtime classpath. - * Otherwise, java.util.logging will be used. - *

    - * This is pretty safe because for use cases where multiple hierarchies - * are desired, classloader hierarchies will effectively isolate multiple - * class-level Logger hierarchies. - *

    - * Sad as it is, the java.util.logging facility lacks the most basic - * developer-side and configuration-side capabilities. - * Besides having a non-scalable discovery system, the designers didn't - * comprehend the need for a level between WARNING and SEVERE! - * Since we don't want to require log4j in Classpath, we have to live - * with these constraints. - *

    - * As with all the popular logging frameworks, if you want to capture a - * stack trace, you must use the two-parameters logging methods. - * I.e., you must also pass a String, or only toString() from your - * throwable will be captured. - *

    - * Usage example: - * - *

    
    - * private static FrameworkLogger logger =
    - *        FrameworkLogger.getLog(SqlTool.class);
    - * ...
    - *   logger.finer("Doing something log-worthy");
    - * 
    - * - *

    - * The system level property hsqldb.reconfig_logging=false is - * required to avoid configuration of java.util.logging. Otherwise - * configuration takes place. - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @version 2.7.0 - * @since 1.9.0 - */ -public class FrameworkLogger { - - /* - * FrameworkLogger coders: It would be convenient to be able to log - * states and such at debug level in this class. - * I tentatively think that using a logger instance early in the static - * lifecycle is too risky, possibly using the underlying plumbing before - * the application has had a chance to customize, and perhaps before - * classloaders have been re-prioritized, etc. - * Could be that it all works out ok, but make sure you consider all - * situations before logging with FrameworkLogger instances here. - * This is one reason why there are a couple uses of System.err below. - */ - - /** - * Utility method for integrators. Returns a string representation of the - * active Logger instance keys. - * - *

    Not named similar to 'toString' to avoid ambiguity with instance - * method toString.

    - * - * @return String - */ - public static synchronized String report() { - - return new StringBuilder().append(loggerInstances.size()).append( - " logger instances: ").append( - loggerInstances.keySet()).toString(); - } - - static private Map loggerInstances = new HashMap(); - static private Map jdkToLog4jLevels = new HashMap(); - static private Method log4jGetLogger; - static private Method log4jLogMethod; - static private boolean callerFqcnAvailable = false; - private Object log4jLogger; - private Logger jdkLogger; - - // No need for more than one static, since we have only one console - static private boolean noopMode; // If true, then logging calls do nothing - - static { - try { - reconfigure(); - } catch (SecurityException e) {} - } - - /** - * Frees Logger(s), if any, with the specified category, or that begins with - * the specified prefix + dot. - * - *

    Note that as of today, this depends on the underlying logging - * framework implementation to release the underlying Logger instances. JUL - * in Sun's JVM uses weak references, so that should be fine. Log4j as of - * today seems to use strong references (and no API hooks to free anything), - * so this method will probably have little benefit for Log4j. - * - * @param prefixToZap String - */ - public static synchronized void clearLoggers(String prefixToZap) { - - Set targetKeys = new HashSet(); - Iterator it = loggerInstances.keySet().iterator(); - String k; - String dottedPrefix = prefixToZap + '.'; - - while (it.hasNext()) { - k = (String) it.next(); - - if (k.equals(prefixToZap) || k.startsWith(dottedPrefix)) { - targetKeys.add(k); - } - } - - loggerInstances.keySet().removeAll(targetKeys); - } - - private static synchronized void populateJdkToLog4jLevels( - String classString) - throws ClassNotFoundException, IllegalAccessException, - NoSuchMethodException, InvocationTargetException { - - Method log4jToLevel = Class.forName(classString).getMethod("toLevel", - new Class[]{ String.class }); - - jdkToLog4jLevels.put(Level.ALL, - log4jToLevel.invoke(null, new Object[]{ "ALL" })); - jdkToLog4jLevels.put(Level.FINER, - log4jToLevel.invoke(null, - new Object[]{ "DEBUG" })); - jdkToLog4jLevels.put(Level.SEVERE, - log4jToLevel.invoke(null, - new Object[]{ "FATAL" })); - jdkToLog4jLevels.put(Level.INFO, - log4jToLevel.invoke(null, - new Object[]{ "INFO" })); - jdkToLog4jLevels.put(Level.OFF, - log4jToLevel.invoke(null, new Object[]{ "OFF" })); - jdkToLog4jLevels.put(Level.FINEST, - log4jToLevel.invoke(null, - new Object[]{ "TRACE" })); - jdkToLog4jLevels.put(Level.WARNING, - log4jToLevel.invoke(null, - new Object[]{ "WARN" })); - } - - /** - * Reconfigure log4j if present. - * (TODO: Class-presence test is inadequate. Should check - * Log4j is actuall used). - * Reconfigure java.util.logging otherwise - */ - static void reconfigure() { - - noopMode = false; - - Class log4jLoggerClass = null; - Class log4jManagerClass = null; - - loggerInstances.clear(); - jdkToLog4jLevels.clear(); - - log4jGetLogger = null; - log4jLogMethod = null; - callerFqcnAvailable = false; - - // Precedence: - // 1) Use log4j v2 if available and class initialization succeeds - // 2) Use log4j v1 if available and class initialization succeeds - // 3) JUL - try { - - // log4j v2 available? - log4jLoggerClass = - Class.forName("org.apache.logging.log4j.Logger"); - log4jManagerClass = - Class.forName("org.apache.logging.log4j.LogManager"); - } catch (Exception e) { - - // The class will only load successfully if Log4j v2 thinks it is - // in usable state. - // Intentionally empty. - } - - // Attempt to configure log4j v2 - if (log4jLoggerClass != null) { - try { - populateJdkToLog4jLevels("org.apache.logging.log4j.Level"); - - log4jLogMethod = log4jLoggerClass.getMethod("log", - new Class[] { - Class.forName("org.apache.logging.log4j.Level"), - Object.class, Throwable.class - }); - log4jGetLogger = log4jManagerClass.getMethod("getLogger", - new Class[]{ String.class }); - - // This last object is what we toggle on to generate either - // Log4j or Jdk Logger objects (to wrap). - return; // Success for Log4j v2 - } catch (Exception e) { - - // This is an unexpected problem, because our Log4j try block will - // only be attempted if Log4j itself initialized (even if it - // successfully initialized with warnings due to bad config). - try { - System.err.println( - " failure " - + "instantiating configured Log4j v2 system: " + e); - - // It's possible we don't have write access to System.err. - } catch (Throwable t) { - - // Intentionally empty. We tried our best to report problem, - // but don't want to throw and prevent JUL from working. - } - } - } - - // Reset - log4jLoggerClass = null; - log4jManagerClass = null; - log4jLogMethod = null; - log4jGetLogger = null; - - jdkToLog4jLevels.clear(); - - try { - - // log4j v1 available? - log4jLoggerClass = Class.forName("org.apache.log4j.Logger"); - log4jManagerClass = log4jLoggerClass; - } catch (Exception e) { - - // The class will only load successfully if Log4j v1 thinks it is - // in usable state. - // Intentionally empty. - } - - // Attempt to configure log4j v1 - if (log4jLoggerClass != null) { - try { - populateJdkToLog4jLevels("org.apache.log4j.Level"); - - log4jLogMethod = log4jLoggerClass.getMethod("log", - new Class[] { - String.class, Class.forName("org.apache.log4j.Priority"), - Object.class, Throwable.class - }); - log4jGetLogger = log4jManagerClass.getMethod("getLogger", - new Class[]{ String.class }); - - // This last object is what we toggle on to generate either - // Log4j or Jdk Logger objects (to wrap). - callerFqcnAvailable = true; - - return; // Success for Log4j v1 - } catch (Exception e) { - - // This is an unexpected problem, because our Log4j try block will - // only be attempted if Log4j itself initialized (even if it - // successfully initialized with warnings due to bad config). - try { - System.err.println( - " failure " - + "instantiating configured Log4j v1 system: " + e); - - // It's possible we don't have write access to System.err. - } catch (Throwable t) { - - // Intentionally empty. We tried our best to report problem, - // but don't want to throw and prevent JUL from working. - } - } - } - - // Reset - log4jLoggerClass = null; - log4jManagerClass = null; - log4jLogMethod = null; - log4jGetLogger = null; - callerFqcnAvailable = false; - - jdkToLog4jLevels.clear(); - - String propVal = System.getProperty("hsqldb.reconfig_logging"); - - // from 2.7.0 the system property must be set to true for any reconfig - // the new hsqldb.extlog=level property specifies the level above which - // messages are logged to JUL OR Log4J - if (propVal == null || !propVal.equalsIgnoreCase("true")) { - return; - } - - // Set up java.util.logging - InputStream istream = null; - - try { - LogManager lm = LogManager.getLogManager(); - - //lm.reset(); - if (System.getProperty("java.util.logging.config.class") != null - || System.getProperty("java.util.logging.config.file") - != null) { - - // App has explicitly configured logging, so do not - // apply hsqldb customizations, but still do not run - // updateConfiguration in case previously loaded hsqldb - // customizations before app customized. - lm.readConfiguration(); - - //lm.updateConfiguration(null); - /* This only for system debugging: - System.err.println(FrameworkLogger.class.getName() - + " reconfigured HANDS-OFF"); - */ - return; - } - - String path = - "/org/hsqldb/resources/jdklogging-default.properties"; - ConsoleHandler consoleHandler = new ConsoleHandler(); - - consoleHandler.setFormatter(new BasicTextJdkLogFormatter(false)); - consoleHandler.setLevel(Level.INFO); - - istream = FrameworkLogger.class.getResourceAsStream(path); - - if (istream == null) { - throw new Exception( - "Failed to resolve default logging config from'" + path - + "'"); - } - - lm.readConfiguration(istream); - - Logger cmdlineLogger = Logger.getLogger("org.hsqldb.cmdline"); - - cmdlineLogger.addHandler(consoleHandler); - cmdlineLogger.setUseParentHandlers(false); - /* This only for system debugging: - System.err.println(FrameworkLogger.class.getName() - + " reconfigured HSQLDB with file '" + path + "'"); - */ - } catch (Exception e) { - noopMode = true; - - System.err.println( - " failure initializing JDK logging system. " - + "Continuing without Application logging. " + e); - e.printStackTrace(); - } finally { - if (istream != null) { - try { - istream.close(); - } catch (IOException ioe) { - System.err.println("Failed to close logging input stream: " - + ioe); - } - } - } - } - - /** - * User may not use the constructor. - * - * @param s String - */ - private FrameworkLogger(String s) { - - if (!noopMode) { - if (log4jGetLogger == null) { - jdkLogger = Logger.getLogger(s); - } else { - try { - log4jLogger = log4jGetLogger.invoke(null, - new Object[]{ s }); - } catch (Exception e) { - throw new RuntimeException( - "Failed to instantiate Log4j Logger", e); - } - } - } - - synchronized (FrameworkLogger.class) { - loggerInstances.put(s, this); - } - } - - /** - * User's entry-point into this logging system.

    You normally want to - * work with static (class-level) pointers to logger instances, for - * performance efficiency. See the class-level JavaDoc for a usage example. - * - * @param c Class - * @return FrameworkLogger - */ - public static FrameworkLogger getLog(Class c) { - return getLog(c.getName()); - } - - /** - * This method just defers to the getLog(Class) method unless default (no - * local configuration) JDK logging is being used; In that case, this method - * assures that the returned logger has an associated FileHander using the - * supplied String identifier. - * - * @param c Class - * @param contextId String - * @return FrameworkLogger - */ - public static FrameworkLogger getLog(Class c, String contextId) { - return (contextId == null) ? getLog(c) - : getLog(contextId + '.' + c.getName()); - } - - /** - * This method just defers to the getLog(String) method unless default (no - * local configuration) JDK logging is being used; In that case, this method - * assures that the returned logger has an associated FileHander using the - * supplied String identifier. - * - * @param baseId String - * @param contextId String - * @return FrameworkLogger - */ - public static FrameworkLogger getLog(String baseId, String contextId) { - return (contextId == null) ? getLog(baseId) - : getLog(contextId + '.' + baseId); - } - - /** - * Alternative entry-point into this logging system, for cases where you - * want to share a single logger instance among multiple classes, or you - * want to use multiple logger instances from a single class. - * - * @see #getLog(Class) - * @param s String - * @return FrameworkLogger - */ - public static synchronized FrameworkLogger getLog(String s) { - - if (loggerInstances.containsKey(s)) { - return (FrameworkLogger) loggerInstances.get(s); - } - - return new FrameworkLogger(s); - } - - /** - * Just like FrameworkLogger.log(Level, String), - * but also logs a stack trace. - * - * @param level java.util.logging.Level level to filter and log at - * @param message Message to be logged - * @param t Throwable whose stack trace will be logged. - * @see #log(Level, String) - * @see Logger#log(Level, String) - * @see Level - */ - public void log(Level level, String message, Throwable t) { - privlog(level, message, t, 2, FrameworkLogger.class); - } - - /** - * The "priv" prefix is historical. This is for special usage when you need - * to modify the reported call stack. If you don't know that you want to do - * this, then you should not use this method. - * - * @param level Level - * @param message String - * @param t Throwable - * @param revertMethods int - * @param skipClass Class - */ - public void privlog(Level level, String message, Throwable t, - int revertMethods, Class skipClass) { - - if (noopMode) { - return; - } - - if (log4jLogger == null) { - StackTraceElement[] elements = new Throwable().getStackTrace(); - String c = ""; - String m = ""; - - if (elements.length > revertMethods) { - c = elements[revertMethods].getClassName(); - m = elements[revertMethods].getMethodName(); - } - - if (t == null) { - jdkLogger.logp(level, c, m, message); - } else { - jdkLogger.logp(level, c, m, message, t); - } - } else { - try { - log4jLogMethod.invoke(log4jLogger, - callerFqcnAvailable ? new Object[] { - skipClass.getName(), jdkToLog4jLevels.get(level), message, - t - } - : new Object[] { - jdkToLog4jLevels.get(level), message, t - }); - } catch (Exception e) { - throw new RuntimeException( - "Logging failed when attempting to log: " + message, e); - } - } - } - - public void enduserlog(Level level, String message) { - - /* This method is SqlTool-specific, which is where this class began at. - * Need to move this back there, but it needs access to the logging - * structures private to this class. Thinking... - */ - if (noopMode) { - return; - } - - if (log4jLogger == null) { - String c = FrameworkLogger.class.getName(); - String m = "\\l"; - - jdkLogger.logp(level, c, m, message); - } else { - try { - Object[] args = callerFqcnAvailable ? new Object[] { - FrameworkLogger.class.getName(), - jdkToLog4jLevels.get(level), message, null - } - : new Object[] { - jdkToLog4jLevels.get(level), message, null - }; - - log4jLogMethod.invoke(log4jLogger, args); - - // Test where SqlFile correct here. - } catch (Exception e) { - throw new RuntimeException( - "Logging failed when attempting to log: " + message, e); - } - } - } - - // Wrappers - - /** - * @param level java.util.logging.Level level to filter and log at - * @param message Message to be logged - * @see Logger#log(Level, String) - * @see Level - */ - public void log(Level level, String message) { - privlog(level, message, null, 2, FrameworkLogger.class); - } - - /** - * @param message Message to be logged - * @see Logger#finer(String) - */ - public void finer(String message) { - privlog(Level.FINER, message, null, 2, FrameworkLogger.class); - } - - /** - * @param message Message to be logged - * @see Logger#warning(String) - */ - public void warning(String message) { - privlog(Level.WARNING, message, null, 2, FrameworkLogger.class); - } - - /** - * @param message Message to be logged - * @see Logger#severe(String) - */ - public void severe(String message) { - privlog(Level.SEVERE, message, null, 2, FrameworkLogger.class); - } - - /** - * @param message Message to be logged - * @see Logger#info(String) - */ - public void info(String message) { - privlog(Level.INFO, message, null, 2, FrameworkLogger.class); - } - - /** - * @param message Message to be logged - * @see Logger#finest(String) - */ - public void finest(String message) { - privlog(Level.FINEST, message, null, 2, FrameworkLogger.class); - } - - /** - * This is just a wrapper for FrameworkLogger.warning(), because - * java.util.logging lacks a method for this critical purpose. - * - * @param message Message to be logged - * @see #warning(String) - */ - public void error(String message) { - privlog(Level.WARNING, message, null, 2, FrameworkLogger.class); - } - - /** - * Just like FrameworkLogger.finer(String), but also logs a stack trace. - * - * @param message String - * @param t Throwable whose stack trace will be logged. - * @see #finer(String) - */ - public void finer(String message, Throwable t) { - privlog(Level.FINER, message, t, 2, FrameworkLogger.class); - } - - /** - * Just like FrameworkLogger.warning(String), but also logs a stack trace. - * - * @param message String - * @param t Throwable whose stack trace will be logged. - * @see #warning(String) - */ - public void warning(String message, Throwable t) { - privlog(Level.WARNING, message, t, 2, FrameworkLogger.class); - } - - /** - * Just like FrameworkLogger.severe(String), but also logs a stack trace. - * - * @param message String - * @param t Throwable whose stack trace will be logged. - * @see #severe(String) - */ - public void severe(String message, Throwable t) { - privlog(Level.SEVERE, message, t, 2, FrameworkLogger.class); - } - - /** - * Just like FrameworkLogger.info(String), but also logs a stack trace. - * - * @param message String - * @param t Throwable whose stack trace will be logged. - * @see #info(String) - */ - public void info(String message, Throwable t) { - privlog(Level.INFO, message, t, 2, FrameworkLogger.class); - } - - /** - * Just like FrameworkLogger.finest(String), but also logs a stack trace. - * - * @param message String - * @param t Throwable whose stack trace will be logged. - * @see #finest(String) - */ - public void finest(String message, Throwable t) { - privlog(Level.FINEST, message, t, 2, FrameworkLogger.class); - } - - /** - * Just like FrameworkLogger.error(String), but also logs a stack trace. - * - * @param message String - * @param t Throwable whose stack trace will be logged. - * @see #error(String) - */ - public void error(String message, Throwable t) { - privlog(Level.WARNING, message, t, 2, FrameworkLogger.class); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HashMap.java b/database/hsqldb/src/org/hsqldb/lib/HashMap.java deleted file mode 100644 index 2dcb3080..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HashMap.java +++ /dev/null @@ -1,260 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.lib.Map.Entry; - -import org.hsqldb.map.BaseHashMap; - -/** - * This class does not store null keys. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class HashMap extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - public HashMap() { - this(8); - } - - public HashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.objectKeyOrValue, - BaseHashMap.objectKeyOrValue, false); - } - - public HashMap(int initialCapacity, ObjectComparator comparator) throws IllegalArgumentException { - this(initialCapacity); - - this.comparator = comparator; - } - - public boolean containsKey(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - return super.containsValue(value); - } - - public V get(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - int hash = comparator.hashCode(key); - int lookup = getLookup(key, hash); - - if (lookup != -1) { - return (V) objectValueTable[lookup]; - } - - return null; - } - - public V put(K key, V value) { - - if (key == null) { - throw new NullPointerException(); - } - - return (V) super.addOrUpdate(0, 0, key, value); - } - - public V remove(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return (V) super.remove(0, 0, key, null, false, false); - } - - /** - * Removes the spacific key, value pair. - * - * @param key the key - * @param value the value - * @return the value associated with the key, or null if none - */ - - public boolean remove(Object key, Object value) { - - if (key == null) { - throw new NullPointerException(); - } - - Object result = super.remove(0, 0, key, value, true, false); - - return result != null; - } - - - public void putAll(Map m) { - - Iterator it = m.keySet().iterator(); - - while (it.hasNext()) { - K key = it.next(); - - if (key == null) { - continue; - } - - put(key, m.get(key)); - } - } - - public T[] keysToArray(T[] array) { - return toArray(array, true); - } - - public T[] valuesToArray(T[] array) { - return toArray(array, false); - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return HashMap.this.new EntrySetIterator(); - } - - public int size() { - return HashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - K key = (K) super.next(); - V value = (V) objectValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public Iterator iterator() { - return HashMap.this.new BaseHashIterator(true); - } - - public int size() { - return HashMap.this.size(); - } - - public boolean contains(Object key) { - return containsKey(key); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return HashMap.this.toArray(true); - } - - public T[] toArray(T[] array) { - return HashMap.this.toArray(array, true); - } - } - - private class Values extends AbstractReadOnlyCollection { - - public Iterator iterator() { - return HashMap.this.new BaseHashIterator(false); - } - - public int size() { - return HashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return HashMap.this.toArray(false); - } - - public T[] toArray(T[] array) { - return HashMap.this.toArray(array, false); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HashSet.java b/database/hsqldb/src/org/hsqldb/lib/HashSet.java deleted file mode 100644 index 2e894a1c..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HashSet.java +++ /dev/null @@ -1,304 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.map.BaseHashMap; - -/** - * This class does not store null keys. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.7.2 - */ -public class HashSet extends BaseHashMap implements Set { - - public HashSet() { - this(8); - } - - public HashSet(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.objectKeyOrValue, - BaseHashMap.noKeyOrValue, false); - } - - public HashSet(int initialCapacity, - ObjectComparator comparator) - throws IllegalArgumentException { - - this(initialCapacity); - - this.comparator = comparator; - } - - public HashSet(Object[] valueList) { - this(valueList.length); - - for (int i = 0; i < valueList.length; i++) { - add((E) valueList[i]); - } - } - - public boolean contains(Object key) { - return super.containsKey(key); - } - - public boolean containsAll(Collection col) { - - Iterator it = col.iterator(); - - while (it.hasNext()) { - if (contains(it.next())) { - continue; - } - - return false; - } - - return true; - } - - public E getOrAdd(E key) { - - if (key == null) { - throw new NullPointerException(); - } - - E value = get(key); - - if (value == null) { - value = key; - - add(key); - } - - return value; - } - - public E get(E key) { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup < 0) { - return null; - } else { - return (E) objectKeyTable[lookup]; - } - } - - /** - * returns true if element is added - * - * @param key the element - * @return true if added - */ - public boolean add(E key) { - if (key == null) { - throw new NullPointerException(); - } - - return (Boolean) super.addOrUpdate(0, 0, key, null); - } - - /** returns true if any element is added - * - * @param c the Collection to add - * @return true if any element is added - */ - public boolean addAll(Collection c) { - - boolean changed = false; - Iterator it = c.iterator(); - - while (it.hasNext()) { - changed |= add(it.next()); - } - - return changed; - } - - /** returns true if any element is added - * - * @param keys the array of elements to add - * @return true if any element is added - */ - public boolean addAll(E[] keys) { - - boolean changed = false; - - for (int i = 0; i < keys.length; i++) { - changed |= add(keys[i]); - } - - return changed; - } - - /** - * returns true if any added - * - * @param keys array of keys to add - * @param start first index to add - * @param limit limit of index to add - * @return true if any element was added - */ - public boolean addAll(E[] keys, int start, int limit) { - - boolean changed = false; - - for (int i = start; i < keys.length && i < limit; i++) { - changed |= add(keys[i]); - } - - return changed; - } - - /** - * returns true if removed - * - * @param key Object to remove - * @return true if removed - */ - public boolean remove(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return (Boolean) super.remove(0, 0, key, null, false, false); - } - - /** - * returns true if all were removed - * - * @param c Collection of elements to remove - * @return true if all removed - */ - public boolean removeAll(Collection c) { - - Iterator it = c.iterator(); - boolean result = true; - - while (it.hasNext()) { - result &= remove(it.next()); - } - - return result; - } - - public boolean retainAll(Collection c) { - - boolean changed = false; - - Iterator it = iterator(); - - while (it.hasNext()) { - if (!c.contains(it.next())) { - it.remove(); - changed = true; - } - } - - return changed; - } - - /** - * returns true if all were removed - * - * @param keys E[] - * @return boolean - */ - public boolean removeAll(E[] keys) { - - boolean result = true; - - for (int i = 0; i < keys.length; i++) { - result &= remove(keys[i]); - } - - return result; - } - - public int getCommonElementCount(Set other) { - - int count = 0; - - Iterator it = iterator(); - - while (it.hasNext()) { - if (other.contains(it.next())) { - count++; - } - } - - return count; - } - - public T[] toArray(T[] a) { - return toArray(a, true); - } - - public Object[] toArray() { - return toArray(true); - } - - public Iterator iterator() { - return new BaseHashIterator(true); - } - - /** - * Returns a String like "[Drei, zwei, Eins]", exactly like - * java.util.HashSet. - * - * @return String representation - */ - public String toString() { - - Iterator it = iterator(); - StringBuilder sb = new StringBuilder(); - - while (it.hasNext()) { - if (sb.length() > 0) { - sb.append(", "); - } else { - sb.append('['); - } - - sb.append(it.next()); - } - - return sb.toString() + ']'; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlArrayHeap.java b/database/hsqldb/src/org/hsqldb/lib/HsqlArrayHeap.java deleted file mode 100644 index 5c6edfae..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlArrayHeap.java +++ /dev/null @@ -1,334 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Comparator; - -/** - * An HsqlHeap implementation backed by an array of objects and an - * {@link ObjectComparator ObjectComparator}. This implementation - * is non-blocking, dynamically resizing and thread-safe. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class HsqlArrayHeap implements HsqlHeap { - -// --------------------------------- members ----------------------------------- - protected Comparator oc; - protected int count; - protected Object[] heap; - -// ------------------------------ constructors --------------------------------- - - /** - * Creates a new HsqlArrayHeap with the given initial capacity, using the - * specified ObjectComparator to maintain the heap invariant. - * - * @throws IllegalArgumentException if capacity less or equal to zero or - * comparator is null - * @param capacity int - * @param comparator Comparator - */ - public HsqlArrayHeap(int capacity, - Comparator comparator) - throws IllegalArgumentException { - - if (capacity <= 0) { - throw new IllegalArgumentException("" + capacity); - } - - if (comparator == null) { - throw new IllegalArgumentException("null comparator"); - } - - heap = new Object[capacity]; - oc = comparator; - } - -// /** Copy constructor (optional) */ -// public HsqlArrayHeap(HsqlArrayHeap other) { -// count = other.count; -// oc = other.oc; -// heap = new Object[count]; -// System.arraycopy(other.heap,0, heap, 0, count); -// } -// -------------------------- interface Implementation ------------------------- - public synchronized void clear() { - - for (int i = 0; i < count; ++i) { - heap[i] = null; - } - - count = 0; - } - - public synchronized boolean add(E o) { - - int ci; // current index - int pi; // parent index - - if (o == null) { - throw new IllegalArgumentException("null element"); - } - - if (isFull()) { - return false; - } - - if (count >= heap.length) { - increaseCapacity(); - } - - ci = count; - - count++; - - do { - if (ci <= 0) { - break; - } - - pi = (ci - 1) >>> 1; - - try { - if (oc.compare(o, heap[pi]) >= 0) { - break; - } - } catch (Exception e) { - throw new IllegalArgumentException(e.toString()); - } - - heap[ci] = heap[pi]; - ci = pi; - } while (true); - - heap[ci] = o; - - return true; - } - - public synchronized boolean isEmpty() { - return count == 0; - } - - public synchronized boolean isFull() { - - // almost impossible for this to happen - return count == Integer.MAX_VALUE; - } - - public synchronized E peek() { - return (E) heap[0]; - } - - public synchronized E remove() { - - int ci; // current index - int li; // left index - int ri; // right index - int chi; // child index - E co; - E ro; - - if (count == 0) { - return null; - } - - ci = 0; - ro = (E) heap[ci]; - - count--; - - if (count == 0) { - heap[0] = null; - - return ro; - } - - co = (E) heap[count]; - heap[count] = null; - - do { - li = (ci << 1) + 1; - - if (li >= count) { - break; - } - - ri = (ci << 1) + 2; - chi = (ri >= count || oc.compare(heap[li], heap[ri]) < 0) ? li - : ri; - - if (oc.compare(co, heap[chi]) <= 0) { - break; - } - - heap[ci] = heap[chi]; - ci = chi; - } while (true); - - heap[ci] = co; - - return ro; - } - - public synchronized int size() { - return count; - } - -// ------------- standard object and collection methods (optional) ------------- -// public synchronized Object clone() throws CloneNotSupportedException { -// return new HsqlArrayHeap(this); -// } -// -// public synchronized java.util.Enumeration elements() { -// -// Object[] elements; -// -// elements = new Object[count]; -// -// System.arraycopy(heap, 0, elements, 0, count); -// -// return new HsqlEnumeration(elements); -// } -// -// public synchronized boolean equals(Object o) { -// -// HsqlArrayHeap other; -// HsqlArrayHeap thiscopy; -// HsqlArrayHeap othercopy; -// -// if (this == o) { -// return true; -// } -// -// if (!(o instanceof HsqlArrayHeap)) { -// return false; -// } -// -// other = (HsqlArrayHeap) o; -// -// if (count != other.size()) { -// return false; -// } -// -// // this is a bit "iffy"... non-equal comparators _might_ still -// // be _equivalent_ under current element content... -// -// if (!oc.equals(other.oc)) { -// return false; -// } -// -// thiscopy = new HsqlArrayHeap(this); -// othercopy = new HsqlArrayHeap(other); -// -// while(!thiscopy.isEmpty()) { -// if (!thiscopy.remove().equals(othercopy.remove())) { -// return false; -// } -// } -// -// return true; -// } -// -// public synchronized Object[] toArray(Object a[]) { -// -// if (a == null) { -// a = new Object[count]; -// } else if ( a.length < count) { -// a = (Object[]) java.lang.reflect.Array.newInstance( -// a.getClass().getComponentType(), count); -// } -// -// System.arraycopy(heap, 0, a, 0, count); -// -// for (int i = count; i < a.length; i++) { -// a[i] = null; -// } -// -// return a; -// } -// - public synchronized String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append(super.toString()); - sb.append(" : size="); - sb.append(count); - sb.append(' '); - sb.append('['); - - for (int i = 0; i < count; i++) { - sb.append(heap[i]); - - if (i + 1 < count) { - sb.append(','); - sb.append(' '); - } - } - - sb.append(']'); - - return sb.toString(); - } - -// -// public void trim() { -// -// Object[] oldheap; -// -// oldheap = heap; -// -// heap = new Object[count == 0 ? 16 : count]; -// -// System.arraycopy(oldheap, 0, heap, 0, count); -// } -// -------------------- internal implementation methods ------------------------ - private void increaseCapacity() { - - Object[] oldheap; - - // no handling of boundary conditions. - // In the highly unlikely event of a rollover, - // in theory, an exception will be thrown (negative array index in - // array allocation?) - oldheap = heap; - - // as per java collections, v.s. JDK 1.1 java util. - heap = new Object[3 * heap.length / 2 + 1]; - - System.arraycopy(oldheap, 0, heap, 0, count); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlArrayList.java b/database/hsqldb/src/org/hsqldb/lib/HsqlArrayList.java deleted file mode 100644 index d402a3a4..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlArrayList.java +++ /dev/null @@ -1,464 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.lang.reflect.Array; -import java.util.Arrays; -import java.util.Comparator; - -// fredt@users - 1.8.0 - 2.5.x - enhancements - -/** - * Intended as an asynchronous alternative to Vector. - * - * @author dnordahl@users - * @version 2.6.0 - * @since 1.7.0 - */ -public class HsqlArrayList extends BaseList implements List { - -//fredt@users -/* - private static Reporter reporter = new Reporter(); - - private static class Reporter { - - private static int initCounter = 0; - private static int updateCounter = 0; - - Reporter() { - - try { - System.runFinalizersOnExit(true); - } catch (SecurityException e) {} - } - - protected void finalize() { - - System.out.println("HsqlArrayList init count: " + initCounter); - System.out.println("HsqlArrayList update count: " - + updateCounter); - } - } -*/ - private static final int DEFAULT_INITIAL_CAPACITY = 8; - private static final float DEFAULT_RESIZE_FACTOR = 2.0f; - E[] elementData; - E[] reserveElementData; - private boolean minimizeOnClear; - - public HsqlArrayList(E[] data, int count) { - elementData = data; - elementCount = count; - } - - /** Creates a new instance of HsqlArrayList */ - @SuppressWarnings( "unchecked" ) - public HsqlArrayList() { - -// reporter.initCounter++; - elementData = (E[]) new Object[DEFAULT_INITIAL_CAPACITY]; - } - - /** - * Creates a new instance of HsqlArrayList that minimizes the size when empty - * - * @param initialCapacity int - * @param minimize boolean - */ - @SuppressWarnings( "unchecked" ) - public HsqlArrayList(int initialCapacity, boolean minimize) { - -// reporter.initCounter++; - if (initialCapacity < DEFAULT_INITIAL_CAPACITY) { - initialCapacity = DEFAULT_INITIAL_CAPACITY; - } - - elementData = (E[]) new Object[initialCapacity]; - minimizeOnClear = minimize; - } - - /** - * Creates a new instance with the given initial capacity - * - * @param initialCapacity int - */ - @SuppressWarnings( "unchecked" ) - public HsqlArrayList(int initialCapacity) { - -// reporter.initCounter++; - if (initialCapacity < 0) { - throw new NegativeArraySizeException( - "Invalid initial capacity given"); - } - - if (initialCapacity < DEFAULT_INITIAL_CAPACITY) { - initialCapacity = DEFAULT_INITIAL_CAPACITY; - } - - elementData = (E[]) new Object[initialCapacity]; - } - - /** - * Inserts an element at the given index - * - * @param index int - * @param element E - */ - public void add(int index, E element) { - -// reporter.updateCounter++; - if (index > elementCount) { - throw new IndexOutOfBoundsException("Index out of bounds: " - + index + ">" + elementCount); - } - - if (index < 0) { - throw new IndexOutOfBoundsException("Index out of bounds: " - + index + " < 0"); - } - - if (elementCount >= elementData.length) { - increaseCapacity(); - } - - if (index < elementCount) { - System.arraycopy(elementData, index, elementData, index + 1, - elementCount - index); - } - - elementData[index] = element; - - elementCount++; - } - - /** - * Appends an element to the end of the list - * - * @param element E - * @return boolean - */ - @Override - public boolean add(E element) { - -// reporter.updateCounter++; - if (elementCount >= elementData.length) { - increaseCapacity(); - } - - elementData[elementCount] = element; - - elementCount++; - - return true; - } - - /** - * Gets the element at given position - * - * @param index int - * @return E - */ - @Override - public E get(int index) { - - if (index >= elementCount) { - throw new IndexOutOfBoundsException("Index out of bounds: " - + index + " >= " - + elementCount); - } - - return elementData[index]; - } - - /** - * returns the index of given object or -1 if not found - * - * @param o Object - * @return int - */ - @Override - public int indexOf(Object o) { - - if (o == null) { - for (int i = 0; i < elementCount; i++) { - if (elementData[i] == null) { - return i; - } - } - - return -1; - } - - for (int i = 0; i < elementCount; i++) { - if (comparator.equals(o, elementData[i])) { - return i; - } - } - - return -1; - } - - /** - * Removes and returns the element at given position - * - * @param index int - * @return E - */ - @Override - public E remove(int index) { - - if (index >= elementCount) { - throw new IndexOutOfBoundsException("Index out of bounds: " - + index + " >= " - + elementCount); - } - - E removedObj = elementData[index]; - - if (index < elementCount - 1) { - System.arraycopy(elementData, index + 1, elementData, index, - elementCount - 1 - index); - } - - elementCount--; - - elementData[elementCount] = null; - - if (elementCount == 0) { - clear(); - } - - return removedObj; - } - - /** - * Replaces the element at given position - * - * @param index int - * @param element E - * @return E - */ - public E set(int index, E element) { - - if (index >= elementCount) { - throw new IndexOutOfBoundsException("Index out of bounds: " - + index + " >= " - + elementCount); - } - - E replacedObj = elementData[index]; - - elementData[index] = element; - - return replacedObj; - } - - /** - * Returns the number of elements in the array list - * - * @return int - */ - @Override - public final int size() { - return elementCount; - } - - private void increaseCapacity() { - - int baseSize = elementData.length == 0 ? 1 - : elementData.length; - - baseSize = (int) (baseSize * DEFAULT_RESIZE_FACTOR); - - resize(baseSize); - } - - private void resize(int baseSize) { - - if (baseSize == elementData.length) { - return; - } - - @SuppressWarnings( "unchecked" ) - E[] newArray = (E[]) Array.newInstance( - elementData.getClass().getComponentType(), baseSize); - int count = elementData.length > newArray.length ? newArray.length - : elementData.length; - - System.arraycopy(elementData, 0, newArray, 0, count); - - if (minimizeOnClear && reserveElementData == null) { - Arrays.fill(elementData, 0); - - reserveElementData = elementData; - } - - elementData = newArray; - } - - /** Trims the array to be the same size as the number of elements. */ - public void trim() { - - // 0 size array is possible - resize(elementCount); - } - - public void clear() { - - if (minimizeOnClear && reserveElementData != null) { - elementData = reserveElementData; - reserveElementData = null; - elementCount = 0; - - return; - } - - for (int i = 0; i < elementCount; i++) { - elementData[i] = null; - } - - elementCount = 0; - } - - /** - * Increase or reduce the size, setting discarded or added elements to null. - * - * @param newSize int - */ - public void setSize(int newSize) { - - if (newSize == 0) { - clear(); - - return; - } - - if (newSize <= elementCount) { - for (int i = newSize; i < elementCount; i++) { - elementData[i] = null; - } - - elementCount = newSize; - - return; - } - - for (; newSize > elementData.length; ) { - increaseCapacity(); - } - - elementCount = newSize; - } - - public Object[] toArray() { - - Object[] newArray = new Object[elementCount]; - - System.arraycopy(elementData, 0, newArray, 0, elementCount); - - return newArray; - } - - /** - * Copies all elements of the list to a[].

    - * - * If a[] is too small, a new array or the same type is returned.

    - * - * If a[] is larger, only the list elements are copied and no other - * change is made to the array.

    - * - * Differs from the implementation in java.util.ArrayList in the second - * aspect. - * - * @param type of array element - * @param array T[] - * @return T[] - */ - public T[] toArray(T[] array) { - - if (array.length < elementCount) { - array = (T[]) Array.newInstance(array.getClass().getComponentType(), - elementCount); - } - - System.arraycopy(elementData, 0, array, 0, elementCount); - - return array; - } - - /** - * Copies elements of the list from start to limit to array. The array must - * be large enough. - * - * @param array E[] - * @param start int - * @param limit int - */ - public void toArraySlice(E[] array, int start, int limit) { - System.arraycopy(elementData, start, array, 0, limit - start); - } - - public E[] getArray() { - return elementData; - } - - public void sort(Comparator c) { - - if (elementCount < 2) { - return; - } - - ArraySort.sort(elementData, elementCount, c); - } - - public int lastIndexOf(Object o) { - - if (o == null) { - for (int i = elementCount - 1; i >= 0; i--) { - if (elementData[i] == null) { - return i; - } - } - - return -1; - } - - for (int i = elementCount - 1; i >= 0; i--) { - if (comparator.equals(o, elementData[i])) { - return i; - } - } - - return -1; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlByteArrayInputStream.java b/database/hsqldb/src/org/hsqldb/lib/HsqlByteArrayInputStream.java deleted file mode 100644 index c6af7dfb..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlByteArrayInputStream.java +++ /dev/null @@ -1,282 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.DataInput; -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; - -/** - * This class is a replacement for both java.io.ByteArrayInputStream - * (without synchronization) and java.io.DataInputStream - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.0 - * @since 1.7.2 - */ -public class HsqlByteArrayInputStream extends InputStream -implements DataInput { - - protected byte[] buffer; - protected int pos; - protected int mark = 0; - protected int count; - - public HsqlByteArrayInputStream(byte[] buf) { - - this.buffer = buf; - this.pos = 0; - this.count = buf.length; - } - - public HsqlByteArrayInputStream(byte[] buf, int offset, int length) { - - this.buffer = buf; - this.pos = offset; - this.count = Math.min(offset + length, buf.length); - this.mark = offset; - } - - public final long getPos() { - return pos; - } - - // methods that implement java.io.DataInput - public void readFully(byte[] b) throws IOException { - readFully(b, 0, b.length); - } - - public final void readFully(byte[] b, int off, - int len) throws IOException { - - if (len < 0) { - throw new IndexOutOfBoundsException(); - } - - int n = 0; - - while (n < len) { - int count = read(b, off + n, len - n); - - if (count < 0) { - throw new EOFException(); - } - - n += count; - } - } - - public boolean readBoolean() throws IOException { - - int ch = read(); - - if (ch < 0) { - throw new EOFException(); - } - - return ch != 0; - } - - public byte readByte() throws IOException { - - int ch = read(); - - if (ch < 0) { - throw new EOFException(); - } - - return (byte) ch; - } - - public final int readUnsignedByte() throws IOException { - - int ch = read(); - - if (ch < 0) { - throw new EOFException(); - } - - return ch; - } - - public short readShort() throws IOException { - - if (count - pos < 2) { - pos = count; - - throw new EOFException(); - } - - int ch1 = buffer[pos++] & 0xff; - int ch2 = buffer[pos++] & 0xff; - - return (short) ((ch1 << 8) + ch2); - } - - public final int readUnsignedShort() throws IOException { - - int ch1 = read(); - int ch2 = read(); - - if ((ch1 | ch2) < 0) { - throw new EOFException(); - } - - return (ch1 << 8) + ch2; - } - - public char readChar() throws IOException { - - int ch1 = read(); - int ch2 = read(); - - if ((ch1 | ch2) < 0) { - throw new EOFException(); - } - - return (char) ((ch1 << 8) + ch2); - } - - public int readInt() throws IOException { - - if (count - pos < 4) { - pos = count; - - throw new EOFException(); - } - - int ch1 = buffer[pos++] & 0xff; - int ch2 = buffer[pos++] & 0xff; - int ch3 = buffer[pos++] & 0xff; - int ch4 = buffer[pos++] & 0xff; - - return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + ch4); - } - - public long readLong() throws IOException { - return (((long) readInt()) << 32) + (((long) readInt()) & 0xffffffffL); - } - - public final float readFloat() throws IOException { - return Float.intBitsToFloat(readInt()); - } - - public final double readDouble() throws IOException { - return Double.longBitsToDouble(readLong()); - } - - public int skipBytes(int n) { - return (int) skip(n); - } - - public String readLine() { - - /* @todo: this will probably be useful */ - throw new java.lang.UnsupportedOperationException("not implemented"); - } - - public String readUTF() throws IOException { - - int bytecount = readUnsignedShort(); - - if (pos + bytecount >= count) { - throw new EOFException(); - } - - String result = StringConverter.readUTF(buffer, pos, bytecount); - - pos += bytecount; - - return result; - } - -// methods that extend java.io.InputStream - public int read() { - return (pos < count) ? (buffer[pos++] & 0xff) - : -1; - } - - public int read(byte[] b, int off, int len) { - - if (pos >= count) { - return -1; - } - - if (pos + len > count) { - len = count - pos; - } - - if (len <= 0) { - return 0; - } - - System.arraycopy(buffer, pos, b, off, len); - - pos += len; - - return len; - } - - public long skip(long n) { - - if (pos + n > count) { - n = count - pos; - } - - if (n < 0) { - return 0; - } - - pos += n; - - return n; - } - - public int available() { - return count - pos; - } - - public boolean markSupported() { - return true; - } - - public void mark(int readAheadLimit) { - mark = pos; - } - - public void reset() { - pos = mark; - } - - public void close() {} -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlByteArrayOutputStream.java b/database/hsqldb/src/org/hsqldb/lib/HsqlByteArrayOutputStream.java deleted file mode 100644 index b8f29a48..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlByteArrayOutputStream.java +++ /dev/null @@ -1,424 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.DataOutput; -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.UTFDataFormatException; -import java.io.UnsupportedEncodingException; - -/** - * This class is a replacement for both java.io.ByteArrayOuputStream - * (without synchronization) and java.io.DataOutputStream - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.7.0 - */ -public class HsqlByteArrayOutputStream extends OutputStream -implements DataOutput { - - protected byte[] buffer; - protected int count; - - public HsqlByteArrayOutputStream() { - this(128); - } - - public HsqlByteArrayOutputStream(int size) { - - if (size < 128) { - size = 128; - } - - buffer = new byte[size]; - } - - public HsqlByteArrayOutputStream(byte[] buffer) { - this.buffer = buffer; - } - - /** - * Constructor from an InputStream limits size to the length argument. - * Throws if the actual length of the InputStream is smaller than length - * value. - * - * @param input InputStream - * @param length int - * @throws IOException if an error occurs - */ - public HsqlByteArrayOutputStream(InputStream input, - int length) throws IOException { - - buffer = new byte[length]; - - int used = write(input, length); - - if (used != length) { - throw new EOFException(); - } - } - - public HsqlByteArrayOutputStream(InputStream input) throws IOException { - - buffer = new byte[128]; - - for (;;) { - int read = input.read(buffer, count, buffer.length - count); - - if (read == -1) { - break; - } - - count += read; - - if (count == buffer.length) { - ensureRoom(128); - } - } - } - - // methods that implement dataOutput - public void writeShort(int v) { - - ensureRoom(2); - - buffer[count++] = (byte) (v >>> 8); - buffer[count++] = (byte) v; - } - - public void writeInt(int v) { - - if (count + 4 > buffer.length) { - ensureRoom(4); - } - - buffer[count++] = (byte) (v >>> 24); - buffer[count++] = (byte) (v >>> 16); - buffer[count++] = (byte) (v >>> 8); - buffer[count++] = (byte) v; - } - - public void writeLong(long v) { - writeInt((int) (v >>> 32)); - writeInt((int) v); - } - - public void writeBytes(String s) { - - int len = s.length(); - - ensureRoom(len); - - for (int i = 0; i < len; i++) { - buffer[count++] = (byte) s.charAt(i); - } - } - - public final void writeFloat(float v) { - writeInt(Float.floatToIntBits(v)); - } - - public final void writeDouble(double v) { - writeLong(Double.doubleToLongBits(v)); - } - - public void writeBoolean(boolean v) { - - ensureRoom(1); - - buffer[count++] = (byte) (v ? 1 - : 0); - } - - public void writeByte(int v) { - - ensureRoom(1); - - buffer[count++] = (byte) v; - } - - public void writeChar(int v) { - - ensureRoom(2); - - buffer[count++] = (byte) (v >>> 8); - buffer[count++] = (byte) v; - } - - public void writeChars(String s) { - - int len = s.length(); - - ensureRoom(len * 2); - - for (int i = 0; i < len; i++) { - int v = s.charAt(i); - - buffer[count++] = (byte) (v >>> 8); - buffer[count++] = (byte) v; - } - } - - public void writeUTF(String str) throws IOException { - - int len = str.length(); - - if (len > 0xffff) { - throw new UTFDataFormatException(); - } - - ensureRoom(len * 3 + 2); - - // - int initpos = count; - - count += 2; - - StringConverter.stringToUTFBytes(str, this); - - int bytecount = count - initpos - 2; - - if (bytecount > 0xffff) { - count = initpos; - - throw new UTFDataFormatException(); - } - - buffer[initpos++] = (byte) (bytecount >>> 8); - buffer[initpos] = (byte) bytecount; - } - - /** - * does nothing - */ - public void flush() {} - - // methods that extend java.io.OutputStream - public void write(int b) { - - ensureRoom(1); - - buffer[count++] = (byte) b; - } - - public void write(byte[] b) { - write(b, 0, b.length); - } - - public void write(byte[] b, int off, int len) { - - ensureRoom(len); - System.arraycopy(b, off, buffer, count, len); - - count += len; - } - - public String toString() { - return new String(buffer, 0, count); - } - - public void close() {} - - // additional public methods not in similar java.util classes - public void writeNoCheck(int b) { - buffer[count++] = (byte) b; - } - - public void writeChars(char[] charArray) { - - int len = charArray.length; - - ensureRoom(len * 2); - - for (int i = 0; i < len; i++) { - int v = charArray[i]; - - buffer[count++] = (byte) (v >>> 8); - buffer[count++] = (byte) v; - } - } - - public int write(InputStream input, int countLimit) throws IOException { - - int left = countLimit; - - ensureRoom(countLimit); - - while (left > 0) { - int read = input.read(buffer, count, left); - - if (read == -1) { - break; - } - - left -= read; - count += read; - } - - return countLimit - left; - } - - public int write(Reader input, int countLimit) throws IOException { - - int left = countLimit; - - ensureRoom(countLimit * 2); - - while (left > 0) { - int c = input.read(); - - if (c == -1) { - break; - } - - writeChar(c); - - left--; - } - - return countLimit - left; - } - - public void writeTo(OutputStream out) throws IOException { - out.write(buffer, 0, count); - } - - public void reset() { - count = 0; - } - - public byte[] toByteArray() { - - byte[] newbuf = new byte[count]; - - System.arraycopy(buffer, 0, newbuf, 0, count); - - return newbuf; - } - - public final int size() { - return count; - } - - public void setPosition(int newPos) { - - if (newPos > buffer.length) { - throw new ArrayIndexOutOfBoundsException(); - } - - count = newPos; - } - - public String toString(String enc) throws UnsupportedEncodingException { - return new String(buffer, 0, count, enc); - } - - public void write(char[] c, int off, int len) { - - ensureRoom(len * 2); - - for (int i = off; i < len; i++) { - int v = c[i]; - - buffer[count++] = (byte) (v >>> 8); - buffer[count++] = (byte) v; - } - } - - public void fill(int b, int len) { - - ensureRoom(len); - - for (int i = 0; i < len; i++) { - buffer[count++] = (byte) b; - } - } - - public byte[] getBuffer() { - return this.buffer; - } - - public void ensureRoom(int extra) { - - long newcount = count + extra; - long newsize = buffer.length; - - if (newcount > Integer.MAX_VALUE - 2) { - throw new OutOfMemoryError("2GB maximum buffer length exceeded"); - } - - if (newcount > newsize) { - while (newcount > newsize) { - newsize *= 2; - } - - if (newsize > Integer.MAX_VALUE - 2) { - newsize = Integer.MAX_VALUE - 2; - } - - byte[] newbuf = new byte[(int) newsize]; - - System.arraycopy(buffer, 0, newbuf, 0, count); - - buffer = newbuf; - } - } - - public void reset(int newSize) { - - count = 0; - - if (newSize > buffer.length) { - newSize = (int) ArrayUtil.getBinaryMultipleCeiling(newSize, 4096); - buffer = new byte[newSize]; - } - } - - public void reset(byte[] buffer) { - count = 0; - this.buffer = buffer; - } - - /** - * size must fit in buffer - * - * @param size int - */ - public void setSize(int size) { - count = size; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlConsoleHandler.java b/database/hsqldb/src/org/hsqldb/lib/HsqlConsoleHandler.java deleted file mode 100644 index 017a1a08..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlConsoleHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.logging.ConsoleHandler; - -public class HsqlConsoleHandler extends ConsoleHandler {} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlDeque.java b/database/hsqldb/src/org/hsqldb/lib/HsqlDeque.java deleted file mode 100644 index db9e0584..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlDeque.java +++ /dev/null @@ -1,505 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.lang.reflect.Array; -import java.util.Arrays; -import java.util.NoSuchElementException; - -/** - * A {@code List} that also implements {@code Deque} and {@code Queue} - * and methods for usage as stack.

    - * - * When used as {@code Queue}, elements are added to the end of - * the List (tail), and retrieved from the start of the List (head).

    - * - * When used as a stack, elements are added to and retrieved from the start of - * the List (head) using {@code push()} and {@code pop()} methods.

    - * - * Data is stored in an Object[] that doubles in size when the List gets full - * but does not shrink when it gets empty. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.0, 20020130 - */ -public class HsqlDeque extends BaseList implements List { - - private E[] list; - private int firstindex = 0; // index of first list element - private int endindex = 0; // index of last list element + 1 - - // can grow to fill list - // if elementCount == 0 then firstindex == endindex - private static final int DEFAULT_INITIAL_CAPACITY = 16; - - public HsqlDeque() { - list = (E[]) new Object[DEFAULT_INITIAL_CAPACITY]; - } - - public int size() { - return elementCount; - } - - public boolean isEmpty() { - return elementCount == 0; - } - - public boolean offer(E e) { - return add(e); } - - public E remove() { - return removeFirst(); - } - - public E poll() { - if(elementCount == 0) { - return null; - } - - return removeFirst(); - } - - public E element() { - return getFirst(); - } - - public E peek() { - if(elementCount == 0) { - return null; - } - - return getFirst(); - } - - public void push(E e) { - addFirst(e); - } - - public E pop() { - return removeFirst(); - } - - public E getFirst() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - return list[firstindex]; - } - - public E getLast() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - return list[endindex - 1]; - } - - public E get(int i) throws IndexOutOfBoundsException { - - int index = getInternalIndex(i); - - return list[index]; - } - - public void add(int i, E o) throws IndexOutOfBoundsException { - - if (i == elementCount) { - add(o); - - return; - } - - resetCapacity(); - - int index = getInternalIndex(i); - - if (index < endindex && endindex < list.length) { - System.arraycopy(list, index, list, index + 1, endindex - index); - - endindex++; - } else { - System.arraycopy(list, firstindex, list, firstindex - 1, - index - firstindex); - - firstindex--; - index--; - } - - list[index] = o; - - elementCount++; - } - - public E set(int i, E o) throws IndexOutOfBoundsException { - - int index = getInternalIndex(i); - E result = list[index]; - - list[index] = o; - - return result; - } - - public E removeFirst() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - E o = list[firstindex]; - - list[firstindex] = null; - - firstindex++; - elementCount--; - - if (elementCount == 0) { - firstindex = endindex = 0; - } else if (firstindex == list.length) { - firstindex = 0; - } - - return o; - } - - public E removeLast() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - endindex--; - - E o = list[endindex]; - - list[endindex] = null; - - elementCount--; - - if (elementCount == 0) { - firstindex = endindex = 0; - } else if (endindex == 0) { - endindex = list.length; - } - - return o; - } - - public E peekFirst() { - return getFirst(); - } - - public E peekLast() { - return getLast(); - } - - public boolean offerFirst(E e) { - addFirst(e); - return true; - } - - public boolean offerLast(E e) { - addLast(e); - return true; - } - - public E pollFirst() { - if (elementCount == 0) { - return null; - } - - return removeFirst(); - } - - public E pollLast() { - if (elementCount == 0) { - return null; - } - - return removeLast(); - } - - public boolean removeFirstOccurrence(Object o) { - int index = indexOf(o); - - if (index < 1) { - return false; - } - - remove(index); - - return true; - } - - public boolean removeLastOccurrence(Object o) { - int index = lastIndexOf(o); - - if (index < 1) { - return false; - } - - remove(index); - - return true; - } - - public Iterator descendingIterator() { - throw new UnsupportedOperationException(); - } - - public boolean add(E o) { - - resetCapacity(); - - if (endindex == list.length) { - endindex = 0; - } - - list[endindex] = o; - - elementCount++; - endindex++; - - return true; - } - - public void addLast(E o) { - add(o); - } - - public void addFirst(E o) { - - resetCapacity(); - - firstindex--; - - if (firstindex < 0) { - firstindex = list.length - 1; - - if (endindex == 0) { - endindex = list.length; - } - } - - list[firstindex] = o; - - elementCount++; - } - - public void clear() { - - if (elementCount == 0) { - return; - } - - firstindex = endindex = elementCount = 0; - - Arrays.fill(list, null); - } - - public int indexOf(Object value) { - - for (int i = 0; i < elementCount; i++) { - int index = firstindex + i; - - if (index >= list.length) { - index -= list.length; - } - - if (list[index] == value) { - return i; - } - - if (value != null && comparator.equals(value, list[index])) { - return i; - } - } - - return -1; - } - - public int lastIndexOf(Object value) { - - for (int i = elementCount - 1; i >= 0; i--) { - int index = firstindex + i; - - if (index < 0) { - index += list.length; - } - - if (list[index] == value) { - return i; - } - - if (value != null && comparator.equals(value, list[index])) { - return i; - } - } - - return -1; - } - - - public E remove(int index) { - - int target = getInternalIndex(index); - E value = list[target]; - - if (target == firstindex) { - list[firstindex] = null; - - firstindex++; - - if (firstindex == list.length) { - firstindex = 0; - } - } else if (target > firstindex) { - System.arraycopy(list, firstindex, list, firstindex + 1, - target - firstindex); - - list[firstindex] = null; - - firstindex++; - - if (firstindex == list.length) { - firstindex = 0; - } - } else { - System.arraycopy(list, target + 1, list, target, - endindex - target - 1); - - endindex--; - - list[endindex] = null; - - if (endindex == 0) { - endindex = list.length; - } - } - - elementCount--; - - if (elementCount == 0) { - firstindex = endindex = 0; - } - - return value; - } - - private int getInternalIndex(int i) throws IndexOutOfBoundsException { - - if (i < 0 || i >= elementCount) { - throw new IndexOutOfBoundsException(); - } - - int index = firstindex + i; - - if (index >= list.length) { - index -= list.length; - } - - return index; - } - - private void resetCapacity() { - - if (elementCount < list.length) { - return; - } - - Object[] newList = new Object[list.length * 2]; - - System.arraycopy(list, firstindex, newList, firstindex, - list.length - firstindex); - - if (endindex <= firstindex) { - System.arraycopy(list, 0, newList, list.length, endindex); - - endindex = list.length + endindex; - } - - list = (E[]) newList; - } - - public T[] toArray(T[] array) { - - if (array.length < elementCount) { - array = (T[]) Array.newInstance(array.getClass().getComponentType(), - elementCount); - } - - int tempCount = list.length - firstindex; - - if (tempCount > elementCount) { - tempCount = elementCount; - } - - System.arraycopy(list, firstindex, array, 0, tempCount); - - if (endindex <= firstindex) { - System.arraycopy(list, 0, array, tempCount, endindex); - } - - return array; - } - - public Object[] toArray() { - - Object[] newArray = new Object[elementCount]; - - return toArray(newArray); - } - - public List subList(int fromIndex, int toIndex) { - throw new UnsupportedOperationException(); - } - - public boolean containsAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException(); - } - - public boolean addAll(int index, Collection c) { - throw new UnsupportedOperationException(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlHeap.java b/database/hsqldb/src/org/hsqldb/lib/HsqlHeap.java deleted file mode 100644 index 5243020a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlHeap.java +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Provides the HyperSQL interface for Heap ADT implementations.

    - * - * In this context, a Heap is simply a collection-like ADT that allows addition - * of elements and provides a way to remove the least element, given some - * implementation-dependent strategy for imposing an order over its - * elements.

    - * - * Typically, an HsqlHeap will be implemented as a tree-like structure that - * recursively guarantees a Heap Invariant, such that all nodes below - * the root are greater than the root, given some comparison strategy.

    - - * This in turn provides the basis for an efficient implementation of ADTs such - * PriorityQueue, since Heap operations using the typical implementation are, - * in theory, guaranteed to be O(log n).

    - * - * This interface represents a pure queue with the same basic queue methods - * as {@code java.util.Queue} but without all the extra methods. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public interface HsqlHeap { - - /** - * Removes all of the elements from this Heap. - */ - void clear(); - - /** - * Retrieves whether this Heap is empty. - * - * @return boolean - */ - boolean isEmpty(); - - /** - * Retrieves whether this Heap is full. - * - * @return boolean - */ - boolean isFull(); - - /** - * Adds the specified element to this Heap. - * - * @param o The element to add - * @throws IllegalArgumentException if the implementation does - * not accept elements of the supplied type (optional) - * @throws RuntimeException if the implementation - * dictates that this Heap is not currently accepting additions - * or that this Heap is currently full (optional) - * @return boolean - */ - boolean add(E o); - - /** - * Retrieves the least element from this Heap, without removing it. - * - * @return the least element from this Heap - */ - E peek(); - - /** - * Retrieves the least element from this Heap, removing it in the process. - * - * @return the least element from this Heap - */ - E remove(); - - /** - * Retrieves the number of elements currently in this Heap. - * - * @return the number of elements currently in this Heap - */ - int size(); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlTaskQueue.java b/database/hsqldb/src/org/hsqldb/lib/HsqlTaskQueue.java deleted file mode 100644 index e0fb096d..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlTaskQueue.java +++ /dev/null @@ -1,169 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Provides very simple queued execution of Runnable objects in a background - * thread. The underlying queue is an HsqlDeque instance, an array-based - * circular queue implementation with automatic capacity expansion. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class HsqlTaskQueue { - - /** The thread used to process commands */ - protected Thread taskRunnerThread; - - /** Special queue element to signal termination */ - protected static final Runnable SHUTDOWNTASK = new Runnable() { - public void run() {} - }; - - /** - * true if thread should shut down after processing current task. - * - * Once set true, stays true forever - */ - protected volatile boolean isShutdown; - - public synchronized Thread getTaskRunnerThread() { - return taskRunnerThread; - } - - protected synchronized void clearThread() { - - try { - taskRunnerThread.setContextClassLoader(null); - } catch (Throwable t) {} - - taskRunnerThread = null; - } - - protected final HsqlDeque queue = new HsqlDeque(); - - protected class TaskRunner implements Runnable { - - public void run() { - - Runnable task; - - try { - while (!isShutdown) { - synchronized (queue) { - task = queue.poll(); - } - - if (task == SHUTDOWNTASK) { - isShutdown = true; - - synchronized (queue) { - queue.clear(); - } - - break; - } else if (task != null) { - task.run(); - - task = null; - } else { - break; - } - } - } finally { - clearThread(); - } - } - } - - protected final TaskRunner taskRunner = new TaskRunner(); - - public HsqlTaskQueue() {} - - public boolean isShutdown() { - return isShutdown; - } - - public synchronized void restart() { - - if (taskRunnerThread == null && !isShutdown) { - taskRunnerThread = new Thread(taskRunner); - - taskRunnerThread.start(); - } - } - - public void execute(Runnable command) throws RuntimeException { - - if (!isShutdown) { - synchronized (queue) { - queue.add(command); - } - - restart(); - } - } - - public synchronized void shutdownAfterQueued() { - - if (!isShutdown) { - synchronized (queue) { - queue.add(SHUTDOWNTASK); - } - } - } - - public synchronized void shutdownAfterCurrent() { - - isShutdown = true; - - synchronized (queue) { - queue.clear(); - queue.add(SHUTDOWNTASK); - } - } - - public synchronized void shutdownImmediately() { - - isShutdown = true; - - if (taskRunnerThread != null) { - taskRunnerThread.interrupt(); - } - - synchronized (queue) { - queue.clear(); - queue.add(SHUTDOWNTASK); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlThreadFactory.java b/database/hsqldb/src/org/hsqldb/lib/HsqlThreadFactory.java deleted file mode 100644 index 60b036f0..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlThreadFactory.java +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * The default HSQLDB thread factory implementation. This factory can be - * used to wrap other thread factories using the setImpl method, but, by - * default simply produces new, vanilla thread objects constructed with - * the supplied runnable object. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.7.2 - * @since 1.7.2 - */ -class HsqlThreadFactory implements ThreadFactory { - - /** - * The factory implementation. Typically, this will be the - * HsqlThreadFactory object itself. - */ - protected ThreadFactory factory; - - /** - * Constructs a new HsqlThreadFactory that uses itself as the factory - * implementation. - */ - public HsqlThreadFactory() { - this(null); - } - - /** - * Constructs a new HsqlThreadFactory whose retrieved threads come from the - * specified ThreadFactory object or from this factory implementation, if' - * the specified implementation is null. - * - * @param f the factory implementation this factory uses - */ - public HsqlThreadFactory(ThreadFactory f) { - setImpl(f); - } - - /** - * Retrieves a thread instance for running the specified Runnable - * @param r The runnable that the retrieved thread handles - * @return the requested thread instance - */ - public Thread newThread(Runnable r) { - return factory == this ? new Thread(r) - : factory.newThread(r); - } - - /** - * Sets the factory implementation that this factory will use to - * produce threads. If the specified argument, f, is null, then - * this factory uses itself as the implementation. - * - * @param f the factory implementation that this factory will use - * to produce threads - * @return the previously installed factory implementation - */ - public synchronized ThreadFactory setImpl(ThreadFactory f) { - - ThreadFactory old; - - old = factory; - factory = (f == null) ? this - : f; - - return old; - } - - /** - * Retrieves the factory implementation that this factory is using - * to produce threads. - * - * @return the factory implementation that this factory is using to produce - * threads. - */ - public synchronized ThreadFactory getImpl() { - return factory; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/HsqlTimer.java b/database/hsqldb/src/org/hsqldb/lib/HsqlTimer.java deleted file mode 100644 index c984da7a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/HsqlTimer.java +++ /dev/null @@ -1,957 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Comparator; -import java.util.Date; - -/** - * Facility to schedule tasks for future execution in a background thread.

    - * - * Tasks may be scheduled for one-time execution or for repeated execution at - * regular intervals, using either fixed rate or fixed delay policy.

    - * - * This class is a JDK 1.1 compatible implementation required by HSQLDB both - * because the java.util.Timer class is available only in JDK 1.3+ and because - * java.util.Timer starves least recently added tasks under high load and - * fixed rate scheduling, especially when the average actual task duration is - * greater than the average requested task periodicity.

    - * - * An additional (minor) advantage over java.util.Timer is that this class does - * not retain a live background thread during periods when the task queue is - * empty. - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.7.2 - */ -public final class HsqlTimer implements Comparator, ThreadFactory { - - /** The priority queue for the scheduled tasks. */ - final TaskQueue taskQueue = new TaskQueue(16, this); - - /** The inner runnable that executes tasks in the background thread. */ - final TaskRunner taskRunner = new TaskRunner(); - - /** The background thread. */ - Thread taskRunnerThread; - - /** The factory that produces the background threads. */ - final ThreadFactory threadFactory; - - /** - * Whether this timer should disallow all further processing. - * - * Once set true, stays true forever. - */ - volatile boolean isShutdown; - - /** - * Constructs a new HsqlTimer using the default thread factory - * implementation. - */ - public HsqlTimer() { - this(null); - } - - /** - * Constructs a new HsqlTimer. - * - * Uses the specified thread factory implementation. - * - * @param threadFactory the ThreadFactory used to produce this timer's - * background threads. If null, the default implementation supplied - * by this class will be used. - */ - public HsqlTimer(final ThreadFactory threadFactory) { - this.threadFactory = (threadFactory == null) ? this - : threadFactory; - } - - /** - * Required to back the priority queue for scheduled tasks. - * - * @param a the first Task - * @param b the second Task - * @return {@code 0 if equal, < 0 if a < b, > 0 if a > b} - */ - public int compare(final Object a, final Object b) { - - final long awhen = ((Task) a).getNextScheduled(); - final long bwhen = ((Task) b).getNextScheduled(); - - return (awhen < bwhen) ? -1 - : (awhen == bwhen) ? 0 - : 1; - } - - /** - * Default ThreadFactory implementation.

    - * - * Constructs a new Thread from the designated runnable, sets its - * name to "HSQLDB Timer @" + Integer.toHexString(hashCode()), - * and sets it as a daemon thread.

    - * - * @param runnable used to construct the new Thread. - * @return a new Thread constructed from the designated runnable. - */ - public Thread newThread(final Runnable runnable) { - - final Thread thread = new Thread(runnable); - - thread.setName("HSQLDB Timer @" + Integer.toHexString(hashCode())); - thread.setDaemon(true); - - return thread; - } - - /** - * Retrieves the background execution thread.

    - * - * null is returned if there is no such thread.

    - * - * @return the current background thread (may be null) - */ - public synchronized Thread getThread() { - return this.taskRunnerThread; - } - - /** - * (Re)starts background processing of the task queue. - * - * @throws IllegalStateException if this timer is shut down. - * @see #shutdown() - * @see #shutdownImmediately() - */ - public synchronized void restart() throws IllegalStateException { - - if (this.isShutdown) { - throw new IllegalStateException("isShutdown==true"); - } else if (this.taskRunnerThread == null) { - this.taskRunnerThread = - this.threadFactory.newThread(this.taskRunner); - - this.taskRunnerThread.start(); - } else { - this.taskQueue.unpark(); - } - } - - /** - * Causes the specified Runnable to be executed once in the background - * after the specified delay. - * - * @param delay in milliseconds - * @param runnable the Runnable to execute. - * @return opaque reference to the internal task - * @throws IllegalArgumentException if runnable is null - */ - public Object scheduleAfter(final long delay, - final Runnable runnable) - throws IllegalArgumentException { - - if (runnable == null) { - throw new IllegalArgumentException("runnable == null"); - } - - return this.addTask(now() + delay, runnable, 0, false); - } - - /** - * Causes the specified Runnable to be executed once in the background - * at the specified time. - * - * @param date time at which to execute the specified Runnable - * @param runnable the Runnable to execute. - * @return opaque reference to the internal task - * @throws IllegalArgumentException if date or runnable is null - */ - public Object scheduleAt(final Date date, - final Runnable runnable) - throws IllegalArgumentException { - - if (date == null) { - throw new IllegalArgumentException("date == null"); - } else if (runnable == null) { - throw new IllegalArgumentException("runnable == null"); - } - - return this.addTask(date.getTime(), runnable, 0, false); - } - - /** - * Causes the specified Runnable to be executed periodically in the - * background, starting at the specified time. - * - * @return opaque reference to the internal task - * @param period the cycle period - * @param relative if true, fixed rate scheduling else fixed delay scheduling - * @param date time at which to execute the specified Runnable - * @param runnable the Runnable to execute - * @throws IllegalArgumentException if date or runnable is null, or - * period is {@code <= 0} - */ - public Object schedulePeriodicallyAt(final Date date, final long period, - final Runnable runnable, - final boolean relative) - throws IllegalArgumentException { - - if (date == null) { - throw new IllegalArgumentException("date == null"); - } else if (period <= 0) { - throw new IllegalArgumentException("period <= 0"); - } else if (runnable == null) { - throw new IllegalArgumentException("runnable == null"); - } - - return addTask(date.getTime(), runnable, period, relative); - } - - /** - * Causes the specified Runnable to be executed periodically in the - * background, starting after the specified delay. - * - * @return opaque reference to the internal task - * @param period the cycle period - * @param relative if true, fixed rate scheduling else fixed delay scheduling - * @param delay in milliseconds - * @param runnable the Runnable to execute. - * @throws IllegalArgumentException if runnable is null or period is {@code <= 0} - */ - public Object schedulePeriodicallyAfter(final long delay, - final long period, final Runnable runnable, - final boolean relative) throws IllegalArgumentException { - - if (period <= 0) { - throw new IllegalArgumentException("period <= 0"); - } else if (runnable == null) { - throw new IllegalArgumentException("runnable == null"); - } - - return addTask(now() + delay, runnable, period, relative); - } - - /** - * Shuts down this timer after the current task (if any) completes.

    - * - * After this call, the timer has permanently entered the shutdown state; - * attempting to schedule any new task or directly restart this timer will - * result in an IllegalStateException. - */ - public synchronized void shutdown() { - - if (!this.isShutdown) { - this.isShutdown = true; - - this.taskQueue.cancelAllTasks(); - } - } - - /** for compatibility with previous version */ - public synchronized void shutDown() { - shutdown(); - } - - /** - * Shuts down this timer immediately, interrupting the wait state associated - * with the current head of the task queue or the wait state internal to - * the currently executing task, if any such state is currently in effect. - * - * After this call, the timer has permanently entered the shutdown state; - * attempting to schedule any new task or directly restart this timer will - * result in an IllegalStateException.

    - * - * Note: If the integrity of work performed by a scheduled task - * may be adversely affected by an unplanned interruption, it is the - * responsibility of the task's implementation to deal correctly with the - * possibility that this method is called while such work is in progress, - * for instance by catching the InterruptedException, completing the work, - * and then rethrowing the exception. - */ - public synchronized void shutdownImmediately() { - - if (!this.isShutdown) { - final Thread runner = this.taskRunnerThread; - - this.isShutdown = true; - - if (runner != null && runner.isAlive()) { - runner.interrupt(); - } - - this.taskQueue.cancelAllTasks(); - } - } - - /** - * Causes the task referenced by the supplied argument to be cancelled. - * If the referenced task is currently executing, it will continue until - * finished but will not be rescheduled. - * - * @param task a task reference - */ - public static void cancel(final Object task) { - - if (task instanceof Task) { - ((Task) task).cancel(); - } - } - - /** - * Retrieves whether the specified argument references a cancelled task. - * - * @param task a task reference - * @return true if referenced task is cancelled - */ - public static boolean isCancelled(final Object task) { - return (task instanceof Task) ? ((Task) task).isCancelled() - : true; - } - - /** - * Retrieves whether the specified argument references a task scheduled - * periodically using fixed rate scheduling. - * - * @param task a task reference - * @return true if the task is scheduled at a fixed rate - */ - public static boolean isFixedRate(final Object task) { - - if (task instanceof Task) { - final Task ltask = (Task) task; - - return (ltask.relative && ltask.period > 0); - } else { - return false; - } - } - - /** - * Retrieves whether the specified argument references a task scheduled - * periodically using fixed delay scheduling. - * - * @param task a task reference - * @return true if the reference is scheduled using a fixed delay - */ - public static boolean isFixedDelay(final Object task) { - - if (task instanceof Task) { - final Task ltask = (Task) task; - - return (!ltask.relative && ltask.period > 0); - } else { - return false; - } - } - - /** - * Retrieves whether the specified argument references a task scheduled - * for periodic execution. - * - * @param task a task reference - * @return true if the task is scheduled for periodic execution - */ - public static boolean isPeriodic(final Object task) { - return (task instanceof Task) ? (((Task) task).period > 0) - : false; - } - - /** - * Retrieves the last time the referenced task was executed, as a - * Date object. If the task has never been executed, null is returned. - * - * @param task a task reference - * @return the last time the referenced task was executed; null if never - */ - public static Date getLastScheduled(Object task) { - - if (task instanceof Task) { - final Task ltask = (Task) task; - final long last = ltask.getLastScheduled(); - - return (last == 0) ? null - : new Date(last); - } else { - return null; - } - } - - /** - * Sets the periodicity of the designated task to a new value.

    - * - * If the designated task is cancelled or the new period is identical to the - * task's current period, then this invocation has essentially no effect - * and the submitted object is returned.

    - * - * Otherwise, if the new period is greater than the designated task's - * current period, then a simple assignment occurs and the submitted - * object is returned.

    - * - * If neither case holds, then the designated task is cancelled and a new, - * equivalent task with the new period is scheduled for immediate first - * execution and returned to the caller.

    - * - * @return a task reference, as per the rules stated above. - * @param task the task whose periodicity is to be set - * @param period the new period - */ - public static Object setPeriod(final Object task, final long period) { - return (task instanceof Task) ? ((Task) task).setPeriod(period) - : task; - } - - /** - * Retrieves the next time the referenced task is due to be executed, as a - * Date object. If the referenced task is cancelled, null is returned. - * - * @param task a task reference - * @return the next time the referenced task is due to be executed - */ - public static Date getNextScheduled(Object task) { - - if (task instanceof Task) { - final Task ltask = (Task) task; - final long next = ltask.isCancelled() ? 0 - : ltask.getNextScheduled(); - - return next == 0 ? null - : new Date(next); - } else { - return null; - } - } - - /** - * Adds to the task queue a new Task object encapsulating the supplied - * Runnable and scheduling arguments. - * - * @param first the time of the task's first execution - * @param runnable the Runnable to execute - * @param period the task's periodicity - * @param relative if true, use fixed rate else use fixed delay scheduling - * @return an opaque reference to the internal task - */ - Task addTask(final long first, final Runnable runnable, - final long period, boolean relative) { - - if (this.isShutdown) { - throw new IllegalStateException("shutdown"); - } - - final Task task = new Task(first, runnable, period, relative); - - // sychronized - this.taskQueue.addTask(task); - - // sychronized - this.restart(); - - return task; - } - - /** Sets the background thread to null. */ - synchronized void clearThread() { - - try { - taskRunnerThread.setContextClassLoader(null); - } catch (Throwable t) {} - - taskRunnerThread = null; - } - - /** - * Retrieves the next task to execute, or null if this timer is shutdown, - * the current thread is interrupted, or there are no queued tasks. - * - * @return the next task to execute, or null - */ - Task nextTask() { - - try { - while (!this.isShutdown || Thread.interrupted()) { - long now; - long next; - long wait; - Task task; - - // synchronized to ensure removeTask - // applies only to the peeked task, - // when the computed wait <= 0 - synchronized (this.taskQueue) { - task = this.taskQueue.peekTask(); - - if (task == null) { - - // queue is empty - break; - } - - now = System.currentTimeMillis(); - next = task.next; - wait = (next - now); - - if (wait > 0) { - - // release ownership of taskQueue monitor and await - // notification of task addition or cancellation, - // at most until the time when the peeked task is - // next supposed to execute - this.taskQueue.park(wait); - - continue; // to top of loop - } else { - this.taskQueue.removeTask(); - } - } - - long period = task.period; - - if (period > 0) { // repeated task - if (task.relative) { // using fixed rate scheduling - final long late = (now - next); - - if (late > period) { - - // ensure that really late tasks don't - // completely saturate the head of the - // task queue - period = 0; - - /* @todo : is -1, -2 ... fairer? */ - } else if (late > 0) { - - // compensate for scheduling overruns - period -= late; - } - } - - task.updateSchedule(now, now + period); - this.taskQueue.addTask(task); - } - - return task; - } - } catch (InterruptedException e) { - - //e.printStackTrace(); - } - - return null; - } - - /** - * stats var - */ - static int nowCount = 0; - - /** - * Convenience method replacing the longer incantation: - * System.currentTimeMillis() - * - * @return System.currentTimeMillis() - */ - static long now() { - - nowCount++; - - return System.currentTimeMillis(); - } - - /** - * The Runnable that the background thread uses to execute - * scheduled tasks.

    - * - * Note: Outer class could simply implement Runnable, - * but using an inner class protects the public run method - * from potential abuse. - */ - protected class TaskRunner implements Runnable { - - /** - * Runs the next available task in the background thread.

    - * - * When there are no available tasks, the background - * thread dies and its instance field is cleared until - * tasks once again become available. - */ - public void run() { - - try { - do { - final Task task = HsqlTimer.this.nextTask(); - - if (task == null) { - break; - } - - // PROBLEM: If the runnable throws an exception other - // than InterruptedException (which likely stems - // naturally from calling shutdownImmediately() - // or getThread().interrupt()), this will still - // cause the loop to exit, which is to say that - // task scheduling will stop until a new task is - // added or the timer is restarted directly, even - // though there may still be uncancelled tasks - // left on the queue. - // - // TODO: Clarify and establish a contract regarding - // the difference between InterruptedException, - // RuntimeException and other things, like - // UndeclaredThrowableException. - // - // SOL'N: At present, we simply require each runnable to - // understand its part of the implicit contract, - // which is to deal with exceptions internally - // (not throw them up to the timer), with the - // possible exception of InterruptedException. - // - // If the integrity of work performed by the - // runnable may be adversely affected by an - // unplanned interruption, the runnable should - // deal with this directly, for instance by - // catching the InterruptedException, ensuring - // that some integrity preserving state is - // attained, and then rethrowing the exception. - task.runnable.run(); - } while (true); - } finally { - HsqlTimer.this.clearThread(); - } - } - } - - /** - * Encapsulates a Runnable and its scheduling attributes. - * - * Essentially, a wrapper class used to schedule a Runnable object - * for execution by the enclosing HsqlTimer's TaskRunner in a - * background thread. - */ - protected class Task { - - /** What to run. */ - Runnable runnable; - - /** The periodic interval, or 0 if one-shot. */ - long period; - - /** The time this task was last executed, or 0 if never. */ - long last; - - /** The next time this task is scheduled to execute. */ - long next; - - /** - * Whether to silently remove this task instead of running it, - * the next time (if ever) it makes its way to the head of the - * timer queue. - */ - boolean cancelled = false; - - /** Serializes concurrent access to the cancelled field. */ - private final Object cancel_mutex = new Object(); - - /** - * Scheduling policy flag.

    - * - * When true, scheduling is fixed rate (as opposed to fixed delay), - * and schedule updates are calculated relative to when the task was - * was last run rather than a fixed delay starting from the current - * wall-clock time provided by System.currentTimeMillis().

    - * - * This helps normalize scheduling for tasks that must attempt to - * maintain a fixed rate of execution. - */ - final boolean relative; - - /** - * Constructs a new Task object encapsulating the specified Runnable - * and scheduling arguments. - * - * @param first the first time to execute - * @param runnable the Runnable to execute - * @param period the periodicity of execution - * @param relative if true, use fixed rate scheduling else fixed delay - */ - Task(final long first, final Runnable runnable, final long period, - final boolean relative) { - - this.next = first; - this.runnable = runnable; - this.period = period; - this.relative = relative; - } - - // fixed reported race condition - - /** Sets this task's cancelled flag true and signals its taskQueue. */ - void cancel() { - - boolean signalCancelled = false; - - synchronized (cancel_mutex) { - if (!cancelled) { - cancelled = signalCancelled = true; - } - } - - if (signalCancelled) { - HsqlTimer.this.taskQueue.signalTaskCancelled(this); - } - } - - /** - * Retrieves whether this task is cancelled. - * - * @return true if cancelled, else false - */ - boolean isCancelled() { - - synchronized (cancel_mutex) { - return cancelled; - } - } - - /** - * Retrieves the instant in time just before this task was - * last executed by the background thread. A value of zero - * indicates that this task has never been executed. - * - * @return the last time this task was executed or zero if never - */ - synchronized long getLastScheduled() { - return last; - } - - /** - * Retrieves the time at which this task is next scheduled for - * execution. - * - * @return the time at which this task is next scheduled for - * execution - */ - synchronized long getNextScheduled() { - return next; - } - - /** - * Updates the last and next scheduled execution times. - * - * @param last when this task was last executed - * @param next when this task is to be next executed - */ - synchronized void updateSchedule(final long last, final long next) { - this.last = last; - this.next = next; - } - - /** - * Sets the new periodicity of this task in milliseconds.

    - * - * If this task is cancelled or the new period is identical to the - * current period, then this invocation has essentially no effect - * and this object is returned.

    - * - * Otherwise, if the new period is greater than the current period, then - * a simple field assignment occurs and this object is returned.

    - * - * If none of the previous cases hold, then this task is cancelled and - * a new, equivalent task with the new period is scheduled for - * immediate first execution and returned to the caller.

    - * - * @param newPeriod the new period - * @return a task reference, as per the rules stated above. - */ - synchronized Object setPeriod(final long newPeriod) { - - if (this.period == newPeriod || this.isCancelled()) { - return this; - } else if (newPeriod > this.period) { - this.period = newPeriod; - - return this; - } else { - this.cancel(); - - return HsqlTimer.this.addTask(now(), this.runnable, newPeriod, - this.relative); - } - } - } - - /** - * Heap-based priority queue. - * - * Provides extensions to facilitate and simplify implementing - * timer functionality. - */ - protected static class TaskQueue extends HsqlArrayHeap { - - /** - * Constructs a new TaskQueue with the specified initial capacity and - * ObjectComparator. - * - * @param capacity the initial capacity of the queue - * @param oc The ObjectComparator this queue uses to maintain its - * Heap invariant. - */ - TaskQueue(final int capacity, final Comparator oc) { - super(capacity, oc); - } - - /** - * Type-safe add method.

    - * - * Can be used to inject debugging or accounting behaviour.

    - * - * @param task the task to add - */ - void addTask(final Task task) { - - // System.out.println("task added: " + task); - super.add(task); - } - - /** - * Atomically removes all tasks in this queue and then and cancels - * them. - */ - void cancelAllTasks() { - - Object[] oldHeap; - int oldCount; - - synchronized (this) { - oldHeap = this.heap; - oldCount = this.count; - - // 1 instead of 0 to avoid unintended aoob exceptions - this.heap = new Object[1]; - this.count = 0; - } - - for (int i = 0; i < oldCount; i++) { - ((Task) oldHeap[i]).cancelled = true; - } - } - - /** - * Causes the calling thread to wait until another thread invokes - * {@link #unpark() unpark} or the specified amount of time has - * elapsed. - * - * Implements the sync and wait(n) half of this queue's availability - * condition.

    - * - * @param timeout the maximum time to wait in milliseconds. - * @throws java.lang.InterruptedException if another thread has - * interrupted the current thread. The interrupted status of - * the current thread is cleared when this exception is thrown. - */ - synchronized void park(final long timeout) - throws InterruptedException { - this.wait(timeout); - } - - /** - * Retrieves the head of this queue, without removing it.

    - * - * This method has the side-effect of removing tasks from the - * head of this queue until a non-cancelled task is encountered - * or this queue is empty.

    - * - * If this queue is initially empty or is emptied in the process - * of finding the earliest scheduled non-cancelled task, - * then null is returned.

    - * - * @return the earliest scheduled non-cancelled task, or null if no such - * task exists - */ - synchronized Task peekTask() { - - while (super.heap[0] != null - && ((Task) super.heap[0]).isCancelled()) { - super.remove(); - } - - return (Task) super.heap[0]; - } - - /** - * Informs this queue that the given task is supposedly cancelled.

    - * - * If the indicated task is identical to the current head of - * this queue, then it is removed and this queue is - * {@link #unpark() unparked}.

    - * - * The cancelled status of the given task is not verified; it is - * assumed that the caller is well-behaved (always passes a - * non-null reference to a cancelled task). - * - * @param task a supposedly cancelled task - */ - synchronized void signalTaskCancelled(Task task) { - - // We only care about the case where HsqlTimer.nextTask - // might be parked momentarily on this task. - if (task == super.heap[0]) { - super.remove(); - this.notify(); - } - } - - /** - * Type-safe remove method.

    - * - * Removes the head task from this queue.

    - * - * Can be used to inject debugging or accounting behaviour.

    - * - * @return this queue's head task or null if no such task exists - */ - Task removeTask() { - - // System.out.println("removing task..."); - return (Task) super.remove(); - } - - /** - * Wakes up a single thread (if any) that is waiting on this queue's - * {@link #park(long) park} method. - * - * Implements the sync and notify half of this queue's availability - * condition. - */ - synchronized void unpark() { - this.notify(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/InOutUtil.java b/database/hsqldb/src/org/hsqldb/lib/InOutUtil.java deleted file mode 100644 index 77e4dd66..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/InOutUtil.java +++ /dev/null @@ -1,289 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; - -/** - * Input / Output utility - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.1 - * @since 1.7.2 - */ -public final class InOutUtil { - - private InOutUtil() {} - - /** - * Implementation only supports unix line-end format and is suitable for - * processing HTTP and other network protocol communications. Reads and - * writes a line of data. Returns the number of bytes read/written. - * - * @param in InputStream - * @param out OutputStream - * @throws IOException on failure - * @return int - */ - public static int readLine(InputStream in, - OutputStream out) throws IOException { - - int count = 0; - - for (;;) { - int b = in.read(); - - if (b == -1) { - break; - } - - count++; - - out.write(b); - - if (b == '\n') { - break; - } - } - - return count; - } - - /** - * Retrieves the serialized form of the specified Object as an - * array of bytes. - * - * @param s the Object to serialize - * @return a static byte array representing the passed Object - * @throws IOException on failure - */ - public static byte[] serialize(Serializable s) throws IOException { - - HsqlByteArrayOutputStream bo = new HsqlByteArrayOutputStream(); - ObjectOutputStream os = new ObjectOutputStream(bo); - - os.writeObject(s); - - return bo.toByteArray(); - } - - /** - * Deserializes the specified byte array to an - * Object instance. - * - * @return the Object resulting from deserializing the specified array of bytes - * @param ba the byte array to deserialize to an Object - * @throws IOException on failure - * @throws ClassNotFoundException if not found - */ - public static Serializable deserialize(byte[] ba) - throws IOException, ClassNotFoundException { - - HsqlByteArrayInputStream bi = new HsqlByteArrayInputStream(ba); - ObjectInputStream is = new ObjectInputStream(bi); - - return (Serializable) is.readObject(); - } - - public static final int DEFAULT_COPY_BUFFER_SIZE = 8192; - public static final long DEFAULT_COPY_AMOUNT = Long.MAX_VALUE; - - /** - * - * @see #copy(java.io.InputStream, java.io.OutputStream, long, int) - * @param inputStream InputStream - * @param outputStream OutputStream - * @throws IOException on failure - * @return long - */ - public static long copy(final InputStream inputStream, - final OutputStream outputStream) - throws IOException { - return copy(inputStream, outputStream, DEFAULT_COPY_AMOUNT, - DEFAULT_COPY_BUFFER_SIZE); - } - - /** - * - * @see #copy(java.io.InputStream, java.io.OutputStream, long, int) - * @param inputStream InputStream - * @param outputStream OutputStream - * @param amount long - * @throws IOException on failure - * @return long - */ - public static long copy(final InputStream inputStream, - final OutputStream outputStream, - final long amount) throws IOException { - return copy(inputStream, outputStream, amount, - DEFAULT_COPY_BUFFER_SIZE); - } - - /** - * the specified amount from the given input stream to the - * given output stream, using a buffer of the given size. - * - * @param inputStream from which to source bytes - * @param outputStream to which to sink bytes - * @param amount max # of bytes to transfer. - * @param bufferSize to use internally - * @return the number of bytes actually transferred. - * @throws IOException if any, thrown by either of the given stream objects - */ - public static long copy(final InputStream inputStream, - final OutputStream outputStream, - final long amount, - final int bufferSize) throws IOException { - - // - int maxBytesToRead = (int) Math.min(bufferSize, amount); - - // - final byte[] buffer = new byte[maxBytesToRead]; - - // - long bytesCopied = 0; - int bytesRead; - - while ((bytesCopied < amount) - && -1 != (bytesRead = inputStream.read(buffer, 0, - maxBytesToRead))) { - - // - outputStream.write(buffer, 0, bytesRead); - - if (bytesRead > Long.MAX_VALUE - bytesCopied) { - - // edge case... - // extremely unlikely but included for 'correctness' - bytesCopied = Long.MAX_VALUE; - } else { - bytesCopied += bytesRead; - } - - if (bytesCopied >= amount) { - return bytesCopied; - } - - maxBytesToRead = (int) Math.min(bufferSize, amount - bytesCopied); - } - - return bytesCopied; - } - - /** - * - * @see #copy(java.io.Reader, java.io.Writer, long, int) - * @param reader Reader - * @param writer Writer - * @throws IOException on failure - * @return long - */ - public static long copy(final Reader reader, - final Writer writer) throws IOException { - return copy(reader, writer, DEFAULT_COPY_AMOUNT, - DEFAULT_COPY_BUFFER_SIZE); - } - - /** - * - * @see #copy(java.io.Reader, java.io.Writer, long, int) - * @param reader Reader - * @param writer Writer - * @param amount long - * @throws IOException on failure - * @return long - */ - public static long copy(final Reader reader, final Writer writer, - final long amount) throws IOException { - return copy(reader, writer, amount, DEFAULT_COPY_BUFFER_SIZE); - } - - /** - * the specified amount from the given input stream to the - * given output stream, using a buffer of the given size. - * - * @param reader from which to source characters - * @param writer to which to sink characters - * @param amount max # of characters to transfer. - * @param bufferSize to use internally - * @return the number of characters actually transferred. - * @throws IOException if any, thrown by either of the given stream objects - */ - public static long copy(final Reader reader, final Writer writer, - final long amount, - final int bufferSize) throws IOException { - - // - int maxCharsToRead = (int) Math.min(bufferSize, amount); - - // - final char[] buffer = new char[maxCharsToRead]; - - // - long charsCopied = 0; - int charsRead; - - while ((charsCopied < amount) - && -1 != (charsRead = reader.read(buffer, 0, - maxCharsToRead))) { - - // - writer.write(buffer, 0, charsRead); - - if (charsRead > Long.MAX_VALUE - charsCopied) { - - // edge case... - // extremely unlikely but included for 'correctness' - charsCopied = Long.MAX_VALUE; - } else { - charsCopied += charsRead; - } - - if (charsCopied >= amount) { - return charsCopied; - } - - maxCharsToRead = (int) Math.min(bufferSize, amount - charsCopied); - } - - return charsCopied; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/InputStreamInterface.java b/database/hsqldb/src/org/hsqldb/lib/InputStreamInterface.java deleted file mode 100644 index 47bd8393..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/InputStreamInterface.java +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 2.3.0 - */ -public interface InputStreamInterface { - - int read() throws IOException; - - int read(byte[] bytes) throws IOException; - - int read(byte[] bytes, int offset, int length) throws IOException; - - long skip(long count) throws IOException; - - int available() throws IOException; - - void close() throws IOException; - - void setSizeLimit(long count); - - /** - * Invariant. Number of characters in stream, including any already read. - * @return -1 if no explicit limit otherwise the limit - */ - long getSizeLimit(); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/InputStreamWrapper.java b/database/hsqldb/src/org/hsqldb/lib/InputStreamWrapper.java deleted file mode 100644 index e646893d..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/InputStreamWrapper.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.2.9 - * @since 2.2.8 - */ -public class InputStreamWrapper implements InputStreamInterface { - - InputStream is; - long limitSize = -1; - long fetchedSize = 0; - - public InputStreamWrapper(InputStream is) { - this.is = is; - } - - public int read() throws IOException { - - if (fetchedSize == limitSize) { - return -1; - } - - int byteread = is.read(); - - if (byteread < 0) { - if (limitSize == -1) { - return -1; - } else { - throw new IOException("stream not reached the end" - + fetchedSize + " " + limitSize); - } - } - - fetchedSize++; - - return byteread; - } - - public int read(byte[] bytes) throws IOException { - return read(bytes, 0, bytes.length); - } - - public int read(byte[] bytes, int offset, int length) throws IOException { - - if (fetchedSize == limitSize) { - return -1; - } - - if (limitSize >= 0 && limitSize - fetchedSize < length) { - length = (int) (limitSize - fetchedSize); - } - - int count = is.read(bytes, offset, length); - - if (count < 0) { - if (limitSize == -1) { - return -1; - } else { - throw new IOException("stream not reached the end" - + fetchedSize + " " + limitSize); - } - } - - fetchedSize += count; - - return count; - } - - public long skip(long count) throws IOException { - return is.skip(count); - } - - public int available() throws IOException { - return is.available(); - } - - public void close() throws IOException { - is.close(); - } - - public void setSizeLimit(long count) { - limitSize = count; - } - - public long getSizeLimit() { - return limitSize; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntHashSet.java b/database/hsqldb/src/org/hsqldb/lib/IntHashSet.java deleted file mode 100644 index ef668916..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntHashSet.java +++ /dev/null @@ -1,232 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.map.BaseHashMap; - -/** - * A set of int primitives.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 2.3.0 - */ -public class IntHashSet extends BaseHashMap { - - public IntHashSet() { - this(8); - } - - public IntHashSet(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.intKeyOrValue, - BaseHashMap.noKeyOrValue, false); - } - - public IntHashSet(int[] elements) { - - super(elements.length, BaseHashMap.intKeyOrValue, - BaseHashMap.noKeyOrValue, false); - - addAll(elements); - } - - public IntHashSet(int[] elementsA, int[] elementsB) { - - super(elementsA.length + elementsB.length, BaseHashMap.intKeyOrValue, - BaseHashMap.noKeyOrValue, false); - - addAll(elementsA); - addAll(elementsB); - } - - public boolean contains(Object o) { - - if (o instanceof Integer) { - - int intKey = ((Integer) o).intValue(); - - return containsKey(intKey); - } - - if (o == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean contains(int key) { - return super.containsKey(key); - } - - public boolean add(Integer e) { - - if (e == null) { - throw new NullPointerException(); - } - - int intKey = ((Integer) e).intValue(); - - return add(intKey); - } - - - public boolean add(int key) { - return (Boolean) super.addOrUpdate(key, 0, null, null); - } - - public boolean remove(Object o) { - if (o instanceof Integer) { - - int intKey = ((Integer) o).intValue(); - - return remove(intKey); - } - - if (o == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean remove(int key) { - return (Boolean) super.remove(key, 0, null, null, false, false); - } - - public int getStartMatchCount(int[] array) { - - int i = 0; - - for (; i < array.length; i++) { - if (!super.containsKey(array[i])) { - break; - } - } - - return i; - } - - public boolean addAll(Collection col) { - - int oldSize = size(); - Iterator it = col.iterator(); - - while (it.hasNext()) { - add(it.next()); - } - - return oldSize != size(); - } - - public boolean addAll(IntHashSet s) { - - boolean result = false; - - PrimitiveIterator it = s.iterator(); - - while (it.hasNext()) { - result |= add(it.nextInt()); - } - - return result; - } - - public boolean addAll(int[] elements) { - - int oldSize = size(); - - for (int i = 0; i < elements.length; i++) { - add(elements[i]); - } - - return oldSize != size(); - } - - - public boolean containsAll(Collection c) { - Iterator it = c.iterator(); - - while (it.hasNext()) { - if (!contains(it.next())) { - return false; - } - } - - return true; - } - - public boolean retainAll(Collection c) { - int oldSize = size(); - - PrimitiveIterator it = new BaseHashIterator(true); - - while (it.hasNext()) { - - if (!c.contains(it.nextInt())) { - it.remove(); - } - } - - return oldSize != size(); - } - - public boolean removeAll(Collection c) { - int oldSize = size(); - Iterator it = c.iterator(); - - while (it.hasNext()) { - Object o = it.next(); - - if (o instanceof Integer) { - remove(o); - } - } - - return oldSize != size(); - } - - public int[] toArray() { - - int[] array = new int[size()]; - - return toIntArray(array, true); - } - - public int[] toArray(int[] array) { - return toIntArray(array, true); - } - - public PrimitiveIterator iterator() { - return new BaseHashIterator(true); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntIndex.java b/database/hsqldb/src/org/hsqldb/lib/IntIndex.java deleted file mode 100644 index c14e15b0..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntIndex.java +++ /dev/null @@ -1,654 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Arrays; - -/** - * Maintains an ordered integer index. Equal keys are allowed. - * - * findXXX() methods return the array index into the list - * containing a matching key, or or -1 if not found.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.3.3 - */ -public class IntIndex { - - private int count = 0; - private int capacity; - private boolean sorted = true; - private final boolean fixedSize; - private int[] keys; - -// - private int targetSearchValue; - - public IntIndex(int capacity, boolean fixedSize) { - - this.capacity = capacity; - this.keys = new int[capacity]; - this.fixedSize = fixedSize; - } - - public synchronized int getKey(int i) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - return keys[i]; - } - - /** - * Modifies an existing pair. - * @param i the index - * @param key the key - */ - public synchronized void setKey(int i, int key) { - - if (i < 0 || i >= count) { - throw new IndexOutOfBoundsException(); - } - - sorted = false; - keys[i] = key; - } - - public synchronized int size() { - return count; - } - - public synchronized int capacity() { - return capacity; - } - - public int[] getKeys() { - return keys; - } - - public synchronized long getTotalValues() { - - long total = 0; - - for (int i = 0; i < count; i++) { - total += keys[i]; - } - - return total; - } - - /** - * Adds a key into the table. - * - * @param key the key - * @return true or false depending on success - */ - public synchronized boolean addUnsorted(int key) { - - if (count == capacity) { - if (fixedSize) { - return false; - } else { - doubleCapacity(); - } - } - - if (sorted && count != 0) { - if (key < keys[count - 1]) { - sorted = false; - } - } - - keys[count] = key; - - count++; - - return true; - } - - /** - * Adds a key into the table with the guarantee that the key - * is equal or larger than the largest existing key. This prevents a sort - * from taking place on next call to find() - * - * @param key the key - * @return true or false depending on success - */ - public synchronized boolean addSorted(int key) { - - if (count == capacity) { - if (fixedSize) { - return false; - } else { - doubleCapacity(); - } - } - - if (count != 0) { - if (key < keys[count - 1]) { - return false; - } - } - - keys[count] = key; - - count++; - - return true; - } - - /** - * Adds a key, ensuring no duplicate key already exists in the - * current search target column. - * @param key the key - * @return true or false depending on success - */ - public synchronized boolean addUnique(int key) { - - if (count == capacity) { - if (fixedSize) { - return false; - } else { - doubleCapacity(); - } - } - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = key; - - int i = binaryEmptySlotSearch(); - - if (i == -1) { - return false; - } - - if (count != i) { - moveRows(i, i + 1, count - i); - } - - keys[i] = key; - - count++; - - return true; - } - - /** - * Adds a key, maintaining sort order on - * current search target column. - * @param key the key - * @return index of added key or -1 if full - */ - public synchronized int add(int key) { - - if (count == capacity) { - if (fixedSize) { - return -1; - } else { - doubleCapacity(); - } - } - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = key; - - int i = binarySlotSearch(); - - if (count != i) { - moveRows(i, i + 1, count - i); - } - - keys[i] = key; - - count++; - - return i; - } - - public void clear() { - removeAll(); - } - - public synchronized int findFirstIndexUnsorted(int value) { - - for (int i = 0; i < count; i++) { - if (keys[i] == value) { - return i; - } - } - - return -1; - } - - /** - * @param value the value - * @return the index - */ - public synchronized int findFirstGreaterEqualKeyIndex(int value) { - - int index = findFirstGreaterEqualSlotIndex(value); - - return index == count ? -1 - : index; - } - - /** - * @param value the value - * @return the index - */ - public synchronized int findFirstEqualKeyIndex(int value) { - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = value; - - return binaryFirstSearch(); - } - - /** - * @param number the number of consecutive keys required - * @return the index or -1 if not found - */ - public synchronized int findFirstConsecutiveKeys(int number) { - - int baseIndex = -1; - - if (count == 0) { - return -1; - } - - if (!sorted) { - fastQuickSort(); - } - - if (number == 1) { - return 0; - } - - for (int i = 1; i < count; i++) { - if (keys[i - 1] == keys[i] - 1) { - if (baseIndex == -1) { - baseIndex = i - 1; - } - - if (i - baseIndex + 1 == number) { - return baseIndex; - } - } else { - baseIndex = -1; - } - } - - return -1; - } - - /** - * - * @param number the number of consecutive keys required - * @param def default value - * @return the first key in series or def if not found - */ - public synchronized int removeFirstConsecutiveKeys(int number, int def) { - - int baseIndex = findFirstConsecutiveKeys(number); - - if (baseIndex == -1) { - return def; - } - - int result = keys[baseIndex]; - - this.removeRange(baseIndex, baseIndex + number); - - return result; - } - - /** - * This method is similar to findFirstGreaterEqualKeyIndex(int) but - * returns the index of the empty row past the end of the array if - * the search value is larger than all the values / keys in the searched - * column. - * @param value the value - * @return the index - */ - public synchronized int findFirstGreaterEqualSlotIndex(int value) { - - if (!sorted) { - fastQuickSort(); - } - - targetSearchValue = value; - - return binarySlotSearch(); - } - - /** - * Returns the index of the lowest element == the given search target, - * or -1 - * @return index or -1 if not found - */ - private int binaryFirstSearch() { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - int found = count; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare < 0) { - high = mid; - } else if (compare > 0) { - low = mid + 1; - } else { - high = mid; - found = mid; - } - } - - return found == count ? -1 - : found; - } - - /** - * Returns the index of the lowest element {@code >=} the given search target, - * or count - * @return the index - */ - private int binarySlotSearch() { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare <= 0) { - high = mid; - } else { - low = mid + 1; - } - } - - return low; - } - - /** - * Returns the index of the lowest element {@code >} the given search target - * or count or -1 if target is found - * @return the index - */ - private int binaryEmptySlotSearch() { - - int low = 0; - int high = count; - int mid = 0; - int compare = 0; - - while (low < high) { - mid = (low + high) >>> 1; - compare = compare(mid); - - if (compare < 0) { - high = mid; - } else if (compare > 0) { - low = mid + 1; - } else { - return -1; - } - } - - return low; - } - - public synchronized void sort() { - fastQuickSort(); - } - - /** - * fast quicksort using a stack on the heap to reduce stack use - */ - private synchronized void fastQuickSort() { - - DoubleIntIndex indices = new DoubleIntIndex(32); - int threshold = 16; - - indices.push(0, count - 1); - - while (indices.size() > 0) { - int start = indices.peekKey(); - int end = indices.peekValue(); - - indices.pop(); - - if (end - start >= threshold) { - int pivot = partition(start, end, - start + ((end - start) >>> 1)); - - indices.push(start, pivot - 1); - indices.push(pivot + 1, end); - } else { - insertionSort(start, end); - } - } - - sorted = true; - } - - private int partition(int start, int end, int pivot) { - - int store = start; - - swap(pivot, end); - - for (int i = start; i <= end - 1; i++) { - if (lessThan(i, end)) { - swap(i, store); - - store++; - } - } - - swap(store, end); - - return store; - } - - /** - * fast quicksort with recursive quicksort implementation - */ - private synchronized void fastQuickSortRecursive() { - - quickSort(0, count - 1); - insertionSort(0, count - 1); - - sorted = true; - } - - private void quickSort(int l, int r) { - - int M = 16; - int i; - int j; - int v; - - if ((r - l) > M) { - i = (r + l) >>> 1; - - if (lessThan(i, l)) { - swap(l, i); // Tri-Median Methode! - } - - if (lessThan(r, l)) { - swap(l, r); - } - - if (lessThan(r, i)) { - swap(i, r); - } - - j = r - 1; - - swap(i, j); - - i = l; - v = j; - - for (;;) { - while (lessThan(++i, v)) {} - - while (lessThan(v, --j)) {} - - if (j < i) { - break; - } - - swap(i, j); - } - - swap(i, r - 1); - quickSort(l, j); - quickSort(i + 1, r); - } - } - - private void insertionSort(int lo0, int hi0) { - - int i; - int j; - - for (i = lo0 + 1; i <= hi0; i++) { - j = i; - - while ((j > lo0) && lessThan(i, j - 1)) { - j--; - } - - if (i != j) { - moveAndInsertRow(i, j); - } - } - } - - protected void moveAndInsertRow(int i, int j) { - - int col1 = keys[i]; - - moveRows(j, j + 1, i - j); - - keys[j] = col1; - } - - protected void swap(int i1, int i2) { - - int col1 = keys[i1]; - - keys[i1] = keys[i2]; - keys[i2] = col1; - } - - /** - * Check if targeted column value in the row indexed i is less than the - * search target object. - * @param i the index - * @return -1, 0 or +1 - */ - protected int compare(int i) { - - if (targetSearchValue > keys[i]) { - return 1; - } else if (targetSearchValue < keys[i]) { - return -1; - } - - return 0; - } - - /** - * Check if row indexed i is less than row indexed j - * @param i the first index - * @param j the second index - * @return true or false - */ - protected boolean lessThan(int i, int j) { - return keys[i] < keys[j]; - } - - protected void moveRows(int fromIndex, int toIndex, int rows) { - System.arraycopy(keys, fromIndex, keys, toIndex, rows); - } - - protected void doubleCapacity() { - keys = (int[]) ArrayUtil.resizeArray(keys, capacity * 2); - capacity *= 2; - } - - public synchronized void removeRange(int start, int limit) { - - ArrayUtil.adjustArray(ArrayUtil.CLASS_CODE_INT, keys, count, start, - start - limit); - - count -= (limit - start); - } - - public synchronized void removeAll() { - - Arrays.fill(keys, 0); - - count = 0; - } - - public final synchronized void remove(int position) { - - moveRows(position + 1, position, count - position - 1); - - count--; - - keys[count] = 0; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntKeyHashMap.java b/database/hsqldb/src/org/hsqldb/lib/IntKeyHashMap.java deleted file mode 100644 index f3760d56..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntKeyHashMap.java +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of int primitives to Object values.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class IntKeyHashMap extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - public IntKeyHashMap() { - this(8); - } - - public IntKeyHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.intKeyOrValue, - BaseHashMap.objectKeyOrValue, false); - } - - public boolean containsKey(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return containsKey(intKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(int key) { - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - return super.containsValue(value); - } - - public V get(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return get(intKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public V get(int key) { - - int lookup = getLookup(key); - - if (lookup != -1) { - return (V) objectValueTable[lookup]; - } - - return null; - } - - public V put(Integer key, V value) { - - if (key == null) { - throw new NullPointerException(); - } - - int intKey = ((Integer) key).intValue(); - - return put(intKey, value); - } - - public V put(int key, V value) { - return (V) super.addOrUpdate(key, 0, null, value); - } - - public V remove(Object key) { - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return remove(intKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public V remove(int key) { - return (V) super.remove(key, 0, null, null, false, false); - } - - public void putAll(Map other) { - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - Integer key = it.next(); - - if (key == null) { - continue; - } - - int intKey = key.intValue(); - - put(intKey, (V) other.get(key)); - } - } - - public void putAll(IntKeyHashMap other) { - - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - int key = it.nextInt(); - - put(key, (V) other.get(key)); - } - } - - public int[] keysToArray(int[] array) { - return toIntArray(array, true); - } - - public Object[] valuesToArray() { - - return toArray(false); - } - - public T[] valuesToArray(T[] array) { - return toArray(array, false); - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return IntKeyHashMap.this.new EntrySetIterator(); - } - - public int size() { - return IntKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Integer key = super.nextInt(); - V value = (V) objectValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return IntKeyHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return IntKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public Iterator iterator() { - return IntKeyHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return IntKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return IntKeyHashMap.this.toArray(false); - } - - public T[] toArray(T[] array) { - return IntKeyHashMap.this.toArray(array, false); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntKeyHashMapConcurrent.java b/database/hsqldb/src/org/hsqldb/lib/IntKeyHashMapConcurrent.java deleted file mode 100644 index a04e8e0a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntKeyHashMapConcurrent.java +++ /dev/null @@ -1,348 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of int primitives to Object values, suitable for thread-safe access.

    - * - * Iterators of keys or values are not thread-safe. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class IntKeyHashMapConcurrent extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - // - ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); - ReentrantReadWriteLock.ReadLock readLock = lock.readLock(); - ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); - - public IntKeyHashMapConcurrent() { - this(8); - } - - public IntKeyHashMapConcurrent(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.intKeyOrValue, - BaseHashMap.objectKeyOrValue, false); - } - - public Lock getWriteLock() { - return writeLock; - } - - public boolean containsKey(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return super.containsKey(intKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(int key) { - - try { - readLock.lock(); - - return super.containsKey(key); - } finally { - readLock.unlock(); - } - } - - public boolean containsValue(Object value) { - - try { - readLock.lock(); - - return super.containsValue(value); - } finally { - readLock.unlock(); - } - } - - public V get(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return get(intKey); - } - - return null; - } - - public V get(int key) { - - try { - readLock.lock(); - - int lookup = getLookup(key); - - if (lookup != -1) { - return (V) objectValueTable[lookup]; - } - - return null; - } finally { - readLock.unlock(); - } - } - - public V put(Integer key, V value) { - - if (key == null) { - throw new NullPointerException(); - } - - int intKey = ((Integer) key).intValue(); - - return put(intKey, value); - } - - - public V put(int key, V value) { - - try { - writeLock.lock(); - - return (V) super.addOrUpdate(key, 0, null, value); - } finally { - writeLock.unlock(); - } - } - - public V remove(Object key) { - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return remove(intKey); - } - - return null; - } - - public V remove(int key) { - - try { - writeLock.lock(); - - return (V) super.remove(key, 0, null, null, false, false); - } finally { - writeLock.unlock(); - } - } - - public void putAll(Map other) { - try { - writeLock.lock(); - - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - Integer key = it.next(); - int intKey = key.intValue(); - - put(intKey, (V) other.get(key)); - } - } finally { - writeLock.unlock(); - } - } - - public void putAll(IntKeyHashMap other) { - - try { - writeLock.lock(); - - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - int intKey = it.nextInt(); - - put(intKey, (V) other.get(intKey)); - } - } finally { - writeLock.unlock(); - } - } - - public int getOrderedKeyMatchCount(int[] array) { - - int i = 0; - - try { - readLock.lock(); - - for (; i < array.length; i++) { - if (!super.containsKey(array[i])) { - break; - } - } - - return i; - } finally { - readLock.unlock(); - } - } - - public int[] keysToArray(int[] array) { - try { - readLock.lock(); - - return toIntArray(array, true); - } finally { - readLock.unlock(); - } - } - - public T[] valuesToArray(T[] array) { - try { - readLock.lock(); - - return toArray(array, false); - } finally { - readLock.unlock(); - } - } - - public Set keySet() { - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return IntKeyHashMapConcurrent.this.new EntrySetIterator(); - } - - public int size() { - return IntKeyHashMapConcurrent.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Integer key = super.nextInt(); - V value = (V) objectValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return IntKeyHashMapConcurrent.this.new BaseHashIterator(true); - } - - public int size() { - return IntKeyHashMapConcurrent.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public Iterator iterator() { - return IntKeyHashMapConcurrent.this.new BaseHashIterator(false); - } - - public int size() { - return IntKeyHashMapConcurrent.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - Object[] array = new Object[size()]; - return IntKeyHashMapConcurrent.this.valuesToArray(array); - } - - public T[] toArray(T[] a) { - return IntKeyHashMapConcurrent.this.valuesToArray(a); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntKeyIntValueHashMap.java b/database/hsqldb/src/org/hsqldb/lib/IntKeyIntValueHashMap.java deleted file mode 100644 index 2a2d3bdb..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntKeyIntValueHashMap.java +++ /dev/null @@ -1,322 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of int primitive keys to int primitive values.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class IntKeyIntValueHashMap extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - public IntKeyIntValueHashMap() { - this(8); - } - - public IntKeyIntValueHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.intKeyOrValue, - BaseHashMap.intKeyOrValue, false); - } - - public boolean containsKey(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return super.containsKey(intKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(int key) { - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - if (value instanceof Integer) { - - int intValue = ((Integer) value).intValue(); - - return super.containsValue(intValue); - } - - if (value == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsValue(int value) { - return super.containsValue(value); - } - - public Integer get(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - try { - int intVal = get(intKey); - - return Integer.valueOf(intVal); - } catch (NoSuchElementException e) { - return null; - } - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public int get(int key) throws NoSuchElementException { - - int lookup = getLookup(key); - - if (lookup != -1) { - return intValueTable[lookup]; - } - - throw new NoSuchElementException(); - } - - public int get(int key, int defaultValue) { - - int lookup = getLookup(key); - - if (lookup != -1) { - return intValueTable[lookup]; - } - - return defaultValue; - } - - public boolean get(int key, int[] value) { - - int lookup = getLookup(key); - - if (lookup != -1) { - value[0] = intValueTable[lookup]; - - return true; - } - - return false; - } - - public Integer put(Integer key, Integer value) { - - if (key == null || value == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - if (oldSize == size()) { - return null; - } else { - return value; - } - } - - public boolean put(int key, int value) { - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - return oldSize != size(); - } - - public Integer remove(Object key) { - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return (Integer) super.remove(intKey, 0, null, null, false, false); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public boolean remove(int key) { - - Integer value = (Integer) super.remove(key, 0, null, null, false, false); - - return value == null ? false : true; - } - - public void putAll(Map other) { - - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - Integer key = it.next(); - int intKey = key.intValue(); - Integer value = other.get(key); - int intValue = value.intValue(); - - put(intKey, intValue); - } - } - - public void putAll(IntKeyIntValueHashMap other) { - - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - - int key = it.nextInt(); - int value = other.get(key); - - put(key, value); - } - } - - public int[] keysToArray(int[] array) { - return toIntArray(array, true); - } - - public int[] valuesToArray(int[] array) { - return toIntArray(array, false); - } - - public Set keySet() { - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return IntKeyIntValueHashMap.this.new EntrySetIterator(); - } - - public int size() { - return IntKeyIntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Integer key = super.nextInt(); - Integer value = intValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return IntKeyIntValueHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return IntKeyIntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public PrimitiveIterator iterator() { - return IntKeyIntValueHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return IntKeyIntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntKeyLongValueHashMap.java b/database/hsqldb/src/org/hsqldb/lib/IntKeyLongValueHashMap.java deleted file mode 100644 index b425991d..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntKeyLongValueHashMap.java +++ /dev/null @@ -1,324 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of int primitive keys to long primitive values.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class IntKeyLongValueHashMap extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - - public IntKeyLongValueHashMap() { - this(8); - } - - public IntKeyLongValueHashMap(int initialCapacity) throws - IllegalArgumentException { - super(initialCapacity, BaseHashMap.intKeyOrValue, - BaseHashMap.longKeyOrValue, false); - } - - public boolean containsKey(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return super.containsKey(intKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(int key) { - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - if (value instanceof Long) { - - long longValue = ((Long) value).longValue(); - - return super.containsValue(longValue); - } - - if (value == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsValue(int value) { - return super.containsValue(value); - } - - public Long get(Object key) { - - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - try { - long longVal = get(intKey); - - return Long.valueOf(longVal); - } catch (NoSuchElementException e) { - return null; - } - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public long get(int key) throws NoSuchElementException { - - int lookup = getLookup(key); - - if (lookup != -1) { - return longValueTable[lookup]; - } - - throw new NoSuchElementException(); - } - - public long get(int key, long defaultValue) { - - int lookup = getLookup(key); - - if (lookup != -1) { - return longValueTable[lookup]; - } - - return defaultValue; - } - - public boolean get(int key, long[] value) { - - int lookup = getLookup(key); - - if (lookup != -1) { - value[0] = longValueTable[lookup]; - - return true; - } - - return false; - } - - public Long put(Integer key, Long value) { - - if (key == null || value == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - if (oldSize == size()) { - return null; - } else { - return value; - } - } - - public boolean put(int key, long value) { - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - return oldSize != size(); - } - - public Long remove(Object key) { - if (key instanceof Integer) { - - int intKey = ((Integer) key).intValue(); - - return (Long)super.remove(intKey, 0, null, null, false, false); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public boolean remove(int key) { - - Long value = (Long)super.remove(key, 0, null, null, false, false); - - return value == null ? false : true; - } - - public void putAll(Map other) { - - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - Integer key = it.next(); - int intKey = key.intValue(); - Long value = other.get(key); - long longValue = value.longValue(); - - put(intKey, longValue); - } - } - - public void putAll(IntKeyIntValueHashMap other) { - - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - - int intKey = it.nextInt(); - int intValue = other.get(intKey); - - put(intKey, intValue); - } - } - - public int[] keysToArray(int[] array) { - return toIntArray(array, true); - } - - public long[] valuesToArray(long[] array) { - return toLongArray(array, false); - } - - public Set keySet() { - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return IntKeyLongValueHashMap.this.new EntrySetIterator(); - } - - public int size() { - return IntKeyLongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Integer key = super.nextInt(); - Long value = longValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return IntKeyLongValueHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return IntKeyLongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public PrimitiveIterator iterator() { - return IntKeyLongValueHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return IntKeyLongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntLookup.java b/database/hsqldb/src/org/hsqldb/lib/IntLookup.java deleted file mode 100644 index d4c1ffbb..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntLookup.java +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -/** - * Interface for int to int lookup. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.8.0 - */ -public interface IntLookup { - - int add(int key, int value); - - boolean addUnsorted(int key, int value); - - int lookup(int key) throws NoSuchElementException; - - int lookup(int key, int def); - - int size(); - - void clear(); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/IntValueHashMap.java b/database/hsqldb/src/org/hsqldb/lib/IntValueHashMap.java deleted file mode 100644 index 9dc91e8a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/IntValueHashMap.java +++ /dev/null @@ -1,295 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -import org.hsqldb.lib.Map.Entry; -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of Object keys to int primitive values.

    - * - * This class does not store null keys. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class IntValueHashMap extends BaseHashMap { - - private Set keySet; - private Collection values; - private Set> entries; - - public IntValueHashMap() { - this(8); - } - - public IntValueHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.objectKeyOrValue, - BaseHashMap.intKeyOrValue, false); - } - - public boolean containsKey(Object key) { - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - - if (value instanceof Integer) { - - int intValue = ((Integer) value).intValue(); - - return super.containsValue(intValue); - } - - if (value == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsValue(int value) { - return super.containsValue(value); - } - - public int get(Object key) throws NoSuchElementException { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup != -1) { - return intValueTable[lookup]; - } - - throw new NoSuchElementException(); - } - - public int get(Object key, int defaultValue) { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup != -1) { - return intValueTable[lookup]; - } - - return defaultValue; - } - - public boolean get(Object key, int[] value) { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup != -1) { - value[0] = intValueTable[lookup]; - - return true; - } - - return false; - } - - public Object getKey(int value) { - - BaseHashIterator it = new BaseHashIterator(false); - - while (it.hasNext()) { - int i = it.nextInt(); - - if (i == value) { - return objectKeyTable[it.getLookup()]; - } - } - - return null; - } - - public boolean put(Object key, int value) { - - if (key == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.addOrUpdate(0, value, key, null); - - return oldSize != size(); - } - - public boolean remove(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.remove(0, 0, key, null, false, false); - - return oldSize != size(); - } - - public void putAll(Map other) { - - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - K key = it.next(); - Integer value = other.get(key); - int intValue = value.intValue(); - - put(key, intValue); - } - } - - public void putAll(IntValueHashMap other) { - - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - Object key = it.next(); - - put(key, other.get(key)); - } - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return IntValueHashMap.this.new EntrySetIterator(); - } - - public int size() { - return IntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - K key = (K) super.next(); - Integer value = intValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return IntValueHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return IntValueHashMap.this.size(); - } - - public boolean contains(Object o) { - return containsKey(o); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return IntValueHashMap.this.toArray(true); - } - - public T[] toArray(T[] a) { - return IntValueHashMap.this.toArray(a, true); - } - } - - class Values extends AbstractReadOnlyCollection { - - public Iterator iterator() { - return IntValueHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return IntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/Iterator.java b/database/hsqldb/src/org/hsqldb/lib/Iterator.java deleted file mode 100644 index e34e305c..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/Iterator.java +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Interface for HyperSQL iterators. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public interface Iterator { - - boolean hasNext(); - - E next(); - - int nextInt(); - - long nextLong(); - - void remove(); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/KMPSearchAlgorithm.java b/database/hsqldb/src/org/hsqldb/lib/KMPSearchAlgorithm.java deleted file mode 100644 index 9ae86b99..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/KMPSearchAlgorithm.java +++ /dev/null @@ -1,709 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; - -/** - * Implements the Knuth-Morris-Pratt string search algorithm for searching - * streams or arrays of octets or characters.

    - * - * This algorithm is a good choice for searching large, forward-only access - * streams for repeated search using pre-processed small to medium sized - * patterns.

    - * - * This is because in addition to the facts that it: - * - *

      - *
    • does not require pre-processing the searched data (only the pattern) - *
    • scans strictly left-to-right - *
    • does not need to perform back tracking - *
    • does not need to employ reverse scan order - *
    • does not need to perform effectively random access lookups against - * the searched data or pattern - *
    - * - * it also has: - * - *
      - *
    • a very simple, highly predictable behavior - *
    • an O(n) complexity once the a search pattern is preprocessed - *
    • an O(m) complexity for pre-processing search patterns - *
    • a worst case performance characteristic of only 2n - *
    • an average case performance characteristic that is deemed to be - * 2-3 times better than the naive search algorithm employed by - * {@link String#indexOf(java.lang.String,int)}. - *
    - * - * Note that the Boyer-Moore algorithm is generally considered to be the better - * practical, all-round exact sub-string search algorithm, but due to its - * reverse pattern scan order, performance considerations dictate that it - * requires more space and that is somewhat more complex to implement - * efficiently for searching forward-only access streams.

    - * - * In particular, its higher average performance is biased toward larger - * search patterns, due to its ability to skip ahead further and with fewer - * tests under reverse pattern scan. But when searching forward-only access - * streams, overall performance considerations require the use a circular buffer - * of the same size as the search pattern to hold data from the searched stream - * as it is being compared in reverse order to the search pattern. Hence, - * Boyer-Moore requires at minimum twice the memory required by - * Knuth-Morris-Pratt to search for the same pattern and that factor has the - * greatest impact precisely on the same class of patterns (larger) for which it - * is most outperforms Knuth-Morris-Pratt. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.x - * @since 2.1 - * @see - * - * Knuth-Morris-Pratt algorithm - */ -public class KMPSearchAlgorithm { - - // @todo 2.7.x - performance optimizations for backend use - - /** - * computes the table used to optimize octet pattern search - * - * @param pattern for which to compute the table. - * @return the table computed from the octet pattern. - * @throws IllegalArgumentException if {@code pattern == null - * || pattern.length < 2}. - */ - public static int[] computeTable(final byte[] pattern) { - - if (pattern == null) { - throw new IllegalArgumentException("pattern must not be null."); - } else if (pattern.length < 2) { - throw new IllegalArgumentException("pattern.length must be > 1."); - } - - // - final int[] table = new int[pattern.length]; - int i = 2; - int j = 0; - - // - table[0] = -1; - table[1] = 0; - - // - while (i < pattern.length) { - if (pattern[i - 1] == pattern[j]) { - table[i] = j + 1; - - j++; - i++; - } else if (j > 0) { - j = table[j]; - } else { - table[i] = 0; - - i++; - - j = 0; - } - } - - // - return table; - } - - /** - * computes the table used to optimize octet pattern search - * - * @param pattern for which to compute the table. - * @return the table computed from the character pattern. - * @throws IllegalArgumentException if {@code pattern == null - * || pattern.length < 2}. - */ - public static int[] computeTable(final char[] pattern) { - - if (pattern == null) { - throw new IllegalArgumentException("pattern must not be null."); - } else if (pattern.length < 2) { - throw new IllegalArgumentException("pattern.length must be > 1."); - } - - int[] table = new int[pattern.length]; - int i = 2; - int j = 0; - - table[0] = -1; - table[1] = 0; - - while (i < pattern.length) { - if (pattern[i - 1] == pattern[j]) { - table[i] = j + 1; - - j++; - i++; - } else if (j > 0) { - j = table[j]; - } else { - table[i] = 0; - - i++; - - j = 0; - } - } - - return table; - } - - /** - * computes the table used to optimize octet pattern search - * - * @param pattern for which to compute the table. - * @return the table computed from the String pattern. - * @throws IllegalArgumentException if {@code pattern == null - * || pattern.length < 2}. - */ - public static int[] computeTable(final String pattern) { - - if (pattern == null) { - throw new IllegalArgumentException("Pattern must not be null."); - } else if (pattern.length() < 2) { - throw new IllegalArgumentException("Pattern length must be > 1."); - } - - final int patternLength = pattern.length(); - - // - int[] table = new int[patternLength]; - int i = 2; - int j = 0; - - table[0] = -1; - table[1] = 0; - - while (i < patternLength) { - if (pattern.charAt(i - 1) == pattern.charAt(j)) { - table[i] = j + 1; - - j++; - i++; - } else if (j > 0) { - j = table[j]; - } else { - table[i] = 0; - - i++; - - j = 0; - } - } - - return table; - } - - /** - * Searches the given octet stream for the given octet pattern - * returning the zero-based offset from the initial stream position - * at which the first match is detected. - *

    - * - * Note that the signature includes a slot for the table so that - * searches for a pattern can be performed multiple times without - * incurring the overhead of computing the table each time. - * - * @param inputStream in which to search - * @param pattern for which to search - * @param table computed from the pattern that optimizes the search. - * If null, automatically computed. - * @return zero-based offset of first match; -1 if {@code inputStream == null - * || pattern == null} or no match found, ; zero (0) if - * {@code pattern.length == 0}. - * @throws IOException when an error occurs accessing the input stream. - */ - public static long search(final InputStream inputStream, - final byte[] pattern, - int[] table) throws IOException { - - if (inputStream == null || pattern == null) { - return -1; - } - - // - final int patternLength = pattern.length; - // as per SQL LOCATE, INSTR, POSITION( IN ) - if (patternLength == 0) { - return 0; - } - - // - long streamIndex = -1; - int currentByte; - - if (patternLength == 1) { - final int byteToFind = pattern[0]; - - currentByte = inputStream.read(); - - while (-1 != currentByte) { - streamIndex++; - - if (currentByte == byteToFind) { - return streamIndex; - } - - currentByte = inputStream.read(); - } - - return -1; - } - - int patternIndex = 0; - final int[] localTable = table == null ? computeTable(pattern) - : table; - currentByte = inputStream.read(); - - while (-1 != currentByte) { - streamIndex++; - - if (currentByte == pattern[patternIndex]) { - patternIndex++; - } else if (patternIndex > 0) { - patternIndex = localTable[patternIndex]; - - patternIndex++; - } - - if (patternIndex == patternLength) { - return streamIndex - (patternLength - 1); - } - - currentByte = inputStream.read(); - } - - return -1; - } - - /** - * Searches the given character stream for the given character pattern - * returning the zero-based offset from the initial stream position - * at which the first match is detected.

    - * - * Note that the signature includes a slot for the table so that - * searches for a pattern can be performed multiple times without - * incurring the overhead of computing the table each time. - * - * @param reader in which to search - * @param pattern for which to search - * @param table computed from the pattern that optimizes the search - * If null, automatically computed. - * @return zero-based offset of first match; -1 if {@code reader == null - * || pattern == null} or no match found, ; zero (0) if - * {@code pattern.length == 0}. - * @throws IOException when an error occurs accessing the input stream. - */ - @SuppressWarnings({"NestedAssignment", "AssignmentToMethodParameter"}) - public static long search(final Reader reader, final char[] pattern, - int[] table) throws IOException { - - if (reader == null || pattern == null) { - return -1; - } - - // - final int patternLength = pattern.length; - // as per SQL LOCATE, INSTR, POSITION( IN ) - if (patternLength == 0) { - return 0; - } - - // - long streamIndex = -1; - int currentCharacter; - - if (patternLength == 1) { - final int characterToFind = pattern[0]; - - currentCharacter = reader.read(); - - while (-1 != currentCharacter) { - streamIndex++; - - if (currentCharacter == characterToFind) { - return streamIndex; - } - - currentCharacter = reader.read(); - } - - return -1; - } - - - final int[] localTable = table == null ? computeTable(pattern) - : table; - // - int patternIndex = 0; - currentCharacter = reader.read(); - - while (-1 != currentCharacter) { - streamIndex++; - - if (currentCharacter == pattern[patternIndex]) { - patternIndex++; - } else if (patternIndex > 0) { - patternIndex = localTable[patternIndex]; - - patternIndex++; - } - - if (patternIndex == patternLength) { - return streamIndex - (patternLength - 1); - } - - currentCharacter = reader.read(); - } - - return -1; - } - - /** - * Searches the given character stream for the given character pattern - * returning the zero-based offset from the initial stream position - * at which the first match is detected. - *

    - * - * Note that the signature includes a slot for the table so that - * searches for a pattern can be performed multiple times without - * incurring the overhead of computing the table each time. - * - * @param reader in which to search - * @param pattern for which to search - * @param table computed from the pattern that optimizes the search - * If null, automatically computed. - * @return zero-based offset of first match; -1 if {@code reader == null - * || pattern == null} or no match found, ; zero (0) if - * {@code pattern.length() == 0}. - * @throws IOException when an error occurs accessing the input stream. - */ - @SuppressWarnings({"NestedAssignment", "AssignmentToMethodParameter"}) - public static long search(final Reader reader, final String pattern, - int[] table) throws IOException { - - if (reader == null || pattern == null) { - return -1; - } - // - final int patternLength = pattern.length(); - // as per SQL LOCATE, INSTR, POSITION( IN ) - if (patternLength == 0) { - return 0; - } - // - long streamIndex = -1; - int currentCharacter; - - if (patternLength == 1) { - final int characterToFind = pattern.charAt(0); - - currentCharacter = reader.read(); - - while (-1 != currentCharacter) { - streamIndex++; - - if (currentCharacter == characterToFind) { - return streamIndex; - } - - currentCharacter = reader.read(); - } - - return -1; - } - - - final int[] localTable = table == null ? computeTable(pattern) - : table; - // - int patternIndex = 0; - currentCharacter = reader.read(); - - while (-1 != currentCharacter) { - streamIndex++; - - if (currentCharacter == pattern.charAt(patternIndex)) { - patternIndex++; - } else if (patternIndex > 0) { - patternIndex = localTable[patternIndex]; - - patternIndex++; - } - - if (patternIndex == patternLength) { - return streamIndex - (patternLength - 1); - } - - currentCharacter = reader.read(); - } - - return -1; - } - - /** - * Searches the given octet string for the given octet pattern - * returning the zero-based offset from given start position - * at which the first match is detected.

    - * - * Note that the signature includes a slot for the table so that - * searches for a pattern can be performed multiple times without - * incurring the overhead of computing the table each time. - * - * @param source array in which to search - * @param pattern to be matched - * @param table computed from the pattern that optimizes the search - * If null, automatically computed. - * @param start position in source at which to start the search - * @return zero-based offset of first match; -1 if {@code source == null - * || pattern == null} or no match found, ; start if - * {@code pattern.length == 0 and start <= source.length}. - */ - public static int search(final byte[] source, final byte[] pattern, - int[] table, final int start) { - - if (source == null || pattern == null) { - return -1; - } - - // - final int sourceLength = source.length; - final int patternLength = pattern.length; - // as per SQL LOCATE, INSTR, POSITION( IN ) - if (patternLength == 0) { - return start > sourceLength ? -1 : start; - } - // - int sourceIndex = start; - - if (patternLength == 1) { - final int byteToFind = pattern[0]; - - for (; sourceIndex < sourceLength; sourceIndex++) { - if (source[sourceIndex] == byteToFind) { - return sourceIndex; - } - } - - return -1; - } - - // - int matchStart = start; - int patternIndex = 0; - - // - final int[] localTable = table == null ? computeTable(pattern) - : table; - // - while ((sourceIndex < sourceLength) - && (patternIndex < patternLength)) { - if (source[sourceIndex] == pattern[patternIndex]) { - patternIndex++; - } else { - final int tableValue = localTable[patternIndex]; - - matchStart += (patternIndex - tableValue); - - if (patternIndex > 0) { - patternIndex = tableValue; - } - - patternIndex++; - } - - sourceIndex = (matchStart + patternIndex); - } - - if (patternIndex == patternLength) { - return matchStart; - } else { - return -1; - } - } - - /** - * Searches the given character array for the given character pattern - * returning the zero-based offset from given start position - * at which the first match is detected. - * - * @param source array in which to search - * @param pattern to be matched - * @param table computed from the pattern that optimizes the search - * If null, automatically computed. - * @param start position in source at which to start the search - * @return zero-based offset of first match; -1 if {@code source == null - * || pattern == null} or no match found, ; start if - * {@code pattern.length == 0 and start <= source.length}. - */ - public static int search(final char[] source, final char[] pattern, - int[] table, final int start) { - - if (source == null || pattern == null) { - return -1; - } - - final int sourceLength = source.length; - final int patternLength = pattern.length; - - // as per SQL LOCATE, INSTR, POSITION( IN ) - if (patternLength == 0) { - return start > sourceLength ? -1 : start; - } - - int sourceIndex = start; - if (patternLength == 1) { - final int characterToFind = pattern[0]; - - for (; sourceIndex < sourceLength; sourceIndex++) { - if (source[sourceIndex] == characterToFind) { - return sourceIndex; - } - } - - return -1; - } - - // - int matchStart = start; - int patternIndex = 0; - - // - final int[] localTable = table == null ? computeTable(pattern) - : table; - - // - while ((sourceIndex < sourceLength) - && (patternIndex < patternLength)) { - if (source[sourceIndex] == pattern[patternIndex]) { - patternIndex++; - } else { - final int tableValue = localTable[patternIndex]; - - matchStart += (patternIndex - tableValue); - - if (patternIndex > 0) { - patternIndex = tableValue; - } - - patternIndex++; - } - - sourceIndex = (matchStart + patternIndex); - } - - if (patternIndex == patternLength) { - return matchStart; - } else { - return -1; - } - } - - /** - * Searches the given String object for the given character pattern - * returning the zero-based offset from given start position - * at which the first match is detected. - * - * @param source array to be searched - * @param pattern to be matched - * @param table computed from the pattern that optimizes the search - * @param start position in source at which to start the search - * @return zero-based offset of first match; -1 if {@code source == null - * || pattern == null} or no match found, ; start if - * {@code pattern.length == 0 and start <= source.length}. - */ - public static int search(final String source, final String pattern, - int[] table, final int start) { - - if (source == null || pattern == null) { - return -1; - } - - final int patternLength = pattern.length(); - final int sourceLength = source.length(); - - // as per SQL LOCATE, INSTR, POSITION( IN ) - if (patternLength == 0) { - return start > sourceLength ? -1 : start; - } - if (patternLength == 1) { - return source.indexOf(pattern, start); - } - - // - int matchStart = start; - int sourceIndex = start; - int patternIndex = 0; - - // - final int[] localTable = table == null ? computeTable(pattern) - : table; - - // - while ((sourceIndex < sourceLength) - && (patternIndex < patternLength)) { - if (source.charAt(sourceIndex) == pattern.charAt(patternIndex)) { - patternIndex++; - } else { - final int tableValue = localTable[patternIndex]; - - matchStart += (patternIndex - tableValue); - - if (patternIndex > 0) { - patternIndex = tableValue; - } - - patternIndex++; - } - - sourceIndex = matchStart + patternIndex; - } - - if (patternIndex == patternLength) { - return matchStart; - } else { - return -1; - } - } - - private KMPSearchAlgorithm() { - assert false : "Pure Utility Class"; - } - -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LineGroupReader.java b/database/hsqldb/src/org/hsqldb/lib/LineGroupReader.java deleted file mode 100644 index 93989eaf..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LineGroupReader.java +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.LineNumberReader; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.hsqldb.lib.java.JavaSystem; -import org.hsqldb.map.ValuePool; - -/** - * Uses a LineNumberReader and returns multiple consecutive lines which conform - * to the specified group demarcation characteristics. Any exception - * thrown while reading from the reader is handled internally. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public class LineGroupReader { - - private static final String[] defaultContinuations = new String[] { - " ", "*" - }; - private static final String[] defaultIgnoredStarts = new String[]{ "--" }; - static final String LS = System.getProperty("line.separator", "\n"); - - // - LineNumberReader reader; - String nextStartLine = null; - int startLineNumber = 0; - int nextStartLineNumber = 0; - - // - final String[] sectionContinuations; - final String[] sectionStarts; - final String[] ignoredStarts; - - /** - * Default constructor for TestUtil usage. - * Sections start at lines beginning with any non-space character. - * SQL comment lines are ignored. - * - * @param reader LineNumberReader - */ - public LineGroupReader(LineNumberReader reader) { - - this.sectionContinuations = defaultContinuations; - this.sectionStarts = ValuePool.emptyStringArray; - this.ignoredStarts = defaultIgnoredStarts; - this.reader = reader; - - try { - getNextSection(); - } catch (Exception e) {} - } - - /** - * Constructor for sections starting with specified strings. - * - * @param reader LineNumberReader - * @param sectionStarts String[] - */ - public LineGroupReader(LineNumberReader reader, String[] sectionStarts) { - - this.sectionStarts = sectionStarts; - this.sectionContinuations = ValuePool.emptyStringArray; - this.ignoredStarts = ValuePool.emptyStringArray; - this.reader = reader; - - try { - getNextSection(); - } catch (Exception e) {} - } - - public HsqlArrayList getNextSection() { - - String line; - HsqlArrayList list = new HsqlArrayList(new String[128], 0); - - if (nextStartLine != null) { - list.add(nextStartLine); - - startLineNumber = nextStartLineNumber; - } - - while (true) { - boolean newSection = false; - - line = null; - - try { - line = reader.readLine(); - } catch (Exception e) {} - - if (line == null) { - nextStartLine = null; - - return list; - } - - line = line.substring(0, StringUtil.rightTrimSize(line)); - - //if the line is blank or a comment, then ignore it - if (line.isEmpty() || isIgnoredLine(line)) { - continue; - } - - if (isNewSectionLine(line)) { - newSection = true; - } - - if (newSection) { - nextStartLine = line; - nextStartLineNumber = reader.getLineNumber(); - - return list; - } - - list.add(line); - } - } - - public String getSectionAsString() { - HsqlArrayList list = getNextSection(); - return convertToString(list, 0); - } - - /** - * Returns a map/list which contains the first line of each line group as - * key and the rest of the lines as a String value. - * - * @return OrderedHashMap - */ - public OrderedHashMap getAsMap() { - - OrderedHashMap map = new OrderedHashMap(); - - while (true) { - HsqlArrayList list = getNextSection(); - - if (list.size() == 0) { - break; - } - - String key = (String) list.get(0); - String value = LineGroupReader.convertToString(list, 1); - - map.put(key, value); - } - - return map; - } - - private boolean isNewSectionLine(String line) { - - if (sectionStarts.length == 0) { - for (int i = 0; i < sectionContinuations.length; i++) { - if (line.startsWith(sectionContinuations[i])) { - return false; - } - } - - return true; - } else { - for (int i = 0; i < sectionStarts.length; i++) { - if (line.startsWith(sectionStarts[i])) { - return true; - } - } - - return false; - } - } - - private boolean isIgnoredLine(String line) { - - for (int i = 0; i < ignoredStarts.length; i++) { - if (line.startsWith(ignoredStarts[i])) { - return true; - } - } - - return false; - } - - public int getStartLineNumber() { - return startLineNumber; - } - - public void close() { - - try { - reader.close(); - } catch (Exception e) {} - } - - public static String convertToString(HsqlArrayList list, int offset) { - - StringBuilder sb = new StringBuilder(); - - for (int i = offset; i < list.size(); i++) { - sb.append(list.get(i)).append(LS); - } - - return sb.toString(); - } - - public static OrderedHashMap getStatementMap(final String path) { - - OrderedHashMap statementMap; - String[] starters = new String[]{ "/*" }; - LineGroupReader lg = getGroupReader(path, starters); - - statementMap = lg.getAsMap(); - - lg.close(); - - return statementMap; - } - - public static LineGroupReader getGroupReader(final String path, - final String[] starters) { - - InputStream fis = - AccessController.doPrivileged(new PrivilegedAction() { - - public InputStream run() { - return getClass().getResourceAsStream(path); - } - }); - InputStreamReader reader = new InputStreamReader(fis, - JavaSystem.CS_ISO_8859_1); - LineNumberReader lineReader = new LineNumberReader(reader); - - return new LineGroupReader(lineReader, starters); - } - - public static LineGroupReader getGroupReader(final String path) { - return getGroupReader(path, ValuePool.emptyStringArray); - } - -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LineReader.java b/database/hsqldb/src/org/hsqldb/lib/LineReader.java deleted file mode 100644 index bd14ed40..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LineReader.java +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; - -/** - * A converter for InputStream to return String objects using the given - * charset for conversion. The readLine() method returns the next string - * excluding carriage-return and line-feed characters. No other character is - * excluded. A carriage-return followed by a line-feed is treated as a single - * end-of-line marker. Otherwise, each carriage-return or line-feed is treated - * as an end-of_line marker. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.0.1 - */ -public class LineReader { - - boolean finished = false; - boolean wasCR = false; - boolean wasEOL = false; - HsqlByteArrayOutputStream baOS = new HsqlByteArrayOutputStream(1024); - - // - final InputStream stream; - final Charset charset; - - public LineReader(InputStream stream, Charset charset) { - this.stream = stream; - this.charset = charset; - } - - public String readLine() throws IOException { - - if (finished) { - return null; - } - - while (true) { - int c = stream.read(); - - if (c == -1) { - finished = true; - - if (baOS.size() == 0) { - return null; - } - - break; - } - - switch (c) { - - case '\r' : { - wasCR = true; - - break; - } - case '\n' : { - if (wasCR) { - wasCR = false; - - continue; - } else { - break; - } - } - default : { - baOS.write(c); - - wasCR = false; - - continue; - } - } - - break; - } - - // can use charset with JDK 1.6 - String string = new String(baOS.getBuffer(), 0, baOS.size(), charset); - - baOS.reset(); - - return string; - } - - public void close() throws IOException { - stream.close(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/List.java b/database/hsqldb/src/org/hsqldb/lib/List.java deleted file mode 100644 index 126297a5..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/List.java +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Interface for List collections. Updated for generics fredt@users. - * - * @author dnordahl@users - * @version 2.6.0 - * @since 1.7.2 - */ -public interface List extends Collection { - - void add(int index, E element); - - boolean add(E element); - - E get(int index); - - E remove(int index); - - E set(int index, E element); - - boolean isEmpty(); - - int size(); - - Iterator iterator(); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LongDeque.java b/database/hsqldb/src/org/hsqldb/lib/LongDeque.java deleted file mode 100644 index c718706d..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LongDeque.java +++ /dev/null @@ -1,349 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Arrays; -import java.util.NoSuchElementException; - -/** - * A deque of long values. Implementation based on HsqlDeque class. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 1.9.0 - */ -public class LongDeque { - - private long[] list; - private int firstindex = 0; // index of first list element - private int endindex = 0; // index of last list element + 1 - private int elementCount; - - // can grow to fill list - // if elementCount == 0 then firstindex == endindex - private static final int DEFAULT_INITIAL_CAPACITY = 8; - - public LongDeque() { - this(DEFAULT_INITIAL_CAPACITY); - } - - public LongDeque(int capacity) { - list = new long[capacity]; - } - - public int size() { - return elementCount; - } - - public boolean isEmpty() { - return elementCount == 0; - } - - public long getFirst() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - return list[firstindex]; - } - - public long getLast() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - return list[endindex - 1]; - } - - public long get(int i) throws IndexOutOfBoundsException { - - int index = getInternalIndex(i); - - return list[index]; - } - - public long removeFirst() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - long value = list[firstindex]; - - list[firstindex] = 0; - - firstindex++; - elementCount--; - - if (elementCount == 0) { - firstindex = endindex = 0; - } else if (firstindex == list.length) { - firstindex = 0; - } - - return value; - } - - public long removeLast() throws NoSuchElementException { - - if (elementCount == 0) { - throw new NoSuchElementException(); - } - - endindex--; - - long value = list[endindex]; - - list[endindex] = 0; - - elementCount--; - - if (elementCount == 0) { - firstindex = endindex = 0; - } else if (endindex == 0) { - endindex = list.length; - } - - return value; - } - - public boolean add(long value) { - - resetCapacity(); - - if (endindex == list.length) { - endindex = 0; - } - - list[endindex] = value; - - elementCount++; - endindex++; - - return true; - } - - public boolean addLast(long value) { - return add(value); - } - - public boolean addFirst(long value) { - - resetCapacity(); - - firstindex--; - - if (firstindex < 0) { - firstindex = list.length - 1; - - if (endindex == 0) { - endindex = list.length; - } - } - - list[firstindex] = value; - - elementCount++; - - return true; - } - - public int addAll(LongDeque deque) { - - int count = 0; - - for (int i = 0; i < deque.size(); i++) { - add(deque.get(i)); - - count++; - } - - return count; - } - - public void clear() { - - if (elementCount == 0) { - return; - } - - firstindex = endindex = elementCount = 0; - - Arrays.fill(list, 0); - } - - public void zeroSize() { - firstindex = endindex = elementCount = 0; - } - - public int indexOf(long value) { - - for (int i = 0; i < elementCount; i++) { - int index = firstindex + i; - - if (index >= list.length) { - index -= list.length; - } - - if (list[index] == value) { - return i; - } - } - - return -1; - } - - public long remove(final int index) { - - int target = getInternalIndex(index); - long value = list[target]; - - if (target == firstindex) { - list[firstindex] = 0; - - firstindex++; - - if (firstindex == list.length) { - firstindex = 0; - } - } else if (target > firstindex) { - System.arraycopy(list, firstindex, list, firstindex + 1, - target - firstindex); - - list[firstindex] = 0; - - firstindex++; - - if (firstindex == list.length) { - firstindex = 0; - } - } else { - System.arraycopy(list, target + 1, list, target, - endindex - target - 1); - - endindex--; - - list[endindex] = 0; - - if (endindex == 0) { - endindex = list.length; - } - } - - elementCount--; - - if (elementCount == 0) { - firstindex = endindex = 0; - } - - return value; - } - - public boolean contains(long value) { - - for (int i = 0; i < elementCount; i++) { - int index = firstindex + i; - - if (index >= list.length) { - index -= list.length; - } - - if (list[index] == value) { - return true; - } - } - - return false; - } - - public void toArray(int[] array) { - - for (int i = 0; i < elementCount; i++) { - array[i] = (int) get(i); - } - } - - public void toArray(long[] array) { - - for (int i = 0; i < elementCount; i++) { - array[i] = get(i); - } - } - - public long[] toArray() { - - long[] array = new long[elementCount]; - - for (int i = 0; i < elementCount; i++) { - array[i] = get(i); - } - - return array; - } - - private int getInternalIndex(int i) throws IndexOutOfBoundsException { - - if (i < 0 || i >= elementCount) { - throw new IndexOutOfBoundsException(); - } - - int index = firstindex + i; - - if (index >= list.length) { - index -= list.length; - } - - return index; - } - - private void resetCapacity() { - - if (elementCount < list.length) { - return; - } - - long[] newList = new long[list.length * 2]; - - System.arraycopy(list, firstindex, newList, firstindex, - list.length - firstindex); - - if (endindex <= firstindex) { - System.arraycopy(list, 0, newList, list.length, endindex); - - endindex = list.length + endindex; - } - - list = newList; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LongKeyHashMap.java b/database/hsqldb/src/org/hsqldb/lib/LongKeyHashMap.java deleted file mode 100644 index da40d730..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LongKeyHashMap.java +++ /dev/null @@ -1,385 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of long primitives to Object values.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class LongKeyHashMap extends BaseHashMap implements Map { - - ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); - ReentrantReadWriteLock.ReadLock readLock = lock.readLock(); - ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); - - // - private Set keySet; - private Collection values; - private Set> entries; - - public LongKeyHashMap() { - this(16); - } - - public LongKeyHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.longKeyOrValue, - BaseHashMap.objectKeyOrValue, false); - } - - public Lock getReadLock() { - return readLock; - } - - public Lock getWriteLock() { - return writeLock; - } - - public boolean containsKey(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return containsKey(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(long key) { - - readLock.lock(); - - try { - return super.containsKey(key); - } finally { - readLock.unlock(); - } - } - - public boolean containsValue(Object value) { - - readLock.lock(); - - try { - return super.containsValue(value); - } finally { - readLock.unlock(); - } - } - - public V get(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return get(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public V get(long key) { - - readLock.lock(); - - try { - int lookup = getLookup(key); - - if (lookup == -1) { - return null; - } - - return (V) objectValueTable[lookup]; - } finally { - readLock.unlock(); - } - } - - public V put(Long key, V value) { - - if (key == null) { - throw new NullPointerException(); - } - - long longKey = ((Long) key).longValue(); - - return put(longKey, value); - } - - public V put(long key, V value) { - - writeLock.lock(); - - try { - return (V) super.addOrUpdate(key, 0, null, value); - } finally { - writeLock.unlock(); - } - } - - public V remove(Object key) { - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return remove(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public V remove(long key) { - - writeLock.lock(); - - try { - return (V) super.remove(key, 0, null, null, false, false); - } finally { - writeLock.unlock(); - } - } - - public void clear() { - - writeLock.lock(); - - try { - super.clear(); - } finally { - writeLock.unlock(); - } - } - - public boolean isEmpty() { - - readLock.lock(); - - try { - return super.isEmpty(); - } finally { - readLock.unlock(); - } - } - - public int size() { - - readLock.lock(); - - try { - return super.size(); - } finally { - readLock.unlock(); - } - } - - public void putAll(Map other) { - Iterator it = other.keySet().iterator(); - - writeLock.lock(); - - try { - while (it.hasNext()) { - Long key = it.next(); - long longKey = key.longValue(); - - put(longKey, (V) other.get(key)); - } - } finally { - writeLock.unlock(); - } - } - - public void putAll(LongKeyHashMap other) { - - writeLock.lock(); - - try { - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - long key = it.nextLong(); - - put(key, (V) other.get(key)); - } - } finally { - writeLock.unlock(); - } - } - - public long[] keysToArray(long[] array) { - - readLock.lock(); - - try { - return toLongArray(array, true); - } finally { - readLock.unlock(); - } - } - - public Object[] valuesToArray() { - - readLock.lock(); - - try { - return toArray(false); - } finally { - readLock.unlock(); - } - } - - public T[] valuesToArray(T[] array) { - - readLock.lock(); - - try { - return toArray(array, false); - } finally { - readLock.unlock(); - } - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return LongKeyHashMap.this.new EntrySetIterator(); - } - - public int size() { - return LongKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Long key = super.nextLong(); - V value = (V) objectValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return LongKeyHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return LongKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public Iterator iterator() { - return LongKeyHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return LongKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return LongKeyHashMap.this.toArray(false); - } - - public T[] toArray(T[] a) { - return LongKeyHashMap.this.toArray(a, false); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LongKeyIntValueHashMap.java b/database/hsqldb/src/org/hsqldb/lib/LongKeyIntValueHashMap.java deleted file mode 100644 index 047d836e..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LongKeyIntValueHashMap.java +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -import org.hsqldb.lib.Map.Entry; -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of long primitives to int primitives.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class LongKeyIntValueHashMap extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - public LongKeyIntValueHashMap() { - this(8); - } - - public LongKeyIntValueHashMap(boolean minimize) { - - this(8); - - minimizeOnEmpty = minimize; - } - - public LongKeyIntValueHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.longKeyOrValue, - BaseHashMap.intKeyOrValue, false); - } - - public boolean containsKey(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return super.containsKey(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(long key) { - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - if (value instanceof Integer) { - - int intValue = ((Integer) value).intValue(); - - return super.containsValue(intValue); - } - - if (value == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsValue(int value) { - return super.containsValue(value); - } - - public Integer get(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - try { - int intVal = get(longKey); - - return Integer.valueOf(intVal); - } catch (NoSuchElementException e) { - return null; - } - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public int get(long key) throws NoSuchElementException { - - int lookup = getLookup(key); - - if (lookup != -1) { - return intValueTable[lookup]; - } - - throw new NoSuchElementException(); - } - - public int get(long key, int defaultValue) { - - int lookup = getLookup(key); - - if (lookup != -1) { - return intValueTable[lookup]; - } - - return defaultValue; - } - - public boolean get(long key, int[] value) { - - int lookup = getLookup(key); - - if (lookup != -1) { - value[0] = intValueTable[lookup]; - - return true; - } - - return false; - } - - public int getLookup(long key) { - return super.getLookup(key); - } - - public Integer put(Long key, Integer value) { - - if (key == null || value == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - if (oldSize == size()) { - return null; - } else { - return value; - } - } - - public boolean put(long key, int value) { - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - return oldSize != size(); - } - - public Integer remove(Object key) { - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return (Integer) super.remove(longKey, 0, null, null, false, false); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public boolean remove(long key) { - - Integer value = (Integer) super.remove(key, 0, null, null, false, false); - - return value == null ? false : true; - } - - - public void putAll(Map other) { - - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - Long key = it.next(); - long longKey = key.longValue(); - Integer value = other.get(key); - int intValue = value.intValue(); - - put(longKey, intValue); - } - } - - public void putAll(LongKeyIntValueHashMap other) { - - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - - long key = it.nextLong(); - int value = other.get(key); - - put(key, value); - } - } - - public long[] keysToArray(long[] array) { - return toLongArray(array, true); - } - - public int[] valuesToArray(int[] array) { - return toIntArray(array, false); - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return LongKeyIntValueHashMap.this.new EntrySetIterator(); - } - - public int size() { - return LongKeyIntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Long key = super.nextLong(); - Integer value = intValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return LongKeyIntValueHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return LongKeyIntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public PrimitiveIterator iterator() { - return LongKeyIntValueHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return LongKeyIntValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LongKeyLongValueHashMap.java b/database/hsqldb/src/org/hsqldb/lib/LongKeyLongValueHashMap.java deleted file mode 100644 index 2f302c13..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LongKeyLongValueHashMap.java +++ /dev/null @@ -1,331 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of long primitives to to long primitive.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class LongKeyLongValueHashMap extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - public LongKeyLongValueHashMap() { - this(8); - } - - public LongKeyLongValueHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.longKeyOrValue, - BaseHashMap.longKeyOrValue, false); - } - - public LongKeyLongValueHashMap(boolean minimize) { - - this(8); - - minimizeOnEmpty = minimize; - } - - public boolean containsKey(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return super.containsKey(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(long key) { - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - if (value instanceof Long) { - - long longValue = ((Long) value).longValue(); - - return super.containsValue(longValue); - } - - if (value == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsValue(long value) { - return super.containsValue(value); - } - - public Long get(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).intValue(); - - try { - long longVal = get(longKey); - - return Long.valueOf(longVal); - } catch (NoSuchElementException e) { - return null; - } - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public long get(long key) throws NoSuchElementException { - - int lookup = getLookup(key); - - if (lookup != -1) { - return longValueTable[lookup]; - } - - throw new NoSuchElementException(); - } - - public long get(long key, long defaultValue) { - - int lookup = getLookup(key); - - if (lookup != -1) { - return longValueTable[lookup]; - } - - return defaultValue; - } - - public boolean get(long key, long[] value) { - - int lookup = getLookup(key); - - if (lookup != -1) { - value[0] = longValueTable[lookup]; - - return true; - } - - return false; - } - - public Long put(Long key, Long value) { - - if (key == null || value == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - if (oldSize == size()) { - return null; - } else { - return value; - } - } - - public boolean put(long key, long value) { - - int oldSize = size(); - - super.addOrUpdate(key, value, null, null); - - return oldSize != size(); - } - - public Long remove(Object key) { - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return (Long) super.remove(longKey, 0, null, null, false, false); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public boolean remove(long key) { - - Long value = (Long) super.remove(key, 0, null, null, false, false); - - return value == null ? false : true; - } - - public void putAll(Map other) { - - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - - Long key = it.next(); - long longKey = key.longValue(); - Long value = other.get(key); - long longValue = value.longValue(); - - put(longKey, longValue); - } - } - - public void putAll(IntKeyIntValueHashMap other) { - - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - - long longKey = it.nextLong(); - int longValue = other.get(longKey); - - put(longKey, longValue); - } - } - - public long[] keysToArray(long[] array) { - return toLongArray(array, true); - } - - public long[] valuesToArray(long[] array) { - return toLongArray(array, false); - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return LongKeyLongValueHashMap.this.new EntrySetIterator(); - } - - public int size() { - return LongKeyLongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Long key = super.nextLong(); - Long value = longValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return LongKeyLongValueHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return LongKeyLongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public PrimitiveIterator iterator() { - return LongKeyLongValueHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return LongKeyLongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LongLookup.java b/database/hsqldb/src/org/hsqldb/lib/LongLookup.java deleted file mode 100644 index 95db1c36..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LongLookup.java +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -/** - * Interface for long to long lookup. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.0.0 - */ -public interface LongLookup { - - int add(long key, long value); - - boolean addUnsorted(long key, long value); - - long lookup(long key) throws NoSuchElementException; - - long lookup(long key, long def); - - long getLongKey(int pos); - - long getLongValue(int pos); - - void setLongValue(int pos, long newValue); - - long getTotalValues(); - - int size(); - - void sort(); - - void clear(); - - LongLookup duplicate(); - - boolean addUnsorted(LongLookup other); - - boolean compactLookupAsIntervals(); - -} diff --git a/database/hsqldb/src/org/hsqldb/lib/LongValueHashMap.java b/database/hsqldb/src/org/hsqldb/lib/LongValueHashMap.java deleted file mode 100644 index 089362ca..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/LongValueHashMap.java +++ /dev/null @@ -1,273 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -import org.hsqldb.lib.Map.Entry; -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of Object keys to long primitives.

    - * - * This class does not store null keys. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class LongValueHashMap extends BaseHashMap { - - private Set keySet; - private Collection values; - private Set> entries; - - public LongValueHashMap() { - this(8); - } - - public LongValueHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity, BaseHashMap.objectKeyOrValue, - BaseHashMap.longKeyOrValue, false); - } - - public LongValueHashMap(int initialCapacity, ObjectComparator comparator) { - - this(initialCapacity); - - this.comparator = comparator; - } - - public long get(Object key) throws NoSuchElementException { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup != -1) { - return longValueTable[lookup]; - } - - throw new NoSuchElementException(); - } - - public long get(Object key, int defaultValue) { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup != -1) { - return longValueTable[lookup]; - } - - return defaultValue; - } - - public boolean get(Object key, long[] value) { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup != -1) { - value[0] = longValueTable[lookup]; - - return true; - } - - return false; - } - - public Object getKey(long value) { - - BaseHashIterator it = new BaseHashIterator(false); - - while (it.hasNext()) { - long i = it.nextLong(); - - if (i == value) { - return objectKeyTable[it.getLookup()]; - } - } - - return null; - } - - public boolean put(Object key, long value) { - - if (key == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.addOrUpdate(0, value, key, null); - - return oldSize != size(); - } - - public boolean remove(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - int oldSize = size(); - - super.remove(0, 0, key, null, false, false); - - return oldSize != size(); - } - - public boolean containsKey(Object key) { - if (key == null) { - throw new NullPointerException(); - } - - return super.containsKey(key); - } - - public void putAll(LongValueHashMap t) { - - Iterator it = t.keySet().iterator(); - - while (it.hasNext()) { - Object key = it.next(); - - put(key, t.get(key)); - } - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return LongValueHashMap.this.new EntrySetIterator(); - } - - public int size() { - return LongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - K key = (K) super.next(); - Long value = longValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public Iterator iterator() { - return LongValueHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return LongValueHashMap.this.size(); - } - - public boolean contains(Object key) { - return containsKey(key); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return LongValueHashMap.this.toArray(true); - } - - public T[] toArray(T[] array) { - return LongValueHashMap.this.toArray(array, true); - } - } - - private class Values extends AbstractReadOnlyCollection { - - public PrimitiveIterator iterator() { - return LongValueHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return LongValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/Map.java b/database/hsqldb/src/org/hsqldb/lib/Map.java deleted file mode 100644 index 2ee8abe6..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/Map.java +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Interface for collections of mapped key - value pairs. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 2.6.0 - */ -public interface Map { - int size(); - - boolean isEmpty(); - - boolean containsKey(Object key); - - boolean containsValue(Object value); - - V get(Object key); - - V put(K key, V value); - - V remove(Object key); - - void putAll(Map m); - - void clear(); - - Set keySet(); - - Collection values(); - - Set> entrySet(); - - /** - * Interface for a key - value pair. - */ - interface Entry { - - K getKey(); - - V getValue(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/MapEntry.java b/database/hsqldb/src/org/hsqldb/lib/MapEntry.java deleted file mode 100644 index 8ed1825a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/MapEntry.java +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.lib.Map.Entry; - -/** - * A key - value pair. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 2.6.0 - */ -public class MapEntry implements Entry { - K key; - V value; - - MapEntry(K key, V value) { - this.key = key; - this.value = value; - } - - public K getKey() { - return key; - } - - public V getValue() { - return value; - } - - public String toString() { - String valueString = value == null ? null - : value.toString(); - return key.toString() + "->" + valueString; - } - - public boolean equals(Object o) { - if (o instanceof Entry) { - Entry other = (Entry) o; - Object otherValue = other.getValue(); - return key.equals(other.getKey()) && - (value == otherValue || - (value != null && value.equals(otherValue))); - } - return false; - } - - public int hashCode() { - return key.hashCode() + (value == null ? 0 : value.hashCode()); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/MultiValueHashMap.java b/database/hsqldb/src/org/hsqldb/lib/MultiValueHashMap.java deleted file mode 100644 index 57742da2..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/MultiValueHashMap.java +++ /dev/null @@ -1,326 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of Object keys to Object values which stores multiple values per - * key. The getValuesIterator(K key) method returns an iterator covering the - * values associated with the given key. The get(K key) method returns the first - * value (if any) associated with the key.

    - * - * This class does not store null keys. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class MultiValueHashMap extends BaseHashMap implements Map{ - - private Set keySet; - private Collection values; - private Set> entries; - - public MultiValueHashMap() { - this(8); - } - - public MultiValueHashMap(int initialCapacity) throws IllegalArgumentException { - - super(initialCapacity, BaseHashMap.objectKeyOrValue, - BaseHashMap.objectKeyOrValue, false); - this.isMultiValue = true; - } - - public MultiValueHashMap(int initialCapacity, ObjectComparator comparator) throws IllegalArgumentException { - - this(initialCapacity); - this.comparator = comparator; - } - - public boolean containsKey(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - return super.containsValue(value); - } - - /** - * Returns one of the values associated with the given key. - * - * @param key the key - * @return any value associated with the key, or null if none - */ - public V get(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - int hash = comparator.hashCode(key); - int lookup = getLookup(key, hash); - - if (lookup != -1) { - return (V) objectValueTable[lookup]; - } - - return null; - } - - /** - * Returns an iterator on all values associated with the key. - * - * @param key the key - * @return iterator on value associated with the key - */ - public Iterator getValuesIterator(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return super.getMultiValuesIterator(key); - } - - public V put(K key, V value) { - - if (key == null) { - throw new NullPointerException(); - } - - boolean added = super.addMultiVal(0, 0, key, value); - - return added ? null : value; - } - - /** - * Removes all values associated with the key. - * - * @param key the key - * @return any value associated with the key, or null if none - */ - public V remove(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return (V) super.removeMultiVal(0, 0, key, null, false); - } - - /** - * Removes the spacific value associated with the key. - * - * @param key the key - * @param value the value - * @return the value associated with the key, or null if none - */ - public boolean remove(Object key, Object value) { - - if (key == null) { - throw new NullPointerException(); - } - - Object result = super.removeMultiVal(0, 0, key, value, true); - - return result != null; - } - - /** - * Counts the values associated with the key. - * - * @param key the key - * @return the count - */ - public int valueCount(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - int hash = comparator.hashCode(key); - - return super.multiValueElementCount(key); - } - - public void putAll(Map m) { - - Iterator it = m.keySet().iterator(); - - while (it.hasNext()) { - K key = it.next(); - - if (key == null) { - continue; - } - - put(key, m.get(key)); - } - } - - public void putAll(MultiValueHashMap m) { - - Iterator it = m.keySet().iterator(); - - while (it.hasNext()) { - K key = it.next(); - - Iterator valueSet = m.getValuesIterator(key); - - while(valueSet.hasNext()) { - V value = valueSet.next(); - put(key, value); - - } - } - } - - public T[] keysToArray(T[] array) { - return toArray(array, true); - } - - public T[] valuesToArray(T[] array) { - return toArray(array, false); - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return MultiValueHashMap.this.new EntrySetIterator(); - } - - public int size() { - return MultiValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - K key = (K) super.next(); - V value = (V) objectValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public Iterator iterator() { - return MultiValueHashMap.this.new MultiValueKeyIterator(); - } - - public int size() { - return MultiValueHashMap.this.multiValueKeyCount(); - } - - public boolean contains(Object key) { - return containsKey(key); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return MultiValueHashMap.this.toArray(true); - } - - public T[] toArray(T[] array) { - return MultiValueHashMap.this.multiValueKeysToArray(array); - } - } - - private class Values extends AbstractReadOnlyCollection { - - public Iterator iterator() { - return MultiValueHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return MultiValueHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return MultiValueHashMap.this.toArray(false); - } - - public T[] toArray(T[] array) { - return MultiValueHashMap.this.toArray(array, false); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/Notified.java b/database/hsqldb/src/org/hsqldb/lib/Notified.java deleted file mode 100644 index eff9a519..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/Notified.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -public interface Notified { - void notify(int id); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ObjectComparator.java b/database/hsqldb/src/org/hsqldb/lib/ObjectComparator.java deleted file mode 100644 index a53b26a3..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ObjectComparator.java +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Interface for equality comparison.

    - * - * The equals and hashCode methods of this interace are used instead of - * the methods of the compared Objects.

    - * - * The DefaultComparator implmentation calls the Object's methods.

    - * - * The IdentityComparator implementation uses {@code ==} instead of the equals - * method of the Object.

    - * - * Updated for generics fredt@users. - * - * @author fredt@users - * @version 2.6.0 - * @since 2.0 - */ -public interface ObjectComparator { - - boolean equals(T a, T b); - - int hashCode(T a); - - long longKey(T a); - - ObjectComparator defaultComparator = new DefaultComparator(); - - ObjectComparator identityComparator = new IdentityComparator(); - - /** - * Comparator that uses identity for Object equality. - */ - class IdentityComparator implements ObjectComparator { - - public boolean equals(Object a, Object b) { - return a == b; - } - - public int hashCode(Object a) { - return a == null ? 0 : - a.hashCode(); - } - - public long longKey(Object a) { - return 0L; - } - } - - /** - * Comparator that uses the equals and hash code methods of Objects. - */ - class DefaultComparator implements ObjectComparator { - - public boolean equals(Object a, Object b) { - return a == b || (a != null && a.equals(b)); - } - - public int hashCode(Object a) { - return a == null ? 0 : - a.hashCode(); - } - - public long longKey(Object a) { - return 0L; - } - } - -} diff --git a/database/hsqldb/src/org/hsqldb/lib/OrderedHashMap.java b/database/hsqldb/src/org/hsqldb/lib/OrderedHashMap.java deleted file mode 100644 index a302470b..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/OrderedHashMap.java +++ /dev/null @@ -1,211 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * A Map which maintains the insertion order of the key/value pairs and allows - * access by index. Iterators return the keys or values in the index order.

    - * - * This class does not store null keys. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.60 - * @since 1.7.2 - */ -public class OrderedHashMap extends HashMap { - - public OrderedHashMap() { - this(8); - } - - public OrderedHashMap(int initialCapacity) throws IllegalArgumentException { - super(initialCapacity); - - this.isList = true; - } - - /** - * Returns the key stored in the entry at index position. - * - * @param index the index of the entry - * @throws IndexOutOfBoundsException for invalid argument - * @return the value stored in the entry - */ - public K getKeyAt(int index) throws IndexOutOfBoundsException { - - checkRange(index); - - return (K) objectKeyTable[index]; - } - - /** - * Returns the value stored in the entry at index position. - * - * @param index the index of the entry - * @throws IndexOutOfBoundsException for invalid argument - * @return the value stored in the entry - */ - public V getValueAt(int index) throws IndexOutOfBoundsException { - - checkRange(index); - - return (V) objectValueTable[index]; - } - - /** - * Same as getValueAt(index). - * - * @param index the index of the entry - * @throws IndexOutOfBoundsException for invalid argument - * @return the value stored in the entry - */ - public V get(int index) throws IndexOutOfBoundsException { - - checkRange(index); - - return (V) objectValueTable[index]; - } - - public V remove(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return (V) super.remove(0, 0, key, null, false, true); - } - - public void removeEntry(int index) throws IndexOutOfBoundsException { - - checkRange(index); - - Object key = objectKeyTable[index]; - - super.remove(0, 0, key, null, false, true); - } - - public boolean add(K key, V value) { - - if (key == null) { - throw new NullPointerException(); - } - - int lookup = getLookup(key); - - if (lookup >= 0) { - return false; - } - - super.put(key, value); - - return true; - } - - public V setValueAt(int index, V value) throws IndexOutOfBoundsException { - - checkRange(index); - - V returnValue = (V) objectValueTable[index]; - - objectValueTable[index] = value; - - return returnValue; - } - - public boolean insert(int index, K key, V value) throws IndexOutOfBoundsException { - - if (key == null) { - throw new NullPointerException(); - } - - if (index < 0 || index > size()) { - throw new IndexOutOfBoundsException(); - } - - - int lookup = getLookup(key); - - if (lookup >= 0) { - return false; - } - - if (index < size()) { - super.insertRow(index); - } - - super.put(key, value); - - return true; - } - - public boolean set(int index, K key, V value) throws IndexOutOfBoundsException { - - if (key == null) { - throw new NullPointerException(); - } - - checkRange(index); - - if (keySet().contains(key) && getIndex(key) != index) { - return false; - } - - super.remove(0, 0, objectKeyTable[index], null, false, false); - super.put(key, value); - - return true; - } - - public boolean setKeyAt(int index, K key) throws IndexOutOfBoundsException { - - if (key == null) { - throw new NullPointerException(); - } - - checkRange(index); - - V value = (V) objectValueTable[index]; - - return set(index, key, value); - } - - public int getIndex(K key) { - return getLookup(key); - } - - private void checkRange(int i) { - - if (i < 0 || i >= size()) { - throw new IndexOutOfBoundsException(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/OrderedHashSet.java b/database/hsqldb/src/org/hsqldb/lib/OrderedHashSet.java deleted file mode 100644 index 8b28192b..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/OrderedHashSet.java +++ /dev/null @@ -1,254 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * A list which is also a Set which maintains the inserted order of elements and - * allows access by index. Iterators return the elements in the index order.

    - * - * This class does not store null elements. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public class OrderedHashSet extends HashSet implements List, Set { - - public OrderedHashSet() { - super(8); - - this.isList = true; - } - - public OrderedHashSet(int initialCapacity) { - super(initialCapacity); - - this.isList = true; - } - - public OrderedHashSet(int initialCapacity, ObjectComparator comparator) { - super(initialCapacity, comparator); - - this.isList = true; - } - - public OrderedHashSet(Object[] valueList) { - this(valueList.length); - - for (int i = 0; i < valueList.length; i++) { - add((E) valueList[i]); - } - } - - public boolean remove(Object key) { - - if (key == null) { - throw new NullPointerException(); - } - - return (Boolean) super.remove(0, 0, key, null, false, true); - } - - public E remove(int index) { - - checkRange(index); - - E key = (E)objectKeyTable[index]; - - super.remove(0, 0, key, null, false, true); - - return key; - } - - public void removeEntry(int index) throws IndexOutOfBoundsException { - remove(index); - } - - public boolean insert(int index, - E key) throws IndexOutOfBoundsException { - - if (index < 0 || index > size()) { - throw new IndexOutOfBoundsException(); - } - - if (contains(key)) { - return false; - } - - if (index < size()) { - super.insertRow(index); - } - - return add(key); - } - - public E set(int index, E key) { - if (key == null) { - throw new NullPointerException(); - } - - checkRange(index); - - if (contains(key) && getIndex(key) != index) { - throw new IllegalArgumentException(); - } - - E oldKey = (E) objectKeyTable[index]; - - super.remove(0, 0, oldKey, null, false, false); - - add(key); - - return oldKey; - } - - public void add(int index, E key) { - boolean result = insert(index, key); - - if (!result) { - throw new IllegalArgumentException(); - } - } - - public E get(int index) { - - checkRange(index); - - return (E) objectKeyTable[index]; - } - - public Object[] toArray() { - Object[] array = new Object[size()]; - return toArray(array); - } - - public T[] toArray(T[] array) { - System.arraycopy(super.objectKeyTable, 0, array, 0, array.length); - - return array; - } - - public int indexOf(Object key) { - return getLookup(key); - } - - public int getIndex(Object key) { - return getLookup(key); - } - - public int lastIndexOf(Object o) { - return indexOf(o); - } - - public int getLargestIndex(OrderedHashSet other) { - - int max = -1; - - for (int i = 0, size = other.size(); i < size; i++) { - int index = indexOf(other.get(i)); - - if (index > max) { - max = index; - } - } - - return max; - } - - public int getSmallestIndex(OrderedHashSet other) { - - int min = -1; - - for (int i = 0, size = other.size(); i < size; i++) { - int index = indexOf(other.get(i)); - - if (index != -1) { - if (min == -1 || index < min) { - min = index; - } - } - } - - return min; - } - - public int getCommonElementCount(Set other) { - - int count = 0; - - for (int i = 0, size = size(); i < size; i++) { - if (other.contains((E) objectKeyTable[i])) { - count++; - } - } - - return count; - } - - public static OrderedHashSet addAll(OrderedHashSet first, - OrderedHashSet second) { - - if (second == null) { - return first; - } - - if (first == null) { - first = new OrderedHashSet(); - } - - first.addAll(second); - - return first; - } - - public static OrderedHashSet add(OrderedHashSet first, E value) { - - if (value == null) { - return first; - } - - if (first == null) { - first = new OrderedHashSet(); - } - - first.add(value); - - return first; - } - - private void checkRange(int i) { - - if (i < 0 || i >= size()) { - throw new IndexOutOfBoundsException(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/OrderedIntHashSet.java b/database/hsqldb/src/org/hsqldb/lib/OrderedIntHashSet.java deleted file mode 100644 index 4bf996e2..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/OrderedIntHashSet.java +++ /dev/null @@ -1,149 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * A list which is also a set of int primitives which maintains the insertion - * order of the elements and allows access by index. Iterators return the keys - * in the index order.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class OrderedIntHashSet extends IntHashSet { - - public OrderedIntHashSet() { - this(8); - } - - public OrderedIntHashSet(int initialCapacity) throws IllegalArgumentException { - - super(initialCapacity); - - isList = true; - } - - public OrderedIntHashSet(int[] elements) { - - super(elements.length); - - isList = true; - - addAll(elements); - } - - public OrderedIntHashSet(int[] elementsA, int[] elementsB) { - - super(elementsA.length + elementsB.length); - - isList = true; - - addAll(elementsA); - addAll(elementsB); - } - - public boolean insert(int index, - int key) throws IndexOutOfBoundsException { - - if (index < 0 || index > size()) { - throw new IndexOutOfBoundsException(); - } - - if (contains(key)) { - return false; - } - - if (index < size()) { - super.insertRow(index); - } - - return add(key); - } - - public boolean remove(int key) { - return (Boolean) super.remove(key, 0, null, null, false, true); - } - - public void removeEntry(int index) throws IndexOutOfBoundsException { - checkRange(index); - - int key = intKeyTable[index]; - - super.remove(key, 0, null, null, false, true); - } - - public int get(int index) { - - checkRange(index); - - return intKeyTable[index]; - } - - public int getIndex(int value) { - return getLookup(value); - } - - public int getOrderedStartMatchCount(int[] array) { - - int i = 0; - - for (; i < array.length; i++) { - if (i >= size() || get(i) != array[i]) { - break; - } - } - - return i; - } - - public boolean addAll(OrderedIntHashSet set) { - - int oldSize = size(); - int setSize = set.size(); - - for (int i = 0; i < setSize; i++) { - int value = set.get(i); - - add(value); - } - - return oldSize != size(); - } - - private void checkRange(int i) { - - if (i < 0 || i >= size()) { - throw new IndexOutOfBoundsException(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/OrderedIntKeyHashMap.java b/database/hsqldb/src/org/hsqldb/lib/OrderedIntKeyHashMap.java deleted file mode 100644 index 42c5ff0a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/OrderedIntKeyHashMap.java +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * A Map of int primitives to Object values which maintains the insertion order - * of the key/value pairs and allows access by index. Iterators return the keys - * or values in the index order.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 2.0.0 - */ -public class OrderedIntKeyHashMap extends IntKeyHashMap implements Map { - - public OrderedIntKeyHashMap() { - this(8); - } - - public OrderedIntKeyHashMap(int initialCapacity) throws IllegalArgumentException { - - super(initialCapacity); - - isList = true; - } - - public int getKeyAt(int lookup, int def) { - - if (lookup >= 0 && lookup < size()) { - return this.intKeyTable[lookup]; - } - - return def; - } - - public Object getValueAt(int index) { - - checkRange(index); - - return this.objectValueTable[index]; - } - - public Object setValueAt(int index, Object value) { - - checkRange(index); - - Object oldValue = objectValueTable[index]; - - objectValueTable[index] = value; - - return oldValue; - } - - public boolean set(int index, int key, V value) throws IndexOutOfBoundsException { - - checkRange(index); - - if (keySet().contains(key) && getIndex(key) != index) { - return false; - } - super.remove(intKeyTable[index], 0, null, null, false, false); - put(key, value); - - return true; - } - - public boolean insert(int index, int key, V value) throws IndexOutOfBoundsException { - - if (index < 0 || index > size()) { - throw new IndexOutOfBoundsException(); - } - - - int lookup = getLookup(key); - - if (lookup >= 0) { - return false; - } - - if (index < size()) { - super.insertRow(index); - } - - super.put(key, value); - - return true; - } - - public boolean setKeyAt(int index, int key) throws IndexOutOfBoundsException { - - checkRange(index); - - V value = (V) objectValueTable[index]; - - return set(index, key, value); - } - - public int getIndex(int key) { - return getLookup(key); - } - - public V remove(int key) { - return (V) super.remove(key, 0, null, null, false, true); - } - - public void removeEntry(int index) throws IndexOutOfBoundsException { - - checkRange(index); - - int key = intKeyTable[index]; - - super.remove(key, 0, null, null, false, true); - } - - private void checkRange(int i) { - - if (i < 0 || i >= size()) { - throw new IndexOutOfBoundsException(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/OrderedLongHashSet.java b/database/hsqldb/src/org/hsqldb/lib/OrderedLongHashSet.java deleted file mode 100644 index 808855d2..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/OrderedLongHashSet.java +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.map.BaseHashMap; - -/** - * A list which is also a set of long primitives which maintains the insertion - * order of the elements and allows access by index. Iterators return the keys - * or values in the index order.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class OrderedLongHashSet extends BaseHashMap { - - public OrderedLongHashSet() { - this(8); - } - - public OrderedLongHashSet(int initialCapacity) - throws IllegalArgumentException { - - super(initialCapacity, BaseHashMap.longKeyOrValue, - BaseHashMap.noKeyOrValue, false); - - isList = true; - } - - public boolean contains(long key) { - return super.containsKey(key); - } - - public boolean add(long key) { - - int oldSize = size(); - - super.addOrUpdate(key, 0, null, null); - - return oldSize != size(); - } - - public boolean insert(int index, - long key) throws IndexOutOfBoundsException { - - if (index < 0 || index > size()) { - throw new IndexOutOfBoundsException(); - } - - if (contains(key)) { - return false; - } - - if (index < size()) { - super.insertRow(index); - } - - return add(key); - } - - public boolean remove(long key) { - - return (Boolean) super.remove(key, 0, null, null, false, true); - } - - public void removeEntry(int index) throws IndexOutOfBoundsException { - - checkRange(index); - - long key = longKeyTable[index]; - - super.remove(key, 0, null, null, false, true); - } - - public long get(int index) { - - checkRange(index); - - return longKeyTable[index]; - } - - public int getIndex(long value) { - return getLookup(value); - } - - public int getStartMatchCount(long[] array) { - - int i = 0; - - for (; i < array.length; i++) { - if (!super.containsKey(array[i])) { - break; - } - } - - return i; - } - - public int getOrderedStartMatchCount(long[] array) { - - int i = 0; - - for (; i < array.length; i++) { - if (i >= size() || get(i) != array[i]) { - break; - } - } - - return i; - } - - public boolean addAll(OrderedLongHashSet col) { - - int oldSize = size(); - - for (int i = 0; i < oldSize; i++) { - long val = col.longValueTable[i]; - - add(val); - } - - return oldSize != size(); - } - - public long[] toArray() { - - int lookup = -1; - long[] array = new long[size()]; - - for (int i = 0; i < array.length; i++) { - lookup = super.nextLookup(lookup); - - long value = intKeyTable[lookup]; - - array[i] = value; - } - - return array; - } - - public PrimitiveIterator iterator() { - return new BaseHashIterator(true); - } - - private void checkRange(int i) { - - if (i < 0 || i >= size()) { - throw new IndexOutOfBoundsException(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/OrderedLongKeyHashMap.java b/database/hsqldb/src/org/hsqldb/lib/OrderedLongKeyHashMap.java deleted file mode 100644 index 072ae87c..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/OrderedLongKeyHashMap.java +++ /dev/null @@ -1,425 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import org.hsqldb.map.BaseHashMap; - -/** - * A Map of long primitives to Object values which maintains the insertion order - * of the key/value pairs and allows access by index. Iterators return the keys - * or values in the index order.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class OrderedLongKeyHashMap extends BaseHashMap implements Map { - - private Set keySet; - private Collection values; - private Set> entries; - - public OrderedLongKeyHashMap() { - this(8); - } - - public OrderedLongKeyHashMap(int initialCapacity) - throws IllegalArgumentException { - - super(initialCapacity, BaseHashMap.longKeyOrValue, - BaseHashMap.objectKeyOrValue, false); - - isList = true; - } - - public OrderedLongKeyHashMap(int initialCapacity, - boolean hasThirdValue) - throws IllegalArgumentException { - - super(initialCapacity, BaseHashMap.longKeyOrValue, - BaseHashMap.objectKeyOrValue, false); - - objectKeyTable = new Object[objectValueTable.length]; - isTwoObjectValue = true; - isList = true; - - if (hasThirdValue) { - objectValueTable2 = new Object[objectValueTable.length]; - } - - minimizeOnEmpty = true; - } - - public boolean containsKey(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return containsKey(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return false; - } - - public boolean containsKey(long key) { - return super.containsKey(key); - } - - public boolean containsValue(Object value) { - return super.containsValue(value); - } - - public V get(Object key) { - - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return get(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public V get(long key) { - - int lookup = getLookup(key); - - if (lookup != -1) { - return (V) objectValueTable[lookup]; - } - - return null; - } - - public long getKeyAt(int index) { - checkRange(index); - - return longKeyTable[index]; - } - - public V getValueAt(int index) { - checkRange(index); - - return (V) objectValueTable[index]; - } - - public Object getSecondValueAt(int index) { - checkRange(index); - - return objectKeyTable[index]; - } - - public Object getThirdValueAt(int index) { - checkRange(index); - - return objectValueTable2[index]; - } - - public Object setValueAt(int index, Object value) { - - checkRange(index); - - Object oldValue = objectValueTable[index]; - - objectValueTable[index] = value; - - return oldValue; - } - - public Object setSecondValueAt(int index, Object value) { - - checkRange(index); - - Object oldValue = objectKeyTable[index]; - - objectKeyTable[index] = value; - - return oldValue; - } - - public Object setThirdValueAt(int index, Object value) { - - checkRange(index); - - Object oldValue = objectValueTable2[index]; - - objectValueTable2[index] = value; - - return oldValue; - } - - public boolean insert(int index, long key, V value) throws IndexOutOfBoundsException { - - if (index < 0 || index > size()) { - throw new IndexOutOfBoundsException(); - } - - - int lookup = getLookup(key); - - if (lookup >= 0) { - return false; - } - - if (index < size()) { - super.insertRow(index); - } - - put(key, value); - - return true; - } - - public boolean set(int index, long key, V value) throws IndexOutOfBoundsException { - - checkRange(index); - - if (keySet().contains(key) && getIndex(key) != index) { - return false; - } - - super.remove(longKeyTable[index], 0, null, null, false, false); - put(key, value); - - return true; - } - - public boolean setKeyAt(int index, long key) throws IndexOutOfBoundsException { - - checkRange(index); - - V value = (V) objectValueTable[index]; - - return set(index, key, value); - } - - public int getIndex(long key) { - return getLookup(key); - } - - public V put(Long key, V value) { - - if (key == null) { - throw new NullPointerException(); - } - - long longKey = ((Long) key).longValue(); - - return put(longKey, value); - } - - public V put(long key, V value) { - return (V) super.addOrUpdate(key, 0, null, value); - } - - public V remove(Object key) { - if (key instanceof Long) { - - long longKey = ((Long) key).longValue(); - - return remove(longKey); - } - - if (key == null) { - throw new NullPointerException(); - } - - return null; - } - - public V remove(long key) { - - V returnValue = (V) super.remove(key, 0, null, null, false, true); - - return returnValue; - } - - public void removeEntry(int index) throws IndexOutOfBoundsException { - - checkRange(index); - - long key = longKeyTable[index]; - - super.remove(key, 0, null, null, false, true); - } - - public int getLookup(long key) { - return super.getLookup(key); - } - - public void putAll(Map other) { - Iterator it = other.keySet().iterator(); - - while (it.hasNext()) { - Long key = it.next(); - long longKey = key.longValue(); - - put(longKey, (V) other.get(key)); - } - } - - public void putAll(LongKeyHashMap other) { - - PrimitiveIterator it = (PrimitiveIterator) other.keySet().iterator(); - - while (it.hasNext()) { - long key = it.nextLong(); - - put(key, (V) other.get(key)); - } - } - - public long[] keysToArray(long[] array) { - - return toLongArray(array, true); - } - - public Object[] valuesToArray() { - - return toArray(false); - } - - public T[] valuesToArray(T[] array) { - - return toArray(array, false); - } - - public Set keySet() { - - if (keySet == null) { - keySet = new KeySet(); - } - - return keySet; - } - - public Collection values() { - - if (values == null) { - values = new Values(); - } - - return values; - } - - public Set> entrySet() { - if (entries == null) { - entries = new EntrySet(); - } - - return entries; - } - - private class EntrySet extends AbstractReadOnlyCollection> implements Set> { - - public Iterator> iterator() { - return OrderedLongKeyHashMap.this.new EntrySetIterator(); - } - - public int size() { - return OrderedLongKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class EntrySetIterator extends BaseHashIterator{ - - EntrySetIterator() { - super(true); - } - - public Entry next() { - Long key = super.nextLong(); - V value = (V) objectValueTable[lookup]; - - return new MapEntry(key, value); - } - } - - private void checkRange(int i) { - - if (i < 0 || i >= size()) { - throw new IndexOutOfBoundsException(); - } - } - - private class KeySet extends AbstractReadOnlyCollection implements Set { - - public PrimitiveIterator iterator() { - return OrderedLongKeyHashMap.this.new BaseHashIterator(true); - } - - public int size() { - return OrderedLongKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - } - - private class Values extends AbstractReadOnlyCollection { - - public PrimitiveIterator iterator() { - return OrderedLongKeyHashMap.this.new BaseHashIterator(false); - } - - public int size() { - return OrderedLongKeyHashMap.this.size(); - } - - public boolean isEmpty() { - return size() == 0; - } - - public Object[] toArray() { - return OrderedLongKeyHashMap.this.toArray(false); - } - - public T[] toArray(T[] array) { - return OrderedLongKeyHashMap.this.toArray(array, false); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/PrimitiveIterator.java b/database/hsqldb/src/org/hsqldb/lib/PrimitiveIterator.java deleted file mode 100644 index 2db05841..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/PrimitiveIterator.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Marker interface for iterators supporting nextInt or nextLong methods. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public interface PrimitiveIterator extends Iterator {} diff --git a/database/hsqldb/src/org/hsqldb/lib/ReadWriteLockDummy.java b/database/hsqldb/src/org/hsqldb/lib/ReadWriteLockDummy.java deleted file mode 100644 index b0d924dc..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ReadWriteLockDummy.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; - -public class ReadWriteLockDummy implements ReadWriteLock { - - public Lock readLock() { - return new LockDummy(); - } - - public Lock writeLock() { - return new LockDummy(); - } - - public static class LockDummy implements Lock { - - public void lock() {} - - public void lockInterruptibly() {} - - public boolean tryLock() { - return false; - } - - public boolean tryLock(long time, TimeUnit unit) { - return false; - } - - public void unlock() {} - - public Condition newCondition() { - return null; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ReaderInputStream.java b/database/hsqldb/src/org/hsqldb/lib/ReaderInputStream.java deleted file mode 100644 index a7f70206..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ReaderInputStream.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; - -/** - * This class is an part implementation of DataInput. It wraps a Reader object. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.9.0 - */ -public class ReaderInputStream extends InputStream { - - protected Reader reader; - protected long pos; - int lastChar = -1; - - public ReaderInputStream(Reader reader) { - this.reader = reader; - this.pos = 0; - } - - public int read() throws IOException { - - if (lastChar >= 0) { - int val = lastChar & 0xff; - - lastChar = -1; - - pos++; - return val; - } - - lastChar = reader.read(); - - if (lastChar < 0) { - return lastChar; - } - - pos++; - return lastChar >> 8; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/RefCapablePropertyResourceBundle.java b/database/hsqldb/src/org/hsqldb/lib/RefCapablePropertyResourceBundle.java deleted file mode 100644 index ee47d47e..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/RefCapablePropertyResourceBundle.java +++ /dev/null @@ -1,501 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/* $Id: RefCapablePropertyResourceBundle.java 6513 2022-05-18 03:25:20Z unsaved $ */ - -/** - * Just like PropertyResourceBundle, except keys mapped to nothing in the - * properties file will load the final String value from a text file. - * - * The use case is where one wants to use a ResourceBundle for Strings, - * but some of the Strings are long-- too long to maintain in a Java - * .properties file. - * By using this class, you can put each such long String in its own - * separate file, yet all keys mapped to (non-empty) values in the - * .properties file will behave just like regular PropertyResourceBundle - * properties. - * In this documentation, I call these values read in atomically from - * other files referenced values, because the values are not directly - * in the .properties file, but are "referenced" in the .properties file - * by virtue of the empty value for the key. - * - * You use this class in the same way as you would traditionally use - * ResourceBundle: - *

    - *  import org.hsqldb.util..RefCapablePropertyResourceBundle;
    - *  ...
    - *      RefCapablePropertyResourceBundle bundle =
    - *              RefCapablePropertyResourceBundle.getBundle("subdir.xyz");
    - *      System.out.println("Value for '1' = (" + bundle.getString("1") + ')');
    - * 
    - * - * Just like PropertyResourceBundle, the .properties file and the - * referenced files are read in from the classpath by a class loader, - * according to the normal ResourceBundle rules. - * To eliminate the need to prohibit the use of any strings in the .properties - * values, and to enforce consistency, you must use the following rules - * to when putting your referenced files into place. - *

    - * REFERENCED FILE DIRECTORY is a directory named with the base name of the - * properties file, and in the same parent directory. So, the referenced - * file directory /a/b/c/greentea is used to hold all reference - * files for properties files /a/b/c/greentea_en_us.properties, - * /a/b/c/greentea_de.properties, - * /a/b/c/greentea.properties, etc. - * (BTW, according to ResourceBundle rules, this resource should be looked - * up with name "a.b.c.greentea", not "/a/b/c..." or "a/b/c"). - * REFERENCED FILES themselves all have the base name of the property key, - * with locale appendages exactly as the referring properties files - * has, plus the suffix .text. - *

    - * So, if we have the following line in - * /a/b/c/greentea_de.properties: - *

    - *     1: eins
    - * 
    - * then you must have a reference text file - * /a/b/c/greentea/1_de.properties: - *

    - * In reference text files, - * sequences of "\r", "\n" and "\r\n" are all translated to the line - * delimiter for your platform (System property line.separator). - * If one of those sequences exists at the very end of the file, it will be - * eliminated (so, if you really want getString() to end with a line delimiter, - * end your file with two of them). - * (The file itself is never modified-- I'm talking about the value returned - * by getString(String)). - *

    - * To prevent throwing at runtime due to unset variables, use a wrapper class - * like SqltoolRB (use SqltoolRB.java as a template). - * To prevent throwing at runtime due to unset System Properties, or - * insufficient parameters passed to getString(String, String[]), set the - * behavior values appropriately. - *

    - * Just like all Properties files, referenced files must use ISO-8859-1 - * encoding, with unicode escapes for characters outside of ISO-8859-1 - * character set. But, unlike Properties files, \ does not need to be - * escaped for normal usage. - *

    - * The getString() methods with more than one parameter substitute for - * "positional" parameters of the form "%{1}". - * The getExpandedString() methods substitute for System Property names - * of the form "${1}". - * In both cases, you can interpose :+ and a string between the variable - * name and the closing }. This works just like the Bourne shell - * ${x:+y} feature. If "x" is set, then "y" is returned, and "y" may - * contain references to the original variable without the curly braces. - * In this file, I refer to the y text as the "conditional string". - * One example of each type: - *

    - *     Out val = (${condlSysProp:+Prop condlSysProp is set to $condlSysProp.})
    - *     Out val = (%{2:+Pos Var #2 is set to %2.})
    - * OUTPUT if neither are set:
    - *     Out val = ()
    - *     Out val = ()
    - * OUTPUT if condlSysProp=alpha and condlPLvar=beta:
    - *     Out val = (Prop condlSysProp is set to alpha.)
    - *     Out val = (Pos Var #2 is set to beta.)
    - * 
    - * This feature has the following limitations. - *
      - *
    • The conditional string may only contain the primary variable. - *
    • Inner instances of the primary variable may not use curly braces, - * and therefore the variable name must end at a word boundary. - *
    - * The conditional string may span newlines, and it is often very useful - * to do so. - * - * @see java.util.PropertyResourceBundle - * @see java.util.ResourceBundle - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ -public class RefCapablePropertyResourceBundle { - private PropertyResourceBundle wrappedBundle; - private String baseName; - private String language, country, variant; - static private Map - allBundles = - new HashMap(); - public static final String LS = System.getProperty("line.separator"); - private Pattern sysPropVarPattern = Pattern.compile( - "(?s)\\Q${\\E([^}]+?)(?:\\Q:+\\E([^}]+))?\\Q}"); - private Pattern posPattern = Pattern.compile( - "(?s)\\Q%{\\E(\\d)(?:\\Q:+\\E([^}]+))?\\Q}"); - private Class> loaderClass; - - public static final int THROW_BEHAVIOR = 0; - public static final int EMPTYSTRING_BEHAVIOR = 1; - public static final int NOOP_BEHAVIOR = 2; - - public Enumeration getKeys() { - return wrappedBundle.getKeys(); - } - - private RefCapablePropertyResourceBundle(String baseName, - PropertyResourceBundle wrappedBundle, - Class> loaderClass) { - this.baseName = baseName; - this.wrappedBundle = wrappedBundle; - Locale locale = wrappedBundle.getLocale(); - this.loaderClass = loaderClass; - language = locale.getLanguage(); - country = locale.getCountry(); - variant = locale.getVariant(); - if (language.length() < 1) language = null; - if (country.length() < 1) country = null; - if (variant.length() < 1) variant = null; - } - - /** - * Same as getString(), but expands System Variables specified in property - * values like ${sysvarname}. - * - * @param key String - * @param behavior int - * @return String - */ - public String getExpandedString(String key, int behavior) { - String s = getString(key); - Matcher matcher = sysPropVarPattern.matcher(s); - int previousEnd = 0; - StringBuilder sb = new StringBuilder(); - String varName, varValue; - String condlVal; // Conditional : value - while (matcher.find()) { - varName = matcher.group(1); - condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null); - varValue = System.getProperty(varName); - if (condlVal != null) { - // Replace varValue (the value to be substituted), with - // the post-:+ portion of the expression. - varValue = ((varValue == null) - ? "" - : condlVal.replaceAll("\\Q$" + varName + "\\E\\b", - Matcher.quoteReplacement(varValue))); - } - if (varValue == null) switch (behavior) { - case THROW_BEHAVIOR: - throw new RuntimeException( - "No Sys Property set for variable '" - + varName + "' in property value (" - + s + ")."); - case EMPTYSTRING_BEHAVIOR: - varValue = ""; - break; - case NOOP_BEHAVIOR: - break; - default: - throw new RuntimeException( - "Undefined value for behavior: " + behavior); - } - sb.append(s.substring(previousEnd, matcher.start()) - + ((varValue == null) ? matcher.group() : varValue)); - previousEnd = matcher.end(); - } - return (previousEnd < 1) ? s - : (sb.toString() + s.substring(previousEnd)); - } - - /** - * Replaces positional substitution patterns of the form %{\d} with - * corresponding element of the given subs array. Note that %{\d} numbers - * are 1-based, so we lok for subs[x-1]. - * - * @param s String - * @param subs String[] - * @param behavior int - * @return String - */ - public String posSubst(String s, String[] subs, int behavior) { - Matcher matcher = posPattern.matcher(s); - int previousEnd = 0; - StringBuilder sb = new StringBuilder(); - String varValue; - int varIndex; - String condlVal; // Conditional : value - while (matcher.find()) { - varIndex = Integer.parseInt(matcher.group(1)) - 1; - condlVal = ((matcher.groupCount() > 1) ? matcher.group(2) : null); - varValue = ((varIndex < subs.length) ? subs[varIndex] : null); - if (condlVal != null) { - // Replace varValue (the value to be substituted), with - // the post-:+ portion of the expression. - varValue = ((varValue == null) - ? "" - : condlVal.replaceAll("\\Q%" + (varIndex+1) + "\\E\\b", - Matcher.quoteReplacement(varValue))); - } - // System.err.println("Behavior: " + behavior); - if (varValue == null) switch (behavior) { - case THROW_BEHAVIOR: - throw new RuntimeException( - Integer.toString(subs.length) - + " positional values given, but property string " - + "contains (" + matcher.group() + ")."); - case EMPTYSTRING_BEHAVIOR: - varValue = ""; - break; - case NOOP_BEHAVIOR: - break; - default: - throw new RuntimeException( - "Undefined value for behavior: " + behavior); - } - sb.append(s.substring(previousEnd, matcher.start()) - + ((varValue == null) ? matcher.group() : varValue)); - previousEnd = matcher.end(); - } - return (previousEnd < 1) ? s - : (sb.toString() + s.substring(previousEnd)); - } - - public String getExpandedString(String key, String[] subs, - int missingPropertyBehavior, int missingPosValueBehavior) { - return posSubst(getExpandedString(key, missingPropertyBehavior), subs, - missingPosValueBehavior); - } - public String getString(String key, String[] subs, int behavior) { - return posSubst(getString(key), subs, behavior); - } - - /** - * Just identifies this RefCapablePropertyResourceBundle instance. - * - * @return String - */ - public String toString() { - return baseName + " for " + language + " / " + country + " / " - + variant; - } - - /** - * Returns value defined in this RefCapablePropertyResourceBundle's - * .properties file, unless that value is empty. If the value in the - * .properties file is empty, then this returns the entire contents of the - * referenced text file. - * - * @see ResourceBundle#getString(String) - * @param key String - * @return String - */ - public String getString(String key) { - String value = wrappedBundle.getString(key); - if (value.length() < 1) { - value = getStringFromFile(key); - // For conciseness and sanity, get rid of all \r's so that \n - // will definitively be our line breaks. - if (value.indexOf('\r') > -1) - value = value.replaceAll("\\Q\r\n", "\n") - .replaceAll("\\Q\r", "\n"); - if (value.length() > 0 && value.charAt(value.length() - 1) == '\n') - value = value.substring(0, value.length() - 1); - } - return RefCapablePropertyResourceBundle.toNativeLs(value); - } - - /** - * @param inString Input string with \n definitively indicating desired - * position for line separators. - * @return If platform's line-separator is \n, then just returns inString. - * Otherwise returns a copy of inString, with all \n's - * transformed to the platform's line separators. - */ - public static String toNativeLs(String inString) { - return LS.equals("\n") ? inString : inString.replaceAll("\\Q\n", LS); - } - - /** - * Use like java.util.ResourceBundle.getBundle(String). - * - * ClassLoader is required for our getBundles()s, since it is impossible - * to get the "caller's" ClassLoader without using JNI (i.e., with pure - * Java). - * - * @see ResourceBundle#getBundle(String) - * @param baseName String - * @param loader ClassLoader - * @param loaderClass Class - * @return RefCapablePropertyResourceBundle - */ - public static RefCapablePropertyResourceBundle getBundle(String baseName, - ClassLoader loader, Class> loaderClass) { - return getRef(baseName, ResourceBundle.getBundle(baseName, - Locale.getDefault(), loader), loaderClass); - } - - /** - * Use exactly like java.util.ResourceBundle.get(String, Locale, - * ClassLoader). - * - * @see ResourceBundle#getBundle(String, Locale, ClassLoader) - * @param baseName String - * @param locale Locale - * @param loader ClassLoader - * @param loaderClass Class - * @return RefCapablePropertyResourceBundle - */ - public static RefCapablePropertyResourceBundle - getBundle(String baseName, Locale locale, ClassLoader loader, - Class> loaderClass) { - return getRef(baseName, ResourceBundle.getBundle( - baseName, locale, loader), loaderClass); - } - - /** - * Return a ref to a new or existing RefCapablePropertyResourceBundle, or - * throw a MissingResourceException. - * - * @param baseName String - * @param rb ResourceBundle - * @param loaderClass Class - * @return RefCapablePropertyResourceBundle - */ - static private RefCapablePropertyResourceBundle getRef(String baseName, - ResourceBundle rb, Class> loaderClass) { - if (!(rb instanceof PropertyResourceBundle)) - throw new MissingResourceException( - "Found a Resource Bundle, but it is a " - + rb.getClass().getName(), - PropertyResourceBundle.class.getName(), null); - if (allBundles.containsKey(rb)) return allBundles.get(rb); - RefCapablePropertyResourceBundle newPRAFP = - new RefCapablePropertyResourceBundle(baseName, - (PropertyResourceBundle) rb, loaderClass); - allBundles.put(rb, newPRAFP); - return newPRAFP; - } - - /** - * Recursive. - * For consistency we do not allow paths relative to anything other - * than root. Even though we load via Class, baseNames are resolved - * as if absolute, just like ClassLoader lookups. - */ - private InputStream getMostSpecificStream( - String key, String l, String c, String v) { - // Now that using a Class to look up resource for this special case, - // absolute paths need to begin with slash. - final String filePath = - (baseName.matches("^[^./].*[./].+") ? "/" : "") - + baseName.replace('.', '/') + '/' + key - + ((l == null) ? "" : ("_" + l)) - + ((c == null) ? "" : ("_" + c)) - + ((v == null) ? "" : ("_" + v)) - + ".text"; - //System.err.println("Seeking " + filePath + " FOR " + baseName); - InputStream is = loaderClass.getResourceAsStream(filePath); - // N.b. If were using Class.getRes... instead of ClassLoader.getRes... - // we would need to prefix the path with "/". - return (is == null && l != null) - ? getMostSpecificStream(key, ((c == null) ? null : l), - ((v == null) ? null : c), null) - : is; - } - - private String getStringFromFile(String key) { - byte[] ba = null; - int bytesread = 0; - int retval; - InputStream inputStream = - getMostSpecificStream(key, language, country, variant); - if (inputStream == null) - throw new MissingResourceException( - "Key '" + key - + "' is present in .properties file with no value, yet " - + "text file resource is missing", - RefCapablePropertyResourceBundle.class.getName(), key); - try { - try { - ba = new byte[inputStream.available()]; - } catch (IOException ioe) { - throw new MissingResourceException( - "Failed to read in value for key '" + key + "': " + ioe, - RefCapablePropertyResourceBundle.class.getName(), key); - } catch (Throwable re) { - throw new MissingResourceException( - "Resource is too big to read in '" + key + "' value in one " - + "gulp.\nPlease run the program with more RAM " - + "(try Java -Xm* switches).: " + re, - RefCapablePropertyResourceBundle.class.getName(), key); - } - - try { - while (bytesread < ba.length && - (retval = inputStream.read( - ba, bytesread, ba.length - bytesread)) > 0) { - bytesread += retval; - } - } catch (IOException ioe) { - throw new MissingResourceException( - "Failed to read in value for '" + key + "': " + ioe, - RefCapablePropertyResourceBundle.class.getName(), key); - } - } finally { - try { - inputStream.close(); - } catch (IOException ioe) { - System.err.println("Failed to close input stream: " + ioe); - } - } - if (bytesread != ba.length) { - throw new MissingResourceException( - "Didn't read all bytes. Read in " - + bytesread + " bytes out of " + ba.length - + " bytes for key '" + key + "'", - RefCapablePropertyResourceBundle.class.getName(), key); - } - - try { - return new String(ba, Charset.forName("ISO-8859-1")); - } catch (Throwable re) { - throw new MissingResourceException( - "Value for key '" + key + "' too big to convert to String. " - + "Please run the program with more RAM " - + "(try Java -Xm* switches).: " + re, - RefCapablePropertyResourceBundle.class.getName(), key); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/RefCapableRBInterface.java b/database/hsqldb/src/org/hsqldb/lib/RefCapableRBInterface.java deleted file mode 100644 index 28649ef7..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/RefCapableRBInterface.java +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -public interface RefCapableRBInterface { - String getString(); - String getString(String... strings); - String getExpandedString(); - String getExpandedString(String... strings); - String getString(int i1); - String getString(int i1, int i2); - String getString(int i1, int i2, int i3); - String getString(int i1, String s2); - String getString(String s1, int i2); - String getString(int i1, int i2, String s3); - String getString(int i1, String s2, int i3); - String getString(String s1, int i2, int i3); - String getString(int i1, String s2, String s3); - String getString(String s1, String s2, int i3); - String getString(String s1, int i2, String s3); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ScannerSearchAlgorithm.java b/database/hsqldb/src/org/hsqldb/lib/ScannerSearchAlgorithm.java deleted file mode 100644 index 552093ad..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ScannerSearchAlgorithm.java +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.hsqldb.lib; - -import java.io.Reader; -import java.util.Scanner; -import java.util.logging.Logger; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -/** - * Provides a string search facility using a {@link Scanner}. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.x - * @since 2.7.x - */ -public class ScannerSearchAlgorithm { - - /** - * is 1024. This is the size above which it may be better to use - * {@link KMPSearchAlgorithm}. - */ - public static final int SUGGESTED_MAX_LITERAL_SIZE = 1024; - private static final Logger LOG - = Logger.getLogger(ScannerSearchAlgorithm.class.getName()); - - /** - * the given {@code reader} for the given {@code searchstr}. - * - * @param reader to search - * @param searchstr to find - * @param literal true to treat {@code searchstr} as a literal search - * term; false to treat {@code searchstr} as a regular - * expression. - * @return zero-based offset into stream at which {@code searchstr} is - * found; -1 if not found, {@code reader} is null, or - * {@code searchstr} is null; 0 if {@code searchstr.length() == 0 - * && literal == true}. - * @throws IllegalStateException if a {@link Scanner} illegal state - * occurs - * @throws IllegalArgumentException if a {@link Scanner} illegal argument is - * encountered. - */ - public static long search(Reader reader, char[] searchstr, boolean literal) { - if (reader == null || searchstr == null) { - return -1; - } - if (searchstr.length == 0 && literal) { - return 0; - } - return search(reader, new String(searchstr), literal); - } - - /** - * the given {@code reader} for the given {@code searchstr}. - * - * @param reader to search - * @param searchstr to find - * @param literal true to treat {@code searchstr} as a literal search - * term; false to treat {@code searchstr} as a regular - * expression. - * @return zero-based offset into stream at which {@code searchstr} is - * found; -1 if not found, {@code reader} is null, or - * {@code searchstr} is null; 0 if {@code searchstr.length() == 0 - * && literal == true}. - * @throws PatternSyntaxException if {@code searchstr} expression's syntax - * is invalid - * @throws IllegalStateException if a {@link Scanner} illegal state - * occurs - * @throws IllegalArgumentException if a {@link Scanner} illegal argument is - * encountered. - */ - public static long search(Reader reader, String searchstr, boolean literal) - throws NullPointerException, PatternSyntaxException, - IllegalStateException, IllegalArgumentException { - if (reader == null || searchstr == null) { - return -1; - } - if (searchstr.length() == 0 && literal) { - return 0; - } - final String s = literal ? Pattern.quote(searchstr) : searchstr; - final Pattern pattern = Pattern.compile(s); - return searchNoChecks(reader, pattern); - } - - /** - * the given {@code reader} for the given {@code pattern}. - * - * @param reader to search - * @param pattern to find - * @return zero-based offset into stream at which {@code searchstr} is - * found; -1 if not found; - * @throws NullPointerException if {@code reader} is null or - * {@code pattern} is null. - * @throws IllegalStateException if a {@link Scanner} illegal state - * occurs - * @throws IllegalArgumentException if a {@link Scanner} illegal argument is - * encountered. - */ - public static long search(Reader reader, Pattern pattern) - throws IllegalStateException, IllegalArgumentException { - if (reader == null || pattern == null) { - return -1; - } - - return searchNoChecks(reader, pattern); - } - - /** - * the given {@code reader} for the given {@code pattern}. - * - * @param reader to search - * @param pattern to find - * @return zero-based offset into stream at which {@code searchstr} is - * found; -1 if not found; - * @throws IllegalStateException if a {@link Scanner} illegal state - * occurs - * @throws IllegalArgumentException if a {@link Scanner} illegal argument is - * encountered. - */ - private static long searchNoChecks(Reader reader, Pattern pattern) - throws IllegalStateException, IllegalArgumentException { - final Scanner scanner = new Scanner(reader); - final String token = scanner.findWithinHorizon(pattern, 0); - final long position = (token == null) - ? -1 - : scanner.match().start(); - return position; - } - - private ScannerSearchAlgorithm() { - assert false : "Pure Utility Class"; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/Set.java b/database/hsqldb/src/org/hsqldb/lib/Set.java deleted file mode 100644 index 4f7433b0..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/Set.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Marker interface for a Collection that is a Set of values. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public interface Set extends Collection {} diff --git a/database/hsqldb/src/org/hsqldb/lib/SimpleLog.java b/database/hsqldb/src/org/hsqldb/lib/SimpleLog.java deleted file mode 100644 index 8dc92638..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/SimpleLog.java +++ /dev/null @@ -1,242 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; - -import org.hsqldb.HsqlDateTime.SystemTimeString; - -/** - * Simple log for recording abnormal events in persistence

    - * Log levels, LOG_NONE, LOG_ERROR, and LOG_NORMAL are currently supported.

    - * LOG_ERROR corresponds to property value 1 and logs main database events plus - * any major errors encountered in operation. - * LOG_NORMAL corresponds to property value 2 and logs additional normal events - * and minor errors. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.8.0 - */ -public class SimpleLog { - - public static final int LOG_NONE = 0; - public static final int LOG_ERROR = 1; - public static final int LOG_WARNING = 2; - public static final int LOG_NORMAL = 3; - public static final int LOG_DETAIL = 4; - public static final int LOG_RESULT = 4; - - // - public static final String logTypeNameEngine = "ENGINE"; - static final String[] appLogTypeNames = { - "", "ERROR ", "WARNING", "NORMAL", "DETAIL" - }; - static final String[] sqlLogTypeNames = { - "", "BASIC ", "NORMAL", "DETAIL", "RESULT" - }; - - // - private PrintWriter writer; - private int level; - private boolean isSystem; - private boolean isSQL; - String[] logTypeNames; - private String filePath; - private StringBuilder sb; - SystemTimeString sysTime = new SystemTimeString(); - - public SimpleLog(String path, int level, boolean isSQL) { - - this.isSystem = path == null; - this.filePath = path; - this.isSQL = isSQL; - logTypeNames = isSQL ? sqlLogTypeNames - : appLogTypeNames; - sb = new StringBuilder(256); - - setLevel(level); - } - - private void setupWriter() { - - if (level == LOG_NONE) { - close(); - - return; - } - - if (writer == null) { - if (isSystem) { - writer = new PrintWriter(System.out); - } else { - File file = new File(filePath); - - setupLog(file); - } - } - } - - private void setupLog(File file) { - - try { - FileUtil.getFileUtil().makeParentDirectories(file); - - writer = new PrintWriter(new FileWriter(file, true), true); - } catch (Exception e) { - isSystem = true; - writer = new PrintWriter(System.out); - } - } - - public int getLevel() { - return level; - } - - public void setLevel(int level) { - - this.level = level; - - setupWriter(); - } - - public PrintWriter getPrintWriter() { - return writer; - } - - public synchronized void logContext(int atLevel, String message) { - - if (level < atLevel) { - return; - } - - if (writer == null) { - return; - } - - sb.append(sysTime.getTimestampString()).append(' '); - - if (!isSQL) { - sb.append(logTypeNames[atLevel]).append(' '); - } - - sb.append(message); - writer.println(sb.toString()); - sb.setLength(0); - writer.flush(); - } - - public synchronized void logContext(int atLevel, String prefix, - String message, String suffix) { - - if (level < atLevel) { - return; - } - - if (writer == null) { - return; - } - - sb.append(sysTime.getTimestampString()).append(' '); - - if (!isSQL) { - sb.append(logTypeNames[atLevel]).append(' '); - } - - sb.append(prefix).append(' '); - sb.append(message).append(' ').append(suffix); - writer.println(sb.toString()); - sb.setLength(0); - writer.flush(); - } - - public synchronized void logContext(Throwable t, String message, - int atLevel) { - - if (level == LOG_NONE) { - return; - } - - if (writer == null) { - return; - } - - sb.append(sysTime.getTimestampString()).append(' '); - - if (!isSQL) { - sb.append(logTypeNames[atLevel]).append(' '); - } - - sb.append(message); - - Throwable temp = new Throwable(); - StackTraceElement[] elements = temp.getStackTrace(); - - if (elements.length > 1) { - sb.append(' '); - sb.append(elements[1].getClassName()).append('.'); - sb.append(elements[1].getMethodName()); - } - - elements = t.getStackTrace(); - - if (elements.length > 0) { - sb.append(' '); - sb.append(elements[0].getClassName()).append('.'); - sb.append(' ').append(elements[0].getMethodName()); - } - - sb.append(' ').append(t.toString()); - writer.println(sb.toString()); - sb.setLength(0); - writer.flush(); - } - - public void flush() { - - if (writer != null) { - writer.flush(); - } - } - - public void close() { - - if (writer != null && !isSystem) { - writer.flush(); - writer.close(); - } - - writer = null; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/StopWatch.java b/database/hsqldb/src/org/hsqldb/lib/StopWatch.java deleted file mode 100644 index 3111a242..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/StopWatch.java +++ /dev/null @@ -1,241 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * Provides the programatic analog of a physical stop watch.

    - * - * The watch can be started, stopped and zeroed and can be queried for - * elapsed running time. The watch accumulates elapsed time over starts - * and stops such that only the time actually spent running is recorded. - * If the watch is zeroed, then the accumulated time is discarded and - * the watch starts again with zero accumulated time.

    - * - * Nanosecond support added by fredt@users - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class StopWatch { - - /** - * The last time this object made the transition - * from stopped to running state, as reported - * by System.nanoTime(). - */ - private long startTime; - private long lastStart; - - /** - * The accumulated running time of this object since - * it was last zeroed. - */ - private long total; - - /** Flags if this object is started or stopped. */ - boolean running = false; - - /** Creates, zeros, and starts a new StopWatch */ - public StopWatch() { - this(true); - } - - /** - * Creates, zeros, and starts a new StopWatch - * - * @param start boolean - */ - public StopWatch(boolean start) { - - if (start) { - start(); - } - } - - /** - * Retrieves the accumulated milliseconds this object has spent running since - * it was last zeroed. - * @return the accumulated milliseconds this object has spent running since - * it was last zeroed. - */ - public long elapsedTime() { - - if (running) { - return (total + System.nanoTime() - startTime) / 1000000; - } else { - return total / 1000000; - } - } - - /** - * Retrieves the accumulated nanoseconds this object has spent running since - * it was last zeroed. - * @return the accumulated nanoseconds this object has spent running since - * it was last zeroed. - */ - public long elapsedNanos() { - - if (running) { - return total + System.nanoTime() - startTime; - } else { - return total; - } - } - - /** - * Retrieves the accumulated milliseconds this object has spent running since - * it was last started. - * @return the accumulated milliseconds this object has spent running since - * it was last started. - */ - public long currentElapsedTime() { - - if (running) { - return (System.nanoTime() - startTime) / 1000000; - } else { - return 0; - } - } - - /** - * Retrieves the accumulated nanoseconds this object has spent running since - * it was last started. - * @return the accumulated nanoseconds this object has spent running since - * it was last started. - */ - public long currentElapsedNanos() { - - if (running) { - return (System.nanoTime() - startTime); - } else { - return 0; - } - } - - /** Zeros accumulated running time and restarts this object. */ - public void zero() { - - total = 0; - - start(); - } - - /** - * Ensures that this object is in the running state. If this object is not - * running, then the call has the effect of setting the startTime - * attribute to the current value of System.nanoTime() and setting - * the running attribute to true. - */ - public void start() { - startTime = System.nanoTime(); - running = true; - } - - /** - * Ensures that this object is in the stopped state. If this object is - * in the running state, then this has the effect of adding to the - * total attribute the elapsed time since the last transition - * from stopped to running state and sets the running attribute - * to false. If this object is not in the running state, this call has no - * effect. - */ - public void stop() { - - if (running) { - total += System.nanoTime() - startTime; - running = false; - } - } - - public void mark() { - stop(); - start(); - } - - /** - * Retrieves prefix + " in " + elapsedTime() + " ms." - * @param prefix The string to use as a prefix - * @return prefix + " in " + elapsedTime() + " ms." - */ - public String elapsedTimeToMessage(String prefix) { - return prefix + " in " + elapsedTime() + " ms."; - } - - /** - * Retrieves prefix + " in " + elapsedNanos() + " ns." - * @param prefix The string to use as a prefix - * @return prefix + " in " + elapsedNanos() + " ns." - */ - public String elapsedNanosToMessage(String prefix) { - return prefix + " in " + elapsedNanos() + " ns."; - } - - /** - * Retrieves prefix + " in " + elapsedTime() + " ms." - * @param prefix The string to use as a prefix - * @return prefix + " in " + elapsedTime() + " ms." - */ - public String currentElapsedTimeToMessage(String prefix) { - return prefix + " in " + currentElapsedTime() + " ms."; - } - - /** - * Retrieves prefix + " in " + elapsedTime() + " ns." - * @param prefix The string to use as a prefix - * @return prefix + " in " + elapsedTime() + " ns." - */ - public String currentElapsedNanosToMessage(String prefix) { - return prefix + " in " + currentElapsedNanos() + " ns."; - } - - /** - * Retrieves the internal state of this object, as a String. - * - * The retrieved value is: - * - *

    -     *    super.toString() +
    -     *    "[running=" +
    -     *    running +
    -     *    ", startTime=" +
    -     *    startTime +
    -     *    ", total=" +
    -     *    total + "]";
    -     * 
    - * @return the state of this object, as a String - */ - public String toString() { - return super.toString() + "[running=" + running + ", startTime=" - + startTime + ", total=" + total + "]"; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/StringComparator.java b/database/hsqldb/src/org/hsqldb/lib/StringComparator.java deleted file mode 100644 index ef048e0a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/StringComparator.java +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.Serializable; -import java.util.Comparator; - -public class StringComparator implements Comparator, Serializable { - - /* - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ - public int compare(String a, String b) { - - // handle nulls - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - return a.compareTo(b); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/StringConverter.java b/database/hsqldb/src/org/hsqldb/lib/StringConverter.java deleted file mode 100644 index 5be98c25..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/StringConverter.java +++ /dev/null @@ -1,995 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UTFDataFormatException; - -import org.hsqldb.map.BitMap; - -/** - * Collection of static methods for converting strings between different - * formats and to and from byte arrays.

    - * - * Includes two methods based on Hypersonic code as indicated. - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.7.2 - */ -public class StringConverter { - - private static final byte[] HEXBYTES = { - (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', - (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', - (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' - }; - - private static int getNibble(int value) { - - if (value >= '0' && value <= '9') { - return value - '0'; - } - - if (value >= 'a' && value <= 'f') { - return 10 + value - 'a'; - } - - if (value >= 'A' && value <= 'F') { - return 10 + value - 'A'; - } - - return -1; - } - - /** - * Converts a hexadecimal string into a byte array - * - * - * @param s hexadecimal string - * - * @return byte array for the hex string - * @throws IOException on error - */ - public static byte[] hexStringToByteArray(String s) throws IOException { - - int l = s.length(); - byte[] data = new byte[l / 2 + (l % 2)]; - int n, - b = 0; - boolean high = true; - int i = 0; - - for (int j = 0; j < l; j++) { - char c = s.charAt(j); - - if (c == ' ') { - continue; - } - - n = getNibble(c); - - if (n == -1) { - throw new IOException( - "hexadecimal string contains non hex character"); //NOI18N - } - - if (high) { - b = (n & 0xf) << 4; - high = false; - } else { - b += (n & 0xf); - high = true; - data[i++] = (byte) b; - } - } - - if (!high) { - throw new IOException( - "hexadecimal string with odd number of characters"); //NOI18N - } - - if (i < data.length) { - data = (byte[]) ArrayUtil.resizeArray(data, i); - } - - return data; - } - - /** - * Compacts a bit string into a BitMap - * @param s bit string - * @return BitMap for the bit string - * @throws IOException on error - */ - public static BitMap sqlBitStringToBitMap(String s) throws IOException { - - int l = s.length(); - int n; - int bitIndex = 0; - BitMap map = new BitMap(0, true); - - for (int j = 0; j < l; j++) { - char c = s.charAt(j); - - if (c == ' ') { - continue; - } - - n = getNibble(c); - - if (n != 0 && n != 1) { - throw new IOException( - "hexadecimal string contains non hex character"); //NOI18N - } - - if (n == 1) { - map.set(bitIndex); - } - - bitIndex++; - } - - map.setSize(bitIndex); - - return map; - } - - /** - * Converts a byte array into a hexadecimal string - * - * - * @param b byte array - * - * @return hex string - */ - public static String byteArrayToHexString(byte[] b) { - - int len = b.length; - char[] s = new char[len * 2]; - - for (int i = 0, j = 0; i < len; i++) { - int c = ((int) b[i]) & 0xff; - - s[j++] = (char) HEXBYTES[c >> 4 & 0xf]; - s[j++] = (char) HEXBYTES[c & 0xf]; - } - - return new String(s); - } - - /** - * Converts a byte array into an SQL hexadecimal string - * - * - * @param b byte array - * - * @return hex string - */ - public static String byteArrayToSQLHexString(byte[] b) { - - int len = b.length; - char[] s = new char[len * 2 + 3]; - - s[0] = 'X'; - s[1] = '\''; - - int j = 2; - - for (int i = 0; i < len; i++) { - int c = ((int) b[i]) & 0xff; - - s[j++] = (char) HEXBYTES[c >> 4 & 0xf]; - s[j++] = (char) HEXBYTES[c & 0xf]; - } - - s[j] = '\''; - - return new String(s); - } - - /** - * Converts a byte array into a bit string - * - * - * @param bytes byte array - * @param bitCount number of bits - * @return hex string - */ - public static String byteArrayToBitString(byte[] bytes, int bitCount) { - - char[] s = new char[bitCount]; - - for (int j = 0; j < bitCount; j++) { - byte b = bytes[j / 8]; - - s[j] = BitMap.isSet(b, j % 8) ? '1' - : '0'; - } - - return new String(s); - } - - /** - * Converts a byte array into an SQL binary string - * - * - * @param bytes byte array - * @param bitCount number of bits - * @return hex string - */ - public static String byteArrayToSQLBitString(byte[] bytes, int bitCount) { - - char[] s = new char[bitCount + 3]; - - s[0] = 'B'; - s[1] = '\''; - - int pos = 2; - - for (int j = 0; j < bitCount; j++) { - byte b = bytes[j / 8]; - - s[pos++] = BitMap.isSet(b, j % 8) ? '1' - : '0'; - } - - s[pos] = '\''; - - return new String(s); - } - - /** - * Converts a byte array into hexadecimal characters which are written as - * ASCII to the given output stream. - * - * @param o output array - * @param from offset into output array - * @param b input array - * @return written count - */ - public static int writeHexBytes(byte[] o, final int from, byte[] b) { - - int len = b.length; - int pos = from; - - for (int i = 0; i < len; i++) { - int c = ((int) b[i]) & 0xff; - - o[pos++] = HEXBYTES[c >> 4 & 0xf]; - o[pos++] = HEXBYTES[c & 0xf]; - } - - return pos - from; - } - - public static String byteArrayToString(byte[] b, String charset) { - - try { - return (charset == null) ? new String(b) - : new String(b, charset); - } catch (Exception e) {} - - return null; - } - - /** - * Hsqldb specific encoding used only for log files. The SQL statements that - * need to be written to the log file (input) are Java Unicode strings. - * input is converted into a 7bit escaped ASCII string (output)with the - * following transformations. All characters outside the 0x20-7f range are - * converted to a escape sequence and added to output. If a backslash - * character is immediately followed by 'u', the backslash character is - * converted to escape sequence and added to output. All the remaining - * characters in input are added to output without conversion. The escape - * sequence is backslash, letter u, xxxx, where xxxx is the hex - * representation of the character code. (fredt@users)

    - * - * Method based on Hypersonic Code - * - * @param b output stream to wite to - * @param s Java string - * @param doubleSingleQuotes boolean - */ - public static void stringToUnicodeBytes(HsqlByteArrayOutputStream b, - String s, boolean doubleSingleQuotes) { - - if (s == null) { - return; - } - - final int len = s.length(); - int extras = 0; - - if (len == 0) { - return; - } - - b.ensureRoom(len * 2 + 5); - - for (int i = 0; i < len; i++) { - char c = s.charAt(i); - - if (c == '\\') { - if ((i < len - 1) && (s.charAt(i + 1) == 'u')) { - b.writeNoCheck(c); // encode the \ as unicode, so 'u' is ignored - b.writeNoCheck('u'); - b.writeNoCheck('0'); - b.writeNoCheck('0'); - b.writeNoCheck('5'); - b.writeNoCheck('c'); - - extras += 5; - } else { - b.write(c); - } - } else if ((c >= 0x0020) && (c <= 0x007f)) { - b.writeNoCheck(c); // this is 99% - - if (c == '\'' && doubleSingleQuotes) { - b.writeNoCheck(c); - - extras++; - } - } else { - b.writeNoCheck('\\'); - b.writeNoCheck('u'); - b.writeNoCheck(HEXBYTES[(c >> 12) & 0xf]); - b.writeNoCheck(HEXBYTES[(c >> 8) & 0xf]); - b.writeNoCheck(HEXBYTES[(c >> 4) & 0xf]); - b.writeNoCheck(HEXBYTES[c & 0xf]); - - extras += 5; - } - - if (extras > len) { - b.ensureRoom(len + extras + 5); - - extras = 0; - } - } - } - -// fredt@users 20020522 - fix for 557510 - backslash bug -// this legacy bug resulted from forward reading the input when a backslash -// was present and manifested itself when a backslash was followed -// immediately by a character outside the 0x20-7f range in a database field. - - /** - * Hsqldb specific decoding used only for log files. This method converts - * the 7 bit escaped ASCII strings in a log file back into Java Unicode - * strings. See stringToUnicodeBytes() above.

    - * - * Method based on Hypersonic Code - * - * @param s encoded ASCII string in byte array - * @return Java string - */ - public static String unicodeStringToString(String s) { - - if (s == null || !s.contains("\\u")) { - return s; - } - - int len = s.length(); - char[] b = new char[len]; - int j = 0; - - for (int i = 0; i < len; i++) { - char c = s.charAt(i); - - if (c == '\\' && i < len - 5) { - char c1 = s.charAt(i + 1); - - if (c1 == 'u') { - i++; - - // 4 characters read should always return 0-15 - int k = getNibble(s.charAt(++i)) << 12; - - k += getNibble(s.charAt(++i)) << 8; - k += getNibble(s.charAt(++i)) << 4; - k += getNibble(s.charAt(++i)); - b[j++] = (char) k; - } else { - b[j++] = c; - } - } else { - b[j++] = c; - } - } - - return new String(b, 0, j); - } - - public static String readUTF(byte[] bytearr, int offset, - int length) throws IOException { - - char[] buf = new char[length]; - - return readUTF(bytearr, offset, length, buf); - } - - public static String readUTF(byte[] bytearr, int offset, int length, - char[] buf) throws IOException { - - int bcount = 0; - int c, char2, char3; - int count = 0; - - while (count < length) { - c = bytearr[offset + count]; - - if (bcount == buf.length) { - buf = (char[]) ArrayUtil.resizeArray(buf, length); - } - - if (c > 0) { - - /* 0xxxxxxx*/ - count++; - - buf[bcount++] = (char) c; - - continue; - } - - c &= 0xff; - - switch (c >> 4) { - - case 12 : - case 13 : - - /* 110x xxxx 10xx xxxx*/ - count += 2; - - if (count > length) { - throw new UTFDataFormatException(); - } - - char2 = bytearr[offset + count - 1]; - - if ((char2 & 0xC0) != 0x80) { - throw new UTFDataFormatException(); - } - - buf[bcount++] = (char) (((c & 0x1F) << 6) - | (char2 & 0x3F)); - break; - - case 14 : - - /* 1110 xxxx 10xx xxxx 10xx xxxx */ - count += 3; - - if (count > length) { - throw new UTFDataFormatException(); - } - - char2 = bytearr[offset + count - 2]; - char3 = bytearr[offset + count - 1]; - - if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) { - throw new UTFDataFormatException(); - } - - buf[bcount++] = (char) (((c & 0x0F) << 12) - | ((char2 & 0x3F) << 6) - | ((char3 & 0x3F))); - break; - - default : - - /* 10xx xxxx, 1111 xxxx */ - throw new UTFDataFormatException(); - } - } - - // The number of chars produced may be less than length - return new String(buf, 0, bcount); - } - - /** - * Writes a string to the specified DataOutput using UTF-8 encoding in a - * machine-independent manner. - *

    - * @param str a string to be written. - * @param out destination to write to - * @return The number of bytes written out. - */ - public static int stringToUTFBytes(String str, - HsqlByteArrayOutputStream out) { - - int strlen = str.length(); - int c, - count = 0; - - if (out.count + strlen + 8 > out.buffer.length) { - out.ensureRoom(strlen + 8); - } - - char[] arr = str.toCharArray(); - - for (int i = 0; i < strlen; i++) { - c = arr[i]; - - if (c >= 0x0001 && c <= 0x007F) { - out.buffer[out.count++] = (byte) c; - - count++; - } else if (c > 0x07FF) { - out.buffer[out.count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); - out.buffer[out.count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); - out.buffer[out.count++] = (byte) (0x80 | ((c) & 0x3F)); - count += 3; - } else { - out.buffer[out.count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); - out.buffer[out.count++] = (byte) (0x80 | ((c) & 0x3F)); - count += 2; - } - - if (out.count + 8 > out.buffer.length) { - out.ensureRoom(strlen - i + 8); - } - } - - return count; - } - - public static int getUTFSize(String s) { - - int len = (s == null) ? 0 - : s.length(); - int l = 0; - - for (int i = 0; i < len; i++) { - int c = s.charAt(i); - - if ((c >= 0x0001) && (c <= 0x007F)) { - l++; - } else if (c > 0x07FF) { - l += 3; - } else { - l += 2; - } - } - - return l; - } - - /** - * Using an output stream, returns a String from an InputStream. - * - * @param is InputStream to read from - * @param encoding character encoding of the string - * @throws IOException on error - * @return a Java string - */ - public static String inputStreamToString(InputStream is, - String encoding) throws IOException { - - HsqlByteArrayOutputStream baOS = new HsqlByteArrayOutputStream(1024); - - while (true) { - int c = is.read(); - - if (c == -1) { - break; - } - - baOS.write(c); - } - - return new String(baOS.getBuffer(), 0, baOS.size(), encoding); - } - -// fredt@users 20020130 - patch 497872 by Nitin Chauhan - use byte[] of exact size - - /** - * Returns the quoted version of the string using the quotechar argument. - * doublequote argument indicates whether each instance of quotechar inside - * the string is doubled.

    - * - * null string argument returns null. If the caller needs the literal - * "NULL" it should created it itself

    - * - * @param s Java string - * @param quoteChar character used for quoting - * @param extraQuote true if quoteChar itself should be repeated - * @return String - */ - public static String toQuotedString(String s, char quoteChar, - boolean extraQuote) { - - if (s == null) { - return null; - } - - int count = extraQuote ? count(s, quoteChar) - : 0; - int len = s.length(); - char[] b = new char[2 + count + len]; - int i = 0; - int j = 0; - - b[j++] = quoteChar; - - for (; i < len; i++) { - char c = s.charAt(i); - - b[j++] = c; - - if (extraQuote && c == quoteChar) { - b[j++] = c; - } - } - - b[j] = quoteChar; - - return new String(b); - } - - /** - * Counts Character c in String s - * - * @param s Java string - * @param c character to count - * @return int count - */ - static int count(final String s, final char c) { - - int pos = 0; - int count = 0; - - if (s != null) { - while ((pos = s.indexOf(c, pos)) > -1) { - count++; - pos++; - } - } - - return count; - } - - /** - * Converts the string to an HTML representation in the ASCII character set - * and appends it to a byte array output stream. - * - * @param b the output byte array output stream - * @param s the input string - */ - public static void stringToHtmlBytes(HsqlByteArrayOutputStream b, - String s) { - - if (s == null) { - return; - } - - final int len = s.length(); - char[] chars; - - if (len == 0) { - return; - } - - chars = s.toCharArray(); - - b.ensureRoom(len); - - for (int i = 0; i < len; i++) { - char c = chars[i]; - - if (c > 0x007f || c == '"' || c == '&' || c == '<' || c == '>') { - int codePoint = Character.codePointAt(chars, i); - - if (Character.charCount(codePoint) == 2) { - i++; - } - - b.ensureRoom(16); - b.writeNoCheck('&'); - b.writeNoCheck('#'); - b.writeBytes(String.valueOf(codePoint)); - b.writeNoCheck(';'); - } else if (c < 0x0020) { - b.writeNoCheck(' '); - } else { - b.writeNoCheck(c); - } - } - } - - /** - * Returns a string representation in UUID form from a binary string. - * - * UUID string is composed of 8-4-4-4-12 hexadecimal characters. - * - * @param b the byte array - * @return UUID string form - */ - public static String toStringUUID(byte[] b) { - - if (b == null) { - return null; - } - - if (b.length != 16) { - throw new NumberFormatException(); - } - - char[] chars = new char[36]; - int hexIndex; - - for (int i = 0, j = 0; i < b.length; ) { - hexIndex = (b[i] & 0xf0) >> 4; - chars[j++] = (char) HEXBYTES[hexIndex]; - hexIndex = b[i] & 0xf; - chars[j++] = (char) HEXBYTES[hexIndex]; - - i++; - - if (i >= 4 && i <= 10 && (i % 2) == 0) { - chars[j++] = '-'; - } - } - - return new String(chars); - } - - public static int writeUUIDHexBytes(byte[] o, final int from, byte[] b) { - - if (b.length != 16) { - throw new NumberFormatException(); - } - - int pos = from; - int hexIndex; - - for (int i = 0; i < b.length; ) { - hexIndex = (b[i] & 0xf0) >> 4; - o[pos++] = HEXBYTES[hexIndex]; - hexIndex = b[i] & 0xf; - o[pos++] = HEXBYTES[hexIndex]; - - i++; - - if (i >= 4 && i <= 10 && (i % 2) == 0) { - o[pos++] = '-'; - } - } - - return pos - from; - } - - /** - * Returns a byte[] representation in UUID form from a UUID string. - * - * @param s the UUID string - * @return byte array - */ - public static byte[] toBinaryUUID(String s) { - - if (s == null) { - return null; - } - - if (s.length() != 36) { - throw new NumberFormatException(); - } - - byte[] bytes = new byte[16]; - - for (int i = 0, j = 0; i < bytes.length; ) { - char c = s.charAt(j++); - int high = getNibble(c); - - c = s.charAt(j++); - bytes[i] = (byte) ((high << 4) + getNibble(c)); - - i++; - - if (i >= 4 && i <= 10 && (i % 2) == 0) { - c = s.charAt(j++); - - if (c != '-') { - throw new NumberFormatException(); - } - } - } - - return bytes; - } - - static void appendHex(StringBuilder b, char c) { - - for (int shift = 12; shift >= 0; shift -= 4) { - int hex = (c >>> shift) & 0xf; - - if (hex < 10) { - b.append((char) ('0' + hex)); - } else { - b.append((char) ('A' + (hex - 10))); - } - } - } - - public static String stringToUnicodeEscaped(String s) { - - StringBuilder b = new StringBuilder(s.length() * 2); - - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - if (c >= ' ' && c < 127 && c != '\\') { - b.append(c); - } else { - b.append('\\'); - appendHex(b, c); - } - } - - return b.toString(); - } - - public static String unicodeEscapedToString(String s) throws IOException { - - StringBuilder b = new StringBuilder(s.length() * 2); - - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - - if (c != '\\') { - b.append(c); - - continue; - } - - i++; - - if (i >= s.length()) { - throw new UTFDataFormatException(); - } - - c = s.charAt(i); - - if (c == '\\') { - b.append(c); - - continue; - } - - if (i > s.length() - 4) { - throw new UTFDataFormatException(); - } - - c = 0; - - for (int shift = 12; shift >= 0; shift -= 4, i++) { - int n = s.charAt(i); - - n = getNibble(n); - - if (n < 0) { - throw new UTFDataFormatException(); - } - - c |= (n << shift); - } - - b.append(c); - - i--; - } - - return b.toString(); - } - - public static void toJSONString(String s, StringBuilder sb) { - - int firstQuote; - int length = s.length(); - - sb.append('"'); - - firstQuote = s.indexOf('"'); - - if (firstQuote == -1) { - if (s.indexOf('\\') == -1) { - sb.append(s); - sb.append('"'); - - return; - } - } - - sb.append(s.substring(0, firstQuote)); - - for (int i = firstQuote; i < length; i++) { - char c = s.charAt(i); - - if (c < 32) { - sb.append('\\'); - appendHex(sb, c); - } else { - if (c == '"' || c == '\\') { - sb.append('\\'); - } - - sb.append(c); - } - } - - sb.append('"'); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/StringInputStream.java b/database/hsqldb/src/org/hsqldb/lib/StringInputStream.java deleted file mode 100644 index de1c3120..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/StringInputStream.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.io.IOException; -import java.io.InputStream; - -/** - * Minimal InputStream subclass to fetch bytes form a String. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.7.0 - */ -public class StringInputStream extends InputStream { - - protected int strOffset = 0; - protected int charOffset = 0; - protected int available; - protected String str; - - public StringInputStream(String s) { - str = s; - available = s.length() * 2; - } - - public int read() throws java.io.IOException { - - if (available == 0) { - return -1; - } - - available--; - - char c = str.charAt(strOffset); - - if (charOffset == 0) { - charOffset = 1; - - return (c & 0x0000ff00) >> 8; - } else { - charOffset = 0; - - strOffset++; - - return c & 0x000000ff; - } - } - - public int available() throws IOException { - return available; - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/StringUtil.java b/database/hsqldb/src/org/hsqldb/lib/StringUtil.java deleted file mode 100644 index f0a0a844..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/StringUtil.java +++ /dev/null @@ -1,419 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.lang.reflect.Array; - -/** Provides a collection of convenience methods for processing and - * creating objects with String value components. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.7.0 - */ -public class StringUtil { - - /** - * If necessary, adds zeros to the beginning of a value so that the total - * length matches the given precision, otherwise trims the right digits. - * Then if maxSize is smaller than precision, trims the right digits to - * maxSize. Negative values are treated as positive - * - * @param value long - * @param precision int - * @param maxSize int - * @return String - */ - public static String toZeroPaddedString(long value, int precision, - int maxSize) { - - StringBuilder sb = new StringBuilder(); - - if (value < 0) { - value = -value; - } - - String s = Long.toString(value); - - if (s.length() > precision) { - s = s.substring(precision); - } - - for (int i = s.length(); i < precision; i++) { - sb.append('0'); - } - - sb.append(s); - - if (maxSize < precision) { - sb.setLength(maxSize); - } - - return sb.toString(); - } - - public static String toPaddedString(String source, int length, char pad, - boolean trailing) { - - int len = source.length(); - - if (len >= length) { - return source; - } - - StringBuilder sb = new StringBuilder(length); - - if (trailing) { - sb.append(source); - } - - for (int i = len; i < length; i++) { - sb.append(pad); - } - - if (!trailing) { - sb.append(source); - } - - return sb.toString(); - } - - public static String toPaddedString(String source, int length, String pad, - boolean trailing) { - - int len = source.length(); - - if (len == length) { - return source; - } - - if (len > length) { - if (trailing) { - return source.substring(0, length); - } else { - return source.substring(len - length, len); - } - } - - StringBuilder sb = new StringBuilder(length); - int padedLength = source.length(); - int partLength = (length - padedLength) % pad.length(); - - if (trailing) { - sb.append(source); - } - - for (; padedLength + pad.length() <= length; - padedLength += pad.length()) { - sb.append(pad); - } - - sb.append(pad.substring(0, partLength)); - - if (!trailing) { - sb.append(source); - } - - return sb.toString(); - } - - /** - * Returns a string with non alphanumeric chars converted to the - * substitute character. A digit first character is also converted. - * By sqlbob@users - * @param source string to convert - * @param substitute character to use - * @return converted string - */ - public static String toLowerSubset(String source, char substitute) { - - int len = source.length(); - StringBuilder sb = new StringBuilder(len); - char ch; - - for (int i = 0; i < len; i++) { - ch = source.charAt(i); - - if (!Character.isLetterOrDigit(ch)) { - sb.append(substitute); - } else if ((i == 0) && Character.isDigit(ch)) { - sb.append(substitute); - } else { - sb.append(Character.toLowerCase(ch)); - } - } - - return sb.toString(); - } - - /** - * Builds a bracketed CSV list from the array - * @param array an array of Objects - * @return string - */ - public static String arrayToString(Object array) { - - int len = Array.getLength(array); - int last = len - 1; - StringBuilder sb = new StringBuilder(2 * (len + 1)); - - sb.append('{'); - - for (int i = 0; i < len; i++) { - sb.append(Array.get(array, i)); - - if (i != last) { - sb.append(','); - } - } - - sb.append('}'); - - return sb.toString(); - } - - /** - * Builds a CSV list from the specified String[], separator string and - * quote string. - * - *

      - *
    • All arguments are assumed to be non-null. - *
    • Separates each list element with the value of the - * separator argument. - *
    • Prepends and appends each element with the value of the - * quote argument. - *
    • No attempt is made to escape the quote character sequence if it is - * found internal to a list element. - *
    - * @return a CSV list - * @param separator the String to use as the list element separator - * @param quote the String with which to quote the list elements - * @param s array of String objects - */ - public static String getList(String[] s, String separator, String quote) { - - int len = s.length; - StringBuilder sb = new StringBuilder(len * 16); - - for (int i = 0; i < len; i++) { - sb.append(quote); - sb.append(s[i]); - sb.append(quote); - - if (i + 1 < len) { - sb.append(separator); - } - } - - return sb.toString(); - } - - /** - * Builds a CSV list from the specified int[], separator - * String and quote String. - * - *
      - *
    • All arguments are assumed to be non-null. - *
    • Separates each list element with the value of the - * separator argument. - *
    • Prepends and appends each element with the value of the - * quote argument. - *
    - * @return a CSV list - * @param s the array of int values - * @param separator the String to use as the separator - * @param quote the String with which to quote the list elements - */ - public static String getList(int[] s, String separator, String quote) { - - int len = s.length; - StringBuilder sb = new StringBuilder(len * 8); - - for (int i = 0; i < len; i++) { - sb.append(quote); - sb.append(s[i]); - sb.append(quote); - - if (i + 1 < len) { - sb.append(separator); - } - } - - return sb.toString(); - } - - public static String getList(long[] s, String separator, String quote) { - - int len = s.length; - StringBuilder sb = new StringBuilder(len * 8); - - for (int i = 0; i < len; i++) { - sb.append(quote); - sb.append(s[i]); - sb.append(quote); - - if (i + 1 < len) { - sb.append(separator); - } - } - - return sb.toString(); - } - - /** - * Builds a CSV list from the specified String[][], separator string and - * quote string. - * - *
      - *
    • All arguments are assumed to be non-null. - *
    • Uses only the first element in each subarray. - *
    • Separates each list element with the value of the - * separator argument. - *
    • Prepends and appends each element with the value of the - * quote argument. - *
    • No attempt is made to escape the quote character sequence if it is - * found internal to a list element. - *
    - * @return a CSV list - * @param separator the String to use as the list element separator - * @param quote the String with which to quote the list elements - * @param s the array of String array objects - */ - public static String getList(String[][] s, String separator, - String quote) { - - int len = s.length; - StringBuilder sb = new StringBuilder(len * 16); - - for (int i = 0; i < len; i++) { - sb.append(quote); - sb.append(s[i][0]); - sb.append(quote); - - if (i + 1 < len) { - sb.append(separator); - } - } - - return sb.toString(); - } - - /** - * Checks if text is empty ({@code characters <= space}) - * @return boolean true if text is null or empty, false otherwise - * @param s java.lang.String - */ - public static boolean isEmpty(String s) { - - int i = s == null ? 0 - : s.length(); - - while (i > 0) { - if (s.charAt(--i) > ' ') { - return false; - } - } - - return true; - } - - /** - * Returns the size of substring that does not contain any trailing spaces - * @param s the string - * @return trimmed size - */ - public static int rightTrimSize(String s) { - - int i = s.length(); - - while (i > 0) { - i--; - - if (s.charAt(i) != ' ') { - return i + 1; - } - } - - return 0; - } - - /** - * Skips any spaces at or after start and returns the index of first - * non-space character; - * @param s the string - * @param start index to start - * @return index of first non-space - */ - public static int skipSpaces(String s, int start) { - - int limit = s.length(); - int i = start; - - for (; i < limit; i++) { - if (s.charAt(i) != ' ') { - break; - } - } - - return i; - } - - /** - * Splits the string into an array, using the separator. If separator is - * not found in the string, the whole string is returned in the array. - * - * @param s the string - * @param separator the separator - * @return array of strings - */ - public static String[] split(String s, String separator) { - - HsqlArrayList list = new HsqlArrayList(); - int currindex = 0; - - for (boolean more = true; more; ) { - int nextindex = s.indexOf(separator, currindex); - - if (nextindex == -1) { - nextindex = s.length(); - more = false; - } - - list.add(s.substring(currindex, nextindex)); - - currindex = nextindex + separator.length(); - } - - return (String[]) list.toArray(new String[list.size()]); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ThreadFactory.java b/database/hsqldb/src/org/hsqldb/lib/ThreadFactory.java deleted file mode 100644 index f7d7db2c..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ThreadFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -/** - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.7.2 - * @since 1.7.2 - */ -public interface ThreadFactory { - Thread newThread(Runnable r); -} diff --git a/database/hsqldb/src/org/hsqldb/lib/ValidatingResourceBundle.java b/database/hsqldb/src/org/hsqldb/lib/ValidatingResourceBundle.java deleted file mode 100644 index aa9e1f63..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/ValidatingResourceBundle.java +++ /dev/null @@ -1,314 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Set; - -/* $Id: ValidatingResourceBundle.java 6511 2022-05-17 14:14:54Z fredt $ */ - -/** - * Purpose of this class is to wrap a RefCapablePropertyResourceBundle to - * reliably detect any possible use of a missing property key as soon as - * this class is clinitted. - * The reason for this is to allow us developers to detect all such errors - * before end-users ever use this class. - * - * See SqltoolRB for an example implementation of this abstract class. - */ -public class ValidatingResourceBundle { - protected boolean validated = false; - protected Class> enumType; - - public static final int THROW_BEHAVIOR = - RefCapablePropertyResourceBundle.THROW_BEHAVIOR; - public static final int EMPTYSTRING_BEHAVIOR = - RefCapablePropertyResourceBundle.EMPTYSTRING_BEHAVIOR; - public static final int NOOP_BEHAVIOR = - RefCapablePropertyResourceBundle.NOOP_BEHAVIOR; - /* Three constants above are only so caller doesn't need to know - * details of RefCapablePropertyResourceBundle (and they won't need - * to code that God-awfully-long class name). */ - - protected RefCapablePropertyResourceBundle wrappedRCPRB; - - public static String resourceKeyFor(Enum enumKey) { - return enumKey.name().replace('_', '.'); - } - - public ValidatingResourceBundle( - String baseName, Class> enumType) { - this.enumType = enumType; - try { - wrappedRCPRB = RefCapablePropertyResourceBundle.getBundle(baseName, - enumType.getClassLoader(), enumType); - validate(); - } catch (RuntimeException re) { - System.err.println("Failed to initialize resource bundle: " + re); - // Make extra sure that the source of this fatal startup condition - // is not hidden. - throw re; - } - } - - // The following methods are a passthru wrappers for the wrapped RCPRB. - - /** - * - * @see RefCapablePropertyResourceBundle#getString(String) - * @param key Enum - * @return String - */ - public String getString(Enum key) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return wrappedRCPRB.getString(key.toString()); - } - - /** - * - * @see RefCapablePropertyResourceBundle#getString(String, String[], int) - * @param key Enum - * @param strings String[] - * @return String - */ - public String getString(Enum key, String... strings) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return wrappedRCPRB.getString( - key.toString(), strings, missingPosValueBehavior); - } - - /** - * - * @see RefCapablePropertyResourceBundle#getExpandedString(String, int) - * @param key Enum - * @return String - */ - public String getExpandedString(Enum key) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return wrappedRCPRB.getExpandedString(key.toString(), missingPropertyBehavior); - } - - /** - * - * @see RefCapablePropertyResourceBundle#getExpandedString(String, - * String[], int, int) - * @param key Enum - * @param strings String[] - * @return String - */ - public String getExpandedString(Enum key, String... strings) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return wrappedRCPRB.getExpandedString(key.toString(), strings, - missingPropertyBehavior, missingPosValueBehavior); - } - - private int missingPropertyBehavior = THROW_BEHAVIOR; - private int missingPosValueBehavior = THROW_BEHAVIOR; - - /** - * Set behavior for get*String*() method when a referred-to System Property - * is not set. Set to one of - *
      - *
    • RefCapablePropertyResourceBundle.THROW_BEHAVIOR - *
    • RefCapablePropertyResourceBundle.EMPTYSTRING_BEHAVIOR - *
    • RefCapablePropertyResourceBundle.NOOP_BEHAVIOR - *
    - * The first value is the default. - * - * @param missingPropertyBehavior int - */ - public void setMissingPropertyBehavior(int missingPropertyBehavior) { - this.missingPropertyBehavior = missingPropertyBehavior; - } - - /** - * Set behavior for get*String(String, String[]) method when a positional - * index (like %{4}) is used but no subs value was given for that index. Set - * to one of - *
      - *
    • RefCapablePropertyResourceBundle.THROW_BEHAVIOR - *
    • RefCapablePropertyResourceBundle.EMPTYSTRING_BEHAVIOR - *
    • RefCapablePropertyResourceBundle.NOOP_BEHAVIOR - *
    - * The first value is the default. - * - * @param missingPosValueBehavior int - */ - public void setMissingPosValueBehavior(int missingPosValueBehavior) { - this.missingPosValueBehavior = missingPosValueBehavior; - } - - public int getMissingPropertyBehavior() { - return missingPropertyBehavior; - } - public int getMissingPosValueBehavior() { - return missingPosValueBehavior; - } - - public void validate() { - String val; - if (validated) return; - validated = true; - Set resKeysFromEls = new HashSet(); - for (Enum e : enumType.getEnumConstants()) - resKeysFromEls.add(e.toString()); - Enumeration allKeys = wrappedRCPRB.getKeys(); - while (allKeys.hasMoreElements()) { - // We can't test positional parameters, but we can verify that - // referenced files exist by reading the values. - // Pretty inefficient, but this can be optimized when I have time. - val = allKeys.nextElement(); - wrappedRCPRB.getString(val); // because it throws if missing? - // Keep no reference to the returned String - resKeysFromEls.remove(val); - } - if (resKeysFromEls.size() > 0) - throw new RuntimeException( - "Resource Bundle pre-validation failed. " - + "Missing property with key: " + resKeysFromEls); - } - - /* Convenience wrappers follow for getString(int, String[]) for up to - * 3 int and/or String positionals or any number of just String positions - */ - public String getString(Enum key, int i1) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] {Integer.toString(i1)}); - } - public String getString(Enum key, int i1, int i2) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - Integer.toString(i1), Integer.toString(i2) - }); - } - public String getString(Enum key, int i1, int i2, int i3) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - Integer.toString(i1), Integer.toString(i2), Integer.toString(i3) - }); - } - public String getString(Enum key, int i1, String s2) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - Integer.toString(i1), s2 - }); - } - public String getString(Enum key, String s1, int i2) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - s1, Integer.toString(i2) - }); - } - - public String getString(Enum key, int i1, int i2, String s3) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - Integer.toString(i1), Integer.toString(i2), s3 - }); - } - public String getString(Enum key, int i1, String s2, int i3) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - Integer.toString(i1), s2, Integer.toString(i3) - }); - } - public String getString(Enum key, String s1, int i2, int i3) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - s1, Integer.toString(i2), Integer.toString(i3) - }); - } - public String getString(Enum key, int i1, String s2, String s3) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - Integer.toString(i1), s2, s3 - }); - } - public String getString(Enum key, String s1, String s2, int i3) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - s1, s2, Integer.toString(i3) - }); - } - public String getString(Enum key, String s1, int i2, String s3) { - if (!enumType.isInstance(key)) - throw new IllegalArgumentException( - "Key is a " + key.getClass().getName() + ",not a " - + enumType.getName() + ": " + key); - return getString(key, new String[] { - s1, Integer.toString(i2), s3 - }); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/WrapperIterator.java b/database/hsqldb/src/org/hsqldb/lib/WrapperIterator.java deleted file mode 100644 index 0893e926..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/WrapperIterator.java +++ /dev/null @@ -1,214 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib; - -import java.util.NoSuchElementException; - -/** - * An Iterator that returns the elements of a specified array, or other - * iterators etc. The collection of objects returned depends on the - * constructor used.

    - * - * Based on similar Enumerator code by campbell-burnet@users - * - * @author fred@users - * @version 2.6.0 - * @since HSQLDB 1.7.2 - */ -public class WrapperIterator implements Iterator { - - private static final Object[] emptyelements = new Object[0]; - private Object[] elements; - private int i; - - // chained iterators - private boolean chained; - private Iterator it1; - private Iterator it2; - - /** return only not null elements */ - private boolean notNull; - - /** - * Constructor for an empty iterator. - */ - public WrapperIterator() { - this.elements = emptyelements; - } - - /** - * Constructor for all elements of the specified array. - * - * @param elements the array of objects to enumerate - */ - public WrapperIterator(Object[] elements) { - this.elements = elements; - } - - /** - * Constructor for not-null elements of specified array. - * - * @param elements the array of objects to iterate - * @param notNull boolean - */ - public WrapperIterator(Object[] elements, boolean notNull) { - this.elements = elements; - this.notNull = notNull; - } - - /** - * Constructor for a singleton object iterator - * - * @param element the single object to iterate - */ - public WrapperIterator(Object element) { - this.elements = new Object[]{ element }; - } - - /** - * Constructor for a chained iterator that returns the elements of the two - * specified iterators. - * - * @param it1 Iterator - * @param it2 Iterator - */ - public WrapperIterator(Iterator it1, Iterator it2) { - - this.it1 = it1; - this.it2 = it2; - chained = true; - } - - /** - * Tests if this iterator contains more elements.

    - * - * @return true if this iterator contains more elements; - * false otherwise. - */ - public boolean hasNext() { - - // for chained iterators - if (chained) { - if (it1 == null) { - if (it2 == null) { - return false; - } - - if (it2.hasNext()) { - return true; - } - - it2 = null; - - return false; - } else { - if (it1.hasNext()) { - return true; - } - - it1 = null; - - return hasNext(); - } - } - - // for other iterators - if (elements == null) { - return false; - } - - for (; notNull && i < elements.length && elements[i] == null; i++) {} - - if (i < elements.length) { - return true; - } else { - - // release elements for garbage collection - elements = null; - - return false; - } - } - - /** - * Returns the next element. - * - * @return the next element - * @throws NoSuchElementException if there is no next element - */ - public E next() { - - // for chained iterators - if (chained) { - if (it1 == null) { - if (it2 == null) { - throw new NoSuchElementException(); - } - - if (it2.hasNext()) { - return it2.next(); - } - - it2 = null; - - return next(); - } else { - if (it1.hasNext()) { - return it1.next(); - } - - it1 = null; - - return next(); - } - } - - // for other iterators - if (hasNext()) { - return (E) elements[i++]; - } - - throw new NoSuchElementException(); - } - - public int nextInt() { - throw new NoSuchElementException(); - } - - public long nextLong() { - throw new NoSuchElementException(); - } - - public void remove() { - throw new NoSuchElementException(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/java/JavaSystem.java b/database/hsqldb/src/org/hsqldb/lib/java/JavaSystem.java deleted file mode 100644 index 4fec28f5..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/java/JavaSystem.java +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.java; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.MappedByteBuffer; -import java.nio.charset.Charset; - -/** - * Handles invariants, runtime and methods - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.1 - */ -public final class JavaSystem { - - public static final Charset CS_ISO_8859_1 = Charset.forName("ISO-8859-1"); - public static final Charset CS_US_ASCII = Charset.forName("US-ASCII"); - public static final Charset CS_UTF8 = Charset.forName("UTF-8"); - private static int javaVersion; - - static { - try { - String version = System.getProperty("java.specification.version", - "6"); - - if (version.startsWith("1.")) { - version = version.substring(2); - } else if (version.startsWith("0.")) { - version = "6"; - } - - javaVersion = Integer.parseInt(version); - } catch (Throwable t) { - - // unknow future version - default to last widely used - javaVersion = 11; - } - } - - public static int javaVersion() { - return javaVersion; - } - - // Memory - public static long availableMemory() { - return Runtime.getRuntime().freeMemory(); - } - - public static long usedMemory() { - return Runtime.getRuntime().totalMemory() - - Runtime.getRuntime().freeMemory(); - } - - public static Throwable unmap(MappedByteBuffer buffer) { - - if (buffer == null) { - return null; - } - - if (javaVersion > 8) { - try { - Class unsafeClass = Class.forName("sun.misc.Unsafe"); - Field unsafeField = unsafeClass.getDeclaredField("theUnsafe"); - - unsafeField.setAccessible(true); - - Object unsafe = unsafeField.get(null); - Method invokeCleaner = unsafeClass.getMethod("invokeCleaner", - java.nio.ByteBuffer.class); - - invokeCleaner.invoke(unsafe, buffer); - - return null; - } catch (NoSuchMethodException e) {} - catch (NoSuchFieldException e) {} - catch (IllegalAccessException e) {} - catch (ClassNotFoundException e) {} - catch (InvocationTargetException e) { - return e; - } catch (Throwable t) { - return t; - } - - // on any reflection error we assume that we made a mistake guessing the java version - // and try the old code instead - } - - try { - Method cleanerMethod = buffer.getClass().getMethod("cleaner"); - - cleanerMethod.setAccessible(true); - - Object cleaner = cleanerMethod.invoke(buffer); - Method cleanMethod = cleaner.getClass().getMethod("clean"); - - cleanMethod.invoke(cleaner); - return null; - } catch (NoSuchMethodException e) {} - catch (IllegalAccessException e) {} - catch (InvocationTargetException e) { - - // means we're not dealing with a Sun JVM? - return e; - } catch (Throwable t) { - return t; - } - - // try another fallback on any reflection error - // this is specific to older Android version 4 or older and works for java.nio.DirectByteBuffer and java.nio.MappedByteBufferAdapter - try { - Method freeMethod = buffer.getClass().getMethod("free"); - - freeMethod.setAccessible(true); - - freeMethod.invoke(buffer); - return null; - } catch (Throwable t) { - return t; - } - } - - public static IOException toIOException(Throwable t) { - - if (t instanceof IOException) { - return (IOException) t; - } - - return new IOException(t); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/java/package-info.java b/database/hsqldb/src/org/hsqldb/lib/java/package-info.java deleted file mode 100644 index 062253d7..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/java/package-info.java +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains a single static class which handles invariants, runtime and - * methods in different JDK versions - */ -package org.hsqldb.lib.java; diff --git a/database/hsqldb/src/org/hsqldb/lib/package-info.java b/database/hsqldb/src/org/hsqldb/lib/package-info.java deleted file mode 100644 index 76f7dadd..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/package-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains shared classes used by other HyperSQL classes. - */ -package org.hsqldb.lib; diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/DbBackup.java b/database/hsqldb/src/org/hsqldb/lib/tar/DbBackup.java deleted file mode 100644 index e5c350ec..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/DbBackup.java +++ /dev/null @@ -1,468 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Properties; - -import org.hsqldb.lib.InputStreamInterface; -import org.hsqldb.lib.InputStreamWrapper; - -/** - * Works with tar archives containing HyperSQL database instance backups. - * Viz, creating, examining, or extracting these archives. - *

    - * This class provides OO Tar backup-creation control. - * The extraction and listing features are implemented only in static fashion - * in the Main method, which provides a consistent interface for all three - * features from the command-line. - *

    - * For tar creation, the default behavior is to fail if the target archive - * exists, and to abort if any database change is detected. - * Use the JavaBean setters to changes this behavior. - * See the main(String[]) method for details about command-line usage. - *

    - * - * @see - * The database backup section of the HyperSQL User Guide - * @see DbBackupMain#main(String[]) - * @see #setOverWrite(boolean) - * @see #setAbortUponModify(boolean) - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 2.0.0 - */ -public class DbBackup { - - protected File dbDir; - protected File archiveFile; - protected String instanceName; - protected boolean overWrite = false; // Defaults no NO OVERWRITE - protected boolean abortUponModify = true; // Defaults to ABORT-UPON-MODIFY - File[] componentFiles; - InputStreamInterface[] componentStreams; - boolean[] existList; - boolean[] ignoreList; - - /** - * Instantiate a DbBackup instance for creating a Database Instance backup.

    - * - * Much validation is deferred until the write() method, to prevent problems - * with files changing between the constructor and the write call. - * - * @param archiveFile File - * @param dbPath String - */ - public DbBackup(File archiveFile, String dbPath) { - - this.archiveFile = archiveFile; - - File dbPathFile = new File(dbPath); - - dbDir = dbPathFile.getAbsoluteFile().getParentFile(); - instanceName = dbPathFile.getName(); - componentFiles = new File[] { - new File(dbDir, instanceName + ".properties"), - new File(dbDir, instanceName + ".script"), - new File(dbDir, instanceName + ".data"), - new File(dbDir, instanceName + ".backup"), - new File(dbDir, instanceName + ".log"), - new File(dbDir, instanceName + ".lobs") - }; - componentStreams = new InputStreamInterface[componentFiles.length]; - existList = new boolean[componentFiles.length]; - ignoreList = new boolean[componentFiles.length]; - } - - /** - * Used for SCRIPT backup - * - * @param archiveFile File - * @param dbPath String - * @param script boolean - */ - public DbBackup(File archiveFile, String dbPath, boolean script) { - - this.archiveFile = archiveFile; - - File dbPathFile = new File(dbPath); - - dbDir = dbPathFile.getAbsoluteFile().getParentFile(); - instanceName = dbPathFile.getName(); - componentFiles = new File[]{ - new File(dbDir, instanceName + ".script"), }; - componentStreams = new InputStreamInterface[componentFiles.length]; - existList = new boolean[componentFiles.length]; - ignoreList = new boolean[componentFiles.length]; - abortUponModify = false; - } - - /** - * Overrides file with stream. - * - * @param fileExtension String - * @param is InputStreamInterface - */ - public void setStream(String fileExtension, InputStreamInterface is) { - - for (int i = 0; i < componentFiles.length; i++) { - if (componentFiles[i].getName().endsWith(fileExtension)) { - componentStreams[i] = is; - - break; - } - } - } - - public void setFileIgnore(String fileExtension) { - - for (int i = 0; i < componentFiles.length; i++) { - if (componentFiles[i].getName().endsWith(fileExtension)) { - ignoreList[i] = true; - - break; - } - } - } - - /** - * Defaults to false.

    - * - * If arg is false, then attempts to write a tar file that already exist - * will abort. - * - * @param overWrite boolean - */ - public void setOverWrite(boolean overWrite) { - this.overWrite = overWrite; - } - - /** - * Defaults to true.

    - * - * If true, then the write() method will validate that the database is - * closed, and it will verify that no DB file changes between when we - * start writing the tar, and when we finish. - * - * @param abortUponModify boolean - */ - public void setAbortUponModify(boolean abortUponModify) { - this.abortUponModify = abortUponModify; - } - - public boolean getOverWrite() { - return overWrite; - } - - public boolean getAbortUponModify() { - return abortUponModify; - } - - /** - * This method always backs up the .properties and .script files. It will - * back up all of .backup, .data, and .log which exist.

    - * - * If abortUponModify is set, no tar file will be created, and this - * method will throw. - * - * @throws IOException for any of many possible I/O problems - * @throws TarMalformatException if there is a problem writin the tar file - */ - public void write() throws IOException, TarMalformatException { - - long startTime = new java.util.Date().getTime(); - - checkEssentialFiles(); - - TarGenerator generator = new TarGenerator(archiveFile, overWrite, - Integer.valueOf(DbBackup.generateBufferBlockValue(componentFiles))); - - for (int i = 0; i < componentFiles.length; i++) { - boolean exists = componentStreams[i] != null - || componentFiles[i].exists(); - - if (!exists) { - continue; - - // We've already verified that required files exist, therefore - // there is no error condition here. - } - - if (ignoreList[i]) { - continue; - } - - if (componentStreams[i] == null) { - generator.queueEntry(componentFiles[i].getName(), - componentFiles[i]); - - existList[i] = true; - } else { - generator.queueEntry(componentFiles[i].getName(), - componentStreams[i]); - } - } - - generator.write(); - checkFilesNotChanged(startTime); - } - - public void writeAsFiles() throws IOException { - - int bufferSize = 512 - * DbBackup.generateBufferBlockValue(componentFiles); - byte[] writeBuffer = new byte[bufferSize]; - - checkEssentialFiles(); - FileOutputStream fileOut = null; - - for (int i = 0; i < componentFiles.length; i++) try { - if (ignoreList[i]) { - continue; - } - - if (!componentFiles[i].exists()) { - continue; - } - - File outFile = new File(archiveFile, componentFiles[i].getName()); - fileOut = new FileOutputStream(outFile); - - if (componentStreams[i] == null) { - componentStreams[i] = new InputStreamWrapper( - new FileInputStream(componentFiles[i])); - } - - InputStreamInterface instream = componentStreams[i]; - - while (true) { - int count = instream.read(writeBuffer, 0, writeBuffer.length); - - if (count <= 0) { - break; - } - - fileOut.write(writeBuffer, 0, count); - } - - instream.close(); - fileOut.flush(); - fileOut.getFD().sync(); - } finally { - if (fileOut != null) { - fileOut.close(); - fileOut = null; - } - } - } - - void checkEssentialFiles() - throws FileNotFoundException, IllegalStateException { - - if (!componentFiles[0].getName().endsWith(".properties")) { - return; - } - - for (int i = 0; i < 2; i++) { - boolean exists = componentStreams[i] != null - || componentFiles[i].exists(); - - if (!exists) { - - // First 2 files are REQUIRED - throw new FileNotFoundException( - RB.file_missing.getString( - componentFiles[i].getAbsolutePath())); - } - } - - if (!abortUponModify) { - return; - } - - Properties p = new Properties(); - FileInputStream fis = null; - - try { - File propertiesFile = componentFiles[0]; - - fis = new FileInputStream(propertiesFile); - - p.load(fis); - } catch (IOException io) {} - finally { - try { - if (fis != null) { - fis.close(); - } - } catch (IOException io) {} - finally { - fis = null; // Encourage buffer GC - } - } - - String modifiedString = p.getProperty("modified"); - - if (modifiedString != null - && (modifiedString.equalsIgnoreCase("yes") - || modifiedString.equalsIgnoreCase("true"))) { - throw new IllegalStateException( - RB.modified_property.getString(modifiedString)); - } - } - - void checkFilesNotChanged(long startTime) throws FileNotFoundException { - - // abortUponModify is used with offline invocation only - if (!abortUponModify) { - return; - } - - try { - for (int i = 0; i < componentFiles.length; i++) { - if (componentFiles[i].exists()) { - if (!existList[i]) { - throw new FileNotFoundException( - RB.file_disappeared.getString( - componentFiles[i].getAbsolutePath())); - } - - if (componentFiles[i].lastModified() > startTime) { - throw new FileNotFoundException( - RB.file_changed.getString( - componentFiles[i].getAbsolutePath())); - } - } else if (existList[i]) { - throw new FileNotFoundException( - RB.file_appeared.getString( - componentFiles[i].getAbsolutePath())); - } - } - } catch (IllegalStateException ise) { - if (!archiveFile.delete()) { - System.out.println( - RB.cleanup_rmfail.getString( - archiveFile.getAbsolutePath())); - - // Be-it-known. This method can write to stderr if - // abortUponModify is true. - } - - throw ise; - } - } - - /* - * @todo - Supply a version of my MemTest program which people can run - * one time when the server can be starved of RAM, and save the available - * RAM quantity to a text file. We can then really crank up the buffer - * size to make transfers really efficient. - */ - - /** - * Return a 512-block buffer size suggestion, based on the size of what - * needs to be read or written, and default and typical JVM constraints. - *

    - * Algorithm details: - *

    - * Minimum system I want support is a J2SE system with 256M physical - * RAM. This system can hold a 61 MB byte array (real 1024^2 M). - * (61MB with Java 1.6, 62MB with Java 1.4). - * This decreases to just 60 MB with (pre-production, non-optimized) - * HSQLDB v. 1.9 on Java 1.6. - * Allow the user 40 MB of for data (this only corresponds to a much - * smaller quantity of real data due to the huge overhead of Java and - * database structures). - * This allows 20 MB for us to use. User can easily use more than this - * by raising JVM settings and/or getting more PRAM or VRAM. - * Therefore, ceiling = 20MB = 20 MB / .5 Kb = 40 k blocks - *

    - * We make the conservative simplification that each data file contains - * just one huge data entry component. This is a good estimation, since in - * most cases, the contents of the single largest file will be many orders - * of magnitude larger than the other files and the single block entry - * headers. - *

    - * We aim for reading or writing these biggest file with 10 reads/writes. - * In the case of READING Gzip files, there will actually be many more - * reads than this, but that's the price you pay for smaller file size. - * - * @param files Null array elements are permitted. They will just be - * skipped by the algorithm. - * @return block value - */ - static protected int generateBufferBlockValue(File[] files) { - - long maxFileSize = 0; - - for (int i = 0; i < files.length; i++) { - if (files[i] == null) { - continue; - } - - if (files[i].length() > maxFileSize) { - maxFileSize = files[i].length(); - } - } - - int idealBlocks = (int) (maxFileSize / (10L * 512L)); - - // I.e., 1/10 of the file, in units of 512 byte blocks. - // It's fine that operations will truncate down instead of round. - if (idealBlocks < 1) { - return 1; - } - - if (idealBlocks > 40 * 1024) { - return 40 * 1024; - } - - return idealBlocks; - } - - /** - * Convenience wrapper for generateBufferBlockValue(File[]). - * - * @see #generateBufferBlockValue(File[]) - * @param file File - * @return int - */ - static protected int generateBufferBlockValue(File file) { - return generateBufferBlockValue(new File[]{ file }); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/DbBackupMain.java b/database/hsqldb/src/org/hsqldb/lib/tar/DbBackupMain.java deleted file mode 100644 index 855c8d17..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/DbBackupMain.java +++ /dev/null @@ -1,154 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.File; -import java.io.IOException; - -/** - * This class is used for offline backup of HyperSQL databases.

    - * - * See - * the database offline backup section of the HyperSQL User Guide

    - * - * Contains only the main method. - */ -public class DbBackupMain { - - /** - * Command line invocation to create, examine, or extract HSQLDB database - * backup tar archives. - *

    - * This class stores tar entries as relative files without specifying - * parent directories, in what is commonly referred to as tar bomb - * format. - * The set of files is small, with known extensions, and the potential - * inconvenience of messing up the user's current directory is more than - * compensated by making it easier for the user to restore to a new - * database URL location at a peer level to the original. - *

    - * Automatically calculates buffer sizes based on the largest component - * file (for "save" mode) or tar file size (for other modes). - *

    - * Run

    
    -     *     java -cp path/to/hsqldb.jar org.hsqldb.lib.tar.DbBackupMain
    -     * 
    for syntax help. - * - * @param sa The arguments - * @throws IOException on read-write error - * @throws TarMalformatException on tar file problems - * - */ - public static void main(String[] sa) - throws IOException, TarMalformatException { - - try { - if (sa.length < 1) { - System.out.println( - RB.DbBackup_syntax.getString(DbBackup.class.getName())); - System.out.println(); - System.out.println(RB.listing_format.getString()); - System.exit(0); - } - - if (sa[0].equals("--save")) { - boolean overWrite = sa.length > 1 - && sa[1].equals("--overwrite"); - - if (sa.length != (overWrite ? 4 - : 3)) { - throw new IllegalArgumentException(); - } - - DbBackup backup = new DbBackup(new File(sa[sa.length - 2]), - sa[sa.length - 1]); - - backup.setOverWrite(overWrite); - backup.write(); - } else if (sa[0].equals("--list")) { - if (sa.length < 2) { - throw new IllegalArgumentException(); - } - - String[] patternStrings = null; - - if (sa.length > 2) { - patternStrings = new String[sa.length - 2]; - - for (int i = 2; i < sa.length; i++) { - patternStrings[i - 2] = sa[i]; - } - } - - new TarReader(new File(sa[1]), TarReader - .LIST_MODE, patternStrings, Integer.valueOf(DbBackup - .generateBufferBlockValue(new File(sa[1]))), null) - .read(); - } else if (sa[0].equals("--extract")) { - boolean overWrite = sa.length > 1 - && sa[1].equals("--overwrite"); - int firstPatInd = overWrite ? 4 - : 3; - - if (sa.length < firstPatInd) { - throw new IllegalArgumentException(); - } - - String[] patternStrings = null; - - if (sa.length > firstPatInd) { - patternStrings = new String[sa.length - firstPatInd]; - - for (int i = firstPatInd; i < sa.length; i++) { - patternStrings[i - firstPatInd] = sa[i]; - } - } - - File tarFile = new File(sa[overWrite ? 2 - : 1]); - int tarReaderMode = overWrite ? TarReader.OVERWRITE_MODE - : TarReader.EXTRACT_MODE; - - new TarReader( - tarFile, tarReaderMode, patternStrings, - Integer.valueOf(DbBackup.generateBufferBlockValue(tarFile)), - new File(sa[firstPatInd - 1])).read(); - } else { - throw new IllegalArgumentException(); - } - } catch (IllegalArgumentException iae) { - System.out.println( - RB.DbBackup_syntaxerr.getString(DbBackup.class.getName())); - System.exit(2); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/PIFData.java b/database/hsqldb/src/org/hsqldb/lib/tar/PIFData.java deleted file mode 100644 index d67916f9..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/PIFData.java +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Pax Interchange Format object constituted from an Input Stream. - *

    - * Right now, the only Pax property that we support directly is "size". - * - */ -public class PIFData extends HashMap { - static final long serialVersionUID = 3086795680582315773L; - - private static Pattern pifRecordPattern = - Pattern.compile("\\d+ +([^=]+)=(.*)"); - - /** - * N.b. this is nothing to do with HashMap.size() or Map.size(). - * This returns the value of the Pax "size" property. - * @return Pax size - */ - public Long getSize() { - return sizeObject; - } - - private Long sizeObject = null; - - public PIFData(InputStream stream) - throws TarMalformatException, IOException { - - BufferedReader br = null; - try { - br = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8"))); - String s, k, v; - Matcher m; - int lineNum = 0; - - /* - * Pax spec does not allow for blank lines, ignored white space, - * nor comments of any type, in the file. - */ - while ((s = br.readLine()) != null) { - lineNum++; - - m = pifRecordPattern.matcher(s); - - if (!m.matches()) { - throw new TarMalformatException( - RB.pif_malformat.getString(lineNum, s)); - } - - k = m.group(1); - v = m.group(2); - - if (v == null || v.length() < 1) { - remove(k); - } else { - put(k, v); - } - } - } finally { - try { - stream.close(); - } finally { - br = null; // Encourage buffer GC - } - } - - String sizeString = get("size"); - - if (sizeString != null) { - try { - sizeObject = Long.valueOf(sizeString); - } catch (NumberFormatException nfe) { - throw new TarMalformatException( - RB.pif_malformat_size.getString(sizeString)); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/PIFGenerator.java b/database/hsqldb/src/org/hsqldb/lib/tar/PIFGenerator.java deleted file mode 100644 index 7d791287..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/PIFGenerator.java +++ /dev/null @@ -1,192 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.nio.charset.Charset; -import java.util.Date; - -/** - * Encapsulates Pax Interchange Format key-value pairs. - */ -public class PIFGenerator extends ByteArrayOutputStream { - - OutputStreamWriter writer; - String name; - int fakePid; // Only used by constructors - - //char typeFlag; Serves no purpose. What was orig. purpose? - public String getName() { - return name; - } - - protected PIFGenerator() { - - writer = new OutputStreamWriter(this, Charset.forName("UTF-8")); - - fakePid = (int) (new Date().getTime() % 100000L); - - // Java doesn't have access to PIDs, as PIF wants in the "name" field, - // so we emulate one in a way that is easy for us. - } - - /** - * Construct a PIFGenerator object for a 'g' record. - * - * @param sequenceNum Index starts at 1 in each Tar file - */ - public PIFGenerator(int sequenceNum) { - - this(); - - if (sequenceNum < 1) { - - // No need to localize. Would be caught at dev-time. - throw new IllegalArgumentException("Sequence numbers start at 1"); - } - - //typeFlag = 'g'; - name = System.getProperty("java.io.tmpdir") + "/GlobalHead." + fakePid - + '.' + sequenceNum; - } - - /** - * Construct a PIFGenerator object for a 'x' record. - * - * @param file Target file of the x record. - */ - public PIFGenerator(File file) { - - this(); - - //typeFlag = 'x'; - String parentPath = (file.getParentFile() == null) ? "." - : file.getParentFile() - .getPath(); - - name = parentPath + "/PaxHeaders." + fakePid + '/' + file.getName(); - } - - /** - * Convenience wrapper for addRecord(String, String). N.b. this writes - * values exactly as either "true" or "false". - * - * @see #addRecord(String, String) - * @see Boolean#toString(boolean) - * @param key String - * @param b boolean value - * @throws TarMalformatException if there is a problem writing the tar file - * @throws IOException if there is an IO problem - */ - public void addRecord(String key, - boolean b) - throws TarMalformatException, IOException { - addRecord(key, Boolean.toString(b)); - } - - /** - * Convenience wrapper for addRecord(String, String). - * - * @see #addRecord(String, String) - * @param key String - * @param i int value - * @throws TarMalformatException if there is a problem writing the tar file - * @throws IOException IOException if there is an IO problem - */ - public void addRecord(String key, - int i) throws TarMalformatException, IOException { - addRecord(key, Integer.toString(i)); - } - - /** - * Convenience wrapper for addRecord(String, String). - * - * @see #addRecord(String, String) - * @param key String - * @param l long value - * @throws TarMalformatException if there is a problem writing the tar file - * @throws IOException if there is an IO problem - */ - public void addRecord(String key, - long l) throws TarMalformatException, IOException { - addRecord(key, Long.toString(l)); - } - - /** - * I guess the "initial length" field is supposed to be in units of - * characters, not bytes? - * - * @param key String - * @param value String - * @throws TarMalformatException if there is a problem writing the tar file - * @throws IOException if there is an IO problem - */ - public void addRecord(String key, - String value) - throws TarMalformatException, IOException { - - if (key == null || value == null || key.length() < 1 - || value.length() < 1) { - throw new TarMalformatException(RB.zero_write.getString()); - } - - int lenWithoutIlen = key.length() + value.length() + 3; - - // "Ilen" means Initial Length field. +3 = SPACE + = + \n - int lenW = 0; // lenW = Length With initial-length-field - - if (lenWithoutIlen < 8) { - lenW = lenWithoutIlen + 1; // Takes just 1 char to report total - } else if (lenWithoutIlen < 97) { - lenW = lenWithoutIlen + 2; // Takes 2 chars to report this total - } else if (lenWithoutIlen < 996) { - lenW = lenWithoutIlen + 3; // Takes 3... - } else if (lenWithoutIlen < 9995) { - lenW = lenWithoutIlen + 4; // ditto - } else if (lenWithoutIlen < 99994) { - lenW = lenWithoutIlen + 5; - } else { - throw new TarMalformatException(RB.pif_toobig.getString(99991)); - } - - writer.write(Integer.toString(lenW)); - writer.write(' '); - writer.write(key); - writer.write('='); - writer.write(value); - writer.write('\n'); - writer.flush(); // Does this do anything with a BAOS? - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/RB.java b/database/hsqldb/src/org/hsqldb/lib/tar/RB.java deleted file mode 100644 index d1e75953..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/RB.java +++ /dev/null @@ -1,178 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import org.hsqldb.lib.ValidatingResourceBundle; -import org.hsqldb.lib.RefCapableRBInterface; - -/* $Id: RB.java 6527 2022-05-23 12:29:48Z fredt $ */ - -/** - * Resource Bundle for Tar classes - *

    - * Purpose of this class is to wrap a RefCapablePropertyResourceBundle to - * reliably detect any possible use of a missing property key as soon as - * this class is clinitted. - * The reason for this is to allow us developers to detect all such errors - * before end-users ever use this class. - *

    - * IMPORTANT: To add a new ResourceBundle element, add two new lines, one - * like

    - *    public static final int NEWKEYID = keyCounter++;
    - * 
    and one line
    - *      new Integer(KEY2), "key2",
    - * 
    - * Both should be inserted right after all of the other lines of the same type. - * NEWKEYID is obviously a new constant which you will use in calling code - * like RB.NEWKEYID. - */ -public enum RB implements RefCapableRBInterface { - DbBackup_syntax, - DbBackup_syntaxerr, - TarGenerator_syntax, - pad_block_write, - cleanup_rmfail, - TarReader_syntax, - unsupported_entry_present, - bpr_write, - stream_buffer_report, - write_queue_report, - file_missing, - modified_property, - file_disappeared, - file_changed, - file_appeared, - pif_malformat, - pif_malformat_size, - zero_write, - pif_toobig, - read_denied, - compression_unknown, - insufficient_read, - decompression_ranout, - move_work_file, - cant_overwrite, - cant_write_dir, - no_parent_dir, - bad_block_write_len, - illegal_block_boundary, - workfile_delete_fail, - unsupported_ext, - dest_exists, - parent_not_dir, - cant_write_parent, - parent_create_fail, - tar_field_toobig, - missing_supp_path, - nonfile_entry, - read_lt_1, - data_changed, - unexpected_header_key, - tarreader_syntaxerr, - unsupported_mode, - dir_x_conflict, - pif_unknown_datasize, - pif_data_toobig, - data_size_unknown, - extraction_exists, - extraction_exists_notfile, - extraction_parent_not_dir, - extraction_parent_not_writable, - extraction_parent_mkfail, - write_count_mismatch, - header_field_missing, - checksum_mismatch, - create_only_normal, - bad_header_value, - bad_numeric_header_value, - listing_format, - ; - - private static final ValidatingResourceBundle vrb = - new ValidatingResourceBundle( - RB.class.getPackage().getName() + ".rb", RB.class); - static { - vrb.setMissingPosValueBehavior( - ValidatingResourceBundle.NOOP_BEHAVIOR); - vrb.setMissingPropertyBehavior( - ValidatingResourceBundle.NOOP_BEHAVIOR); - } - - public String getString() { - return vrb.getString(this); - } - public String toString() { - return ValidatingResourceBundle.resourceKeyFor(this); - } - public String getExpandedString() { - return vrb.getExpandedString(this); - } - public String getExpandedString(String... strings) { - return vrb.getExpandedString(this, strings); - } - public String getString(String... strings) { - return vrb.getString(this, strings); - } - public String getString(int i1) { - return vrb.getString(this, i1); - } - public String getString(int i1, int i2) { - return vrb.getString(this, i1, i2); - } - public String getString(int i1, int i2, int i3) { - return vrb.getString(this, i1, i2, i3); - } - public String getString(int i1, String s2) { - return vrb.getString(this, i1, s2); - } - public String getString(String s1, int i2) { - return vrb.getString(this, s1, i2); - } - public String getString(int i1, int i2, String s3) { - return vrb.getString(this, i1, i2, s3); - } - public String getString(int i1, String s2, int i3) { - return vrb.getString(this, i1, s2, i3); - } - public String getString(String s1, int i2, int i3) { - return vrb.getString(this, s1, i2, i3); - } - public String getString(int i1, String s2, String s3) { - return vrb.getString(this, i1, s3, s3); - } - public String getString(String s1, String s2, int i3) { - return vrb.getString(this, s1, s2, i3); - } - public String getString(String s1, int i2, String s3) { - return vrb.getString(this, s1, i2, s3); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarFileInputStream.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarFileInputStream.java deleted file mode 100644 index 9e00c0a9..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarFileInputStream.java +++ /dev/null @@ -1,322 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.GZIPInputStream; - -/** - * Note that this class is not a java.io.FileInputStream, - * because our goal is to greatly restrict the public methods of - * FileInputStream, yet we must use public methods of the underlying - * FileInputStream internally. Can't accomplish these goals in Java if we - * subclass. - *

    - * This class is ignorant about Tar header fields, attributes and such. - * It is concerned with reading and writing blocks of data in conformance with - * Tar formatting, in a way convenient to those who want to get the header and - * data blocks. - *

    - * Asymmetric to the Tar file writing side, the bufferBlocks setting here is - * used only for to adjust read buffer size (for file data reads), so the user - * can compromise between available memory and performance. Small buffer sizes - * will always work, but will incur more reads; on the other hand, buffer sizes - * larger than the largest component file is just a waste of memory. - *

    - * We assume the responsibility to manage the setting because the decision - * should be based on available RAM more than anything else (therefore, we can't - * set a good value automatically). - *

    - * As alluded to above, headers are read in separate reads, regardless of the - * readBufferBlocks setting. readBufferBlocks is used for reading - * file data. - *

    - * I have purposefully not implemented skip(), because, though I haven't tested - * it, I believe our readBlock() and readBlocks() methods are at least as fast, - * since we use the larges read buffer within limits the user has set. - *

    - */ -public class TarFileInputStream { - - /* Would love to use a RandomAccessFile, but RandomAccessFiles do not play - * nicely with InputStreams or filters, and it just would not work with - * compressed input. */ - protected long bytesRead = 0; - - // Pronounced as past tense of "to read", not the other forms of "read". - // I.e., the homonym of "red". - private InputStream readStream; - - /* This is not a "Reader", but the byte "Stream" that we read() from. */ - protected byte[] readBuffer; - protected int readBufferBlocks; - protected int compressionType; - - /** - * Convenience wrapper to use default readBufferBlocks and compressionType. - * - * @see #TarFileInputStream(File, int, int) - * @param sourceFile File - * @throws IOException on failure - */ - public TarFileInputStream(File sourceFile) throws IOException { - this(sourceFile, TarFileOutputStream.Compression.DEFAULT_COMPRESSION); - } - - /** - * Convenience wrapper to use default readBufferBlocks. - * - * @see #TarFileInputStream(File, int, int) - * @param sourceFile File - * @param compressionType int - * @throws IOException on failure - */ - public TarFileInputStream(File sourceFile, - int compressionType) throws IOException { - this(sourceFile, compressionType, - TarFileOutputStream.Compression.DEFAULT_BLOCKS_PER_RECORD); - } - - public int getReadBufferBlocks() { - return readBufferBlocks; - } - - /** - * This class does no validation or enforcement of file naming conventions. - * If desired, the caller should enforce extensions like "tar" and - * "tar.gz" (and that they match the specified compression type). - *

    - * This object will automatically release its I/O resources when you get - * false back from a readNextHeaderBlock() call. - * If you abort before then, you must call the close() method like for a - * normal InputStream. - *

    - * - * @see #close() - * @see #readNextHeaderBlock() - * @param sourceFile File - * @param compressionType int - * @param readBufferBlocks int - * @throws IOException on failure - */ - public TarFileInputStream(File sourceFile, int compressionType, - int readBufferBlocks) throws IOException { - - if (!sourceFile.isFile()) { - throw new FileNotFoundException(sourceFile.getAbsolutePath()); - } - - if (!sourceFile.canRead()) { - throw new IOException( - RB.read_denied.getString(sourceFile.getAbsolutePath())); - } - - this.readBufferBlocks = readBufferBlocks; - this.compressionType = compressionType; - readBuffer = new byte[readBufferBlocks * 512]; - - switch (compressionType) { - - case TarFileOutputStream.Compression.NO_COMPRESSION : - readStream = new FileInputStream(sourceFile); - break; - - case TarFileOutputStream.Compression.GZIP_COMPRESSION : - readStream = - new GZIPInputStream(new FileInputStream(sourceFile), - readBuffer.length); - break; - - default : - throw new IllegalArgumentException( - RB.compression_unknown.getString(compressionType)); - } - } - - /** - * readBlocks(int) is the method that USERS of this class should use to - * read file data from the tar file. - * This method reads from the tar file and writes to the readBuffer array. - *

    - * This class and subclasses should read from the underlying readStream - * ONLY WITH THIS METHOD. - * That way we can be confident that bytesRead will always be accurate. - *

    - * This method is different from a typical Java byte array read command - * in that when reading tar files

      - *
    1. we always know ahead-of-time how many bytes we should read, and - *
    2. we always want to read quantities of bytes in multiples of 512. - *
    - * - * @param blocks How many 512 blocks to read. - * @throws IOException for an I/O error on the underlying InputStream - * @throws TarMalformatException if no I/O error occurred, but we failed to - * read the exact number of bytes requested. - */ - public void readBlocks(int blocks) - throws IOException, TarMalformatException { - - /* int for blocks should support sizes up to about 1T, according to - * my off-the-cuff calculations */ - if (compressionType - != TarFileOutputStream.Compression.NO_COMPRESSION) { - readCompressedBlocks(blocks); - - return; - } - - int i = readStream.read(readBuffer, 0, blocks * 512); - - bytesRead += i; - - if (i != blocks * 512) { - throw new TarMalformatException( - RB.insufficient_read.getString(blocks * 512, i)); - } - } - - /** - * Work-around for the problem that compressed InputReaders don't fill - * the read buffer before returning. - * - * Has visibility 'protected' so that subclasses may override with - * different algorithms, or use different algorithms for different - * compression stream. - */ - protected void readCompressedBlocks(int blocks) throws IOException { - - int bytesSoFar = 0; - int requiredBytes = 512 * blocks; - - // This method works with individual bytes! - int i; - - while (bytesSoFar < requiredBytes) { - i = readStream.read(readBuffer, bytesSoFar, - requiredBytes - bytesSoFar); - - if (i < 0) { - throw new EOFException( - RB.decompression_ranout.getString( - bytesSoFar, requiredBytes)); - } - - bytesRead += i; - bytesSoFar += i; - } - } - - /** - * readBlock() and readNextHeaderBlock are the methods that USERS of this - * class should use to read header blocks from the tar file. - *

    - * readBlock() should be used when you know that the current block should - * contain what you want. - * E.g. you know that the very first block of a tar file should contain - * a Tar Entry header block. - *

    - * - * @see #readNextHeaderBlock - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public void readBlock() throws IOException, TarMalformatException { - readBlocks(1); - } - - /** - * readBlock() and readNextHeaderBlock are the methods that USERS of this - * class should use to read header blocks from the tar file. - * - *

    readNextHeaderBlock continues working through the Tar File from the - * current point until it finds a block with a non-0 first byte.

    - * - * @return True if a header block was read and place at beginning of the - * readBuffer array. False if EOF was encountered without finding - * any blocks with first byte != 0. If false is returned, we have - * automatically closed the this TarFileInputStream too. - * @see #readBlock - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public boolean readNextHeaderBlock() - throws IOException, TarMalformatException { - - // We read a-byte-at-a-time because there should only be 2 empty blocks - // between each Tar Entry. - try { - while (readStream.available() > 0) { - readBlock(); - - if (readBuffer[0] != 0) { - return true; - } - } - } catch (EOFException ee) { - /* This is a work-around. - * Sun Java's inputStream.available() works like crap. - * Reach this point when performing a read of a GZip stream when - * .available == 1, which according to API Spec, should not happen. - * We treat this condition exactly as if readStream.available is 0, - * which it should be. - */ - } - - close(); - - return false; - } - - /** - * Implements java.io.Closeable. - * - * @see java.io.Closeable - * @throws IOException on failure - */ - public void close() throws IOException { - - if (readStream == null) { - return; - } - - try { - readStream.close(); - } finally { - readStream = null; // Encourage buffer GC - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarFileOutputStream.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarFileOutputStream.java deleted file mode 100644 index 39f5a08a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarFileOutputStream.java +++ /dev/null @@ -1,399 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.zip.GZIPOutputStream; - -/** - * Note that this class is not a java.io.FileOutputStream, - * because our goal is to greatly restrict the public methods of - * FileOutputStream, yet we must use public methods of the underlying - * FileOutputStream internally. Can't accomplish these goals in Java if we - * subclass. - *

    - * This class is ignorant about Tar header fields, attributes and such. - * It is concerned with reading and writing blocks of data in conformance with - * Tar formatting, in a way convenient to those who want to write the header - * and data blocks. - *

    - * Users write file data by means of populating the provided, public byte array, - * then calling the single write(int) method to write a portion of that array. - * This design purposefully goes with efficiency, simplicity, and performance - * over Java convention, which would not use public fields. - *

    - * At this time, we do not support appending. That would greatly decrease the - * generality and simplicity of the our design, since appending is trivial - * without compression and very difficult with compression. - *

    - * Users must finish tar file creation by using the finish() method. - * Just like a normal OutputStream, if processing is aborted for any reason, - * the close() method must be used to free up system resources. - *

    - * SECURITY NOTE - * Due to pitiful lack of support for file security in Java before version 1.6, - * this class will only explicitly set permissions if it is compiled for Java - * 1.6. If it was not, and if your tar entries contain private data in files - * with 0400 or similar, be aware that that file can be pretty much be - * extracted by anybody with access to the tar file. - *

    - * - * @see #finish - * @see #close - */ -public class TarFileOutputStream { - - public interface Compression { - - int NO_COMPRESSION = 0; - int GZIP_COMPRESSION = 1; - int DEFAULT_COMPRESSION = NO_COMPRESSION; - int DEFAULT_BLOCKS_PER_RECORD = 20; - } - - public static final boolean debug = Boolean.getBoolean("DEBUG"); - protected int blocksPerRecord; - protected long bytesWritten = 0; - private OutputStream writeStream; - private File targetFile; - private File writeFile; - - /* This is not a "Writer", but the byte "Stream" that we write() to. */ - public byte[] writeBuffer; - /* We purposefully provide no public getter or setter for writeBuffer. - * No getter because the whole point of this class is that the byte - * array is a direct, optimally efficient byte array. No setter because - * the inside implementation of this class is intimately dependent upon - * the nature of the write buffer. */ - static final byte[] ZERO_BLOCK = new byte[512]; - - /** - * Convenience wrapper to use default blocksPerRecord and compressionType. - * - * @see #TarFileOutputStream(File, int, int) - * @param targetFile File - * @throws IOException on failure - */ - public TarFileOutputStream(File targetFile) throws IOException { - this(targetFile, Compression.DEFAULT_COMPRESSION); - } - - /** - * Convenience wrapper to use default blocksPerRecord. - * - * @see #TarFileOutputStream(File, int, int) - * @param targetFile File - * @param compressionType int - * @throws IOException on failure - */ - public TarFileOutputStream(File targetFile, - int compressionType) throws IOException { - this(targetFile, compressionType, - TarFileOutputStream.Compression.DEFAULT_BLOCKS_PER_RECORD); - } - - /** - * This class does no validation or enforcement of file naming conventions. - * If desired, the caller should enforce extensions like "tar" and - * "tar.gz" (and that they match the specified compression type). - * - * It also overwrites files without warning (just like FileOutputStream). - * - * @param targetFile File - * @param compressionType int - * @param blocksPerRecord int - * @throws IOException on failure - */ - public TarFileOutputStream(File targetFile, int compressionType, - int blocksPerRecord) throws IOException { - - this.blocksPerRecord = blocksPerRecord; - this.targetFile = targetFile; - writeFile = new File(targetFile.getParentFile(), - targetFile.getName() + "-partial"); - - if (this.writeFile.exists()) { - throw new IOException( - RB.move_work_file.getString(writeFile.getAbsolutePath())); - } - - if (targetFile.exists() && !targetFile.canWrite()) { - throw new IOException( - RB.cant_overwrite.getString(targetFile.getAbsolutePath())); - } - - File parentDir = targetFile.getAbsoluteFile().getParentFile(); - - if (parentDir.exists() && parentDir.isDirectory()) { - if (!parentDir.canWrite()) { - throw new IOException( - RB.cant_write_dir.getString(parentDir.getAbsolutePath())); - } - } else { - throw new IOException( - RB.no_parent_dir.getString(parentDir.getAbsolutePath())); - } - - writeBuffer = new byte[blocksPerRecord * 512]; - - switch (compressionType) { - - case TarFileOutputStream.Compression.NO_COMPRESSION : - writeStream = new FileOutputStream(writeFile); - break; - - case TarFileOutputStream.Compression.GZIP_COMPRESSION : - writeStream = - new GZIPOutputStream(new FileOutputStream(writeFile), - writeBuffer.length); - break; - - default : - throw new IllegalArgumentException( - RB.compression_unknown.getString(compressionType)); - } - - writeFile.setExecutable(false, true); - writeFile.setExecutable(false, false); - writeFile.setReadable(false, false); - writeFile.setReadable(true, true); - writeFile.setWritable(false, false); - writeFile.setWritable(true, true); - - // We restrict permissions to the file owner before writing - // anything, in case we will be writing anything private into this - // file. - } - - /** - * This class and subclasses should write to the underlying writeStream - * ONLY WITH THIS METHOD. That way we can be confident that - * bytesWritten will always be accurate. - * - * @param byteArray byte[] - * @param byteCount int - * @throws IOException on failure - */ - public void write(byte[] byteArray, int byteCount) throws IOException { - - writeStream.write(byteArray, 0, byteCount); - - bytesWritten += byteCount; - } - - /** - * The normal way to write file data (as opposed to header data or padding) - * using this class. - * - * @param byteCount int - * @throws IOException on failure - */ - public void write(int byteCount) throws IOException { - write(writeBuffer, byteCount); - } - - /** - * Write a user-specified 512-byte block. For efficiency, write(int) should - * be used when writing file body content. - * - * @see #write(int) - * @param block byte[] - * @throws IOException on failure - */ - public void writeBlock(byte[] block) throws IOException { - - if (block.length != 512) { - throw new IllegalArgumentException( - RB.bad_block_write_len.getString(block.length)); - } - - write(block, block.length); - } - - /** - * Writes the specified quantity of zero'd blocks. - * - * @param blockCount int - * @throws IOException on failure - */ - public void writePadBlocks(int blockCount) throws IOException { - - for (int i = 0; i < blockCount; i++) { - write(ZERO_BLOCK, ZERO_BLOCK.length); - } - } - - /** - * Writes a single zero'd block. - * - * @throws IOException on failure - */ - public void writePadBlock() throws IOException { - writePadBlocks(1); - } - - public int bytesLeftInBlock() { - - int modulus = (int) (bytesWritten % 512L); - - if (modulus == 0) { - return 0; - } - - return 512 - modulus; - } - - /** - * @throws IllegalStateException if end of file not on a block boundary. - */ - public void assertAtBlockBoundary() { - - if (bytesLeftInBlock() != 0) { - throw new IllegalArgumentException( - RB.illegal_block_boundary.getString( - Long.toString(bytesWritten))); - } - } - - /** - * Rounds out the current block to the next block boundary. If we are - * currently at a block boundary, nothing is done. - * - * @throws IOException on failure - */ - public void padCurrentBlock() throws IOException { - - int padBytes = bytesLeftInBlock(); - - if (padBytes == 0) { - return; - } - - write(ZERO_BLOCK, padBytes); - - // REMOVE THIS DEV-ASSERTION: - assertAtBlockBoundary(); - } - - /** - * Implements java.io.Flushable. - * - * @see java.io.Flushable - * @throws IOException on failure - */ - public void flush() throws IOException { - writeStream.flush(); - } - - /** - * Implements java.io.Closeable. - *

    - * IMPORTANT: This method deletes the work file after - * closing it! - * - * @see java.io.Closeable - * @throws IOException on failure - */ - public void close() throws IOException { - - if (writeStream == null) { - return; - } - - try { - writeStream.close(); - - if (!writeFile.delete()) { - throw new IOException( - RB.workfile_delete_fail.getString( - writeFile.getAbsolutePath())); - } - } finally { - writeStream = null; // Encourage buffer GC - } - } - - public long getBytesWritten() { - return bytesWritten; - } - - /** - * (Only) when this method returns successfully, the generated file will be - * a valid tar file. - * - * This method always performs a close, so you never need to call the close - * if your code makes it to this method. - * (You do need to call close if processing is aborted before calling - * finish()). - * - * @see #close - * @throws IOException on failure - */ - public void finish() throws IOException { - - try { - long finalBlock = bytesWritten / 512 + 2; - - if (finalBlock % blocksPerRecord != 0) { - - // Round up total archive size to a blocksPerRecord multiple - finalBlock = (finalBlock / blocksPerRecord + 1) - * blocksPerRecord; - } - - int finalPadBlocks = (int) (finalBlock - bytesWritten / 512L); - - if (TarFileOutputStream.debug) { - System.out.println( - RB.pad_block_write.getString(finalPadBlocks)); - } - - writePadBlocks(finalPadBlocks); - } catch (IOException ioe) { - try { - close(); - } catch (IOException ne) { - - // Too difficult to report every single error. - // More important that the user know about the original Exc. - } - - throw ioe; - } - - writeStream.close(); - writeFile.renameTo(targetFile); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarGenerator.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarGenerator.java deleted file mode 100644 index bb0d494d..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarGenerator.java +++ /dev/null @@ -1,731 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - -import org.hsqldb.lib.InputStreamInterface; -import org.hsqldb.lib.InputStreamWrapper; -import org.hsqldb.lib.StringUtil; - -/** - * Generates a tar archive from specified Files and InputStreams. - * Modified by fredt for hot backup - * @version 2.5.0 - * @since 2.0.0 - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ -public class TarGenerator { - - protected TarFileOutputStream archive; - protected List entryQueue = - new ArrayList(); - protected long paxThreshold = 0100000000000L; - - // in bytes. Value here exactly = 8GB. - - /** - * When data file is this size or greater, in bytes, a - * Pix Interchange Format 'x' record will be created and used for the file - * entry. - *

    - * Limitation - * At this time, PAX is only implemented for entries added as Files, - * not entries added as Stream. - *

    - * - * @param paxThreshold long - */ - public void setPaxThreshold(long paxThreshold) { - this.paxThreshold = paxThreshold; - } - - /** - * - * @see #setPaxThreshold(long) - * @return long - */ - public long getPaxThreshold() { - return paxThreshold; - } - - /** - * Compression is determined directly by the suffix of the file name in - * the specified path. - * - * @param inFile Absolute or relative (from user.dir) File for - * tar file to be created. getName() Suffix must - * indicate tar file and may indicate a compression - * method. - * @param overWrite True to replace an existing file of same path. - * @param blocksPerRecord Null will use default tar value. - * @throws IOException on access failure - */ - public TarGenerator(File inFile, boolean overWrite, Integer blocksPerRecord) - throws IOException { - File archiveFile = inFile.getAbsoluteFile(); - - // Do this so we can be sure .getParent*() is non-null. (Also allows - // us to use .getPath() instead of very long .getAbsolutePath() for - // error messages. - int compression = TarFileOutputStream.Compression.NO_COMPRESSION; - - if (archiveFile.getName().endsWith(".tgz") - || archiveFile.getName().endsWith(".tar.gz")) { - compression = TarFileOutputStream.Compression.GZIP_COMPRESSION; - } else if (archiveFile.getName().endsWith(".tar")) { - - // purposefully do nothing - } else { - throw new IllegalArgumentException( - RB.unsupported_ext.getString( - getClass().getName(), archiveFile.getPath())); - } - - if (archiveFile.exists()) { - if (!overWrite) { - throw new IOException( - RB.dest_exists.getString(archiveFile.getPath())); - } - } else { - File parentDir = archiveFile.getParentFile(); - - // parentDir will be absolute, since archiveFile is absolute. - if (parentDir.exists()) { - if (!parentDir.isDirectory()) { - throw new IOException( - RB.parent_not_dir.getString(parentDir.getPath())); - } - - if (!parentDir.canWrite()) { - throw new IOException( - RB.cant_write_parent.getString(parentDir.getPath())); - } - } else { - if (!parentDir.mkdirs()) { - throw new IOException( - RB.parent_create_fail.getString(parentDir.getPath())); - } - } - } - - archive = (blocksPerRecord == null) - ? new TarFileOutputStream(archiveFile, compression) - : new TarFileOutputStream(archiveFile, compression, - blocksPerRecord.intValue()); - - if ((blocksPerRecord != null) && TarFileOutputStream.debug) { - System.out.println( - RB.bpr_write.getString(blocksPerRecord.intValue())); - } - } - - public void queueEntry(File file) - throws FileNotFoundException, TarMalformatException { - queueEntry(null, file); - } - - public void queueEntry(String entryPath, File file) - throws FileNotFoundException, TarMalformatException { - entryQueue.add(new TarEntrySupplicant(entryPath, file, archive, - paxThreshold)); - } - - public void queueEntry(String entryPath, InputStreamInterface is) - throws FileNotFoundException, TarMalformatException { - entryQueue.add(new TarEntrySupplicant(entryPath, is, archive, - paxThreshold)); - } - - /** - * This method does not support Pax Interchange Format, nor data sizes - * greater than 2G. - *

    - * This limitation may or may not be eliminated in the future. - *

    - - * @param entryPath String - * @param inStream InputStream - * @param maxBytes int - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public void queueEntry(String entryPath, InputStream inStream, int maxBytes) - throws IOException, TarMalformatException { - entryQueue.add(new TarEntrySupplicant(entryPath, inStream, maxBytes, - '0', archive)); - } - - /** - * This method does release all of the streams, even if there is a failure. - * - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public void write() throws IOException, TarMalformatException { - if (TarFileOutputStream.debug) { - System.out.println( - RB.write_queue_report.getString(entryQueue.size())); - } - - TarEntrySupplicant entry; - - try { - for (int i = 0; i < entryQueue.size(); i++) { - System.out.print(Integer.toString(i + 1) + " / " - + entryQueue.size() + ' '); - entry = entryQueue.get(i); - System.out.print(entry.getPath() + "... "); - entry.write(); - archive.assertAtBlockBoundary(); - System.out.println(); - } - - archive.finish(); - } catch (IOException ioe) { - System.out.println(); // Exception should cause a report - - try { - - // Just release resources from any Entry's input, which may be - // left open. - for (TarEntrySupplicant sup : entryQueue) { - sup.close(); - } - - archive.close(); - } catch (IOException ne) { - - // Too difficult to report every single error. - // More important that the user know about the original Exc. - } - - throw ioe; - } - } - - /** - * Slots for supplicant files and input streams to be added to a Tar - * archive. - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ - static protected class TarEntrySupplicant { - static final byte[] HEADER_TEMPLATE = - TarFileOutputStream.ZERO_BLOCK.clone(); - static Character swapOutDelim = null; - static final byte[] ustarBytes = { - 'u', 's', 't', 'a', 'r' - }; - - static { - char c = System.getProperty("file.separator").charAt(0); - - if (c != '/') { - swapOutDelim = Character.valueOf(c); - } - - try { - writeField(TarHeaderField.uid, 0L, HEADER_TEMPLATE); - writeField(TarHeaderField.gid, 0L, HEADER_TEMPLATE); - } catch (TarMalformatException tme) { - - // This would definitely get caught in Dev env. - throw new RuntimeException(tme); - } - - // Setting uid and gid to 0 = root. - // Misleading, yes. Anything better we can do? No. - int magicStart = TarHeaderField.magic.getStart(); - - for (int i = 0; i < ustarBytes.length; i++) { - - // UStar magic field - HEADER_TEMPLATE[magicStart + i] = ustarBytes[i]; - } - - HEADER_TEMPLATE[263] = '0'; - HEADER_TEMPLATE[264] = '0'; - - // UStar version field, version = 00 - // This is the field that Gnu Tar desecrates. - } - - static protected void writeField(TarHeaderField field, String newValue, - byte[] target) - throws TarMalformatException { - int start = field.getStart(); - int stop = field.getStop(); - byte[] ba; - - ba = newValue.getBytes(Charset.forName("ISO-8859-1")); - - if (ba.length > stop - start) { - throw new TarMalformatException( - RB.tar_field_toobig.getString(field.toString(), newValue)); - } - - for (int i = 0; i < ba.length; i++) { - target[start + i] = ba[i]; - } - } - - static protected void clearField(TarHeaderField field, byte[] target) { - int start = field.getStart(); - int stop = field.getStop(); - - for (int i = start; i < stop; i++) { - target[i] = 0; - } - } - - static protected void writeField(TarHeaderField field, long newValue, - byte[] target) - throws TarMalformatException { - TarEntrySupplicant.writeField( - field, - TarEntrySupplicant.prePaddedOctalString( - newValue, field.getStop() - field.getStart()), target); - } - - public static String prePaddedOctalString(long val, int width) { - return StringUtil.toPaddedString(Long.toOctalString(val), width, - '0', false); - } - - protected byte[] rawHeader = HEADER_TEMPLATE.clone(); - protected String fileMode = DEFAULT_FILE_MODES; - - // Following fields are always initialized by constructors. - protected InputStreamInterface inputStream; - protected String path; - protected long modTime; - protected TarFileOutputStream tarStream; - protected long dataSize; // In bytes - protected boolean paxSized = false; - protected final long paxThreshold; - - // (paxSized = true) tells the target entry to NOT set the size header field, - // to ensure that no tar client accidentally extracts only - // a portion of the file data. - // If the client can't read the correct size from the PIF data, - // we want the client to report that so the user can get a better - // tar client! - // Size will only be written to entry's header if paxSized is false. - public String getPath() { - return path; - } - - public long getDataSize() { - return dataSize; - } - - /* - * Internal constructor that validates the entry's path. - */ - protected TarEntrySupplicant(String path, char typeFlag, - TarFileOutputStream tarStream, - long paxThreshold) - throws TarMalformatException { - this.paxThreshold = paxThreshold; - - if (path == null) { - throw new IllegalArgumentException( - RB.missing_supp_path.getString()); - } - - this.path = (swapOutDelim == null) - ? path - : path.replace(swapOutDelim.charValue(), '/'); - this.tarStream = tarStream; - writeField(TarHeaderField.typeflag, typeFlag); - - if ((typeFlag == '\0') || (typeFlag == ' ')) { - writeField(TarHeaderField.uname, - System.getProperty("user.name"), HEADER_TEMPLATE); - writeField(TarHeaderField.gname, "root", HEADER_TEMPLATE); - - // Setting UNAME and GNAME at the instance level instead of the - // static template, because record types 'x' and 'g' do not set - // these fields. - // POSIX UStar compliance requires that we set "gname" field. - // It's impossible for use to determine the correct value from - // Java. We punt with "root" because (a) it's the only group - // name - // we know should exist on every UNIX system, and (b) every tar - // client gracefully handles it when extractor user does not - // have privs for the specified group. - } - } - - /** - * This creates a 'x' entry for a 0/\0 entry. - * - * @throws IOException on access failure - * @throws TarMalformatException if malformed - * @return TarEntrySupplicant - */ - public TarEntrySupplicant makeXentry() - throws IOException, TarMalformatException { - PIFGenerator pif = new PIFGenerator(new File(path)); - - pif.addRecord("size", dataSize); - - /* - * Really bad to make pseudo-stream just to get a byte array out - * of it, but it would be a very poor use of development time to - * re-design this class because the comparative time wasted at - * runtime will be negligible compared to storing the data entries. - */ - return new TarEntrySupplicant( - pif.getName(), new ByteArrayInputStream(pif.toByteArray()), - pif.size(), 'x', tarStream); - } - - /** - * After instantiating a TarEntrySupplicant, the user must either invoke - * write() or close(), to release system resources on the input - * File/Stream. - * - * @param path String - * @param file File - * @param tarStream TarFileOutputStream - * @param paxThreshold long - * @throws FileNotFoundException if not found - * @throws TarMalformatException if malformed - */ - public TarEntrySupplicant(String path, File file, - TarFileOutputStream tarStream, - long paxThreshold) - throws FileNotFoundException, TarMalformatException { - - // Must use an expression-embedded ternary here to satisfy compiler - // that this() call be first statement in constructor. - this(((path == null) - ? file.getPath() - : path), '0', tarStream, paxThreshold); - - // Difficult call for '0'. binary 0 and character '0' both mean - // regular file. Binary 0 pre-UStar is probably more portable, - // but we are writing a valid UStar header, and I doubt anybody's - // tar implementation would choke on this since there is no - // outcry of UStar archives failing to work with older tars. - if (!file.isFile()) { - throw new IllegalArgumentException( - RB.nonfile_entry.getString()); - } - - if (!file.canRead()) { - throw new IllegalArgumentException( - RB.read_denied.getString(file.getAbsolutePath())); - } - - modTime = file.lastModified() / 1000L; - fileMode = TarEntrySupplicant.getLameMode(file); - dataSize = file.length(); - inputStream = new InputStreamWrapper(new FileInputStream(file)); - } - - public TarEntrySupplicant(String path, InputStreamInterface is, - TarFileOutputStream tarStream, - long paxThreshold) - throws TarMalformatException { - - // Must use an expression-embedded ternary here to satisfy compiler - // that this() call be first statement in constructor. - this(path, '0', tarStream, paxThreshold); - - // Difficult call for '0'. binary 0 and character '0' both mean - // regular file. Binary 0 pre-UStar is probably more portable, - // but we are writing a valid UStar header, and I doubt anybody's - // tar implementation would choke on this since there is no - // outcry of UStar archives failing to work with older tars. - modTime = System.currentTimeMillis() / 1000L; - fileMode = DEFAULT_FILE_MODES; - inputStream = is; - } - - /** - * After instantiating a TarEntrySupplicant, the user must either invoke - * write() or close(), to release system resources on the input - * File/Stream. - *

    - * WARNING: - * Do not use this method unless the quantity of available RAM is - * sufficient to accommodate the specified maxBytes all at one time. - * This constructor loads all input from the specified InputStream into - * RAM before anything is written to disk. - *

    - * - * @param path String - * @param origStream InputStream - * @param maxBytes This method will fail if more than maxBytes bytes - * are supplied on the specified InputStream. - * As the type of this parameter enforces, the max - * size you can request is 2GB. - * @param typeFlag char - * @param tarStream TarFileOutputStream - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public TarEntrySupplicant(String path, InputStream origStream, - int maxBytes, char typeFlag, - TarFileOutputStream tarStream) - throws IOException, TarMalformatException { - - /* - * If you modify this, make sure to not intermix reading/writing of - * the PipedInputStream and the PipedOutputStream, or you could - * cause dead-lock. Everything is safe if you close the - * PipedOutputStream before reading the PipedInputStream. - */ - this(path, typeFlag, tarStream, 0100000000000L); - - if (maxBytes < 1) { - throw new IllegalArgumentException(RB.read_lt_1.getString()); - } - - int i; - PipedOutputStream outPipe = new PipedOutputStream(); - - /* - * This constructor not available until Java 1.6: - * inputStream = new PipedInputStream(outPipe, maxBytes); - */ - try { - inputStream = - new InputStreamWrapper(new PipedInputStream(outPipe)); - - while ((i = - origStream.read(tarStream.writeBuffer, 0, - tarStream.writeBuffer.length)) > 0) { - outPipe.write(tarStream.writeBuffer, 0, i); - } - - outPipe.flush(); // Do any good on a pipe? - dataSize = inputStream.available(); - - if (TarFileOutputStream.debug) { - System.out.println( - RB.stream_buffer_report.getString( - Long.toString(dataSize))); - } - } catch (IOException ioe) { - close(); - - throw ioe; - } finally { - try { - outPipe.close(); - } finally { - outPipe = null; // Encourage buffer GC - } - } - - modTime = new java.util.Date().getTime() / 1000L; - } - - public void close() throws IOException { - if (inputStream == null) { - return; - } - - try { - inputStream.close(); - } finally { - inputStream = null; // Encourage buffer GC - } - } - - protected long headerChecksum() { - long sum = 0; - - for (int i = 0; i < rawHeader.length; i++) { - boolean isInRange = - ((i >= TarHeaderField.checksum.getStart()) - && (i < TarHeaderField.checksum.getStop())); - - sum += isInRange - ? 32 - : (255 & rawHeader[i]); - - // We ignore current contents of the checksum field so that - // this method will continue to work right, even if we later - // recycle the header or RE-calculate a header. - } - - return sum; - } - - protected void clearField(TarHeaderField field) { - TarEntrySupplicant.clearField(field, rawHeader); - } - - protected void writeField(TarHeaderField field, String newValue) - throws TarMalformatException { - TarEntrySupplicant.writeField(field, newValue, rawHeader); - } - - protected void writeField(TarHeaderField field, long newValue) - throws TarMalformatException { - TarEntrySupplicant.writeField(field, newValue, rawHeader); - } - - protected void writeField(TarHeaderField field, char c) - throws TarMalformatException { - TarEntrySupplicant.writeField(field, Character.toString(c), - rawHeader); - } - - /** - * Writes entire entry to this object's tarStream. - * - * This method is guaranteed to close the supplicant's input stream. - * - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public void write() throws IOException, TarMalformatException { - int i; - - try { - - // normal file streams will return -1 as size limit - // getSizeLimit() is called just before writing the entry - long sizeLimit = inputStream.getSizeLimit(); - - // special stream with explicit zero limit is not written - if (sizeLimit == 0) { - return; - } - - // special stream - if (sizeLimit > 0) { - dataSize = sizeLimit; - } - - if (dataSize >= paxThreshold) { - paxSized = true; - makeXentry().write(); - System.out.print("x... "); - } - - writeField(TarHeaderField.name, path); - - // TODO: If path.length() > 99, then write a PIF entry with - // the file path. - // Don't waste time using the PREFIX header field. - writeField(TarHeaderField.mode, fileMode); - - if (!paxSized) { - writeField(TarHeaderField.size, dataSize); - } - - writeField(TarHeaderField.mtime, modTime); - writeField( - TarHeaderField.checksum, - TarEntrySupplicant.prePaddedOctalString( - headerChecksum(), 6) + "\0 "); - - // Silly, but that's what the base header spec calls for. - tarStream.writeBlock(rawHeader); - - long dataStart = tarStream.getBytesWritten(); - - while ((i = inputStream.read(tarStream.writeBuffer)) > 0) { - tarStream.write(i); - } - - if (dataStart + dataSize != tarStream.getBytesWritten()) { - throw new IOException( - RB.data_changed.getString( - Long.toString(dataSize), - Long.toString( - tarStream.getBytesWritten() - dataStart))); - } - - tarStream.padCurrentBlock(); - } finally { - close(); - } - } - - /** - * This method is so-named because it only sets the owner privileges, - * not any "group" or "other" privileges. - *

    - * This is because of Java limitation. - * Incredibly, with Java 1.6, the API gives you the power to set - * privileges for "other" (last nibble in file Mode), but no ability - * to detect the same. - *

    - * - * @param file File - * @return String - */ - static protected String getLameMode(File file) { - int umod = 0; - - if (file.canExecute()) { - umod = 1; - } - - if (file.canWrite()) { - umod += 2; - } - - if (file.canRead()) { - umod += 4; - } - - return "0" + umod + "00"; - - // Conservative since Java gives us no way to determine group or - // other privileges on a file, and this file may contain passwords. - } - - public static final String DEFAULT_FILE_MODES = "600"; - - // Be conservative, because these files contain passwords - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarGeneratorMain.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarGeneratorMain.java deleted file mode 100644 index f7df3422..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarGeneratorMain.java +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.File; -import java.io.IOException; - -public class TarGeneratorMain { - - /** - * Creates specified tar file to contain specified files, or stdin, using - * default blocks-per-record and replacing tar file if it already exists. - * - * @param sa arguments - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public static void main(String[] sa) - throws IOException, TarMalformatException { - - if (sa.length < 1) { - System.out.println( - RB.TarGenerator_syntax.getString(DbBackup.class.getName())); - System.exit(0); - } - - TarGenerator generator = new TarGenerator(new File(sa[0]), true, null); - - if (sa.length == 1) { - generator.queueEntry("stdin", System.in, 10240); - } else { - for (int i = 1; i < sa.length; i++) { - generator.queueEntry(new File(sa[i])); - } - } - - generator.write(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarHeaderField.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarHeaderField.java deleted file mode 100644 index ab22d38e..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarHeaderField.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -/** - * Purely static structure defining our interface to the Tar Entry Header. - * - * The fields controlled here are fields for the individual tar file entries - * in an archive. There is no such thing as a Header Field at the top archive - * level. - *

    - * We use header field names as they are specified in the FreeBSD man page for - * tar in section 5 (Solaris and Linux have no such page in section 5). - * Where we use a constant, the constant name is just the FreeBSD field name - * capitalized. - * Since a single field is known as either "linkflag" or "typeflag", we are - * going with the UStar name typeflag for this field. - *

    - * We purposefully define no variable for this list of fields, since - * we DO NOT WANT TO access or change these values, due to application - * goals or JVM limitations:

      - *
    • gid - *
    • uid - *
    • linkname - *
    • magic (UStar ID), - *
    • magic version - *
    • group name - *
    • device major num - *
    • device minor num - *
    - * Our application has no use for these, or Java has no ability to - * work with them. - *

    - * This class will be very elegant when refactored as an enum with enumMap(s) - * and using generics with auto-boxing instead of the ugly and non-validating - * casts. - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ -@SuppressWarnings("boxing") -public enum TarHeaderField { - // 1 PAST last position (in normal Java substring fashion). - /* Note that (with one exception), there is always 1 byte - * between a numeric field stop and the next start. This is - * because null byte must occupy the intervening position. - * This is not true for non-numeric fields (which includes the - * link-indicator/type-flag field, which is used as a code, - * and is not necessarily numeric with UStar format). - * - * As a consequence, there may be NO DELIMITER after - * non-numerics, which may occupy the entire field segment. - * - * Arg. man page for "pax" says that both original and ustar - * headers must be <= 100 chars. INCLUDING the trailing \0 - * character. ??? GNU tar certainly does not honor this. - */ - name(0, 100), - mode(100, 107), - uid(108, 115), - gid(116, 123), - size(124, 135), - mtime(136, 147), // (File.lastModified()|*.getTime())/1000 - checksum(148, 156),// "Queer terminator" in original code. ??? - // Pax UStore does not follow spec and delimits this - // field like any other numeric, skipping the space byte. - typeflag(156, 157), // 1-byte CODE - // With current version, we are never doing anything with this - // field. In future, we will support x and/or g type here. - // N.b. Gnu Tar does not honor this Stop. - - // The remaining are from UStar format: - magic(257, 263), - uname(265, 296), - gname(297, 328), - prefix(345, 399), - ; - - TarHeaderField(int start, int stop) { - this.start = start; - this.stop = stop; - } - private final int start; - private final int stop; - - // The getters below throw RuntimExceptions instead of - // TarMalformatExceptions because these errors indicate a dev problem, - // not some problem with a Header, or generating or reading a Header. - public int getStart() { return start; } - public int getStop() { return stop; } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarMalformatException.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarMalformatException.java deleted file mode 100644 index 84633e53..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarMalformatException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -@SuppressWarnings("serial") -public class TarMalformatException extends Exception { - - public TarMalformatException(String s) { - super(s); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarReader.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarReader.java deleted file mode 100644 index 159501cf..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarReader.java +++ /dev/null @@ -1,772 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import org.hsqldb.lib.StringUtil; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.text.SimpleDateFormat; -import java.util.regex.Pattern; - -/** - * Reads a Tar file for reporting or extraction. - * N.b. this is not a Reader in the java.io.Reader sense, - * but in the sense of differentiating tar x and - * tar t from tar c. - *

    - * SECURITY NOTE - * Due to pitiful lack of support for file security in Java before version 1.6, - * this class will only explicitly set permissions if it is compiled for Java - * 1.6. If it was not, and if your tar entries contain private data in files - * with 0400 or similar, be aware that they will be extracted with privs such - * that they can be ready by anybody. - *

    - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ -public class TarReader { - - public static final int LIST_MODE = 0; - - /** - * EXTRACT_MODE refuses to overwrite existing files. - */ - public static final int EXTRACT_MODE = 1; - - /** - * OVERWRITE_MODE is just EXTRACT_MODE where we will silently overwrite - * existing files upon extraction. - */ - public static final int OVERWRITE_MODE = 2; - - protected TarFileInputStream archive; - protected Pattern[] patterns = null; - protected int mode; - protected File extractBaseDir; // null means current directory - - // Not used for Absolute path entries - // This path is always absolutized - - /** - * Compression is determined directly by the suffix of the file name in - * the specified path. - * - * @param inFile Absolute or relative (from user.dir) path to - * tar file to be read. Suffix may indicate - * a compression method. - * @param mode Whether to list, extract-without-overwrite, or - * extract-with-overwrite. - * @param patternStrings - * List of regular expressions to match against tar entry - * names. If null, all entries will be listed or - * extracted. If non-null, then only entries with names - * which match will be extracted or listed. - * @param readBufferBlocks Null will use default tar value. - * @param inDir Directory that RELATIVE entries will be extracted - * relative to. Defaults to current directory (user.dir). - * Only used for extract modes and relative file entries. - * @throws IOException on access failure - * @throws IllegalArgumentException if any given pattern is an invalid - * regular expression. Don't have to worry about this if - * you call with null 'patterns' param. - * @see Pattern - */ - public TarReader(File inFile, int mode, String[] patternStrings, - Integer readBufferBlocks, File inDir) throws IOException { - - this.mode = mode; - - File archiveFile = inFile.getAbsoluteFile(); - - extractBaseDir = (inDir == null) ? null - : inDir.getAbsoluteFile(); - - int compression = - TarFileOutputStream.Compression.NO_COMPRESSION; - - if (archiveFile.getName().endsWith(".tgz") - || archiveFile.getName().endsWith(".gz")) { - compression = TarFileOutputStream.Compression.GZIP_COMPRESSION; - } - - if (patternStrings != null) { - patterns = new Pattern[patternStrings.length]; - - for (int i = 0; i < patternStrings.length; i++) { - patterns[i] = Pattern.compile(patternStrings[i]); - } - } - - // Don't check for archive file existence here. We can depend upon the - // TarFileInputStream to check that. - archive = (readBufferBlocks == null) - ? new TarFileInputStream(archiveFile, compression) - : new TarFileInputStream(archiveFile, compression, - readBufferBlocks.intValue()); - } - - public void read() throws IOException, TarMalformatException { - - TarEntryHeader header; - boolean anyUnsupporteds = false; - boolean matched; - Long paxSize = null; - String paxString = null; - - try { - EACH_HEADER: - while (archive.readNextHeaderBlock()) { - header = new TarEntryHeader(archive.readBuffer); - - char entryType = header.getEntryType(); - - if (entryType == 'x') { - /* Since we don't know the name of the target file yet, - * we must load the size from all pax headers. - * If the target file is not thereafter excluded via - * patterns, we will need this size for the listing or to - * extract the data. - */ - paxSize = getPifData(header).getSize(); - paxString = header.toString(); - - continue; - } - - if (paxSize != null) { - - // Ignore "size" field in the entry header because PIF - // setting overrides. - header.setDataSize(paxSize.longValue()); - - paxSize = null; - } - - if (patterns != null) { - matched = false; - - for (int i = 0; i < patterns.length; i++) { - if (patterns[i].matcher(header.getPath()).matches()) { - matched = true; - - break; - } - } - - if (!matched) { - paxString = null; - - skipFileData(header); - - continue EACH_HEADER; - } - } - - if (entryType != '\0' && entryType != '0' - && entryType != 'x') { - anyUnsupporteds = true; - } - - switch (mode) { - - case LIST_MODE : - if (paxString != null) { - System.out.println(paxString); - } - - System.out.println(header.toString()); - skipFileData(header); - break; - - case EXTRACT_MODE : - case OVERWRITE_MODE : - if (paxString != null) { - System.out.println(paxString); - } - - /* Display entry summary before successful extraction. - * Both "tar" and "rsync" display the name of the - * currently extracting file, and we do the same. - * Therefore the currently "shown" name is still being - * extracted. - */ - System.out.println(header.toString()); - - // Instance variable mode will be used to differentiate - // behavior inside of extractFile(). - if (entryType == '\0' || entryType == '0' - || entryType == 'x') { - extractFile(header); - } else { - skipFileData(header); - } - break; - - default : - throw new IllegalArgumentException( - RB.unsupported_mode.getString(mode)); - } - - paxString = null; - } - - if (anyUnsupporteds) { - System.out.println(RB.unsupported_entry_present.getString()); - } - } catch (IOException ioe) { - archive.close(); - - throw ioe; - } - } - - protected PIFData getPifData(TarEntryHeader header) - throws IOException, TarMalformatException { - - /* - * If you modify this, make sure to not intermix reading/writing of - * the PipedInputStream and the PipedOutputStream, or you could - * cause dead-lock. Everything is safe if you close the - * PipedOutputStream before reading the PipedInputStream. - */ - long dataSize = header.getDataSize(); - - if (dataSize < 1) { - throw new TarMalformatException( - RB.pif_unknown_datasize.getString()); - } - - if (dataSize > Integer.MAX_VALUE) { - throw new TarMalformatException(RB.pif_data_toobig.getString( - Long.toString(dataSize), Integer.MAX_VALUE)); - } - - int readNow; - int readBlocks = (int) (dataSize / 512L); - int modulus = (int) (dataSize % 512L); - - // Couldn't care less about the entry "name" field. - PipedInputStream inPipe = null; - PipedOutputStream outPipe = new PipedOutputStream(); - - /* This constructor not available until Java 1.6: - new PipedInputStream(outPipe, (int) dataSize); - */ - try { - inPipe = new PipedInputStream(outPipe); - while (readBlocks > 0) { - readNow = (readBlocks > archive.getReadBufferBlocks()) - ? archive.getReadBufferBlocks() - : readBlocks; - - archive.readBlocks(readNow); - - readBlocks -= readNow; - - outPipe.write(archive.readBuffer, 0, readNow * 512); - } - - if (modulus != 0) { archive.readBlock(); - outPipe.write(archive.readBuffer, 0, modulus); - } - - outPipe.flush(); // Do any good on a pipe? - } catch (IOException ioe) { - if (inPipe != null) { - inPipe.close(); - } - - throw ioe; - } finally { - try { - outPipe.close(); - } finally { - outPipe = null; // Encourage buffer GC - } - } - - return new PIFData(inPipe); - } - - protected void extractFile(TarEntryHeader header) - throws IOException, TarMalformatException { - - if (header.getDataSize() < 1) { - throw new TarMalformatException(RB.data_size_unknown.getString()); - } - - int readNow; - int readBlocks = (int) (header.getDataSize() / 512L); - int modulus = (int) (header.getDataSize() % 512L); - File newFile = header.generateFile(); - - if (!newFile.isAbsolute()) { - newFile = (extractBaseDir == null) ? newFile.getAbsoluteFile() - : new File(extractBaseDir, - newFile.getPath()); - } - - // newFile is definitively Absolutized at this point - File parentDir = newFile.getParentFile(); - - if (newFile.exists()) { - if (mode != TarReader.OVERWRITE_MODE) { - throw new IOException( - RB.extraction_exists.getString(newFile.getAbsolutePath())); - } - - if (!newFile.isFile()) { - throw new IOException( - RB.extraction_exists_notfile.getString( - newFile.getAbsolutePath())); - } - - // Better to let FileOutputStream creation zero it than to - // to newFile.delete(). - } - - if (parentDir.exists()) { - if (!parentDir.isDirectory()) { - throw new IOException( - RB.extraction_parent_not_dir.getString( - parentDir.getAbsolutePath())); - } - - if (!parentDir.canWrite()) { - throw new IOException( - RB.extraction_parent_not_writable.getString( - parentDir.getAbsolutePath())); - } - } else { - if (!parentDir.mkdirs()) { - throw new IOException( - RB.extraction_parent_mkfail.getString( - parentDir.getAbsolutePath())); - } - } - - int fileMode = header.getFileMode(); - FileOutputStream outStream = new FileOutputStream(newFile); - - try { - - // Don't know exactly why I am still able to write to the file - // after removing read and write privs from myself, but it does - // work. - newFile.setExecutable(false, false); - newFile.setReadable(false, false); - newFile.setWritable(false, false); - newFile.setExecutable(((fileMode & 0100) != 0), true); - newFile.setReadable((fileMode & 0400) != 0, true); - newFile.setWritable((fileMode & 0200) != 0, true); - - while (readBlocks > 0) { - readNow = (readBlocks > archive.getReadBufferBlocks()) - ? archive.getReadBufferBlocks() - : readBlocks; - - archive.readBlocks(readNow); - - readBlocks -= readNow; - - outStream.write(archive.readBuffer, 0, readNow * 512); - } - - if (modulus != 0) { - archive.readBlock(); - outStream.write(archive.readBuffer, 0, modulus); - } - - outStream.flush(); - } finally { - try { - outStream.close(); - } finally { - outStream = null; // Encourage buffer GC - } - } - - newFile.setLastModified(header.getModTime() * 1000); - - if (newFile.length() != header.getDataSize()) { - throw new IOException(RB.write_count_mismatch.getString( - Long.toString(header.getDataSize()), - newFile.getAbsolutePath(), - Long.toString(newFile.length()))); - } - } - - protected void skipFileData(TarEntryHeader header) - throws IOException, TarMalformatException { - - /* - * Some entry types which we don't support have 0 data size. - * If we just return here, the entry will just be skipped./ - */ - if (header.getDataSize() == 0) { - return; - } - - if (header.getDataSize() < 0) { - throw new TarMalformatException(RB.data_size_unknown.getString()); - } - - int skipNow; - int oddBlocks = (header.getDataSize() % 512L == 0L) ? 0 - : 1; - int skipBlocks = (int) (header.getDataSize() / 512L) + oddBlocks; - - while (skipBlocks > 0) { - skipNow = (skipBlocks > archive.getReadBufferBlocks()) - ? archive.getReadBufferBlocks() - : skipBlocks; - - archive.readBlocks(skipNow); - - skipBlocks -= skipNow; - } - } - - /** - * A Tar entry header constituted from a header block in a tar file. - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ - @SuppressWarnings("serial") - static protected class TarEntryHeader { - - static protected class MissingField extends Exception { - - private TarHeaderField field; - - public MissingField(TarHeaderField field) { - this.field = field; - } - - public String getMessage() { - return RB.header_field_missing.getString(field.toString()); - } - } - - protected SimpleDateFormat sdf = - new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - - /** - * @param rawHeader May be longer than 512 bytes, but the first 512 - * bytes MUST COMPRISE a raw tar entry header. - * - * @throws TarMalformatException if malformed - */ - public TarEntryHeader(byte[] rawHeader) throws TarMalformatException { - - this.rawHeader = rawHeader; - - Long expectedCheckSum = readInteger(TarHeaderField.checksum); - - try { - if (expectedCheckSum == null) { - throw new MissingField(TarHeaderField.checksum); - } - - long calculatedCheckSum = headerChecksum(); - - if (expectedCheckSum.longValue() != calculatedCheckSum) { - throw new TarMalformatException( - RB.checksum_mismatch.getString( - expectedCheckSum.toString(), - Long.toString(calculatedCheckSum))); - } - - path = readString(TarHeaderField.name); - - if (path == null) { - throw new MissingField(TarHeaderField.name); - } - - Long longObject = readInteger(TarHeaderField.mode); - - if (longObject == null) { - throw new MissingField(TarHeaderField.mode); - } - - fileMode = (int) longObject.longValue(); - longObject = readInteger(TarHeaderField.size); - - if (longObject != null) { - dataSize = longObject.longValue(); - } - - longObject = readInteger(TarHeaderField.mtime); - - if (longObject == null) { - throw new MissingField(TarHeaderField.mtime); - } - - modTime = longObject.longValue(); - } catch (MissingField mf) { - throw new TarMalformatException(mf.getMessage()); - } - - entryType = readChar(TarHeaderField.typeflag); - ownerName = readString(TarHeaderField.uname); - - String pathPrefix = readString(TarHeaderField.prefix); - - if (pathPrefix != null) { - path = pathPrefix + '/' + path; - } - - // We're not loading the "gname" field, since there is nothing at - // all that Java can do with it. - ustar = isUstar(); - } - - protected byte[] rawHeader; - /* CRITICALLY IMPORTANT: TO NOT USE rawHeader.length OR DEPEND ON - * THE LENGTH OF the rawHeader ARRAY! Use only the first 512 bytes! - */ - protected String path; - protected int fileMode; - protected long dataSize = -1; // In bytes - protected long modTime; - protected char entryType; - protected String ownerName; - protected boolean ustar; - - /** - * @return a new Absolutized File object generated from this - * TarEntryHeader. - */ - public File generateFile() { - - if (entryType != '\0' && entryType != '0') { - throw new IllegalStateException( - RB.create_only_normal.getString()); - } - - // Unfortunately, it does no good to set modification times or - // privileges here, since those settings have no effect on our - // new file until after is created by the FileOutputStream - // constructor. - return new File(path); - } - - public char getEntryType() { - return entryType; - } - - public String getPath() { - return path; - } - - /** - * Setter is needed in order to override header size setting for Pax. - * - * @param dataSize long - */ - public void setDataSize(long dataSize) { - this.dataSize = dataSize; - } - - public long getDataSize() { - return dataSize; - } - - public long getModTime() { - return modTime; - } - - public int getFileMode() { - return fileMode; - } - - /** - * Choosing not to report fields that we don't write (e.g. "gname"), - * but which would certainly be useful for a general Java tar client - * implementation. - * - *

    This design decision is subject to change. - * - * @return String - */ - public String toString() { - - StringBuilder sb = new StringBuilder( - sdf.format(Long.valueOf(modTime * 1000L)) + ' '); - - sb.append((entryType == '\0') ? ' ' - : entryType); - sb.append(ustar ? '*' - : ' '); - sb.append( - " " - + StringUtil.toPaddedString( - Integer.toOctalString(fileMode), 4, ' ', false) + ' ' - + StringUtil.toPaddedString( - Long.toString(dataSize), 11, ' ', false) + " "); - sb.append(StringUtil.toPaddedString(((ownerName == null) ? "-" - : ownerName), 8, - ' ', - true)); - sb.append(" " + path); - - return sb.toString(); - } - - /** - * Is this any UStar variant - * - * @throws TarMalformatException - * @return boolean - */ - public boolean isUstar() throws TarMalformatException { - - String magicString = readString(TarHeaderField.magic); - - return magicString != null && magicString.startsWith("ustar"); - } - - /** - * - * @return index based at 0 == from - * @param ba byte[] - * @param val byte - * @param from int - * @param to int - */ - public static int indexOf(byte[] ba, byte val, int from, int to) { - - for (int i = from; i < to; i++) { - if (ba[i] == val) { - return i - from; - } - } - - return -1; - } - - protected char readChar(TarHeaderField field) throws TarMalformatException { - - /* Depends on readString(int) contract that it will never return - * a 0-length String */ - String s = readString(field); - - return (s == null) ? '\0' - : s.charAt(0); - } - - /** - * - * @return null or String with {@code length() > 0}. - * @param field TarHeaderField - * @throws TarMalformatException - */ - protected String readString(TarHeaderField field) throws TarMalformatException { - - int start = field.getStart(); - int stop = field.getStop(); - int termIndex = TarEntryHeader.indexOf(rawHeader, (byte) 0, start, - stop); - - switch (termIndex) { - - case 0 : - return null; - - case -1 : - termIndex = stop - start; - break; - - default: - break; - } - - try { - return new String(rawHeader, start, termIndex); - } catch (Throwable t) { - - // Java API does not specify behavior if decoding fails. - throw new TarMalformatException( - RB.bad_header_value.getString(field.toString())); - } - } - - /** - * Integer as in positive whole number, which does not imply Java types - * of int or Integer. - * - * @param field TarHeaderField - * @throws TarMalformatException if malformed - * @return Long - */ - protected Long readInteger(TarHeaderField field) - throws TarMalformatException { - - String s = readString(field); - - if (s == null) { - return null; - } - - try { - return Long.valueOf(s, 8); - } catch (NumberFormatException nfe) { - throw new TarMalformatException( - RB.bad_numeric_header_value.getString( - field.toString(), nfe.toString())); - } - } - - protected long headerChecksum() { - - long sum = 0; - - for (int i = 0; i < 512; i++) { - boolean isInRange = - (i >= TarHeaderField.checksum.getStart() - && i < TarHeaderField.checksum.getStop()); - - // We ignore current contents of the checksum field so that - // this method will continue to work right, even if we later - // recycle the header or RE-calculate a header. - sum += isInRange ? 32 - : (255 & rawHeader[i]); - } - - return sum; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/TarReaderMain.java b/database/hsqldb/src/org/hsqldb/lib/tar/TarReaderMain.java deleted file mode 100644 index ced3cacc..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/TarReaderMain.java +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.lib.tar; - -import java.io.File; -import java.io.IOException; - -public class TarReaderMain { - - /** - * Reads a specified tar file or stdin in order to either list or extract - * the file tar entries, depending on the first argument being "t" or "x", - * using default read buffer blocks. - * - * @param sa arguments - * @throws IOException on access failure - * @throws TarMalformatException if malformed - */ - public static void main(String[] sa) - throws IOException, TarMalformatException { - - if (sa.length < 1) { - System.out.println( - RB.TarReader_syntax.getString(TarReader.class.getName())); - System.out.println(RB.listing_format.getString()); - System.exit(0); - } - - File exDir = (sa.length > 1 && sa[1].startsWith("--directory=")) - ? (new File(sa[1].substring("--directory=".length()))) - : null; - int firstPatInd = (exDir == null) ? 2 - : 3; - - if (sa.length < firstPatInd - || ((!sa[0].equals("t")) && !sa[0].equals("x"))) { - throw new IllegalArgumentException( - RB.tarreader_syntaxerr.getString(TarReader.class.getName())); - } - - String[] patternStrings = null; - - if (sa.length > firstPatInd) { - patternStrings = new String[sa.length - firstPatInd]; - - for (int i = firstPatInd; i < sa.length; i++) { - patternStrings[i - firstPatInd] = sa[i]; - } - } - - if (sa[0].equals("t") && exDir != null) { - throw new IllegalArgumentException(RB.dir_x_conflict.getString()); - } - - int dirIndex = (exDir == null) ? 1 - : 2; - int tarReaderMode = sa[0].equals("t") ? TarReader.LIST_MODE - : TarReader.EXTRACT_MODE; - - new TarReader(new File(sa[dirIndex]), tarReaderMode, patternStrings, - null, exDir).read(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/package-info.java b/database/hsqldb/src/org/hsqldb/lib/tar/package-info.java deleted file mode 100644 index 9a842574..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/package-info.java +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains the DbBackupMain class, for offline backing up HyperSQL databases.

    - * - * See - * the database offline backup section of the HyperSQL User Guide

    - * - * Also contains support classes for handling files in tar and pax format. - - */ -package org.hsqldb.lib.tar; diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb.properties b/database/hsqldb/src/org/hsqldb/lib/tar/rb.properties deleted file mode 100644 index 1f39910b..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb.properties +++ /dev/null @@ -1,97 +0,0 @@ -# $Id: rb.properties 3375 2009-12-18 23:27:07Z unsaved $ - -# Default Locale String resources for TarGenerator. - -# IMPORTANT: Make sure to use ISO-8859-1 encoding for any extended characters, -# both in this file (actually any .properties file) and all referenced text -# files. - -# GENERAL .properties SYNTAX: -# White space AT END OF LINES IS SIGNIFICANT -# White space at beginning of lines is not -# \ at very end of line makes the following line a continuation line (with -# no implied newline in the value. -# (Combined with the previous 2 rules, this means that white space before -# this \ is significant, and whitespace at beginning of continutation lines -# is not). -# \n does not work as an escape. Use unicode \u000a for line breaks instead. - -# This file is loaded by RefCapablePropertyResourceBundle, so if any -# property here has no value set, the value MUST be set in a file -# located at targenerator/PROPERTYNAME.text -# Property keys MAY NOT CONTAIN UNDERSCORE. Underscores in Enum constants -# will automatically be transated to dots. - -# These tell RefCapablePropertyResourceBundle to look for text files: -DbBackup.syntax= -TarGenerator.syntax= -TarReader.syntax= -listing.format= - -# Traditional inline .properties values: -DbBackup.syntaxerr=Syntax error. Run the following for help:\u000a \ - java -cp path/to/hsqldb.jar %{1} -pad.block.write=Padding archive with %{1} zero blocks -cleanup.rmfail=Failed to remove possibly corrupt archive: %{1} -unsupported.entry.present=\u000aArchive contains unsupported entry type(s).\u000a\ - We only support types ' ', '0', 'x' (entry type is shown in first column). -bpr.write=Will write at %{1} blocks-per-record -stream.buffer.report=Buffered %{1} bytes from given InputStream into RAM -write.queue.report=%{1} supplicants queued for writing... -file.missing=Required file is missing: %{1} -modified.property='modified' DB property is '%{1}' -file.disappeared='%{1}' disappeared after backup started -file.changed='%{1}' changed after backup started -file.appeared='%{1}' appeared after backup started -pif.malformat=Line %{1} of PIF Data is malformatted:\u000a%{2} -pif.malformat.size=PIF Data contains malformatted 'size' value: %{1} -zero.write=Refusing to write record with zero-length key or value -pif.toobig=Total key + val lengths exceeds our total supported max of %{1} -read.denied=User does not have privileges to read file: %{1} -compression.unknown=Unexpected compression type: %{1} -insufficient.read=Expected to read %{1} bytes, but could only read %{2} -decompression.ranout=Ran out of decompressed bytes after reading %{1} out of %{2} -move.work.file=Is somebody else writing to the same file? \ - If not, remove aborted work file: %{1} -cant.overwrite=You do not have privileges to overwrite '%{1}' -cant.write.dir=You do not have privileges to write in directory '%{1}' -no.parent.dir=No parent directory '%{1}' -bad.block.write.len=Specified block is %{1} bytes long instead of 512 -illegal.block.boundary=Current file length %{1} is not an even 512-byte-block multiple -workfile.delete.fail=Failed to delete work file '%{1}' -unsupported.ext=%{1} only generates files with extensions \ - '.tar', '.tgz.', or '.tar.gz': %{2} -dest.exists=Destination file already exists: %{1} -parent.not.dir=Parent node of specified file is not a directory: %{1} -cant.write.parent=Parent directory of specified file is not writable: {1} -parent.create.fail=Failed to create parent directory for tar file: %{1} -tar.field.toobig=Input too long for field %{1}: %{2} -missing.supp.path=Path required if existing component file not specified -nonfile.entry=This method intentionally creates TarEntries only for files -read.lt.1=Does not make sense to make an entry for < 1 byte -data.changed=Seems that the input data changed. Input data was %{1} bytes, \ - but we wrote %{2} bytes of data -unexpected.header.key=Unexpected Header key: %{1} -tarreader.syntaxerr=Run 'java -cp path/to/hsqldb.jar %{1}' for help -unsupported.mode=Sorry, mode not supported yet: %{1} -dir.x.conflict=The '--directory=' switch only makes sense with 'x' mode -pif.unknown.datasize=PIF Data size unknown -pif.data.toobig=PIF Data exceeds max supported size. %{1} > %{2} -data.size.unknown=Data size unknown -extraction.exists=Extracted file already exists: %{1} -extraction.exists.notfile=Node already exist but is not a file: %{1} -extraction.parent.not.dir=Parent node of extracted path is not a directory: %{1} -extraction.parent.not.writable=Parent directory of extracted path is not \ - writable: %{1} -extraction.parent.mkfail=Failed to create parent directory for extracted \ - file: %{1} -write.count.mismatch=Attempted to write %{1} bytes to '%{2}', but only wrote %{3} -header.field.missing=Required field '%{1}' missing in tar entry header. -checksum.mismatch=Corrupted tar entry header. Expected checksum %{1}, \ - but calculated %{2} -create.only.normal=At this time, we only support creation of normal files \ - from Tar entries -bad.header.value=Bad value in header for field %{1} -bad.numeric.header.value=Bad value in header for field %{1}: %{2}.\u000a\ - Header field could use 'binary number extension', which we don't \ - support.\u000aUse Pax Interchange Format instead for huge files. diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/DbBackup.syntax.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/DbBackup.syntax.text deleted file mode 100644 index b0e7d6ef..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/DbBackup.syntax.text +++ /dev/null @@ -1,16 +0,0 @@ -SYNTAX: - java -cp path/to/hsqldb.jar %{1} - (to display this message) -OR - java -cp path/to/hsqldb.jar %{1} --save \ - [--overwrite] tar/path.tar db/base/path -OR - java -cp path/to/hsqldb.jar %{1} --list \ - tar/path.tar [regex1...] -OR - java -cp path/to/hsqldb.jar %{1} --extract \ - [--overwrite] file/path.tar[.gz] db/dir [regex1...] - (extracts entry files to the specified db/dir). - -N.b. the db/base/path includes file base name, like in JDBC URLs, whereas -db/dir is a proper 'directory'. diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/DbBackup.syntax_de.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/DbBackup.syntax_de.text deleted file mode 100644 index 72cbfea5..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/DbBackup.syntax_de.text +++ /dev/null @@ -1,19 +0,0 @@ -SYNTAX: - java -cp Pfad/zur/hsqldb.jar %{1} - (um diese Meldung anzuzeigen) -ODER - java -cp Pfad/zur/hsqldb.jar %{1} --save \ - [--overwrite] tar/Pfad.tar DB-Wurzel-Pfad -ODER - java -cp Pfad/zur/hsqldb.jar %{1} --list \ - tar/Pfad.tar [regex1...] -ODER - java -cp path/to/hsqldb.jar %{1} --extract \ - [--overwrite] Datei/Pfad.tar[.gz] DB/Verz. [regex1...] - (entpackt die enthaltenen Dateien in die angegebene DB/das angegebene Verzeichnis). - -Bitte beachten: -#N.b. the db/base/path includes file base name, like in JDBC URLs, whereas -#db/dir is a proper 'directory'. -Der DB-Wurzel-Pfad beinhaltet auch das Wurzelverzeichnis der Datei, -wie bei JDBC-URLs, wo das DB/Verz. eine normales Verzeichnis ist. diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarGenerator.syntax.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarGenerator.syntax.text deleted file mode 100644 index 0fa01ed5..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarGenerator.syntax.text +++ /dev/null @@ -1,3 +0,0 @@ -SYNTAX: java -cp %{1} new.tar [entryFile1...] -If no entryFiles are specified, stdin will be read to write an entry with -name 'stdin'. In this latter case, input is limited to 10240 bytes. diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarGenerator.syntax_de.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarGenerator.syntax_de.text deleted file mode 100644 index 8902e2cb..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarGenerator.syntax_de.text +++ /dev/null @@ -1,3 +0,0 @@ -SYNTAX: java -cp %{1} neu.tar [Dateieintrag1...] -Wenn keine Dateien angegeben wurden, dann wird von stdin gelesen um einen Eintrag -mit dem Namen 'stdin' zu speichern. Bei letzteren ist die Eingabegre auf 10240 Bytes begrenzt. diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarReader.syntax.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarReader.syntax.text deleted file mode 100644 index f1064826..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarReader.syntax.text +++ /dev/null @@ -1,7 +0,0 @@ -SYNTAX: java -cp path/to/hsqldb.jar %{1} {t|x} \ - [--directory=path] file/path/tar[.gz] [regex1...] -where - t: Table-of-content mode (like "tar -t...") - x: Extract mode (like "tar -x...") - path: Base extraction directory for relative entries - regex*: Pattern(s) which narrow entries listed or extracted diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarReader.syntax_de.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarReader.syntax_de.text deleted file mode 100644 index 03dd1d04..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/TarReader.syntax_de.text +++ /dev/null @@ -1,7 +0,0 @@ -SYNTAX: java -cp Pfad/zur/hsqldb.jar %{1} {t|x} \ - [--directory=Pfad] Pfad/zur/Datei/tar[.gz] [regex1...] -wobei - t: Anzeigen einer Tabelle mit den Eintrgen (wie "tar -t...") - x: Entpacken-Modus (wie "tar -x...") - Pfad: Basisverzeichnis zum Entpacken der relativen Archiveintrge - regex*: Muster, welche die darauf passenden Eintrge auflistet oder entpackt diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/listing.format.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/listing.format.text deleted file mode 100644 index 484201e1..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/listing.format.text +++ /dev/null @@ -1,4 +0,0 @@ -LISTING FORMAT: -modification_time__ tu mode file_size_ owner___ filepath - t = Tar entry type - u = '*' for UStar-compliant entry diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb/listing.format_de.text b/database/hsqldb/src/org/hsqldb/lib/tar/rb/listing.format_de.text deleted file mode 100644 index f4f99f5a..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb/listing.format_de.text +++ /dev/null @@ -1,4 +0,0 @@ -ANZEIGE FORMAT: -nderungszeit__ tu Modus Dateigre_ Besitzer___ Dateipfad - t = Tar entry type - u = '*' fr UStar-kompatible entry diff --git a/database/hsqldb/src/org/hsqldb/lib/tar/rb_de.properties b/database/hsqldb/src/org/hsqldb/lib/tar/rb_de.properties deleted file mode 100644 index cb2e7c53..00000000 --- a/database/hsqldb/src/org/hsqldb/lib/tar/rb_de.properties +++ /dev/null @@ -1,95 +0,0 @@ -# $Id: rb_de.properties 3375 2009-12-18 23:27:07Z unsaved $ - -# Default Locale String resources for TarGenerator. - -# IMPORTANT: Make sure to use ISO-8859-1 encoding for any extended characters, -# both in this file (actually any .properties file) and all referenced text -# files. - -# GENERAL .properties SYNTAX: -# White space AT END OF LINES IS SIGNIFICANT -# White space at beginning of lines is not -# \ at very end of line makes the following line a continuation line (with -# no implied newline in the value. -# (Combined with the previous 2 rules, this means that white space before -# this \ is significant, and whitespace at beginning of continutation lines -# is not). -# \n does not work as an escape. Use unicode \u000a for line breaks instead. - -# This file is loaded by RefCapablePropertyResourceBundle, so if any -# property here has no value set, the value MUST be set in a file -# located at targenerator/PROPERTYNAME.text -# Property keys MAY NOT CONTAIN UNDERSCORE. Underscores in Enum constants -# will automatically be transated to dots. - -# These tell RefCapablePropertyResourceBundle to look for text files: -DbBackup.syntax= -TarGenerator.syntax= -TarReader.syntax= -listing.format= - -# Traditional inline .properties values: -DbBackup.syntaxerr=Syntax-Fehler. Geben Sie fr Hilfe folgendes ein:\u000a \ - java -cp pfad/zur/hsqldb.jar %{1} -pad.block.write=Flle das Archive mit %{1} Null-Blcken auf. -cleanup.rmfail=Fehler beim Lschen eines wahrscheinlich beschdigten Archives: %{1} -unsupported.entry.present=\u000aDas Archive beinhaltet nicht untersttzte Typen von Eintrgen.\u000a\ - Wir untersttzen nur folgende Typen ' ', '0', 'x' (Eintragstyp wird in der ersten Spalte angezeigt). -bpr.write=Schreibe %{1} Blcke pro Datensatz. -stream.buffer.report=Puffere %{1} Bytes aus dem Eingabestrom im Arbeitsspeicher. -write.queue.report=%{1} Elemente zum Schreiben in der Warteschlange... -file.missing=Bentigte Datei wird vermisst: %{1} -modified.property='genderte' DB-Einstellung ist '%{1}' -file.disappeared='%{1}' verschwunden seit dem Start des Backup. -file.changed='%{1}' verndert seit dem Start des Backup. -file.appeared='%{1}' neue seit dem Start des Backup. -pif.malformat=Zeile %{1} der PIF-Daten ist fehlerhaft:\u000a%{2} -pif.malformat.size=PIF-Daten beinhalten einen fehlerhaften 'size'-Wert: %{1} -zero.write=Das schreiben eines Datensatzes mit leerem Schlssel (Key) oder Wert (value) wird verweigert. -pif.toobig=Die Gesamtlnge von Schlssel und Wert berschreitet das untersttzte Maximum von %{1} -read.denied=Der Benutzer hat keine ausreichenden Rechte zum Lesen der Datei: %{1} -compression.unknown=Unerwartetes Kompressionsverfahren: %{1} -insufficient.read=Erwartete %{1} Bytes zum Lesen, konnte aber nur %{2} einlesen -decompression.ranout=Dekomprimierte Bytes sind ausgegangen, nach dem dem Lesen von %{1} aus %{2} Bytes. -move.work.file=Versucht jemand anderes in dieselbe Datei zu schreiben? \ - Wenn nicht, lschen Sie bitte die Datei, bei der die Arbeit unterbrochen wurde: %{1} -cant.overwrite=Sie haben keine Rechte zum berschreiben von '%{1}' -cant.write.dir=Sie haben keine Rechte um in das Verzeichnis '%{1}' zu schreiben. -no.parent.dir=Kein bergeordnetes Verzeichnis '%{1}' -bad.block.write.len=Angegebener Block ist %{1} Bytes lang, statt 512 -illegal.block.boundary=Die Lnge %{1} der aktuellen Datei ist kein genaues Vielfaches eines 512-Byte-Block. -workfile.delete.fail=Fehler beim Lschen der Arbeitsdatei '%{1}' -unsupported.ext=Erzeuge nur %{1} Dateien mit den Erweiterungen \ - '.tar', '.tgz.', or '.tar.gz': %{2} -dest.exists=Zieldatei existiert bereits: %{1} -parent.not.dir=Der bergeordnete Knotenpunkt der angegebenen Datei ist kein Verzeichnis: %{1} -cant.write.parent=Das bergeordnete Verzeichnis der angegebenen Datei ist nicht beschreibbar: {1} -parent.create.fail=Fehler beim Erstellen des bergeordneten Verzeichnises fr die TAR-Datei: %{1} -tar.field.toobig=Eingabe zu lang fr das Feld %{1}: %{2} -missing.supp.path=Pfad wird bentigt, wenn dieser bei der Datei nicht angegeben wurde. -nonfile.entry=Diese Methode erzeugt absichtlich TAR-Eintrge nur fr Dateien. -read.lt.1=Es macht keinen Sinn einen Eintrag zu erzeugen, fr weniger als einen Byte. -data.changed=Scheint das sich die Eingabedaten gendert haben. Eingabedaten bestanden aus %{1} Bytes, \ - geschrieben wurden aber Daten mit %{2} Bytes. -unexpected.header.key=Unerwarteter Kopfschlssel (Header key): %{1} -tarreader.syntaxerr=Geben Sie 'java -cp pfad/zur/hsqldb.jar %{1}' ein fr die Hilfe -unsupported.mode=Entschuldigung, dieser Modus wird noch nicht untersttzt: %{1} -dir.x.conflict=Der Schalter '--directory=' macht nur in Verbindung mit dem 'x'-Modus Sinn -pif.unknown.datasize=PIF-Datengre ist unbekannt. -pif.data.toobig=PIF-Daten berschreiben die maximal untersttzte Gre %{1} > %{2} -data.size.unknown=Datengre unbekannt -extraction.exists=Entpackte Dateien existieren bereits: %{1} -extraction.exists.notfile=Der Knotenpunkt (Node) existert bereits, er ist aber keine Datei: %{1} -extraction.parent.not.dir=Der bergeordnete Knotenpunkt (Parent node) des entpackten Pfades ist kein Verzeichnis: %{1} -extraction.parent.not.writable=Das bergeordnete Verzeichnis des entpackten Pfades ist nicht beschreibbar: %{1} -extraction.parent.mkfail=Fehler beim erzeugen des bergeordneten Verzeichnises fr die entpackten Dateien: %{1} -write.count.mismatch=Versuchte %{1} Bytes nach '%{2}' zu schreiben, konnte aber nur %{3} schreiben -header.field.missing=Vorgeschriebenes Feld '%{1}' fehlt im TAR-Kopfzeileneintrag (tar entry header). -checksum.mismatch=Beschdigter TAR-Kopfzeileneintrag (tar entry header). Erwartete Prfsumme %{1}, \ - berechnete ist aber %{2} -create.only.normal=Zu diesem Zeitpunkt untersttzen wir nur die Erzeugung normaler Dateien \ - aus TAR-Eintrgen -bad.header.value=Falscher Wert im Kopfzeilenfeld %{1} -bad.numeric.header.value=Falscher Wert im Kopfzeilenfeld %{1}: %{2}.\u000a\ - Kopfzeilenfeld kann 'binary number extension' verwenden, welche wir aber nicht untersttzen \ - \u000aVerwenden Sie das Pax-Interchange-Format anstellen von sehr groen Dateien. diff --git a/database/hsqldb/src/org/hsqldb/map/BaseHashMap.java b/database/hsqldb/src/org/hsqldb/map/BaseHashMap.java deleted file mode 100644 index 5a59d90f..00000000 --- a/database/hsqldb/src/org/hsqldb/map/BaseHashMap.java +++ /dev/null @@ -1,2058 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.map; - -import java.lang.reflect.Array; -import java.util.Arrays; -import java.util.NoSuchElementException; -import java.util.concurrent.atomic.AtomicInteger; - -import org.hsqldb.lib.ArrayCounter; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.ObjectComparator; -import org.hsqldb.lib.PrimitiveIterator; - -/** - * Base class for hash tables or sets. The exact type of the structure is - * defined by the constructor. Each instance has at least a keyTable array - * and a HashIndex instance for looking up the keys into this table. Instances - * that are maps also have a valueTable the same size as the keyTable. - * - * Special getOrAddXXX() methods are used for object maps in some subclasses. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class BaseHashMap { - -/* - - data store: - keys: {array of primitive | array of object} - values: {none | array of primitive | array of object} same size as keys - objects support : hashCode(), equals() - - implemented types of keyTable: - {objectKeyTable: variable size Object[] array for keys | - intKeyTable: variable size int[] for keys | - longKeyTable: variable size long[] for keys } - - implemented types of valueTable: - {objectValueTable: variable size Object[] array for values | - intValueTable: variable size int[] for values | - longValueTable: variable size long[] for values} - - valueTable does not exist for sets or for object pools - - hash index: - hashTable: fixed size int[] array for hash lookup into keyTable - linkTable: pointer to the next key ; size equal or larger than hashTable - but equal to the valueTable - - access count table: - {none | - variable size int[] array for access count} same size as xxxKeyTable -*/ - - // - protected boolean isIntKey; - protected boolean isLongKey; - protected boolean isObjectKey; - protected boolean isNoValue; - protected boolean isIntValue; - protected boolean isLongValue; - protected boolean isObjectValue; - protected boolean isMultiValue; - protected boolean isTwoObjectValue; - protected boolean isList; - protected boolean isAccessCount; - protected boolean isLastAccessCount; - - // - protected HashIndex hashIndex; - - // - protected int[] intKeyTable; - protected Object[] objectKeyTable; - protected long[] longKeyTable; - - // - protected int[] intValueTable; - protected Object[] objectValueTable; - protected long[] longValueTable; - - // - protected int accessMin; - protected AtomicInteger accessCount; - protected int[] accessTable; - protected Object[] objectValueTable2; - - // - protected final float loadFactor; - protected final int initialCapacity; - protected int threshold; - protected int maxCapacity; - protected int purgePolicy = NO_PURGE; - protected boolean minimizeOnEmpty; - protected ObjectComparator comparator = ObjectComparator.defaultComparator; - - // - protected boolean hasZeroKey; - protected int zeroKeyIndex = -1; - protected int zeroOrNullValueCount; - - // keyOrValueTypes - protected static final int noKeyOrValue = 0; - protected static final int intKeyOrValue = 1; - protected static final int longKeyOrValue = 2; - protected static final int objectKeyOrValue = 3; - - // purgePolicy - protected static final int NO_PURGE = 0; - protected static final int PURGE_ALL = 1; - protected static final int PURGE_HALF = 2; - - // - public static final int ACCESS_MAX = Integer.MAX_VALUE - (1 << 20); - public static final Object[] emptyObjectArray = new Object[]{}; - - protected BaseHashMap(int initialCapacity, int keyType, int valueType, - boolean hasAccessCount) - throws IllegalArgumentException { - - if (initialCapacity <= 0) { - throw new IllegalArgumentException(); - } - - if (initialCapacity < 4) { - initialCapacity = 4; - } else { - initialCapacity = (int) ArrayUtil.getBinaryNormalisedCeiling(initialCapacity); - } - - this.loadFactor = 1; // can use any value if necessary - this.initialCapacity = initialCapacity; - threshold = initialCapacity; - - int hashtablesize = (int) (initialCapacity * loadFactor); - - if (hashtablesize < 4) { - hashtablesize = 4; - } - - hashIndex = new HashIndex(hashtablesize, initialCapacity, true); - - int arraySize = threshold; - - if (keyType == BaseHashMap.intKeyOrValue) { - isIntKey = true; - intKeyTable = new int[arraySize]; - } else if (keyType == BaseHashMap.objectKeyOrValue) { - isObjectKey = true; - objectKeyTable = new Object[arraySize]; - } else { - isLongKey = true; - longKeyTable = new long[arraySize]; - } - - if (valueType == BaseHashMap.intKeyOrValue) { - isIntValue = true; - intValueTable = new int[arraySize]; - } else if (valueType == BaseHashMap.objectKeyOrValue) { - isObjectValue = true; - objectValueTable = new Object[arraySize]; - } else if (valueType == BaseHashMap.longKeyOrValue) { - isLongValue = true; - longValueTable = new long[arraySize]; - } else { - isNoValue = true; - } - - isLastAccessCount = hasAccessCount; - - if (hasAccessCount) { - accessTable = new int[arraySize]; - accessCount = new AtomicInteger(); - } - } - - protected int getLookup(Object key) { - - int hash = comparator.hashCode(key); - int lookup = hashIndex.getLookup(hash); - - for (; lookup >= 0; lookup = hashIndex.getNextLookup(lookup)) { - Object current = objectKeyTable[lookup]; - - if (comparator.equals(key, current)) { - break; - } - } - - return lookup; - } - - protected int getLookup(Object key, int hash) { - - int lookup = hashIndex.getLookup(hash); - - for (; lookup >= 0; lookup = hashIndex.getNextLookup(lookup)) { - Object current = objectKeyTable[lookup]; - - if (comparator.equals(key, current)) { - break; - } - } - - return lookup; - } - - protected int getLookup(int key) { - - int hash = (int) ((long) key >>> 32 ^ key); - int lookup = hashIndex.getLookup(hash); - - for (; lookup >= 0; lookup = hashIndex.getNextLookup(lookup)) { - int current = intKeyTable[lookup]; - - if (key == current) { - break; - } - } - - return lookup; - } - - protected int getLookup(long key) { - - int hash = (int) (key >>> 32 ^ key); - int lookup = hashIndex.getLookup(hash); - - for (; lookup >= 0; lookup = hashIndex.getNextLookup(lookup)) { - long current = longKeyTable[lookup]; - - if (key == current) { - break; - } - } - - return lookup; - } - - protected int getObjectLookup(long key) { - - int hash = (int) (key >>> 32 ^ key); - int lookup = hashIndex.getLookup(hash); - long tempKey; - - for (; lookup >= 0; lookup = hashIndex.getNextLookup(lookup)) { - tempKey = comparator.longKey(objectKeyTable[lookup]); - - if (tempKey == key) { - break; - } - } - - return lookup; - } - - protected PrimitiveIterator getMultiValuesIterator(Object key) { - - int lookup = getLookup(key); - ValueCollectionIterator valuesIterator = - new ValueCollectionIterator(key, lookup); - - return valuesIterator; - } - - protected int multiValueElementCount(Object key) { - - int lookup = getLookup(key); - - if (lookup == -1) { - return 0; - } - - int count = 1; - - while (true) { - lookup = BaseHashMap.this.hashIndex.getNextLookup(lookup); - - if (lookup == -1) { - break; - } - - if (BaseHashMap.this.objectKeyTable[lookup].equals(key)) { - count++; - } else { - break; - } - } - - return count; - } - - protected int multiValueKeyCount() { - - int count = 0; - int lookup = -1; - Object oldKey = null; - - for (int index = 0; index < hashIndex.hashTable.length; ) { - if (hashIndex.hashTable[index] < 0) { - index++; - - continue; - } - - if (lookup < 0) { - lookup = hashIndex.hashTable[index]; - } else { - lookup = hashIndex.getNextLookup(lookup); - } - - if (lookup < 0) { - index++; - - continue; - } - - if (!comparator.equals(oldKey, objectKeyTable[lookup])) { - oldKey = objectKeyTable[lookup]; - - count++; - } - } - - return count; - } - - /** - * generic method for adding keys and values or updating values - * - * returns existing Object value if any or null - * - * returns - */ - protected Object addOrUpdate(long longKey, long longValue, - Object objectKey, Object objectValue) { - - int hash; - - if (isObjectKey) { - if (objectKey == null) { - return null; - } - - hash = comparator.hashCode(objectKey); - } else { - hash = (int) (longKey >>> 32 ^ longKey); - } - - int index = hashIndex.getHashIndex(hash); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - Object returnValue = null; - boolean matched = false; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - if (isObjectKey) { - matched = comparator.equals(objectKeyTable[lookup], objectKey); - } else if (isIntKey) { - matched = longKey == intKeyTable[lookup]; - } else if (isLongKey) { - matched = longKey == longKeyTable[lookup]; - } - - if (matched) { - break; - } - } - - if (matched) { - if (isNoValue) { - return Boolean.FALSE; - } else if (isObjectValue) { - returnValue = objectValueTable[lookup]; - objectValueTable[lookup] = objectValue; - - if (objectValue == null) { - if (returnValue != null) { - zeroOrNullValueCount++; - } - } else { - if (returnValue == null) { - zeroOrNullValueCount--; - } - } - } else if (isIntValue) { - int existing = intValueTable[lookup]; - - returnValue = existing; - intValueTable[lookup] = (int) longValue; - - if (longValue == 0) { - if (existing != 0) { - zeroOrNullValueCount++; - } - } else { - if (existing == 0) { - zeroOrNullValueCount--; - } - } - } else if (isLongValue) { - long existing = longValueTable[lookup]; - - returnValue = existing; - longValueTable[lookup] = longValue; - - if (longValue == 0) { - if (existing != 0) { - zeroOrNullValueCount++; - } - } else { - if (existing == 0) { - zeroOrNullValueCount--; - } - } - } - - if (isLastAccessCount) { - accessTable[lookup] = accessCount.incrementAndGet(); - } else if (isAccessCount) { - accessTable[lookup]++; - } - - return returnValue; - } - - if (hashIndex.elementCount >= threshold) { - if (reset()) { - return addOrUpdate(longKey, longValue, objectKey, objectValue); - } else { - throw new NoSuchElementException("BaseHashMap"); - } - } - - lookup = hashIndex.linkNode(index, lastLookup); - - if (isObjectKey) { - objectKeyTable[lookup] = objectKey; - } else if (isIntKey) { - intKeyTable[lookup] = (int) longKey; - - if (longKey == 0) { - hasZeroKey = true; - zeroKeyIndex = lookup; - } - } else if (isLongKey) { - longKeyTable[lookup] = longKey; - - if (longKey == 0) { - hasZeroKey = true; - zeroKeyIndex = lookup; - } - } - - if (isNoValue) { - return Boolean.TRUE; - } else if (isObjectValue) { - objectValueTable[lookup] = objectValue; - - if (objectValue == null) { - zeroOrNullValueCount++; - } - } else if (isIntValue) { - intValueTable[lookup] = (int) longValue; - - if (longValue == 0) { - zeroOrNullValueCount++; - } - } else if (isLongValue) { - longValueTable[lookup] = longValue; - - if (longValue == 0) { - zeroOrNullValueCount++; - } - } - - // - if (isLastAccessCount) { - accessTable[lookup] = accessCount.incrementAndGet(); - } else if (isAccessCount) { - accessTable[lookup] = 1; - } - - return returnValue; - } - - /** - * generic method for removing keys - * - * returns existing Object value if any (or Object key if this is a set) - */ - protected Object remove(long longKey, long longValue, Object objectKey, - Object objectValue, boolean matchValue, - boolean removeRow) { - - int hash; - - if (isObjectKey) { - if (objectKey == null) { - return null; - } - - hash = comparator.hashCode(objectKey); - } else { - hash = (int) (longKey >>> 32 ^ longKey); - } - - int index = hashIndex.getHashIndex(hash); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - Object returnValue = null; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - boolean matched = false; - - if (isObjectKey) { - matched = comparator.equals(objectKeyTable[lookup], objectKey); - } else if (isIntKey) { - matched = longKey == intKeyTable[lookup]; - } else if (isLongKey) { - matched = longKey == longKeyTable[lookup]; - } - - if (matched) { - if (matchValue) { - if (isObjectValue) { - matched = ObjectComparator.defaultComparator.equals( - objectValueTable[lookup], objectValue); - } else if (isIntValue) { - matched = intValueTable[lookup] == longValue; - } else if (isLongKey) { - matched = longValueTable[lookup] == longValue; - } - - if (!matched) { - return null; - } - } - - break; - } - } - - if (lookup < 0) { - if (isNoValue) { - return Boolean.FALSE; - } - - return null; - } - - if (isObjectKey) { - objectKeyTable[lookup] = null; - } else { - if (longKey == 0) { - hasZeroKey = false; - zeroKeyIndex = -1; - } - - if (isIntKey) { - intKeyTable[lookup] = 0; - } else { - longKeyTable[lookup] = 0; - } - } - - if (isNoValue) { - returnValue = Boolean.TRUE; - } else if (isObjectValue) { - returnValue = objectValueTable[lookup]; - objectValueTable[lookup] = null; - - if (returnValue == null) { - zeroOrNullValueCount--; - } - } else if (isIntValue) { - int existing = intValueTable[lookup]; - - returnValue = existing; - intValueTable[lookup] = 0; - - if (existing == 0) { - zeroOrNullValueCount--; - } - } else if (isLongValue) { - long existing = longValueTable[lookup]; - - returnValue = existing; - longValueTable[lookup] = 0; - - if (existing == 0) { - zeroOrNullValueCount--; - } - } - - hashIndex.unlinkNode(index, lastLookup, lookup); - - if (accessTable != null) { - accessTable[lookup] = 0; - } - - if (isList && removeRow) { - removeRow(lookup); - } - - if (minimizeOnEmpty && hashIndex.elementCount == 0) { - rehash(initialCapacity); - } - - return returnValue; - } - - /** - * Single method for adding key / values in multi-value maps. - * Values for each key are clustered. - */ - protected boolean addMultiVal(long longKey, long longValue, - Object objectKey, Object objectValue) { - - int hash; - - if (isObjectKey) { - if (objectKey == null) { - return false; - } - - hash = comparator.hashCode(objectKey); - } else { - hash = (int) (longKey >>> 32 ^ longKey); - } - - int index = hashIndex.getHashIndex(hash); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - int matchedKey = -1; - boolean matched = false; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - if (isObjectKey) { - matched = comparator.equals(objectKeyTable[lookup], objectKey); - } else if (isIntKey) { - matched = longKey == intKeyTable[lookup]; - } else if (isLongKey) { - matched = longKey == longKeyTable[lookup]; - } - - if (matched) { - matchedKey = lookup; - } else { - if (matchedKey < 0) { - continue; - } else { - break; - } - } - - if (isObjectValue) { - matched = ObjectComparator.defaultComparator.equals( - objectValueTable[lookup], objectValue); - } else if (isIntValue) { - matched = longValue == intValueTable[lookup]; - } else if (isLongValue) { - matched = longValue == longValueTable[lookup]; - } - - if (matched) { - return false; - } - } - - if (hashIndex.elementCount >= threshold) { - if (reset()) { - return addMultiVal(longKey, longValue, objectKey, objectValue); - } else { - throw new NoSuchElementException("BaseHashMap"); - } - } - - lookup = hashIndex.linkNode(index, lastLookup); - - // type dependent block - if (isObjectKey) { - objectKeyTable[lookup] = objectKey; - } else if (isIntKey) { - intKeyTable[lookup] = (int) longKey; - - if (longKey == 0) { - hasZeroKey = true; - zeroKeyIndex = lookup; - } - } else if (isLongKey) { - longKeyTable[lookup] = longKey; - - if (longKey == 0) { - hasZeroKey = true; - zeroKeyIndex = lookup; - } - } - - if (isObjectValue) { - objectValueTable[lookup] = objectValue; - - if (objectValue == null) { - zeroOrNullValueCount++; - } - } else if (isIntValue) { - intValueTable[lookup] = (int) longValue; - - if (longValue == 0) { - zeroOrNullValueCount++; - } - } else if (isLongValue) { - longValueTable[lookup] = longValue; - - if (longValue == 0) { - zeroOrNullValueCount++; - } - } - - if (isLastAccessCount) { - accessTable[lookup] = accessCount.incrementAndGet(); - } else if (isAccessCount) { - accessTable[lookup] = 1; - } - - return true; - } - - /** - * Single method for removing key / values in multi-value maps. - */ - protected Object removeMultiVal(long longKey, long longValue, - Object objectKey, Object objectValue, - boolean matchValue) { - - if (objectKey == null) { - return null; - } - - int hash = comparator.hashCode(objectKey); - int index = hashIndex.getHashIndex(hash); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - int matchedKey = -1; - Object returnValue = null; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - boolean matched = false; - - if (isObjectKey) { - matched = comparator.equals(objectKeyTable[lookup], objectKey); - - if (matched) { - matchedKey = lookup; - } else { - if (matchedKey < 0) { - continue; - } else { - break; - } - } - - if (matchValue) { - matched = ObjectComparator.defaultComparator.equals( - objectValueTable[lookup], objectValue); - - if (matched) { - objectKeyTable[lookup] = null; - returnValue = objectValueTable[lookup]; - objectValueTable[lookup] = null; - - if (returnValue == null) { - zeroOrNullValueCount--; - } - - hashIndex.unlinkNode(index, lastLookup, lookup); - - return returnValue; - } else { - continue; - } - } else { - objectKeyTable[lookup] = null; - returnValue = objectValueTable[lookup]; - objectValueTable[lookup] = null; - - if (returnValue == null) { - zeroOrNullValueCount--; - } - - if (lastLookup > lookup) { - lastLookup = lastLookup; - } - - hashIndex.unlinkNode(index, lastLookup, lookup); - - if (lastLookup < 0) { - lookup = hashIndex.hashTable[index]; - - if (lookup < 0) { - break; - } - } else { - lookup = lastLookup; - } - } - } - } - - return returnValue; - } - - /** - * type specific method for Object sets or Object to Object maps - */ - protected Object removeObject(Object objectKey, boolean removeRow) { - - if (objectKey == null) { - return null; - } - - int hash = comparator.hashCode(objectKey); - int index = hashIndex.getHashIndex(hash); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - Object returnValue = null; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - if (!comparator.equals(objectKeyTable[lookup], objectKey)) { - continue; - } - - returnValue = objectKeyTable[lookup]; - objectKeyTable[lookup] = null; - - if (accessTable != null) { - accessTable[lookup] = 0; - } - - hashIndex.unlinkNode(index, lastLookup, lookup); - - if (isObjectValue) { - returnValue = objectValueTable[lookup]; - objectValueTable[lookup] = null; - } - - if (removeRow) { - removeRow(lookup); - } - - return returnValue; - } - - // not found - return returnValue; - } - - /** - * For object sets using long key attribute of object for equality and - * hash. Used in org.hsqldb.persist.Cache - */ - protected Object addOrRemoveObject(long longKey, Object object, - boolean remove) { - - int hash = (int) (longKey >>> 32 ^ longKey); - int index = hashIndex.getHashIndex(hash); - int lookup = hashIndex.getLookup(hash); - int lastLookup = -1; - Object returnValue = null; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - if (comparator.longKey(objectKeyTable[lookup]) == longKey) { - returnValue = objectKeyTable[lookup]; - - break; - } - } - - if (lookup >= 0) { - if (remove) { - objectKeyTable[lookup] = null; - - hashIndex.unlinkNode(index, lastLookup, lookup); - - if (accessTable != null) { - accessTable[lookup] = 0; - } - - if (minimizeOnEmpty && hashIndex.elementCount == 0) { - rehash(initialCapacity); - } - } else { - objectKeyTable[lookup] = object; - - if (isLastAccessCount) { - accessTable[lookup] = accessCount.incrementAndGet(); - } else if (isAccessCount) { - accessTable[lookup]++; - } - } - - return returnValue; - } else if (remove) { - return null; - } - - if (hashIndex.elementCount >= threshold) { - if (reset()) { - return addOrRemoveObject(longKey, object, remove); - } else { - throw new NoSuchElementException("BaseHashMap"); - } - } - - lookup = hashIndex.linkNode(index, lastLookup); - objectKeyTable[lookup] = object; - - if (isLastAccessCount) { - accessTable[lookup] = accessCount.incrementAndGet(); - } else if (isAccessCount) { - accessTable[lookup] = 1; - } - - return returnValue; - } - - protected boolean reset() { - - if (maxCapacity == 0 || maxCapacity > threshold) { - rehash(hashIndex.linkTable.length * 2); - - return true; - } - - switch (purgePolicy) { - - case PURGE_ALL : - clear(); - - return true; - - case PURGE_HALF : - clearToHalf(); - - return true; - - case NO_PURGE : - default : - return false; - } - } - - /** - * rehash uses existing key and element arrays. key / value pairs are - * put back into the arrays from the top, removing any gaps. any redundant - * key / value pairs duplicated at the end of the array are then cleared. - * - * newCapacity must be larger or equal to existing number of elements. - */ - protected void rehash(int newCapacity) { - - int limitLookup = hashIndex.newNodePointer; - boolean oldZeroKey = hasZeroKey; - int oldZeroKeyIndex = zeroKeyIndex; - - if (newCapacity < hashIndex.elementCount) { - return; - } - - hashIndex.reset((int) (newCapacity * loadFactor), newCapacity); - - hasZeroKey = false; - zeroKeyIndex = -1; - zeroOrNullValueCount = 0; - threshold = newCapacity; - - for (int lookup = -1; - (lookup = nextLookup(lookup, limitLookup, oldZeroKey, oldZeroKeyIndex)) - < limitLookup; ) { - long longKey = 0; - long longValue = 0; - Object objectKey = null; - Object objectValue = null; - - if (isObjectKey) { - objectKey = objectKeyTable[lookup]; - } else if (isIntKey) { - longKey = intKeyTable[lookup]; - } else { - longKey = longKeyTable[lookup]; - } - - if (isObjectValue) { - objectValue = objectValueTable[lookup]; - } else if (isIntValue) { - longValue = intValueTable[lookup]; - } else if (isLongValue) { - longValue = longValueTable[lookup]; - } - - if (isMultiValue) { - addMultiVal(longKey, longValue, objectKey, objectValue); - } else { - addOrUpdate(longKey, longValue, objectKey, objectValue); - } - - if (accessTable != null) { - accessTable[hashIndex.elementCount - 1] = accessTable[lookup]; - } - } - - resizeElementArrays(hashIndex.newNodePointer, newCapacity); - } - - /** - * resize the arrays containing the key / value data - */ - private void resizeElementArrays(int dataLength, int newLength) { - - Object temp; - int usedLength = newLength > dataLength ? dataLength - : newLength; - - if (isIntKey) { - temp = intKeyTable; - intKeyTable = new int[newLength]; - - System.arraycopy(temp, 0, intKeyTable, 0, usedLength); - } - - if (isIntValue) { - temp = intValueTable; - intValueTable = new int[newLength]; - - System.arraycopy(temp, 0, intValueTable, 0, usedLength); - } - - if (isLongKey) { - temp = longKeyTable; - longKeyTable = new long[newLength]; - - System.arraycopy(temp, 0, longKeyTable, 0, usedLength); - } - - if (isLongValue) { - temp = longValueTable; - longValueTable = new long[newLength]; - - System.arraycopy(temp, 0, longValueTable, 0, usedLength); - } - - if (objectKeyTable != null) { - temp = objectKeyTable; - objectKeyTable = new Object[newLength]; - - System.arraycopy(temp, 0, objectKeyTable, 0, usedLength); - } - - if (isObjectValue) { - temp = objectValueTable; - objectValueTable = new Object[newLength]; - - System.arraycopy(temp, 0, objectValueTable, 0, usedLength); - } - - if (objectValueTable2 != null) { - temp = objectValueTable2; - objectValueTable2 = new Object[newLength]; - - System.arraycopy(temp, 0, objectValueTable2, 0, usedLength); - } - - if (accessTable != null) { - temp = accessTable; - accessTable = new int[newLength]; - - System.arraycopy(temp, 0, accessTable, 0, usedLength); - } - } - - /** - * clear all the key / value data in a range. - */ - private void clearElementArrays(final int from, final int to) { - - if (intKeyTable != null) { - Arrays.fill(intKeyTable, from, to, 0); - } else if (longKeyTable != null) { - Arrays.fill(longKeyTable, from, to, 0); - } - - if (objectKeyTable != null) { - Arrays.fill(objectKeyTable, from, to, null); - } - - if (intValueTable != null) { - Arrays.fill(intValueTable, from, to, 0); - } else if (longValueTable != null) { - Arrays.fill(longValueTable, from, to, 0); - } else if (objectValueTable != null) { - Arrays.fill(objectValueTable, from, to, null); - } - - if (objectValueTable2 != null) { - Arrays.fill(objectValueTable2, from, to, null); - } - - if (accessTable != null) { - Arrays.fill(accessTable, from, to, 0); - } - } - - /** - * move the elements after a removed key / value pair to fill the gap - */ - void removeFromElementArrays(int size, int lookup) { - - if (isIntKey) { - Object array = intKeyTable; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - intKeyTable[size - 1] = 0; - } else if (isLongKey) { - Object array = longKeyTable; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - longKeyTable[size - 1] = 0; - } - - if (objectKeyTable != null) { - Object array = objectKeyTable; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - objectKeyTable[size - 1] = null; - } - - if (isIntValue) { - Object array = intValueTable; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - intValueTable[size - 1] = 0; - } else if (isLongValue) { - Object array = longValueTable; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - longValueTable[size - 1] = 0; - } - - if (isObjectValue) { - Object array = objectValueTable; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - objectValueTable[size - 1] = null; - } - - if (objectValueTable2 != null) { - Object array = objectValueTable2; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - objectValueTable2[size - 1] = null; - } - - if (accessTable != null) { - Object array = accessTable; - - System.arraycopy(array, lookup + 1, array, lookup, - size - lookup - 1); - - accessTable[size - 1] = 0; - } - } - - /** - * move the elements to create a gap - */ - void insertIntoElementArrays(int size, int lookup) { - - if (isIntKey) { - Object array = intKeyTable; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - intKeyTable[lookup] = 0; - } else if (isLongKey) { - Object array = longKeyTable; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - longKeyTable[lookup] = 0; - } - - if (objectKeyTable != null) { - Object array = objectKeyTable; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - objectKeyTable[lookup] = null; - } - - if (isIntValue) { - Object array = intValueTable; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - intValueTable[lookup] = 0; - } else if (isLongValue) { - Object array = longValueTable; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - longValueTable[lookup] = 0; - } - - if (isObjectValue) { - Object array = objectValueTable; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - objectValueTable[lookup] = null; - } - - if (objectValueTable2 != null) { - Object array = objectValueTable2; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - objectValueTable2[lookup] = null; - } - - if (accessTable != null) { - Object array = accessTable; - - System.arraycopy(array, lookup, array, lookup + 1, size - lookup); - - accessTable[lookup] = 0; - } - } - - /** - * find the next lookup in the key/value tables with an entry - * allows the use of old limit and zero int key attributes - */ - int nextLookup(int lookup, int limitLookup, boolean hasZeroKey, - int zeroKeyIndex) { - - for (++lookup; lookup < limitLookup; lookup++) { - if (isObjectKey) { - if (objectKeyTable[lookup] != null) { - return lookup; - } - } else if (isIntKey) { - if (intKeyTable[lookup] != 0) { - return lookup; - } else if (hasZeroKey && lookup == zeroKeyIndex) { - return lookup; - } - } else { - if (longKeyTable[lookup] != 0) { - return lookup; - } else if (hasZeroKey && lookup == zeroKeyIndex) { - return lookup; - } - } - } - - return lookup; - } - - /** - * find the next lookup in the key/value tables with an entry - * uses current limits and zero integer key state - */ - protected int nextLookup(int lookup) { - - for (++lookup; lookup < hashIndex.newNodePointer; lookup++) { - if (isObjectKey) { - if (objectKeyTable[lookup] != null) { - return lookup; - } - } else if (isIntKey) { - if (intKeyTable[lookup] != 0) { - return lookup; - } else if (hasZeroKey && lookup == zeroKeyIndex) { - return lookup; - } - } else { - if (longKeyTable[lookup] != 0) { - return lookup; - } else if (hasZeroKey && lookup == zeroKeyIndex) { - return lookup; - } - } - } - - return -1; - } - - /** - * row already freed of key / element - */ - protected void removeRow(int lookup) { - - int size = hashIndex.newNodePointer; - - if (size == 0) { - return; - } - - hashIndex.removeEmptyNode(lookup); - removeFromElementArrays(size, lookup); - } - - protected void insertRow(int lookup) { - - if (hashIndex.elementCount >= threshold) { - reset(); - } - - if (lookup == hashIndex.elementCount) { - return; - } - - int size = hashIndex.newNodePointer; - - if (size == 0) { - return; - } - - insertIntoElementArrays(size, lookup); - hashIndex.insertEmptyNode(lookup); - } - - /** - * Clear the map completely. - */ - public void clear() { - - if (hashIndex.modified) { - if (accessCount != null) { - accessCount.set(0); - } - - accessMin = 0; - hasZeroKey = false; - zeroKeyIndex = -1; - zeroOrNullValueCount = 0; - - clearElementArrays(0, hashIndex.newNodePointer); - hashIndex.clear(); - - if (minimizeOnEmpty) { - rehash(initialCapacity); - } - } - } - - /** - * Return the max accessCount value for count elements with the lowest - * access count. Always return at least accessMin + 1 - */ - protected int getAccessCountCeiling(int count, int margin) { - return ArrayCounter.rank(accessTable, hashIndex.newNodePointer, count, - accessMin, accessCount.get(), margin); - } - - /** - * This is called after all elements below count accessCount have been - * removed - */ - protected void setAccessCountFloor(int count) { - accessMin = count; - } - - /** - * Clear approximately half elements from the map, starting with - * those with low accessTable ranking. - * - * Only for value maps - */ - private void clearToHalf() { - - int count = threshold >> 1; - int margin = threshold >> 8; - - if (margin < 64) { - margin = 64; - } - - int maxlookup = hashIndex.newNodePointer; - int accessBase = getAccessCountCeiling(count, margin); - - for (int lookup = 0; lookup < maxlookup; lookup++) { - Object o = objectKeyTable[lookup]; - - if (o != null && accessTable[lookup] < accessBase) { - removeObject(o, false); - } - } - - accessMin = accessBase; - - if (hashIndex.elementCount > threshold - margin) { - clear(); - } - } - - protected void resetAccessCount() { - - int accessMax = accessCount.get(); - - if (accessMax > 0 && accessMax < ACCESS_MAX) { - return; - } - - int limit = hashIndex.getNewNodePointer(); - - accessMax = 0; - accessMin = Integer.MAX_VALUE; - - for (int i = 0; i < limit; i++) { - int access = accessTable[i]; - - if (access == 0) { - continue; - } - - access = (access >>> 2) + 1; - accessTable[i] = access; - - if (access > accessMax) { - accessMax = access; - } else if (access < accessMin) { - accessMin = access; - } - } - - if (accessMin > accessMax) { - accessMin = accessMax; - } - - accessCount.set(accessMax); - } - - protected int capacity() { - return hashIndex.linkTable.length; - } - - public int size() { - return hashIndex.elementCount; - } - - public boolean isEmpty() { - return hashIndex.elementCount == 0; - } - - protected boolean containsKey(Object key) { - - if (key == null) { - return false; - } - - if (hashIndex.elementCount == 0) { - return false; - } - - int lookup = getLookup(key, comparator.hashCode(key)); - - return lookup == -1 ? false - : true; - } - - protected boolean containsKey(int key) { - - if (hashIndex.elementCount == 0) { - return false; - } - - int lookup = getLookup(key); - - return lookup == -1 ? false - : true; - } - - protected boolean containsKey(long key) { - - if (hashIndex.elementCount == 0) { - return false; - } - - int lookup = getLookup(key); - - return lookup == -1 ? false - : true; - } - - protected boolean containsValue(Object value) { - - int lookup = 0; - - if (hashIndex.elementCount == 0) { - return false; - } - - if (value == null) { - for (; lookup < hashIndex.newNodePointer; lookup++) { - if (objectValueTable[lookup] == null) { - if (isObjectKey) { - if (objectKeyTable[lookup] != null) { - return true; - } - } else if (isIntKey) { - if (intKeyTable[lookup] != 0) { - return true; - } else if (hasZeroKey && lookup == zeroKeyIndex) { - return true; - } - } else { - if (longKeyTable[lookup] != 0) { - return true; - } else if (hasZeroKey && lookup == zeroKeyIndex) { - return true; - } - } - } - } - } else { - for (; lookup < hashIndex.newNodePointer; lookup++) { - if (value.equals(objectValueTable[lookup])) { - return true; - } - } - } - - return false; - } - - protected boolean containsValue(int value) { - - if (value == 0) { - return zeroOrNullValueCount > 0; - } - - for (int lookup = 0; lookup < hashIndex.newNodePointer; lookup++) { - if (intValueTable[lookup] == value) { - return true; - } - } - - return false; - } - - protected boolean containsValue(long value) { - - if (value == 0) { - return zeroOrNullValueCount > 0; - } - - for (int lookup = 0; lookup < hashIndex.newNodePointer; lookup++) { - if (longValueTable[lookup] == value) { - return true; - } - } - - return false; - } - - protected Object[] toArray(boolean keys) { - - Object[] array = new Object[size()]; - - return toArray(array, keys); - } - - - protected T[] multiValueKeysToArray(T[] array) { - - int size = this.multiValueKeyCount(); - if (array.length < size) { - array = (T[]) Array.newInstance(array.getClass().getComponentType(), - size); - } - - PrimitiveIterator it = new MultiValueKeyIterator(); - - int index = 0; - - while (it.hasNext()) { - array[index] = (T) it.next(); - - index++; - } - - return array; - } - - - protected T[] toArray(T[] array, boolean keys) { - - if (array.length < size()) { - array = (T[]) Array.newInstance(array.getClass().getComponentType(), - size()); - } - - int limit = hashIndex.getNewNodePointer(); - int index = 0; - Object[] table = keys ? objectKeyTable : - objectValueTable; - - for (int i = 0; i < limit; i++) { - T o = (T) table[i]; - - if (o != null) { - array[index++] = o; - } - } - - return array; - } - - protected int[] toIntArray(int[] array, boolean keys) { - - if (array.length < size()) { - array = new int[size()]; - } - - PrimitiveIterator it = new BaseHashIterator(keys); - - for (int i = 0; i < array.length; i++) { - int value = it.nextInt(); - - array[i] = value; - } - - return array; - } - - protected long[] toLongArray(long[] array, boolean keys) { - - if (array.length < size()) { - array = new long[size()]; - } - - PrimitiveIterator it = new BaseHashIterator(keys); - - for (int i = 0; i < array.length; i++) { - long value = it.nextInt(); - - array[i] = value; - } - - return array; - } - - /** - * Iterator for accessing the values for a single key in MultiValueHashMap - * Currently only for object maps - */ - protected class ValueCollectionIterator implements PrimitiveIterator { - - int lookup = -1; - Object key; - - ValueCollectionIterator(Object key, int lookup) { - this.key = key; - this.lookup = lookup; - } - - public boolean hasNext() { - return lookup != -1; - } - - public Object next() throws NoSuchElementException { - - if (lookup == -1) { - throw new NoSuchElementException(); - } - - Object value = BaseHashMap.this.objectValueTable[lookup]; - - lookup = BaseHashMap.this.hashIndex.getNextLookup(lookup); - - if (lookup != -1) { - Object nextKey = BaseHashMap.this.objectKeyTable[lookup]; - - if (!comparator.equals(nextKey, key)) { - lookup = -1; - } - } - - return value; - } - - public int nextInt() throws NoSuchElementException { - throw new NoSuchElementException("Hash Iterator"); - } - - public long nextLong() throws NoSuchElementException { - throw new NoSuchElementException("Hash Iterator"); - } - - public void remove() throws NoSuchElementException { - throw new NoSuchElementException("Hash Iterator"); - } - } - - protected class MultiValueKeyIterator implements PrimitiveIterator { - - int index = 0; - int lookup = -1; - boolean removed; - Object oldKey; - - public MultiValueKeyIterator() { - - if (hashIndex.elementCount > 0) { - toNextLookup(); - } - } - - private void toNextLookup() { - - for (; index < hashIndex.hashTable.length; ) { - if (hashIndex.hashTable[index] < 0) { - index++; - - continue; - } - - if (lookup < 0) { - lookup = hashIndex.hashTable[index]; - } else { - lookup = hashIndex.getNextLookup(lookup); - } - - if (lookup < 0) { - index++; - - continue; - } - - if (comparator.equals(oldKey, objectKeyTable[lookup])) { - continue; - } - - break; - } - } - - public boolean hasNext() { - return lookup != -1; - } - - public Object next() throws NoSuchElementException { - - if (lookup < 0) { - throw new NoSuchElementException("Hash Iterator"); - } - - Object value = objectKeyTable[lookup]; - - toNextLookup(); - - oldKey = value; - - return value; - } - - public int nextInt() throws NoSuchElementException { - throw new NoSuchElementException("Hash Iterator"); - } - - public long nextLong() throws NoSuchElementException { - throw new NoSuchElementException("Hash Iterator"); - } - - public void remove() throws NoSuchElementException { - - removeMultiVal(0, 0, oldKey, null, false); - - oldKey = null; - } - } - - /** - * Iterator returns Object, int or long and is used both for keys and - * values - */ - protected class BaseHashIterator implements PrimitiveIterator { - - protected boolean keys; - protected int lookup = -1; - protected int counter; - protected boolean removed; - - /** - * default is iterator for values - */ - public BaseHashIterator() { - - } - - public BaseHashIterator(boolean keys) { - - this.keys = keys; - - if (!keys && isNoValue) { - throw new RuntimeException("Hash Iterator"); - } - } - - public void reset() { - - this.lookup = -1; - this.counter = 0; - this.removed = false; - } - - public boolean hasNext() { - return counter < hashIndex.elementCount; - } - - public Object next() throws NoSuchElementException { - - if (keys) { - if (isIntKey) { - return nextInt(); - } else if (isLongKey) { - return nextLong(); - } - } else { - if (isIntValue) { - return nextInt(); - } else if (isLongValue) { - return nextLong(); - } - } - - removed = false; - - if (hasNext()) { - counter++; - - lookup = nextLookup(lookup); - - if (keys) { - return objectKeyTable[lookup]; - } else { - return objectValueTable[lookup]; - } - } - - throw new NoSuchElementException("Hash Iterator"); - } - - public int nextInt() throws NoSuchElementException { - - if ((keys && !isIntKey) || (!keys && !isIntValue)) { - throw new NoSuchElementException("Hash Iterator"); - } - - removed = false; - - if (hasNext()) { - counter++; - - lookup = nextLookup(lookup); - - if (keys) { - return intKeyTable[lookup]; - } else { - return intValueTable[lookup]; - } - } - - throw new NoSuchElementException("Hash Iterator"); - } - - public long nextLong() throws NoSuchElementException { - - if ((keys && !isLongKey) || (!keys && !isLongValue)) { - throw new NoSuchElementException("Hash Iterator"); - } - - removed = false; - - if (hasNext()) { - counter++; - - lookup = nextLookup(lookup); - - return keys ? longKeyTable[lookup] - : longValueTable[lookup]; - } - - throw new NoSuchElementException("Hash Iterator"); - } - - public void remove() throws NoSuchElementException { - - if (removed) { - throw new NoSuchElementException("Hash Iterator"); - } - - counter--; - - removed = true; - - if (BaseHashMap.this.isObjectKey) { - if (isMultiValue) { - removeMultiVal(0, 0, objectKeyTable[lookup], - objectValueTable[lookup], true); - } else { - BaseHashMap.this.remove(0, 0, objectKeyTable[lookup], - null, false, true); - } - } else if (isIntKey) { - BaseHashMap.this.remove(intKeyTable[lookup], 0, null, null, - false, true); - } else { - BaseHashMap.this.remove(longKeyTable[lookup], 0, null, null, - false, true); - } - - if (isList) { - lookup--; - } - } - - public int getAccessCount() { - - if (removed || accessTable == null) { - throw new NoSuchElementException(); - } - - return accessTable[lookup]; - } - - public void setAccessCount(int count) { - - if (removed || accessTable == null) { - throw new NoSuchElementException(); - } - - accessTable[lookup] = count; - } - - public int getLookup() { - return lookup; - } - } - - public BaseHashMap clone() { - - BaseHashMap copy = null; - - try { - copy = (BaseHashMap) super.clone(); - } catch (CloneNotSupportedException e) {} - - copy.hashIndex = hashIndex.clone(); - - if (intKeyTable != null) { - copy.intKeyTable = intKeyTable.clone(); - } - - if (objectKeyTable != null) { - copy.objectKeyTable = objectKeyTable.clone(); - } - - if (longKeyTable != null) { - copy.longKeyTable = longKeyTable.clone(); - } - - if (intValueTable != null) { - copy.intValueTable = intValueTable.clone(); - } - - if (objectValueTable != null) { - copy.objectValueTable = objectValueTable.clone(); - } - - if (longValueTable != null) { - copy.longValueTable = longValueTable.clone(); - } - - if (accessTable != null) { - copy.accessTable = accessTable.clone(); - } - - if (objectValueTable2 != null) { - copy.objectValueTable2 = objectValueTable2.clone(); - } - - return copy; - } - - BaseHashMap duplicate() { - return null; - } -} diff --git a/database/hsqldb/src/org/hsqldb/map/BitMap.java b/database/hsqldb/src/org/hsqldb/map/BitMap.java deleted file mode 100644 index b983db9b..00000000 --- a/database/hsqldb/src/org/hsqldb/map/BitMap.java +++ /dev/null @@ -1,794 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.map; - -import java.util.Arrays; - -/** - * Implementation of a bit map of any size. The map is initialised with - * the given size with no bits set. The map is fixed length depending on - * the constructor argument. - * - * Static methods to manipulate int, byte and byte[] values as bit maps. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.1 - * @since 1.8.0 -*/ -public class BitMap { - - private boolean canChangeSize; - private int initialSize; - private int[] map; - private int limitPos; - - public BitMap(int size, boolean extend) { - - int words = size / Integer.SIZE; - - if (size == 0 || size % Integer.SIZE != 0) { - words++; - } - - map = new int[words]; - canChangeSize = extend; - limitPos = size; - initialSize = size; - } - - public BitMap(int[] map) { - - this.map = map; - initialSize = map.length * Integer.SIZE; - limitPos = initialSize; - canChangeSize = false; - } - - public BitMap duplicate() { - - BitMap newMap = new BitMap(Arrays.copyOf(this.map, this.map.length)); - - newMap.canChangeSize = this.canChangeSize; - newMap.initialSize = this.initialSize; - newMap.limitPos = this.limitPos; - - return newMap; - } - - public int size() { - return limitPos; - } - - public void setSize(int newSize) { - - if (!canChangeSize) { - throw new UnsupportedOperationException("BitMap"); - } - - ensureCapacity(newSize); - - // if newSize is smaller - if (limitPos > newSize) { - unsetRange(newSize, limitPos - newSize); - - limitPos = newSize; - } - } - - /** - * Resets to bits not set with original size - */ - public void reset() { - - Arrays.fill(map, 0); - - limitPos = initialSize; - } - - /** - * Counts the bit positions that are set both in this and the other map. - */ - public int countSetMatches(BitMap other) { - - int matchCount = 0; - - for (int i = 0; i < map.length; i++) { - int matches = this.map[i] & other.map[i]; - - if (matches != 0) { - matchCount += Integer.bitCount(matches); - } - } - - return matchCount; - } - - public int setRange(int pos, int count) { - return setOrUnsetRange(pos, count, true); - } - - public int unsetRange(int pos, int count) { - return setOrUnsetRange(pos, count, false); - } - - /** - * returns count of bits that change - */ - private int setOrUnsetRange(int pos, int count, boolean set) { - - if (count == 0) { - return 0; - } - - ensureCapacity(pos + count); - - int windex = pos >> 5; - int windexend = (pos + count - 1) >> 5; - int mask = 0xffffffff >>> (pos & 0x1F); - int maskend = 0x80000000 >> ((pos + count - 1) & 0x1F); - int word; - int setCount; - - if (windex == windexend) { - mask &= maskend; - } - - word = map[windex]; - setCount = Integer.bitCount(word & mask); - - if (set) { - map[windex] = (word | mask); - } else { - mask = ~mask; - map[windex] = (word & mask); - } - - if (windex != windexend) { - word = map[windexend]; - setCount += Integer.bitCount(word & maskend); - - if (set) { - map[windexend] = (word | maskend); - } else { - maskend = ~maskend; - map[windexend] = (word & maskend); - } - - for (int i = windex + 1; i < windexend; i++) { - setCount += Integer.bitCount(map[i]); - map[i] = set ? 0xffffffff - : 0; - } - } - - return set ? count - setCount - : setCount; - } - - public int setValue(int pos, boolean set) { - return set ? set(pos) - : unset(pos); - } - - /** - * Sets pos and returns old value - */ - public int set(int pos) { - - ensureCapacity(pos + 1); - - int windex = pos >> 5; - int mask = 0x80000000 >>> (pos & 0x1F); - int word = map[windex]; - int result = (word & mask) == 0 ? 0 - : 1; - - map[windex] = (word | mask); - - return result; - } - - /** - * Unsets pos and returns old value - */ - public int unset(int pos) { - - ensureCapacity(pos + 1); - - int windex = pos >> 5; - int mask = 0x80000000 >>> (pos & 0x1F); - int word = map[windex]; - int result = (word & mask) == 0 ? 0 - : 1; - - mask = ~mask; - map[windex] = (word & mask); - - return result; - } - - public int get(int pos) { - - if (pos >= limitPos) { - throw new ArrayIndexOutOfBoundsException(pos); - } - - int windex = pos >> 5; - int word = map[windex]; - - if (word == 0) { - return 0; - } - - if (word == -1) { - return 1; - } - - int mask = 0x80000000 >>> (pos & 0x1F); - - return (word & mask) == 0 ? 0 - : 1; - } - - public boolean isSet(int pos) { - return get(pos) == 1; - } - - /** - * Sets all bits that are set in the other map. - */ - public void set(BitMap other) { - - for (int windex = 0; windex < map.length; windex++) { - int word = other.map[windex]; - - map[windex] |= word; - } - } - - public int countSet(int from, int count) { - - int set = 0; - - for (int i = from; i < from + count; i++) { - if (isSet(i)) { - set++; - } - } - - return set; - } - - public int countSetBits() { - - int setCount = 0; - - for (int windex = 0; windex < limitPos / Integer.SIZE; windex++) { - int word = map[windex]; - - if (word == 0) { - continue; - } - - if (word == -1) { - setCount += Integer.SIZE; - - continue; - } - - setCount += Integer.bitCount(word); - } - - if (limitPos % Integer.SIZE != 0) { - int maskend = 0x80000000 >> ((limitPos - 1) & 0x1F); - int word = map[limitPos / Integer.SIZE] & maskend; - - setCount += Integer.bitCount(word); - } - - return setCount; - } - - /** - * Only for word boundary map size - */ - public int countSetBitsEnd() { - - int count = 0; - int windex = (limitPos / Integer.SIZE) - 1; - - for (; windex >= 0; windex--) { - if (map[windex] == 0xffffffff) { - count += Integer.SIZE; - - continue; - } - - int val = countSetBitsEnd(map[windex]); - - count += val; - - break; - } - - return count; - } - - public int[] getIntArray() { - return map; - } - - public byte[] getBytes() { - - byte[] buf = new byte[(limitPos + 7) / 8]; - - if (buf.length == 0) { - return buf; - } - - for (int i = 0; ; ) { - int v = map[i / 4]; - - buf[i++] = (byte) (v >>> 24); - - if (i == buf.length) { - break; - } - - buf[i++] = (byte) (v >>> 16); - - if (i == buf.length) { - break; - } - - buf[i++] = (byte) (v >>> 8); - - if (i == buf.length) { - break; - } - - buf[i++] = (byte) v; - - if (i == buf.length) { - break; - } - } - - return buf; - } - - /** - * Ensures capacity by enlarging the array if necessary. - * Sets limitPos if capacity is increased. - */ - private void ensureCapacity(int newSize) { - - if (newSize > limitPos) { - if (!canChangeSize) { - throw new ArrayStoreException("BitMap extend"); - } - } - - if (newSize <= map.length * Integer.SIZE) { - if (newSize > limitPos) { - limitPos = newSize; - } - - return; - } - - int newMapLength = map.length; - - while (newSize > newMapLength * Integer.SIZE) { - newMapLength *= 2; - } - - int[] newmap = new int[newMapLength]; - - System.arraycopy(map, 0, newmap, 0, map.length); - - map = newmap; - limitPos = newSize; - } - - /** - * count the run of set bits at the low end - */ - public static int countSetBitsEnd(int map) { - - int mask = 0x01; - int count = 0; - - for (; count < Integer.SIZE; count++) { - if ((map & mask) == 0) { - break; - } - - map >>= 1; - } - - return count; - } - - /** - * count the run of unset bits at the high end - */ - public static int countUnsetBitsStart(int map) { - - int mask = 0x80000000; - int count = 0; - - if (map == 0) { - return Integer.SIZE; - } - - for (; count < Integer.SIZE; count++) { - if ((map & mask) != 0) { - break; - } - - mask >>>= 1; - } - - return count; - } - - /** - * copy the byte value into the map at given position (0, 24) - */ - public static int setByte(int map, byte value, int pos) { - - int intValue = (value & 0xff) << (24 - pos); - int mask = 0xff000000 >>> pos; - - mask = ~mask; - map &= mask; - - return (map | intValue); - } - - public static int set(int map, int pos) { - - int mask = 0x80000000 >>> pos; - - return (map | mask); - } - - public static byte set(byte map, int pos) { - - int mask = 0x00000080 >>> pos; - - return (byte) (map | mask); - } - - public static int unset(int map, int pos) { - - int mask = 0x80000000 >>> pos; - - mask = ~mask; - - return (map & mask); - } - - public static boolean isSet(int map, int pos) { - - int mask = 0x80000000 >>> pos; - - return (map & mask) == 0 ? false - : true; - } - - public static boolean isSet(byte map, int pos) { - - int mask = 0x00000080 >>> pos; - - return (map & mask) == 0 ? false - : true; - } - - public static boolean isSet(byte[] map, int pos) { - - int mask = 0x00000080 >>> (pos & 0x07); - int index = pos / 8; - - if (index >= map.length) { - return false; - } - - byte b = map[index]; - - return (b & mask) == 0 ? false - : true; - } - - public static void unset(byte[] map, int pos) { - - int mask = 0x00000080 >>> (pos & 0x07); - - mask = ~mask; - - int index = pos / 8; - - if (index >= map.length) { - return; - } - - byte b = map[index]; - - map[index] = (byte) (b & mask); - } - - public static void set(byte[] map, int pos) { - - int mask = 0x00000080 >>> (pos & 0x07); - int index = pos / 8; - - if (index >= map.length) { - return; - } - - byte b = map[index]; - - map[index] = (byte) (b | mask); - } - - /** - * AND count bits from source with map contents starting at pos - */ - public static void and(byte[] map, int pos, byte source, int count) { - - int shift = pos & 0x07; - int mask = (source & 0xff) >>> shift; - int innermask = 0xff >> shift; - int index = pos / 8; - - if (count < 8) { - innermask = innermask >>> (8 - count); - innermask = innermask << (8 - count); - } - - mask &= innermask; - innermask = ~innermask; - - if (index >= map.length) { - return; - } - - byte b = map[index]; - - map[index] = (byte) (b & innermask); - b = (byte) (b & mask); - map[index] = (byte) (map[index] | b); - - if (shift == 0) { - return; - } - - shift = 8 - shift; - - if (count > shift) { - mask = ((source & 0xff) << 8) >>> shift; - innermask = 0xff00 >>> shift; - innermask = ~innermask; - b = map[index + 1]; - map[index + 1] = (byte) (b & innermask); - b = (byte) (b & mask); - map[index + 1] = (byte) (map[index + 1] | b); - } - } - - /** - * OR count bits from source with map contents starting at pos - */ - public static void or(byte[] map, int pos, byte source, int count) { - - int shift = pos & 0x07; - int mask = (source & 0xff) >>> shift; - int index = pos / 8; - - if (index >= map.length) { - return; - } - - byte b = (byte) (map[index] | mask); - - map[index] = b; - - if (shift == 0) { - return; - } - - shift = 8 - shift; - - if (count > shift) { - mask = ((source & 0xff) << 8) >>> shift; - b = (byte) (map[index + 1] | mask); - map[index + 1] = b; - } - } - - /** - * overlay count bits from source on map contents starting at pos - */ - public static void overlay(byte[] map, int pos, byte source, int count) { - - int shift = pos & 0x07; - int mask = (source & 0xff) >>> shift; - int innermask = 0xff >> shift; - int index = pos / 8; - - if (count < 8) { - innermask = innermask >>> (8 - count); - innermask = innermask << (8 - count); - } - - mask &= innermask; - innermask = ~innermask; - - if (index >= map.length) { - return; - } - - byte b = map[index]; - - b = (byte) (b & innermask); - map[index] = (byte) (b | mask); - - if (shift == 0) { - return; - } - - shift = 8 - shift; - - if (count > shift) { - mask = ((source & 0xff) << 8) >>> shift; - innermask = 0xff00 >>> shift; - innermask = ~innermask; - b = map[index + 1]; - b = (byte) (b & innermask); - map[index + 1] = (byte) (b | mask); - } - } - - public static byte[] and(byte[] a, byte[] b) { - - int length = a.length > b.length ? a.length - : b.length; - int shortLength = a.length > b.length ? b.length - : a.length; - byte[] map = new byte[length]; - - for (int i = 0; i < shortLength; i++) { - map[i] = (byte) (a[i] & b[i]); - } - - return map; - } - - public static byte[] or(byte[] a, byte[] b) { - - int length = a.length > b.length ? a.length - : b.length; - int shortLength = a.length > b.length ? b.length - : a.length; - byte[] map = new byte[length]; - - if (length != shortLength) { - byte[] source = a.length > b.length ? a - : b; - - System.arraycopy(source, shortLength, map, shortLength, - length - shortLength); - } - - for (int i = 0; i < shortLength; i++) { - map[i] = (byte) (a[i] | b[i]); - } - - return map; - } - - public static byte[] xor(byte[] a, byte[] b) { - - int length = a.length > b.length ? a.length - : b.length; - int shortLength = a.length > b.length ? b.length - : a.length; - byte[] map = new byte[length]; - - if (length != shortLength) { - byte[] source = a.length > b.length ? a - : b; - - System.arraycopy(source, shortLength, map, shortLength, - length - shortLength); - } - - for (int i = 0; i < shortLength; i++) { - map[i] = (byte) (a[i] ^ b[i]); - } - - return map; - } - - public static byte[] not(byte[] a) { - - byte[] map = new byte[a.length]; - - for (int i = 0; i < a.length; i++) { - map[i] = (byte) ~a[i]; - } - - return map; - } - - public static boolean hasAnyBitSet(byte[] map) { - - for (int i = 0; i < map.length; i++) { - if (map[i] != 0) { - return true; - } - } - - return false; - } - - public static byte[] leftShift(byte[] map, int shiftBits) { - - byte[] newMap = new byte[map.length]; - int shiftBytes = shiftBits / 8; - - if (shiftBytes >= map.length) { - return newMap; - } - - shiftBits = shiftBits % 8; - - if (shiftBits == 0) { - for (int i = 0, j = shiftBytes; j < map.length; i++, j++) { - newMap[i] = map[j]; - } - } else { - for (int i = 0, j = shiftBytes; j < map.length; i++, j++) { - int shifted = (map[j] & 0xff) << shiftBits; - - newMap[i] = (byte) shifted; - - if (i > 0) { - newMap[i - 1] |= (byte) (shifted >>> 8); - } - } - } - - return newMap; - } -} diff --git a/database/hsqldb/src/org/hsqldb/map/HashIndex.java b/database/hsqldb/src/org/hsqldb/map/HashIndex.java deleted file mode 100644 index 60d9ff6f..00000000 --- a/database/hsqldb/src/org/hsqldb/map/HashIndex.java +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.map; - -import java.util.Arrays; - -/** - * A chained bucket hash index implementation. - * - * hashTable and linkTable are arrays of signed integral types. This - * implementation uses int as the type but short or byte can be used for - * smaller index sizes (cardinality). - * - * hashTable[index] contains the pointer to the first node with - * (index == hash modulo hashTable.length) or -1 if there is no corresponding - * node. linkTable[{0,newNodePointer}] (the range between 0 and newNodePointer) - * contains either the pointer to the next node or -1 if there is no - * such node. reclaimedNodeIndex contains a pointer to an element - * of linkTable which is the first element in the list of reclaimed nodes - * (nodes no longer in index) or -1 if there is no such node. - * - * elements at and above linkTable[newNodePointer] have never been used - * as a node and their contents is not significant. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class HashIndex { - - int[] hashTable; - int[] linkTable; - int newNodePointer; - int elementCount; - int reclaimedNodePointer = -1; - boolean fixedSize; - boolean modified; - - public HashIndex(int hashTableSize, int capacity, boolean fixedSize) { - - if (capacity < hashTableSize) { - capacity = hashTableSize; - } - - reset(hashTableSize, capacity); - - this.fixedSize = fixedSize; - } - - /** - * Reset the structure with a new size as empty. - * - * @param hashTableSize size - * @param capacity capacity - */ - public void reset(int hashTableSize, int capacity) { - - int[] newHT = new int[hashTableSize]; - int[] newLT = new int[capacity]; - - // allocate memory before assigning - hashTable = newHT; - linkTable = newLT; - - Arrays.fill(hashTable, -1); - resetTables(); - } - - public void resetTables() { - - newNodePointer = 0; - elementCount = 0; - reclaimedNodePointer = -1; - modified = false; - } - - public int getElementCount() { - return elementCount; - } - - public int getLimitPointer() { - return newNodePointer; - } - - /** - * Reset the index as empty. - */ - public void clear() { - - Arrays.fill(linkTable, 0, newNodePointer, 0); - Arrays.fill(hashTable, -1); - resetTables(); - } - - /** - * @param hash hash value - */ - public int getHashIndex(int hash) { - return (hash & 0x7fffffff) % hashTable.length; - } - - /** - * Return the array index for a hash. - * - * @param hash the hash value used for indexing - * @return either -1 or the first node for this hash value - */ - public int getLookup(int hash) { - - if (elementCount == 0) { - return -1; - } - - int index = (hash & 0x7fffffff) % hashTable.length; - - return hashTable[index]; - } - - /** - * Return the pointer - */ - public int getNewNodePointer() { - return newNodePointer; - } - - /** - * This looks from a given node, so the parameter is always {@code > -1}. - * - * @param lookup A valid node to look from - * @return either -1 or the next node from this node - */ - public int getNextLookup(int lookup) { - return linkTable[lookup]; - } - - /** - * Link a new node into the linked list for a hash index. - * - * @param index an index into hashTable - * @param lastLookup either -1 or the node to which the new node will be linked - * @return the new node - */ - public int linkNode(int index, final int lastLookup) { - - // get the first reclaimed slot - int lookup = reclaimedNodePointer; - - if (lookup == -1) { - lookup = newNodePointer++; - } else { - - // reset the first reclaimed slot - reclaimedNodePointer = linkTable[lookup]; - } - - // link the node - int nextLookup; - - if (lastLookup == -1) { - nextLookup = hashTable[index]; - hashTable[index] = lookup; - } else { - nextLookup = linkTable[lastLookup]; - linkTable[lastLookup] = lookup; - } - - linkTable[lookup] = nextLookup; - - elementCount++; - - modified = true; - - return lookup; - } - - /** - * Unlink a node from a linked list and link into the reclaimed list. - * - * @param index an index into hashTable - * @param lastLookup either -1 or the node to which the target node is linked - * @param lookup the node to remove - */ - public void unlinkNode(int index, int lastLookup, int lookup) { - - // unlink the node - if (lastLookup == -1) { - hashTable[index] = linkTable[lookup]; - } else { - linkTable[lastLookup] = linkTable[lookup]; - } - - // add to reclaimed list - linkTable[lookup] = reclaimedNodePointer; - reclaimedNodePointer = lookup; - - elementCount--; - - if (elementCount == 0) { - Arrays.fill(linkTable, 0, newNodePointer, 0); - resetTables(); - } - } - - /** - * Remove a node that has already been unlinked. This is not required - * for index operations. It is used only when the row needs to be removed - * from the data structures that store the actual indexed data and the - * nodes need to be contiguous. - * - * @param lookup the node to remove - * @return true if node found in unlinked state - */ - public boolean removeEmptyNode(int lookup) { - - boolean found = false; - int lastLookup = -1; - - for (int i = reclaimedNodePointer; i >= 0; - lastLookup = i, i = linkTable[i]) { - if (i == lookup) { - if (lastLookup == -1) { - reclaimedNodePointer = linkTable[lookup]; - } else { - linkTable[lastLookup] = linkTable[lookup]; - } - - found = true; - - break; - } - } - - if (!found) { - return false; - } - - for (int i = 0; i < newNodePointer; i++) { - if (linkTable[i] > lookup) { - linkTable[i]--; - } - } - - System.arraycopy(linkTable, lookup + 1, linkTable, lookup, - newNodePointer - lookup - 1); - - linkTable[newNodePointer - 1] = 0; - - newNodePointer--; - - for (int i = 0; i < hashTable.length; i++) { - if (hashTable[i] > lookup) { - hashTable[i]--; - } - } - - return true; - } - - /** - * Insert a node. - * - * @param lookup the node to remove - * @return true if node found in unlinked state - */ - public boolean insertEmptyNode(int lookup) { - - for (int i = 0; i < newNodePointer; i++) { - if (linkTable[i] >= lookup) { - linkTable[i]++; - } - } - - for (int i = 0; i < hashTable.length; i++) { - if (hashTable[i] >= lookup) { - hashTable[i]++; - } - } - - System.arraycopy(linkTable, lookup, linkTable, lookup + 1, - newNodePointer - lookup); - - newNodePointer++; - - if (reclaimedNodePointer >= lookup) { - reclaimedNodePointer++; - } - - linkTable[lookup] = reclaimedNodePointer; - reclaimedNodePointer = lookup; - - return true; - } - - public HashIndex clone() { - - HashIndex copy = null; - - try { - copy = (HashIndex) super.clone(); - } catch (CloneNotSupportedException e) {} - - copy.hashTable = hashTable.clone(); - copy.linkTable = linkTable.clone(); - - return copy; - } -} diff --git a/database/hsqldb/src/org/hsqldb/map/ValuePool.java b/database/hsqldb/src/org/hsqldb/map/ValuePool.java deleted file mode 100644 index f88a7b04..00000000 --- a/database/hsqldb/src/org/hsqldb/map/ValuePool.java +++ /dev/null @@ -1,206 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.map; - -import java.math.BigDecimal; - -/** - * Supports pooling of Integer, Long, Double, BigDecimal, String and Date - * Java Objects. Leads to reduction in memory use when an Object is used more - * then twice in the database. - * - * getXXX methods are used for retrieval of values. If a value is not in - * the pool, it is added to the pool and returned. When the pool gets - * full, half the contents that have been accessed less recently are purged. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.1 - * @since 1.7.2 - */ -public final class ValuePool { - - // - static ValuePoolHashMap intPool; - static ValuePoolHashMap longPool; - static ValuePoolHashMap doublePool; - static ValuePoolHashMap bigdecimalPool; - static ValuePoolHashMap stringPool; - static final int SPACE_STRING_SIZE = 64; - static final int DEFAULT_VALUE_POOL_SIZE = 4096; - static final int[] defaultPoolLookupSize = new int[] { - DEFAULT_VALUE_POOL_SIZE, DEFAULT_VALUE_POOL_SIZE, - DEFAULT_VALUE_POOL_SIZE, DEFAULT_VALUE_POOL_SIZE, - DEFAULT_VALUE_POOL_SIZE - }; - static final int POOLS_COUNT = defaultPoolLookupSize.length; - static final int defaultSizeFactor = 2; - static final int defaultMaxStringLength = 16; - - // - static ValuePoolHashMap[] poolList; - - // - static int maxStringLength; - - // - public static final String spaceString; - - static { - char[] c = new char[SPACE_STRING_SIZE]; - - for (int i = 0; i < SPACE_STRING_SIZE; i++) { - c[i] = ' '; - } - - spaceString = new String(c); - - // - initPool(); - } - - public static final Integer INTEGER_0 = ValuePool.getInt(0); - public static final Integer INTEGER_1 = ValuePool.getInt(1); - public static final Integer INTEGER_2 = ValuePool.getInt(2); - public static final Integer INTEGER_MAX = - ValuePool.getInt(Integer.MAX_VALUE); - public static final BigDecimal BIG_DECIMAL_0 = - ValuePool.getBigDecimal(BigDecimal.valueOf(0)); - public static final BigDecimal BIG_DECIMAL_1 = - ValuePool.getBigDecimal(new BigDecimal(1)); - - // - public static final String[] emptyStringArray = new String[]{}; - public static final Object[] emptyObjectArray = new Object[]{}; - public static final int[] emptyIntArray = new int[]{}; - - // - private static void initPool() { - - int[] sizeArray = defaultPoolLookupSize; - int sizeFactor = defaultSizeFactor; - - synchronized (ValuePool.class) { - maxStringLength = defaultMaxStringLength; - poolList = new ValuePoolHashMap[POOLS_COUNT]; - - for (int i = 0; i < POOLS_COUNT; i++) { - int size = sizeArray[i]; - - poolList[i] = new ValuePoolHashMap(size, size * sizeFactor, - BaseHashMap.PURGE_HALF); - } - - intPool = poolList[0]; - longPool = poolList[1]; - doublePool = poolList[2]; - bigdecimalPool = poolList[3]; - stringPool = poolList[4]; - } - } - - public static int getMaxStringLength() { - return maxStringLength; - } - - public static void resetPool() { - - synchronized (ValuePool.class) { - for (int i = 0; i < POOLS_COUNT; i++) { - poolList[i].clear(); - } - } - } - - public static void clearPool() { - - synchronized (ValuePool.class) { - for (int i = 0; i < POOLS_COUNT; i++) { - poolList[i].clear(); - } - } - } - - public static Integer getInt(int val) { - - synchronized (intPool) { - return intPool.getOrAddInteger(val); - } - } - - public static Long getLong(long val) { - - synchronized (longPool) { - return longPool.getOrAddLong(val); - } - } - - public static Double getDouble(long val) { - - synchronized (doublePool) { - return doublePool.getOrAddDouble(val); - } - } - - public static String getString(String val) { - - if (val == null || val.length() > maxStringLength) { - return val; - } - - synchronized (stringPool) { - return stringPool.getOrAddString(val); - } - } - - public static String getSubString(String val, int start, int limit) { - - synchronized (stringPool) { - return stringPool.getOrAddString(val.substring(start, limit)); - } - } - - public static BigDecimal getBigDecimal(BigDecimal val) { - - if (val == null) { - return val; - } - - synchronized (bigdecimalPool) { - return (BigDecimal) bigdecimalPool.getOrAddObject(val); - } - } - - public static Boolean getBoolean(boolean b) { - return b ? Boolean.TRUE - : Boolean.FALSE; - } -} diff --git a/database/hsqldb/src/org/hsqldb/map/ValuePoolHashMap.java b/database/hsqldb/src/org/hsqldb/map/ValuePoolHashMap.java deleted file mode 100644 index 0c53da6f..00000000 --- a/database/hsqldb/src/org/hsqldb/map/ValuePoolHashMap.java +++ /dev/null @@ -1,465 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.map; - -import org.hsqldb.types.TimestampData; - -/* - * implementation notes: - * - * NB: As of this version this class cannot be used for mixed object types - * It is relatively easy to support this by adding an 'instanceof' test inside - * each getOrAddXxxx method before casting the Set values to the target type - * for comparison purposes. - * - * superclass is used as an Object Set - * getOrAddXxxx methods are implemented directly for speed - * the superclass infrastructure is otherwise used - */ - -/** - * Subclass of BaseHashMap for maintaining a pool of objects. Supports a - * range of java.lang.* objects. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.7.2 - * - */ -public class ValuePoolHashMap extends BaseHashMap { - - long hits; - - public ValuePoolHashMap(int initialCapacity, int maxCapacity, - int purgePolicy) throws IllegalArgumentException { - - super(initialCapacity, BaseHashMap.objectKeyOrValue, - BaseHashMap.noKeyOrValue, true); - - this.maxCapacity = maxCapacity; - this.purgePolicy = purgePolicy; - } - - protected Integer getOrAddInteger(int intKey) { - - Integer testValue; - int index = hashIndex.getHashIndex(intKey); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - testValue = (Integer) objectKeyTable[lookup]; - - int keyValue = testValue.intValue(); - - if (keyValue == intKey) { - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - hits++; - - return testValue; - } else if (keyValue > intKey) { - break; - } - } - - if (hashIndex.elementCount >= threshold) { - reset(); - - return getOrAddInteger(intKey); - } - - lookup = hashIndex.linkNode(index, lastLookup); - testValue = Integer.valueOf(intKey); - objectKeyTable[lookup] = testValue; - - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - return testValue; - } - - protected Long getOrAddLong(long longKey) { - - Long testValue; - int index = hashIndex.getHashIndex((int) (longKey ^ (longKey >>> 32))); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - testValue = (Long) objectKeyTable[lookup]; - - long keyValue = testValue.longValue(); - - if (keyValue == longKey) { - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - hits++; - - return testValue; - } else if (keyValue > longKey) { - break; - } - } - - if (hashIndex.elementCount >= threshold) { - reset(); - - return getOrAddLong(longKey); - } - - lookup = hashIndex.linkNode(index, lastLookup); - testValue = Long.valueOf(longKey); - objectKeyTable[lookup] = testValue; - - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - return testValue; - } - - /** - * This is dissimilar to normal hash map get() methods. The key Object - * should have an equals(String) method which should return true if the - * key.toString().equals(String) is true. Also the key.hashCode() method - * must return the same value as key.toString.hashCode().

    - * - * The above is always true when the key is a String. But it means it is - * possible to submit special keys that fulfill the contract. For example - * a wrapper around a byte[] can be submitted as key to retrieve either - * a new String, which is the result of the toString() method of the - * wrapper, or return an existing String which would be equal to the result - * of toString(). - * - * @param key String or other Object with compatible equals(String) - * and hashCode(). - * @return String from map or a new String - */ - protected String getOrAddString(Object key) { - - String testValue; - int index = hashIndex.getHashIndex(key.hashCode()); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - testValue = (String) objectKeyTable[lookup]; - - if (key.equals(testValue)) { - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - hits++; - - return testValue; - } - } - - if (hashIndex.elementCount >= threshold) { - reset(); - - return getOrAddString(key); - } - - testValue = key.toString(); - lookup = hashIndex.linkNode(index, lastLookup); - objectKeyTable[lookup] = testValue; - - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - return testValue; - } - - protected String getOrAddSubString(String key, int from, int limit) { - - // to improve - key = key.substring(from, limit); - - String testValue; - int index = hashIndex.getHashIndex(key.hashCode()); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - testValue = (String) objectKeyTable[lookup]; - - if (key.equals(testValue)) { - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - hits++; - - return testValue; - } - } - - if (hashIndex.elementCount >= threshold) { - reset(); - - return getOrAddString(key); - } - - testValue = new String(key.toCharArray()); - lookup = hashIndex.linkNode(index, lastLookup); - objectKeyTable[lookup] = testValue; - - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - return testValue; - } - - protected TimestampData getOrAddDate(long longKey) { - - TimestampData testValue; - int hash = (int) longKey ^ (int) (longKey >>> 32); - int index = hashIndex.getHashIndex(hash); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - testValue = (TimestampData) objectKeyTable[lookup]; - - if (testValue.getSeconds() == longKey) { - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - hits++; - - return testValue; - } - } - - if (hashIndex.elementCount >= threshold) { - reset(); - - return getOrAddDate(longKey); - } - - lookup = hashIndex.linkNode(index, lastLookup); - testValue = new TimestampData(longKey); - objectKeyTable[lookup] = testValue; - - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - return testValue; - } - - protected Double getOrAddDouble(long longKey) { - - Double testValue; - int index = hashIndex.getHashIndex((int) (longKey ^ (longKey >>> 32))); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - testValue = (Double) objectKeyTable[lookup]; - - if (Double.doubleToLongBits(testValue.doubleValue()) == longKey) { - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - hits++; - - return testValue; - } - } - - if (hashIndex.elementCount >= threshold) { - reset(); - - return getOrAddDouble(longKey); - } - - lookup = hashIndex.linkNode(index, lastLookup); - testValue = Double.valueOf(Double.longBitsToDouble(longKey)); - objectKeyTable[lookup] = testValue; - - - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - return testValue; - } - - protected Object getOrAddObject(Object key) { - - Object testValue; - int index = hashIndex.getHashIndex(key.hashCode()); - int lookup = hashIndex.hashTable[index]; - int lastLookup = -1; - - for (; lookup >= 0; - lastLookup = lookup, - lookup = hashIndex.getNextLookup(lookup)) { - testValue = objectKeyTable[lookup]; - - if (testValue.equals(key)) { - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - hits++; - - return testValue; - } - } - - if (hashIndex.elementCount >= threshold) { - reset(); - - return getOrAddObject(key); - } - - lookup = hashIndex.linkNode(index, lastLookup); - objectKeyTable[lookup] = key; - - - int count = accessCount.incrementAndGet(); - - if (count < 0) { - resetAccessCount(); - - count = accessCount.incrementAndGet(); - } - - accessTable[lookup] = count; - - return key; - } -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RangeIterator.java b/database/hsqldb/src/org/hsqldb/navigator/RangeIterator.java deleted file mode 100644 index d2a351c3..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RangeIterator.java +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.0 - * @since 1.9.0 - */ -public interface RangeIterator extends RowIterator { - - boolean isBeforeFirst(); - - void setCurrent(Object[] data); - - void reset(); - - int getRangePosition(); -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RowIterator.java b/database/hsqldb/src/org/hsqldb/navigator/RowIterator.java deleted file mode 100644 index f0889154..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RowIterator.java +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -import org.hsqldb.Row; - -/** - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.7.2 - */ -public interface RowIterator { - - RowIterator emptyRowIterator = new EmptyRowIterator(); - - Object getField(int col); - - boolean next(); - - Row getCurrentRow(); - - Object[] getCurrent(); - - void removeCurrent(); - - void release(); - - long getRowId(); - - final class EmptyRowIterator implements RowIterator { - - private EmptyRowIterator() {} - - public Object getField(int col) { - return null; - } - - public boolean next() { - return false; - } - - public Row getCurrentRow() { - return null; - } - - public Object[] getCurrent() { - return null; - } - - public void release() {} - - public void removeCurrent() {} - - public long getRowId() { - return 0L; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigator.java b/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigator.java deleted file mode 100644 index 9184082c..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigator.java +++ /dev/null @@ -1,320 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -import org.hsqldb.Row; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * Encapsulates navigation functionality for lists of objects. The base class - * provides positional navigation and checking, while the subclasses provide - * object retrieval. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public abstract class RowSetNavigator implements RangeIterator { - - public RowSetNavigator() {} - - SessionInterface session; - long id; - int size; - int mode; - int currentPos = -1; - int rangePosition; - boolean hadNext; - boolean isClosed; - - /** - * Sets the id; - */ - public void setId(long id) { - this.id = id; - } - - /** - * Returns the id - */ - public long getId() { - return id; - } - - /** - * Returns the current row object. Type of object is implementation defined. - */ - public abstract Object[] getCurrent(); - - public Object getField(int col) { - - Object[] current = getCurrent(); - - if (current == null) { - return null; - } - - return current[col]; - } - - public void setCurrent(Object[] data) {} - - public abstract Row getCurrentRow(); - - /** - * Add data to the end - */ - public abstract void add(Object[] data); - - /** - * Add row to the end - */ - public abstract boolean addRow(Row row); - - /** - * Remove current row - */ - public abstract void removeCurrent(); - - /** - * Reset to initial state - */ - public void reset() { - currentPos = -1; - } - - /** - * Clear the contents - */ - public abstract void clear(); - - /** - * Remove any resourses and invalidate - */ - public abstract void release(); - - public boolean isClosed() { - return isClosed; - } - - public void setSession(SessionInterface session) { - this.session = session; - } - - public SessionInterface getSession() { - return session; - } - - public int getSize() { - return size; - } - - public boolean isEmpty() { - return size == 0; - } - - public boolean next() { - - if (hasNext()) { - currentPos++; - - hadNext = true; - - return true; - } else if (size != 0) { - currentPos = size; - } - - hadNext = false; - - return false; - } - - final boolean hasNext() { - return currentPos < size - 1; - } - - public long getRowId() { - throw Error.runtimeError(ErrorCode.U_S0500, "RowSetNavigator"); - } - - public boolean hadNext() { - return hadNext; - } - - public boolean beforeFirst() { - - reset(); - - currentPos = -1; - - return true; - } - - public boolean afterLast() { - - if (size == 0) { - return false; - } - - reset(); - - currentPos = size; - - return true; - } - - public boolean first() { - - beforeFirst(); - - return next(); - } - - public boolean last() { - - if (size == 0) { - return false; - } - - if (isAfterLast()) { - beforeFirst(); - } - - while (hasNext()) { - next(); - } - - return true; - } - - public int getRowNumber() { - return currentPos; - } - - /** - * Uses similar semantics to java.sql.ResultSet except this is 0 based. - * When position is 0 or positive, it is from the start; when negative, - * it is from end - */ - public boolean absolute(int position) { - - if (position < 0) { - position += size; - } - - if (position < 0) { - beforeFirst(); - - return false; - } - - if (position >= size) { - afterLast(); - - return false; - } - - if (size == 0) { - return false; - } - - if (position < currentPos) { - beforeFirst(); - } - - // go to the tagget row; - while (position > currentPos) { - next(); - } - - return true; - } - - public boolean relative(int rows) { - - int position = currentPos + rows; - - if (position < 0) { - beforeFirst(); - - return false; - } - - return absolute(position); - } - - public boolean previous() { - return relative(-1); - } - - public boolean isFirst() { - return size > 0 && currentPos == 0; - } - - public boolean isLast() { - return size > 0 && currentPos == size - 1; - } - - public boolean isBeforeFirst() { - return size > 0 && currentPos == -1; - } - - public boolean isAfterLast() { - return size > 0 && currentPos == size; - } - - public void writeSimple(RowOutputInterface out, ResultMetaData meta) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowSetNavigator"); - } - - public void readSimple(RowInputInterface in, ResultMetaData meta) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowSetNavigator"); - } - - public abstract void write(RowOutputInterface out, ResultMetaData meta); - - public abstract void read(RowInputInterface in, ResultMetaData meta); - - public boolean isMemory() { - return true; - } - - public int getRangePosition() { - return rangePosition; - } -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorClient.java b/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorClient.java deleted file mode 100644 index 219e7cd2..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorClient.java +++ /dev/null @@ -1,285 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -import org.hsqldb.HsqlException; -import org.hsqldb.Row; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/* - * All-in-memory implementation of RowSetNavigator for client side, or for - * transferring a slice of the result to the client or server using a subset of - * a server-side row set. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.0 - * @since 1.9.0 - */ -public class RowSetNavigatorClient extends RowSetNavigator { - - public static final Object[][] emptyTable = new Object[0][]; - - // - int currentOffset; - int baseBlockSize; - - // - Object[][] table; - - // - public RowSetNavigatorClient() { - table = emptyTable; - } - - public RowSetNavigatorClient(int blockSize) { - table = new Object[blockSize][]; - } - - public RowSetNavigatorClient(RowSetNavigator source, int offset, - int blockSize) { - - this.size = source.size; - this.baseBlockSize = blockSize; - this.currentOffset = offset; - table = new Object[blockSize][]; - - source.absolute(offset); - - for (int count = 0; count < blockSize; count++) { - table[count] = source.getCurrent(); - - source.next(); - } - - source.beforeFirst(); - } - - /** - * For communication of small results such as BATCHEXECRESPONSE - */ - public void setData(Object[][] table) { - this.table = table; - this.size = table.length; - } - - public void setData(int index, Object[] data) { - table[index] = data; - } - - public Object[] getData(int index) { - return table[index]; - } - - /** - * Returns the current row object. Type of object is implementation defined. - */ - public Object[] getCurrent() { - - if (currentPos < 0 || currentPos >= size) { - return null; - } - - if (currentPos >= currentOffset + table.length) { - getBlock(currentOffset + table.length); - } - - return table[currentPos - currentOffset]; - } - - public Row getCurrentRow() { - throw Error.runtimeError(ErrorCode.U_S0500, "RowSetNavigatorClient"); - } - - /** - * Only for navigators for INSERT - */ - public void removeCurrent() { - - System.arraycopy(table, currentPos + 1, table, currentPos, - size - currentPos - 1); - - table[size - 1] = null; - - currentPos--; - size--; - } - - public void add(Object[] data) { - - ensureCapacity(); - - table[size] = data; - - size++; - } - - public boolean addRow(Row row) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowSetNavigatorClient"); - } - - public void clear() { - - setData(emptyTable); - - size = 0; - - reset(); - } - - public void release() { - - setData(emptyTable); - reset(); - - isClosed = true; - } - - public boolean absolute(int position) { - - if (position < 0) { - position += size; - } - - if (position < 0) { - beforeFirst(); - - return false; - } - - if (position >= size) { - afterLast(); - - return false; - } - - if (size == 0) { - return false; - } - - currentPos = position; - - return true; - } - - public void readSimple(RowInputInterface in, ResultMetaData meta) { - - size = in.readInt(); - - if (table.length < size) { - table = new Object[size][]; - } - - for (int i = 0; i < size; i++) { - table[i] = in.readData(meta.columnTypes); - } - } - - public void writeSimple(RowOutputInterface out, ResultMetaData meta) { - - out.writeInt(size); - - for (int i = 0; i < size; i++) { - Object[] data = table[i]; - - out.writeData(meta.getColumnCount(), meta.columnTypes, data, null, - null); - } - } - - public void read(RowInputInterface in, ResultMetaData meta) { - - id = in.readLong(); - size = in.readInt(); - currentOffset = in.readInt(); - baseBlockSize = in.readInt(); - - if (table.length < baseBlockSize) { - table = new Object[baseBlockSize][]; - } - - for (int i = 0; i < baseBlockSize; i++) { - table[i] = in.readData(meta.columnTypes); - } - } - - public void write(RowOutputInterface out, ResultMetaData meta) { - - int limit = size - currentOffset; - - if (limit > table.length) { - limit = table.length; - } - - out.writeLong(id); - out.writeInt(size); - out.writeInt(currentOffset); - out.writeInt(limit); - - for (int i = 0; i < limit; i++) { - Object[] data = table[i]; - - out.writeData(meta.getColumnCount(), meta.columnTypes, data, null, - null); - } - } - - /** - * baseBlockSize remains unchanged. - */ - void getBlock(int offset) { - - try { - RowSetNavigatorClient source = session.getRows(id, offset, - baseBlockSize); - - table = source.table; - currentOffset = source.currentOffset; - } catch (HsqlException e) {} - } - - private void ensureCapacity() { - - if (size == table.length) { - int newSize = size == 0 ? 4 - : size * 2; - Object[][] newTable = new Object[newSize][]; - - System.arraycopy(table, 0, newTable, 0, size); - - table = newTable; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorData.java b/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorData.java deleted file mode 100644 index 8b787fed..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorData.java +++ /dev/null @@ -1,778 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -import java.util.Comparator; -import java.util.TreeMap; - -import org.hsqldb.QueryExpression; -import org.hsqldb.QuerySpecification; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.SortAndSlice; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.lib.ArraySort; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.LongKeyHashMap; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * Implementation of RowSetNavigator for result sets. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.1 - * @since 1.9.0 - */ -public class RowSetNavigatorData extends RowSetNavigator -implements Comparator { - - public static final Object[][] emptyTable = new Object[0][]; - - // - private Object[][] dataTable = emptyTable; - - // - int visibleColumnCount; - boolean isAggregate; - boolean isSimpleAggregate; - Object[] simpleAggregateData; - - // - boolean reindexTable; - - // - Index mainIndex; - Index fullIndex; - Index orderIndex; - Index groupIndex; - Index idIndex; - - // - final SortAndSlice sortAndSlice; - - // - TreeMap groupMap; - LongKeyHashMap idMap; - - RowSetNavigatorData(Session session, SortAndSlice sortAndSlice) { - this.session = session; - this.sortAndSlice = sortAndSlice; - } - - public RowSetNavigatorData(Session session, QuerySpecification select) { - - this.session = session; - this.rangePosition = select.resultRangePosition; - visibleColumnCount = select.getColumnCount(); - isSimpleAggregate = select.isAggregated && !select.isGrouped; - mainIndex = select.mainIndex; - fullIndex = select.fullIndex; - orderIndex = select.orderIndex; - sortAndSlice = select.sortAndSlice; - - if (select.isGrouped) { - mainIndex = select.groupIndex; - groupMap = new TreeMap(this); - } - - if (select.idIndex != null) { - idMap = new LongKeyHashMap(); - } - } - - public RowSetNavigatorData(Session session, - QueryExpression queryExpression) { - - this.session = session; - mainIndex = queryExpression.mainIndex; - fullIndex = queryExpression.fullIndex; - orderIndex = queryExpression.orderIndex; - visibleColumnCount = queryExpression.getColumnCount(); - sortAndSlice = queryExpression.sortAndSlice; - } - - public RowSetNavigatorData(Session session, RowSetNavigator navigator) { - - this.session = session; - sortAndSlice = SortAndSlice.noSort; - - setCapacity(navigator.size); - - while (navigator.next()) { - add(navigator.getCurrent()); - } - } - - public void sortFull() { - - mainIndex = fullIndex; - - ArraySort.sort(dataTable, size, this); - reset(); - } - - public void sortOrder() { - - if (orderIndex != null) { - mainIndex = orderIndex; - - ArraySort.sort(dataTable, size, this); - } - - reset(); - } - - public void sortOrderUnion(SortAndSlice sortAndSlice) { - - if (sortAndSlice.index != null) { - mainIndex = sortAndSlice.index; - - ArraySort.sort(dataTable, size, this); - reset(); - } - } - - public void add(Object[] data) { - - ensureCapacity(); - - dataTable[size] = data; - - if (groupMap != null) { - groupMap.put(data, size); - } - - if (idMap != null) { - Long id = (Long) data[visibleColumnCount]; - - idMap.put(id.longValue(), data); - } - - size++; - } - - public void setPosition(Object[] data) { - - Integer mapPos = groupMap.get(data); - - if (mapPos == null) { - return; - } - - int pos = mapPos.intValue(); - - currentPos = pos; - } - - public boolean addRow(Row row) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowSetNavigatorData"); - } - - public void update(Object[] oldData, Object[] newData) { - - // noop - } - - void addAdjusted(Object[] data, int[] columnMap) { - - data = projectData(data, columnMap); - - add(data); - } - - void insertAdjusted(Object[] data, int[] columnMap) { - data = projectData(data, columnMap); - insert(data); - } - - Object[] projectData(Object[] data, int[] columnMap) { - - if (columnMap == null) { - data = (Object[]) ArrayUtil.resizeArrayIfDifferent(data, - visibleColumnCount); - } else { - Object[] newData = new Object[visibleColumnCount]; - - ArrayUtil.projectRow(data, columnMap, newData); - - data = newData; - } - - return data; - } - - /** - * for union only - */ - void insert(Object[] data) { - - ensureCapacity(); - System.arraycopy(dataTable, currentPos, dataTable, currentPos + 1, - size - currentPos); - - dataTable[currentPos] = data; - - size++; - } - - public Object[][] getDataTable() { - return dataTable; - } - - public void release() { - - this.dataTable = emptyTable; - this.size = 0; - - reset(); - - isClosed = true; - } - - public void clear() { - - this.dataTable = emptyTable; - this.size = 0; - - reset(); - } - - public void resetRowMap() { - groupMap = new TreeMap(this); - } - - public boolean absolute(int position) { - return super.absolute(position); - } - - public Object[] getCurrent() { - - if (currentPos < 0 || currentPos >= size) { - return null; - } - - return dataTable[currentPos]; - } - - public Row getCurrentRow() { - throw Error.runtimeError(ErrorCode.U_S0500, "RowSetNavigatorData"); - } - - public Object[] getNextRowData() { - return next() ? getCurrent() - : null; - } - - public boolean next() { - return super.next(); - } - - public void removeCurrent() { - - System.arraycopy(dataTable, currentPos + 1, dataTable, currentPos, - size - currentPos - 1); - - dataTable[size - 1] = null; - - currentPos--; - size--; - } - - public void removeRange(int start, int rows) { - - ArrayUtil.adjustArray(ArrayUtil.CLASS_CODE_OBJECT, dataTable, size, - start, -rows); - - if (currentPos >= start + rows) { - currentPos -= rows; - } else if (currentPos >= start) { - currentPos = start; - } - - size -= rows; - } - - public void reset() { - super.reset(); - } - - public boolean isMemory() { - return true; - } - - public void read(RowInputInterface in, ResultMetaData meta) {} - - public void write(RowOutputInterface out, ResultMetaData meta) { - - reset(); - out.writeLong(id); - out.writeInt(size); - out.writeInt(0); // offset - out.writeInt(size); - - while (next()) { - Object[] data = getCurrent(); - - out.writeData(meta.getExtendedColumnCount(), meta.columnTypes, - data, null, null); - } - - reset(); - } - - public Object[] getData(long rowId) { - return (Object[]) idMap.get(rowId); - } - - public void copy(RowIterator other, int[] rightColumnIndexes) { - - while (other.next()) { - Object[] currentData = other.getCurrent(); - - addAdjusted(currentData, rightColumnIndexes); - } - } - - public void union(RowSetNavigatorData other) { - - Object[] currentData; - - removeDuplicates(); - other.removeDuplicates(); - - mainIndex = fullIndex; - - while (other.next()) { - currentData = other.getCurrent(); - - int position = ArraySort.searchFirst(dataTable, 0, size, - currentData, this); - - if (position < 0) { - position = -position - 1; - currentPos = position; - - insert(currentData); - } - } - - reset(); - } - - public void unionAll(RowSetNavigatorData other) { - - mainIndex = fullIndex; - - other.reset(); - - while (other.next()) { - Object[] currentData = other.getCurrent(); - - add(currentData); - } - - reset(); - } - - public void intersect(RowSetNavigatorData other) { - - removeDuplicates(); - other.sortFull(); - - while (next()) { - Object[] currentData = getCurrent(); - boolean hasRow = other.containsRow(currentData); - - if (!hasRow) { - removeCurrent(); - } - } - - reset(); - } - - public void intersectAll(RowSetNavigatorData other) { - - Object[] compareData = null; - RowIterator it; - Object[] otherData = null; - - sortFull(); - other.sortFull(); - - it = RowIterator.emptyRowIterator; - - while (next()) { - Object[] currentData = getCurrent(); - boolean newGroup = - compareData == null - || fullIndex.compareRowNonUnique( - (Session) session, currentData, compareData, - visibleColumnCount) != 0; - - if (newGroup) { - compareData = currentData; - it = other.findFirstRow(currentData); - } - - if (it.next()) { - otherData = it.getCurrent(); - - if (fullIndex.compareRowNonUnique( - (Session) session, currentData, otherData, - visibleColumnCount) == 0) { - continue; - } - } - - removeCurrent(); - } - - reset(); - } - - public void except(RowSetNavigatorData other) { - - removeDuplicates(); - other.sortFull(); - - while (next()) { - Object[] currentData = getCurrent(); - boolean hasRow = other.containsRow(currentData); - - if (hasRow) { - removeCurrent(); - } - } - - reset(); - } - - public void exceptNoDedup(RowSetNavigatorData other) { - - other.sortFull(); - reset(); - - while (next()) { - Object[] currentData = getCurrent(); - boolean hasRow = other.containsRow(currentData); - - if (hasRow) { - removeCurrent(); - } - } - - reset(); - } - - public void exceptAll(RowSetNavigatorData other) { - - Object[] compareData = null; - RowIterator it; - Object[] otherData = null; - - sortFull(); - other.sortFull(); - - it = RowIterator.emptyRowIterator; - - while (next()) { - Object[] currentData = getCurrent(); - boolean newGroup = - compareData == null - || fullIndex.compareRowNonUnique( - (Session) session, currentData, compareData, - fullIndex.getColumnCount()) != 0; - - if (newGroup) { - compareData = currentData; - it = other.findFirstRow(currentData); - } - - if (it.next()) { - otherData = it.getCurrent(); - - if (fullIndex.compareRowNonUnique( - (Session) session, currentData, otherData, - fullIndex.getColumnCount()) == 0) { - removeCurrent(); - } - } - } - - reset(); - } - - public boolean hasUniqueNotNullRows() { - - sortFull(); - reset(); - - Object[] lastRowData = null; - - while (next()) { - Object[] currentData = getCurrent(); - - if (hasNull(currentData)) { - continue; - } - - if (lastRowData != null - && fullIndex.compareRow( - (Session) session, lastRowData, currentData) == 0) { - return false; - } else { - lastRowData = currentData; - } - } - - return true; - } - - public void removeDuplicates() { - - sortFull(); - reset(); - - int lastRowPos = -1; - Object[] lastRowData = null; - - while (next()) { - Object[] currentData = getCurrent(); - - if (lastRowData == null) { - lastRowPos = currentPos; - lastRowData = currentData; - - continue; - } - - if (fullIndex.compareRow( - (Session) session, lastRowData, currentData) != 0) { - lastRowPos++; - - lastRowData = currentData; - dataTable[lastRowPos] = currentData; - } - } - - for (int i = lastRowPos + 1; i < size; i++) { - dataTable[i] = null; - } - - super.size = lastRowPos + 1; - - reset(); - } - - public void trim(int limitstart, int limitcount) { - - if (size == 0) { - return; - } - - if (limitstart >= size) { - clear(); - - return; - } - - if ((long) limitstart + limitcount < size) { - reset(); - removeRange(limitstart + limitcount, - size - limitstart - limitcount); - } - - removeRange(0, limitstart); - } - - boolean hasNull(Object[] data) { - - for (int i = 0; i < visibleColumnCount; i++) { - if (data[i] == null) { - return true; - } - } - - return false; - } - - /** - * Special case for isSimpleAggregate cannot use index lookup. - */ - public Object[] getGroupData(Object[] data) { - - if (isSimpleAggregate) { - if (simpleAggregateData == null) { - simpleAggregateData = data; - - return null; - } - - return simpleAggregateData; - } - - Integer position = groupMap.get(data); - - if (position == null) { - return null; - } - - int pos = position.intValue(); - - return dataTable[pos]; - } - - /** - * Special case for isSimpleAggregate cannot use index lookup. - */ - public Object[] getGroupDataAndPosition(Object[] data) { - - Integer mapPos = groupMap.get(data); - - if (mapPos == null) { - return null; - } - - int pos = mapPos.intValue(); - - currentPos = pos; - - return dataTable[pos]; - } - - boolean containsRow(Object[] data) { - - int position = ArraySort.searchFirst(dataTable, 0, size, data, this); - - return position >= 0; - } - - RowIterator findFirstRow(Object[] data) { - - int position = ArraySort.searchFirst(dataTable, 0, size, data, this); - - if (position < 0) { - position = size; - } else { - position--; - } - - return new DataIterator(position); - } - - /** - * baseBlockSize remains unchanged. - */ - void getBlock(int offset) { - - // no op for no blocks - } - - private void setCapacity(int newSize) { - - if (size > dataTable.length) { - dataTable = new Object[newSize][]; - } - } - - private void ensureCapacity() { - - if (size == dataTable.length) { - int newSize = size == 0 ? 4 - : size * 2; - Object[][] newTable = new Object[newSize][]; - - System.arraycopy(dataTable, 0, newTable, 0, size); - - dataTable = newTable; - } - } - - class DataIterator implements RowIterator { - - int pos; - - DataIterator(int position) { - pos = position; - } - - public Object getField(int col) { - - if (pos < size) { - return dataTable[pos][col]; - } else { - return null; - } - } - - public boolean next() { - - if (pos < size - 1) { - pos++; - - return true; - } - - return false; - } - - public Row getCurrentRow() { - return null; - } - - public Object[] getCurrent() { - - if (pos < size) { - return dataTable[pos]; - } else { - return null; - } - } - - public void removeCurrent() {} - - public void release() {} - - public long getRowId() { - return 0L; - } - } - - public int compare(Object[] a, Object[] b) { - return mainIndex.compareRow((Session) session, a, b); - } -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataChange.java b/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataChange.java deleted file mode 100644 index b908b7cc..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataChange.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2001-2020, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -import java.io.IOException; - -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; -import org.hsqldb.types.Type; - -/* - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.0 - * @since 2.2.7 - */ -public interface RowSetNavigatorDataChange extends RangeIterator { - - int getSize(); - - int getRowPosition(); - - boolean beforeFirst(); - - Object[] getCurrentChangedData(); - - int[] getCurrentChangedColumns(); - - void write(RowOutputInterface out, ResultMetaData meta) throws IOException; - - void read(RowInputInterface in, ResultMetaData meta) throws IOException; - - void endMainDataSet(); - - boolean addRow(Row row); - - Object[] addRow(Session session, Row row, Object[] data, Type[] types, - int[] columnMap); - - boolean addUpdate(Row row, Object[] data, int[] columnMap); - - boolean containsDeletedRow(Row row); - - boolean containsUpdatedRow(Row row, Row refRow, int[] keys); - - RangeIterator getUpdateRowIterator(); -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataChangeMemory.java b/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataChangeMemory.java deleted file mode 100644 index 6a976b9a..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataChangeMemory.java +++ /dev/null @@ -1,342 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.OrderedLongKeyHashMap; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; -import org.hsqldb.types.Type; - -/* - * All-in-memory implementation of RowSetNavigator for delete and update - * operations. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public class RowSetNavigatorDataChangeMemory -implements RowSetNavigatorDataChange { - - public static final RowSetNavigatorDataChangeMemory emptyRowSet = - new RowSetNavigatorDataChangeMemory(null); - int size; - int currentPos = -1; - OrderedLongKeyHashMap list; - Session session; - - public RowSetNavigatorDataChangeMemory(Session session) { - this.session = session; - list = new OrderedLongKeyHashMap(64, true); - } - - public void release() { - - beforeFirst(); - list.clear(); - - size = 0; - } - - public int getSize() { - return size; - } - - public int getRowPosition() { - return currentPos; - } - - public boolean next() { - - if (currentPos < size - 1) { - currentPos++; - - return true; - } - - currentPos = size - 1; - - return false; - } - - public boolean beforeFirst() { - - currentPos = -1; - - return true; - } - - public Row getCurrentRow() { - return (Row) list.getValueAt(currentPos); - } - - public Object[] getCurrentChangedData() { - return (Object[]) list.getSecondValueAt(currentPos); - } - - public int[] getCurrentChangedColumns() { - return (int[]) list.getThirdValueAt(currentPos); - } - - // reading and writing - public void write(RowOutputInterface out, ResultMetaData meta) {} - - public void read(RowInputInterface in, ResultMetaData meta) {} - - public void endMainDataSet() {} - - public boolean addRow(Row row) { - - int lookup = list.getLookup(row.getId()); - - if (lookup == -1) { - list.put(row.getId(), row); - - size++; - - return true; - } else { - if (list.getSecondValueAt(lookup) != null) { - if (session.database.sqlEnforceTDCD) { - throw Error.error(ErrorCode.X_27000); - } - - list.setSecondValueAt(lookup, null); - list.setThirdValueAt(lookup, null); - - return true; - } - - return false; - } - } - - public boolean addUpdate(Row row, Object[] data, int[] columnMap) { - - int lookup = list.getLookup(row.getId()); - - if (lookup == -1) { - return false; - } - - list.setSecondValueAt(lookup, data); - list.setThirdValueAt(lookup, columnMap); - - return true; - } - - public Object[] addRow(Session session, Row row, Object[] data, - Type[] types, int[] columnMap) { - - long rowId = row.getId(); - int lookup = list.getLookup(rowId); - - if (lookup == -1) { - list.put(rowId, row); - list.setSecondValueAt(size, data); - list.setThirdValueAt(size, columnMap); - - size++; - - return data; - } else { - Object[] rowData = ((Row) list.getValueAt(lookup)).getData(); - Object[] currentData = - (Object[]) list.getSecondValueAt(lookup); - - if (currentData == null) { - if (session.database.sqlEnforceTDCD) { - throw Error.error(ErrorCode.X_27000); - } else { - return null; - } - } - - for (int i = 0; i < columnMap.length; i++) { - int j = columnMap[i]; - - if (types[j].compare(session, data[j], currentData[j]) != 0) { - if (types[j].compare(session, rowData[j], currentData[j]) - != 0) { - if (session.database.sqlEnforceTDCU) { - throw Error.error(ErrorCode.X_27000); - } - } else { - currentData[j] = data[j]; - } - } - } - - int[] currentMap = (int[]) list.getThirdValueAt(lookup); - - currentMap = ArrayUtil.union(currentMap, columnMap); - - list.setThirdValueAt(lookup, currentMap); - - return currentData; - } - } - - public boolean containsDeletedRow(Row refRow) { - - int lookup = list.getLookup(refRow.getId()); - - if (lookup == -1) { - return false; - } - - Object[] currentData = (Object[]) list.getSecondValueAt(lookup); - - return currentData == null; - } - - public boolean containsUpdatedRow(Row row, Row refRow, int[] keys) { - - int lookup = list.getLookup(refRow.getId()); - - if (lookup > -1) { - return true; - } - - Object[] rowData = row.getData(); - - outerloop: - for (int i = 0; i < size; i++) { - Row oldRow = (Row) list.getValueAt(i); - - if (oldRow.getTable() != row.getTable()) { - continue; - } - - Type[] types = row.getTable().getColumnTypes(); - Object[] data = (Object[]) list.getSecondValueAt(i); - - for (int j = 0; j < keys.length; j++) { - int pos = keys[j]; - - if (types[pos].compare(session, rowData[pos], data[pos]) - != 0) { - continue outerloop; - } - } - - return true; - } - - return false; - } - - public void removeCurrent() {} - - public long getRowId() { - return getCurrentRow().getId(); - } - - public boolean isBeforeFirst() { - return currentPos == -1; - } - - public Object[] getCurrent() { - return getCurrentRow().getData(); - } - - public Object getField(int col) { - return getCurrentRow().getData()[col]; - } - - public void setCurrent(Object[] data) {} - - public void reset() { - beforeFirst(); - } - - public int getRangePosition() { - return 1; - } - - public RangeIterator getUpdateRowIterator() { - return new UpdateRowIterator(); - } - - class UpdateRowIterator implements RangeIterator { - - public void removeCurrent() {} - - public void release() {} - - public long getRowId() { - return 0; - } - - public boolean beforeFirst() { - return RowSetNavigatorDataChangeMemory.this.beforeFirst(); - } - - public Row getCurrentRow() { - return null; - } - - public boolean next() { - return RowSetNavigatorDataChangeMemory.this.next(); - } - - public boolean isBeforeFirst() { - return RowSetNavigatorDataChangeMemory.this.isBeforeFirst(); - } - - public Object[] getCurrent() { - return RowSetNavigatorDataChangeMemory.this - .getCurrentChangedData(); - } - - public Object getField(int col) { - return RowSetNavigatorDataChangeMemory.this - .getCurrentChangedData()[col]; - } - - public void setCurrent(Object[] data) {} - - public void reset() { - beforeFirst(); - } - - public int getRangePosition() { - return 2; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataTable.java b/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataTable.java deleted file mode 100644 index 589f8cd5..00000000 --- a/database/hsqldb/src/org/hsqldb/navigator/RowSetNavigatorDataTable.java +++ /dev/null @@ -1,633 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.navigator; - -import org.hsqldb.HsqlException; -import org.hsqldb.QueryExpression; -import org.hsqldb.QuerySpecification; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.SortAndSlice; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.persist.PersistentStore; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * Implementation of RowSetNavigator using a table as the data store. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public class RowSetNavigatorDataTable extends RowSetNavigatorData { - - public TableBase table; - public PersistentStore store; - RowIterator iterator; - Row currentRow; - Object[] tempRowData; - - public RowSetNavigatorDataTable(Session session, - QuerySpecification select) { - - super(session, select.sortAndSlice); - - rangePosition = select.resultRangePosition; - visibleColumnCount = select.indexLimitVisible; - table = select.resultTable.duplicate(); - store = session.sessionData.getNewResultRowStore(table, - !select.isAggregated); - table.store = store; - isAggregate = select.isAggregated; - isSimpleAggregate = select.isAggregated && !select.isGrouped; - reindexTable = select.isGrouped; - mainIndex = select.mainIndex; - fullIndex = select.fullIndex; - orderIndex = select.orderIndex; - groupIndex = select.groupIndex; - idIndex = select.idIndex; - tempRowData = new Object[1]; - } - - public RowSetNavigatorDataTable(Session session, - QuerySpecification select, - RowSetNavigatorData navigator) { - - this(session, select); - - navigator.reset(); - - while (navigator.next()) { - add(navigator.getCurrent()); - } - } - - public RowSetNavigatorDataTable(Session session, - QueryExpression queryExpression) { - - super(session, queryExpression.sortAndSlice); - - table = queryExpression.resultTable.duplicate(); - visibleColumnCount = table.getColumnCount(); - store = session.sessionData.getNewResultRowStore(table, true); - table.store = store; - mainIndex = queryExpression.mainIndex; - fullIndex = queryExpression.fullIndex; - } - - public RowSetNavigatorDataTable(Session session, Table table) { - - super(session, SortAndSlice.noSort); - - this.table = table; - visibleColumnCount = table.getColumnCount(); - mainIndex = table.getPrimaryIndex(); - fullIndex = table.getFullIndex(session); - store = table.getRowStore(session); - size = (int) store.elementCount(); - - reset(); - } - - public void sortFull() { - - if (reindexTable) { - store.indexRows((Session) session); - } - - mainIndex = fullIndex; - - reset(); - } - - public void sortOrder() { - - if (orderIndex != null) { - if (reindexTable) { - store.indexRows((Session) session); - } - - mainIndex = orderIndex; - - if (iterator != null) { - iterator.release(); - } - - reset(); - } - } - - public void sortOrderUnion(SortAndSlice sortAndSlice) { - - if (sortAndSlice.index != null) { - mainIndex = sortAndSlice.index; - - reset(); - } - } - - public void add(Object[] data) { - - try { - if (table.getDataColumnCount() > data.length) { - Object[] d = table.getEmptyRowData(); - - ArrayUtil.copyArray(data, d, data.length); - - data = d; - } - - Row row = (Row) store.getNewCachedObject((Session) session, data, - false); - - store.indexRow((Session) session, row); - - size++; - } catch (HsqlException e) {} - } - - void addAdjusted(Object[] data, int[] columnMap) { - - try { - if (columnMap == null) { - data = (Object[]) ArrayUtil.resizeArrayIfDifferent(data, - visibleColumnCount); - } else { - Object[] newData = new Object[visibleColumnCount]; - - ArrayUtil.projectRow(data, columnMap, newData); - - data = newData; - } - - add(data); - } catch (HsqlException e) {} - } - - public void update(Object[] oldData, Object[] newData) { - - if (isSimpleAggregate) { - return; - } - - RowIterator it = groupIndex.findFirstRow((Session) session, store, - oldData); - - if (it.next()) { - it.removeCurrent(); - it.release(); - - size--; - - add(newData); - } - } - - public boolean absolute(int position) { - return super.absolute(position); - } - - public Object[] getCurrent() { - return currentRow.getData(); - } - - public Row getCurrentRow() { - return currentRow; - } - - public boolean next() { - - boolean result = super.next(); - - if (!result) { - return false; - } - - iterator.next(); - - currentRow = iterator.getCurrentRow(); - - return result; - } - - public void removeCurrent() { - - if (currentRow != null) { - iterator.removeCurrent(); - - currentRow = null; - - currentPos--; - size--; - } - } - - public void reset() { - - super.reset(); - - if (iterator != null) { - iterator.release(); - } - - iterator = mainIndex.firstRow((Session) session, store, null, 0, null); - } - - public void release() { - - if (isClosed) { - return; - } - - iterator.release(); - store.release(); - - isClosed = true; - } - - public void clear() { - - store.removeAll(); - - size = 0; - - reset(); - } - - public boolean isMemory() { - return store.isMemory(); - } - - public void read(RowInputInterface in, ResultMetaData meta) {} - - public void write(RowOutputInterface out, ResultMetaData meta) { - - reset(); - out.writeLong(id); - out.writeInt(size); - out.writeInt(0); // offset - out.writeInt(size); - - while (next()) { - Object[] data = getCurrent(); - - out.writeData(meta.getExtendedColumnCount(), meta.columnTypes, - data, null, null); - } - - reset(); - } - - public Object[] getData(Long rowId) { - - tempRowData[0] = rowId; - - RowIterator it = idIndex.findFirstRow((Session) session, store, - tempRowData, - idIndex.getDefaultColumnMap()); - - it.next(); - - return it.getCurrent(); - } - - public void copy(RowSetNavigatorData other, int[] rightColumnIndexes) { - - while (other.next()) { - Object[] currentData = other.getCurrent(); - - addAdjusted(currentData, rightColumnIndexes); - } - } - - public void union(RowSetNavigatorData other) { - - Object[] currentData; - int colCount = table.getColumnTypes().length; - - removeDuplicates(); - other.reset(); - - while (other.next()) { - currentData = other.getCurrent(); - - RowIterator it = findFirstRow(currentData); - - if (!it.next()) { - currentData = - (Object[]) ArrayUtil.resizeArrayIfDifferent(currentData, - colCount); - - add(currentData); - } - - it.release(); - } - - reset(); - } - - public void intersect(RowSetNavigatorData other) { - - removeDuplicates(); - other.sortFull(); - - while (next()) { - Object[] currentData = getCurrent(); - boolean hasRow = other.containsRow(currentData); - - if (!hasRow) { - removeCurrent(); - } - } - - reset(); - } - - public void intersectAll(RowSetNavigatorData other) { - - Object[] compareData = null; - RowIterator it; - Row otherRow = null; - Object[] otherData = null; - - sortFull(); - other.sortFull(); - - it = RowIterator.emptyRowIterator; - - while (next()) { - Object[] currentData = getCurrent(); - boolean newGroup = - compareData == null - || fullIndex.compareRowNonUnique( - (Session) session, currentData, compareData, - fullIndex.getColumnCount()) != 0; - - if (newGroup) { - compareData = currentData; - it = other.findFirstRow(currentData); - } - - if (it.next()) { - otherData = it.getCurrent(); - - if (fullIndex.compareRowNonUnique( - (Session) session, currentData, otherData, - fullIndex.getColumnCount()) == 0) { - continue; - } - } - - removeCurrent(); - } - - reset(); - } - - public void except(RowSetNavigatorData other) { - - removeDuplicates(); - other.sortFull(); - - while (next()) { - Object[] currentData = getCurrent(); - boolean hasRow = other.containsRow(currentData); - - if (hasRow) { - removeCurrent(); - } - } - - reset(); - } - - public void exceptNoDedup(RowSetNavigatorData other) { - - other.sortFull(); - reset(); - - while (next()) { - Object[] currentData = getCurrent(); - boolean hasRow = other.containsRow(currentData); - - if (hasRow) { - removeCurrent(); - } - } - - reset(); - } - - public void exceptAll(RowSetNavigatorData other) { - - Object[] compareData = null; - RowIterator it; - Object[] otherData = null; - - sortFull(); - other.sortFull(); - - it = RowIterator.emptyRowIterator; - - while (next()) { - Object[] currentData = getCurrent(); - boolean newGroup = - compareData == null - || fullIndex.compareRowNonUnique( - (Session) session, currentData, compareData, - fullIndex.getColumnCount()) != 0; - - if (newGroup) { - compareData = currentData; - it = other.findFirstRow(currentData); - } - - if (it.next()) { - otherData = it.getCurrent(); - - if (fullIndex.compareRowNonUnique( - (Session) session, currentData, otherData, - fullIndex.getColumnCount()) == 0) { - removeCurrent(); - } - } - } - - reset(); - } - - public boolean hasUniqueNotNullRows() { - - sortFull(); - - Object[] lastRowData = null; - - while (next()) { - Object[] currentData = getCurrent(); - - if (hasNull(currentData)) { - continue; - } - - if (lastRowData != null - && fullIndex.compareRow( - (Session) session, lastRowData, currentData) == 0) { - return false; - } else { - lastRowData = currentData; - } - } - - return true; - } - - public void removeDuplicates() { - - sortFull(); - - Object[] lastRowData = null; - - while (next()) { - Object[] currentData = getCurrent(); - - if (lastRowData != null - && fullIndex.compareRow( - (Session) session, lastRowData, currentData) == 0) { - removeCurrent(); - } else { - lastRowData = currentData; - } - } - - reset(); - } - - public void trim(int limitstart, int limitcount) { - - if (size == 0) { - return; - } - - if (limitstart >= size) { - clear(); - - return; - } - - if (limitstart != 0) { - reset(); - - for (int i = 0; i < limitstart; i++) { - next(); - removeCurrent(); - } - } - - if (limitcount == 0 || limitcount >= size) { - return; - } - - reset(); - - for (int i = 0; i < limitcount; i++) { - next(); - } - - while (next()) { - removeCurrent(); - } - - reset(); - } - - boolean hasNull(Object[] data) { - - for (int i = 0; i < visibleColumnCount; i++) { - if (data[i] == null) { - return true; - } - } - - return false; - } - - /** - * Special case for isSimpleAggregate cannot use index lookup. - */ - public Object[] getGroupData(Object[] data) { - - if (isSimpleAggregate) { - if (simpleAggregateData == null) { - simpleAggregateData = data; - - return null; - } - - return simpleAggregateData; - } - - RowIterator it = groupIndex.findFirstRow((Session) session, store, - data); - - if (it.next()) { - Row row = it.getCurrentRow(); - - if (isAggregate) { - row.setChanged(true); - } - - return row.getData(); - } - - return null; - } - - boolean containsRow(Object[] data) { - - RowIterator it = mainIndex.findFirstRow((Session) session, store, - data); - boolean result = it.next(); - - it.release(); - - return result; - } - - RowIterator findFirstRow(Object[] data) { - return mainIndex.findFirstRow((Session) session, store, data); - } -} diff --git a/database/hsqldb/src/org/hsqldb/package-info.java b/database/hsqldb/src/org/hsqldb/package-info.java deleted file mode 100644 index 0194e1bd..00000000 --- a/database/hsqldb/src/org/hsqldb/package-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains the HyperSQL engine classes. - */ -package org.hsqldb; diff --git a/database/hsqldb/src/org/hsqldb/persist/BitMapCachedObject.java b/database/hsqldb/src/org/hsqldb/persist/BitMapCachedObject.java deleted file mode 100644 index 15543e15..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/BitMapCachedObject.java +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.LongLookup; -import org.hsqldb.map.BitMap; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.3 - * @since 2.3.0 - */ -public class BitMapCachedObject extends CachedObjectBase { - - public static final int fileSizeFactor = 4; - - // - BitMap bitMap; - - public BitMapCachedObject(int capacity) { - bitMap = new BitMap(new int[capacity]); - hasChanged = true; - } - - public void read(RowInputInterface in) { - - this.position = in.getFilePosition(); - - int[] array = bitMap.getIntArray(); - int capacity = array.length; - - for (int i = 0; i < capacity; i++) { - array[i] = in.readInt(); - } - - hasChanged = false; - } - - public int getDefaultCapacity() { - return bitMap.getIntArray().length; - } - - public int getRealSize(RowOutputInterface out) { - return bitMap.getIntArray().length * PersistentStore.INT_STORE_SIZE; - } - - public void write(RowOutputInterface out) { - write(out, null); - } - - public void write(RowOutputInterface out, LongLookup lookup) { - - int[] array = bitMap.getIntArray(); - int capacity = array.length; - - out.setStorageSize(storageSize); - - for (int i = 0; i < capacity; i++) { - out.writeInt(array[i]); - } - - out.writeEnd(); - } - - public BitMap getBitMap() { - return bitMap; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/BlockObjectStore.java b/database/hsqldb/src/org/hsqldb/persist/BlockObjectStore.java deleted file mode 100644 index 0fcf7459..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/BlockObjectStore.java +++ /dev/null @@ -1,132 +0,0 @@ -/* Copyright (c) 2001-2020, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.lang.reflect.Constructor; - -import org.hsqldb.Session; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.rowio.RowInputInterface; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.3.0 - */ -public class BlockObjectStore extends SimpleStore { - - final Class objectClass; - final Constructor constructor; - final int storageSize; - final int blockSize; - - public BlockObjectStore(DataFileCache cache, - TableSpaceManager tableSpaceManager, - Class objectClass, int storageSize, - int blockSize) { - - this.cache = cache; - this.spaceManager = tableSpaceManager; - this.objectClass = objectClass; - this.blockSize = blockSize; - this.storageSize = storageSize; - - try { - this.constructor = objectClass.getConstructor(int.class); - } catch (Exception e) { - throw Error.runtimeError(ErrorCode.U_S0500, "BlockObjectStore"); - } - } - - public CachedObject get(CachedObject object, boolean keep) { - return cache.get(object.getPos(), storageSize, this, keep); - } - - public CachedObject get(long i, boolean keep) { - return cache.get(i, storageSize, this, keep); - } - - public void add(Session session, CachedObject object, boolean tx) { - throw Error.runtimeError(ErrorCode.U_S0500, "BlockObjectStore"); - } - - public void add(CachedObject object, boolean keep) { - - int size = object.getRealSize(cache.rowOut); - - if (size > storageSize) { - throw Error.runtimeError(ErrorCode.U_S0500, "BlockObjectStore"); - } - - object.setStorageSize(storageSize); - - long pos = spaceManager.getFilePosition(storageSize); - - object.setPos(pos); - cache.add(object, keep); - } - - public CachedObject get(RowInputInterface in) { - - CachedObject object = getNewInstance(); - - object.read(in); - - int size = object.getRealSize(cache.rowOut); - - if (size > storageSize) { - throw Error.runtimeError(ErrorCode.U_S0500, "BlockObjectStore"); - } - - object.setStorageSize(storageSize); - - return object; - } - - public CachedObject getNewInstance(int size) { - throw Error.runtimeError(ErrorCode.U_S0500, "BlockObjectStore"); - } - - private CachedObject getNewInstance() { - - try { - CachedObject object = - (CachedObject) constructor.newInstance(new Object[]{ - Integer.valueOf(blockSize) }); - - return object; - } catch (Exception e) { - return null; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/Cache.java b/database/hsqldb/src/org/hsqldb/persist/Cache.java deleted file mode 100644 index f51468e2..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/Cache.java +++ /dev/null @@ -1,528 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.Comparator; -import java.util.concurrent.atomic.AtomicInteger; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArraySort; -import org.hsqldb.lib.IntIndex; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.ObjectComparator; -import org.hsqldb.lib.StopWatch; -import org.hsqldb.map.BaseHashMap; - -/** - * New implementation of row caching for CACHED tables.

    - * - * Manages memory for the cache map and its contents based on least recently - * used clearup.

    - * Also provides services for selecting rows to be saved and passing them - * to DataFileCache.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.0 - */ -public class Cache extends BaseHashMap { - - private int reserveCount; - final DataFileCache dataFileCache; - private int capacity; // number of Rows - private long bytesCapacity; // number of bytes - private final CachedObjectComparator rowComparator; - private final BaseHashMap.BaseHashIterator objectIterator; - private final boolean updateAccess; - - // - private CachedObject[] rowTable; - private long cacheBytesLength; - - // for testing - StopWatch saveAllTimer = new StopWatch(false); - StopWatch shadowTimer = new StopWatch(false); - int saveRowCount = 0; - - Cache(DataFileCache dfc) { - - super(dfc.capacity(), BaseHashMap.objectKeyOrValue, - BaseHashMap.noKeyOrValue, true); - - maxCapacity = dfc.capacity(); - dataFileCache = dfc; - capacity = dfc.capacity(); - bytesCapacity = dfc.bytesCapacity(); - rowComparator = new CachedObjectComparator(); - rowTable = new CachedObject[capacity]; - cacheBytesLength = 0; - objectIterator = new BaseHashIterator(true); - updateAccess = dfc instanceof TextCache; - comparator = rowComparator; - reserveCount = dfc instanceof TextCache - || dfc instanceof DataFileCacheSession ? 0 - : 8; - } - - long getTotalCachedBlockSize() { - return cacheBytesLength; - } - - /** - * Returns a row if in memory cache. - */ - public CachedObject get(long pos) { - - int lookup = getObjectLookup(pos); - - if (lookup == -1) { - return null; - } - - accessTable[lookup] = accessCount.incrementAndGet(); - - CachedObject object = (CachedObject) objectKeyTable[lookup]; - - return object; - } - - /** - * Adds a row to the cache. - */ - void put(CachedObject row) { - - int storageSize = row.getStorageSize(); - - if (preparePut(storageSize)) { - putNoCheck(row); - } else { - long value = size() + reserveCount >= capacity ? capacity - : bytesCapacity - / 1024L; - - throw Error.error(ErrorCode.DATA_CACHE_IS_FULL, - String.valueOf(value)); - } - } - - /** - * reserve slots may be used and storage size may exceed bytesCapacity - */ - void putUsingReserve(CachedObject row) { - - int storageSize = row.getStorageSize(); - - preparePut(storageSize); - - if (size() >= capacity) { - throw Error.error(ErrorCode.DATA_CACHE_IS_FULL, - String.valueOf(capacity)); - } - - putNoCheck(row); - } - - boolean preparePut(int storageSize) { - - boolean exceedsCount = size() + reserveCount >= capacity; - boolean exceedsSize = storageSize + cacheBytesLength > bytesCapacity; - - if (exceedsCount || exceedsSize) { - cleanUp(false); - - exceedsCount = size() + reserveCount >= capacity; - exceedsSize = storageSize + cacheBytesLength > bytesCapacity; - - if (exceedsCount || exceedsSize) { - clearUnchanged(); - } else { - return true; - } - - exceedsCount = size() + reserveCount >= capacity; - exceedsSize = storageSize + cacheBytesLength > bytesCapacity; - - if (exceedsCount || exceedsSize) { - cleanUp(true); - } else { - return true; - } - - exceedsCount = size() + reserveCount >= capacity; - exceedsSize = storageSize + cacheBytesLength > bytesCapacity; - - if (exceedsCount) { - dataFileCache.logInfoEvent( - "dataFileCache CACHE ROWS limit reached"); - } - - if (exceedsSize) { - dataFileCache.logInfoEvent( - "dataFileCache CACHE SIZE limit reached"); - } - - if (exceedsCount || exceedsSize) { - return false; - } - } - - return true; - } - - private void putNoCheck(CachedObject row) { - - Object existing = addOrRemoveObject(row.getPos(), row, false); - - if (existing != null) { - dataFileCache.logSevereEvent("existing object in Cache.put() " - + row.getPos() + " " - + row.getStorageSize(), null); - } - - row.setInMemory(true); - - cacheBytesLength += row.getStorageSize(); - } - - /** - * Removes an object from memory cache. Does not release the file storage. - */ - CachedObject release(long pos) { - - CachedObject r = (CachedObject) addOrRemoveObject(pos, null, true); - - if (r == null) { - return null; - } - - cacheBytesLength -= r.getStorageSize(); - - r.setInMemory(false); - - return r; - } - - public void releaseRange(IntIndex list, int fileBlockItemCount) { - - objectIterator.reset(); - - while (objectIterator.hasNext()) { - CachedObject o = (CachedObject) objectIterator.next(); - long pos = o.getPos(); - int block = (int) (pos / fileBlockItemCount); - int index = list.findFirstEqualKeyIndex(block); - - if (index >= 0) { - o.setInMemory(false); - objectIterator.remove(); - - cacheBytesLength -= o.getStorageSize(); - } - } - } - - public void releaseRange(long startPos, long limitPos) { - - objectIterator.reset(); - - while (objectIterator.hasNext()) { - CachedObject o = (CachedObject) objectIterator.next(); - long pos = o.getPos(); - - if (pos >= startPos && pos < limitPos) { - o.setInMemory(false); - objectIterator.remove(); - - cacheBytesLength -= o.getStorageSize(); - } - } - } - - private void updateAccessCounts() { - - CachedObject row; - int count; - - if (updateAccess) { - for (int i = 0; i < objectKeyTable.length; i++) { - row = (CachedObject) objectKeyTable[i]; - - if (row != null) { - count = row.getAccessCount(); - - if (count > accessTable[i]) { - accessTable[i] = count; - } - } - } - } - } - - private void updateObjectAccessCounts() { - - CachedObject row; - int count; - - if (updateAccess) { - for (int i = 0; i < objectKeyTable.length; i++) { - row = (CachedObject) objectKeyTable[i]; - - if (row != null) { - count = accessTable[i]; - - row.updateAccessCount(count); - } - } - } - } - - /** - * Reduces the number of rows held in this Cache object.

    - * - * Cleanup is done by checking the accessCount of the Rows and removing - * the rows with the lowest access count. - * - * Index operations require that some rows remain - * in the cache. This is ensured by prior calling keepInMemory(). - * - */ - private void cleanUp(boolean all) { - - updateAccessCounts(); - - if (accessCount.get() > ACCESS_MAX || accessCount.get() < 0) { - resetAccessCount(); - updateObjectAccessCounts(); - } - - int savecount = 0; - int removeCount = size() / 2; - int accessTarget = all ? accessCount.get() + 1 - : getAccessCountCeiling(removeCount, - removeCount / 8); - - objectIterator.reset(); - - for (; objectIterator.hasNext(); ) { - CachedObject row = (CachedObject) objectIterator.next(); - - synchronized (row) { - int currentAccessCount = objectIterator.getAccessCount(); - boolean oldRow = currentAccessCount < accessTarget; - boolean newRow = row.isNew() - && row.getStorageSize() - >= DataFileCache.initIOBufferSize; - boolean saveRow = row.hasChanged() && (oldRow || newRow); - - if (saveRow) { - rowTable[savecount++] = row; - } - - if (oldRow) { - if (row.isKeepInMemory()) { - objectIterator.setAccessCount(accessTarget); - } else { - row.setInMemory(false); - objectIterator.remove(); - - cacheBytesLength -= row.getStorageSize(); - } - } - } - - if (savecount == rowTable.length) { - saveRows(savecount); - - savecount = 0; - } - } - - saveRows(savecount); - setAccessCountFloor(accessTarget); - accessCount.incrementAndGet(); - } - - void clearUnchanged() { - - objectIterator.reset(); - - for (; objectIterator.hasNext(); ) { - CachedObject row = (CachedObject) objectIterator.next(); - - synchronized (row) { - if (!row.isKeepInMemory() && !row.hasChanged()) { - row.setInMemory(false); - objectIterator.remove(); - - cacheBytesLength -= row.getStorageSize(); - } - } - } - } - - private void saveRows(int count) { - - if (count == 0) { - return; - } - - rowComparator.setType(CachedObjectComparator.COMPARE_POSITION); - ArraySort.sort(rowTable, count, rowComparator); - dataFileCache.saveRows(rowTable, 0, count); - - saveRowCount += count; - } - - /** - * Writes out all modified cached Rows. - */ - void saveAll() { - - int savecount = 0; - - objectIterator.reset(); - - for (; objectIterator.hasNext(); ) { - if (savecount == rowTable.length) { - saveRows(savecount); - - savecount = 0; - } - - CachedObject r = (CachedObject) objectIterator.next(); - - if (r.hasChanged()) { - rowTable[savecount] = r; - - savecount++; - } - } - - saveRows(savecount); - } - - void logSaveRowsEvent(int saveCount, long storageSize, long startTime) { - - long time = saveAllTimer.elapsedTime(); - StringBuilder sb = new StringBuilder(); - - sb.append("cache save rows total [count,time] "); - sb.append(saveRowCount + saveCount); - sb.append(',').append(time).append(' '); - sb.append("operation [count,time,size]").append(saveCount).append(','); - sb.append(time - startTime).append(','); - sb.append(storageSize).append(' '); - -// - sb.append("tx-ts "); - sb.append(dataFileCache.database.txManager.getSystemChangeNumber()); - -// - dataFileCache.logDetailEvent(sb.toString()); - } - - /** - * clears out the memory cache - */ - public void clear() { - - super.clear(); - - cacheBytesLength = 0; - } - - public Iterator getIterator() { - - objectIterator.reset(); - - return objectIterator; - } - - protected AtomicInteger getAccessCount() { - return accessCount; - } - - static final class CachedObjectComparator - implements Comparator, ObjectComparator { - - static final int COMPARE_LAST_ACCESS = 0; - static final int COMPARE_POSITION = 1; - static final int COMPARE_SIZE = 2; - private int compareType = COMPARE_POSITION; - private long compareCount; - - CachedObjectComparator() {} - - void setType(int type) { - compareType = type; - compareCount = 0; - } - - public int compare(CachedObject a, CachedObject b) { - - long diff; - - compareCount++; - - switch (compareType) { - - case COMPARE_POSITION : - diff = a.getPos() - b.getPos(); - break; - - case COMPARE_SIZE : - diff = a.getStorageSize() - b.getStorageSize(); - break; - - default : - return 0; - } - - return diff == 0 ? 0 - : diff > 0 ? 1 - : -1; - } - - public boolean equals(CachedObject a, CachedObject b) { - return compare(a, b) == 0; - } - - public int hashCode(CachedObject o) { - return o.hashCode(); - } - - public long longKey(CachedObject o) { - return o.getPos(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/CachedObject.java b/database/hsqldb/src/org/hsqldb/persist/CachedObject.java deleted file mode 100644 index 87e98aeb..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/CachedObject.java +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.LongLookup; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * Interface for an object stored in the memory cache. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.3 - * @since 1.8.0 - */ -public interface CachedObject { - - CachedObject[] emptyArray = new CachedObject[]{}; - - boolean isMemory(); - - void updateAccessCount(int count); - - int getAccessCount(); - - void setStorageSize(int size); - - int getStorageSize(); - - boolean isInvariable(); - - boolean isBlock(); - - long getPos(); - - void setPos(long pos); - - boolean isNew(); - - boolean hasChanged(); - - void setChanged(boolean flag); - - boolean isKeepInMemory(); - - boolean keepInMemory(boolean keep); - - boolean isInMemory(); - - void setInMemory(boolean in); - - void restore(); - - void destroy(); - - int getRealSize(RowOutputInterface out); - - int getDefaultCapacity(); - - void read(RowInputInterface in); - - void write(RowOutputInterface out); - - void write(RowOutputInterface out, LongLookup lookup); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/CachedObjectBase.java b/database/hsqldb/src/org/hsqldb/persist/CachedObjectBase.java deleted file mode 100644 index 7a35a23c..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/CachedObjectBase.java +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * Base class for a stored simple object. - * - * @author Fred Toussi (fredt@users dot sourceforge dot net) - * @version 2.3.3 - */ -public abstract class CachedObjectBase implements CachedObject { - - boolean isMemory; - long position; - int storageSize; - boolean isInMemory; - boolean hasChanged; - int keepCount; - int accessCount; - - public boolean isMemory() { - return isMemory; - } - - public void updateAccessCount(int count) { - accessCount = count; - } - - public int getAccessCount() { - return accessCount; - } - - public void setStorageSize(int size) { - storageSize = size; - } - - public int getStorageSize() { - return storageSize; - } - - public final boolean isInvariable() { - return false; - } - - public final boolean isBlock() { - return true; - } - - public long getPos() { - return position; - } - - public void setPos(long pos) { - position = pos; - } - - public boolean isNew() { - return false; - } - - public boolean hasChanged() { - return hasChanged; - } - - public final void setChanged(boolean flag) { - hasChanged = flag; - } - - public boolean isKeepInMemory() { - return keepCount > 0; - } - - public boolean keepInMemory(boolean keep) { - - if (!isInMemory) { - return false; - } - - if (keep) { - keepCount++; - } else { - if (keepCount == 0) { - throw Error.runtimeError(ErrorCode.U_S0500, - "CachedObjectBase - keep count"); - } - - keepCount--; - } - - return true; - } - - public boolean isInMemory() { - return isInMemory; - } - - public void setInMemory(boolean in) { - isInMemory = in; - } - - public boolean equals(Object other) { - return other instanceof CachedObjectBase - && ((CachedObjectBase) other).position == this.position; - } - - public int hashCode() { - return (int) position; - } - - public void restore() {} - - public void destroy() {} -} diff --git a/database/hsqldb/src/org/hsqldb/persist/Crypto.java b/database/hsqldb/src/org/hsqldb/persist/Crypto.java deleted file mode 100644 index 1744623a..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/Crypto.java +++ /dev/null @@ -1,288 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.CipherInputStream; -import javax.crypto.CipherOutputStream; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.KeyGenerator; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.SecretKey; -import javax.crypto.ShortBufferException; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.StringConverter; - -/** - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.1 - * @since 1.9.0 - */ - -// support for IV parameters added by Shaun Murphy (shaunmurphy@users dot sourcedorge.net) -public class Crypto { - - final SecretKeySpec key; - final Cipher outCipher; - final Cipher inCipher; - final Cipher inStreamCipher; - final Cipher outStreamCipher; - final IvParameterSpec ivSpec; - - public Crypto(String keyString, String ivString, String cipherName, - String provider) { - - final String keyAlgorithm = (cipherName.contains("/")) - ? cipherName.substring(0, - cipherName.indexOf("/")) - : cipherName; - - try { - byte[] encodedKey = - StringConverter.hexStringToByteArray(keyString); - - if (ivString != null && !ivString.isEmpty()) { - byte[] encodedIv = - StringConverter.hexStringToByteArray(ivString); - - ivSpec = new IvParameterSpec(encodedIv); - } else { - ivSpec = null; - } - - key = new SecretKeySpec(encodedKey, keyAlgorithm); - outCipher = provider == null ? Cipher.getInstance(cipherName) - : Cipher.getInstance(cipherName, - provider); - - if (ivSpec == null) { - outCipher.init(Cipher.ENCRYPT_MODE, key); - } else { - outCipher.init(Cipher.ENCRYPT_MODE, key, ivSpec); - } - - outStreamCipher = provider == null ? Cipher.getInstance(cipherName) - : Cipher.getInstance(cipherName, - provider); - - if (ivSpec == null) { - outStreamCipher.init(Cipher.ENCRYPT_MODE, key); - } else { - outStreamCipher.init(Cipher.ENCRYPT_MODE, key, ivSpec); - } - - inCipher = provider == null ? Cipher.getInstance(cipherName) - : Cipher.getInstance(cipherName, - provider); - - if (ivSpec == null) { - inCipher.init(Cipher.DECRYPT_MODE, key); - } else { - inCipher.init(Cipher.DECRYPT_MODE, key, ivSpec); - } - - inStreamCipher = provider == null ? Cipher.getInstance(cipherName) - : Cipher.getInstance(cipherName, - provider); - - if (ivSpec == null) { - inStreamCipher.init(Cipher.DECRYPT_MODE, key); - } else { - inStreamCipher.init(Cipher.DECRYPT_MODE, key, ivSpec); - } - } catch (NoSuchPaddingException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (NoSuchAlgorithmException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (InvalidKeyException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (NoSuchProviderException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (IOException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (InvalidAlgorithmParameterException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - - public synchronized InputStream getInputStream(InputStream in) { - - if (inCipher == null) { - return in; - } - - try { - if (ivSpec == null) { - inStreamCipher.init(Cipher.DECRYPT_MODE, key); - } else { - inStreamCipher.init(Cipher.DECRYPT_MODE, key, ivSpec); - } - - return new CipherInputStream(in, inStreamCipher); - } catch (java.security.InvalidKeyException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (InvalidAlgorithmParameterException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - - public synchronized OutputStream getOutputStream(OutputStream out) { - - if (outCipher == null) { - return out; - } - - try { - if (ivSpec == null) { - outStreamCipher.init(Cipher.ENCRYPT_MODE, key); - } else { - outStreamCipher.init(Cipher.ENCRYPT_MODE, key, ivSpec); - } - - return new CipherOutputStream(out, outStreamCipher); - } catch (java.security.InvalidKeyException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (InvalidAlgorithmParameterException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - - public synchronized int decode(byte[] source, int sourceOffset, - int length, byte[] dest, int destOffset) { - - if (inCipher == null) { - return length; - } - - try { - if (ivSpec == null) { - inCipher.init(Cipher.DECRYPT_MODE, key); - } else { - inCipher.init(Cipher.DECRYPT_MODE, key, ivSpec); - } - - return inCipher.doFinal(source, sourceOffset, length, dest, - destOffset); - } catch (java.security.InvalidKeyException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (BadPaddingException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (IllegalBlockSizeException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (ShortBufferException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (InvalidAlgorithmParameterException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - - public synchronized int encode(byte[] source, int sourceOffset, - int length, byte[] dest, int destOffset) { - - if (outCipher == null) { - return length; - } - - try { - if (ivSpec == null) { - outCipher.init(Cipher.ENCRYPT_MODE, key); - } else { - outCipher.init(Cipher.ENCRYPT_MODE, key, ivSpec); - } - - return outCipher.doFinal(source, sourceOffset, length, dest, - destOffset); - } catch (java.security.InvalidKeyException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (BadPaddingException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (IllegalBlockSizeException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (ShortBufferException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (InvalidAlgorithmParameterException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - - public static byte[] getNewKey(String cipherName, String provider) { - - try { - KeyGenerator generator = provider == null - ? KeyGenerator.getInstance(cipherName) - : KeyGenerator.getInstance(cipherName, - provider); - SecretKey key = generator.generateKey(); - byte[] raw = key.getEncoded(); - - return raw; - } catch (java.security.NoSuchAlgorithmException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (NoSuchProviderException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - - public synchronized int getEncodedSize(int size) { - - try { - return outCipher.getOutputSize(size); - } catch (IllegalStateException ex) { - try { - if (ivSpec == null) { - outCipher.init(Cipher.ENCRYPT_MODE, key); - } else { - outCipher.init(Cipher.ENCRYPT_MODE, key, ivSpec); - } - - return outCipher.getOutputSize(size); - } catch (java.security.InvalidKeyException e) { - throw Error.error(ErrorCode.X_S0531, e); - } catch (InvalidAlgorithmParameterException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DataFileCache.java b/database/hsqldb/src/org/hsqldb/persist/DataFileCache.java deleted file mode 100644 index e5ef5aaf..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DataFileCache.java +++ /dev/null @@ -1,1415 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.IOException; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.hsqldb.Database; -import org.hsqldb.HsqlException; -import org.hsqldb.Session; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.FileAccess; -import org.hsqldb.lib.FileArchiver; -import org.hsqldb.lib.IntIndex; -import org.hsqldb.map.BitMap; -import org.hsqldb.rowio.RowInputBinaryDecode; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputBinaryEncode; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * Acts as a manager for CACHED table persistence.

    - * - * This contains the top level functionality. Provides file management services - * and access.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.7.2 - */ -public class DataFileCache { - - interface Flags { - - int FLAG_ISSHADOWED = 1; - int FLAG_ISSAVED = 2; - int FLAG_ROWINFO = 3; - int FLAG_200 = 4; - int FLAG_HX = 5; - int FLAG_251 = 6; - } - - /** - * file format fields - */ - interface Positions { - - int LONG_EMPTY_SIZE = 4; // empty space size - int LONG_FREE_POS = 12; // where iFreePos is saved - int INT_SPACE_PROPS = 20; // (space size << 16) + scale - int INT_SPACE_LIST_POS = 24; // space list - int INT_FLAGS = 28; - int LONG_TIMESTAMP = 32; // db open tx timestamp - int MIN_INITIAL_FREE_POS = 64; // not used up to this - int MAX_INITIAL_FREE_POS = DataSpaceManager.fixedDiskBlockSize * 2; // not used up to this - } - - protected FileAccess fa; - - // - public DataSpaceManager spaceManager; - static final int initIOBufferSize = 4096; - - // - protected String dataFileName; - protected String backupFileName; - protected Database database; - protected boolean logEvents = true; - - /** - * this flag is used externally to determine if a backup is required - */ - protected boolean fileModified; - protected boolean cacheModified; - protected int dataFileScale; - protected int dataFileSpace; - - // post opening constant fields - protected boolean cacheReadonly; - - // - protected int cachedRowPadding; - - // - protected long lostSpaceSize; - protected long spaceManagerPosition; - protected long fileStartFreePosition; - protected int storeCount; - - // reusable input / output streams - protected RowInputInterface rowIn; - public RowOutputInterface rowOut; - - // - public long maxDataFileSize; - - // - boolean is251; - - // - protected RandomAccessInterface dataFile; - protected volatile long fileFreePosition; - protected int maxCacheRows; // number of Rows - protected long maxCacheBytes; // number of bytes - protected Cache cache; - - // - private RAShadowFile shadowFile; - - // - ReadWriteLock lock = new ReentrantReadWriteLock(); - Lock readLock = lock.readLock(); - Lock writeLock = lock.writeLock(); - - public DataFileCache(Database db, String baseFileName) { - - initParams(db, baseFileName, false); - - cache = new Cache(this); - } - - /** - * used for defrag - */ - public DataFileCache(Database db, String baseFileName, boolean defrag) { - - initParams(db, baseFileName, true); - - cache = new Cache(this); - - try { - dataFile = new RAFileSimple(database.logger, dataFileName, "rw"); - } catch (Throwable t) { - throw Error.error(ErrorCode.FILE_IO_ERROR, t); - } - - initNewFile(); - initBuffers(); - - if (dataFileSpace > 0) { - spaceManager = new DataSpaceManagerBlocks(this); - } else { - spaceManager = new DataSpaceManagerSimple(this, false); - } - } - - /** - * initial external parameters are set here. - */ - protected void initParams(Database database, String baseFileName, - boolean defrag) { - - this.database = database; - dataFileName = baseFileName + Logger.dataFileExtension; - backupFileName = baseFileName + Logger.backupFileExtension; - fa = database.logger.getFileAccess(); - dataFileScale = database.logger.getDataFileScale(); - dataFileSpace = database.logger.getDataFileSpace(); - cachedRowPadding = dataFileScale; - - if (dataFileScale < 8) { - cachedRowPadding = 8; - } - - cacheReadonly = database.isFilesReadOnly(); - maxCacheRows = database.logger.getCacheMaxRows(); - maxCacheBytes = database.logger.getCacheSize(); - maxDataFileSize = (long) Integer.MAX_VALUE * dataFileScale - * database.logger.getDataFileFactor(); - - if (defrag) { - dataFileName = dataFileName + Logger.newFileExtension; - backupFileName = backupFileName + Logger.newFileExtension; - maxCacheRows = 1024; - maxCacheBytes = 1024 * 4096; - } - } - - /** - * Opens the *.data file for this cache, setting the variables that - * allow access to the particular database version of the *.data file. - */ - public void open(boolean readonly) { - - logInfoEvent("dataFileCache open start"); - - try { - boolean isNio = database.logger.propNioDataFile; - int fileType; - - if (database.isFilesInJar()) { - fileType = RAFile.DATA_FILE_JAR; - } else if (isNio) { - fileType = RAFile.DATA_FILE_NIO; - } else { - fileType = RAFile.DATA_FILE_RAF; - } - - if (readonly || database.isFilesInJar()) { - dataFile = RAFile.newScaledRAFile(database, dataFileName, - true, fileType); - - int flags = getFlags(); - - if (BitMap.isSet(flags, Flags.FLAG_HX)) { - throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION); - } - - dataFile.seek(Positions.LONG_FREE_POS); - - fileFreePosition = dataFile.readLong(); - - dataFile.seek(Positions.INT_SPACE_LIST_POS); - - spaceManagerPosition = (long) dataFile.readInt() - * DataSpaceManager.fixedDiskBlockSize; - - initBuffers(); - - spaceManager = new DataSpaceManagerSimple(this, true); - - return; - } - - boolean preexists = fa.isStreamElement(dataFileName); - boolean isIncremental = true; - boolean isSaved = false; - boolean doRestore = false; - - if (preexists) { - dataFile = new RAFileSimple(database.logger, dataFileName, - "r"); - - long length = dataFile.length(); - boolean wrongVersion = false; - - if (length > Positions.LONG_TIMESTAMP) { - int flags = getFlags(); - - isSaved = BitMap.isSet(flags, Flags.FLAG_ISSAVED); - isIncremental = BitMap.isSet(flags, Flags.FLAG_ISSHADOWED); - is251 = BitMap.isSet(flags, Flags.FLAG_251); - - if (BitMap.isSet(flags, Flags.FLAG_HX)) { - wrongVersion = true; - } - } else { - preexists = false; - } - - if (isSaved && is251) { - dataFile.seek(Positions.LONG_TIMESTAMP); - - long timestamp = dataFile.readLong(); - - if (timestamp > database.logger.getFilesTimestamp()) { - doRestore = true; - } - } - - dataFile.close(); - - if (wrongVersion) { - throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION); - } - - if (!database.logger.propLargeData) { - if (length > (maxDataFileSize / 8) * 7) { - database.logger.propLargeData = true; - maxDataFileSize = - (long) Integer.MAX_VALUE * dataFileScale - * database.logger.getDataFileFactor(); - } - } - - if (length > maxDataFileSize) { - throw Error.error(ErrorCode.DATA_FILE_IS_FULL, - String.valueOf(maxDataFileSize)); - } - } - - if (preexists) { - if (isSaved) { - boolean existsBackup = fa.isStreamElement(backupFileName); - - if (existsBackup) { - logInfoEvent( - "data file was not modified but inc backup exists"); - - if (doRestore) { - restoreBackupIncremental(); - } - } - - deleteBackupFile(); - } else { - boolean restored; - - if (isIncremental) { - restored = restoreBackupIncremental(); - } else { - restored = restoreBackup(); - } - - if (!restored) { - database.logger.logSevereEvent( - "DataFileCache data file modified but no backup exists", - null); - - throw Error.error(ErrorCode.DATA_FILE_BACKUP_MISMATCH); - } - } - } - - dataFile = RAFile.newScaledRAFile(database, dataFileName, - readonly, fileType); - - if (preexists) { - dataFile.seek(Positions.LONG_EMPTY_SIZE); - - lostSpaceSize = dataFile.readLong(); - - dataFile.seek(Positions.LONG_FREE_POS); - - fileFreePosition = dataFile.readLong(); - fileStartFreePosition = fileFreePosition; - - dataFile.seek(Positions.INT_SPACE_PROPS); - - int spaceProps = dataFile.readInt(); - - setSpaceProps(spaceProps); - dataFile.seek(Positions.INT_SPACE_LIST_POS); - - spaceManagerPosition = (long) dataFile.readInt() - * DataSpaceManager.fixedDiskBlockSize; - - int flags = getFlags(); - - flags = BitMap.set(flags, Flags.FLAG_ISSHADOWED); - flags = BitMap.set(flags, Flags.FLAG_ISSAVED); - - setFlags(flags); - } else { - initNewFile(); - } - - initBuffers(); - - fileModified = false; - cacheModified = false; - - if (dataFileSpace > 0) { - spaceManager = new DataSpaceManagerBlocks(this); - } else { - spaceManager = new DataSpaceManagerSimple(this, false); - } - - if (!preexists) { - reset(); - } - - openShadowFile(); - logInfoEvent("dataFileCache open end"); - } catch (HsqlException e) { - throw e; - } catch (Throwable t) { - logSevereEvent("DataFileCache.open", t); - release(); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_DataFileCache_open, new String[] { - t.toString(), dataFileName - }); - } - } - - void setSpaceProps(int spaceProps) { - - if (spaceProps == 0) { - spaceProps = dataFileScale | (dataFileSpace << 16); - - try { - dataFile.seek(Positions.INT_SPACE_PROPS); - dataFile.writeInt(spaceProps); - dataFile.synch(); - } catch (Throwable t) { - throw Error.error(ErrorCode.FILE_IO_ERROR, t); - } - - return; - } - - dataFileScale = spaceProps & 0xffff; - dataFileSpace = spaceProps >>> 16; - - database.logger.setDataFileScaleNoCheck(dataFileScale); - database.logger.setDataFileSpace(dataFileSpace); - } - - void initNewFile() { - - try { - int initialFreePos = Positions.MAX_INITIAL_FREE_POS; - - if (dataFileSpace == 0) { - initialFreePos = Positions.MIN_INITIAL_FREE_POS; - - if (initialFreePos < dataFileScale) { - initialFreePos = dataFileScale; - } - } - - fileFreePosition = initialFreePos; - fileStartFreePosition = initialFreePos; - - dataFile.seek(Positions.LONG_FREE_POS); - dataFile.writeLong(fileFreePosition); - - int spaceProps = dataFileScale | (dataFileSpace << 16); - - dataFile.seek(Positions.INT_SPACE_PROPS); - dataFile.writeInt(spaceProps); - dataFile.seek(Positions.LONG_TIMESTAMP); - dataFile.writeLong(database.logger.getFilesTimestamp()); - - // set shadowed flag; - int flags = 0; - - flags = BitMap.set(flags, Flags.FLAG_ISSHADOWED); - flags = BitMap.set(flags, Flags.FLAG_ISSAVED); - flags = BitMap.set(flags, Flags.FLAG_200); - flags = BitMap.set(flags, Flags.FLAG_251); - - setFlags(flags); - - is251 = true; - } catch (Throwable t) { - throw Error.error(ErrorCode.FILE_IO_ERROR, t); - } - } - - private void openShadowFile() { - - shadowFile = new RAShadowFile(database.logger, dataFile, - backupFileName, fileFreePosition, - 1 << 14); - } - - /** - * Restores a compressed backup or the .data file. - */ - private boolean restoreBackup() { - - try { - FileAccess fileAccess = database.logger.getFileAccess(); - - deleteBackupFile(); - - if (fileAccess.isStreamElement(backupFileName)) { - FileArchiver.unarchive(backupFileName, dataFileName, - fileAccess, - FileArchiver.COMPRESSION_ZIP); - - return true; - } - - return false; - } catch (Throwable t) { - database.logger.logSevereEvent("DataFileCache.restoreBackup", t); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_Message_Pair, new String[] { - t.toString(), backupFileName - }); - } - } - - /** - * Restores in from an incremental backup - */ - private boolean restoreBackupIncremental() { - - try { - FileAccess fileAccess = database.logger.getFileAccess(); - - if (fileAccess.isStreamElement(backupFileName)) { - RAShadowFile.restoreFile(database, backupFileName, - dataFileName); - deleteBackupFile(); - - return true; - } - - // this is an anomaly where no backup exists but .data file - // modified flag has been set - return false; - } catch (Throwable e) { - database.logger.logSevereEvent( - "DataFileCache.restoreBackupIncremental", e); - - throw Error.error(ErrorCode.FILE_IO_ERROR, e); - } - } - - /** - * Abandons changed rows and closes the .data file. - */ - public void release() { - - writeLock.lock(); - - try { - if (dataFile == null) { - return; - } - - if (shadowFile != null) { - shadowFile.close(); - - shadowFile = null; - } - - dataFile.close(); - logDetailEvent("dataFileCache file closed"); - - dataFile = null; - } catch (Throwable t) { - logSevereEvent("DataFileCache.release", t); - } finally { - writeLock.unlock(); - } - } - - /** - * Writes out all cached rows that have been modified and the - * free position pointer for the *.data file and then closes the file. - */ - public void close() { - - writeLock.lock(); - - try { - if (dataFile == null) { - return; - } - - reset(); - dataFile.close(); - logDetailEvent("dataFileCache file close end"); - - dataFile = null; - } catch (HsqlException e) { - throw e; - } catch (Throwable t) { - logSevereEvent("DataFileCache.close", t); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_DataFileCache_close, new String[] { - t.toString(), dataFileName - }); - } finally { - writeLock.unlock(); - } - } - - protected void clear() { - - writeLock.lock(); - - try { - cache.clear(); - } finally { - writeLock.unlock(); - } - } - - public void adjustStoreCount(int adjust) { - - writeLock.lock(); - - try { - storeCount += adjust; - } finally { - writeLock.unlock(); - } - } - - public void reopen() { - - writeLock.lock(); - - try { - openShadowFile(); - spaceManager.initialiseSpaces(); - } finally { - writeLock.unlock(); - } - } - - /** - * Commits all the changes to the file - */ - public void reset() { - - writeLock.lock(); - - try { - if (cacheReadonly) { - return; - } - - logInfoEvent("dataFileCache commit start"); - spaceManager.reset(); - cache.saveAll(); - - // set empty - long lostSize = spaceManager.getLostBlocksSize(); - - dataFile.seek(Positions.LONG_EMPTY_SIZE); - dataFile.writeLong(lostSize); - - // set end - dataFile.seek(Positions.LONG_FREE_POS); - dataFile.writeLong(fileFreePosition); - - // set space props - int spaceProps = dataFileScale | (dataFileSpace << 16); - - dataFile.seek(Positions.INT_SPACE_PROPS); - dataFile.writeInt(spaceProps); - - // set space list - int pos = (int) (spaceManagerPosition - / DataSpaceManager.fixedDiskBlockSize); - - dataFile.seek(Positions.INT_SPACE_LIST_POS); - dataFile.writeInt(pos); - - if (is251) { - dataFile.seek(Positions.LONG_TIMESTAMP); - dataFile.writeLong(database.logger.getFilesTimestamp()); - } - - // set saved flag and sync file - setFlag(Flags.FLAG_ISSAVED, true); - logDetailEvent("file sync end"); - - fileModified = false; - cacheModified = false; - fileStartFreePosition = fileFreePosition; - - if (shadowFile != null) { - shadowFile.close(); - - shadowFile = null; - } - - logInfoEvent("dataFileCache commit end"); - } catch (Throwable t) { - logSevereEvent("DataFileCache.reset commit", t); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_DataFileCache_close, new String[] { - t.toString(), dataFileName - }); - } finally { - writeLock.unlock(); - } - } - - protected void initBuffers() { - - if (rowOut == null) { - rowOut = new RowOutputBinaryEncode(database.logger.getCrypto(), - initIOBufferSize, - cachedRowPadding); - } - - if (rowIn == null) { - rowIn = new RowInputBinaryDecode(database.logger.getCrypto(), - new byte[initIOBufferSize]); - } - } - - DataFileDefrag defrag(Session session) { - - writeLock.lock(); - - try { - cache.saveAll(); - - DataFileDefrag dfd = new DataFileDefrag(database, this); - - dfd.process(session); - - return dfd; - } finally { - writeLock.unlock(); - } - } - - /** - * Used when a row is deleted as a result of some DML or DDL statement. - * Removes the row from the cache data structures. - */ - public void remove(CachedObject object) { - release(object.getPos()); - } - - public void removePersistence(CachedObject object) {} - - public void add(CachedObject object, boolean keep) { - - writeLock.lock(); - - try { - cacheModified = true; - - cache.put(object); - - if (keep) { - object.keepInMemory(true); - } - - if (object.getStorageSize() > initIOBufferSize) { - rowOut.reset(object.getStorageSize()); - } - } finally { - writeLock.unlock(); - } - } - - public CachedObject get(CachedObject object, PersistentStore store, - boolean keep) { - - readLock.lock(); - - long pos; - - try { - if (object.isInMemory()) { - if (keep) { - object.keepInMemory(true); - } - - return object; - } - - pos = object.getPos(); - - if (pos < 0) { - return null; - } - - object = cache.get(pos); - - if (object != null) { - if (keep) { - object.keepInMemory(true); - } - - return object; - } - } finally { - readLock.unlock(); - } - - return getFromFile(pos, store, keep); - } - - public CachedObject get(long pos, int size, PersistentStore store, - boolean keep) { - - CachedObject object; - - if (pos < 0) { - return null; - } - - readLock.lock(); - - try { - object = cache.get(pos); - - if (object != null) { - if (keep) { - object.keepInMemory(true); - } - - return object; - } - } finally { - readLock.unlock(); - } - - return getFromFile(pos, size, store, keep); - } - - public CachedObject get(long pos, PersistentStore store, boolean keep) { - - CachedObject object; - - if (pos < 0) { - return null; - } - - readLock.lock(); - - try { - object = cache.get(pos); - - if (object != null) { - if (keep) { - object.keepInMemory(true); - } - - return object; - } - } finally { - readLock.unlock(); - } - - return getFromFile(pos, store, keep); - } - - private CachedObject getFromFile(long pos, PersistentStore store, - boolean keep) { - - CachedObject object = null; - - writeLock.lock(); - - try { - object = cache.get(pos); - - if (object != null) { - if (keep) { - object.keepInMemory(true); - } - - return object; - } - - for (int j = 0; j < 2; j++) { - try { - readObject(pos); - - object = store.get(rowIn); - - if (object == null) { - throw Error.error(ErrorCode.GENERAL_IO_ERROR, - "position " + pos); - } - - break; - } catch (Throwable t) { - if (t instanceof OutOfMemoryError) { - cache.clearUnchanged(); - - if (j > 0) { - logInfoEvent(dataFileName - + " getFromFile out of mem, pos: " - + pos); - - HsqlException ex = - Error.error(ErrorCode.OUT_OF_MEMORY, t); - - ex.info = rowIn; - - throw ex; - } - } else if (t instanceof HsqlException) { - ((HsqlException) t).info = rowIn; - - throw (HsqlException) t; - } else { - HsqlException ex = - Error.error(ErrorCode.GENERAL_IO_ERROR, t); - - ex.info = rowIn; - - throw ex; - } - } - } - - if (object == null) { - throw Error.error(ErrorCode.DATA_FILE_ERROR); - } - - // for text tables with empty rows at the beginning, - // pos may move forward in readObject - cache.put(object); - - if (keep) { - object.keepInMemory(true); - } - - return object; - } catch (HsqlException e) { - logSevereEvent(dataFileName + " getFromFile failed " + pos, e); - - throw e; - } finally { - writeLock.unlock(); - } - } - - private CachedObject getFromFile(long pos, int size, - PersistentStore store, boolean keep) { - - CachedObject object = null; - - writeLock.lock(); - - try { - object = cache.get(pos); - - if (object != null) { - if (keep) { - object.keepInMemory(true); - } - - return object; - } - - for (int j = 0; j < 2; j++) { - try { - readObject(pos, size); - - object = store.get(rowIn); - - break; - } catch (OutOfMemoryError err) { - cache.clearUnchanged(); - System.gc(); - - if (j > 0) { - logSevereEvent(dataFileName - + " getFromFile out of mem " - + pos, err); - - throw err; - } - } - } - - if (object == null) { - throw Error.error(ErrorCode.DATA_FILE_ERROR); - } - - cache.putUsingReserve(object); - - if (keep) { - object.keepInMemory(true); - } - - return object; - } catch (HsqlException e) { - logSevereEvent(dataFileName + " getFromFile failed " + pos, e); - - throw e; - } finally { - writeLock.unlock(); - } - } - - RowInputInterface getRaw(long pos) { - - writeLock.lock(); - - try { - readObject(pos); - - return rowIn; - } finally { - writeLock.unlock(); - } - } - - private void readObject(long pos) { - - try { - dataFile.seek(pos * dataFileScale); - - int size = dataFile.readInt(); - - rowIn.resetRow(pos, size); - dataFile.read(rowIn.getBuffer(), 4, size - 4); - } catch (Throwable t) { - logSevereEvent("DataFileCache.readObject", t, pos); - - HsqlException ex = Error.error(ErrorCode.DATA_FILE_ERROR, t); - - if (rowIn.getFilePosition() != pos) { - rowIn.resetRow(pos, 0); - } - - ex.info = rowIn; - - throw ex; - } - } - - protected void readObject(long pos, int size) { - - try { - rowIn.resetBlock(pos, size); - dataFile.seek(pos * dataFileScale); - dataFile.read(rowIn.getBuffer(), 0, size); - } catch (Throwable t) { - logSevereEvent("DataFileCache.readObject", t, pos); - - HsqlException ex = Error.error(ErrorCode.DATA_FILE_ERROR, t); - - ex.info = rowIn; - - throw ex; - } - } - - public void releaseRange(long startPos, long limitPos) { - - writeLock.lock(); - - try { - cacheModified = true; - - cache.releaseRange(startPos, limitPos); - } finally { - writeLock.unlock(); - } - } - - public void releaseRange(IntIndex list, int fileBlockItemCount) { - - writeLock.lock(); - - try { - cacheModified = true; - - cache.releaseRange(list, fileBlockItemCount); - } finally { - writeLock.unlock(); - } - } - - public CachedObject release(long pos) { - - writeLock.lock(); - - try { - cacheModified = true; - - return cache.release(pos); - } finally { - writeLock.unlock(); - } - } - - protected void saveRows(CachedObject[] rows, int offset, int count) { - - if (count == 0) { - return; - } - - int pageCount = copyShadow(rows, offset, count); - long startTime = cache.saveAllTimer.elapsedTime(); - long storageSize = 0; - - cache.saveAllTimer.start(); - - if (pageCount > 0) { - setFileModified(); - } - - for (int i = offset; i < offset + count; i++) { - CachedObject r = rows[i]; - - saveRowNoLock(r); - - rows[i] = null; - storageSize += r.getStorageSize(); - } - - cache.saveAllTimer.stop(); - cache.logSaveRowsEvent(count, storageSize, startTime); - } - - /** - * Writes out the specified Row. Will write only the Nodes or both Nodes - * and table row data depending on what is not already persisted to disk. - */ - public void saveRow(CachedObject row) { - - writeLock.lock(); - - try { - copyShadow(row); - setFileModified(); - saveRowNoLock(row); - } finally { - writeLock.unlock(); - } - } - - public void saveRowOutput(long pos) { - - try { - dataFile.seek(pos * dataFileScale); - dataFile.write(rowOut.getOutputStream().getBuffer(), 0, - rowOut.getOutputStream().size()); - } catch (Throwable t) { - logSevereEvent("DataFileCache.saveRowOutput", t, pos); - - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - protected void saveRowNoLock(CachedObject row) { - - try { - rowOut.reset(); - row.write(rowOut); - dataFile.seek(row.getPos() * dataFileScale); - dataFile.write(rowOut.getOutputStream().getBuffer(), 0, - rowOut.getOutputStream().size()); - row.setChanged(false); - } catch (Throwable t) { - logSevereEvent("DataFileCache.saveRowNoLock", t, row.getPos()); - - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - protected int copyShadow(CachedObject[] rows, int offset, int count) { - - int pageCount = 0; - - if (shadowFile != null) { - long time = cache.shadowTimer.elapsedTime(); - long seekpos = 0; - - cache.shadowTimer.start(); - - try { - for (int i = offset; i < offset + count; i++) { - CachedObject row = rows[i]; - - seekpos = row.getPos() * dataFileScale; - pageCount += shadowFile.copy(seekpos, - row.getStorageSize()); - } - - if (pageCount > 0) { - shadowFile.synch(); - } - } catch (Throwable t) { - logSevereEvent("DataFileCache.copyShadow", t, seekpos); - - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - - cache.shadowTimer.stop(); - - if (pageCount > 0) { - time = cache.shadowTimer.elapsedTime() - time; - - logDetailEvent("copyShadow [size, time] " - + shadowFile.getSavedLength() + " " + time); - } - } - - return pageCount; - } - - protected int copyShadow(CachedObject row) { - - if (shadowFile != null) { - long seekpos = row.getPos() * dataFileScale; - - try { - int pageCount = shadowFile.copy(seekpos, row.getStorageSize()); - - shadowFile.synch(); - - return pageCount; - } catch (Throwable t) { - logSevereEvent("DataFileCache.copyShadow", t, row.getPos()); - - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - return 0; - } - - void deleteDataFile() { - Log.deleteFile(fa, dataFileName); - } - - private void deleteBackupFile() { - Log.deleteFile(fa, backupFileName); - } - - /** - * Delta must always result in block multiples - */ - public long enlargeFileSpace(long newLength) { - - writeLock.lock(); - - try { - long position = fileFreePosition; - - if (newLength > maxDataFileSize) { - logSevereEvent("data file reached maximum allowed size: " - + dataFileName + " " + maxDataFileSize, null); - - throw Error.error(ErrorCode.DATA_FILE_IS_FULL); - } - - boolean result = dataFile.ensureLength(newLength); - - if (!result) { - logSevereEvent("data file cannot be enlarged - disk space: " - + dataFileName + " " + newLength, null); - - throw Error.error(ErrorCode.DATA_FILE_IS_FULL); - } - - fileFreePosition = newLength; - - return position; - } finally { - writeLock.unlock(); - } - } - - public int capacity() { - return maxCacheRows; - } - - public long bytesCapacity() { - return maxCacheBytes; - } - - public long getTotalCachedBlockSize() { - return cache.getTotalCachedBlockSize(); - } - - public long getLostBlockSize() { - return spaceManager.getLostBlocksSize(); - } - - public long getFileFreePos() { - return fileFreePosition; - } - - public int getCachedObjectCount() { - return cache.size(); - } - - public String getFileName() { - return dataFileName; - } - - public int getDataFileScale() { - return dataFileScale; - } - - public int getDataFileSpace() { - return dataFileSpace; - } - - public boolean isFileModified() { - return fileModified; - } - - public boolean isModified() { - return cacheModified; - } - - public boolean isFileOpen() { - return dataFile != null; - } - - protected void setFileModified() { - - try { - if (!fileModified) { - - // unset saved flag; - setFlag(Flags.FLAG_ISSAVED, false); - logDetailEvent("setFileModified flag set "); - - fileModified = true; - } - } catch (Throwable t) { - logSevereEvent("DataFileCache.setFileModified", t); - - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - int getFlags() throws IOException { - - dataFile.seek(Positions.INT_FLAGS); - - int flags = dataFile.readInt(); - - return flags; - } - - void setFlags(int flags) throws IOException { - - dataFile.seek(Positions.INT_FLAGS); - dataFile.writeInt(flags); - dataFile.synch(); - } - - void setFlag(int singleFlag, boolean val) throws IOException { - - dataFile.seek(Positions.INT_FLAGS); - - int flags = dataFile.readInt(); - - flags = val ? BitMap.set(flags, singleFlag) - : BitMap.unset(flags, singleFlag); - - dataFile.seek(Positions.INT_FLAGS); - dataFile.writeInt(flags); - dataFile.synch(); - } - - public boolean isDataReadOnly() { - return this.cacheReadonly; - } - - public RAShadowFile getShadowFile() { - return shadowFile; - } - - public AtomicInteger getAccessCount() { - return cache.getAccessCount(); - } - - private void logSevereEvent(String message, Throwable t, long position) { - - if (logEvents) { - StringBuilder sb = new StringBuilder(message); - - sb.append(' ').append(position); - - message = sb.toString(); - - database.logger.logSevereEvent(message, t); - } - } - - public void logSevereEvent(String message, Throwable t) { - - if (logEvents) { - database.logger.logSevereEvent(message, t); - } - } - - void logInfoEvent(String message) { - - if (logEvents) { - database.logger.logInfoEvent(message); - } - } - - void logDetailEvent(String message) { - - if (logEvents) { - database.logger.logDetailEvent(message); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DataFileCacheSession.java b/database/hsqldb/src/org/hsqldb/persist/DataFileCacheSession.java deleted file mode 100644 index b42f9438..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DataFileCacheSession.java +++ /dev/null @@ -1,152 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Database; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.FileUtil; - -/** - * A file-based row store for temporary CACHED table persistence.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public class DataFileCacheSession extends DataFileCache { - - public DataFileCacheSession(Database db, String baseFileName) { - - super(db, baseFileName); - - logEvents = false; - } - - /** - * Initial external parameters are set here. The size if fixed. - */ - protected void initParams(Database database, String baseFileName, - boolean defrag) { - - this.dataFileName = baseFileName + ".data.tmp"; - this.database = database; - fa = FileUtil.getFileUtil(); - dataFileScale = 64; - cachedRowPadding = dataFileScale; - maxCacheRows = 2048; - maxCacheBytes = maxCacheRows * 1024L; - maxDataFileSize = (long) Integer.MAX_VALUE * dataFileScale; - } - - /** - * Opens the *.data file for this cache. - */ - public void open(boolean readonly) { - - try { - dataFile = new RAFile(database.logger, dataFileName, false, false, - false); - fileFreePosition = dataFileScale; - - initBuffers(); - - spaceManager = new DataSpaceManagerSimple(this, false); - } catch (Throwable t) { - database.logger.logWarningEvent("Failed to open Session RA file", - t); - release(); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_DataFileCache_open, new String[] { - t.toString(), dataFileName - }); - } - } - - protected void setFileModified() {} - - /** - * Parameter write is always false. The backing file is simply closed and - * deleted. - */ - public void close() { - - writeLock.lock(); - - try { - clear(); - - if (dataFile != null) { - dataFile.close(); - - dataFile = null; - - deleteDataFile(); - } - } catch (Throwable t) { - database.logger.logWarningEvent("Failed to close Session RA file", - t); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_DataFileCache_close, new String[] { - t.toString(), dataFileName - }); - } finally { - writeLock.unlock(); - } - } - - public void adjustStoreCount(int adjust) { - - writeLock.lock(); - - try { - storeCount += adjust; - - if (storeCount == 0) { - clear(); - } - } finally { - writeLock.unlock(); - } - } - - protected void clear() { - - super.clear(); - - fileStartFreePosition = fileFreePosition = dataFileScale; - - initBuffers(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DataFileDefrag.java b/database/hsqldb/src/org/hsqldb/persist/DataFileDefrag.java deleted file mode 100644 index 729c2c4e..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DataFileDefrag.java +++ /dev/null @@ -1,237 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Database; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.DoubleIntIndex; -import org.hsqldb.lib.DoubleLongIndex; -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.lib.LongLookup; -import org.hsqldb.lib.StopWatch; -import org.hsqldb.lib.StringUtil; - -/** - * Routine to defrag the *.data file. - * - * This method iterates over the primary index of a table to find the - * disk position for each row and stores it, together with the new position - * in an array. - * - * A second pass over the primary index writes each row to the new disk - * image after translating the old pointers to the new. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.7.2 - */ -final class DataFileDefrag { - - DataFileCache dataFileOut; - StopWatch stopw = new StopWatch(); - String dataFileName; - long[][] rootsList; - Database database; - DataFileCache dataCache; - LongLookup pointerLookup; - - DataFileDefrag(Database db, DataFileCache cache) { - - this.database = db; - this.dataCache = cache; - this.dataFileName = cache.getFileName(); - } - - void process(Session session) { - - Throwable error = null; - - database.logger.logDetailEvent("Defrag process begins"); - - HsqlArrayList allTables = database.schemaManager.getAllTables(true); - - rootsList = new long[allTables.size()][]; - - long maxSize = 0; - - for (int i = 0, tSize = allTables.size(); i < tSize; i++) { - Table table = (Table) allTables.get(i); - - if (table.getTableType() == TableBase.CACHED_TABLE) { - RowStoreAVLDisk store = - (RowStoreAVLDisk) database.persistentStoreCollection - .getStore(table); - long size = store.elementCount(); - - if (size > maxSize) { - maxSize = size; - } - - if (dataCache.spaceManager.isMultiSpace() - && store.getSpaceManager().isDefaultSpace()) { - if (store.getStorageSizeEstimate() - > dataCache.spaceManager.getFileBlockSize() / 2) { - int spaceId = - dataCache.spaceManager.getNewTableSpaceID(); - - table.setSpaceID(spaceId); - } - } - } - } - - if (maxSize > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.X_2200T); - } - - try { - String baseFileName = database.getCanonicalPath(); - - dataFileOut = new DataFileCache(database, baseFileName, true); - - if (dataCache.fileFreePosition - < (long) Integer.MAX_VALUE * dataCache.dataFileScale) { - pointerLookup = new DoubleIntIndex((int) maxSize); - } else { - pointerLookup = new DoubleLongIndex((int) maxSize); - } - - for (int i = 0, tSize = allTables.size(); i < tSize; i++) { - Table t = (Table) allTables.get(i); - - if (t.getTableType() == TableBase.CACHED_TABLE) { - long[] rootsArray = writeTableToDataFile(session, t); - - rootsList[i] = rootsArray; - } else { - rootsList[i] = null; - } - } - - dataFileOut.close(); - - dataFileOut = null; - - for (int i = 0, size = rootsList.length; i < size; i++) { - long[] roots = rootsList[i]; - - if (roots != null) { - database.logger.logDetailEvent("roots: " - + StringUtil.getList(roots, - ",", "")); - } - } - } catch (OutOfMemoryError e) { - error = e; - - throw Error.error(ErrorCode.OUT_OF_MEMORY, e); - } catch (Throwable t) { - error = t; - - throw Error.error(ErrorCode.GENERAL_ERROR, t); - } finally { - try { - if (dataFileOut != null) { - dataFileOut.release(); - } - } catch (Throwable t) {} - - if (error instanceof OutOfMemoryError) { - database.logger.logInfoEvent( - "defrag failed - out of memory - required: " - + maxSize * 8); - } - - if (error == null) { - database.logger.logDetailEvent("Defrag transfer complete: " - + stopw.elapsedTime()); - } else { - database.logger.logSevereEvent("defrag failed ", error); - - if (dataFileOut != null) { - dataFileOut.deleteDataFile(); - } - } - } - } - - long[] writeTableToDataFile(Session session, Table table) { - - RowStoreAVLDisk store = - (RowStoreAVLDisk) table.database.persistentStoreCollection - .getStore(table); - long[] rootsArray = table.getIndexRootsArray(); - - pointerLookup.clear(); - database.logger.logDetailEvent("lookup begins " - + table.getName().statementName + " " - + stopw.elapsedTime()); - store.moveDataToSpace(dataFileOut, pointerLookup); - - for (int i = 0; i < table.getIndexCount(); i++) { - if (rootsArray[i] == -1) { - continue; - } - - long pos = pointerLookup.lookup(rootsArray[i], -1); - - if (pos == -1) { - throw Error.error(ErrorCode.DATA_FILE_ERROR); - } - - rootsArray[i] = pos; - } - - // log any discrepency in row count - long count = store.elementCount(); - - if (count != pointerLookup.size()) { - database.logger.logSevereEvent("discrepency in row count " - + table.getName().name + " " - + count + " " - + pointerLookup.size(), null); - } - - database.logger.logDetailEvent("table written " - + table.getName().statementName); - - return rootsArray; - } - - public long[][] getIndexRoots() { - return rootsList; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DataSpaceManager.java b/database/hsqldb/src/org/hsqldb/persist/DataSpaceManager.java deleted file mode 100644 index c46b50a7..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DataSpaceManager.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.LongLookup; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.3.0 - */ -public interface DataSpaceManager { - - int tableIdEmpty = 0; - int tableIdDirectory = 1; - int tableIdLookup = 5; - int tableIdSetAside = 6; - int tableIdDefault = 7; - int tableIdFirst = 8; - - // - int fixedDiskBlockSize = 4096; - - TableSpaceManager getDefaultTableSpace(); - - TableSpaceManager getTableSpace(int spaceId); - - int getNewTableSpaceID(); - - long getFileBlocks(int spaceId, int blockCount); - - void initialiseTableSpace(TableSpaceManagerBlocks tableSpace); - - void freeTableSpace(int spaceId); - - void freeTableSpace(int spaceId, LongLookup spaceList, long offset, - long limit); - - long getLostBlocksSize(); - - boolean isModified(); - - int getFileBlockSize(); - - void initialiseSpaces(); - - void reset(); - - boolean isMultiSpace(); - - int getFileBlockItemCount(); - - DirectoryBlockCachedObject[] getDirectoryList(); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DataSpaceManagerBlocks.java b/database/hsqldb/src/org/hsqldb/persist/DataSpaceManagerBlocks.java deleted file mode 100644 index 1589ac23..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DataSpaceManagerBlocks.java +++ /dev/null @@ -1,1195 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.concurrent.atomic.AtomicInteger; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.DoubleIntIndex; -import org.hsqldb.lib.IntIndex; -import org.hsqldb.lib.IntKeyHashMap; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.LongLookup; -import org.hsqldb.lib.OrderedIntHashSet; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.3.0 - */ -public class DataSpaceManagerBlocks implements DataSpaceManager { - - // - final DataFileCache cache; - final TableSpaceManagerBlocks defaultSpaceManager; - final TableSpaceManagerBlocks directorySpaceManager; - - // - final IntKeyHashMap spaceManagerList; - - // - final BlockObjectStore rootStore; - final BlockObjectStore directoryStore; - final BlockObjectStore bitMapStore; - final BlockObjectStore lastBlockStore; - - // - IntArrayCachedObject rootBlock; - DoubleIntArrayCachedObject lastBlocks; - - // - final AtomicInteger spaceIdSequence = new AtomicInteger(tableIdFirst); - final IntIndex emptySpaceList; - int released = 0; - - // - public static final int lastBlockListSize = 1024; - public static final int dirBlockSize = 1024 * 2; - public static final int fileBlockItemCountLimit = 64 * 1024; - - // - final int bitmapIntSize; - final int bitmapStorageSize; - final int fileBlockItemCount; - final int fileBlockSize; - final int dataFileScale; - - // - BlockAccessor ba; - - public DataSpaceManagerBlocks(DataFileCache dataFileCache) { - - int bitmapStoreSizeTemp; - - cache = dataFileCache; - dataFileScale = cache.getDataFileScale(); - fileBlockSize = cache.getDataFileSpace() * 1024 * 1024; - fileBlockItemCount = fileBlockSize / dataFileScale; - bitmapIntSize = fileBlockItemCount / Integer.SIZE; - bitmapStoreSizeTemp = BitMapCachedObject.fileSizeFactor - * bitmapIntSize; - - if (bitmapStoreSizeTemp < fixedDiskBlockSize) { - bitmapStoreSizeTemp = fixedDiskBlockSize; - } - - bitmapStorageSize = bitmapStoreSizeTemp; - ba = new BlockAccessor(); - spaceManagerList = new IntKeyHashMap(); - emptySpaceList = new IntIndex(32, false); - - // - directorySpaceManager = new TableSpaceManagerBlocks(this, - tableIdDirectory, fileBlockSize, 16, dataFileScale); - defaultSpaceManager = new TableSpaceManagerBlocks(this, - tableIdDefault, fileBlockSize, - cache.database.logger.propMaxFreeBlocks, dataFileScale); - - spaceManagerList.put(tableIdDirectory, directorySpaceManager); - spaceManagerList.put(tableIdDefault, defaultSpaceManager); - - // - rootStore = getRootStore(); - directoryStore = getDirectoryStore(); - bitMapStore = getBitMapStore(); - lastBlockStore = getLastBlockStore(); - - if (cache.spaceManagerPosition == 0) { - initialiseNewSpaceDirectory(); - - cache.spaceManagerPosition = rootBlock.getPos() * dataFileScale; - } else { - long position = cache.spaceManagerPosition / dataFileScale; - - rootBlock = (IntArrayCachedObject) rootStore.get(position, true); - - // integrity check - if (getBlockIndexLimit() == 0) { - throw Error.error(ErrorCode.FILE_IO_ERROR); - } - - if (cache.isDataReadOnly()) { - return; - } - - initialiseSpaceList(); - - int blockPos = rootBlock.getValue(dirBlockSize - 1); - - if (blockPos == 0) { - - // create - lastBlocks = new DoubleIntArrayCachedObject(lastBlockListSize); - - initialiseTableSpace(directorySpaceManager); - lastBlockStore.add(lastBlocks, true); - - blockPos = getFileBlockPosFromPosition(lastBlocks.getPos()); - - rootBlock.setValue(dirBlockSize - 1, blockPos); - } else { - position = getPositionFromFileBlock(blockPos); - lastBlocks = - (DoubleIntArrayCachedObject) lastBlockStore.get(position, - true); - - initialiseTableSpace(directorySpaceManager); - } - } - } - - BlockObjectStore getRootStore() { - - return new BlockObjectStore(cache, directorySpaceManager, - IntArrayCachedObject.class, - IntArrayCachedObject.fileSizeFactor - * dirBlockSize, dirBlockSize); - } - - BlockObjectStore getDirectoryStore() { - - return new BlockObjectStore(cache, directorySpaceManager, - DirectoryBlockCachedObject.class, - DirectoryBlockCachedObject.fileSizeFactor - * dirBlockSize, dirBlockSize); - } - - BlockObjectStore getBitMapStore() { - - return new BlockObjectStore(cache, directorySpaceManager, - BitMapCachedObject.class, - bitmapStorageSize, bitmapIntSize); - } - - BlockObjectStore getLastBlockStore() { - - return new BlockObjectStore(cache, directorySpaceManager, - DoubleIntArrayCachedObject.class, - DoubleIntArrayCachedObject.fileSizeFactor - * lastBlockListSize, lastBlockListSize); - } - - private void initialiseNewSpaceDirectory() { - - long filePosition = DataFileCache.Positions.MAX_INITIAL_FREE_POS; - int dirSpaceBlockCount = 1; - - cache.enlargeFileSpace(fileBlockSize); - directorySpaceManager.initialiseFileBlock(null, filePosition, - fileBlockSize); - - rootBlock = new IntArrayCachedObject(dirBlockSize); - - rootStore.add(rootBlock, true); - - lastBlocks = new DoubleIntArrayCachedObject(lastBlockListSize); - - lastBlockStore.add(lastBlocks, true); - - int blockPos = getFileBlockPosFromPosition(lastBlocks.getPos()); - - rootBlock.setValue(dirBlockSize - 1, blockPos); - createFileBlocksInDirectory(0, dirSpaceBlockCount, tableIdDirectory); - } - - /** - * The space for a new directory block must be added to the directorySpaceManager - * before createFileBlocksInDirectory is called, otherwise there is no space - * to create the bit-map - */ - private void ensureDirectorySpaceAvailable(int blockCount) { - - long dirObjectSize = (long) bitmapStorageSize * blockCount; - - dirObjectSize += DirectoryBlockCachedObject.fileSizeFactor - * dirBlockSize; - - boolean hasRoom = directorySpaceManager.hasFileRoom(dirObjectSize); - - if (!hasRoom) { - int index = getBlockIndexLimit(); - long filePosition = (long) index * fileBlockSize; - long dirSpaceBlockCount = dirObjectSize / fileBlockSize + 1; - long delta = dirSpaceBlockCount * fileBlockSize; - - cache.enlargeFileSpace(filePosition + delta); - directorySpaceManager.addFileBlock(filePosition, - filePosition + delta); - createFileBlocksInDirectory(index, (int) dirSpaceBlockCount, - tableIdDirectory); - } - } - - /** - * try available blocks first, then get fresh block - */ - public long getFileBlocks(int tableId, int blockCount) { - - cache.writeLock.lock(); - - try { - long index = getExistingBlockIndex(tableId, blockCount); - - if (index > 0) { - return index * fileBlockSize; - } else { - return getNewFileBlocks(tableId, blockCount); - } - } finally { - cache.writeLock.unlock(); - } - } - - private long getNewFileBlocks(int tableId, int blockCount) { - - ensureDirectorySpaceAvailable(blockCount); - - return getNewFileBlocksNoCheck(tableId, blockCount); - } - - private long getNewFileBlocksNoCheck(int tableId, int blockCount) { - - int index = getBlockIndexLimit(); - long filePosition = (long) index * fileBlockSize; - long delta = (long) blockCount * fileBlockSize; - - cache.enlargeFileSpace(filePosition + delta); - createFileBlocksInDirectory(index, blockCount, tableId); - - return filePosition; - } - - private void createFileBlocksInDirectory(int fileBlockIndex, - int blockCount, int tableId) { - - for (int i = 0; i < blockCount; i++) { - createFileBlockInDirectory(fileBlockIndex + i, tableId); - } - } - - private void createFileBlockInDirectory(int fileBlockIndex, int tableId) { - - BitMapCachedObject bitMap = new BitMapCachedObject(bitmapIntSize); - - bitMapStore.add(bitMap, false); - - // - int bitmapBlockPos = getFileBlockPosFromPosition(bitMap.getPos()); - int blockOffset = fileBlockIndex % dirBlockSize; - DirectoryBlockCachedObject directory = getDirectory(fileBlockIndex, - true); - - if (directory == null) { - createDirectory(fileBlockIndex); - - directory = getDirectory(fileBlockIndex, true); - } - - directory.setTableId(blockOffset, tableId); - directory.setBitmapAddress(blockOffset, bitmapBlockPos); - directory.keepInMemory(false); - } - - private DirectoryBlockCachedObject getDirectory(int fileBlockIndex, - boolean keep) { - - int indexInRoot = fileBlockIndex / dirBlockSize; - - return getDirectoryByIndex(indexInRoot, keep); - } - - private DirectoryBlockCachedObject getDirectoryByIndex(int indexInRoot, - boolean keep) { - - int blockPos = rootBlock.getValue(indexInRoot); - long position = getPositionFromFileBlock(blockPos); - - if (position == 0) { - return null; - } - - return (DirectoryBlockCachedObject) directoryStore.get(position, keep); - } - - private void createDirectory(int fileBlockIndex) { - - DirectoryBlockCachedObject directory; - - directory = new DirectoryBlockCachedObject(dirBlockSize); - - directoryStore.add(directory, false); - - int indexInRoot = fileBlockIndex / dirBlockSize; - int blockPosition = getFileBlockPosFromPosition(directory.getPos()); - - rootBlock.setValue(indexInRoot, blockPosition); - } - - private int getBlockIndexLimit() { - - int indexInRoot = rootBlock.getNonZeroSize(); - - if (indexInRoot == 0) { - return 0; - } - - indexInRoot--; - - int directoryBlockOffset = getDirectoryIndexLimit(indexInRoot); - - return indexInRoot * dirBlockSize + directoryBlockOffset; - } - - private int getDirectoryIndexLimit(int indexInRoot) { - - DirectoryBlockCachedObject directory = getDirectoryByIndex(indexInRoot, - false); - int[] bitmapArray = directory.getBitmapAddressArray(); - int index = 0; - - for (; index < bitmapArray.length; index++) { - if (bitmapArray[index] == 0) { - break; - } - } - - return index; - } - - private void initialiseSpaceList() { - - int maxId = tableIdDefault; - OrderedIntHashSet list = new OrderedIntHashSet(); - - ba.initialise(false); - - try { - for (;;) { - boolean result = ba.nextBlock(); - - if (!result) { - break; - } - - int currentId = ba.getTableId(); - - if (currentId > maxId) { - maxId = currentId; - } - - if (currentId == tableIdEmpty) { - int freeItems = ba.getFreeSpaceValue(); - int freeItemsEnd = ba.getFreeBlockValue(); - - if (freeItems == 0 && freeItemsEnd == 0) { - emptySpaceList.addUnique(ba.currentBlockIndex); - } else { - list.add(ba.currentBlockIndex); - } - } - } - } finally { - ba.reset(); - } - - spaceIdSequence.set((maxId + 2) & -2); - - if (list.size() > 0) { - setAsideBlocks(list); - - String s = - "space manager error - recovered (freeItems in empty blocks) : (" - + list.size() + ")"; - - cache.logSevereEvent(s, null); - } - } - - private int getExistingBlockIndex(int tableId, int blockCount) { - - int blockIndex = emptySpaceList.removeFirstConsecutiveKeys(blockCount, - -1); - - if (blockIndex > 0) { - setDirectoryBlocksAsTable(tableId, blockIndex, blockCount); - } - - return blockIndex; - } - - /** - * index and blockCount always valid - */ - private void setDirectoryBlocksAsTable(int tableId, int blockIndex, - int blockCount) { - - int directoryIndex = -1; - DirectoryBlockCachedObject directory = null; - - for (int i = blockIndex; i < blockIndex + blockCount; i++) { - if (directoryIndex != i / dirBlockSize) { - if (directory != null) { - directory.keepInMemory(false); - } - - directory = getDirectory(i, true); - directoryIndex = i / dirBlockSize; - } - - int offset = i % dirBlockSize; - - directory.setTableId(offset, tableId); - } - - directory.keepInMemory(false); - } - - public TableSpaceManager getDefaultTableSpace() { - return defaultSpaceManager; - } - - public TableSpaceManager getTableSpace(int spaceId) { - - if (spaceId == tableIdDefault) { - return defaultSpaceManager; - } - - if (spaceId >= spaceIdSequence.get()) { - spaceIdSequence.set((spaceId + 2) & -2); - } - - cache.writeLock.lock(); - - try { - TableSpaceManagerBlocks manager = - (TableSpaceManagerBlocks) spaceManagerList.get(spaceId); - - if (manager == null) { - manager = new TableSpaceManagerBlocks( - this, spaceId, fileBlockSize, - cache.database.logger.propMaxFreeBlocks, dataFileScale); - - spaceManagerList.put(spaceId, manager); - } - - return manager; - } finally { - cache.writeLock.unlock(); - } - } - - public int getNewTableSpaceID() { - return spaceIdSequence.getAndAdd(2); - } - - public void freeTableSpace(int spaceId) { - - if (spaceId == tableIdDefault || spaceId == tableIdDirectory) { - return; - } - - cache.writeLock.lock(); - - try { - TableSpaceManager tableSpace = - (TableSpaceManager) spaceManagerList.get(spaceId); - - if (tableSpace != null) { - tableSpace.reset(); - - // do not remove from spaceManagerList - can be truncate - } - - lastBlocks.removeKey(spaceId); - - IntIndex list = new IntIndex(16, false); - - ba.initialise(true); - - try { - while (ba.nextBlockForTable(spaceId)) { - list.addUnsorted(ba.currentBlockIndex); - ba.setTable(tableIdEmpty); - emptySpaceList.addUnique(ba.currentBlockIndex); - } - } finally { - ba.reset(); - } - - cache.releaseRange(list, fileBlockItemCount); - } finally { - cache.writeLock.unlock(); - } - } - - public void freeTableSpace(int spaceId, LongLookup spaceList, long offset, - long limit) { - - if (spaceList.size() == 0 && offset == limit) { - return; - } - - cache.writeLock.lock(); - - try { - ba.initialise(true); - - try { - long position; - int units; - - for (int i = 0; i < spaceList.size(); i++) { - position = spaceList.getLongKey(i); - units = (int) spaceList.getLongValue(i); - - freeTableSpacePart(position, units); - } - - position = offset / dataFileScale; - units = (int) ((limit - offset) / dataFileScale); - - freeTableSpacePart(position, units); - } finally { - ba.reset(); - } - } finally { - cache.writeLock.unlock(); - } - } - - private void freeTableSpacePart(long position, int units) { - - for (; units > 0; ) { - - // count can cover more than one file block - int blockIndex = (int) (position / fileBlockItemCount); - int offset = (int) (position % fileBlockItemCount); - int currentUnits = fileBlockItemCount - offset; - - if (currentUnits > units) { - currentUnits = units; - } - - boolean result = ba.moveToBlock(blockIndex); - - if (result) { - int setCount = ba.setRange(offset, currentUnits); - - if (setCount != currentUnits) { - ba.unsetRange(offset, currentUnits); - - String s = - "space manager error - recovered (block, offset, units) : (" - + blockIndex + "," + offset + "," + units + ")"; - - cache.logSevereEvent(s, null); - } - } else { - String s = - "space manager error - recovered (block, offset, units) : (" - + blockIndex + "," + offset + "," + units + ")"; - - cache.logSevereEvent(s, null); - } - - units -= currentUnits; - position += currentUnits; - } - } - - /** - * Returns space id - * - * returns - 1 if pointer is beyond the last allocated block - */ - int findTableSpace(long position) { - - int blockIndex = (int) (position / fileBlockItemCount); - - cache.writeLock.lock(); - - try { - ba.initialise(false); - - try { - boolean result = ba.moveToBlock(blockIndex); - - if (!result) { - return -1; - } - - int id = ba.getTableId(); - - return id; - } finally { - ba.reset(); - } - } finally { - cache.writeLock.unlock(); - } - } - - void setAsideBlocks(OrderedIntHashSet blocks) { - - cache.writeLock.lock(); - - try { - ba.initialise(true); - - try { - for (int i = 0; i < blocks.size(); i++) { - int block = blocks.get(i); - boolean result = ba.moveToBlock(block); - - if (result) { - ba.setTable(tableIdSetAside); - } - } - } finally { - ba.reset(); - } - } finally { - cache.writeLock.unlock(); - } - } - - public long getLostBlocksSize() { - - long fragment = 0; - - cache.writeLock.lock(); - - try { - ba.initialise(false); - - try { - for (;;) { - boolean result = ba.nextBlock(); - - if (!result) { - break; - } - - if (ba.getTableId() == tableIdDirectory) { - continue; - } - - fragment += (long) ba.getFreeSpaceValue() * dataFileScale; - - if (ba.getTableId() == tableIdEmpty) { - fragment += fileBlockSize; - } - } - } finally { - ba.reset(); - } - } finally { - cache.writeLock.unlock(); - } - - return fragment; - } - - public int getFileBlockSize() { - return fileBlockSize; - } - - public boolean isModified() { - return true; - } - - public void initialiseSpaces() { - - cache.writeLock.lock(); - - try { - Iterator it = spaceManagerList.values().iterator(); - - while (it.hasNext()) { - TableSpaceManagerBlocks tableSpace = - (TableSpaceManagerBlocks) it.next(); - - if (tableSpace.getSpaceID() == tableIdDirectory - || tableSpace.getFileBlockIndex() != -1) { - initialiseTableSpace(tableSpace); - } - } - } finally { - cache.writeLock.unlock(); - } - } - - public void reset() { - - cache.writeLock.lock(); - - try { - Iterator it = spaceManagerList.values().iterator(); - - while (it.hasNext()) { - TableSpaceManagerBlocks tableSpace = - (TableSpaceManagerBlocks) it.next(); - - tableSpace.reset(); - - int lastBlockIndex = tableSpace.getFileBlockIndex(); - int spaceId; - - if (lastBlockIndex >= 0) { - spaceId = tableSpace.getSpaceID(); - - lastBlocks.addKey(spaceId, lastBlockIndex); - } - } - } finally { - cache.writeLock.unlock(); - } - } - - public boolean isMultiSpace() { - return true; - } - - public int getFileBlockItemCount() { - return fileBlockItemCount; - } - - public DirectoryBlockCachedObject[] getDirectoryList() { - - int count = rootBlock.getNonZeroSize(); - DirectoryBlockCachedObject[] directoryList; - - directoryList = new DirectoryBlockCachedObject[count]; - - for (int i = 0; i < directoryList.length; i++) { - directoryList[i] = getDirectoryByIndex(i, false); - } - - return directoryList; - } - - /** - * return keys are file block indexes, values are bad (off) space ids - * or tableIdDirectory when two bitmpas have the same pointer - */ - DoubleIntIndex checkDirectorySpaces() { - - DirectoryBlockCachedObject[] directoryList = getDirectoryList(); - DoubleIntIndex offspaceBitmaps = new DoubleIntIndex(8); - DoubleIntIndex positionBitmaps = new DoubleIntIndex(8); - - for (int i = 0; i < directoryList.length; i++) { - DirectoryBlockCachedObject dir = directoryList[i]; - long position = dir.getPos(); - int spaceId = findTableSpace(position); - int blockIndex = i; - int blockPos = rootBlock.getValue(blockIndex); - boolean result; - int count = dir.getStorageSize() / fixedDiskBlockSize; - - for (int j = 0; j < count; j++) { - result = positionBitmaps.addUnique(blockPos, blockIndex); - } - - int[] bitMapAddress = dir.getBitmapAddressArray(); - - for (int j = 0; j < bitMapAddress.length; j++) { - blockPos = dir.getBitmapAddress(j); - - if (blockPos == 0) { - break; - } - - position = getPositionFromFileBlock(blockPos); - spaceId = findTableSpace(position); - blockIndex = i * dirBlockSize + j; - - if (spaceId != tableIdDirectory) { - offspaceBitmaps.add(blockIndex, spaceId); - } else { - result = positionBitmaps.addUnique(blockPos, blockIndex); - - if (!result) { - offspaceBitmaps.add(blockIndex, spaceId); - - int offset = - positionBitmaps.findFirstEqualKeyIndex(blockPos); - - blockIndex = positionBitmaps.getValue(offset); - - offspaceBitmaps.add(blockIndex, spaceId); - } - } - } - } - - return offspaceBitmaps; - } - - /** - * return keys are file block indexes, values are space ids - */ - DoubleIntIndex checkDirectoryBitmaps(DirectoryBlockCachedObject mismatch) { - - DirectoryBlockCachedObject[] directoryList = getDirectoryList(); - DoubleIntIndex offspaceBitmaps = new DoubleIntIndex(8); - int mismatchCount = 0; - - for (int i = 0; i < directoryList.length; i++) { - DirectoryBlockCachedObject dir = directoryList[i]; - int[] bitMapAddress = dir.getBitmapAddressArray(); - - for (int j = 0; j < bitMapAddress.length; j++) { - int blockPos = dir.getBitmapAddress(j); - - if (blockPos == 0) { - break; - } - - long position = getPositionFromFileBlock(blockPos); - int spaceId = findTableSpace(position); - int blockIndex = i * dirBlockSize + j; - BitMapCachedObject currentBitMap = - (BitMapCachedObject) bitMapStore.get(position, false); - - spaceId = dir.getTableId(j); - - int freeUnits = currentBitMap.bitMap.countSetBits(); - int freeBlockUnits = currentBitMap.bitMap.countSetBitsEnd(); - - if (dir.getFreeSpace(j) != freeUnits - || dir.getFreeBlock(j) != freeBlockUnits) { - offspaceBitmaps.add(blockIndex, spaceId); - mismatch.setTableId(mismatchCount, spaceId); - mismatch.setFreeSpace(mismatchCount, (char) freeUnits); - mismatch.setFreeBlock(mismatchCount, - (char) freeBlockUnits); - - mismatchCount++; - - if (mismatchCount == mismatch.getTableIdArray().length) { - break; - } - } - } - } - - return offspaceBitmaps; - } - - private int findLastFreeSpace(int spaceId) { - return lastBlocks.getValue(spaceId, -1); - } - - public void initialiseTableSpace(TableSpaceManagerBlocks tableSpace) { - - int spaceId = tableSpace.getSpaceID(); - int lastBlockIndex = tableSpace.getFileBlockIndex(); - - if (lastBlockIndex < 0) { - lastBlockIndex = findLastFreeSpace(spaceId); - } - - if (lastBlockIndex >= 0) { - long position = (long) lastBlockIndex * fileBlockItemCount; - int id = findTableSpace(position); - - if (id != spaceId) { - lastBlockIndex = -1; - } - } - - if (lastBlockIndex < 0) { - lastBlockIndex = findLargestFreeSpace(spaceId); - } - - if (lastBlockIndex < 0) { - return; - } - - if (hasFreeSpace(spaceId, lastBlockIndex)) { - initialiseTableSpace(tableSpace, lastBlockIndex); - } - } - - private boolean hasFreeSpace(int spaceId, int blockIndex) { - - ba.initialise(false); - - try { - boolean result = ba.moveToBlock(blockIndex); - - if (result) { - if (ba.getTableId() == spaceId) { - if (ba.getFreeBlockValue() > 0) { - return true; - } - } - } - - return false; - } finally { - ba.reset(); - } - } - - private int findLargestFreeSpace(int spaceId) { - - int maxFree = 0; - int blockIndex = -1; - - ba.initialise(false); - - try { - for (; ba.nextBlockForTable(spaceId); ) { - - // find the largest free - int currentFree = ba.getFreeBlockValue(); - - if (currentFree > maxFree) { - blockIndex = ba.currentBlockIndex; - maxFree = currentFree; - } - } - - return blockIndex; - } finally { - ba.reset(); - } - } - - private void initialiseTableSpace(TableSpaceManagerBlocks tableSpace, - int blockIndex) { - - // get existing file block and initialise - ba.initialise(true); - - try { - ba.moveToBlock(blockIndex); - - int freeItems = ba.getFreeBlockValue(); - long blockPos = (long) blockIndex * fileBlockSize; - int unsetCount = ba.unsetRange(fileBlockItemCount - freeItems, - freeItems); - - if (unsetCount == freeItems) { - tableSpace.initialiseFileBlock(null, blockPos + fileBlockSize - - (long) freeItems - * dataFileScale, blockPos - + fileBlockSize); - } else { - cache.logSevereEvent("space manager error - recovered", null); - } - } finally { - ba.reset(); - } - } - - /** - * input is in units of fixedBlockSizeUnit - * output is in units of dataFileScale - */ - long getPositionFromFileBlock(int fixedBlockPos) { - return fixedBlockPos * (long) (fixedDiskBlockSize / dataFileScale); - } - - int getFileBlockPosFromPosition(long position) { - return (int) (position / (fixedDiskBlockSize / dataFileScale)); - } - - private class BlockAccessor { - - boolean currentKeep; - int currentBlockIndex = -1; - int currentDirIndex = -1; - int currentBlockOffset = -1; - DirectoryBlockCachedObject currentDir = null; - BitMapCachedObject currentBitMap = null; - - void initialise(boolean forUpdate) { - currentKeep = forUpdate; - } - - boolean nextBlock() { - - boolean result = moveToBlock(currentBlockIndex + 1); - - return result; - } - - boolean nextBlockForTable(int tableId) { - - for (;;) { - boolean result = moveToBlock(currentBlockIndex + 1); - - if (!result) { - return false; - } - - if (getTableId() == tableId) { - return true; - } - } - } - - boolean moveToBlock(int fileBlockIndex) { - - if (currentBlockIndex != fileBlockIndex) { - endBlockUpdate(); - - currentBitMap = null; - - if (currentDirIndex != fileBlockIndex / dirBlockSize) { - reset(); - - currentDirIndex = fileBlockIndex / dirBlockSize; - currentDir = getDirectory(fileBlockIndex, currentKeep); - } - - if (currentDir == null) { - reset(); - - return false; - } - - currentBlockIndex = fileBlockIndex; - currentBlockOffset = fileBlockIndex % dirBlockSize; - - long position = - currentDir.getBitmapAddress(currentBlockOffset); - - if (position == 0) { - reset(); - - return false; - } - - if (currentKeep) { - position *= (fixedDiskBlockSize / dataFileScale); - currentBitMap = - (BitMapCachedObject) bitMapStore.get(position, true); - } - } - - return true; - } - - int setRange(int offset, int currentUnits) { - - currentBitMap.setChanged(true); - - return currentBitMap.bitMap.setRange(offset, currentUnits); - } - - int unsetRange(int offset, int currentUnits) { - - currentBitMap.setChanged(true); - - return currentBitMap.bitMap.unsetRange(offset, currentUnits); - } - - void reset() { - - endBlockUpdate(); - - if (currentDir != null) { - if (currentKeep) { - currentDir.keepInMemory(false); - } - } - - currentBlockIndex = -1; - currentDirIndex = -1; - currentBlockOffset = -1; - currentDir = null; - currentBitMap = null; - } - - private void endBlockUpdate() { - - if (currentBitMap == null) { - return; - } - - if (!currentBitMap.hasChanged()) { - currentBitMap.keepInMemory(false); - - return; - } - - int freeUnits = currentBitMap.bitMap.countSetBits(); - int freeBlockUnits = currentBitMap.bitMap.countSetBitsEnd(); - - if (freeUnits == fileBlockItemCount) { - int currentId = - currentDir.getTableIdArray()[currentBlockOffset]; - - if (currentId != tableIdSetAside) { - setTable(tableIdEmpty); - emptySpaceList.addUnique(currentBlockIndex); - - released++; - } - - currentBitMap.keepInMemory(false); - - return; - } - - currentBitMap.keepInMemory(false); - currentDir.setFreeSpace(currentBlockOffset, (char) freeUnits); - currentDir.setFreeBlock(currentBlockOffset, (char) freeBlockUnits); - } - - void setTable(int tableId) { - - currentDir.setTableId(currentBlockOffset, tableId); - currentDir.setFreeSpace(currentBlockOffset, (char) 0); - currentDir.setFreeBlock(currentBlockOffset, (char) 0); - currentBitMap.bitMap.reset(); - currentBitMap.setChanged(true); - } - - int getTableId() { - return currentDir.getTableId(currentBlockOffset); - } - - char getFreeSpaceValue() { - return currentDir.getFreeSpace(currentBlockOffset); - } - - char getFreeBlockValue() { - return currentDir.getFreeBlock(currentBlockOffset); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DataSpaceManagerSimple.java b/database/hsqldb/src/org/hsqldb/persist/DataSpaceManagerSimple.java deleted file mode 100644 index 758d3a27..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DataSpaceManagerSimple.java +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.LongLookup; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.3.0 - */ -public class DataSpaceManagerSimple implements DataSpaceManager { - - final DataFileCache cache; - final TableSpaceManager defaultSpaceManager; - final int fileBlockSize = fixedDiskBlockSize; - long totalFragmentSize; - int spaceIdSequence = tableIdFirst; - LongLookup lookup; - - /** - * Used for non-space default, readonly, Text and Session data files - */ - DataSpaceManagerSimple(DataFileCache cache, boolean isReadOnly) { - - this.cache = cache; - - if (cache instanceof DataFileCacheSession) { - defaultSpaceManager = new TableSpaceManagerSimple(cache); - } else if (cache instanceof TextCache) { - defaultSpaceManager = new TableSpaceManagerSimple(cache); - } else { - int capacity = cache.database.logger.propMaxFreeBlocks; - - defaultSpaceManager = new TableSpaceManagerBlocks(this, - tableIdDefault, fileBlockSize, capacity, - cache.getDataFileScale()); - - if (!isReadOnly) { - initialiseSpaces(); - - cache.spaceManagerPosition = 0; - } - } - - totalFragmentSize = cache.lostSpaceSize; - } - - public TableSpaceManager getDefaultTableSpace() { - return defaultSpaceManager; - } - - public TableSpaceManager getTableSpace(int spaceId) { - - if (spaceId >= spaceIdSequence) { - spaceIdSequence = spaceId + 2; - } - - return defaultSpaceManager; - } - - public int getNewTableSpaceID() { - - int id = spaceIdSequence; - - spaceIdSequence += 2; - - return id; - } - - public long getFileBlocks(int spaceId, int blockCount) { - - long filePosition = cache.getFileFreePos(); - - cache.enlargeFileSpace(filePosition - + (long) blockCount * fileBlockSize); - - return filePosition; - } - - public void initialiseTableSpace(TableSpaceManagerBlocks tableSpace) {} - - public void freeTableSpace(int spaceId) {} - - public void freeTableSpace(int spaceId, LongLookup spaceList, long offset, - long limit) { - - totalFragmentSize += spaceList.getTotalValues() - * cache.getDataFileScale(); - - if (cache.fileFreePosition == limit) { - cache.writeLock.lock(); - - try { - cache.fileFreePosition = offset; - } finally { - cache.writeLock.unlock(); - } - } else { - totalFragmentSize += limit - offset; - } - - if (spaceList.size() != 0) { - lookup = spaceList.duplicate(); - } - } - - public long getLostBlocksSize() { - return totalFragmentSize + defaultSpaceManager.getLostBlocksSize(); - } - - public int getFileBlockSize() { - return 1024 * 1024 * cache.getDataFileScale() / 16; - } - - public boolean isModified() { - return true; - } - - public void initialiseSpaces() { - - long filePosition = cache.getFileFreePos(); - long totalBlocks = (filePosition + fileBlockSize) / fileBlockSize; - - long lastFreePosition = cache.enlargeFileSpace(totalBlocks - * fileBlockSize); - - defaultSpaceManager.initialiseFileBlock(lookup, lastFreePosition, - cache.getFileFreePos()); - - if (lookup != null) { - totalFragmentSize -= lookup.getTotalValues() - * cache.getDataFileScale(); - lookup = null; - } - } - - public void reset() { - defaultSpaceManager.reset(); - } - - public boolean isMultiSpace() { - return false; - } - - public int getFileBlockItemCount() { - return 1024 * 64; - } - - public DirectoryBlockCachedObject[] getDirectoryList() { - return new DirectoryBlockCachedObject[0]; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DirectoryBlockCachedObject.java b/database/hsqldb/src/org/hsqldb/persist/DirectoryBlockCachedObject.java deleted file mode 100644 index e9e2f7a1..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DirectoryBlockCachedObject.java +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.LongLookup; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.1 - * @since 2.3.0 - */ -public class DirectoryBlockCachedObject extends CachedObjectBase { - - static final int fileSizeFactor = 12; - - // - int[] tableId; - int[] bitmapAddress; - char[] freeSpace; - char[] freeSpaceBlock; - - public DirectoryBlockCachedObject(int capacity) { - - tableId = new int[capacity]; - bitmapAddress = new int[capacity]; - freeSpace = new char[capacity]; - freeSpaceBlock = new char[capacity]; - hasChanged = true; - } - - public void read(RowInputInterface in) { - - this.position = in.getFilePosition(); - - int capacity = tableId.length; - - for (int i = 0; i < capacity; i++) { - tableId[i] = in.readInt(); - } - - for (int i = 0; i < capacity; i++) { - bitmapAddress[i] = in.readInt(); - } - - for (int i = 0; i < capacity; i++) { - freeSpace[i] = in.readChar(); - } - - for (int i = 0; i < capacity; i++) { - freeSpaceBlock[i] = in.readChar(); - } - - hasChanged = false; - } - - public int getDefaultCapacity() { - return tableId.length; - } - - public int getRealSize(RowOutputInterface out) { - return tableId.length * fileSizeFactor; - } - - public void write(RowOutputInterface out) { - write(out, null); - } - - public void write(RowOutputInterface out, LongLookup lookup) { - - int capacity = tableId.length; - - out.setStorageSize(storageSize); - - for (int i = 0; i < capacity; i++) { - out.writeInt(tableId[i]); - } - - for (int i = 0; i < capacity; i++) { - out.writeInt(bitmapAddress[i]); - } - - for (int i = 0; i < capacity; i++) { - out.writeChar(freeSpace[i]); - } - - for (int i = 0; i < capacity; i++) { - out.writeChar(freeSpaceBlock[i]); - } - - out.writeEnd(); - } - - public void setTableId(int pos, int value) { - tableId[pos] = value; - hasChanged = true; - } - - public void setBitmapAddress(int pos, int value) { - bitmapAddress[pos] = value; - hasChanged = true; - } - - public void setFreeSpace(int pos, char value) { - freeSpace[pos] = value; - hasChanged = true; - } - - public void setFreeBlock(int pos, char value) { - freeSpaceBlock[pos] = value; - hasChanged = true; - } - - public void setLastUsed(int pos, byte value) {} - - public int getTableId(int pos) { - return tableId[pos]; - } - - public int getBitmapAddress(int pos) { - return bitmapAddress[pos]; - } - - public char getFreeSpace(int pos) { - return freeSpace[pos]; - } - - public char getFreeBlock(int pos) { - return freeSpaceBlock[pos]; - } - - public int[] getTableIdArray() { - return tableId; - } - - public int[] getBitmapAddressArray() { - return bitmapAddress; - } - - public char[] getFreeSpaceArray() { - return freeSpace; - } - - public char[] getFreeBlockArray() { - return freeSpaceBlock; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/DoubleIntArrayCachedObject.java b/database/hsqldb/src/org/hsqldb/persist/DoubleIntArrayCachedObject.java deleted file mode 100644 index ba7c7b53..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/DoubleIntArrayCachedObject.java +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.DoubleIntIndex; -import org.hsqldb.lib.LongLookup; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.5.1 - */ -public class DoubleIntArrayCachedObject extends CachedObjectBase { - - public static final int fileSizeFactor = 8; - - // - DoubleIntIndex table; - - public DoubleIntArrayCachedObject(int capacity) { - this.table = new DoubleIntIndex(capacity, true); - hasChanged = true; - } - - public void read(RowInputInterface in) { - - this.position = in.getFilePosition(); - - int capacity = table.capacity(); - int[] array = table.getKeys(); - int lastValueIndex = -1; - - for (int i = 0; i < capacity; i++) { - array[i] = in.readInt(); - - if (array[i] != 0) { - lastValueIndex = i; - } - } - - array = table.getValues(); - - for (int i = 0; i < capacity; i++) { - array[i] = in.readInt(); - } - - table.setSize(lastValueIndex + 1); - - hasChanged = false; - } - - public int getDefaultCapacity() { - return table.capacity(); - } - - public int getRealSize(RowOutputInterface out) { - return table.capacity() * fileSizeFactor; - } - - public void write(RowOutputInterface out) { - write(out, null); - } - - public void write(RowOutputInterface out, LongLookup lookup) { - - int capacity = table.capacity(); - - out.setStorageSize(storageSize); - - int[] array = table.getKeys(); - - for (int i = 0; i < capacity; i++) { - out.writeInt(array[i]); - } - - array = table.getValues(); - - for (int i = 0; i < capacity; i++) { - out.writeInt(array[i]); - } - - out.writeEnd(); - } - - public void clear() { - - hasChanged |= table.size() > 0; - - table.clear(); - } - - public boolean removeKey(int key) { - - boolean result = table.removeKey(key); - - hasChanged |= result; - - return result; - } - - public boolean addKey(int key, int value) { - - boolean result = table.addOrReplaceUnique(key, value); - - hasChanged |= result; - - return result; - } - - /** - * assumes all values are zero or positive - */ - public int getValue(int key) { - return table.lookup(key, -1); - } - - public int getValue(int key, int def) { - return table.lookup(key, def); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/HsqlDatabaseProperties.java b/database/hsqldb/src/org/hsqldb/persist/HsqlDatabaseProperties.java deleted file mode 100644 index 2f2c6ba9..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/HsqlDatabaseProperties.java +++ /dev/null @@ -1,1023 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.Enumeration; - -import org.hsqldb.Database; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.HashMap; -import org.hsqldb.lib.HashSet; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.StringUtil; -import org.hsqldb.types.Collation; - -/** - * Manages a .properties file for a database. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since 1.7.0 - */ -public class HsqlDatabaseProperties extends HsqlProperties { - - public static final String hsqldb_method_class_names = - "hsqldb.method_class_names"; - public static final String textdb_allow_full_path = - "textdb.allow_full_path"; - public static final String hsqldb_reconfig_logging = - "hsqldb.reconfig_logging"; - public static String methodClassNames; - private static final HashSet accessibleJavaMethodNames = new HashSet(); - private static boolean allowFullPath; - - static { - try { - methodClassNames = System.getProperty(hsqldb_method_class_names); - - if (methodClassNames != null) { - - String[] names = StringUtil.split(methodClassNames, ";"); - - for (int i = 0; i < names.length; i++) { - accessibleJavaMethodNames.add(names[i]); - } - } - - String prop = System.getProperty(textdb_allow_full_path); - - if (prop != null) { - if (Boolean.valueOf(prop)) { - allowFullPath = true; - } - } - } catch (Exception e) {} - } - - /** - * If the system property "hsqldb.method_class_names" is not set, then - * static methods of available Java classes cannot be accessed as functions - * in HSQLDB. If the property is set, then only the list of semicolon - * separated method names becomes accessible. An empty property value means - * no class is accessible.

    - * - * A property value that ends with .* is treated as a wild card and allows - * access to all classe or method names formed by substitution of the - * asterisk.

    - * - * For example, org.mypackage.* means all classes in the given package.

    - * - * All methods of java.lang.Math are always accessible. - */ - public static boolean supportsJavaMethod(String name) { - - if (name.startsWith("java.lang.Math.")) { - return true; - } - - if (accessibleJavaMethodNames.contains(name)) { - return true; - } - - Iterator it = accessibleJavaMethodNames.iterator(); - - while (it.hasNext()) { - String className = (String) it.next(); - int limit = className.lastIndexOf(".*"); - - if (limit < 1) { - continue; - } - - if (name.startsWith(className.substring(0, limit + 1))) { - return true; - } - } - - return false; - } - - // accessibility - public static final int SYSTEM_PROP = 0; - public static final int FILES_PROP = 1; - public static final int DB_PROP = 2; - public static final int SQL_PROP = 3; - public static final int URL_PROP = 4; - - // db files modified - public static final int FILES_NOT_MODIFIED = 0; - public static final int FILES_MODIFIED = 1; - public static final int FILES_MODIFIED_NEW = 2; - public static final int FILES_MODIFIED_NEW_DATA = 3; - public static final int FILES_NEW = 4; - - // - private static final String MODIFIED_NO = "no"; - private static final String MODIFIED_YES = "yes"; - private static final String MODIFIED_YES_NEW = "yes-new-files"; - private static final String MODIFIED_YES_NEW_DATA = "yes-new-files-data"; - private static final String MODIFIED_NO_NEW = "no-new-files"; - - // allowed property metadata - private static final HashMap dbMeta = new HashMap(128); - private static final HashMap textMeta = new HashMap(16); - private static final HashSet excludedMeta = new HashSet(); - private static final HashMap urlUserConnMeta = new HashMap(); - - // versions - public static final String VERSION_STRING_1_8_0 = "1.8.0"; - public static final String PRODUCT_NAME = "HSQL Database Engine"; - - public static final String THIS_VERSION = "2.7.2"; - public static final String THIS_FULL_VERSION = "2.7.2"; - public static final int MAJOR = 2, - MINOR = 7, - REVISION = 2; - - /** - * system properties supported by HSQLDB - */ - public static final String system_lockfile_poll_retries_property = - "hsqldb.lockfile_poll_retries"; - public static final String system_max_char_or_varchar_display_size = - "hsqldb.max_char_or_varchar_display_size"; - - // - public static final String hsqldb_inc_backup = "hsqldb.inc_backup"; - - // - public static final String hsqldb_version = "version"; - public static final String hsqldb_readonly = "readonly"; - private static final String hsqldb_modified = "modified"; - - // - public static final String tx_timestamp = "tx_timestamp"; - - // - public static final String runtime_gc_interval = "runtime.gc_interval"; - - // - public static final String url_ifexists = "ifexists"; - public static final String url_create = "create"; - public static final String url_default_schema = "default_schema"; - public static final String url_check_props = "check_props"; - public static final String url_get_column_name = "get_column_name"; - public static final String url_close_result = "close_result"; - public static final String url_allow_empty_batch = "allow_empty_batch"; - public static final String url_memory_lobs = "memory_lobs"; - - // - public static final String url_shutdown = "shutdown"; - public static final String url_recover = "recover"; - public static final String url_tls_wrapper = "tls_wrapper"; - - // - public static final String url_crypt_key = "crypt_key"; - public static final String url_crypt_type = "crypt_type"; - public static final String url_crypt_provider = "crypt_provider"; - public static final String url_crypt_iv = "crypt_iv"; - public static final String url_crypt_lobs = "crypt_lobs"; - - // - public static final String hsqldb_tx = "hsqldb.tx"; - public static final String hsqldb_tx_level = "hsqldb.tx_level"; - public static final String hsqldb_tx_conflict_rollback = - "hsqldb.tx_conflict_rollback"; - public static final String hsqldb_tx_interrupt_rollback = - "hsqldb.tx_interrupt_rollback"; - public static final String hsqldb_applog = "hsqldb.applog"; - public static final String hsqldb_extlog = "hsqldb.extlog"; - public static final String hsqldb_sqllog = "hsqldb.sqllog"; - public static final String hsqldb_lob_file_scale = "hsqldb.lob_file_scale"; - public static final String hsqldb_lob_file_compressed = - "hsqldb.lob_compressed"; - public static final String hsqldb_cache_file_scale = - "hsqldb.cache_file_scale"; - public static final String hsqldb_cache_free_count = - "hsqldb.cache_free_count"; - public static final String hsqldb_cache_rows = "hsqldb.cache_rows"; - public static final String hsqldb_cache_size = "hsqldb.cache_size"; - public static final String hsqldb_default_table_type = - "hsqldb.default_table_type"; - public static final String hsqldb_defrag_limit = "hsqldb.defrag_limit"; - public static final String hsqldb_files_readonly = "files_readonly"; - public static final String hsqldb_lock_file = "hsqldb.lock_file"; - public static final String hsqldb_log_data = "hsqldb.log_data"; - public static final String hsqldb_log_size = "hsqldb.log_size"; - public static final String hsqldb_nio_data_file = "hsqldb.nio_data_file"; - public static final String hsqldb_nio_max_size = "hsqldb.nio_max_size"; - public static final String hsqldb_script_format = "hsqldb.script_format"; - public static final String hsqldb_temp_directory = "hsqldb.temp_directory"; - public static final String hsqldb_result_max_memory_rows = - "hsqldb.result_max_memory_rows"; - public static final String hsqldb_write_delay = "hsqldb.write_delay"; - public static final String hsqldb_write_delay_millis = - "hsqldb.write_delay_millis"; - public static final String hsqldb_full_log_replay = - "hsqldb.full_log_replay"; - public static final String hsqldb_large_data = "hsqldb.large_data"; - public static final String hsqldb_files_space = "hsqldb.files_space"; - public static final String hsqldb_digest = "hsqldb.digest"; - - // - public static final String jdbc_translate_tti_types = - "jdbc.translate_tti_types"; - - // - public static final String sql_restrict_exec = "sql.restrict_exec"; - public static final String sql_ref_integrity = "sql.ref_integrity"; - public static final String sql_compare_in_locale = "sql.compare_in_locale"; - public static final String sql_enforce_size = "sql.enforce_size"; - public static final String sql_enforce_strict_size = - "sql.enforce_strict_size"; // synonym for sql_enforce_size - public static final String sql_enforce_refs = "sql.enforce_refs"; - public static final String sql_enforce_names = "sql.enforce_names"; - public static final String sql_regular_names = "sql.regular_names"; - public static final String sql_enforce_types = "sql.enforce_types"; - public static final String sql_enforce_tdcd = "sql.enforce_tdc_delete"; - public static final String sql_enforce_tdcu = "sql.enforce_tdc_update"; - public static final String sql_char_literal = "sql.char_literal"; - public static final String sql_concat_nulls = "sql.concat_nulls"; - public static final String sql_nulls_first = "sql.nulls_first"; - public static final String sql_nulls_order = "sql.nulls_order"; - public static final String sql_unique_nulls = "sql.unique_nulls"; - public static final String sql_convert_trunc = "sql.convert_trunc"; - public static final String sql_trunc_trailing = "sql.truncate_trailing"; - public static final String sql_avg_scale = "sql.avg_scale"; - public static final String sql_max_recursive = "sql.max_recursive"; - public static final String sql_double_nan = "sql.double_nan"; - public static final String sql_syntax_db2 = "sql.syntax_db2"; - public static final String sql_syntax_mss = "sql.syntax_mss"; - public static final String sql_syntax_mys = "sql.syntax_mys"; - public static final String sql_syntax_ora = "sql.syntax_ora"; - public static final String sql_syntax_pgs = "sql.syntax_pgs"; - public static final String sql_longvar_is_lob = "sql.longvar_is_lob"; - public static final String sql_default_collation = "sql.default_collation"; - public static final String sql_pad_space = "sql.pad_space"; - public static final String sql_ignore_case = "sql.ignore_case"; - public static final String sql_live_object = "sql.live_object"; - public static final String sql_sys_index_names = "sql.sys_index_names"; - public static final String sql_lowercase_ident = "sql.lowercase_ident"; - - // - public static final String textdb_cache_scale = "textdb.cache_scale"; - public static final String textdb_cache_size_scale = - "textdb.cache_size_scale"; - public static final String textdb_cache_rows = "textdb.cache_rows"; - public static final String textdb_cache_size = "textdb.cache_size"; - public static final String textdb_all_quoted = "textdb.all_quoted"; - public static final String textdb_encoding = "textdb.encoding"; - public static final String textdb_ignore_first = "textdb.ignore_first"; - public static final String textdb_quoted = "textdb.quoted"; - public static final String textdb_fs = "textdb.fs"; - public static final String textdb_vs = "textdb.vs"; - public static final String textdb_lvs = "textdb.lvs"; - public static final String textdb_qc = "textdb.qc"; - public static final String textdb_null_def = "textdb.null_def"; - - // obsolete properties from version 2.5.1 - public static final String hsqldb_min_reuse = "hsqldb.min_reuse"; - public static final String hsqldb_cache_version = "hsqldb.cache_version"; - - static { - - // properties that are not displayed to user, including obsolete props - excludedMeta.add(hsqldb_min_reuse); - excludedMeta.add(hsqldb_cache_version); - excludedMeta.add(runtime_gc_interval); - excludedMeta.add(hsqldb_inc_backup); - excludedMeta.add(tx_timestamp); - excludedMeta.add(hsqldb_version); - excludedMeta.add(hsqldb_modified); - excludedMeta.add(hsqldb_full_log_replay); - excludedMeta.add(sql_compare_in_locale); - - // url properties which apply to a new connection to an open database - urlUserConnMeta.put(url_default_schema, - newMeta(url_default_schema, URL_PROP, false)); - urlUserConnMeta.put(url_check_props, - newMeta(url_check_props, URL_PROP, false)); - urlUserConnMeta.put(url_get_column_name, - newMeta(url_get_column_name, URL_PROP, true)); - urlUserConnMeta.put(url_close_result, - newMeta(url_close_result, URL_PROP, false)); - urlUserConnMeta.put(url_allow_empty_batch, - newMeta(url_allow_empty_batch, URL_PROP, false)); - urlUserConnMeta.put(url_memory_lobs, - newMeta(url_memory_lobs, URL_PROP, false)); - - // text table defaults - textMeta.put(textdb_allow_full_path, - newMeta(textdb_allow_full_path, SYSTEM_PROP, true)); - textMeta.put(textdb_quoted, newMeta(textdb_quoted, SQL_PROP, true)); - textMeta.put(textdb_all_quoted, - newMeta(textdb_all_quoted, SQL_PROP, false)); - textMeta.put(textdb_ignore_first, - newMeta(textdb_ignore_first, SQL_PROP, false)); - textMeta.put(textdb_null_def, - newMeta(textdb_null_def, SQL_PROP, false)); - textMeta.put(textdb_fs, newMeta(textdb_fs, SQL_PROP, ",")); - textMeta.put(textdb_vs, newMeta(textdb_vs, SQL_PROP, null)); - textMeta.put(textdb_lvs, newMeta(textdb_lvs, SQL_PROP, null)); - textMeta.put(textdb_qc, newMeta(textdb_qc, SQL_PROP, "\"")); - textMeta.put(textdb_encoding, - newMeta(textdb_encoding, SQL_PROP, "ISO-8859-1")); - textMeta.put(textdb_cache_scale, - newMeta(textdb_cache_scale, DB_PROP, 10, 8, 16)); - textMeta.put(textdb_cache_size_scale, - newMeta(textdb_cache_size_scale, DB_PROP, 10, 6, 20)); - textMeta.put(textdb_cache_rows, - newMeta(textdb_cache_rows, DB_PROP, 1000, 100, 1000000)); - textMeta.put(textdb_cache_size, - newMeta(textdb_cache_size, DB_PROP, 100, 10, 1000000)); - dbMeta.putAll(textMeta); - - // system props - dbMeta.put(hsqldb_method_class_names, - newMeta(hsqldb_method_class_names, SYSTEM_PROP, "")); - dbMeta.put(hsqldb_reconfig_logging, - newMeta(hsqldb_reconfig_logging, SYSTEM_PROP, false)); - - // string defaults for protected props - dbMeta.put(hsqldb_version, newMeta(hsqldb_version, FILES_PROP, null)); - dbMeta.put(hsqldb_modified, - newMeta(hsqldb_modified, FILES_PROP, null)); - dbMeta.put(hsqldb_cache_version, - newMeta(hsqldb_cache_version, FILES_PROP, null)); - - // boolean defaults for protected props - dbMeta.put(hsqldb_readonly, - newMeta(hsqldb_readonly, FILES_PROP, false)); - dbMeta.put(hsqldb_files_readonly, - newMeta(hsqldb_files_readonly, FILES_PROP, false)); - - // string defaults for user defined props - dbMeta.put(hsqldb_tx, newMeta(hsqldb_tx, SQL_PROP, "LOCKS")); - dbMeta.put(hsqldb_tx_level, - newMeta(hsqldb_tx_level, SQL_PROP, "READ_COMMITTED")); - dbMeta.put(hsqldb_temp_directory, - newMeta(hsqldb_temp_directory, DB_PROP, null)); - dbMeta.put(hsqldb_default_table_type, - newMeta(hsqldb_default_table_type, SQL_PROP, "MEMORY")); - dbMeta.put(hsqldb_digest, newMeta(hsqldb_digest, DB_PROP, "MD5")); - dbMeta.put(sql_live_object, newMeta(sql_live_object, DB_PROP, false)); - dbMeta.put(tx_timestamp, newMeta(tx_timestamp, DB_PROP, 0)); - - // boolean defaults for user defined props - dbMeta.put(hsqldb_tx_conflict_rollback, - newMeta(hsqldb_tx_conflict_rollback, SQL_PROP, true)); - dbMeta.put(hsqldb_tx_interrupt_rollback, - newMeta(hsqldb_tx_interrupt_rollback, SQL_PROP, false)); - dbMeta.put(jdbc_translate_tti_types, - newMeta(jdbc_translate_tti_types, SQL_PROP, true)); - dbMeta.put(hsqldb_inc_backup, - newMeta(hsqldb_inc_backup, DB_PROP, true)); - dbMeta.put(hsqldb_lock_file, newMeta(hsqldb_lock_file, DB_PROP, true)); - dbMeta.put(hsqldb_log_data, newMeta(hsqldb_log_data, DB_PROP, true)); - dbMeta.put(hsqldb_nio_data_file, - newMeta(hsqldb_nio_data_file, DB_PROP, true)); - dbMeta.put(hsqldb_full_log_replay, - newMeta(hsqldb_full_log_replay, DB_PROP, false)); - dbMeta.put(hsqldb_write_delay, - newMeta(hsqldb_write_delay, DB_PROP, true)); - dbMeta.put(hsqldb_large_data, - newMeta(hsqldb_large_data, DB_PROP, false)); - dbMeta.put(sql_ref_integrity, - newMeta(sql_ref_integrity, SQL_PROP, true)); - dbMeta.put(sql_restrict_exec, - newMeta(sql_restrict_exec, SQL_PROP, false)); - - // SQL reserved words not allowed as some identifiers - dbMeta.put(sql_enforce_names, - newMeta(sql_enforce_names, SQL_PROP, false)); - dbMeta.put(sql_regular_names, - newMeta(sql_regular_names, SQL_PROP, true)); - dbMeta.put(sql_enforce_refs, - newMeta(sql_enforce_refs, SQL_PROP, false)); - - // char padding to size and exception if data is too long - dbMeta.put(sql_enforce_size, - newMeta(sql_enforce_size, SQL_PROP, true)); - dbMeta.put(sql_enforce_types, - newMeta(sql_enforce_types, SQL_PROP, false)); - dbMeta.put(sql_enforce_tdcd, - newMeta(sql_enforce_tdcd, SQL_PROP, true)); - dbMeta.put(sql_enforce_tdcu, - newMeta(sql_enforce_tdcu, SQL_PROP, true)); - dbMeta.put(sql_char_literal, - newMeta(sql_char_literal, SQL_PROP, true)); - dbMeta.put(sql_concat_nulls, - newMeta(sql_concat_nulls, SQL_PROP, true)); - dbMeta.put(sql_nulls_first, newMeta(sql_nulls_first, SQL_PROP, true)); - dbMeta.put(sql_nulls_order, newMeta(sql_nulls_order, SQL_PROP, true)); - dbMeta.put(sql_unique_nulls, - newMeta(sql_unique_nulls, SQL_PROP, true)); - dbMeta.put(sql_convert_trunc, - newMeta(sql_convert_trunc, SQL_PROP, true)); - dbMeta.put(sql_trunc_trailing, - newMeta(sql_trunc_trailing, SQL_PROP, true)); - dbMeta.put(sql_avg_scale, newMeta(sql_avg_scale, SQL_PROP, 0, 0, 10)); - dbMeta.put(sql_max_recursive, - newMeta(sql_max_recursive, SQL_PROP, 256, 16, - 1024 * 1024 * 1024)); - dbMeta.put(sql_double_nan, newMeta(sql_double_nan, SQL_PROP, true)); - dbMeta.put(sql_syntax_db2, newMeta(sql_syntax_db2, SQL_PROP, false)); - dbMeta.put(sql_syntax_mss, newMeta(sql_syntax_mss, SQL_PROP, false)); - dbMeta.put(sql_syntax_mys, newMeta(sql_syntax_mys, SQL_PROP, false)); - dbMeta.put(sql_syntax_ora, newMeta(sql_syntax_ora, SQL_PROP, false)); - dbMeta.put(sql_syntax_pgs, newMeta(sql_syntax_pgs, SQL_PROP, false)); - dbMeta.put(sql_compare_in_locale, - newMeta(sql_compare_in_locale, SQL_PROP, false)); - dbMeta.put(sql_longvar_is_lob, - newMeta(sql_longvar_is_lob, SQL_PROP, false)); - dbMeta.put(sql_default_collation, - newMeta(sql_default_collation, SQL_PROP, - Collation.defaultCollationName)); - dbMeta.put(sql_pad_space, newMeta(sql_pad_space, SQL_PROP, true)); - dbMeta.put(sql_ignore_case, newMeta(sql_ignore_case, SQL_PROP, false)); - dbMeta.put(sql_sys_index_names, - newMeta(sql_sys_index_names, SQL_PROP, true)); - dbMeta.put(sql_lowercase_ident, - newMeta(sql_lowercase_ident, SQL_PROP, false)); - dbMeta.put(hsqldb_files_space, - newMeta(hsqldb_files_space, DB_PROP, false)); - - // integral defaults for user-defined props - sets - dbMeta.put(hsqldb_write_delay_millis, - newMeta(hsqldb_write_delay_millis, DB_PROP, 500, 0, 10000)); - dbMeta.put(hsqldb_applog, newMeta(hsqldb_applog, DB_PROP, 0, 0, 4)); - dbMeta.put(hsqldb_extlog, newMeta(hsqldb_extlog, DB_PROP, 0, 0, 4)); - dbMeta.put(hsqldb_sqllog, newMeta(hsqldb_sqllog, DB_PROP, 0, 0, 4)); - dbMeta.put(hsqldb_script_format, - newMeta(hsqldb_script_format, DB_PROP, 0, new int[] { - 0, 1, 3 - })); - dbMeta.put(hsqldb_lob_file_scale, - newMeta(hsqldb_lob_file_scale, DB_PROP, 32, new int[] { - 1, 2, 4, 8, 16, 32 - })); - dbMeta.put(hsqldb_lob_file_compressed, - newMeta(hsqldb_lob_file_compressed, DB_PROP, false)); - - // this property is normally 8 - or 1 for old databases from early versions - dbMeta.put(hsqldb_cache_file_scale, - newMeta(hsqldb_cache_file_scale, DB_PROP, 32, new int[] { - 1, 8, 16, 32, 64, 128, 256, 512, 1024 - })); - - // integral defaults for user defined props - ranges - dbMeta.put(hsqldb_log_size, - newMeta(hsqldb_log_size, DB_PROP, 50, 0, 4 * 1024)); - dbMeta.put(hsqldb_defrag_limit, - newMeta(hsqldb_defrag_limit, DB_PROP, 0, 0, 100)); - dbMeta.put(runtime_gc_interval, - newMeta(runtime_gc_interval, DB_PROP, 0, 0, 1000000)); - dbMeta.put(hsqldb_cache_size, - newMeta(hsqldb_cache_size, DB_PROP, 10000, 100, - 4 * 1024 * 1024)); - dbMeta.put(hsqldb_cache_rows, - newMeta(hsqldb_cache_rows, DB_PROP, 50000, 100, - 4 * 1024 * 1024)); - dbMeta.put(hsqldb_cache_free_count, - newMeta(hsqldb_cache_free_count, DB_PROP, 512, 0, 4096)); - dbMeta.put(hsqldb_result_max_memory_rows, - newMeta(hsqldb_result_max_memory_rows, DB_PROP, 0, 0, - 4 * 1024 * 1024)); - dbMeta.put(hsqldb_nio_max_size, - newMeta(hsqldb_nio_max_size, DB_PROP, 256, 64, 262144)); - dbMeta.put(hsqldb_min_reuse, - newMeta(hsqldb_min_reuse, DB_PROP, 0, 0, 1024 * 1024)); - } - - private Database database; - - public HsqlDatabaseProperties(Database db) { - - super(db.getPath(), db.logger.getFileAccess(), db.isFilesInJar()); - - database = db; - - setNewDatabaseProperties(); - } - - void setNewDatabaseProperties() { - - // version of a new database - setProperty(hsqldb_version, THIS_VERSION); - setProperty(hsqldb_modified, MODIFIED_NO_NEW); - } - - /** - * Creates file with defaults if it didn't exist. - * Returns false if file already existed. - */ - public boolean load() { - - boolean exists; - - if (!database.getType().isFileBased()) { - return true; - } - - try { - exists = super.load(); - } catch (Throwable t) { - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_LOAD_SAVE_PROPERTIES, new String[] { - t.toString(), fileName - }); - } - - if (!exists) { - return false; - } - - filterLoadedProperties(); - - String version = getStringProperty(hsqldb_version); - int check = version.substring(0, 5).compareTo(VERSION_STRING_1_8_0); - - // do not open early version databases - if (check < 0) { - throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION); - } - - // do not open databases of 1.8 versions if script format is not compatible - if (check == 0) { - if (getIntegerProperty(hsqldb_script_format) != 0) { - throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION); - } - } - - check = version.substring(0, 2).compareTo(THIS_VERSION); - - // do not open if the database belongs to a later (future) version (3.x) - if (check > 0) { - throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION); - } - - return true; - } - - public void save() { - - if (!database.getType().isFileBased() || database.isFilesReadOnly() - || database.isFilesInJar()) { - return; - } - - try { - HsqlProperties props = new HsqlProperties(database.getPath(), - database.logger.getFileAccess(), false); - - if (getIntegerProperty(hsqldb_script_format) == 3) { - props.setProperty(hsqldb_script_format, 3); - } - - props.setProperty(hsqldb_version, THIS_VERSION); - props.setProperty( - tx_timestamp, - Long.toString(database.logger.getFilesTimestamp())); - props.setProperty(hsqldb_modified, getProperty(hsqldb_modified)); - props.save(fileName + ".properties" + ".new"); - fa.renameElementOrCopy(fileName + ".properties" + ".new", - fileName + ".properties", database.logger); - } catch (Throwable t) { - database.logger.logSevereEvent("save failed", t); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_LOAD_SAVE_PROPERTIES, new String[] { - t.toString(), fileName - }); - } - } - - void filterLoadedProperties() { - - String val = stringProps.getProperty(sql_enforce_strict_size); - - if (val != null) { - stringProps.setProperty(sql_enforce_size, val); - } - - Enumeration en = stringProps.propertyNames(); - - while (en.hasMoreElements()) { - String key = (String) en.nextElement(); - boolean accept = dbMeta.containsKey(key); - - if (!accept) { - stringProps.remove(key); - } - } - } - - /** - * overload file database properties with any passed on URL line - * do not store password etc - */ - public void setURLProperties(HsqlProperties p) { - - boolean strict = false; - - if (p == null) { - return; - } - - String val = p.getProperty(sql_enforce_strict_size); - - if (val != null) { - p.setProperty(sql_enforce_size, val); - p.removeProperty(sql_enforce_strict_size); - } - - strict = p.isPropertyTrue(url_check_props, false); - - for (Enumeration e = p.propertyNames(); e.hasMoreElements(); ) { - String propertyName = (String) e.nextElement(); - String propertyValue = p.getProperty(propertyName); - boolean valid = false; - boolean validVal = false; - String error = null; - PropertyMeta meta = dbMeta.get(propertyName); - - if (meta != null) { - if (meta.propType == DB_PROP || meta.propType == SQL_PROP) { - valid = true; - error = validateProperty(propertyName, propertyValue, meta); - validVal = error == null; - } - } - - if (propertyName.startsWith("sql.") - || propertyName.startsWith("hsqldb.") - || propertyName.startsWith("textdb.")) { - if (strict && !valid) { - throw Error.error(ErrorCode.X_42555, propertyName); - } - - if (strict && !validVal) { - throw Error.error(ErrorCode.X_42556, error); - } - } - } - - for (Enumeration e = p.propertyNames(); e.hasMoreElements(); ) { - String propertyName = (String) e.nextElement(); - PropertyMeta meta = dbMeta.get(propertyName); - - if (meta != null) { - if (meta.propType == DB_PROP || meta.propType == SQL_PROP) { - setDatabaseProperty(propertyName, p.getProperty(propertyName)); - } - } - } - } - - public static Iterator getUserDefinedProperties() { - - return new Iterator() { - - Iterator it = dbMeta.values().iterator(); - PropertyMeta current; - boolean b = filterToNext(); - - public boolean hasNext() { - return current != null; - } - - public Object next() { - - PropertyMeta value = current; - - filterToNext(); - - return value; - } - - public int nextInt() { - return 0; - } - - public long nextLong() { - return 0L; - } - - public void remove() {} - - private boolean filterToNext() { - - while (it.hasNext()) { - current = it.next(); - - if (!excludedMeta.contains(current.propName)) { - return true; - } - } - - current = null; - - return false; - } - }; - } - - public boolean setDatabaseProperty(String key, String value) { - - PropertyMeta meta = dbMeta.get(key); - String error = validateProperty(key, value, meta); - - if (error != null) { - return false; - } - - stringProps.put(key, value); - - return true; - } - - public int getDefaultWriteDelay() { - return 500; - } - - public void setDBModified(int mode) { - - String value; - - switch (mode) { - - case FILES_NOT_MODIFIED : - value = MODIFIED_NO; - break; - - case FILES_MODIFIED : - value = MODIFIED_YES; - break; - - case FILES_MODIFIED_NEW : - value = MODIFIED_YES_NEW; - break; - - case FILES_MODIFIED_NEW_DATA : - value = MODIFIED_YES_NEW_DATA; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, - "HsqlDatabaseProperties"); - } - - stringProps.put(hsqldb_modified, value); - save(); - } - - public int getDBModified() { - - String value = getStringProperty(hsqldb_modified); - - if (MODIFIED_YES.equals(value)) { - return FILES_MODIFIED; - } else if (MODIFIED_YES_NEW.equals(value)) { - return FILES_MODIFIED_NEW; - } else if (MODIFIED_YES_NEW_DATA.equals(value)) { - return FILES_MODIFIED_NEW_DATA; - } else if (MODIFIED_NO_NEW.equals(value)) { - return FILES_NEW; - } - - return FILES_NOT_MODIFIED; - } - -//----------------------- - public String getProperty(String key) { - - PropertyMeta meta = dbMeta.get(key); - - if (meta == null) { - throw Error.error(ErrorCode.X_42555, key); - } - - return stringProps.getProperty(key); - } - - public boolean isPropertyTrue(String key) { - - Boolean value; - PropertyMeta meta = dbMeta.get(key); - - if (meta == null) { - throw Error.error(ErrorCode.X_42555, key); - } - - value = (Boolean) meta.propDefaultValue; - - String prop = null; - boolean isSystem = meta.propType == SYSTEM_PROP; - - if (isSystem) { - try { - prop = System.getProperty(key); - } catch (SecurityException e) {} - } else { - prop = stringProps.getProperty(key); - } - - if (prop != null) { - value = Boolean.valueOf(prop); - } - - return value.booleanValue(); - } - - public static String getStringPropertyDefault(String key) { - - PropertyMeta meta = dbMeta.get(key); - - if (meta == null) { - throw Error.error(ErrorCode.X_42555, key); - } - - return (String) meta.propDefaultValue; - } - - public String getStringProperty(String key) { - - String value; - PropertyMeta meta = dbMeta.get(key); - - if (meta == null) { - throw Error.error(ErrorCode.X_42555, key); - } - - value = (String) meta.propDefaultValue; - - String prop = stringProps.getProperty(key); - - if (prop != null) { - value = prop; - } - - return value; - } - - public int getIntegerProperty(String key) { - - int value; - PropertyMeta meta = dbMeta.get(key); - - if (meta == null) { - throw Error.error(ErrorCode.X_42555, key); - } - - value = ((Integer) meta.propDefaultValue).intValue(); - - String prop = stringProps.getProperty(key); - - if (prop != null) { - try { - value = Integer.parseInt(prop); - } catch (NumberFormatException e) {} - } - - return value; - } - - public static PropertyMeta getMeta(String key) { - return dbMeta.get(key); - } - - public static int getIntegerPropertyDefault(String key) { - - int value; - PropertyMeta meta = dbMeta.get(key); - - if (meta == null) { - throw Error.error(ErrorCode.X_42555, key); - } - - value = ((Integer) meta.propDefaultValue).intValue(); - - return value; - } - - public static int getPropertyWithinRange(String name, int number) { - - PropertyMeta meta = dbMeta.get(name); - - if (meta == null) { - return number; - } - - if (meta.propClass.equals("Integer")) { - if (meta.propIsRange) { - int low = meta.propRangeLow; - int high = meta.propRangeHigh; - - if (number < low) { - return low; - } else if (high < number) { - return high; - } - } - - if (meta.propValues != null) { - int[] values = meta.propValues; - - if (ArrayUtil.find(values, number) == -1) { - return values[0]; - } - } - } - - return number; - } - - public static boolean validateProperty(String name, int number) { - - PropertyMeta meta = dbMeta.get(name); - - if (meta == null) { - return false; - } - - if (meta.propClass.equals("Integer")) { - if (meta.propIsRange) { - int low = meta.propRangeLow; - int high = meta.propRangeHigh; - - if (number < low || high < number) { - return false; - } - } - - if (meta.propValues != null) { - int[] values = meta.propValues; - - if (ArrayUtil.find(values, number) == -1) { - return false; - } - } - - return true; - } - - return false; - } - - public static Iterator getUrlUserConnectionProperties() { - return urlUserConnMeta.values().iterator(); - } - - public String getClientPropertiesAsString() { - - if (isPropertyTrue(jdbc_translate_tti_types)) { - StringBuilder sb = new StringBuilder(jdbc_translate_tti_types); - - sb.append('=').append(true); - - return sb.toString(); - } - - return ""; - } - - public boolean isVersion18() { - - String version = - getProperty(HsqlDatabaseProperties.hsqldb_cache_version, - THIS_VERSION); - - return version.substring(0, 4).equals("1.7."); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/HsqlProperties.java b/database/hsqldb/src/org/hsqldb/persist/HsqlProperties.java deleted file mode 100644 index a3bde503..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/HsqlProperties.java +++ /dev/null @@ -1,572 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; -import java.util.Properties; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.FileAccess; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.map.ValuePool; - -/** - * Wrapper for java.util.Properties to limit values to Specific types and - * allow saving and loading.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.7.0 - */ -public class HsqlProperties { - - // - public static final int ANY_ERROR = 0; - public static final int NO_VALUE_FOR_KEY = 1; - protected String fileName; - protected String fileExtension = ""; - protected Properties stringProps; - protected int[] errorCodes = ValuePool.emptyIntArray; - protected String[] errorKeys = ValuePool.emptyStringArray; - protected FileAccess fa; - - public HsqlProperties() { - stringProps = new Properties(); - fileName = null; - } - - public HsqlProperties(String fileName) { - this(fileName, ".properties"); - } - - public HsqlProperties(String fileName, String fileExtension) { - - stringProps = new Properties(); - this.fileName = fileName; - this.fileExtension = fileExtension; - fa = FileUtil.getFileUtil(); - } - - public HsqlProperties(String fileName, FileAccess accessor, boolean b) { - - stringProps = new Properties(); - this.fileName = fileName; - this.fileExtension = ".properties"; - fa = accessor; - } - - public HsqlProperties(Properties props) { - stringProps = props; - } - - public void setFileName(String name) { - fileName = name; - } - - public String setProperty(String key, int value) { - return setProperty(key, Integer.toString(value)); - } - - public String setProperty(String key, boolean value) { - return setProperty(key, String.valueOf(value)); - } - - public String setProperty(String key, String value) { - return (String) stringProps.put(key, value); - } - - public String setPropertyIfNotExists(String key, String value) { - - value = getProperty(key, value); - - return setProperty(key, value); - } - - public Properties getProperties() { - return stringProps; - } - - public String getProperty(String key) { - return stringProps.getProperty(key); - } - - public String getProperty(String key, String defaultValue) { - return stringProps.getProperty(key, defaultValue); - } - - public int getIntegerProperty(String key, int defaultValue) { - return getIntegerProperty(stringProps, key, defaultValue); - } - - public static int getIntegerProperty(Properties props, String key, - int defaultValue) { - - String prop = props.getProperty(key); - - try { - if (prop != null) { - prop = prop.trim(); - defaultValue = Integer.parseInt(prop); - } - } catch (NumberFormatException e) {} - - return defaultValue; - } - - public boolean isPropertyTrue(String key) { - return isPropertyTrue(key, false); - } - - public boolean isPropertyTrue(String key, boolean defaultValue) { - - String value = stringProps.getProperty(key); - - if (value == null) { - return defaultValue; - } - - value = value.trim(); - - return value.toLowerCase().equals("true"); - } - - public void removeProperty(String key) { - stringProps.remove(key); - } - - public void addProperties(Properties props) { - - if (props == null) { - return; - } - - Enumeration keys = props.propertyNames(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String value = props.getProperty(key); - - this.stringProps.put(key, value); - } - } - - public void addProperties(HsqlProperties props) { - - if (props == null) { - return; - } - - addProperties(props.stringProps); - } - -// oj@openoffice.org - public boolean propertiesFileExists() { - - if (fileName == null) { - return false; - } - - String propFilename = fileName + fileExtension; - - return fa.isStreamElement(propFilename); - } - - public boolean load() throws Exception { - - if (fileName == null || fileName.isEmpty()) { - throw new FileNotFoundException( - Error.getMessage(ErrorCode.M_HsqlProperties_load)); - } - - if (!propertiesFileExists()) { - return false; - } - - InputStream fis = null; - String propsFilename = fileName + fileExtension; - -// oj@openoffice.org - try { - fis = fa.openInputStreamElement(propsFilename); - - stringProps.load(fis); - } finally { - if (fis != null) { - fis.close(); - } - } - - return true; - } - - /** - * Saves the properties. - */ - public void save() throws Exception { - - if (fileName == null || fileName.isEmpty()) { - throw new java.io.FileNotFoundException( - Error.getMessage(ErrorCode.M_HsqlProperties_load)); - } - - String filestring = fileName + fileExtension; - - save(filestring); - } - - /** - * Saves the properties - */ - public void save(String fileString) throws Exception { - -// oj@openoffice.org - fa.createParentDirs(fileString); - fa.removeElement(fileString); - - OutputStream fos = fa.openOutputStreamElement(fileString); - FileAccess.FileSync outDescriptor = fa.getFileSync(fos); - String name = HsqlDatabaseProperties.PRODUCT_NAME + " " - + HsqlDatabaseProperties.THIS_FULL_VERSION; - - stringProps.store(fos, name); - fos.flush(); - outDescriptor.sync(); - fos.close(); - - outDescriptor = null; - fos = null; - } - - /** - * Adds the error code and the key to the list of errors. This list - * is populated during construction or addition of elements and is used - * outside this class to act upon the errors. - */ - protected void addError(int code, String key) { - - errorCodes = (int[]) ArrayUtil.resizeArray(errorCodes, - errorCodes.length + 1); - errorKeys = (String[]) ArrayUtil.resizeArray(errorKeys, - errorKeys.length + 1); - errorCodes[errorCodes.length - 1] = code; - errorKeys[errorKeys.length - 1] = key; - } - - /** - * Creates and populates an HsqlProperties Object from the arguments - * array of a Main method. Properties are in the form of "-key value" - * pairs. Each key is prefixed with the type argument and a dot before - * being inserted into the properties Object.

    - * - * "--help" is treated as a key with no value and not inserted. - */ - public static HsqlProperties argArrayToProps(String[] arg, String type) { - - HsqlProperties props = new HsqlProperties(); - - for (int i = 0; i < arg.length; i++) { - String p = arg[i]; - - if (p.equals("--help") || p.equals("-help")) { - props.addError(NO_VALUE_FOR_KEY, p.substring(1)); - } else if (p.startsWith("--")) { - String value = i + 1 < arg.length ? arg[i + 1] - : ""; - - props.setProperty(type + "." + p.substring(2), value); - - i++; - } else if (p.charAt(0) == '-') { - String value = i + 1 < arg.length ? arg[i + 1] - : ""; - - props.setProperty(type + "." + p.substring(1), value); - - i++; - } - } - - return props; - } - - /** - * Creates and populates a new HsqlProperties Object using a string - * such as "key1=value1;key2=value2".

    - * - * The string that represents the = sign above is specified as pairsep - * and the one that represents the semicolon is specified as delimiter, - * allowing any string to be used for either.

    - * - * Leading / trailing spaces around the keys and values are discarded.

    - * - * The string is parsed by (1) subdividing into segments by delimiter - * (2) subdividing each segment in two by finding the first instance of - * the pairsep (3) trimming each pair of segments from step 2 and - * inserting into the properties object.

    - * - * Each key is prefixed with the type argument and a dot before being - * inserted.

    - * - * Any key without a value is added to the list of errors. - */ - public static HsqlProperties delimitedArgPairsToProps(String s, - String pairsep, String dlimiter, String type) { - - HsqlProperties props = new HsqlProperties(); - int currentpair = 0; - - while (true) { - int nextpair = s.indexOf(dlimiter, currentpair); - - if (nextpair == -1) { - nextpair = s.length(); - } - - // find value within the segment - int valindex = s.substring(0, nextpair).indexOf(pairsep, - currentpair); - - if (valindex == -1) { - props.addError(NO_VALUE_FOR_KEY, - s.substring(currentpair, nextpair).trim()); - } else { - String key = s.substring(currentpair, valindex).trim(); - String value = s.substring(valindex + pairsep.length(), - nextpair).trim(); - - if (type != null) { - key = type + "." + key; - } - - props.setProperty(key, value); - } - - if (nextpair == s.length()) { - break; - } - - currentpair = nextpair + dlimiter.length(); - } - - return props; - } - - public Enumeration propertyNames() { - return stringProps.propertyNames(); - } - - public boolean isEmpty() { - return stringProps.isEmpty(); - } - - public String[] getErrorKeys() { - return errorKeys; - } - - public void validate() {} - - public static PropertyMeta newMeta(String name, int type, - long defaultVal) { - - PropertyMeta meta = new PropertyMeta(); - - meta.propName = name; - meta.propType = type; - meta.propClass = "Long"; - meta.propDefaultValue = Long.valueOf(defaultVal); - - return meta; - } - - public static PropertyMeta newMeta(String name, int type, - String defaultValue) { - - PropertyMeta meta = new PropertyMeta(); - - meta.propName = name; - meta.propType = type; - meta.propClass = "String"; - meta.propDefaultValue = defaultValue; - - return meta; - } - - public static PropertyMeta newMeta(String name, int type, - boolean defaultValue) { - - PropertyMeta meta = new PropertyMeta(); - - meta.propName = name; - meta.propType = type; - meta.propClass = "Boolean"; - meta.propDefaultValue = defaultValue ? Boolean.TRUE - : Boolean.FALSE; - - return meta; - } - - public static PropertyMeta newMeta(String name, int type, - int defaultValue, int[] values) { - - PropertyMeta meta = new PropertyMeta(); - - meta.propName = name; - meta.propType = type; - meta.propClass = "Integer"; - meta.propDefaultValue = ValuePool.getInt(defaultValue); - meta.propValues = values; - - return meta; - } - - public static PropertyMeta newMeta(String name, int type, - int defaultValue, int rangeLow, - int rangeHigh) { - - PropertyMeta meta = new PropertyMeta(); - - meta.propName = name; - meta.propType = type; - meta.propClass = "Integer"; - meta.propDefaultValue = ValuePool.getInt(defaultValue); - meta.propIsRange = true; - meta.propRangeLow = rangeLow; - meta.propRangeHigh = rangeHigh; - - return meta; - } - - /** - * Performs any range checking for property and return an error message - */ - public static String validateProperty(String key, String value, - PropertyMeta meta) { - - if (meta.propClass.equals("Boolean")) { - value = value.toLowerCase(); - - if (value.equals("true") || value.equals("false")) { - return null; - } - - return "invalid boolean value for property: " + key; - } - - if (meta.propClass.equals("String")) { - return null; - } - - if (meta.propClass.equals("Long")) { - return null; - } - - if (meta.propClass.equals("Integer")) { - try { - int number = Integer.parseInt(value); - - if (meta.propIsRange) { - int low = meta.propRangeLow; - int high = meta.propRangeHigh; - - if (number < low || high < number) { - return "value outside range for property: " + key; - } - } - - if (meta.propValues != null) { - int[] values = meta.propValues; - - if (ArrayUtil.find(values, number) == -1) { - return "value not supported for property: " + key; - } - } - } catch (NumberFormatException e) { - return "invalid integer value for property: " + key; - } - - return null; - } - - return null; - } - - public String toString() { - - StringBuilder sb = new StringBuilder(); - - sb.append('{'); - - int len = stringProps.size(); - Enumeration en = stringProps.propertyNames(); - List list = Collections.list(en); - - Collections.sort(list); - - for (int i = 0; i < len; i++) { - String key = (String) list.get(i); - - sb.append(key); - sb.append('='); - sb.append('"'); - sb.append(stringProps.get(key)); - sb.append('"'); - - if (i + 1 < len) { - sb.append(','); - sb.append(' '); - } - } - - sb.append('}'); - - return sb.toString(); - } - - public static class PropertyMeta { - - public String propName; - public int propType; - public String propClass; - public boolean propIsRange; - public Object propDefaultValue; - public int propRangeLow; - public int propRangeHigh; - public int[] propValues; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/IntArrayCachedObject.java b/database/hsqldb/src/org/hsqldb/persist/IntArrayCachedObject.java deleted file mode 100644 index 462001d3..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/IntArrayCachedObject.java +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.LongLookup; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.1 - * @since 2.3.0 - */ -public class IntArrayCachedObject extends CachedObjectBase { - - public static final int fileSizeFactor = 4; - - // - int[] values; - - public IntArrayCachedObject(int capacity) { - this.values = new int[capacity]; - hasChanged = true; - } - - public void read(RowInputInterface in) { - - this.position = in.getFilePosition(); - - int capacity = values.length; - - for (int i = 0; i < capacity; i++) { - values[i] = in.readInt(); - } - - hasChanged = false; - } - - public int getDefaultCapacity() { - return values.length; - } - - public int getRealSize(RowOutputInterface out) { - return values.length * PersistentStore.INT_STORE_SIZE; - } - - public void write(RowOutputInterface out) { - write(out, null); - } - - public void write(RowOutputInterface out, LongLookup lookup) { - - int capacity = values.length; - - out.setStorageSize(storageSize); - - for (int i = 0; i < capacity; i++) { - out.writeInt(values[i]); - } - - out.writeEnd(); - } - - /** - * returns on first zero element - */ - public int getNonZeroSize() { - - int i = 0; - - for (; i < values.length; i++) { - if (values[i] == 0) { - break; - } - } - - return i; - } - - public void setValue(int position, int value) { - values[position] = value; - hasChanged = true; - } - - public void setIntArray(int[] array) { - values = array; - hasChanged = true; - } - - public int getValue(int position) { - return values[position]; - } - - public int[] getIntArray() { - return values; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/LobManager.java b/database/hsqldb/src/org/hsqldb/persist/LobManager.java deleted file mode 100644 index d35e49bc..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/LobManager.java +++ /dev/null @@ -1,2288 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.zip.DataFormatException; -import java.util.zip.Deflater; -import java.util.zip.Inflater; - -import org.hsqldb.Database; -import org.hsqldb.HsqlException; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Statement; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.HsqlByteArrayInputStream; -import org.hsqldb.lib.LineGroupReader; -import org.hsqldb.lib.OrderedHashMap; -import org.hsqldb.map.ValuePool; -import org.hsqldb.navigator.RowSetNavigator; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultLob; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.types.BinaryData; -import org.hsqldb.types.BlobData; -import org.hsqldb.types.BlobDataID; -import org.hsqldb.types.ClobData; -import org.hsqldb.types.ClobDataID; -import org.hsqldb.types.Collation; -import org.hsqldb.types.Types; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public class LobManager { - - static final String resourceFileName = - "/org/hsqldb/resources/lob-schema.sql"; - - // - Database database; - LobStore lobStore; - Session sysLobSession; - volatile boolean storeModified; - byte[] byteBuffer; - - // - Inflater inflater; - Deflater deflater; - byte[] dataBuffer; - - // - boolean cryptLobs; - boolean compressLobs; - int lobBlockSize; - int largeLobBlockSize = SessionInterface.lobStreamBlockSize; - int totalBlockLimitCount = Integer.MAX_VALUE; - - // - Statement getLob; - Statement getSpanningBlocks; - Statement deleteLobCall; - Statement deleteLobPartCall; - Statement divideLobPartCall; - Statement createLob; - Statement createLobPartCall; - Statement createSingleLobPartCall; - Statement updateLobLength; - Statement updateLobUsage; - Statement getNextLobId; - Statement deleteUnusedLobs; - Statement mergeUnusedSpace; - Statement getLobUseLimit; - Statement getLobCount; - Statement getSpanningParts; - Statement getLastPart; - Statement createPart; - - // - long usageChanged; - - // - ReadWriteLock lock = new ReentrantReadWriteLock(); - Lock writeLock = lock.writeLock(); - - // LOBS columns - interface LOBS { - - int BLOCK_ADDR = 0; - int BLOCK_COUNT = 1; - int BLOCK_OFFSET = 2; - int LOB_ID = 3; - } - - private interface LOB_IDS { - - int LOB_ID = 0; - int LOB_LENGTH = 1; - int LOB_USAGE_COUNT = 2; - int LOB_TYPE = 3; - } - - private interface GET_LOB_PART { - - int LOB_ID = 0; - int BLOCK_OFFSET = 1; - int BLOCK_LIMIT = 2; - } - - private interface DIVIDE_BLOCK { - int BLOCK_OFFSET = 0; - int LOB_ID = 1; - } - - private interface DELETE_BLOCKS { - - int LOB_ID = 0; - int BLOCK_OFFSET = 1; - int BLOCK_LIMIT = 2; - int TX_ID = 3; - } - - private interface ALLOC_BLOCKS { - - int BLOCK_COUNT = 0; - int BLOCK_OFFSET = 1; - int LOB_ID = 2; - } - - private interface UPDATE_USAGE { - int BLOCK_COUNT = 0; - int LOB_ID = 1; - } - - private interface UPDATE_LENGTH { - int LOB_LENGTH = 0; - int LOB_ID = 1; - } - - private interface ALLOC_PART { - - int BLOCK_COUNT = 0; - int BLOCK_OFFSET = 1; - int PART_OFFSET = 2; - int PART_LENGTH = 3; - int PART_BYTES = 4; - int LOB_ID = 5; - } - - private static final String existsBlocksSQL = - "SELECT * FROM SYSTEM_LOBS.BLOCKS LIMIT 1"; - private static final String initialiseBlocksSQL = - "INSERT INTO SYSTEM_LOBS.BLOCKS VALUES(?,?,?)"; - private static final String getLobSQL = - "SELECT * FROM SYSTEM_LOBS.LOB_IDS WHERE LOB_IDS.LOB_ID = ?"; - private static final String getLobPartSQL = - "SELECT * FROM SYSTEM_LOBS.LOBS WHERE LOBS.LOB_ID = ? AND BLOCK_OFFSET + BLOCK_COUNT > ? AND BLOCK_OFFSET < ? ORDER BY BLOCK_OFFSET"; - private static final String deleteLobPartCallSQL = - "CALL SYSTEM_LOBS.DELETE_BLOCKS(?,?,?,?)"; - private static final String createLobSQL = - "INSERT INTO SYSTEM_LOBS.LOB_IDS VALUES(?, ?, ?, ?)"; - private static final String updateLobLengthSQL = - "UPDATE SYSTEM_LOBS.LOB_IDS SET LOB_LENGTH = ? WHERE LOB_IDS.LOB_ID = ?"; - private static final String createLobPartCallSQL = - "CALL SYSTEM_LOBS.ALLOC_BLOCKS(?, ?, ?)"; - private static final String createSingleLobPartCallSQL = - "CALL SYSTEM_LOBS.ALLOC_SINGLE_BLOCK(?, ?, ?)"; - private static final String divideLobPartCallSQL = - "CALL SYSTEM_LOBS.DIVIDE_BLOCK(?, ?)"; - private static final String updateLobUsageSQL = - "UPDATE SYSTEM_LOBS.LOB_IDS SET LOB_USAGE_COUNT = LOB_USAGE_COUNT + ? WHERE LOB_IDS.LOB_ID = ?"; - private static final String getNextLobIdSQL = - "VALUES NEXT VALUE FOR SYSTEM_LOBS.LOB_ID"; - private static final String deleteLobCallSQL = - "CALL SYSTEM_LOBS.DELETE_LOB(?, ?)"; - private static final String deleteUnusedCallSQL = - "CALL SYSTEM_LOBS.DELETE_UNUSED_LOBS(?,?)"; - private static final String mergeUnusedSpaceSQL = - "CALL SYSTEM_LOBS.MERGE_EMPTY_BLOCKS()"; - private static final String getLobUseLimitSQL = - "SELECT * FROM SYSTEM_LOBS.LOBS WHERE BLOCK_ADDR = (SELECT MAX(BLOCK_ADDR) FROM SYSTEM_LOBS.LOBS)"; - private static final String getLobCountSQL = - "SELECT COUNT(*) FROM SYSTEM_LOBS.LOB_IDS"; - - // - //BLOCK_COUNT INT NOT NULL, BLOCK_OFFSET INT, PART_OFFSET BIGINT NOT NULL, PART_LENGTH BIGINT NOT NULL, PART_BYTES BIGINT NOT NULL, LOB_ID BIGINT, - private static final String getPartsSQL = - "SELECT BLOCK_COUNT, BLOCK_OFFSET, PART_OFFSET, PART_LENGTH, PART_BYTES, LOB_ID " - + "FROM SYSTEM_LOBS.PARTS " - + "WHERE LOB_ID = ? AND PART_OFFSET + PART_LENGTH > ? AND PART_OFFSET < ? ORDER BY BLOCK_OFFSET"; - private static final String getLastPartSQL = - "SELECT BLOCK_COUNT, BLOCK_OFFSET, PART_OFFSET, PART_LENGTH, PART_BYTES, LOB_ID " - + "FROM SYSTEM_LOBS.PARTS " - + "WHERE LOB_ID = ? ORDER BY LOB_ID DESC, BLOCK_OFFSET DESC LIMIT 1"; - private static final String createPartSQL = - "INSERT INTO SYSTEM_LOBS.PARTS VALUES ?,?,?,?,?,?"; - - public LobManager(Database database) { - this.database = database; - } - - public void lock() { - writeLock.lock(); - } - - public void unlock() { - writeLock.unlock(); - } - - public void createSchema() { - - sysLobSession = database.sessionManager.getSysLobSession(); - - OrderedHashMap map = LineGroupReader.getStatementMap(resourceFileName); - String sql = (String) map.get("/*lob_schema_definition*/"); - Statement statement = sysLobSession.compileStatement(sql); - Result result = statement.execute(sysLobSession); - - if (result.isError()) { - throw result.getException(); - } - - // throws if schema not created - database.schemaManager.getSchemaHsqlName("SYSTEM_LOBS"); - compileStatements(); - } - - public void compileStatements() { - - writeLock.lock(); - - try { - getLob = sysLobSession.compileStatement(getLobSQL); - getSpanningBlocks = sysLobSession.compileStatement(getLobPartSQL); - createLob = sysLobSession.compileStatement(createLobSQL); - createLobPartCall = - sysLobSession.compileStatement(createLobPartCallSQL); - createSingleLobPartCall = - sysLobSession.compileStatement(createSingleLobPartCallSQL); - divideLobPartCall = - sysLobSession.compileStatement(divideLobPartCallSQL); - deleteLobCall = sysLobSession.compileStatement(deleteLobCallSQL); - deleteLobPartCall = - sysLobSession.compileStatement(deleteLobPartCallSQL); - updateLobLength = - sysLobSession.compileStatement(updateLobLengthSQL); - updateLobUsage = sysLobSession.compileStatement(updateLobUsageSQL); - getNextLobId = sysLobSession.compileStatement(getNextLobIdSQL); - deleteUnusedLobs = - sysLobSession.compileStatement(deleteUnusedCallSQL); - mergeUnusedSpace = - sysLobSession.compileStatement(mergeUnusedSpaceSQL); - getLobUseLimit = sysLobSession.compileStatement(getLobUseLimitSQL); - getLobCount = sysLobSession.compileStatement(getLobCountSQL); - - // - getSpanningParts = sysLobSession.compileStatement(getPartsSQL); - getLastPart = sysLobSession.compileStatement(getLastPartSQL); - createPart = sysLobSession.compileStatement(createPartSQL); - } finally { - writeLock.unlock(); - } - } - - private void initialiseLobSpace() { - - Statement statement = sysLobSession.compileStatement(existsBlocksSQL); - Result result = statement.execute(sysLobSession); - - if (result.isError()) { - throw result.getException(); - } - - RowSetNavigator navigator = result.getNavigator(); - int size = navigator.getSize(); - - if (size > 0) { - return; - } - - statement = sysLobSession.compileStatement(initialiseBlocksSQL); - - Object[] params = new Object[3]; - - params[0] = ValuePool.INTEGER_0; - params[1] = ValuePool.getInt(totalBlockLimitCount); - params[2] = ValuePool.getLong(0); - - sysLobSession.executeCompiledStatement(statement, params, 0); - } - - public void open() { - - lobBlockSize = database.logger.getLobBlockSize(); - cryptLobs = database.logger.cryptLobs; - compressLobs = database.logger.propCompressLobs; - - if (compressLobs || cryptLobs) { - int largeBufferBlockSize = largeLobBlockSize + 32 * 1024; - - inflater = new Inflater(); - deflater = new Deflater(Deflater.BEST_SPEED); - dataBuffer = new byte[largeBufferBlockSize]; - } - - switch (database.getType()) { - - case DB_FILE : - lobStore = new LobStoreRAFile(database, lobBlockSize); - - if (!database.isFilesReadOnly()) { - byteBuffer = new byte[lobBlockSize]; - - initialiseLobSpace(); - } - break; - - case DB_RES : - lobStore = new LobStoreInJar(database, lobBlockSize); - break; - - case DB_MEM : - lobStore = new LobStoreMem(lobBlockSize); - byteBuffer = new byte[lobBlockSize]; - - initialiseLobSpace(); - break; - } - } - - public void close() { - - if (lobStore != null) { - lobStore.close(); - } - - lobStore = null; - } - - public LobStore getLobStore() { - - if (lobStore == null) { - open(); - } - - return lobStore; - } - - // - private Long getNewLobID() { - - Result result = getNextLobId.execute(sysLobSession); - - if (result.isError()) { - return Long.valueOf(0); - } - - RowSetNavigator navigator = result.getNavigator(); - boolean next = navigator.next(); - - if (!next) { - navigator.release(); - - return Long.valueOf(0); - } - - Object[] data = navigator.getCurrent(); - - navigator.release(); - - return (Long) data[0]; - } - - private Object[] getLobHeader(long lobID) { - - ResultMetaData meta = getLob.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[0] = ValuePool.getLong(lobID); - - sysLobSession.sessionContext.pushDynamicArguments(params); - - Result result = getLob.execute(sysLobSession); - - sysLobSession.sessionContext.pop(); - - if (result.isError()) { - throw result.getException(); - } - - RowSetNavigator navigator = result.getNavigator(); - boolean next = navigator.next(); - Object[] data = null; - - if (next) { - data = navigator.getCurrent(); - } - - navigator.release(); - - return data; - } - - public BlobData getBlob(long lobID) { - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - return null; - } - - return new BlobDataID(lobID); - } finally { - writeLock.unlock(); - } - } - - public ClobData getClob(long lobID) { - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - return null; - } - - return new ClobDataID(lobID); - } finally { - writeLock.unlock(); - } - } - - public long createBlob(Session session, long length) { - - writeLock.lock(); - - try { - Long lobID = getNewLobID(); - ResultMetaData meta = createLob.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[LOB_IDS.LOB_ID] = lobID; - params[LOB_IDS.LOB_LENGTH] = ValuePool.getLong(length); - params[LOB_IDS.LOB_USAGE_COUNT] = ValuePool.INTEGER_0; - params[LOB_IDS.LOB_TYPE] = ValuePool.getInt(Types.SQL_BLOB); - - Result result = sysLobSession.executeCompiledStatement(createLob, - params, 0); - - return lobID.longValue(); - } finally { - writeLock.unlock(); - } - } - - public long createClob(Session session, long length) { - - writeLock.lock(); - - try { - Long lobID = getNewLobID(); - ResultMetaData meta = createLob.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[LOB_IDS.LOB_ID] = lobID; - params[LOB_IDS.LOB_LENGTH] = ValuePool.getLong(length); - params[LOB_IDS.LOB_USAGE_COUNT] = ValuePool.INTEGER_0; - params[LOB_IDS.LOB_TYPE] = ValuePool.getInt(Types.SQL_CLOB); - - Result result = sysLobSession.executeCompiledStatement(createLob, - params, 0); - - return lobID.longValue(); - } finally { - writeLock.unlock(); - } - } - - public Result deleteLob(long lobID) { - - writeLock.lock(); - - try { - ResultMetaData meta = deleteLobCall.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[0] = ValuePool.getLong(lobID); - params[1] = ValuePool.getLong(0); - - Result result = - sysLobSession.executeCompiledStatement(deleteLobCall, params, - 0); - - usageChanged += lobBlockSize; - - return result; - } finally { - writeLock.unlock(); - } - } - - public long getUsageChanged() { - return usageChanged; - } - - public void setUsageChanged() { - usageChanged += lobBlockSize; - } - - public Result deleteUnusedLobs() { - - writeLock.lock(); - - try { - if (lobStore == null || byteBuffer == null || usageChanged == 0) { - return Result.updateZeroResult; - } - - long limitLobID = Long.MAX_VALUE; - ResultMetaData meta = deleteUnusedLobs.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - int deleteCount = 0; - - params[0] = Long.valueOf(limitLobID); - - Result result = - sysLobSession.executeCompiledStatement(deleteUnusedLobs, - params, 0); - - if (result.isError()) { - return result; - } - - if (params[1] != null) { - deleteCount = ((Number) params[1]).intValue(); - - if (deleteCount < 1) { - return Result.updateZeroResult; - } - } - - result = sysLobSession.executeCompiledStatement(mergeUnusedSpace, - ValuePool.emptyObjectArray, 0); - - if (result.isError()) { - return result; - } - - result = sysLobSession.executeCompiledStatement(getLobUseLimit, - ValuePool.emptyObjectArray, 0); - - if (result.isError()) { - return result; - } - - // result is empty when there is no lob, or it has one row - usageChanged = 0; - - long sizeLimit = 0; - RowSetNavigator navigator = result.getNavigator(); - boolean next = navigator.next(); - - if (next) { - Object[] data = navigator.getCurrent(); - - if (data[LOBS.BLOCK_ADDR] == null - || data[LOBS.BLOCK_COUNT] == null) { - return Result.updateOneResult; - } - - sizeLimit = ((Integer) data[LOBS.BLOCK_ADDR]).intValue() - + ((Integer) data[LOBS.BLOCK_COUNT]).intValue(); - sizeLimit *= lobBlockSize; - } - - long currentLength = lobStore.getLength(); - - if (currentLength > sizeLimit) { - database.logger.logInfoEvent("lob file truncated to usage"); - lobStore.setLength(sizeLimit); - - try { - lobStore.synch(); - } catch (Throwable t) {} - } else if (currentLength < sizeLimit) { - database.logger.logInfoEvent( - "lob file reported smaller than usage"); - } - - return Result.newUpdateCountResult(deleteCount); - } finally { - writeLock.unlock(); - } - } - - public Result getLength(long lobID) { - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - throw Error.error(ErrorCode.X_0F502); - } - - long length = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - int type = ((Integer) data[LOB_IDS.LOB_TYPE]).intValue(); - - return ResultLob.newLobSetResponse(lobID, length); - } catch (HsqlException e) { - return Result.newErrorResult(e); - } finally { - writeLock.unlock(); - } - } - - public int compare(long lobId, byte[] b) { - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobId); - long aLength = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - int[][] aAddresses = getBlockAddresses(lobId, 0, - Integer.MAX_VALUE); - int aIndex = 0; - int bOffset = 0; - int aOffset = 0; - - if (aLength == 0) { - return b.length == 0 ? 0 - : -1; - } - - if (b.length == 0) { - return 1; - } - - while (true) { - int aBlockOffset = aAddresses[aIndex][LOBS.BLOCK_ADDR] - + aOffset; - byte[] aBytes = getLobStore().getBlockBytes(aBlockOffset, 1); - - for (int i = 0; i < aBytes.length; i++) { - if (bOffset + i >= b.length) { - if (aLength == b.length) { - return 0; - } - - return 1; - } - - if (aBytes[i] == b[bOffset + i]) { - continue; - } - - return (((int) aBytes[i]) & 0xff) - > (((int) b[bOffset + i]) & 0xff) ? 1 - : -1; - } - - aOffset++; - - bOffset += lobBlockSize; - - if (aOffset == aAddresses[aIndex][LOBS.BLOCK_COUNT]) { - aOffset = 0; - - aIndex++; - } - - if (aIndex == aAddresses.length) { - break; - } - - if (bOffset >= b.length) { - break; - } - } - - if (aLength == b.length) { - return 0; - } - - return aLength > b.length ? 1 - : -1; - } finally { - writeLock.unlock(); - } - } - - public int compare(BlobData a, BlobData b) { - - if (a.getId() == b.getId()) { - return 0; - } - - writeLock.lock(); - - try { - if (compressLobs || cryptLobs) { - return compareBytesCompressed(a.getId(), b.getId()); - } else { - return compareBytesNormal(a.getId(), b.getId()); - } - } finally { - writeLock.unlock(); - } - } - - /* @todo - implement as compareText() */ - public int compare(Collation collation, long lobId, String b) { - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobId); - long aLength = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - int[][] aAddresses = getBlockAddresses(lobId, 0, - Integer.MAX_VALUE); - int aIndex = 0; - int bOffset = 0; - int aOffset = 0; - - if (aLength == 0) { - return b.isEmpty() ? 0 - : -1; - } - - if (b.isEmpty()) { - return 1; - } - - while (true) { - int aBlockOffset = aAddresses[aIndex][LOBS.BLOCK_ADDR] - + aOffset; - byte[] aBytes = getLobStore().getBlockBytes(aBlockOffset, 1); - long aLimit = - aLength - - ((long) aAddresses[aIndex][LOBS.BLOCK_OFFSET] + aOffset) - * lobBlockSize / 2; - - if (aLimit > lobBlockSize / 2) { - aLimit = lobBlockSize / 2; - } - - String aString = new String(ArrayUtil.byteArrayToChars(aBytes), - 0, (int) aLimit); - int bLimit = b.length() - bOffset; - - if (bLimit > lobBlockSize / 2) { - bLimit = lobBlockSize / 2; - } - - String bString = b.substring(bOffset, bOffset + bLimit); - int diff = collation.compare(aString, bString); - - if (diff != 0) { - return diff; - } - - aOffset++; - - bOffset += lobBlockSize / 2; - - if (aOffset == aAddresses[aIndex][LOBS.BLOCK_COUNT]) { - aOffset = 0; - - aIndex++; - } - - if (aIndex == aAddresses.length) { - break; - } - - if (bOffset >= b.length()) { - break; - } - } - - if (aLength == b.length()) { - return 0; - } - - return aLength > b.length() ? 1 - : -1; - } finally { - writeLock.unlock(); - } - } - - public int compare(Collation collation, ClobData a, ClobData b) { - - if (a.getId() == b.getId()) { - return 0; - } - - writeLock.lock(); - - try { - if (compressLobs || cryptLobs) { - return compareTextCompressed(collation, a.getId(), b.getId()); - } else { - return compareTextNormal(collation, a.getId(), b.getId()); - } - } finally { - writeLock.unlock(); - } - } - - private int compareBytesNormal(long aID, long bID) { - - Object[] data = getLobHeader(aID); - long aLength = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - - data = getLobHeader(bID); - - long bLength = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - int[][] aAddresses = getBlockAddresses(aID, 0, Integer.MAX_VALUE); - int[][] bAddresses = getBlockAddresses(bID, 0, Integer.MAX_VALUE); - int aIndex = 0; - int bIndex = 0; - int aOffset = 0; - int bOffset = 0; - - if (aLength == 0) { - return bLength == 0 ? 0 - : -1; - } - - if (bLength == 0) { - return 1; - } - - while (true) { - int aBlockOffset = aAddresses[aIndex][LOBS.BLOCK_ADDR] + aOffset; - int bBlockOffset = bAddresses[bIndex][LOBS.BLOCK_ADDR] + bOffset; - byte[] aBytes = getLobStore().getBlockBytes(aBlockOffset, 1); - byte[] bBytes = getLobStore().getBlockBytes(bBlockOffset, 1); - int result = ArrayUtil.compare(aBytes, bBytes); - - if (result != 0) { - return result; - } - - aOffset++; - bOffset++; - - if (aOffset == aAddresses[aIndex][LOBS.BLOCK_COUNT]) { - aOffset = 0; - - aIndex++; - } - - if (bOffset == bAddresses[bIndex][LOBS.BLOCK_COUNT]) { - bOffset = 0; - - bIndex++; - } - - if (aIndex == aAddresses.length) { - break; - } - - if (bIndex == bAddresses.length) { - break; - } - } - - if (aLength == bLength) { - return 0; - } - - return aLength > bLength ? 1 - : -1; - } - - /* @todo - word-separator and end block zero issues */ - private int compareTextNormal(Collation collation, long aID, long bID) { - - Object[] data = getLobHeader(aID); - long aLength = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - - data = getLobHeader(bID); - - long bLength = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - int[][] aAddresses = getBlockAddresses(aID, 0, Integer.MAX_VALUE); - int[][] bAddresses = getBlockAddresses(bID, 0, Integer.MAX_VALUE); - int aIndex = 0; - int bIndex = 0; - int aOffset = 0; - int bOffset = 0; - - if (aLength == 0) { - return bLength == 0 ? 0 - : -1; - } - - if (bLength == 0) { - return 1; - } - - while (true) { - int aBlockOffset = aAddresses[aIndex][LOBS.BLOCK_ADDR] + aOffset; - int bBlockOffset = bAddresses[bIndex][LOBS.BLOCK_ADDR] + bOffset; - byte[] aBytes = getLobStore().getBlockBytes(aBlockOffset, 1); - byte[] bBytes = getLobStore().getBlockBytes(bBlockOffset, 1); - long aLimit = - aLength - - ((long) aAddresses[aIndex][LOBS.BLOCK_OFFSET] + aOffset) - * lobBlockSize / 2; - - if (aLimit > lobBlockSize / 2) { - aLimit = lobBlockSize / 2; - } - - long bLimit = - bLength - - ((long) bAddresses[bIndex][LOBS.BLOCK_OFFSET] + bOffset) - * lobBlockSize / 2; - - if (bLimit > lobBlockSize / 2) { - bLimit = lobBlockSize / 2; - } - - String aString = new String(ArrayUtil.byteArrayToChars(aBytes), 0, - (int) aLimit); - String bString = new String(ArrayUtil.byteArrayToChars(bBytes), 0, - (int) bLimit); - int diff = collation.compare(aString, bString); - - if (diff != 0) { - return diff; - } - - aOffset++; - bOffset++; - - if (aOffset == aAddresses[aIndex][LOBS.BLOCK_COUNT]) { - aOffset = 0; - - aIndex++; - } - - if (bOffset == bAddresses[bIndex][LOBS.BLOCK_COUNT]) { - bOffset = 0; - - bIndex++; - } - - if (aIndex == aAddresses.length) { - break; - } - - if (bIndex == bAddresses.length) { - break; - } - } - - if (aLength == bLength) { - return 0; - } - - return aLength > bLength ? 1 - : -1; - } - - /** - * Used for SUBSTRING - */ - public Result getLob(long lobID, long offset, long length) { - - if (offset == 0) { - return createDuplicateLob(lobID, length); - } - - throw Error.runtimeError(ErrorCode.U_S0500, "LobManager"); - } - - public Result createDuplicateLob(long lobID) { - - Result result = getLength(lobID); - - if (result.isError()) { - return result; - } - - return createDuplicateLob(lobID, - ((ResultLob) result).getBlockLength()); - } - - public Result createDuplicateLob(long lobID, long newLength) { - - if (byteBuffer == null) { - throw Error.error(ErrorCode.DATA_IS_READONLY); - } - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - return Result.newErrorResult(Error.error(ErrorCode.X_0F502)); - } - - Long newLobID = getNewLobID(); - Object[] params = new Object[data.length]; - - params[LOB_IDS.LOB_ID] = newLobID; - params[LOB_IDS.LOB_LENGTH] = Long.valueOf(newLength); - params[LOB_IDS.LOB_USAGE_COUNT] = ValuePool.INTEGER_0; - params[LOB_IDS.LOB_TYPE] = data[LOB_IDS.LOB_TYPE]; - - Result result = sysLobSession.executeCompiledStatement(createLob, - params, 0); - - if (result.isError()) { - return result; - } - - if (newLength == 0) { - return ResultLob.newLobSetResponse(newLobID.longValue(), - newLength); - } - - long byteLength = newLength; - int lobType = ((Integer) data[LOB_IDS.LOB_TYPE]).intValue(); - - if (lobType == Types.SQL_CLOB) { - byteLength *= 2; - } - - int newBlockCount = (int) (byteLength / lobBlockSize); - - if (byteLength % lobBlockSize != 0) { - newBlockCount++; - } - - result = createBlockAddresses(newLobID.longValue(), 0, - newBlockCount); - - if (result.isError()) { - return result; - } - - // copy the contents - int[][] sourceBlocks = getBlockAddresses(lobID, 0, - Integer.MAX_VALUE); - int[][] targetBlocks = getBlockAddresses(newLobID.longValue(), 0, - Integer.MAX_VALUE); - - try { - copyBlockSet(sourceBlocks, targetBlocks); - } catch (HsqlException e) { - return Result.newErrorResult(e); - } catch (Throwable e) { - return Result.newErrorResult(e); - } - - // clear the end block unused space - int endOffset = (int) (byteLength % lobBlockSize); - - if (endOffset != 0) { - int[] block = targetBlocks[targetBlocks.length - 1]; - int blockOffset = block[LOBS.BLOCK_ADDR] - + block[LOBS.BLOCK_COUNT] - 1; - byte[] bytes = getLobStore().getBlockBytes(blockOffset, 1); - - ArrayUtil.fillArray(bytes, endOffset, (byte) 0); - getLobStore().setBlockBytes(bytes, blockOffset, 1); - } - - lobStore.synch(); - - return ResultLob.newLobSetResponse(newLobID.longValue(), - newLength); - } finally { - writeLock.unlock(); - } - } - - /* @todo - currently unused and returns whole length */ - public Result getTruncateLength(long lobID) { - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - throw Error.error(ErrorCode.X_0F502); - } - - long length = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - int type = ((Integer) data[LOB_IDS.LOB_TYPE]).intValue(); - - return ResultLob.newLobSetResponse(lobID, length); - } finally { - writeLock.unlock(); - } - } - - private void copyBlockSet(int[][] source, int[][] target) { - - int sourceIndex = 0; - int targetIndex = 0; - int sourceOffset = 0; - int targetOffset = 0; - - while (true) { - byte[] bytes = getLobStore().getBlockBytes( - source[sourceIndex][LOBS.BLOCK_ADDR] + sourceOffset, 1); - - getLobStore().setBlockBytes(bytes, - target[targetIndex][LOBS.BLOCK_ADDR] - + targetOffset, 1); - - sourceOffset++; - targetOffset++; - - if (sourceOffset == source[sourceIndex][LOBS.BLOCK_COUNT]) { - sourceOffset = 0; - - sourceIndex++; - } - - if (targetOffset == target[targetIndex][LOBS.BLOCK_COUNT]) { - targetOffset = 0; - - targetIndex++; - } - - if (sourceIndex == source.length) { - break; - } - - if (targetIndex == target.length) { - break; - } - } - - storeModified = true; - } - - public Result getChars(long lobID, long offset, int length) { - - Result result; - - writeLock.lock(); - - try { - if (compressLobs || cryptLobs) { - result = getBytesCompressed(lobID, offset * 2, length * 2); - } else { - result = getBytesNormal(lobID, offset * 2, length * 2); - } - } finally { - writeLock.unlock(); - } - - if (result.isError()) { - return result; - } - - byte[] bytes = ((ResultLob) result).getByteArray(); - char[] chars = ArrayUtil.byteArrayToChars(bytes); - - return ResultLob.newLobGetCharsResponse(lobID, offset, chars); - } - - public Result getBytes(long lobID, long offset, int length) { - - writeLock.lock(); - - try { - if (compressLobs || cryptLobs) { - return getBytesCompressed(lobID, offset, length); - } else { - return getBytesNormal(lobID, offset, length); - } - } finally { - writeLock.unlock(); - } - } - - private Result getBytesNormal(long lobID, long offset, int length) { - - int blockOffset = (int) (offset / lobBlockSize); - int byteBlockOffset = (int) (offset % lobBlockSize); - int blockLimit = (int) ((offset + length) / lobBlockSize); - int byteLimitOffset = (int) ((offset + length) % lobBlockSize); - - if (byteLimitOffset == 0) { - byteLimitOffset = lobBlockSize; - } else { - blockLimit++; - } - - if (length == 0) { - return ResultLob.newLobGetBytesResponse(lobID, offset, - BinaryData.zeroLengthBytes); - } - - int dataBytesPosition = 0; - byte[] dataBytes = new byte[length]; - int[][] blockAddresses = getBlockAddresses(lobID, blockOffset, - blockLimit); - - if (blockAddresses.length == 0) { - return Result.newErrorResult(Error.error(ErrorCode.X_0F502)); - } - - // - int i = 0; - int blockCount = blockAddresses[i][LOBS.BLOCK_COUNT] - + blockAddresses[i][LOBS.BLOCK_OFFSET] - blockOffset; - - if (blockAddresses[i][LOBS.BLOCK_COUNT] - + blockAddresses[i][LOBS.BLOCK_OFFSET] > blockLimit) { - blockCount -= (blockAddresses[i][LOBS.BLOCK_COUNT] - + blockAddresses[i][LOBS.BLOCK_OFFSET] - - blockLimit); - } - - byte[] bytes; - - try { - bytes = getLobStore().getBlockBytes( - blockAddresses[i][LOBS.BLOCK_ADDR] - - blockAddresses[i][LOBS.BLOCK_OFFSET] - + blockOffset, blockCount); - } catch (HsqlException e) { - return Result.newErrorResult(e); - } - - int subLength = lobBlockSize * blockCount - byteBlockOffset; - - if (subLength > length) { - subLength = length; - } - - System.arraycopy(bytes, byteBlockOffset, dataBytes, dataBytesPosition, - subLength); - - dataBytesPosition += subLength; - - i++; - - for (; i < blockAddresses.length && dataBytesPosition < length; i++) { - blockCount = blockAddresses[i][LOBS.BLOCK_COUNT]; - - if (blockAddresses[i][LOBS.BLOCK_COUNT] - + blockAddresses[i][LOBS.BLOCK_OFFSET] > blockLimit) { - blockCount -= (blockAddresses[i][LOBS.BLOCK_COUNT] - + blockAddresses[i][LOBS.BLOCK_OFFSET] - - blockLimit); - } - - try { - bytes = getLobStore().getBlockBytes( - blockAddresses[i][LOBS.BLOCK_ADDR], blockCount); - } catch (HsqlException e) { - return Result.newErrorResult(e); - } - - subLength = lobBlockSize * blockCount; - - if (subLength > length - dataBytesPosition) { - subLength = length - dataBytesPosition; - } - - System.arraycopy(bytes, 0, dataBytes, dataBytesPosition, - subLength); - - dataBytesPosition += subLength; - } - - return ResultLob.newLobGetBytesResponse(lobID, offset, dataBytes); - } - - private Result setBytesBA(long lobID, long offset, byte[] dataBytes, - int dataLength) { - - if (dataLength == 0) { - return ResultLob.newLobSetResponse(lobID, 0); - } - - writeLock.lock(); - - try { - if (compressLobs || cryptLobs) { - return setBytesBACompressed(lobID, offset, dataBytes, - dataLength); - } else { - return setBytesBANormal(lobID, offset, dataBytes, dataLength); - } - } finally { - writeLock.unlock(); - } - } - - private Result setBytesBANormal(long lobID, long offset, byte[] dataBytes, - int dataLength) { - - boolean newBlocks = false; - int blockOffset = (int) (offset / lobBlockSize); - int byteBlockOffset = (int) (offset % lobBlockSize); - int blockLimit = (int) ((offset + dataLength) / lobBlockSize); - int byteLimitOffset = (int) ((offset + dataLength) % lobBlockSize); - - if (byteLimitOffset == 0) { - byteLimitOffset = lobBlockSize; - } else { - blockLimit++; - } - - int[][] blockAddresses = getBlockAddresses(lobID, blockOffset, - blockLimit); - int existingLimit = blockOffset; - - if (blockAddresses.length > 0) { - existingLimit = - blockAddresses[blockAddresses.length - 1][LOBS.BLOCK_OFFSET] - + blockAddresses[blockAddresses.length - 1][LOBS.BLOCK_COUNT]; - } - - if (existingLimit < blockLimit) { - createBlockAddresses(lobID, existingLimit, - blockLimit - existingLimit); - - blockAddresses = getBlockAddresses(lobID, blockOffset, blockLimit); - newBlocks = true; - } - - int currentDataOffset = 0; - int currentDataLength = dataLength; - - try { - for (int i = 0; i < blockAddresses.length; i++) { - long currentBlockOffset = - (long) blockAddresses[i][LOBS.BLOCK_OFFSET] * lobBlockSize; - long currentBlockLength = - (long) blockAddresses[i][LOBS.BLOCK_COUNT] * lobBlockSize; - long currentBlockPosition = - (long) blockAddresses[i][LOBS.BLOCK_ADDR] * lobBlockSize; - int padding = 0; - - if (offset > currentBlockOffset) { - currentBlockLength -= (offset - currentBlockOffset); - currentBlockPosition += (offset - currentBlockOffset); - } - - if (currentDataLength < currentBlockLength) { - if (newBlocks) { - padding = - (int) ((currentBlockLength - currentDataLength) - % lobBlockSize); - } - - currentBlockLength = currentDataLength; - } - - getLobStore().setBlockBytes(dataBytes, currentBlockPosition, - currentDataOffset, - (int) currentBlockLength); - - if (padding != 0) { - ArrayUtil.fillArray(byteBuffer, 0, (byte) 0); - getLobStore().setBlockBytes(byteBuffer, - currentBlockPosition - + currentBlockLength, 0, - padding); - } - - currentDataOffset += currentBlockLength; - currentDataLength -= currentBlockLength; - } - } catch (HsqlException e) { - return Result.newErrorResult(e); - } - - lobStore.synch(); - - storeModified = true; - - return ResultLob.newLobSetResponse(lobID, dataLength); - } - - private Result setBytesIS(long lobID, InputStream inputStream, - long offset, long length) { - - if (length == 0) { - return ResultLob.newLobSetResponse(lobID, 0); - } - - if (compressLobs || cryptLobs) { - return setBytesISCompressed(lobID, inputStream, offset, length); - } else { - return setBytesISNormal(lobID, inputStream, length); - } - } - - private Result setBytesISNormal(long lobID, InputStream inputStream, - long length) { - - long writeLength = 0; - int blockLimit = (int) (length / lobBlockSize); - int byteLimitOffset = (int) (length % lobBlockSize); - - if (byteLimitOffset == 0) { - byteLimitOffset = lobBlockSize; - } else { - blockLimit++; - } - - Result actionResult = createBlockAddresses(lobID, 0, blockLimit); - int[][] blockAddresses = getBlockAddresses(lobID, 0, blockLimit); - - for (int i = 0; i < blockAddresses.length; i++) { - for (int j = 0; j < blockAddresses[i][LOBS.BLOCK_COUNT]; j++) { - int localLength = lobBlockSize; - - ArrayUtil.fillArray(byteBuffer, 0, (byte) 0); - - if (i == blockAddresses.length - 1 - && j == blockAddresses[i][LOBS.BLOCK_COUNT] - 1) { - localLength = byteLimitOffset; - } - - try { - int count = 0; - - while (localLength > 0) { - int read = inputStream.read(byteBuffer, count, - localLength); - - if (read == -1) { - break; - } - - localLength -= read; - count += read; - } - - writeLength += count; - - // read more - } catch (IOException e) { - - // deallocate - return Result.newErrorResult(e); - } - - try { - getLobStore().setBlockBytes( - byteBuffer, blockAddresses[i][LOBS.BLOCK_ADDR] + j, 1); - } catch (HsqlException e) { - return Result.newErrorResult(e); - } - } - } - - storeModified = true; - - lobStore.synch(); - - return ResultLob.newLobSetResponse(lobID, writeLength); - } - - /** - * returns new LOB length - */ - public Result setBytes(long lobID, long offset, byte[] dataBytes, - int dataLength) { - - if (byteBuffer == null) { - throw Error.error(ErrorCode.DATA_IS_READONLY); - } - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - return Result.newErrorResult(Error.error(ErrorCode.X_0F502)); - } - - long length = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - - if (dataLength == 0) { - return ResultLob.newLobSetResponse(lobID, length); - } - - Result result = setBytesBA(lobID, offset, dataBytes, dataLength); - - if (result.isError()) { - return result; - } - - if (offset + dataLength > length) { - length = offset + dataLength; - result = setLength(lobID, length); - - if (result.isError()) { - return result; - } - } - - return ResultLob.newLobSetResponse(lobID, length); - } finally { - writeLock.unlock(); - } - } - - /** - * for new blob only - * - * blob length is set to inputStream size (not given length which could be incorrect) - */ - public Result setBytesForNewBlob(long lobID, InputStream inputStream, - long length) { - - if (byteBuffer == null) { - return Result.newErrorResult( - Error.error(ErrorCode.DATA_IS_READONLY)); - } - - writeLock.lock(); - - try { - Result result = setBytesIS(lobID, inputStream, 0L, length); - Result actionResult = Result.updateZeroResult; - - if (result.isError()) { - return result; - } - - long newLength = ((ResultLob) result).getBlockLength(); - - if (newLength < length) { - actionResult = truncate(lobID, newLength); - } - - if (actionResult.isError()) { - return actionResult; - } - - return result; - } finally { - writeLock.unlock(); - } - } - - /** - * returns new full length of Clob - */ - public Result setChars(long lobID, long offset, char[] chars, - int dataLength) { - - if (byteBuffer == null) { - throw Error.error(ErrorCode.DATA_IS_READONLY); - } - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - return Result.newErrorResult(Error.error(ErrorCode.X_0F502)); - } - - long length = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - - if (dataLength == 0) { - return ResultLob.newLobSetResponse(lobID, length); - } - - byte[] bytes = ArrayUtil.charArrayToBytes(chars, dataLength); - Result result = setBytesBA(lobID, offset * 2, bytes, - dataLength * 2); - - if (result.isError()) { - return result; - } - - if (offset + dataLength > length) { - length = offset + dataLength; - result = setLength(lobID, length); - - if (result.isError()) { - return result; - } - } - - return ResultLob.newLobSetResponse(lobID, length); - } finally { - writeLock.unlock(); - } - } - - public Result setCharsForNewClob(long lobID, InputStream inputStream, - long length) { - - if (byteBuffer == null) { - throw Error.error(ErrorCode.DATA_IS_READONLY); - } - - writeLock.lock(); - - try { - Result result = setBytesIS(lobID, inputStream, 0L, length * 2); - - if (result.isError()) { - return result; - } - - long newLength = ((ResultLob) result).getBlockLength(); - - if (newLength < length) { - Result trunc = truncate(lobID, newLength); - } - - return result; - } finally { - writeLock.unlock(); - } - } - - public Result truncate(long lobID, long offset) { - - if (byteBuffer == null) { - throw Error.error(ErrorCode.DATA_IS_READONLY); - } - - writeLock.lock(); - - try { - Object[] data = getLobHeader(lobID); - - if (data == null) { - return Result.newErrorResult(Error.error(ErrorCode.X_0F502)); - } - - long length = ((Long) data[LOB_IDS.LOB_LENGTH]).longValue(); - long byteLength = offset; - - if (((Integer) data[LOB_IDS.LOB_TYPE]).intValue() - == Types.SQL_CLOB) { - byteLength *= 2; - } - - int blockOffset = (int) ((byteLength + lobBlockSize - 1) - / lobBlockSize); - ResultMetaData meta = deleteLobPartCall.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[DELETE_BLOCKS.LOB_ID] = ValuePool.getLong(lobID); - params[DELETE_BLOCKS.BLOCK_OFFSET] = Integer.valueOf(blockOffset); - params[DELETE_BLOCKS.BLOCK_LIMIT] = ValuePool.INTEGER_MAX; - params[DELETE_BLOCKS.TX_ID] = - ValuePool.getLong(sysLobSession.getTransactionSCN()); - - Result result = - sysLobSession.executeCompiledStatement(deleteLobPartCall, - params, 0); - - setLength(lobID, offset); - - return ResultLob.newLobTruncateResponse(lobID, offset); - } finally { - writeLock.unlock(); - } - } - - private Result setLength(long lobID, long length) { - - ResultMetaData meta = updateLobLength.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[UPDATE_LENGTH.LOB_LENGTH] = ValuePool.getLong(length); - params[UPDATE_LENGTH.LOB_ID] = ValuePool.getLong(lobID); - - Result result = sysLobSession.executeCompiledStatement(updateLobLength, - params, 0); - - return result; - } - - /** - * Executes in user session. No lock - */ - public Result adjustUsageCount(Session session, long lobID, int delta) { - - ResultMetaData meta = updateLobUsage.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[UPDATE_USAGE.BLOCK_COUNT] = ValuePool.getInt(delta); - params[UPDATE_USAGE.LOB_ID] = ValuePool.getLong(lobID); - - session.sessionContext.pushDynamicArguments(params); - - Result result = updateLobUsage.execute(session); - - // todo - return a value in result and check - UPDATE decrements (to zero) then increments usage - if (delta < 0) { - usageChanged += lobBlockSize; - } - - session.sessionContext.pop(); - - return result; - } - - private int[][] getBlockAddresses(long lobID, int offset, int limit) { - - ResultMetaData meta = getSpanningBlocks.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[GET_LOB_PART.LOB_ID] = ValuePool.getLong(lobID); - params[GET_LOB_PART.BLOCK_OFFSET] = ValuePool.getInt(offset); - params[GET_LOB_PART.BLOCK_LIMIT] = ValuePool.getInt(limit); - - sysLobSession.sessionContext.pushDynamicArguments(params); - - Result result = getSpanningBlocks.execute(sysLobSession); - - sysLobSession.sessionContext.pop(); - - RowSetNavigator navigator = result.getNavigator(); - int size = navigator.getSize(); - int[][] blocks = new int[size][3]; - - for (int i = 0; i < size; i++) { - navigator.absolute(i); - - Object[] data = navigator.getCurrent(); - - blocks[i][LOBS.BLOCK_ADDR] = - ((Integer) data[LOBS.BLOCK_ADDR]).intValue(); - blocks[i][LOBS.BLOCK_COUNT] = - ((Integer) data[LOBS.BLOCK_COUNT]).intValue(); - blocks[i][LOBS.BLOCK_OFFSET] = - ((Integer) data[LOBS.BLOCK_OFFSET]).intValue(); - } - - navigator.release(); - - return blocks; - } - - private void deleteBlockAddresses(long lobID, int offset, int limit) { - - ResultMetaData meta = deleteLobPartCall.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[DELETE_BLOCKS.LOB_ID] = ValuePool.getLong(lobID); - params[DELETE_BLOCKS.BLOCK_OFFSET] = ValuePool.getInt(offset); - params[DELETE_BLOCKS.BLOCK_LIMIT] = ValuePool.getInt(limit); - params[DELETE_BLOCKS.TX_ID] = - ValuePool.getLong(sysLobSession.getTransactionSCN()); - - Result result = - sysLobSession.executeCompiledStatement(deleteLobPartCall, params, - 0); - } - - private void divideBlockAddresses(long lobID, int offset) { - - ResultMetaData meta = divideLobPartCall.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[DIVIDE_BLOCK.BLOCK_OFFSET] = ValuePool.getInt(offset); - params[DIVIDE_BLOCK.LOB_ID] = ValuePool.getLong(lobID); - - Result result = - sysLobSession.executeCompiledStatement(divideLobPartCall, params, - 0); - } - - private Result createBlockAddresses(long lobID, int offset, int count) { - - ResultMetaData meta = createLobPartCall.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[ALLOC_BLOCKS.BLOCK_COUNT] = ValuePool.getInt(count); - params[ALLOC_BLOCKS.BLOCK_OFFSET] = ValuePool.getInt(offset); - params[ALLOC_BLOCKS.LOB_ID] = ValuePool.getLong(lobID); - - Result result = - sysLobSession.executeCompiledStatement(createLobPartCall, params, - 0); - - return result; - } - - private Result createFullBlockAddresses(long lobID, int offset, - int count) { - - ResultMetaData meta = createSingleLobPartCall.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[ALLOC_BLOCKS.BLOCK_COUNT] = ValuePool.getInt(count); - params[ALLOC_BLOCKS.BLOCK_OFFSET] = ValuePool.getInt(offset); - params[ALLOC_BLOCKS.LOB_ID] = ValuePool.getLong(lobID); - - Result result = - sysLobSession.executeCompiledStatement(createSingleLobPartCall, - params, 0); - - return result; - } - - private Result createPart(long lobID, long partOffset, int dataLength, - int byteLength, int blockOffset, - int blockCount) { - - ResultMetaData meta = createPart.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[ALLOC_PART.BLOCK_COUNT] = ValuePool.getInt(blockCount); - params[ALLOC_PART.BLOCK_OFFSET] = ValuePool.getInt(blockOffset); - params[ALLOC_PART.PART_OFFSET] = ValuePool.getLong(partOffset); - params[ALLOC_PART.PART_LENGTH] = ValuePool.getLong(dataLength); - params[ALLOC_PART.PART_BYTES] = ValuePool.getLong(byteLength); - params[ALLOC_PART.LOB_ID] = ValuePool.getLong(lobID); - - Result result = sysLobSession.executeCompiledStatement(createPart, - params, 0); - - return result; - } - - private int getBlockAddress(int[][] blockAddresses, int blockOffset) { - - for (int i = 0; i < blockAddresses.length; i++) { - if (blockAddresses[i][LOBS.BLOCK_OFFSET] - + blockAddresses[i][LOBS.BLOCK_COUNT] > blockOffset) { - return blockAddresses[i][LOBS.BLOCK_ADDR] - - blockAddresses[i][LOBS.BLOCK_OFFSET] + blockOffset; - } - } - - return -1; - } - - public int getLobCount() { - - writeLock.lock(); - - try { - sysLobSession.sessionContext.pushDynamicArguments(new Object[]{}); - - Result result = getLobCount.execute(sysLobSession); - - sysLobSession.sessionContext.pop(); - - RowSetNavigator navigator = result.getNavigator(); - boolean next = navigator.next(); - - if (!next) { - navigator.release(); - - return 0; - } - - Object[] data = navigator.getCurrent(); - - return ((Number) data[0]).intValue(); - } finally { - writeLock.unlock(); - } - } - - public void synch() { - - if (storeModified) { - if (lobStore != null) { - writeLock.lock(); - - try { - try { - lobStore.synch(); - } catch (Throwable t) {} - - storeModified = false; - } finally { - writeLock.unlock(); - } - } - } - } - - private long[][] getParts(long lobID, long offset, long limit) { - - ResultMetaData meta = getSpanningParts.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[GET_LOB_PART.LOB_ID] = ValuePool.getLong(lobID); - params[GET_LOB_PART.BLOCK_OFFSET] = ValuePool.getLong(offset); - params[GET_LOB_PART.BLOCK_LIMIT] = ValuePool.getLong(limit); - - sysLobSession.sessionContext.pushDynamicArguments(params); - - Result result = getSpanningParts.execute(sysLobSession); - - sysLobSession.sessionContext.pop(); - - RowSetNavigator navigator = result.getNavigator(); - int size = navigator.getSize(); - long[][] blocks = new long[size][6]; - - for (int i = 0; i < size; i++) { - navigator.absolute(i); - - Object[] data = navigator.getCurrent(); - - for (int j = 0; j < blocks[i].length; j++) { - blocks[i][j] = ((Number) data[j]).longValue(); - } - } - - navigator.release(); - - return blocks; - } - - private void inflate(byte[] data, int length) { - - if (cryptLobs) { - length = database.logger.getCrypto().decode(data, 0, length, data, - 0); - } - - try { - inflater.setInput(data, 0, length); - - length = inflater.inflate(dataBuffer); - - inflater.reset(); - } catch (DataFormatException e) { - - // - } catch (Throwable e) {} - - int limit = (int) ArrayUtil.getBinaryMultipleCeiling(length, - lobBlockSize); - - for (int i = length; i < limit; i++) { - dataBuffer[i] = 0; - } - } - - private int deflate(byte[] data, int offset, int length) { - - deflater.setInput(data, offset, length); - deflater.finish(); - - length = deflater.deflate(dataBuffer); - - deflater.reset(); - - if (cryptLobs) { - length = database.logger.getCrypto().encode(dataBuffer, 0, length, - dataBuffer, 0); - } - - int limit = (int) ArrayUtil.getBinaryMultipleCeiling(length, - lobBlockSize); - - for (int i = length; i < limit; i++) { - dataBuffer[i] = 0; - } - - return length; - } - - private int compareBytesCompressed(long aID, long bID) { - - long[][] aParts = getParts(aID, 0, Long.MAX_VALUE); - long[][] bParts = getParts(bID, 0, Long.MAX_VALUE); - - for (int i = 0; i < aParts.length && i < bParts.length; i++) { - int aPartLength = (int) aParts[i][ALLOC_PART.PART_LENGTH]; - - getPartBytesCompressedInBuffer(aID, aParts[i]); - - byte[] aPartBytes = new byte[aPartLength]; - - System.arraycopy(dataBuffer, 0, aPartBytes, 0, aPartLength); - - int bPartLength = (int) bParts[i][ALLOC_PART.PART_LENGTH]; - - getPartBytesCompressedInBuffer(aID, bParts[i]); - - int result = ArrayUtil.compare(aPartBytes, 0, aPartLength, - byteBuffer, 0, bPartLength); - - if (result != 0) { - return result; - } - } - - if (aParts.length == bParts.length) { - return 0; - } - - return aParts.length > bParts.length ? 1 - : -1; - } - - private int compareTextCompressed(Collation collation, long aID, - long bID) { - - long[][] aParts = getParts(aID, 0, Long.MAX_VALUE); - long[][] bParts = getParts(bID, 0, Long.MAX_VALUE); - - for (int i = 0; i < aParts.length && i < bParts.length; i++) { - int aPartLength = (int) aParts[i][ALLOC_PART.PART_LENGTH]; - - getPartBytesCompressedInBuffer(aID, aParts[i]); - - String aString = new String(ArrayUtil.byteArrayToChars(dataBuffer, - aPartLength)); - int bPartLength = (int) bParts[i][ALLOC_PART.PART_LENGTH]; - - getPartBytesCompressedInBuffer(bID, bParts[i]); - - String bString = new String(ArrayUtil.byteArrayToChars(dataBuffer, - bPartLength)); - int diff = collation.compare(aString, bString); - - if (diff != 0) { - return diff; - } - } - - if (aParts.length == bParts.length) { - return 0; - } - - return aParts.length > bParts.length ? 1 - : -1; - } - - private Result setBytesISCompressed(long lobID, InputStream inputStream, - long baseOffset, long length) { - - long offset = 0; - byte[] tempBuffer = new byte[largeLobBlockSize]; - - while (true) { - int localLength = tempBuffer.length; - - if (localLength > length - offset) { - localLength = (int) (length - offset); - } - - int count = 0; - - try { - while (localLength > 0) { - int read = inputStream.read(tempBuffer, count, - localLength); - - if (read == -1) { - return Result.newErrorResult(new EOFException()); - } - - localLength -= read; - count += read; - } - - // read more - } catch (IOException e) { - - // deallocate - return Result.newErrorResult(e); - } - - Result result = setBytesBACompressedPart(lobID, baseOffset, - tempBuffer, count); - - if (result.isError()) { - return result; - } - - offset += count; - baseOffset += count; - - if (offset == length) { - break; - } - } - - storeModified = true; - - return ResultLob.newLobSetResponse(lobID, length); - } - - private Result setBytesBACompressed(long lobID, long offset, - byte[] dataBytes, int dataLength) { - - if (dataLength == 0) { - return ResultLob.newLobSetResponse(lobID, 0); - } - - if (dataLength <= largeLobBlockSize) { - return setBytesBACompressedPart(lobID, offset, dataBytes, - dataLength); - } - - HsqlByteArrayInputStream is = new HsqlByteArrayInputStream(dataBytes, - 0, dataLength); - - return setBytesISCompressed(lobID, is, offset, dataLength); - } - - /** - * Only for loading parts of the same lob, not for overwriting parts of existing lob - */ - private Result setBytesBACompressedPart(long lobID, long offset, - byte[] dataBytes, int dataLength) { - - // get block offset after existing blocks and compressed block - long[] lastPart = getLastPart(lobID); - int blockOffset = (int) lastPart[ALLOC_PART.BLOCK_OFFSET] - + (int) lastPart[ALLOC_PART.BLOCK_COUNT]; - - // check position - long limit = lastPart[ALLOC_PART.PART_OFFSET] - + lastPart[ALLOC_PART.PART_LENGTH]; - - if (limit != offset || limit % largeLobBlockSize != 0) { - return Result.newErrorResult(Error.error(ErrorCode.X_0A501, - "compressed lobs")); - } - - int byteLength = deflate(dataBytes, 0, dataLength); - int blockCount = (byteLength + lobBlockSize - 1) / lobBlockSize; - Result result = createFullBlockAddresses(lobID, blockOffset, - blockCount); - - if (result.isError()) { - return result; - } - - result = createPart(lobID, offset, dataLength, byteLength, - blockOffset, blockCount); - - if (result.isError()) { - return result; - } - - long blockByteOffset = blockOffset * (long) lobBlockSize; - int blockByteLength = - (int) ArrayUtil.getBinaryMultipleCeiling(byteLength, lobBlockSize); - - setBytesBANormal(lobID, blockByteOffset, dataBuffer, blockByteLength); - - storeModified = true; - - return ResultLob.newLobSetResponse(lobID, dataLength); - } - - private Result getBytesCompressed(long lobID, long offset, int length) { - - byte[] dataBytes = new byte[length]; - long[][] parts = getParts(lobID, offset, offset + length); - - for (int i = 0; i < parts.length; i++) { - long[] part = parts[i]; - long partOffset = part[ALLOC_PART.PART_OFFSET]; - int partLength = (int) part[ALLOC_PART.PART_LENGTH]; - Result result = getPartBytesCompressedInBuffer(lobID, part); - - if (result.isError()) { - return result; - } - - ArrayUtil.copyBytes(partOffset, dataBuffer, 0, partLength, offset, - dataBytes, length); - } - - return ResultLob.newLobGetBytesResponse(lobID, offset, dataBytes); - } - - private Result getPartBytesCompressedInBuffer(long lobID, long[] part) { - - long blockOffset = part[ALLOC_PART.BLOCK_OFFSET]; - long partOffset = part[ALLOC_PART.PART_OFFSET]; - long partLength = part[ALLOC_PART.PART_LENGTH]; - int partBytesLength = (int) part[ALLOC_PART.PART_BYTES]; - long blockByteOffset = blockOffset * lobBlockSize; - Result result = getBytesNormal(lobID, blockByteOffset, - partBytesLength); - - if (result.isError()) { - return result; - } - - byte[] byteBlock = ((ResultLob) result).getByteArray(); - - inflate(byteBlock, partBytesLength); - - return ResultLob.newLobSetResponse(lobID, partLength); - } - - private long[] getLastPart(long lobID) { - - ResultMetaData meta = getLastPart.getParametersMetaData(); - Object[] params = new Object[meta.getColumnCount()]; - - params[GET_LOB_PART.LOB_ID] = ValuePool.getLong(lobID); - - sysLobSession.sessionContext.pushDynamicArguments(params); - - Result result = getLastPart.execute(sysLobSession); - - sysLobSession.sessionContext.pop(); - - RowSetNavigator navigator = result.getNavigator(); - int size = navigator.getSize(); - long[] blocks = new long[6]; - - if (size == 0) { - blocks[ALLOC_PART.LOB_ID] = lobID; - } else { - navigator.absolute(0); - - Object[] data = navigator.getCurrent(); - - for (int j = 0; j < blocks.length; j++) { - blocks[j] = ((Number) data[j]).longValue(); - } - } - - navigator.release(); - - return blocks; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/LobStore.java b/database/hsqldb/src/org/hsqldb/persist/LobStore.java deleted file mode 100644 index 2e76e5b0..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/LobStore.java +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.9.0 - */ -public interface LobStore { - - byte[] getBlockBytes(int blockAddress, int blockCount); - - void setBlockBytes(byte[] dataBytes, int blockAddress, int blockCount); - - void setBlockBytes(byte[] dataBytes, long position, int offset, - int length); - - int getBlockSize(); - - void setLength(long length); - - long getLength(); - - void close(); - - void synch(); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/LobStoreInJar.java b/database/hsqldb/src/org/hsqldb/persist/LobStoreInJar.java deleted file mode 100644 index 01e487ce..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/LobStoreInJar.java +++ /dev/null @@ -1,169 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.DataInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -import org.hsqldb.Database; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.9.0 - */ -public class LobStoreInJar implements LobStore { - - final int lobBlockSize; - Database database; - DataInputStream dataInput; - final String fileName; - - // - long realPosition; - - public LobStoreInJar(Database database, int lobBlockSize) { - - this.lobBlockSize = lobBlockSize; - this.database = database; - - try { - fileName = database.getPath() + ".lobs"; - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public byte[] getBlockBytes(int blockAddress, int blockCount) { - - try { - long address = (long) blockAddress * lobBlockSize; - int count = blockCount * lobBlockSize; - byte[] dataBytes = new byte[count]; - - fileSeek(address); - dataInput.readFully(dataBytes, 0, count); - - realPosition = address + count; - - return dataBytes; - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public void setBlockBytes(byte[] dataBytes, int blockAddress, - int blockCount) {} - - public void setBlockBytes(byte[] dataBytes, long position, int offset, - int length) {} - - public int getBlockSize() { - return lobBlockSize; - } - - public long getLength() { - return 0; - } - - public void setLength(long length) {} - - public void close() { - - try { - if (dataInput != null) { - dataInput.close(); - } - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public void synch() {} - - private void resetStream() throws IOException { - - if (dataInput != null) { - dataInput.close(); - } - - InputStream fis = null; - - try { - fis = getClass().getResourceAsStream(fileName); - - if (fis == null) { - ClassLoader cl = - Thread.currentThread().getContextClassLoader(); - - if (cl != null) { - fis = cl.getResourceAsStream(fileName); - } - } - } catch (Throwable t) { - - // - } finally { - if (fis == null) { - throw new FileNotFoundException(fileName); - } - } - - dataInput = new DataInputStream(fis); - realPosition = 0; - } - - private void fileSeek(long position) throws IOException { - - if (dataInput == null) { - resetStream(); - } - - long skipPosition = realPosition; - - if (position < skipPosition) { - resetStream(); - - skipPosition = 0; - } - - while (position > skipPosition) { - skipPosition += dataInput.skip(position - skipPosition); - } - - realPosition = position; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/LobStoreMem.java b/database/hsqldb/src/org/hsqldb/persist/LobStoreMem.java deleted file mode 100644 index fa0666fb..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/LobStoreMem.java +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.HsqlArrayList; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.9.0 - */ -public class LobStoreMem implements LobStore { - - final int lobBlockSize; - int blocksInLargeBlock = 128; - int largeBlockSize; - HsqlArrayList byteStoreList; - - public LobStoreMem(int lobBlockSize) { - - this.lobBlockSize = lobBlockSize; - largeBlockSize = lobBlockSize * blocksInLargeBlock; - byteStoreList = new HsqlArrayList(); - } - - public byte[] getBlockBytes(int blockAddress, int blockCount) { - - byte[] dataBytes = new byte[blockCount * lobBlockSize]; - int dataBlockOffset = 0; - - while (blockCount > 0) { - int largeBlockIndex = blockAddress / blocksInLargeBlock; - byte[] largeBlock = (byte[]) byteStoreList.get(largeBlockIndex); - int blockOffset = blockAddress % blocksInLargeBlock; - int currentBlockCount = blockCount; - - if ((blockOffset + currentBlockCount) > blocksInLargeBlock) { - currentBlockCount = blocksInLargeBlock - blockOffset; - } - - System.arraycopy(largeBlock, blockOffset * lobBlockSize, - dataBytes, dataBlockOffset * lobBlockSize, - currentBlockCount * lobBlockSize); - - blockAddress += currentBlockCount; - dataBlockOffset += currentBlockCount; - blockCount -= currentBlockCount; - } - - return dataBytes; - } - - public void setBlockBytes(byte[] dataBytes, int blockAddress, - int blockCount) { - - int dataBlockOffset = 0; - - while (blockCount > 0) { - int largeBlockIndex = blockAddress / blocksInLargeBlock; - - if (largeBlockIndex >= byteStoreList.size()) { - byteStoreList.add(new byte[largeBlockSize]); - } - - byte[] largeBlock = (byte[]) byteStoreList.get(largeBlockIndex); - int blockOffset = blockAddress % blocksInLargeBlock; - int currentBlockCount = blockCount; - - if ((blockOffset + currentBlockCount) > blocksInLargeBlock) { - currentBlockCount = blocksInLargeBlock - blockOffset; - } - - System.arraycopy(dataBytes, dataBlockOffset * lobBlockSize, - largeBlock, blockOffset * lobBlockSize, - currentBlockCount * lobBlockSize); - - blockAddress += currentBlockCount; - dataBlockOffset += currentBlockCount; - blockCount -= currentBlockCount; - } - } - - public void setBlockBytes(byte[] dataBytes, long position, int offset, - int length) { - - while (length > 0) { - int largeBlockIndex = (int) (position / largeBlockSize); - - if (largeBlockIndex >= byteStoreList.size()) { - byteStoreList.add(new byte[largeBlockSize]); - } - - byte[] largeBlock = (byte[]) byteStoreList.get(largeBlockIndex); - int offsetInLargeBlock = (int) (position % largeBlockSize); - int currentLength = length; - - if ((offsetInLargeBlock + currentLength) > largeBlockSize) { - currentLength = largeBlockSize - offsetInLargeBlock; - } - - System.arraycopy(dataBytes, offset, largeBlock, - offsetInLargeBlock, currentLength); - - position += currentLength; - offset += currentLength; - length -= currentLength; - } - } - - public int getBlockSize() { - return lobBlockSize; - } - - public long getLength() { - return (long) byteStoreList.size() * largeBlockSize; - } - - public void setLength(long length) { - - int largeBlockIndex = (int) (length / largeBlockSize); - - byteStoreList.setSize(largeBlockIndex + 1); - } - - public void close() { - byteStoreList.clear(); - } - - public void synch() {} -} diff --git a/database/hsqldb/src/org/hsqldb/persist/LobStoreRAFile.java b/database/hsqldb/src/org/hsqldb/persist/LobStoreRAFile.java deleted file mode 100644 index 70392749..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/LobStoreRAFile.java +++ /dev/null @@ -1,184 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Database; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.3 - * @since 1.9.0 - */ -public class LobStoreRAFile implements LobStore { - - final int lobBlockSize; - String fileName; - RandomAccessInterface file; - Database database; - - public LobStoreRAFile(Database database, int lobBlockSize) { - - this.database = database; - this.lobBlockSize = lobBlockSize; - this.fileName = database.getPath() + ".lobs"; - - try { - boolean exists = - database.logger.getFileAccess().isStreamElement(fileName); - - if (exists) { - openFile(); - } - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - private void openFile() { - - try { - boolean readonly = database.isFilesReadOnly(); - - file = new RAFileSimple(database.logger, fileName, readonly ? "r" - : "rws"); - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public byte[] getBlockBytes(int blockAddress, int blockCount) { - - if (file == null) { - throw Error.error(ErrorCode.FILE_IO_ERROR); - } - - try { - long address = (long) blockAddress * lobBlockSize; - int count = blockCount * lobBlockSize; - byte[] dataBytes = new byte[count]; - - file.seek(address); - file.read(dataBytes, 0, count); - - return dataBytes; - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public void setBlockBytes(byte[] dataBytes, int blockAddress, - int blockCount) { - - if (file == null) { - openFile(); - } - - try { - long address = (long) blockAddress * lobBlockSize; - int count = blockCount * lobBlockSize; - - file.seek(address); - file.write(dataBytes, 0, count); - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public void setBlockBytes(byte[] dataBytes, long position, int offset, - int length) { - - if (length == 0) { - return; - } - - if (file == null) { - openFile(); - } - - try { - file.seek(position); - file.write(dataBytes, offset, length); - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public int getBlockSize() { - return lobBlockSize; - } - - public long getLength() { - - if (file == null) { - openFile(); - } - - try { - return file.length(); - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public void setLength(long length) { - - try { - if (file != null) { - file.setLength(length); - file.synch(); - } - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public void close() { - - try { - if (file != null) { - file.synch(); - file.close(); - } - } catch (Throwable t) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, t); - } - } - - public void synch() { - - if (file != null) { - file.synch(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/LockFile.java b/database/hsqldb/src/org/hsqldb/persist/LockFile.java deleted file mode 100644 index 6994ede0..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/LockFile.java +++ /dev/null @@ -1,2387 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.DataInputStream; -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - -import org.hsqldb.DatabaseManager; -import org.hsqldb.HsqlDateTime; -import org.hsqldb.HsqlException; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.lib.HsqlTimer; -import org.hsqldb.lib.StringConverter; - -/** - * Base cooperative file locking implementation and {@code LockFile} - * factory. - * - *


    - * - * Provides a facility for cooperative file locking across process boundaries - * and isolated in-process class loader contexts.

    - * - * The need is obvious for inter-process cases, but it is no less essential for - * in-process Java clients whose classes have been loaded by isolated class - * loaders. This is because static fields--the conventional - * * means for supporting in-process global discovery--become - * distinct and inaccessible across Java class loader context boundaries when - * the contexts do not share a common parent class loader or do not implement - * normal parent class loader delegation semantics.

    - * - * * - * The only purely in-process global discovery alternative known to the author - * is to reflect upon objects found while traversing up the Java runtime thread - * hierarchy. However, this method is often subject to Java security - * restrictions whose collective purpose is essentially dissimilar to that of - * restrictions in effect relative to cooperative file locking requirements, - * making it a generally unacceptable option in this context. - * - *


    - * - * Here is the way this class presently operates: - * - *
      - *
    1. A file with a commonly agreed-upon path is used to implement - * cooperative locking semantics regarding another set of files with - * commonly agreed-upon paths. - * - *
    2. In particular, a background thread periodically writes a timestamp - * value, which acts as a heartbeat that indicates to others whether a - * cooperative lock condition is currently held. - * - *
    3. In addition, a magic value is written so that it is possible to - * distinguish with a reasonably high degree of accuracy between the - * existence of a lock file and some other type of file. - * - *
    4. The generic rules used to acquire a cooperative lock condition are - * as follows: - * - *
        - *
      1. If a lock condition is already held by this object, do nothing and - * signify that the lock attempt was successful, else... - * - *
      2. Poll the underlying file, using a configured maximum number of - * retries and a configured interval between the end of a failed - * poll and the beginning of the next. - * - *
      3. For each poll: - * - *
          - * - *
        1. Attempt to atomically create the underlying file if and only - * if it does not yet exist, exit the polling loop immediately - * indicating success if the attempt succeeds, else fast fail - * the current poll if a security exception is thrown in response - * to the attempt, else... - * - *
        2. Test if the underlying file exists, fast failing the current - * poll if it is impossible to determine (i.e. if a security - * exception is thrown). - * - *
        3. If the file does not exist, exit the polling loop immediately - * indicating success.

          - * - * This can occur only under pre-JDK 1.2 runtimes; or when the - * underlying platform does not correctly support {@link - * java.io.File#createNewFile()}; or when the underlying file is - * deleted within a very short time after i.), above (typically - * on the order of microseconds).

          - * - * If the underlying platform employs a kernel-enforced mandatory - * file locking blanket policy for open files (e.g. Windows - * tm), then this is likely a non-issue. And if - * this case makes possible a race condition with another - * {@code LockFile} object (because the test for existence and - * subsequent file creation is not atomic relative to all other - * file system actions), it is still very unlikely that - * so unfortunate a timing will occur as to allow simultaneous - * lock conditions to be established. Finally, if some - * non-{@code LockFile} entity deleted the file, then there are - * much worse things to worry about, in particular that the files - * this object is supposed to protect are in reality subject to - * arbitrary external modification and deletion. - * - *

        4. Test the file's length, fast failing the current poll if the - * length cannot be determined or it is not the expected - * value. - * - *
        5. Open a stream to read the file's {@code MAGIC} and heartbeat - * timestamp values, fast failing the current poll if the stream - * cannot be opened. - * - *
        6. Test the file's {@code MAGIC} value, failing the current poll - * if the value cannot be read or it is not the expected - * value. - * - *
        7. Test the file's heartbeat timestamp value, fast failing the - * current poll if it cannot be read or it is less than a - * commonly agreed-upon value into the past (or future, to - * overcome a caveat observed by a patch contributor). - *
        - *
      4. If the polling phase exits with a failure indication, then one or - * more of the following cases must have been true at every poll - * iteration: - * - *
          - *
        • The file had the wrong length or {@code MAGIC} value (was - * not an HSQLDB lock file). - * - *
        • The file was deleted externally after a poll's initial - * test for existence and recreated at some point before - * the next poll's initial test for existence. - * - *
        • An incompatible OS-enforced security restriction was in - * effect. - * - *
        • An incompatible Java-enforced security restriction was - * in effect. - * - *
        • The target file system media was effectively inaccessible. - - *
        • A cooperative lock condition was held by some other - * {@code LockFile}. - * - *
        • A kernel-enforced mandatory or advisory file lock was held. - *

        - * - * In this case, signify failure indicating the last encountered - * reason, else... - * - *

      5. Open the file for reading and writing, write the magic value and - * an initial heartbeat timestamp, schedule a periodic heartbeat - * timestamp writer task and signify success. - *
      - *
    5. The generic rules used to release a cooperative lock condition are: - *
        - *
      1. If a lock condition is not currently held, do nothing and signify - * success, else... - * - *
      2. A lock condition is currently held by this object, so try to - * release it.

        - * - * By default, releasing the lock condition consists of closing and - * nullifying any objects that have a file descriptor open on the - * lock file, cancelling the periodic heartbeat timestamp writer - * task and deleting the lock file. If the release occurs without - * raising an exception, signify success, else signify that the - * release attempt might have failed. - *

      - *
    - * - *
    - * - * Additionally, {@link #doOptionalLockActions() doOptionalLockActions()} and - * {@link #doOptionalReleaseActions() doOptionalReleaseActions()} are invoked - * during lock and release attempts, respectively. This enables integration of - * extended lock and release strategies based on subclassing. Subclass - * availability is automatically detected and exposed by the factory method - * {@link #newLockFile newLockFile()}.

    - * - * In particular, if {@link #USE_NIO_FILELOCK_PROPERTY} is true and the required - * classes are available at static initialization, then {@code newLockFile()} - * produces org.hsqldb.persist.NIOLockFile instances.

    - * - * When {@code NIOLockFile} instances are produced, then it is possible that - * true kernel-enforced advisory or mandatory file locking is used to protect - * the underlying lock file from inadvertent modification (and possibly even - * from deletion, including deletion by the system superuser). - * - * Otherwise, {@code newLockFile()} produces vanilla {@code LockFile} - * instances, which exhibit just the elementary cooperative locking behavior on - * platforms that do not, by default, implement kernel-enforced mandatory - * locking for open files.

    - * - * At this point, it must be noted that not every target platform upon which - * Java can run actually provides true kernel-enforced mandatory (or even - * advisory) file locking. Indeed, even when a target platform does - * provide such locking guarantees for local file systems, it may not be able - * to do so for network file systems, or it may only be able to do so safely - * (or at all) with certain restrictions. Further, external system configuration - * may be a prerequisite to enable mandatory locking on systems that support it - * but employ advisory locking by default.

    - * - * In recognition of these facts, the official Java NIO package specification - * explicitly states basically the same information. What is unfortunate, - * however, is that no capabilities API is yet provided as part of the package. - * What is even more unfortunate is that without something like a capabilities - * API, it is impossible for an implementation to indicate or clients to - * distinguish between simple lack of platform support and cases involving - * immature Java runtimes that do not fully or correctly implement all NIO - * features (and hence may throw exceptions at unexpected times or in places - * where the API specification indicates none can be thrown).

    - * - * It is for the preceding reasons that, as of HSQLDB 1.8.0.3, - * {@code FileLock}'s use of Java NIO has been made a purely optional feature. - * Previous to HSQLDB 1.8.0.3, if NIO was detected available, used to create a - * {@code FileLock} and failed, then the enclosing cooperative lock attempt - * failed also, despite the fact that a vanilla locking approach could - * succeed.

    - * - * Polling Configuration:

    - * - * Although the {@link #HEARTBEAT_INTERVAL} and default polling values may - * seem quite conservative, they are the result of ongoing research into - * generally reasonable concerns regarding normal timing and resource - * availability fluctuations experienced frequently under most, if not all - * operating systems.

    - * - * Regardless, flexibility is almost always a good thing, so this class is - * designed to allow polling interval and retry count values to be configured - * at run-time.

    - * - * At present, this can be done at any time by setting the system properties - * whose names are {@link #POLL_RETRIES_PROPERTY} and {@link - * #POLL_INTERVAL_PROPERTY}.

    - * - * Some consideration has also been given to modifying the polling scheme so - * that run-time configuration of the HEARTBEAT_INTERVAL is possible. For now, - * however, this option has been rejected due to the relative complexity of - * guaranteeing acceptably safe, deterministic behaviour. On the other hand, - * if it can be guaranteed that certain site invariants hold (in particular, - * that only one version of the hsqldb jar will ever be used to open database - * instances at the site) and it is desirable or required to experiment with - * a lower interval, then it is recommended for now simply to recompile the - * jar using a different value in the static field assignment. Note that great - * care should be taken to avoid assigning too low a value, or else it may - * become possible that even very short-lived timing and resource availability - * fluctuations will cause incorrect operation of this class.

    - * - * NIO Configuration:

    - * - * Starting with 1.8.0.3, NIO-enhanced file lock attempts are turned off by - * default. The general reasons for this are discussed above. Anyone interested - * in the reading the detailed research notes should refer to the overview of - * NIOLockFile. If, after reviewing the notes and the capabilities of - * the intended target platform, one should still wish to enable NIO-enhanced - * file lock attempts, it can be done by setting the system property {@link - * #USE_NIO_FILELOCK_PROPERTY} true at JVM startup (for example, by using a - * command-line {@code -D=true} directive). Be aware that - * the system property value is read only once, in the static initializer block - * for this class.

    - * - * Design Notes:

    - * - * First, it should be noted that no thread synchronization occurs in - * this class. Primarily, this is because the standard entry point, - * {@link #newLockFileLock(String)}, is always called from within a block - * synchronized upon an HSQLDB Database instance. If this class is to be used - * elsewhere and it could be accessed concurrently, then access should be - * synchronized on an appropriate monitor. That said, certain members of this - * class have been declared volatile to minimize possibility of inconsistent - * views under concurrent read-only access.

    - * - * Second, to the limit of the author's present understanding, the - * implementation details of this class represent a good compromise under varying - * and generally uncontrollable JVM, OS and hardware platform - * limitations/capabilities, as well as under usability considerations and - * external security or operating constraints that may need to be imposed.

    - * - * Alternate approaches that have been considered and rejected for now - * include: - * - *

      - *
    • Socket-based locks (with/without broadcast protocol) - *
    • Pure NIO locking - *
    • Simple lock file (no heartbeat or polling) - *
    • JNI and native configuration alternatives - *
    - * - * Of course, discussions involving and patches implementing improvements - * or better alternatives are always welcome.

    - * - * As a final note and sign post for developers starting to work with - * Java NIO:

    - * - * A separate {@code NIOLockFile} descendant exists specifically - * because it was determined through experimentation that - * {@code java.nio.channels.FileLock} does not always exhibit the correct - * or desired behaviour under reflective method invocation. That is, it was - * discovered that under some operating system/JVM combinations, after calling - * {@code FileLock.release()} via a reflective method invocation, the lock is - * not released properly, deletion of the lock file is not possible even from - * the owning object (this) and it is impossible for other {@code LockFile} - * instances, other in-process objects or other processes to successfully obtain - * a lock condition on the lock file, despite the fact that the - * {@code FileLock} object reports that its lock is invalid (was released - * successfully). Frustratingly, this condition appears to persist until full - * exit of the process hosting the JVM in which the {@code FileLock.tryLock()} - * method was reflectively invoked.

    - * - * To solve this, the original {@code LockFile} class was split in two and - * instead of reflective method invocation, subclass instantiation is now - * performed at the level of the {@code newLockFile()} factory method. - * Similarly, the HSQLDB ANT build script now detects the presence or absence - * of JDK 1.4+ features such as java.nio and only attempts to build and deploy - * {@code NIOLockFile} to the hsqldb.jar if such features are reported - * present.

    - * - * The nio lock file was removed in version 2.0 and reference removed in 2.5.1. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.7.2 - */ -public class LockFile { - - /** - * Arbitrary period, in milliseconds, at which heartbeat timestamps are - * written to this object's lock file.

    - * - * This value was selected to be very conservative, just in case timing - * jitters are experienced on the order introduced by brief network - * partitions, accidentally removed media and transient high load - * CPU bursts. - */ - public static final long HEARTBEAT_INTERVAL = 10000; - - /** - * {@link #HEARTBEAT_INTERVAL} + 100.

    - * - * Interval used by {@link #checkHeartbeat(boolean) checkHeartbeat} to - * test whether the timestamp in the underlying lock file is live or stale. - * Padding added in the hope of reducing potential timing jitter issues - * under the polling scheme introduced in 1.8.0.3 - */ - public static final long HEARTBEAT_INTERVAL_PADDED = 10100; - - /** - * Value written at the beginning of an HSQLDB lock file to distinguish it - * from other file types.

    - * - * The value is the octet sequence: {0x48, 0x53, 0x51, 0x4c, 0x4c, 0x4f, - * 0x43, 0x4b}, which is the ASCII sequence {'H', 'S', 'Q', 'L', 'L', 'O', - * 'C', 'K'}.

    - * - * Design Note:

    - * - * "HSQLLOCK".getBytes() is no longer used because it is dependent on the - * underlying platform's default character set. - */ - protected static final byte[] MAGIC = { - 0x48, 0x53, 0x51, 0x4c, 0x4c, 0x4f, 0x43, 0x4b - }; - - /** - * Size, in bytes, of the region at the beginning of a lock file that is - * actually used to record lock information.

    - * - * Value is currently MAGIC.length + sizeof(long) = (8 + 8) = 16 - */ - public static final int USED_REGION = 16; - - /** - * Number of retries used by default in {@link #pollHeartbeat() - * pollHeartbeat}. - */ - public static final int POLL_RETRIES_DEFAULT = 10; - - /** - * System property that can be used to override the default number of - * heartbeat poll retries. - */ - public static final String POLL_RETRIES_PROPERTY = - "hsqldb.lockfile.poll.retries"; - - /** - * System property that can be used to override the default number of - * milliseconds between each heartbeat poll retry. - */ - public static final String POLL_INTERVAL_PROPERTY = - "hsqldb.lockfile.poll.interval"; - - /** Whether {@code java.nio} file locking is attempted by default. - * Unsupported from version 2.0. - * */ - public static final boolean USE_NIO_FILELOCK_DEFAULT = false; - - /** - * System property that can be used to control whether nio file locking is - * attempted. Unsupported from version 2.0. - */ - public static final String USE_NIO_FILELOCK_PROPERTY = - "hsqldb.lockfile.nio.filelock"; - - /** - * Statically computed indication of {@code java.nio.channels.FileLock} - * runtime availability.

    - * - * Design Note:

    - * - * Computed in a static initializer block. Will be {@code false} if - * {@code USE_NIO_FILELOCK_PROPERTY} is {@code false} at static - * initialization, regardless of actual availability. - */ - public static final boolean NIO_FILELOCK_AVAILABLE; - - /** - * Statically computed reference to the {@code NIOLockFile} class.

    - * - * Design Note:

    - * - * Computed in a static initializer block. Will be {@code null} if - * {@code USE_NIO_FILELOCK_PROPERTY} is {@code false} at static - * initialization, regardless of actual availability. - */ - public static final Class NIO_LOCKFILE_CLASS; - - /** - * The timed scheduler with which to register this object's - * heartbeat task. - */ - protected static final HsqlTimer timer = DatabaseManager.getTimer(); - - // This static initializer comes last, since it references a subclass - // - // That is, it is best practice to ensure the static fields of this class - // are all initialized before referencing a subclass whose static - // field initialization may in turn reference static fields in this class. - static { - synchronized (LockFile.class) { - boolean use = USE_NIO_FILELOCK_DEFAULT; - - try { - use = "true".equalsIgnoreCase( - System.getProperty(USE_NIO_FILELOCK_PROPERTY, use ? "true" - : "false")); - } catch (Exception e) {} - - boolean avail = false; - Class clazz = null; - - if (use) { - try { - Class.forName("java.nio.channels.FileLock"); - - clazz = Class.forName("org.hsqldb.persist.NIOLockFile"); - avail = true; - } catch (Exception e) {} - } - - NIO_FILELOCK_AVAILABLE = avail; - NIO_LOCKFILE_CLASS = clazz; - } - } - - /** - * Canonical reference to this object's lock file.

    - * - * Design Note:

    - * - * Should really be final, but finality makes reflective construction - * and adherence to desirable {@code LockFile} factory method event - * sequence more complicated. - */ - protected File file; - - /** - * Cached value of the lock file's canonical path - * - * Design Note:

    - * - * Should really be final, but finality makes reflective construction - * and adherence to desirable {@code LockFile} factory method event - * sequence much more complicated. - */ - private String cpath; - - /** - * A {@code RandomAccessFile} constructed from this object's canonical file - * reference.

    - * - * This {@code RandomAccessFile} is used to periodically write out the - * heartbeat timestamp to this object's lock file. - */ - protected volatile RandomAccessFile raf; - - /** Indicates presence or absence of the cooperative lock condition. */ - protected volatile boolean locked; - - /** Opaque reference to this object's heartbeat task. */ - private volatile Object timerTask; - - /** - * Retrieves a new {@code NIOLockFile}, or {@code null} if not available - * under the current runtime environment. - * - * Returns null from version 2.0. - * - * @return a new {@code NIOLockFile}, or {@code null} if not available - * under the current runtime environment - */ - private static LockFile newNIOLockFile() { - - /* - if (NIO_FILELOCK_AVAILABLE && NIO_LOCKFILE_CLASS != null) { - try { - return (LockFile) NIO_LOCKFILE_CLASS.getDeclaredConstructor().newInstance(); - } catch (Exception e) { - - // e.printStackTrace() - } - } - */ - - return null; - } - - /** - * To allow subclassing without exposing a public constructor. - */ - protected LockFile() {} - - /** - * Retrieves a {@code LockFile} instance, initialized with a {@code File} - * object whose path is the canonical form of the one specified by the - * given {@code path} argument.

    - * - * The resulting {@code LockFile} instance does not yet hold a lock - * condition on the file with the given path, nor does it guarantee that the - * file pre-exists or is created. - * - * However, upon successful execution, it is guaranteed that all required - * parent directories have been created and that the underlying platform has - * verified the specified path is legal on the file system of the underlying - * storage partition. - * - * @return a {@code LockFile} instance initialized with a {@code File} - * object whose path is the one specified by the given {@code path} - * argument. - * @param path the path of the {@code File} object with which the retrieved - * {@code LockFile} object is to be initialized - * @throws FileCanonicalizationException if an I/O error occurs upon - * canonicalization of the given path, which is possible because - * it may be illegal on the runtime file system or because - * construction of the canonical path name may require native file - * system queries - * @throws FileSecurityException if a required system property value cannot - * be accessed, or if a security manager exists and its {@link - * java.lang.SecurityManager#checkRead} method denies read - * access to the file; or if its {@link - * java.lang.SecurityManager#checkRead(java.lang.String)} - * method does not permit verification of the existence of all - * necessary parent directories; or if the {@link - * java.lang.SecurityManager#checkWrite(java.lang.String)} - * method does not permit all necessary parent directories to be - * created - */ - public static LockFile newLockFile(final String path) - throws FileCanonicalizationException, FileSecurityException { - - LockFile lockFile = newNIOLockFile(); - - if (lockFile == null) { - lockFile = new LockFile(); - } - - lockFile.setPath(path); - - return lockFile; - } - - /** - * {@link org.hsqldb.persist.Logger#acquireLock(java.lang.String)} - * delegate.

    - * - * Retrieves a new {@code LockFile} object holding a cooperative lock - * condition upon the file with the given path, appended with the - * extension '.lck'.

    - * - * @param path of the lock file, to which will be appended '.lck' - * @throws org.hsqldb.HsqlException if the lock condition cannot - * be obtained for any reason. - * @return a new {@code LockFile} object holding a cooperative lock - * condition upon the file with the given path, appended with the - * extension '.lck' - */ - public static LockFile newLockFileLock(final String path) - throws HsqlException { - - LockFile lockFile = null; - - try { - lockFile = LockFile.newLockFile(path + ".lck"); - } catch (LockFile.BaseException e) { - throw Error.error(e, ErrorCode.LOCK_FILE_ACQUISITION_FAILURE, - e.getMessage()); - } - - boolean locked = false; - - try { - locked = lockFile.tryLock(); - } catch (LockFile.BaseException e) { - throw Error.error(e, ErrorCode.LOCK_FILE_ACQUISITION_FAILURE, - e.getMessage()); - } - - // Paranoia mode: In theory, this case can't happen, given the way - // tryLock now works; by all current understanding of the involved API - // contracts, an exception will always be thrown instead by the code - // above. - if (!locked) { - throw Error.error(ErrorCode.LOCK_FILE_ACQUISITION_FAILURE, - lockFile.toString()); - } - - return lockFile; - } - - /** - * Checks whether the underlying file is an HSQLDB lock file and, if so, - * whether its heartbeat timestamp is live (is, as far as can be known, - * presumably in use by another {@code LockFile} instance) or stale.

    - * - * The check conforms to the following rules: - * - *

      - *
    1. If the parameter {@code withCreateNewFile} is true, {@link - * java.io.File#createNewFile()} is available and its invocation - * upon this object's {@code file} object indicates the underlying - * file was atomically created if and only if it did not yet exist, - * then return immediately (we have won the race to establish - * a lock file). - * - *
    2. Test again if the file exists, returning immediately if it does not - * (there's no file and hence no heartbeat to check).

      - * - * An immediate return can occur here only under pre-JDK 1.2 runtimes; - * or when the underlying platform does not correctly support - * {@code File.createNewFile()}; or when the underlying file is deleted - * within a very short time after i.), above (typically on the order of - * microseconds).

      - * - * If the underlying platform employs a kernel-enforced mandatory file - * locking blanket policy for open files (e.g. Windowstm - * ), then this is likely a non-issue. And if this case makes - * possible a race condition with another {@code LockFile} object - * (because the test for existence yields false and subsequent file - * creation is not atomic relative to all other file system actions), it - * is still very unlikely that so unfortunate a timing will - * occur as to allow simultaneous lock conditions to be established. - * Finally, if some non-{@code LockFile} entity deleted the file, then - * there are much worse things to worry about, in particular that the - * files this object is supposed to protect are in reality subject to - * arbitrary external modification and deletion by some uncooperative - * process. - * - *

    3. If a Java security exception is thrown while testing for existence, - * it is rethrown as a {@code FileSecurityException}. - * - *
    4. Read the file's length. - * - *
    5. If a Java security exception is thrown reading length, it is rethrown - * as a {@code FileSecurityException} (it is possible somebody - * concurrently refreshed the system Policy in the interim). - * - *
    6. If the file does not have the expected length, a - * {@code WrongLengthException} is thrown (we're trying to check - * something that is not an HSQLDB lock file). - * - *
    7. Open an input steam to read the file's {@code MAGIC} and heartbeat - * timestamp values. - * - *
    8. If a file not found exception is thrown above, it is rethrown as an - * {@code UnexpectedFileNotFoundException} (we've already tested for - * existence). - * - *
    9. If a Java security exception is thrown above, it is rethrown as a - * {@code FileSecurityException} (it is possible somebody - * concurrently refreshed the system Policy in the interim). - * - *
    10. Read the {@code MAGIC} value. - * - *
    11. If an end of file exception is thrown above, it is rethrown as an - * {@code UnexpectedEndOfFileException} (we've already tested the - * length... did someone truncate the file in the interim?). - * - *
    12. If an I/O exception is thrown, it is rethrown as an - * {@code UnexpectedFileIOException} (we've already tested for - * existence, length and successfully opened a stream...did someone, - * for example, force unmount or physically remove the underlying device - * in the interim?) - * - *
    13. If the value read in does not match the expected {@code MAGIC} value, - * a {@code WrongMagicException} is thrown (we're trying to check - * something that is not an HSQLDB lock file). - * - *
    14. Read the heartbeat timestamp. - * - *
    15. If a Java security exception is thrown above, it is rethrown as a - * {@code FileSecurityException} (it is possible somebody - * concurrently refreshed the system Policy in the interim). - * - *
    16. If an end of file execution is thrown above, it is rethrown as an - * {@code UnexpectedEndOfFileException} (we've already tested the - * length... did someone truncate the file in the interim?). - * - *
    17. If an I/O exception is thrown, it is rethrown as an - * {@code UnexpectedFileIOException} (we've already tested for - * existence, length and successfully opened a stream...did someone, - * for example, force unmount or physically remove the underlying device - * in the interim?) - * - *
    18. If the timestamp read in is less than or equal to - * {@link #HEARTBEAT_INTERVAL_PADDED} milliseconds into the past or - * future, then a {@code LockHeldExternallyException} is thrown. - * - *
    19. Otherwise, this method simply returns. - *
    - * - * @param withCreateNewFile if {@code true}, attempt to employ - * {@code File.createNewFile()} as part of the check so as to - * eliminate potential race conditions when establishing a new - * lock file - * @throws FileSecurityException if the check fails due to a Java - * security permission check failure - * @throws LockHeldExternallyException if it is determined that the - * file's heartbeat timestamp is less than - * {@code HEARTBEAT_INTERVAL_PADDED} into the past (or future) - * @throws UnexpectedEndOfFileException if an {@code EOFException} is - * thrown while reading either the magic or heartbeat timestamp values - * @throws UnexpectedFileIOException if an {@code IOException} other than - * {@code EOFException} is thrown while reading either the magic or - * heartbeat timestamp values - * @throws UnexpectedFileNotFoundException if a - * {@code FileNotFoundException} is thrown while attempting to open a - * stream to read the underlying file's magic and heartbeat timestamp - * values - * @throws WrongLengthException if it is determined that the length - * of the file does not equal {@link #USED_REGION} - * @throws WrongMagicException if it is determined that the file's - * content does not start with {@link #MAGIC}. - */ - private void checkHeartbeat(boolean withCreateNewFile) - throws LockFile.FileSecurityException, - LockFile.LockHeldExternallyException, - LockFile.UnexpectedEndOfFileException, - LockFile.UnexpectedFileIOException, - LockFile.UnexpectedFileNotFoundException, - LockFile.WrongLengthException, LockFile.WrongMagicException { - - long now; - long lastHeartbeat; - long length = 0; - - try { - if (withCreateNewFile) { - try { - if (file.createNewFile()) { - return; - } - } catch (IOException ioe) {} - } - - if (!file.exists()) { - return; - } - - length = file.length(); - } catch (SecurityException se) { - throw new FileSecurityException(this, "checkHeartbeat", se); - } - - if (length != USED_REGION) { - if (length == 0) { - file.delete(); - - return; - } - - throw new WrongLengthException(this, "checkHeartbeat", length); - } - - // Compute the current wall clock time *first* to reduce possibility - // of unwanted time dilation effects introduced, for example, - // by intervening thread or process context switches under CPU - // bursts. - // - // Example: - // - // Say currentTimeMillis is actually somewhere in (-0.5 and 0.5] - // and another LockFile concurrently writes a 0-valued heartbeat - // timestamp. - // - // Then, if readHeartbeat comes first here, happens to 'win the race - // condition' (reads the previous heartbeat: -10,000) and an intervening - // switch causes greater than ~0.5 millisecond elapsed time to - // be experienced between readHeartbeat and currentTimeMillis, then - // currentTimeMillis will be computed as n (n > 0), and (now - - // lastHearbeat) will be HEARTBEAT_INTERVAL + n, instead of - // HEARTBEAT_INTERVAL. - // - // Now, let n be greater than (HEARTBEAT_INTERVAL_PADDED - - // HEARTBEAT_INTERVAL). - // - // Then the check will succeed, although it should fail. - // - // On the other hand, if currentTimeMillis is computed first, the - // worst than can happen is a false positive indication that - // the read heartbeat timestamp value was written by a live LockFile - // instance. - // - now = System.currentTimeMillis(); - lastHeartbeat = readHeartbeat(); - - // Using padded interval to further reduce corner case effects, - // now that heartbeat polling is in effect. - // - // Basically, it is absolutely essential to fail when a lock really is - // still held elsewhere, so it is OK to fail on corner cases where - // the last written heartbeat is very close to HEARTBEAT_INTERVAL - // in the past and it is possible that timing jitters make it uncertain - // whether the lock really is still held. - if (Math.abs(now - lastHeartbeat) <= (HEARTBEAT_INTERVAL_PADDED)) { - throw new LockHeldExternallyException(this, "checkHeartbeat", now, - lastHeartbeat); - } - } - - /** - * Closes this object's {@link #raf RandomAccessFile}.

    - * - * As a side-effect, the associated {@code FileChannel} object, if any, - * is closed as well. - * - * @throws UnexpectedFileIOException if an {@code IOException} is thrown - */ - private void closeRAF() throws LockFile.UnexpectedFileIOException { - - if (raf != null) { - try { - raf.close(); - } catch (IOException ex) { - throw new UnexpectedFileIOException(this, "closeRAF", ex); - } finally { - raf = null; - } - } - } - - /** - * Provides any optional locking actions for the {@link #tryLock() - * tryLock()} template method.

    - * - * Descendants are free to provide additional functionality here, - * using the following rules:

    - * - * PRE:

    - * - * This method is called only from {@code tryLock()} and it is called if - * and only if {@code tryLock()} successfully invokes - * {@code pollHeartbeat()} and {@code openRAF()} first.

    - * - * From this, it can be inferred that upon entry: - * - *

      - *
    1. {@code locked == false}. - *
    2. {@code raf} is a non-null instance that can be used to get a - * {@code FileChannel} instance, if desired. - *
    3. the underlying file either did not exist before invoking - * {@code openRAF()} or it was a valid but stale HSQLDB lock file - * because it: - * - *
        - *
      1. did exist, - *
      2. was readable on {@code USED_REGION}, - *
      3. had the expected length and {@code MAGIC} value and - *
      4. had a stale heartbeat timestamp value. - *
      - *

    - * - * Further, it can be assumed that this object's heatbeat task is definitely - * cancelled and/or has never been scheduled at this point, so whatever - * timestamp is recorded in the lock file, if it did pre-exist, was written - * by a different {@code LockFile} instance or as the result of a previous, - * successful {@code tryLock()} invocation upon this {@code LockFile} - * instance.

    - * - * Finally, it is important that this method does not rethrow any exceptions - * it encounters as unchecked exceptions to the calling context.

    - * - * POST:

    - * - * This method should return {@code false} if optional locking work is not - * performed or if it fails, else {@code true}.

    - * - * In general, if optional locking work fails, then any resources - * acquired in the process should be freed before this method returns. - * In this way, the surrounding implementation can take advantage of a - * {@code false} return value to avoid calling {@link - * #doOptionalReleaseActions() doOptionalReleaseActions()} as part of the - * {@link #tryRelease() tryRelease()} method.

    - * - * Note:

    - * - * The default implementation does nothing and always returns - * {@code false}.

    - * - * @return {@code true} if optional lock actions are performed and they - * succeed, else {@code false} - */ - protected boolean doOptionalLockActions() { - return false; - } - - /** - * Provides any optional release actions for the {@link #tryRelease() - * tryRelease()} template method.

    - * - * PRE:

    - * - * It is important that this method does not rethrow any exceptions - * it encounters as unchecked exceptions to the calling context.

    - * - * POST:

    - * - * In general, {@code false} should be returned if optional locking work - * is not performed or if it fails, else {@code true}. However, the return - * value is currently treated as purely informative.

    - * - * Note:

    - * - * The default implementation does nothing and always returns false.

    - * - * @return {@code true} if optional release actions are performed and they - * succeed, else {@code false} - */ - protected boolean doOptionalReleaseActions() { - return false; - } - - /** - * Initializes this object with a {@code File} object whose path has the - * canonical form of the given {@code path} argument.

    - * - * PRE: - * - *

      - *
    1. This method is called once and only once per - * {@code Lockfile} instance. - * - *
    2. It is always the first method called after - * {@code LockFile} construction - * - *
    3. The supplied {@code path} argument is never - * {@code null}. - *
    - * - * @param path the abstract path representing the file this object is to - * use as its lock file - * @throws FileCanonicalizationException if an I/O error occurs upon - * canonicalization of the given path, which is possible because - * the given path may be illegal on the runtime file system or - * because construction of the canonical pathname may require - * native file system queries - * @throws FileSecurityException if a required system property value cannot - * be accessed, or if a Java security manager exists and its - * {@link java.lang.SecurityManager#checkRead} method denies - * read access to the file; or if its {@link - * java.lang.SecurityManager#checkRead(java.lang.String)} - * method does not permit verification of the existence of - * all necessary parent directories; or if - * its {@link - * java.lang.SecurityManager#checkWrite(java.lang.String)} - * method does not permit all necessary parent directories to be - * created - */ - private void setPath(String path) - throws LockFile.FileCanonicalizationException, - LockFile.FileSecurityException { - - // Should at least be absolutized for reporting purposes, just in case - // a security or canonicalization exception gets thrown. - path = FileUtil.getFileUtil().canonicalOrAbsolutePath(path); - this.file = new File(path); - - try { - FileUtil.getFileUtil().makeParentDirectories(this.file); - } catch (SecurityException ex) { - throw new FileSecurityException(this, "setPath", ex); - } - - try { - this.file = FileUtil.getFileUtil().canonicalFile(path); - } catch (SecurityException ex) { - throw new FileSecurityException(this, "setPath", ex); - } catch (IOException ex) { - throw new FileCanonicalizationException(this, "setPath", ex); - } - - this.cpath = this.file.getPath(); - } - - /** - * Opens (constructs) this object's {@link #raf RandomAccessFile}.

    - * - * @throws UnexpectedFileNotFoundException if a - * {@code FileNotFoundException} is thrown in response to - * constructing the {@code RandomAccessFile} object. - * @throws FileSecurityException if a required system property value cannot - * be accessed, or if a Java security manager exists and its - * {@link java.lang.SecurityManager#checkRead} method - * denies read access to the file; or if its {@link - * java.lang.SecurityManager#checkWrite(java.lang.String)} - * method denies write access to the file - */ - private void openRAF() - throws LockFile.UnexpectedFileNotFoundException, - LockFile.FileSecurityException { - - try { - raf = new RandomAccessFile(file, "rw"); - } catch (SecurityException ex) { - throw new FileSecurityException(this, "openRAF", ex); - } catch (FileNotFoundException ex) { - throw new UnexpectedFileNotFoundException(this, "openRAF", ex); - } - } - - /** - * Checks whether the given {@code DataInputStream} contains the - * {@link #MAGIC} value. - * - * @param dis the stream to check - * @throws FileSecurityException if a required system property value cannot - * be accessed, or if a Java security manager exists and its - * {@link java.lang.SecurityManager#checkRead} method - * denies read access to the file - * @throws UnexpectedEndOfFileException if an {@code EOFException} is - * thrown while reading the {@code DataInputStream} - * @throws UnexpectedFileIOException if an {@code IOException} other than - * {@code EOFException} is thrown while reading the - * {@code DataInputStream} - * @throws WrongMagicException if a value other than {@code MAGIC} is read - * from the {@code DataInputStream} - */ - private void checkMagic(final DataInputStream dis) - throws LockFile.FileSecurityException, - LockFile.UnexpectedEndOfFileException, - LockFile.UnexpectedFileIOException, LockFile.WrongMagicException { - - boolean success = true; - final byte[] magic = new byte[MAGIC.length]; - - try { - for (int i = 0; i < MAGIC.length; i++) { - magic[i] = dis.readByte(); - - if (MAGIC[i] != magic[i]) { - success = false; - } - } - } catch (SecurityException ex) { - throw new FileSecurityException(this, "checkMagic", ex); - } catch (EOFException ex) { - throw new UnexpectedEndOfFileException(this, "checkMagic", ex); - } catch (IOException ex) { - throw new UnexpectedFileIOException(this, "checkMagic", ex); - } - - if (!success) { - throw new WrongMagicException(this, "checkMagic", magic); - } - } - - /** - * Retrieves the last written hearbeat timestamp from this object's lock - * file. If this object's lock file does not exist, then {@code Long.MIN_VALUE - * } (the earliest time representable as a {@code long} in Java) is - * returned immediately.

    - * - * @return the hearbeat timestamp read from this object's lock file, - * as a {@code long} value or, if this object's lock - * file does not exist, {@code Long.MIN_VALUE}, the earliest time - * representable as a {@code long} in Java. - * @throws FileSecurityException if a required system property value cannot - * be accessed, or if a Java security manager exists and its - * {@link java.lang.SecurityManager#checkRead} method - * denies read access to the file - * @throws UnexpectedEndOfFileException if an {@code EOFException} is - * thrown while attempting to read the target file's {@code MAGIC} - * or heartbeat timestamp value - * @throws UnexpectedFileNotFoundException if, after successfully testing - * for existence, the target file is not found a moment later while - * attempting to read its {@code MAGIC} and heartbeat timestamp - * values - * @throws UnexpectedFileIOException if any other input stream error occurs - * @throws WrongMagicException if the lock file does not start with the - * the {@link #MAGIC} value - */ - private long readHeartbeat() - throws LockFile.FileSecurityException, - LockFile.UnexpectedFileNotFoundException, - LockFile.UnexpectedEndOfFileException, - LockFile.UnexpectedFileIOException, LockFile.WrongMagicException { - - FileInputStream fis = null; - DataInputStream dis = null; - - try { - if (!file.exists()) { - return Long.MIN_VALUE; - } - - fis = new FileInputStream(file); - dis = new DataInputStream(fis); - - checkMagic(dis); - - return dis.readLong(); - } catch (SecurityException ex) { - throw new FileSecurityException(this, "readHeartbeat", ex); - } catch (FileNotFoundException ex) { - throw new UnexpectedFileNotFoundException(this, "readHeartbeat", - ex); - } catch (EOFException ex) { - throw new UnexpectedEndOfFileException(this, "readHeartbeat", ex); - } catch (IOException ex) { - throw new UnexpectedFileIOException(this, "readHeartbeat", ex); - } finally { - if (fis != null) { - try { - fis.close(); - } catch (IOException ioe) { - - // ioe.printStackTrace(); - } - } - } - } - - /** - * Schedules the lock heartbeat task. - */ - private void startHeartbeat() { - - if (timerTask == null || HsqlTimer.isCancelled(timerTask)) { - Runnable runner = new HeartbeatRunner(); - - timerTask = timer.schedulePeriodicallyAfter(0, HEARTBEAT_INTERVAL, - runner, true); - } - } - - /** - * Cancels the lock heartbeat task. - */ - private void stopHeartbeat() { - - if (timerTask != null && !HsqlTimer.isCancelled(timerTask)) { - HsqlTimer.cancel(timerTask); - - timerTask = null; - } - } - - /** - * Writes the {@link #MAGIC} value to this object's lock file that - * distinguishes it as an HSQLDB lock file.

    - * - * @throws FileSecurityException possibly never (seek and write are native - * methods whose JavaDoc entries do not actually specify throwing - * {@code SecurityException}). However, it is conceivable that these - * native methods may, in turn, access Java methods that do - * throw {@code SecurityException}. In this case, a - * {@code SecurityException} might be thrown if a required system - * property value cannot be accessed, or if a security manager exists - * and its {@link - * java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)} - * method denies write access to the file - * @throws UnexpectedEndOfFileException if an end of file exception is - * thrown while attempting to write the {@code MAGIC} value to the - * target file (typically, this cannot happen, but the case is - * included to distinguish it from the general {@code IOException} - * case). - * @throws UnexpectedFileIOException if any other I/O error occurs while - * attempting to write the {@code MAGIC} value to the target file. - */ - private void writeMagic() - throws LockFile.FileSecurityException, - LockFile.UnexpectedEndOfFileException, - LockFile.UnexpectedFileIOException { - - try { - raf.seek(0); - raf.write(MAGIC); - } catch (SecurityException ex) { - throw new FileSecurityException(this, "writeMagic", ex); - } catch (EOFException ex) { - throw new UnexpectedEndOfFileException(this, "writeMagic", ex); - } catch (IOException ex) { - throw new UnexpectedFileIOException(this, "writeMagic", ex); - } - } - - /** - * Writes the current hearbeat timestamp value to this object's lock - * file.

    - * - * @throws FileSecurityException possibly never (seek and write are native - * methods whose JavaDoc entries do not actually specify throwing - * {@code SecurityException}). However, it is conceivable that these - * native methods may, in turn, access Java methods that do throw - * {@code SecurityException}. In this case, a - * {@code SecurityException} might be thrown if a required system - * property value cannot be accessed, or if a security manager exists - * and its {@link - * java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)} - * method denies write access to the file - * @throws UnexpectedEndOfFileException if an end of file exception is - * thrown while attempting to write the heartbeat timestamp value to - * the target file (typically, this cannot happen, but the case is - * included to distinguish it from the general IOException case). - * @throws UnexpectedFileIOException if the current heartbeat timestamp - * value cannot be written due to an underlying I/O error - */ - private void writeHeartbeat() - throws LockFile.FileSecurityException, - LockFile.UnexpectedEndOfFileException, - LockFile.UnexpectedFileIOException { - - try { - raf.seek(MAGIC.length); - raf.writeLong(System.currentTimeMillis()); - } catch (SecurityException ex) { - throw new FileSecurityException(this, "writeHeartbeat", ex); - } catch (EOFException ex) { - throw new UnexpectedEndOfFileException(this, "writeHeartbeat", ex); - } catch (IOException ex) { - throw new UnexpectedFileIOException(this, "writeHeartbeat", ex); - } - } - - /** - * Tests whether some other object is "equal to" this one.

    - * - * An object is considered equal to a {@code LockFile} object if and - * only if it is not null, it is an instance of {@code LockFile} and - * either it is the identical instance or it has the same lock file. More - * formally, is is considered equal if and only if it is not null, it is an - * instance of {@code LockFile}, and the expression: - * - *

    -     * this == other ||
    -     * this.file == null ? other.file == null : this.file.equals(other.file);
    -     * 
    - * - * yields true.

    - * - * Note that {@code file} must be a canonical reference to correctly - * satisfy this contract.

    - * - * @param obj the reference object with which to compare. - * @return {@code true} if this object is equal to the {@code obj} - * argument; {@code false} otherwise. - * @see #hashCode - */ - public final boolean equals(final Object obj) { - - if (this == obj) { - return true; - } else if (obj instanceof LockFile) { - LockFile other = (LockFile) obj; - - return (this.file == null) ? other.file == null - : this.file.equals(other.file); - } - - return false; - } - - /** - * Retrieves the canonical path of this object's lock file, as a - * {@code String} object.

    - * - * @return the canonical path of this object's lock file. - */ - public final String getCanonicalPath() { - return cpath; - } - - /** - * Retrieves the hash code value for this object.

    - * - * The value is zero if {@code file} is {@code null}, else the - * {@code hashCode} of {@code file}. That is, two {@code LockFile} - * objects have the same {@code hashCode} value if they refer to the - * same lock file.

    - * - * Note that {@code file} must be a canonical reference to correctly - * satisfy this contract.

    - * - * @return a hash code value for this object. - * @see #equals(java.lang.Object) - */ - public final int hashCode() { - return file == null ? 0 - : file.hashCode(); - } - - /** - * Retrieves whether this object has successfully obtained and is still - * holding (has not yet released) a cooperative lock condition on its - * lock file.

    - * - * Note:

    - * - * Due to platform-independence restrictions placed on a JVM, it is quite - * possible to successfully acquire a lock condition and yet for the - * condition to become invalid while still held.

    - * - * For instance, under JVMs with no {@code java.nio} package or under - * operating systems that do not apply mandatory file locking (especially - * mandatory locking that precludes deletion), it is quite possible for - * another process or even an uncooperative bit of code running in the same - * JVM to overwrite or delete the target lock file while this object holds - * a lock condition.

    - * - * Because of this, the {@code isValid()} method is provided in the public - * interface in order to allow clients to detect at least a subset of such - * situations.

    - * - * @return {@code true} if this object has successfully obtained and is - * still holding (has not yet released) a lock condition, else - * {@code false} - * @see #isValid - */ - public final boolean isLocked() { - return locked; - } - - /** - * Retrieves whether there is potentially already a cooperative lock, - * operating system lock or some other situation preventing a cooperative - * lock condition from being acquired using the specified path. - * - * @param path the path to test - * @return {@code true} if there is currently something preventing the - * acquisition of a cooperative lock condition using the specified - * {@code path}, else {@code false} - */ - public static boolean isLocked(final String path) { - - boolean locked = true; - - try { - LockFile lockFile = LockFile.newLockFile(path); - - lockFile.checkHeartbeat(false); - - locked = false; - } catch (Exception e) {} - - return locked; - } - - /** - * Retrieves whether this object holds a valid lock condition on its - * lock file.

    - * - * More formally, this method retrieves true if and only if: - * - *

    -     * {@code isLocked() && file != null && file.exists() && raf != null}
    -     * 
    - * - * @return {@code true} if this object holds a valid lock condition on its - * lock file; else {@code false} - * @throws SecurityException if a required system property value cannot - * be accessed, or if a Java security manager exists and its - * {@code checkRead} method denies read access to the lock file; - */ - public boolean isValid() { - return isLocked() && file != null && file.exists() && raf != null; - } - - /** - * Retrieves a String representation of this object.

    - * - * The String is of the form: - * - *

    -     * super.toString() +
    -     * "[file=" + getCanonicalPath() +
    -     * ", exists=" + file.exists() +
    -     * ", locked=" + isLocked() +
    -     * ", valid=" + isValid() +
    -     * ", " + toStringImpl() +
    -     * "]";
    -     * 
    - * - * - * @return a String representation of this object. - * @see #toStringImpl - * @throws SecurityException if a required system property value cannot - * be accessed, or if a security manager exists and its {@link - * java.lang.SecurityManager#checkRead} method denies - * read access to the lock file; - */ - public String toString() { - - return new StringBuilder(super.toString()).append("[file =").append( - cpath).append(", exists=").append(file.exists()).append( - ", locked=").append(isLocked()).append(", valid=").append( - isValid()).append(", ").append(toStringImpl()).append( - "]").toString(); - } - - /** - * Retrieves an implementation-specific tail value for the - * {@code toString()} method.

    - * - * The default implementation returns the empty string. - * - * @return an implementation-specific tail value for the {@code toString()} - * method - * @see #toString - */ - protected String toStringImpl() { - return ""; - } - - /** - * Retrieves the number of times {@code checkHeartbeat} may fail before - * {@code pollHeartbeat} fails as a consequence.

    - * - * The value is obtained in the following manner: - * - *

      - *
    1. retries is assigned {@code POLL_RETRIES_DEFAULT}. - * - *
    2. retries is assigned {@code Integer.getInteger(POLL_RETRIES_PROPERTY, - * retries)} inside a try-catch block to silently ignore any security - * exception. - * - *
    3. If retries is less than one (1), retries is assigned one (1). - *
    - * - * @return the number of times {@code checkHeartbeat} may fail before - * {@code pollHeartbeat} fails as a consequence. - */ - public int getPollHeartbeatRetries() { - - int retries = POLL_RETRIES_DEFAULT; - - try { - retries = Integer.getInteger( - HsqlDatabaseProperties.system_lockfile_poll_retries_property, - retries).intValue(); - } catch (Exception e) {} - - if (retries < 1) { - retries = 1; - } - - return retries; - } - - /** - * Retrieves the interval, in milliseconds, that {@code pollHeartbeat} - * waits between failed invocations of {@code checkHeartbeat}. - * - * The value is obtained in the following manner: - * - *
      - *
    1. interval is assigned {@code 10 + (HEARTBEAT_INTERVAL_PADDED - * getPollHeartbeatRetries())} - * - *
    2. interval is assigned {@code Long.getLong(POLL_INTERVAL_PROPERTY, - * interval)}, inside a try-catch block, to silently ignore any security - * exception. - * - *
    3. If interval is less than or equal to zero (0), interval is reassigned - * {@code 10 + (HEARTBEAT_INTERVAL_PADDED / getPollHeartbeatRetries())} - *
    - * - * @return the interval, in milliseconds, that {@code pollHeartbeat} - * waits between failed invocations of {@code checkHeartbeat} - */ - public long getPollHeartbeatInterval() { - - int retries = getPollHeartbeatRetries(); - long interval = 10 + (HEARTBEAT_INTERVAL_PADDED / retries); - - try { - interval = Long.getLong(POLL_INTERVAL_PROPERTY, - interval).longValue(); - } catch (Exception e) {} - - if (interval <= 0) { - interval = 10 + (HEARTBEAT_INTERVAL_PADDED / retries); - } - - return interval; - } - - /** - * Polls the underlying lock file to determine if a lock condition - * exists.

    - * - * Specifically, polls {@link #checkHeartbeat(boolean) checkHeartbeat} at - * the configured interval until the check passes, the current poll interval - * wait state is interrupted or the configured number of poll retries is - * reached.

    - * - * The last exception thrown by {@code checkHeartbeat} is re-thrown if no - * check passes.

    - * - * @throws FileSecurityException if the Java security system denied read - * to the target file - * @throws LockHeldExternallyException if the target file's heartbeat - * timestamp indicated that a lock condition was held by another - * {@code LockFile}. - * @throws UnexpectedFileNotFoundException if the target file became - * unavailable between a test for existence and an attempt to read - * the {@code MAGIC} or heartbeat timestamp value. - * @throws UnexpectedEndOfFileException if an {@code EOFException} was - * raised while trying to read the {@code MAGIC} or heartbeat - * timestamp value of the target file - * @throws UnexpectedFileIOException if an {@code EOFException} other than - * {@code EOFException} was raised while trying to read the - * {@code MAGIC} or heartbeat timestamp value of the target file - * @throws WrongLengthException if the target file did not have the - * expected length - * @throws WrongMagicException if the target file did not begin with the - * expected {@code MAGIC} value - */ - private void pollHeartbeat() - throws LockFile.FileSecurityException, - LockFile.LockHeldExternallyException, - LockFile.UnexpectedFileNotFoundException, - LockFile.UnexpectedEndOfFileException, - LockFile.UnexpectedFileIOException, LockFile.WrongLengthException, - LockFile.WrongMagicException { - - boolean success = false; - int retries = getPollHeartbeatRetries(); - long interval = getPollHeartbeatInterval(); - LockFile.BaseException reason = null; - - for (int i = retries; i > 0; i--) { - try { - checkHeartbeat(true); // withCreateNewFile == true - - success = true; - - break; - } catch (LockFile.BaseException ex) { - reason = ex; - } - - // We get here if and only if success == false and reason != null, - // so its OK to 'break' - try { - Thread.sleep(interval); - } catch (InterruptedException ex) { - break; - } - } - - /* - * @todo: - * Do not want to specify just BaseException in the throws clause. - * Is this really the cleanest way? - */ - if (!success) { - if (reason instanceof FileSecurityException) { - throw (FileSecurityException) reason; - } else if (reason instanceof LockHeldExternallyException) { - throw (LockHeldExternallyException) reason; - } else if (reason instanceof UnexpectedFileNotFoundException) { - throw (UnexpectedFileNotFoundException) reason; - } else if (reason instanceof UnexpectedEndOfFileException) { - throw (UnexpectedEndOfFileException) reason; - } else if (reason instanceof UnexpectedFileIOException) { - throw (UnexpectedFileIOException) reason; - } else if (reason instanceof WrongLengthException) { - throw (WrongLengthException) reason; - } else if (reason instanceof WrongMagicException) { - throw (WrongMagicException) reason; - } - } - } - - /** - * Attempts to obtain a cooperative lock condition upon this object's lock - * file.

    - * - * @throws FileSecurityException if the lock condition could not be - * obtained due to a Java security permission violation - * @throws LockHeldExternallyException if the lock condition could not - * be obtained because the target file's heartbeat timestamp indicated - * that a lock condition was held by another {@code LockFile}. - * @throws UnexpectedFileNotFoundException if the lock condition could not - * be obtained because the target file became unavailable between a - * successful test for existence and an attempt to read its - * {@code MAGIC} or heartbeat timestamp value. - * @throws UnexpectedEndOfFileException if the lock condition could not be - * obtained because {@code EOFException} was raised while trying to - * read the {@code MAGIC} or heartbeat timestamp value of the target - * file - * @throws UnexpectedFileIOException if the lock condition could not be - * obtained due to an {@code IOException} other than - * {@code EOFException} - * @throws WrongLengthException if the lock condition could not be obtained - * because the target file was the wrong length - * @throws WrongMagicException if the lock condition could not be obtained - * because the target file had the wrong {@code MAGIC} value - * @return {@code true} if and only if a lock condition is obtained - * successfully; - * {@code false} otherwise. In general, an exception will - * always be thrown if a lock condition cannot be obtained for - * any reason - */ - public final boolean tryLock() - throws LockFile.FileSecurityException, - LockFile.LockHeldExternallyException, - LockFile.UnexpectedFileNotFoundException, - LockFile.UnexpectedEndOfFileException, - LockFile.UnexpectedFileIOException, LockFile.WrongLengthException, - LockFile.WrongMagicException { - - if (this.locked) { - return true; - } - - try { - pollHeartbeat(); - openRAF(); - - // Must come *after* openRAF to comply with the - // doOptionalLockActions() PRE: assertion contract. - // - // In an ideal world, it would be possible from Java to open - // a file handle and obtain at least one associated NIO FileLock in - // one kernel-enforced atomic operation. However, we can't even - // guarantee that NIO is available. - // - // Note: - // The NIOLockFile version of this operation is 'self cleaning'... - // if it fails for some reason, then it does a 'best effort' to - // eagerly release and nullify its FileLock object before - // returning. - doOptionalLockActions(); - - // Inlined the following to reduce potential for timing issues - // such as initial timer thread startup induced delay of first - // pulse. - // - // In general, what we'll get is two initial pulses in rapid - // succession: one here and one an instant later as a result of - // startHeartbeat (which is OK... no harm, and it's one-shot - // behaviour, not repeated on every writeHeartbeat) - // - // Unfortunately, we may occasionally encounter astronomic (at least - // in computer time) delays between invocation of startHeartbeat - // and the time at which effort is actually expended toward writing - // the initial MAGIC and heartbeat timestamp values. - // - // Another good reason to inline the first writeHeartbeat is to - // provide a last line of defence against inter-process as well - // as inter-thread race conditions. That is, exceptions thrown in - // HeartbeatRunner.run() do yet get propagated anywhere useful. - // - // Of course, if we are operating under a fully-featured and correct - // NIO implementation, the concerns described above are really - // non-issues... at this point, we will have (at least in theory) a - // valid OS-enforced file lock. - // - // But in an ideal world (with or without NIO), any pulse failure in - // HeartbeatRunner.run() would flag the database Logger that a - // database lock condition violation has occurred, preventing further - // ad-hoc operation of the database. - // - // The problem is, if a lock condition has been violated that is - // being used by a database instance, what mechanism can be used to - // safely checkpoint, backup and/or shut down that instance? For - // all we know, the violation indicates that another instance is now - // happily writing to the other database files... - // - // A prudent course of action to take under detection of a - // cooperative lock condition violation in the heartbeatRunner task - // would be to perform a 'SCRIPT ' to some pre-ordained 'safe' - // backup location using a globally unique file name and then do a - // 'SHUTDOWN IMMEDIATELY' in one database-scope atomic context (e.g. - // a single JDBC statement execution). - // - // However, by the time a lock condition violation has been detected, - // the data cache file (and log/script) may already be quite - // corrupted, meaning the resulting script may be totally inaccurate - // or worse. - // - // Bottom line: - // - // Regardless of this inlining measure, if a lock violation occurs - // after startHeartbeat, it's almost certain there's much worse in - // store... - writeMagic(); - writeHeartbeat(); - FileUtil.getFileUtil().deleteOnExit(file); - - this.locked = true; - - startHeartbeat(); - } finally { - if (!locked) { - - // No harm in this... - // - // If this LockFile is an NIOLockFile instance and - // doOptionalLockActions() failed above, then a 'best - // effort' optional release was already performed and - // this will be a no-op. - // - // On the other hand, if doOptionalLockActions() succeeded, best - // to undo them here right away, since the core locking work - // failed. - // - // In practice, however, it is very unlikely for the core - // locking work to fail if this LockFile is an NIOLockFile - // instance and doOptionalLockActions() succeeded, except - // under JVM implementations whose NIO package is broken in - // a very specific way. - // - // Other possibilities include unfortunate timing of events - // under certain network file system or removable media - // configurations, device umounts, physical removal of storage - // media, Java security or file system security policy - // updates, etc. - doOptionalReleaseActions(); - - try { - closeRAF(); - } catch (Exception ex) { - - // It's too late to do anything useful with this exception. - // - // we've already/ failed and will let the caller know the - // reason via the exception thrown in the try block. - // - // ex.printStackTrace(); - } - } - } - - return this.locked; - } - - /** - * Attempts to release any cooperative lock condition this object - * may hold upon its lock file.

    - * - * - * @return {@code true} if this object does not currently hold a - * lock condition or the lock is released completely (including - * successful file deletion), else {@code false}. - * @throws FileSecurityException if a {@code SecurityException} is raised - * in the process of releasing the lock condition - * @throws UnexpectedFileIOException if an IoException is raised in the - * process of releasing the lock condition - */ - public final boolean tryRelease() - throws LockFile.FileSecurityException, LockFile.UnexpectedFileIOException { - - boolean released = !locked; - - if (released) { - return true; - } - - stopHeartbeat(); - doOptionalReleaseActions(); - - UnexpectedFileIOException closeRAFReason = null; - FileSecurityException securityReason = null; - - try { - try { - closeRAF(); - } catch (UnexpectedFileIOException ex) { - closeRAFReason = ex; - } - - try { - - // Hack Alert: - // - // Even without the presence of concurrent locking attempts, - // the delete or exists invocations below occasionally return - // false otherwise, perhaps due to a race condition with the - // heartbeat timestamp writer task or some nio file lock release - // timing issue? - // - // TODO: - // - // determine if this is an external constraint or if we can - // solve it instead by waiting for any in-progress - // writeHeartbeat operation to conclude. - Thread.sleep(100); - } catch (Exception ex) { - - // ex.printStackTrace(); - } - - try { - released = file.delete(); - - // Perhaps excessive... - // - // Another Lockfile may recreate the file an instant after it is - // deleted above (if it it deleted successfully, that is) - // released = !file.exists(); - } catch (SecurityException ex) { - securityReason = new FileSecurityException(this, "tryRelease", - ex); - } - } finally { - - // Regardless of whether all release work succeeds, it is important - // to indicate that, from the perspective of this instance, a lock - // condition is no longer held. - // - // However, in a world of concurrent execution, we do not want to - // to expose this fact externally until *after* all release work has - // been at least attempted. - this.locked = false; - } - - if (closeRAFReason != null) { - throw closeRAFReason; - } else if (securityReason != null) { - throw securityReason; - } - - return released; - } - - /** - * For internal use only.

    - * - * This Runnable class provides the implementation for the timed task - * that periodically writes out a heartbeat timestamp to the lock file. - */ - private final class HeartbeatRunner implements Runnable { - - public void run() { - - try { - LockFile.this.writeHeartbeat(); - } catch (Throwable t) { - Error.printSystemOut(t.toString()); - } - } - } - - /** - * Base exception class for lock condition specific exceptions. - * - */ - public abstract static class BaseException extends Exception { - - private final LockFile lockFile; - private final String inMethod; - - /** - * Constructs a new {@code LockFile.BaseException}.

    - * - * @param lockFile the underlying {@code LockFile} object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - */ - public BaseException(final LockFile lockFile, final String inMethod) { - - super(); - - if (lockFile == null) { - throw new NullPointerException("lockFile"); - } - - if (inMethod == null) { - throw new NullPointerException("inMethod"); - } - - this.lockFile = lockFile; - this.inMethod = inMethod; - } - - /** - * Subclass-specific override.

    - * - * @return representation of {@code lockFile} and - * {@code inMethod}, as {@code String} object - */ - public String getMessage() { // override - return "lockFile: " + lockFile + " method: " + inMethod; - } - - /** - * Getter for {@code inMethod} property.

    - * - * @return name of method in which exception originally occurred - */ - public String getInMethod() { - return this.inMethod; - } - - /** - * Getter for {@code lockFile} property.

    - * - * @return the underlying {@code LockFile} object - */ - public LockFile getLockFile() { - return this.lockFile; - } - } - - /** - * Thrown when canonicalization of a {@code LockFile} object's target - * file path fails.

    - * - * This is possible because the given path may be illegal on the runtime - * file system or because construction of the canonical pathname may require - * filesystem queries. - */ - public static final class FileCanonicalizationException - extends BaseException { - - private final IOException reason; - - /** - * Constructs a new {@code FileCanonicalizationException}.

    - * - * @param lockFile the underlying {@code LockFile} object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param reason the exception thrown during canonicalization - */ - public FileCanonicalizationException(final LockFile lockFile, - final String inMethod, - final IOException reason) { - - super(lockFile, inMethod); - - this.reason = reason; - } - - /** - * Retrieves the underlying {@code IOException}.

    - * - * @return Value of property reason. - */ - public IOException getReason() { - return this.reason; - } - - /** - * Subclass-specific override.

    - * - * @return representation of {@code lockFile}, {@code inMethod} and - * {@code reason}, as a {@code String} object - */ - public String getMessage() { // override - return super.getMessage() + " reason: " + reason; - } - } - - /** - * Thrown when access to a {@code LockFile} object's target file raises a - * Java {@code SecurityException}.

    - * - * This can occur if a required system property value cannot be accessed, or - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkRead} method denies read access to a - * file; or if its {@link - * java.lang.SecurityManager#checkRead(java.lang.String)} - * method does not permit verification of the existence of all necessary - * parent directories; or if its {@link - * java.lang.SecurityManager#checkWrite(java.lang.String)} - * method does not permit all necessary parent directories to be - * created. - * - */ - public static final class FileSecurityException extends BaseException { - - private final SecurityException reason; - - /** - * Constructs a new {@code FileSecurityException}.

    - * - * @param lockFile the underlying LockFile object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param reason the underlying Java security exception - */ - public FileSecurityException(final LockFile lockFile, - final String inMethod, - final SecurityException reason) { - - super(lockFile, inMethod); - - this.reason = reason; - } - - /** - * Retrieves the underlying {@code SecurityException}.

    - * - * @return Value of property reason. - */ - public SecurityException getReason() { - return this.reason; - } - - /** - * Subclass-specific override. - * - * @return representation of lockFile, inMethod and reason, as - * a String object - */ - public String getMessage() { // override - return super.getMessage() + " reason: " + reason; - } - } - - /** - * Thrown when an externally held lock condition prevents lock - * acquisition.

    - * - * Specifically, this exception is thrown when polling fails because the - * lock file's heartbeat timestamp value indicates that another LockFile - * object still holds the lock condition. - * - */ - public static final class LockHeldExternallyException - extends BaseException { - - private final long read; - private final long heartbeat; - - /** - * Constructs a new {@code LockHeldExternallyException}.

    - * - * @param lockFile the underlying {@code LockFile} object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param read the time, in milliseconds since 1970-01-01, at which - * the heartbeat timestamp value was read from the lock file - * @param heartbeat the heartbeat timestamp value, in milliseconds - * since 1970-01-01, that was read from the lock file. - */ - public LockHeldExternallyException(final LockFile lockFile, - final String inMethod, - final long read, - final long heartbeat) { - - super(lockFile, inMethod); - - this.read = read; - this.heartbeat = heartbeat; - } - - /** - * Getter for the {@code heartbeat} attribute.

    - * - * @return the heartbeat timestamp value, in milliseconds since - * 1970-01-01, that was read from the lock file. - */ - public long getHeartbeat() { - return this.heartbeat; - } - - /** - * Getter for the {@code read} attribute.

    - * - * @return the time, in milliseconds since 1970-01-01, that - * the heartbeat timestamp value was read from the lock file. - */ - public long getRead() { - return this.read; - } - - /** - * Subclass-specific override.

    - * - * @return representation of {@code lockFile}, {@code inMethod}, - * {@code read} and {@code heartbeat}, as a {@code String} - * object - */ - public String getMessage() { // override - - return super.getMessage() + " read: " - + HsqlDateTime.getTimestampString(this.read) - + " heartbeat - read: " + (this.heartbeat - this.read) - + " ms."; - } - } - - /** - * Thrown when access to a {@code LockFile} object's target file raises an - * unexpected {@code EOFException}. - */ - public static final class UnexpectedEndOfFileException - extends BaseException { - - private final EOFException reason; - - /** - * Constructs a new {@code UnexpectedEndOfFileException}.

    - * - * @param lockFile the underlying {@code LockFile} object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param reason the underlying exception - */ - public UnexpectedEndOfFileException(final LockFile lockFile, - final String inMethod, - final EOFException reason) { - - super(lockFile, inMethod); - - this.reason = reason; - } - - /** - * Retrieves the underlying EOFException. - * - * @return Value of property reason. - */ - public EOFException getReason() { - return this.reason; - } - - /** - * Subclass-specific override.

    - * - * @return representation of {@code lockFile}, {@code inMethod} and - * {@code reason}, as a {@code String} object - */ - public String getMessage() { // override - return super.getMessage() + " reason: " + reason; - } - } - - /** - * Thrown when access to a {@code LockFile} object's target file raises an - * unexpected {@code IOException} other than {@code EOFException}. - */ - public static final class UnexpectedFileIOException extends BaseException { - - private final IOException reason; - - /** - * Constructs a new UnexpectedFileIOException. - * - * @param lockFile the underlying {@code LockFile} object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param reason the underlying exception - */ - public UnexpectedFileIOException(final LockFile lockFile, - final String inMethod, - final IOException reason) { - - super(lockFile, inMethod); - - this.reason = reason; - } - - /** - * Retrieves the underlying {@code IOException}. - * - * @return Value of property reason. - */ - public IOException getReason() { - return this.reason; - } - - /** - * Subclass-specific override. - * - * @return representation of {@code lockFile}, {@code inMethod} and - * {@code reason}, as a {@code String} object - */ - public String getMessage() { // override - return super.getMessage() + " reason: " + reason; - } - } - - /** - * Thrown when access to a {@code LockFile} object's target file raises an - * unexpected {@code FileNotFoundException}. - */ - public static final class UnexpectedFileNotFoundException - extends BaseException { - - private final FileNotFoundException reason; - - /** - * Constructs a new UnexpectedFileNotFoundException. - * - * @param lockFile the underlying {@code LockFile} object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param reason the underlying exception - */ - public UnexpectedFileNotFoundException( - final LockFile lockFile, final String inMethod, - final FileNotFoundException reason) { - - super(lockFile, inMethod); - - this.reason = reason; - } - - /** - * Retrieves the underlying FileNotFoundException. - * - * @return Value of property reason. - */ - public FileNotFoundException getReason() { - return this.reason; - } - - /** - * Subclass-specific override. - * - * @return representation of lockFile, inMethod and reason, as - * a String object - */ - public String getMessage() { // override - return super.getMessage() + " reason: " + reason; - } - } - - /** - * Thrown when it is detected that a LockFile object's target file does not - * have the expected length. - */ - public static final class WrongLengthException extends BaseException { - - private final long length; - - /** - * Constructs a new WrongLengthException. - * - * @param lockFile the underlying LockFile object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param length the actual length reported by the file system - */ - public WrongLengthException(final LockFile lockFile, - final String inMethod, final long length) { - - super(lockFile, inMethod); - - this.length = length; - } - - /** - * Retrieves the actual length reported by the file system. - * - * @return the actual length reported by the file system - */ - public long getLength() { - return this.length; - } - - /** - * Subclass-specific override. - * - * @return representation of lockFile, inMethod and length, as - * a String object - */ - public String getMessage() { // override - return super.getMessage() + " length: " + length; - } - } - - /** - * Thrown when it is detected that a LockFile object's target file does not - * start with the expected MAGIC value. - */ - public static final class WrongMagicException extends BaseException { - - private final byte[] magic; - - /** - * Constructs a new WrongMagicException. - * - * @param lockFile the underlying LockFile object - * @param inMethod the name of the method in which the exception - * was originally thrown (may be passed up several levels) - * @param magic the actual magic value read from the file - */ - public WrongMagicException(final LockFile lockFile, - final String inMethod, final byte[] magic) { - - super(lockFile, inMethod); - - this.magic = magic; - } - - /** - * Subclass-specific override. - * - * @return representation of inMethod, file and magic, - * as a String object - */ - public String getMessage() { // override - - String message = super.getMessage() + " magic: "; - - message = message + ((magic == null) ? "null" - : "'" - + StringConverter.byteArrayToHexString(magic) - + "'"); - - return message; - } - - /** - * Retrieves a copy of the actual {@code MAGIC} value read from the - * file.

    - * - * @return a copy of the actual {@code MAGIC} value read from the file - */ - public byte[] getMagic() { - return (magic == null) ? null - : this.magic.clone(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/Log.java b/database/hsqldb/src/org/hsqldb/persist/Log.java deleted file mode 100644 index 3d973471..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/Log.java +++ /dev/null @@ -1,836 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.File; -import java.io.IOException; - -import org.hsqldb.Database; -import org.hsqldb.HsqlException; -import org.hsqldb.NumberSequence; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.FileAccess; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.scriptio.ScriptReaderBase; -import org.hsqldb.scriptio.ScriptReaderDecode; -import org.hsqldb.scriptio.ScriptReaderText; -import org.hsqldb.scriptio.ScriptWriterBase; -import org.hsqldb.scriptio.ScriptWriterEncode; -import org.hsqldb.scriptio.ScriptWriterText; - -/** - * This class is responsible for managing some of the database files. - * An HSQLDB database consists of - * a .properties file, a .script file (contains an SQL script), - * a .data file (contains data of cached tables) a .backup file - * a .log file and a .lobs file.

    - * - * When using TEXT tables, a data source for each table is also present.

    - * - * Notes on OpenOffice.org integration. - * - * A Storage API is used when HSQLDB is integrated into OpenOffice.org. All - * file operations on the 4 main files are performed by OOo, which integrates - * the contents of these files into its database file. The script format is - * always TEXT in this case. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @author Bob Preston (sqlbob@users dot sourceforge.net) - text table support - * @version 2.7.0 - * @since 1.8.0 - */ -public class Log { - - private HsqlDatabaseProperties properties; - private String baseFileName; - private Database database; - private FileAccess fa; - ScriptWriterBase dbLogWriter; - private String scriptFileName; - private String dataFileName; - private String backupFileName; - private String logFileName; - private boolean filesReadOnly; - private long maxLogSize; - private int writeDelay; - private DataFileCache cache; - private boolean isModified; - - Log(Database db) { - - database = db; - fa = db.logger.getFileAccess(); - baseFileName = db.getPath(); - properties = db.getProperties(); - } - - void initParams() { - - maxLogSize = database.logger.getLogSize() * 1024L * 1024; - writeDelay = database.logger.getWriteDelay(); - filesReadOnly = database.isFilesReadOnly(); - scriptFileName = baseFileName + Logger.scriptFileExtension; - dataFileName = baseFileName + Logger.dataFileExtension; - backupFileName = baseFileName + Logger.backupFileExtension; - logFileName = baseFileName + Logger.logFileExtension; - } - - /** - * When opening a database, the hsqldb.compatible_version property is - * used to determine if this version of the engine is equal to or greater - * than the earliest version of the engine capable of opening that - * database. - */ - void open() { - - initParams(); - - int state = properties.getDBModified(); - - switch (state) { - - case HsqlDatabaseProperties.FILES_NEW : - break; - - case HsqlDatabaseProperties.FILES_MODIFIED : - database.logger.logInfoEvent("open start - state modified"); - deleteNewAndOldFiles(); - deleteOldTempFiles(); - processScript(); - processLog(); - checkpoint(); - break; - - case HsqlDatabaseProperties.FILES_MODIFIED_NEW_DATA : - renameNewDataFile(); - - // fall through - case HsqlDatabaseProperties.FILES_MODIFIED_NEW : - database.logger.logInfoEvent("open start - state new files"); - deleteBackupFile(); - renameNewScriptFile(); - properties.setDBModified( - HsqlDatabaseProperties.FILES_NOT_MODIFIED); - - // continue as non-modified files - // delete log file as zero length file is possible - // fall through - case HsqlDatabaseProperties.FILES_NOT_MODIFIED : - database.logger.logInfoEvent( - "open start - state not modified"); - deleteLogFile(); - /* - * if startup is after a SHUTDOWN SCRIPT and there are CACHED - * or TEXT tables, perform a checkpoint so that the .script - * file no longer contains CACHED or TEXT table rows. - */ - processScript(); - - if (!filesReadOnly) { - - // isAnyCacheModified arises from reading .script file containing CACHED data - if (isAnyCacheModified()) { - properties.setDBModified( - HsqlDatabaseProperties.FILES_MODIFIED); - checkpoint(); - } - } - break; - } - - if (!filesReadOnly) { - openLog(); - } - } - - /** - * Close all the database files. If script argument is true, no .data - * or .backup file will remain and the .script file will contain all the - * data of the cached tables as well as memory tables. - * - * This is not used for filesReadOnly databases which use shutdown. - */ - void close(boolean script) { - - database.logger.setFilesTimestamp( - database.txManager.getSystemChangeNumber()); - closeLog(); - deleteOldFiles(); - deleteOldTempFiles(); - deleteTempFileDirectory(); - writeScript(script); - database.logger.textTableManager.closeAllTextCaches(script); - - if (cache != null) { - cache.close(); - } - - // set this one last to save the props - properties.setProperty(HsqlDatabaseProperties.hsqldb_script_format, - database.logger.propScriptFormat); - properties.setDBModified(HsqlDatabaseProperties.FILES_MODIFIED_NEW); - deleteLogFile(); - - if (cache != null) { - if (script) { - cache.deleteDataFile(); - - if (fa.isStreamElement(dataFileName)) { - database.logger.logInfoEvent("delete .data file failed "); - } - } - - deleteBackupFile(); - - if (fa.isStreamElement(cache.backupFileName)) { - database.logger.logInfoEvent("delete .backup file failed "); - } - } - - if (fa.isStreamElement(logFileName)) { - database.logger.logInfoEvent("delete .log file failed "); - } - - boolean complete = renameNewScriptFile(); - - if (complete) { - properties.setDBModified( - HsqlDatabaseProperties.FILES_NOT_MODIFIED); - } - } - - /** - * Fast counterpart to close(). Does not perform a checkpoint or delete - * backup of the .data file. - */ - void closeImmediately() { - - if (cache != null) { - cache.release(); - } - - database.logger.textTableManager.closeAllTextCaches(false); - database.logger.setFilesTimestamp( - database.txManager.getSystemChangeNumber()); - closeLog(); - } - - /** - * Checks all the caches and returns true if the modified flag is set for any - */ - boolean isAnyCacheModified() { - - if (cache != null && cache.isModified()) { - return true; - } - - if (database.logger.textTableManager.isAnyTextCacheModified()) { - return true; - } - - return false; - } - - private boolean checkpoint() { - - if (filesReadOnly) { - return true; - } - - boolean result = checkpointClose(); - boolean reopenResult = checkpointReopen(); - - if (!result) { - database.logger.logSevereEvent( - "checkpoint failed - see previous error", null); - } - - return reopenResult; - } - - /** - * Performs checkpoint including pre and post operations. Returns to the - * same state as before the checkpoint. - */ - void checkpoint(Session session, boolean defrag) { - - if (filesReadOnly) { - return; - } - - if (cache == null) { - defrag = false; - } else if (forceDefrag()) { - defrag = true; - } - - if (defrag) { - defrag(session); - } else { - checkpoint(); - } - } - - /** - * Performs checkpoint including pre and post operations. Returns to the - * same state as before the checkpoint. - */ - boolean checkpointClose() { - - if (filesReadOnly) { - return true; - } - - database.logger.setFilesTimestamp( - database.txManager.getSystemChangeNumber()); - database.logger.logInfoEvent("checkpointClose start"); - synchLog(); - database.lobManager.synch(); - database.logger.logInfoEvent("checkpointClose synched"); - deleteOldFiles(); - - try { - writeScript(false); - database.logger.logInfoEvent("checkpointClose script done"); - - if (cache != null) { - cache.reset(); - } - - properties.setProperty(HsqlDatabaseProperties.hsqldb_script_format, - database.logger.propScriptFormat); - properties.setDBModified( - HsqlDatabaseProperties.FILES_MODIFIED_NEW); - - if (cache != null) { - deleteBackupFile(); - } - } catch (Throwable t) { - - // backup failed perhaps due to lack of disk space - deleteNewScriptFile(); - database.logger.logSevereEvent("checkpoint failed - recovered", t); - - return false; - } - - closeLog(); - deleteLogFile(); - renameNewScriptFile(); - - try { - properties.setDBModified( - HsqlDatabaseProperties.FILES_NOT_MODIFIED); - } catch (Throwable e) { - database.logger.logSevereEvent( - "logger.checkpointClose properties file save failed", e); - } - - database.logger.logInfoEvent("checkpointClose end"); - - return true; - } - - boolean checkpointReopen() { - - if (filesReadOnly) { - return true; - } - - database.sessionManager.resetLoggedSchemas(); - - try { - if (cache != null) { - cache.reopen(); - } - - if (dbLogWriter != null) { - openLog(); - } - } catch (Throwable e) { - return false; - } - - return true; - } - - /** - * Writes out all the rows to a new .data file without fragmentation. - */ - public boolean defrag(Session session) { - - database.logger.logInfoEvent("defrag start"); - - try { - if (filesReadOnly) { - return true; - } - - database.logger.setFilesTimestamp( - database.txManager.getSystemChangeNumber()); - database.logger.logInfoEvent("checkpointClose start"); - synchLog(); - database.lobManager.synch(); - database.logger.logInfoEvent("checkpointClose synched"); - deleteOldFiles(); - - DataFileDefrag dfd = cache.defrag(session); - - database.schemaManager.setTempIndexRoots(dfd.getIndexRoots()); - - try { - writeScript(false); - cache.close(); - cache.clear(); - database.logger.logInfoEvent("checkpointClose script done"); - } finally { - database.schemaManager.setTempIndexRoots(null); - } - - database.getProperties().setProperty( - HsqlDatabaseProperties.hsqldb_script_format, - database.logger.propScriptFormat); - database.getProperties().setDBModified( - HsqlDatabaseProperties.FILES_MODIFIED_NEW_DATA); - closeLog(); - deleteLogFile(); - deleteBackupFile(); - renameNewDataFile(); - renameNewScriptFile(); - database.getProperties().setDBModified( - HsqlDatabaseProperties.FILES_NOT_MODIFIED); - cache.open(false); - - if (dbLogWriter != null) { - openLog(); - } - - database.persistentStoreCollection.setNewTableSpaces(); - database.schemaManager.setIndexRoots(dfd.getIndexRoots()); - database.sessionManager.resetLoggedSchemas(); - } catch (HsqlException e) { - throw e; - } catch (Throwable e) { - database.logger.logSevereEvent("defrag failure", e); - - throw Error.error(ErrorCode.DATA_FILE_ERROR, e); - } - - database.logger.logInfoEvent("defrag end"); - - return true; - } - - /** - * Returns true if lost space is above the threshold percentage. - */ - boolean forceDefrag() { - - if (database.logger.propDataFileDefragLimit == 0) { - return false; - } - - long fileSize = cache.getFileFreePos(); - long limit = database.logger.propDataFileDefragLimit * fileSize / 100; - long floor = database.logger.propDataFileSpace * 1024L * 1024 * 2; - - if (floor > limit) { - limit = floor; - } - - long lostSize = cache.getLostBlockSize(); - - return lostSize > limit; - } - - /** - * - */ - boolean hasCache() { - return cache != null; - } - - /** - * Responsible for creating the data file cache instance. - */ - DataFileCache getCache() { - - if (cache == null) { - cache = new DataFileCache(database, baseFileName); - - cache.open(filesReadOnly); - } - - return cache; - } - - void setLogSize(int megas) { - maxLogSize = megas * 1024L * 1024; - } - - /** - * Write delay specifies the frequency of FileDescriptor.sync() calls. - */ - int getWriteDelay() { - return writeDelay; - } - - void setWriteDelay(int delay) { - - writeDelay = delay; - - if (dbLogWriter != null && dbLogWriter.getWriteDelay() != delay) { - dbLogWriter.forceSync(); - dbLogWriter.stop(); - dbLogWriter.setWriteDelay(delay); - dbLogWriter.start(); - } - } - - /** - * Various writeXXX() methods are used for logging statements. - * INSERT, DELETE and SEQUENCE statements do not check log size - */ - void writeOtherStatement(Session session, String s) { - - dbLogWriter.writeOtherStatement(session, s); - - if (maxLogSize > 0 && dbLogWriter.size() > maxLogSize) { - database.logger.setCheckpointRequired(); - } - - setModified(); - } - - void writeInsertStatement(Session session, Row row, Table t) { - dbLogWriter.writeInsertStatement(session, row, t); - } - - void writeDeleteStatement(Session session, Table t, Object[] row) { - dbLogWriter.writeDeleteStatement(session, t, row); - } - - void writeSequenceStatement(Session session, NumberSequence s) { - dbLogWriter.writeSequenceStatement(session, s); - setModified(); - } - - void writeCommitStatement(Session session) { - - dbLogWriter.writeCommitStatement(session); - - if (maxLogSize > 0 && dbLogWriter.size() > maxLogSize) { - database.logger.setCheckpointRequired(); - } - - setModified(); - } - - private void setModified() { - - if (!isModified) { - database.databaseProperties.setDBModified( - HsqlDatabaseProperties.FILES_MODIFIED); - - isModified = true; - } - } - - void synchLog() { - - if (dbLogWriter != null) { - dbLogWriter.forceSync(); - } - } - - /** - * Wrappers for opening-starting / stopping-closing the log file and - * writer. - */ - void openLog() { - - if (filesReadOnly) { - return; - } - - setDataChangeLog(); - - isModified = false; - } - - void closeLog() { - - if (dbLogWriter != null) { - database.logger.logDetailEvent("log close size: " - + dbLogWriter.size()); - dbLogWriter.close(); - } - } - - void setDataChangeLog() { - - Crypto crypto = database.logger.getCrypto(); - - try { - if (crypto == null) { - dbLogWriter = new ScriptWriterText(database, logFileName, - false, false, false); - } else { - dbLogWriter = new ScriptWriterEncode(database, logFileName, - crypto); - } - - dbLogWriter.setWriteDelay(writeDelay); - dbLogWriter.start(); - } catch (Throwable e) { - throw Error.error(e, ErrorCode.FILE_IO_ERROR, getLogFileName()); - } - } - - /** - * Write the .script file as .script.new. - */ - void writeScript(boolean full) { - - deleteNewScriptFile(); - - ScriptWriterBase scw; - Crypto crypto = database.logger.getCrypto(); - - if (crypto == null) { - boolean compressed = database.logger.propScriptFormat == 3; - - scw = new ScriptWriterText(database, - scriptFileName - + Logger.newFileExtension, full, - compressed); - } else { - scw = new ScriptWriterEncode(database, - scriptFileName - + Logger.newFileExtension, full, - crypto); - } - - scw.writeAll(); - scw.close(); - - scw = null; - } - - /** - * Performs all the commands in the .script file. - */ - private void processScript() { - - ScriptReaderBase scr = null; - - try { - Crypto crypto = database.logger.getCrypto(); - - if (crypto == null) { - boolean compressed = database.logger.propScriptFormat == 3; - - scr = new ScriptReaderText(database, scriptFileName, - compressed); - } else { - scr = new ScriptReaderDecode(database, scriptFileName, crypto, - false); - } - - Session session = - database.sessionManager.getSysSessionForScript(database); - - scr.readAll(session); - scr.close(); - } catch (Throwable e) { - if (scr != null) { - scr.close(); - - if (cache != null) { - cache.release(); - } - - database.logger.textTableManager.closeAllTextCaches(false); - } - - database.logger.logWarningEvent("Script processing failure", e); - - if (e instanceof HsqlException) { - throw (HsqlException) e; - } else if (e instanceof IOException) { - throw Error.error(ErrorCode.FILE_IO_ERROR, e); - } else if (e instanceof OutOfMemoryError) { - throw Error.error(ErrorCode.OUT_OF_MEMORY, e); - } else { - throw Error.error(ErrorCode.GENERAL_ERROR, e); - } - } - } - - /** - * Performs all the commands in the .log file. - */ - private void processLog() { - - if (fa.isStreamElement(logFileName)) { - boolean fullReplay = database.getURLProperties().isPropertyTrue( - HsqlDatabaseProperties.hsqldb_full_log_replay); - - ScriptRunner.runScript(database, logFileName, fullReplay); - } - } - - String getLogFileName() { - return logFileName; - } - - static void deleteFile(FileAccess fileAccess, String fileName) { - - // first attempt to delete - fileAccess.removeElement(fileName); - - if (fileAccess.isStreamElement(fileName)) { - fileAccess.removeElement(fileName); - - if (fileAccess.isStreamElement(fileName)) { - String discardName = FileUtil.newDiscardFileName(fileName); - - fileAccess.renameElement(fileName, discardName); - } - } - } - - boolean renameNewFile(FileAccess fileAccess, String baseFileName) { - - if (fileAccess.isStreamElement(baseFileName - + Logger.newFileExtension)) { - deleteFile(fileAccess, baseFileName); - - return fileAccess.renameElementOrCopy( - baseFileName + Logger.newFileExtension, baseFileName, - database.logger); - } - - return true; - } - - /** - * Deletes the leftovers from any previous unfinished operations. - */ - void deleteNewAndOldFiles() { - - deleteOldFiles(); - deleteFile(fa, dataFileName + Logger.newFileExtension); - deleteFile(fa, scriptFileName + Logger.newFileExtension); - } - - void deleteDataFile() { - deleteFile(fa, dataFileName); - } - - void deleteBackupFile() { - deleteFile(fa, backupFileName); - } - - boolean renameNewDataFile() { - return renameNewFile(fa, dataFileName); - } - - boolean renameNewScriptFile() { - return renameNewFile(fa, scriptFileName); - } - - void deleteNewScriptFile() { - deleteFile(fa, scriptFileName + Logger.newFileExtension); - } - - void deleteLogFile() { - deleteFile(fa, logFileName); - } - - void deleteOldFiles() { - - try { - File file = new File(database.getCanonicalPath()); - File[] list = file.getParentFile().listFiles(); - - if (list == null) { - return; - } - - for (int i = 0; i < list.length; i++) { - if (list[i].getName().startsWith(file.getName()) - && list[i].getName().endsWith( - Logger.oldFileExtension)) { - list[i].delete(); - } - } - } catch (Throwable t) {} - } - - void deleteOldTempFiles() { - - try { - if (database.logger.tempDirectoryPath == null) { - return; - } - - File file = new File(database.logger.tempDirectoryPath); - File[] list = file.listFiles(); - - if (list == null) { - return; - } - - for (int i = 0; i < list.length; i++) { - list[i].delete(); - } - } catch (Throwable t) {} - } - - void deleteTempFileDirectory() { - - try { - if (database.logger.tempDirectoryPath == null) { - return; - } - - File file = new File(database.logger.tempDirectoryPath); - - file.delete(); - } catch (Throwable t) {} - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/Logger.java b/database/hsqldb/src/org/hsqldb/persist/Logger.java deleted file mode 100644 index 5c645960..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/Logger.java +++ /dev/null @@ -1,2376 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Locale; -import java.util.concurrent.atomic.AtomicInteger; - -import org.hsqldb.Database; -import org.hsqldb.DatabaseType; -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.NumberSequence; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Statement; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.Tokens; -import org.hsqldb.TransactionManager; -import org.hsqldb.TransactionManagerMV2PL; -import org.hsqldb.TransactionManagerMVCC; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.index.IndexAVL; -import org.hsqldb.index.IndexAVLMemory; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.EventLogInterface; -import org.hsqldb.lib.FileAccess; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.lib.FrameworkLogger; -import org.hsqldb.lib.HashMap; -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.lib.InputStreamInterface; -import org.hsqldb.lib.InputStreamWrapper; -import org.hsqldb.lib.SimpleLog; -import org.hsqldb.lib.StringUtil; -import org.hsqldb.lib.tar.DbBackup; -import org.hsqldb.lib.tar.TarMalformatException; -import org.hsqldb.result.Result; -import org.hsqldb.scriptio.ScriptWriterBase; -import org.hsqldb.scriptio.ScriptWriterText; -import org.hsqldb.types.RowType; -import org.hsqldb.types.Type; - -// campbell-burnet@users 20030510 - patch 1.7.2 - added cooperative file locking - -/** - * The public interface of persistence and logging classes.

    - * - * Implements a storage manager wrapper that provides a consistent, - * always available interface to storage management for the Database - * class, despite the fact not all Database objects actually use file - * storage.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.7.0 - */ -public class Logger implements EventLogInterface { - - public SimpleLog appLog; - public SimpleLog sqlLog; - - // - FrameworkLogger fwLogger; - FrameworkLogger sqlLogger; - - // - private Database database; - private boolean logsStatements; // false indicates Log is being opened - private boolean loggingEnabled; - - // - private boolean propIsFileDatabase; - boolean propNioDataFile; - long propNioMaxSize = 256 * 1024 * 1024L; - int propMaxFreeBlocks = 512; - private int propCacheMaxRows; - private long propCacheMaxSize; - int propDataFileDefragLimit; - private int propDataFileScale; - int propDataFileSpace; - String propTextSourceDefault = ""; - boolean propTextAllowFullPath; - private int propWriteDelay; - private int propLogSize; - private boolean propLogData = true; - private int propExternalEventLogLevel; - private int propEventLogLevel; - int propSqlLogLevel; - int propGC; - int propTxMode = TransactionManager.LOCKS; - boolean propRefIntegrity = true; - int propLobBlockSize = 32 * 1024; - boolean propCompressLobs; - int propScriptFormat = 0; - boolean propLargeData; - long propFilesTimestamp; - - // - Log log; - private LockFile lockFile; - private Crypto crypto; - boolean cryptLobs; - public FileAccess fileAccess; - String tempDirectoryPath; - - // - public TextTableStorageManager textTableManager = - new TextTableStorageManager(); - - // - public boolean isNewDatabase; - - // - public boolean isSingleFile; - - // - AtomicInteger backupState = new AtomicInteger(); - AtomicInteger checkpointState = new AtomicInteger(); - - // - long maxLogSize; - - // - static final int largeDataFactor = 128; - - // backupState cycle normal, backup, normal or normal, checkpoint, normal - static final int stateNormal = 0; - static final int stateBackup = 1; - static final int stateCheckpoint = 2; - - // checkpointState cycle normal, required, due, normal - static final int stateCheckpointNormal = 0; - static final int stateCheckpointRequired = 1; - static final int stateCheckpointDue = 2; - - // - public static final String oldFileExtension = ".old"; - public static final String newFileExtension = ".new"; - public static final String appLogFileExtension = ".app.log"; - public static final String sqlLogFileExtension = ".sql.log"; - public static final String logFileExtension = ".log"; - public static final String scriptFileExtension = ".script"; - public static final String propertiesFileExtension = ".properties"; - public static final String dataFileExtension = ".data"; - public static final String backupFileExtension = ".backup"; - public static final String lobsFileExtension = ".lobs"; - public static final String lockFileExtension = ".lck"; - - public Logger(Database database) { - this.database = database; - } - - /** - * Opens the specified Database object's database files and starts up - * the logging process.

    - * - * If the specified Database object is a new database, its database - * files are first created. - * - * @throws org.hsqldb.HsqlException if there is a problem, such as the case when - * the specified files are in use by another process - */ - public void open() { - - boolean hasFileProps = false; - boolean hasScript = false; - - fileAccess = FileUtil.getFileAccess(database.isFilesInJar()); - propIsFileDatabase = database.getType().isFileBased(); - database.databaseProperties = new HsqlDatabaseProperties(database); - propTextAllowFullPath = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.textdb_allow_full_path); - - if (propIsFileDatabase) { - hasFileProps = database.databaseProperties.load(); - hasScript = fileAccess.isStreamElement(database.getPath() - + scriptFileExtension); - - boolean version18 = database.databaseProperties.isVersion18(); - - if (version18) { - throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION, - "unsupported old database version"); - } - - boolean exists = hasScript; - - if (!exists) { - exists = fileAccess.isStreamElement(database.getPath() - + scriptFileExtension - + Logger.newFileExtension); - - if (exists) { - database.databaseProperties.setDBModified( - HsqlDatabaseProperties.FILES_MODIFIED_NEW); - } else { - exists = fileAccess.isStreamElement(database.getPath() - + dataFileExtension); - - if (exists) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, - "database files not complete"); - } - - exists = fileAccess.isStreamElement(database.getPath() - + backupFileExtension); - - if (exists) { - throw Error.error(ErrorCode.DATA_FILE_ERROR, - "database files not complete"); - } - } - } - - isNewDatabase = !exists; - } else { - isNewDatabase = true; - } - - if (isNewDatabase) { - String name = newUniqueName(); - - database.setDatabaseName(name); - - boolean checkExists = database.isFilesInJar(); - - checkExists |= - (database.urlProperties - .isPropertyTrue(HsqlDatabaseProperties - .url_ifexists) || !database.urlProperties - .isPropertyTrue(HsqlDatabaseProperties - .url_create, true)); - - if (checkExists) { - throw Error.error(ErrorCode.DATABASE_NOT_EXISTS, - database.getPath()); - } - - database.databaseProperties.setURLProperties( - database.urlProperties); - } else { - if (!hasFileProps) { - database.databaseProperties.setDBModified( - HsqlDatabaseProperties.FILES_MODIFIED); - } - - // properties that also apply to existing database only if they exist - if (database.urlProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_files_readonly)) { - database.databaseProperties.setProperty( - HsqlDatabaseProperties.hsqldb_files_readonly, true); - } - - if (database.urlProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_readonly)) { - database.databaseProperties.setProperty( - HsqlDatabaseProperties.hsqldb_readonly, true); - } - - // hsqldb.lock_file=false is applied - if (!database.urlProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_lock_file, true)) { - database.databaseProperties.setProperty( - HsqlDatabaseProperties.hsqldb_lock_file, false); - } - } - - setVariables(); - - String appLogPath = null; - String sqlLogPath = null; - - if (propIsFileDatabase && !database.isFilesReadOnly()) { - appLogPath = database.getPath() + appLogFileExtension; - sqlLogPath = database.getPath() + sqlLogFileExtension; - } - - appLog = new SimpleLog(appLogPath, propEventLogLevel, false); - sqlLog = new SimpleLog(sqlLogPath, propSqlLogLevel, true); - - database.setReferentialIntegrity(propRefIntegrity); - - if (!isFileDatabase()) { - return; - } - - checkpointState.set(stateCheckpointNormal); - - logsStatements = false; - - boolean useLock = database.getProperties().isPropertyTrue( - HsqlDatabaseProperties.hsqldb_lock_file); - - if (useLock && !database.isFilesReadOnly()) { - acquireLock(database.getPath()); - } - - log = new Log(database); - - log.open(); - - logsStatements = true; - loggingEnabled = propLogData && !database.isFilesReadOnly(); - - if (database.getNameString().isEmpty()) { - database.setDatabaseName(newUniqueName()); - } - - // URL database properties that can override .script file settings - int level = database.urlProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_applog, -1); - - if (level >= 0) { - setEventLogLevel(level, false); - } - - level = database.urlProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_extlog, -1); - - if (level >= 0) { - setExternalEventLogLevel(level); - } - - level = database.urlProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_sqllog, -1); - - if (level >= 0) { - setEventLogLevel(level, true); - } - } - - private void setVariables() { - - String cryptKey = database.urlProperties.getProperty( - HsqlDatabaseProperties.url_crypt_key); - - if (cryptKey != null) { - String cryptType = database.urlProperties.getProperty( - HsqlDatabaseProperties.url_crypt_type); - String cryptProvider = database.urlProperties.getProperty( - HsqlDatabaseProperties.url_crypt_provider); - String cryptIv = database.urlProperties.getProperty( - HsqlDatabaseProperties.url_crypt_iv); - - crypto = new Crypto(cryptKey, cryptIv, cryptType, cryptProvider); - cryptLobs = database.urlProperties.isPropertyTrue( - HsqlDatabaseProperties.url_crypt_lobs, true); - } - - if (database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_readonly)) { - database.setReadOnly(); - } - - if (database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_files_readonly)) { - database.setFilesReadOnly(); - } - - // handle invalid paths as well as access issues - if (!database.isFilesReadOnly()) { - if (database.getType() == DatabaseType.DB_MEM) { - tempDirectoryPath = database.getProperties().getStringProperty( - HsqlDatabaseProperties.hsqldb_temp_directory); - } else { - tempDirectoryPath = database.getPath() + ".tmp"; - } - - if (tempDirectoryPath != null) { - tempDirectoryPath = - FileUtil.makeDirectories(tempDirectoryPath); - } - } - - propScriptFormat = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_script_format); - propMaxFreeBlocks = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_cache_free_count); - propMaxFreeBlocks = ArrayUtil.getTwoPowerFloor(propMaxFreeBlocks); - - if (database.urlProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_large_data, false)) { - propLargeData = true; - } - - if (!database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_pad_space, true)) { - database.collation.setPadding(false); - } - - String temp = database.getProperties().getStringProperty( - HsqlDatabaseProperties.hsqldb_digest); - - database.granteeManager.setDigestAlgo(temp); - - if (!isNewDatabase) { - return; - } - - if (tempDirectoryPath != null) { - int rows = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_result_max_memory_rows); - - database.setResultMaxMemoryRows(rows); - } - - String tableType = database.databaseProperties.getStringProperty( - HsqlDatabaseProperties.hsqldb_default_table_type); - - if (Tokens.T_CACHED.equalsIgnoreCase(tableType)) { - database.schemaManager.setDefaultTableType(TableBase.CACHED_TABLE); - } - - String txMode = database.databaseProperties.getStringProperty( - HsqlDatabaseProperties.hsqldb_tx); - - if (Tokens.T_MVCC.equalsIgnoreCase(txMode)) { - propTxMode = TransactionManager.MVCC; - } else if (Tokens.T_MVLOCKS.equalsIgnoreCase(txMode)) { - propTxMode = TransactionManager.MVLOCKS; - } else if (Tokens.T_LOCKS.equalsIgnoreCase(txMode)) { - propTxMode = TransactionManager.LOCKS; - } - - switch (propTxMode) { - - case TransactionManager.LOCKS : - break; - - case TransactionManager.MVLOCKS : - database.txManager = new TransactionManagerMV2PL(database); - break; - - case TransactionManager.MVCC : - database.txManager = new TransactionManagerMVCC(database); - break; - } - - String txLevel = database.databaseProperties.getStringProperty( - HsqlDatabaseProperties.hsqldb_tx_level); - - if (Tokens.T_SERIALIZABLE.equalsIgnoreCase(txLevel)) { - database.defaultIsolationLevel = SessionInterface.TX_SERIALIZABLE; - } else { - database.defaultIsolationLevel = - SessionInterface.TX_READ_COMMITTED; - } - - database.txConflictRollback = - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_tx_conflict_rollback); - database.txInterruptRollback = - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_tx_interrupt_rollback); - database.sqlRestrictExec = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_restrict_exec); - database.sqlEnforceNames = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_enforce_names); - database.sqlRegularNames = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_regular_names); - database.sqlEnforceRefs = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_enforce_refs); - database.sqlEnforceSize = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_enforce_size); - database.sqlEnforceTypes = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_enforce_types); - database.sqlEnforceTDCD = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_enforce_tdcd); - database.sqlEnforceTDCU = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_enforce_tdcu); - database.sqlTranslateTTI = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.jdbc_translate_tti_types); - database.sqlLiveObject = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_live_object); - database.sqlCharLiteral = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_char_literal); - database.sqlConcatNulls = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_concat_nulls); - database.sqlNullsFirst = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_nulls_first); - database.sqlNullsOrder = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_nulls_order); - database.sqlUniqueNulls = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_unique_nulls); - database.sqlConvertTruncate = - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_convert_trunc); - database.sqlTruncateTrailing = - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_trunc_trailing); - database.sqlAvgScale = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.sql_avg_scale); - database.sqlMaxRecursive = - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.sql_max_recursive); - database.sqlDoubleNaN = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_double_nan); - database.sqlLongvarIsLob = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_longvar_is_lob); - database.sqlIgnoreCase = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_ignore_case); - database.sqlSyntaxDb2 = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_syntax_db2); - database.sqlSyntaxMss = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_syntax_mss); - database.sqlSyntaxMys = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_syntax_mys); - database.sqlSyntaxOra = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_syntax_ora); - database.sqlSyntaxPgs = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_syntax_pgs); - database.sqlSysIndexNames = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_sys_index_names); - database.sqlLowerCaseIdentifier = - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_lowercase_ident); - - if (database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_compare_in_locale)) { - database.collation.setCollationAsLocale(); - } - - propEventLogLevel = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_applog); - propExternalEventLogLevel = - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_extlog); - propSqlLogLevel = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_sqllog); - - if (database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_files_readonly)) { - database.setFilesReadOnly(); - } - - if (database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_readonly)) { - database.setReadOnly(); - } - - propNioDataFile = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_nio_data_file); - propNioMaxSize = - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_nio_max_size) * 1024L * 1024L; - propCacheMaxRows = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_cache_rows); - propCacheMaxSize = - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_cache_size) * 1024L; - - setLobFileScaleNoCheck( - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_lob_file_scale)); - setLobFileCompressedNoCheck( - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_lob_file_compressed)); - setDataFileScaleNoCheck( - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_cache_file_scale)); - - // linked with above FILES SCALE - boolean fileSpace = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_files_space); - - setDataFileSpace(fileSpace); - - propDataFileDefragLimit = - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_defrag_limit); - propWriteDelay = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_write_delay_millis); - - if (!database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_write_delay)) { - propWriteDelay = 0; - } - - setLogSize( - database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.hsqldb_log_size)); - - propLogData = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_log_data); - propGC = database.databaseProperties.getIntegerProperty( - HsqlDatabaseProperties.runtime_gc_interval); - propRefIntegrity = database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.sql_ref_integrity); - } - -// fredt@users 20020130 - patch 495484 by campbell-burnet@users - - /** - * Shuts down the logging process using the specified mode.

    - * - * @param closemode The mode in which to shut down the logging - * process - *

      - *
    1. CLOSEMODE_IMMEDIATELY performs SHUTDOWN IMMEDIATELY, equivalent - * to a poweroff or crash. - *
    2. CLOSEMODE_NORMAL performs a normal SHUTDOWN that - * checkpoints the database normally. - *
    3. CLOSEMODE_COMPACT performs a shutdown compact that scripts - * out the contents of any CACHED tables to the log then - * deletes the existing *.data file that contains the data - * for all CACHED table before the normal checkpoint process - * which in turn creates a new, compact *.data file. - *
    4. CLOSEMODE_SCRIPT performs a SHUTDOWN SCRIPT. - *
    - * - * @return true if closed with no problems or false if a problem was - * encountered. - */ - public boolean close(int closemode) { - - boolean result = true; - - if (log == null) { - textTableManager.closeAllTextCaches(false); - - return true; - } - - log.synchLog(); - database.lobManager.synch(); - - try { - switch (closemode) { - - case Database.CLOSEMODE_IMMEDIATELY : - log.closeImmediately(); - break; - - case Database.CLOSEMODE_NORMAL : - log.close(false); - break; - - case Database.CLOSEMODE_COMPACT : - case Database.CLOSEMODE_SCRIPT : - log.close(true); - break; - } - - database.persistentStoreCollection.release(); - } catch (Throwable e) { - database.logger.logSevereEvent("error closing log", e); - - result = false; - } - - logInfoEvent("Database closed"); - - log = null; - - appLog.close(); - sqlLog.close(); - - logsStatements = false; - loggingEnabled = false; - - return result; - } - - String newUniqueName() { - - String name = StringUtil.toPaddedString( - Long.toHexString(System.currentTimeMillis()), 16, '0', false); - - name = "HSQLDB" + name.substring(6).toUpperCase(Locale.ENGLISH); - - return name; - } - - /* - * Must return correct mode prior to initialisation - * @return true if this object encapsulates a non-null Log instance, - * else false - */ - public boolean isLogged() { - return propIsFileDatabase && !database.isFilesReadOnly(); - } - - public boolean isCurrentlyLogged() { - return loggingEnabled; - } - - public boolean isAllowedFullPath() { - return propTextAllowFullPath; - } - - /** - * All usage of FrameworkLogger should call this method before using an - * instance. - * - * It ensures and requires that no logging should take place before a new - * database unique name has been created for a new database or read from the - * .script file for an old database.

    - * - * An instance is returned when: - * - database unique name has been created - * - FrameworkLogger would use log4j - * - * Otherwise null is returned. - * - * This tactic avoids usage of file-based jdk logging for the time being. - * - */ - private void getEventLogger() { - - if (fwLogger != null) { - return; - } - - String name = database.getNameString(); - - if (name.isEmpty()) { - - // The database unique name is set up at different times - // depending on upgraded / exiting / new databases. - // Therefore FrameworkLogger is not used until the unique - // name is known. - return; - } - - fwLogger = FrameworkLogger.getLog(SimpleLog.logTypeNameEngine, - "hsqldb.db." - + database.getNameString()); - /* - sqlLogger = FrameworkLogger.getLog(SimpleLog.logTypeNameEngine, - "hsqldb.sql." - + database.getUniqueName()); - */ - } - - public void setEventLogLevel(int level, boolean logSql) { - - if (level < SimpleLog.LOG_NONE || level > SimpleLog.LOG_RESULT) { - throw Error.error(ErrorCode.X_42556); - } - - if (logSql) { - propSqlLogLevel = level; - - sqlLog.setLevel(level); - } else { - propEventLogLevel = level; - - appLog.setLevel(level); - } - } - - public void setExternalEventLogLevel(int level) { - - if (level < SimpleLog.LOG_NONE || level > SimpleLog.LOG_DETAIL) { - throw Error.error(ErrorCode.X_42556); - } - - propExternalEventLogLevel = level; - } - - public void logSevereEvent(String message, Throwable t) { - - getEventLogger(); - - if (fwLogger != null) { - if (propExternalEventLogLevel >= SimpleLog.LOG_ERROR) { - fwLogger.severe(message, t); - } - } - - if (appLog != null) { - if (t == null) { - appLog.logContext(SimpleLog.LOG_ERROR, message); - } else { - appLog.logContext(t, message, SimpleLog.LOG_ERROR); - } - } - } - - public void logWarningEvent(String message, Throwable t) { - - getEventLogger(); - - if (fwLogger != null) { - if (propExternalEventLogLevel >= SimpleLog.LOG_WARNING) { - fwLogger.warning(message, t); - } - } - - appLog.logContext(t, message, SimpleLog.LOG_WARNING); - } - - public void logInfoEvent(String message) { - - getEventLogger(); - - if (fwLogger != null) { - if (propExternalEventLogLevel >= SimpleLog.LOG_NORMAL) { - fwLogger.info(message); - } - } - - appLog.logContext(SimpleLog.LOG_NORMAL, message); - } - - public void logDetailEvent(String message) { - - getEventLogger(); - - if (fwLogger != null) { - if (propExternalEventLogLevel >= SimpleLog.LOG_DETAIL) { - fwLogger.finest(message); - } - } - - if (appLog != null) { - appLog.logContext(SimpleLog.LOG_DETAIL, message); - } - } - - public void logStatementEvent(Session session, Statement statement, - Object[] paramValues, Result result, - int level) { - - if (sqlLog != null && level <= propSqlLogLevel) { - String sessionId = Long.toString(session.getId()); - String sql = statement.getSQL(); - String values = ""; - int paramLength = 0; - - if (propSqlLogLevel < SimpleLog.LOG_DETAIL) { - if (sql.length() > 256) { - sql = sql.substring(0, 256); - } - - paramLength = 32; - } - - if (paramValues != null && paramValues.length > 0) { - values = RowType.convertToSQLString( - paramValues, - statement.getParametersMetaData().getParameterTypes(), - paramLength); - } - - if (propSqlLogLevel == SimpleLog.LOG_RESULT) { - StringBuilder sb = new StringBuilder(values); - - sb.append(' ').append('['); - - if (result.isError()) { - sb.append(result.getErrorCode()); - } else if (result.isData()) { - sb.append(result.getNavigator().getSize()); - } else if (result.isUpdateCount()) { - sb.append(result.getUpdateCount()); - } - - sb.append(']'); - - values = sb.toString(); - } - - sqlLog.logContext(level, sessionId, sql, values); - } - } - - public int getSqlEventLogLevel() { - return propSqlLogLevel; - } - - /** - * Returns the Cache object or null if one doesn't exist. - */ - public DataFileCache getCache() { - - if (log == null) { - return null; - } else { - return log.getCache(); - } - } - - /** - * Returns true if Cache object exists. - */ - public boolean hasCache() { - - if (log == null) { - return false; - } else { - return log.hasCache(); - } - } - - /** - * Records a Log entry for the specified SQL statement, on behalf of - * the specified Session object. - */ - public synchronized void writeOtherStatement(Session session, - String statement) { - - if (loggingEnabled) { - log.writeOtherStatement(session, statement); - } - } - - /** - * Used exclusively by PersistentStore objects - */ - public synchronized void writeInsertStatement(Session session, Row row, - Table table) { - - if (loggingEnabled) { - log.writeInsertStatement(session, row, table); - } - } - - /** - * Used exclusively by PersistentStore objects - */ - public synchronized void writeDeleteStatement(Session session, Table t, - Object[] row) { - - if (loggingEnabled) { - log.writeDeleteStatement(session, t, row); - } - } - - /** - * Used at transaction commit - */ - public synchronized void writeSequenceStatement(Session session, - NumberSequence s) { - - if (loggingEnabled) { - log.writeSequenceStatement(session, s); - } - } - - /** - * Used at transaction commit - */ - public synchronized void writeCommitStatement(Session session) { - - if (loggingEnabled) { - log.writeCommitStatement(session); - } else { - if (maxLogSize > 0 - && database.lobManager.getUsageChanged() > maxLogSize) { - setCheckpointRequired(); - } - } - } - - public synchronized void synchLog() { - - if (loggingEnabled) { - log.synchLog(); - } - } - - /** - * Checkpoints the database.

    - * - * The most important effect of calling this method is to cause the - * log file to be rewritten in the most efficient form to - * reflect the current state of the database, i.e. only the DDL and - * insert DML required to recreate the database in its present state. - * Other house-keeping duties are performed w.r.t. other database - * files, in order to ensure as much as possible the ACID properties - * of the database. - * - * @throws org.hsqldb.HsqlException if there is a problem checkpointing the - * database - */ - public void checkpoint(Session session, boolean defrag, boolean lobs) { - - if (!backupState.compareAndSet(stateNormal, stateCheckpoint)) { - throw Error.error(ErrorCode.ACCESS_IS_DENIED); - } - - database.lobManager.lock(); - - try { - synchronized (this) { - checkpointInternal(session, defrag); - - if (lobs) { - Result result = database.lobManager.deleteUnusedLobs(); - - if (log != null && result.getUpdateCount() > 0) { - log.synchLog(); - logDetailEvent("Deleted unused LOBs, count: " - + result.getUpdateCount()); - } - } - } - } finally { - backupState.set(stateNormal); - checkpointState.set(stateCheckpointNormal); - database.lobManager.unlock(); - } - } - - private void checkpointInternal(Session session, boolean defrag) { - - if (logsStatements) { - logInfoEvent("Checkpoint start"); - log.checkpoint(session, defrag); - logInfoEvent("Checkpoint end - txts: " - + database.txManager.getSystemChangeNumber()); - } - } - - /** - * Sets the maximum size to which the log file can grow - * before being automatically checkpointed. - * - * @param megas size in MB - */ - public synchronized void setLogSize(int megas) { - - propLogSize = megas; - maxLogSize = propLogSize * 1024L * 1024; - - if (log != null) { - log.setLogSize(propLogSize); - } - } - - /** - * Sets logging on or off. - */ - public synchronized void setLogData(boolean mode) { - - propLogData = mode; - loggingEnabled = propLogData && !database.isFilesReadOnly(); - loggingEnabled &= logsStatements; - } - - /** - * Sets the type of script file, currently 0 for text (default) - * 3 for compressed - * - * @param format The type - */ - public synchronized void setScriptType(int format) { - - if (format == propScriptFormat) { - return; - } - - propScriptFormat = format; - - checkpointState.compareAndSet(stateCheckpointNormal, - stateCheckpointRequired); - } - - /** - * Sets the log write delay mode to number of seconds. By default - * executed commands written to the log are committed fully at most - * 0.5 second after they are executed. This improves performance for - * applications that execute a large number - * of short running statements in a short period of time, but risks - * failing to log some possibly large number of statements in the - * event of a crash. A small value improves recovery. - * A value of 0 will severly slow down logging when autocommit is on, - * or many short transactions are committed. - * - * @param delay in milliseconds - */ - public synchronized void setWriteDelay(int delay) { - - propWriteDelay = delay; - - if (log != null) { - log.setWriteDelay(delay); - } - } - - public Crypto getCrypto() { - return crypto; - } - - public int getWriteDelay() { - return propWriteDelay; - } - - public int getLogSize() { - return propLogSize; - } - - public int getLobBlockSize() { - return propLobBlockSize; - } - - public void setCacheMaxRows(int value) { - propCacheMaxRows = value; - } - - public int getCacheMaxRows() { - return propCacheMaxRows; - } - - public void setCacheSize(int value) { - propCacheMaxSize = value * 1024L; - } - - public long getCacheSize() { - return propCacheMaxSize; - } - - public void setDataFileScale(int value) { - - if (value < 16) { - throw Error.error(ErrorCode.X_42556); - } - - setDataFileScaleNoCheck(value); - } - - public void setDataFileScaleNoCheck(int value) { - - checkPower(value, 10); - - if (value < 8 && value != 1) { - throw Error.error(ErrorCode.X_42556); - } - - propDataFileScale = value; - - if (propDataFileSpace > 0) { - propDataFileSpace = propDataFileScale / 16; // change to default - } - } - - public int getDataFileScale() { - return propDataFileScale; - } - - public int getDataFileFactor() { - return propLargeData ? largeDataFactor - : 1; - } - - public void setDataFileSpace(boolean value) { - - if (value) { - setDataFileSpace(propDataFileScale / 16); - } else { - setDataFileSpace(0); - } - } - - public void setDataFileSpace(int value) { - - if (value != 0) { - checkPower(value, 6); - } - - if (value > propDataFileScale / 16) { - value = propDataFileScale / 16; - } - - propDataFileSpace = value; - } - - public int getDataFileSpace() { - return propDataFileSpace; - } - - public long getFilesTimestamp() { - return propFilesTimestamp; - } - - public void setFilesTimestamp(long value) { - propFilesTimestamp = value; - } - - public void setLobFileScale(int value) { - - if (propLobBlockSize == value * 1024) { - return; - } - - checkPower(value, 5); - - if (database.lobManager.getLobCount() > 0) { - throw Error.error(ErrorCode.DATA_FILE_IN_USE); - } - - propLobBlockSize = value * 1024; - - database.lobManager.close(); - database.lobManager.open(); - } - - public void setLobFileScaleNoCheck(int value) { - - checkPower(value, 5); - - propLobBlockSize = value * 1024; - } - - public int getLobFileScale() { - return propLobBlockSize / 1024; - } - - public void setLobFileCompressed(boolean value) { - - if (propCompressLobs == value) { - return; - } - - if (database.lobManager.getLobCount() > 0) { - throw Error.error(ErrorCode.DATA_FILE_IN_USE); - } - - propCompressLobs = value; - - database.lobManager.close(); - database.lobManager.open(); - } - - public void setLobFileCompressedNoCheck(boolean value) { - propCompressLobs = value; - } - - public void setDefagLimit(int value) { - - if (value > 0 && value < 25) { - value = 25; - } - - propDataFileDefragLimit = value; - } - - public int getDefragLimit() { - return propDataFileDefragLimit; - } - - public void setDefaultTextTableProperties(String source, - HsqlProperties props) { - - props.setProperty(HsqlDatabaseProperties.url_check_props, true); - database.getProperties().setURLProperties(props); - - propTextSourceDefault = source; - } - - public void setNioDataFile(boolean value) { - propNioDataFile = value; - } - - public void setNioMaxSize(int value) { - - value = ArrayUtil.getTwoPowerFloor(value); - - if (value < 64) { - value = 64; - } - - propNioMaxSize = value * 1024L * 1024L; - } - - public FileAccess getFileAccess() { - return fileAccess; - } - - public boolean isFileDatabase() { - return propIsFileDatabase; - } - - public String getTempDirectoryPath() { - return tempDirectoryPath; - } - - static void checkPower(int n, int max) { - - if (!ArrayUtil.isTwoPower(n, max)) { - throw Error.error(ErrorCode.X_42556); - } - } - - public void setCheckpointRequired() { - checkpointState.compareAndSet(stateCheckpointNormal, - stateCheckpointRequired); - } - - public boolean needsCheckpointReset() { - return checkpointState.compareAndSet(stateCheckpointRequired, - stateCheckpointDue); - } - - public boolean hasLockFile() { - return lockFile != null; - } - - public void acquireLock(String path) { - - if (lockFile != null) { - return; - } - - lockFile = LockFile.newLockFileLock(path); - } - - public void releaseLock() { - - try { - if (lockFile != null) { - lockFile.tryRelease(); - } - } catch (Exception e) {} - - lockFile = null; - } - - public PersistentStore newStore(Session session, - PersistentStoreCollection collection, - TableBase table) { - - switch (table.getTableType()) { - - case TableBase.CACHED_TABLE : - DataFileCache cache = getCache(); - - if (cache == null) { - break; - } - - return new RowStoreAVLDisk(cache, (Table) table); - - case TableBase.MEMORY_TABLE : - case TableBase.SYSTEM_TABLE : - return new RowStoreAVLMemory((Table) table); - - case TableBase.TEXT_TABLE : - return new RowStoreAVLDiskData((Table) table); - - case TableBase.INFO_SCHEMA_TABLE : - return new RowStoreAVLHybridExtended(session, table, false); - - case TableBase.TEMP_TABLE : - return new RowStoreAVLHybridExtended(session, table, true); - - case TableBase.CHANGE_SET_TABLE : - return new RowStoreDataChange(session, table); - - case TableBase.FUNCTION_TABLE : - case TableBase.RESULT_TABLE : - case TableBase.SYSTEM_SUBQUERY : - case TableBase.VIEW_TABLE : - case TableBase.TRANSITION_TABLE : - if (session == null) { - return null; - } - - return new RowStoreAVLHybrid(session, table, true); - } - - throw Error.runtimeError(ErrorCode.U_S0500, "Logger"); - } - - public Index newIndex(HsqlName name, long id, TableBase table, - int[] columns, boolean[] descending, - boolean[] nullsLast, Type[] colTypes, boolean pk, - boolean unique, boolean constraint, - boolean forward) { - - switch (table.getTableType()) { - - case TableBase.INFO_SCHEMA_TABLE : - case TableBase.SYSTEM_TABLE : - case TableBase.MEMORY_TABLE : - return new IndexAVLMemory(name, id, table, columns, - descending, nullsLast, colTypes, pk, - unique, constraint, forward); - - case TableBase.CACHED_TABLE : - case TableBase.CHANGE_SET_TABLE : - case TableBase.FUNCTION_TABLE : - case TableBase.TEXT_TABLE : - case TableBase.TEMP_TABLE : - case TableBase.RESULT_TABLE : - case TableBase.SYSTEM_SUBQUERY : - case TableBase.VIEW_TABLE : - case TableBase.TRANSITION_TABLE : - return new IndexAVL(name, id, table, columns, descending, - nullsLast, colTypes, pk, unique, - constraint, forward); - } - - throw Error.runtimeError(ErrorCode.U_S0500, "Logger"); - } - - public HashMap getPropertyValueMap(Session session) { - - HashMap map = new HashMap(); - String value = null; - - map.put(HsqlDatabaseProperties.sql_avg_scale, - String.valueOf(database.sqlAvgScale)); - map.put(HsqlDatabaseProperties.sql_char_literal, - String.valueOf(database.sqlCharLiteral)); - map.put(HsqlDatabaseProperties.sql_concat_nulls, - String.valueOf(database.sqlConcatNulls)); - map.put(HsqlDatabaseProperties.sql_convert_trunc, - String.valueOf(database.sqlConvertTruncate)); - map.put(HsqlDatabaseProperties.sql_default_collation, - String.valueOf(database.collation.getName().name)); - map.put(HsqlDatabaseProperties.sql_trunc_trailing, - String.valueOf(database.sqlTruncateTrailing)); - map.put(HsqlDatabaseProperties.sql_double_nan, - String.valueOf(database.sqlDoubleNaN)); - map.put(HsqlDatabaseProperties.sql_enforce_names, - String.valueOf(database.sqlEnforceNames)); - map.put(HsqlDatabaseProperties.sql_enforce_refs, - String.valueOf(database.sqlEnforceRefs)); - map.put(HsqlDatabaseProperties.sql_enforce_size, - String.valueOf(database.sqlEnforceSize)); - map.put(HsqlDatabaseProperties.sql_enforce_tdcd, - String.valueOf(database.sqlEnforceTDCD)); - map.put(HsqlDatabaseProperties.sql_enforce_tdcu, - String.valueOf(database.sqlEnforceTDCU)); - map.put(HsqlDatabaseProperties.sql_enforce_types, - String.valueOf(database.sqlEnforceTypes)); - map.put(HsqlDatabaseProperties.sql_ignore_case, - String.valueOf(database.sqlIgnoreCase)); - map.put(HsqlDatabaseProperties.sql_live_object, - String.valueOf(database.sqlLiveObject)); - map.put(HsqlDatabaseProperties.sql_longvar_is_lob, - String.valueOf(database.sqlLongvarIsLob)); - map.put(HsqlDatabaseProperties.sql_lowercase_ident, - String.valueOf(database.sqlLowerCaseIdentifier)); - map.put(HsqlDatabaseProperties.sql_max_recursive, - String.valueOf(database.sqlMaxRecursive)); - map.put(HsqlDatabaseProperties.sql_nulls_first, - String.valueOf(database.sqlNullsFirst)); - map.put(HsqlDatabaseProperties.sql_nulls_order, - String.valueOf(database.sqlNullsOrder)); - map.put(HsqlDatabaseProperties.sql_pad_space, - String.valueOf(database.collation.isPadSpace())); - map.put(HsqlDatabaseProperties.sql_ref_integrity, - String.valueOf(database.isReferentialIntegrity())); - map.put(HsqlDatabaseProperties.sql_regular_names, - String.valueOf(database.sqlRegularNames)); - map.put(HsqlDatabaseProperties.sql_restrict_exec, - String.valueOf(database.sqlRestrictExec)); - map.put(HsqlDatabaseProperties.sql_syntax_db2, - String.valueOf(database.sqlSyntaxDb2)); - map.put(HsqlDatabaseProperties.sql_syntax_mss, - String.valueOf(database.sqlSyntaxMss)); - map.put(HsqlDatabaseProperties.sql_syntax_mys, - String.valueOf(database.sqlSyntaxMys)); - map.put(HsqlDatabaseProperties.sql_syntax_ora, - String.valueOf(database.sqlSyntaxOra)); - map.put(HsqlDatabaseProperties.sql_syntax_pgs, - String.valueOf(database.sqlSyntaxPgs)); - map.put(HsqlDatabaseProperties.sql_sys_index_names, - String.valueOf(database.sqlSysIndexNames)); - map.put(HsqlDatabaseProperties.sql_unique_nulls, - String.valueOf(database.sqlUniqueNulls)); - - // - map.put(HsqlDatabaseProperties.jdbc_translate_tti_types, - String.valueOf(database.sqlTranslateTTI)); - - switch (database.txManager.getTransactionControl()) { - - case TransactionManager.MVCC : - value = Tokens.T_MVCC; - break; - - case TransactionManager.MVLOCKS : - value = Tokens.T_MVLOCKS; - break; - - case TransactionManager.LOCKS : - value = Tokens.T_LOCKS; - break; - } - - map.put(HsqlDatabaseProperties.hsqldb_tx, value); - - switch (database.defaultIsolationLevel) { - - case SessionInterface.TX_READ_COMMITTED : - value = new StringBuilder(Tokens.T_READ).append('_').append( - Tokens.T_COMMITTED).toString(); - break; - - case SessionInterface.TX_SERIALIZABLE : - value = Tokens.T_SERIALIZABLE; - break; - } - - map.put(HsqlDatabaseProperties.hsqldb_tx_level, value); - map.put( - HsqlDatabaseProperties.hsqldb_reconfig_logging, - System.getProperty( - HsqlDatabaseProperties.hsqldb_reconfig_logging)); - - if (HsqlDatabaseProperties.methodClassNames != null) { - map.put(HsqlDatabaseProperties.hsqldb_method_class_names, - HsqlDatabaseProperties.methodClassNames); - } - - map.put(HsqlDatabaseProperties.hsqldb_applog, - String.valueOf(appLog.getLevel())); - map.put(HsqlDatabaseProperties.hsqldb_extlog, - String.valueOf(propExternalEventLogLevel)); - map.put(HsqlDatabaseProperties.hsqldb_sqllog, - String.valueOf(sqlLog.getLevel())); - map.put(HsqlDatabaseProperties.hsqldb_lob_file_scale, - String.valueOf(propLobBlockSize / 1024)); - map.put(HsqlDatabaseProperties.hsqldb_lob_file_compressed, - String.valueOf(propCompressLobs)); - map.put(HsqlDatabaseProperties.hsqldb_cache_file_scale, - String.valueOf(propDataFileScale)); - map.put(HsqlDatabaseProperties.hsqldb_cache_free_count, - String.valueOf(propMaxFreeBlocks)); - map.put(HsqlDatabaseProperties.hsqldb_cache_rows, - String.valueOf(propCacheMaxRows)); - map.put(HsqlDatabaseProperties.hsqldb_cache_size, - String.valueOf(propCacheMaxSize / 1024)); - - { - String prop; - - switch (database.schemaManager.getDefaultTableType()) { - - case TableBase.CACHED_TABLE : - prop = Tokens.T_CACHED; - break; - - case TableBase.MEMORY_TABLE : - default : - prop = Tokens.T_MEMORY; - } - - map.put(HsqlDatabaseProperties.hsqldb_default_table_type, prop); - } - - map.put(HsqlDatabaseProperties.hsqldb_defrag_limit, - String.valueOf(propDataFileDefragLimit)); - map.put(HsqlDatabaseProperties.hsqldb_files_space, - String.valueOf(propDataFileSpace)); - map.put( - HsqlDatabaseProperties.hsqldb_files_readonly, - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_files_readonly) ? "true" - : "false"); - map.put(HsqlDatabaseProperties.hsqldb_large_data, - String.valueOf(propLargeData)); - map.put( - HsqlDatabaseProperties.hsqldb_lock_file, - database.databaseProperties.isPropertyTrue( - HsqlDatabaseProperties.hsqldb_lock_file) ? "true" - : "false"); - map.put(HsqlDatabaseProperties.hsqldb_log_data, - String.valueOf(propLogData)); - map.put(HsqlDatabaseProperties.hsqldb_log_size, - String.valueOf(propLogSize)); - map.put(HsqlDatabaseProperties.hsqldb_nio_data_file, - String.valueOf(propNioDataFile)); - map.put(HsqlDatabaseProperties.hsqldb_nio_max_size, - String.valueOf(propNioMaxSize / (1024 * 1024))); - map.put(HsqlDatabaseProperties.hsqldb_script_format, - ScriptWriterBase.LIST_SCRIPT_FORMATS[propScriptFormat] - .toLowerCase()); - map.put(HsqlDatabaseProperties.hsqldb_temp_directory, - tempDirectoryPath); - map.put(HsqlDatabaseProperties.hsqldb_tx_conflict_rollback, - String.valueOf(database.txConflictRollback)); - map.put(HsqlDatabaseProperties.hsqldb_tx_interrupt_rollback, - String.valueOf(database.txInterruptRollback)); - map.put(HsqlDatabaseProperties.hsqldb_result_max_memory_rows, - String.valueOf(database.getResultMaxMemoryRows())); - map.put(HsqlDatabaseProperties.hsqldb_readonly, - database.isReadOnly() ? "true" - : "false"); - map.put(HsqlDatabaseProperties.hsqldb_files_readonly, - database.isFilesReadOnly() ? "true" - : "false"); - map.put(HsqlDatabaseProperties.hsqldb_write_delay, - String.valueOf(propWriteDelay != 0)); - map.put(HsqlDatabaseProperties.hsqldb_write_delay_millis, - String.valueOf(propWriteDelay)); - map.put(HsqlDatabaseProperties.hsqldb_digest, - database.granteeManager.getDigestAlgo()); - - return map; - } - - public String[] getPropertiesSQL(boolean indexRoots) { - - HsqlArrayList list = new HsqlArrayList(); - StringBuilder sb = new StringBuilder(); - - sb.append("SET DATABASE ").append(Tokens.T_UNIQUE).append(' '); - sb.append(Tokens.T_NAME).append(' ').append(database.getNameString()); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_DEFAULT).append(' '); - sb.append(Tokens.T_RESULT).append(' ').append(Tokens.T_MEMORY); - sb.append(' ').append(Tokens.T_ROWS).append(' '); - sb.append(database.getResultMaxMemoryRows()); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_EVENT).append(' '); - sb.append(Tokens.T_LOG).append(' ').append(Tokens.T_LEVEL); - sb.append(' ').append(propEventLogLevel); - list.add(sb.toString()); - sb.setLength(0); - - if (propExternalEventLogLevel != SimpleLog.LOG_NONE) { - sb.append("SET DATABASE ").append(Tokens.T_EXTERNAL).append(' '); - sb.append(Tokens.T_EVENT).append(' '); - sb.append(Tokens.T_LOG).append(' ').append(Tokens.T_LEVEL); - sb.append(' ').append(propExternalEventLogLevel); - list.add(sb.toString()); - sb.setLength(0); - } - - if (propSqlLogLevel != SimpleLog.LOG_NONE) { - sb.append("SET DATABASE ").append(Tokens.T_EVENT).append(' '); - sb.append(Tokens.T_LOG).append(' ').append(Tokens.T_SQL); - sb.append(' ').append(Tokens.T_LEVEL); - sb.append(' ').append(propEventLogLevel); - list.add(sb.toString()); - sb.setLength(0); - } - - sb.append("SET DATABASE ").append(Tokens.T_TRANSACTION); - sb.append(' ').append(Tokens.T_CONTROL).append(' '); - - switch (database.txManager.getTransactionControl()) { - - case TransactionManager.MVCC : - sb.append(Tokens.T_MVCC); - break; - - case TransactionManager.MVLOCKS : - sb.append(Tokens.T_MVLOCKS); - break; - - case TransactionManager.LOCKS : - sb.append(Tokens.T_LOCKS); - break; - } - - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_DEFAULT).append(' '); - sb.append(Tokens.T_ISOLATION).append(' ').append(Tokens.T_LEVEL); - sb.append(' '); - - switch (database.defaultIsolationLevel) { - - case SessionInterface.TX_READ_COMMITTED : - sb.append(Tokens.T_READ).append(' ').append( - Tokens.T_COMMITTED); - break; - - case SessionInterface.TX_SERIALIZABLE : - sb.append(Tokens.T_SERIALIZABLE); - break; - } - - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_TRANSACTION).append(' '); - sb.append(Tokens.T_ROLLBACK).append(' '); - sb.append(Tokens.T_ON).append(' '); - sb.append(Tokens.T_CONFLICT).append(' '); - sb.append(database.txConflictRollback ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - - if (database.txInterruptRollback) { - sb.append("SET DATABASE ").append(Tokens.T_TRANSACTION); - sb.append(' ').append(Tokens.T_ROLLBACK).append(' '); - sb.append(Tokens.T_ON).append(' '); - sb.append(Tokens.T_INTERRUPT).append(' '); - sb.append(database.txInterruptRollback ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - sb.append("SET DATABASE ").append(Tokens.T_TEXT).append(' '); - sb.append(Tokens.T_TABLE).append(' ').append(Tokens.T_DEFAULTS); - sb.append(' ').append('\''); - sb.append(propTextSourceDefault).append('\''); - list.add(sb.toString()); - sb.setLength(0); - - String temp = HsqlDatabaseProperties.getStringPropertyDefault( - HsqlDatabaseProperties.hsqldb_digest); - - if (!temp.equals(database.granteeManager.getDigestAlgo())) { - sb.append("SET DATABASE ").append(Tokens.T_PASSWORD).append(' '); - sb.append(Tokens.T_DIGEST).append(' ').append('\''); - sb.append(database.granteeManager.getDigestAlgo()).append('\''); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.schemaManager.getDefaultTableType() - == TableBase.CACHED_TABLE) { - sb.append("SET DATABASE ").append(Tokens.T_DEFAULT).append(' '); - sb.append(Tokens.T_TABLE).append(' '); - sb.append(Tokens.T_TYPE).append(' '); - sb.append(Tokens.T_CACHED); - list.add(sb.toString()); - sb.setLength(0); - } - - // - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_NAMES).append(' '); - sb.append(database.sqlEnforceNames ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_RESTRICT).append(' '); - sb.append(Tokens.T_EXEC).append(' '); - sb.append(database.sqlRestrictExec ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - - if (!database.sqlRegularNames) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_REGULAR).append(' '); - sb.append(Tokens.T_NAMES).append(' '); - sb.append(database.sqlRegularNames ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_REFERENCES).append(' '); - sb.append(database.sqlEnforceRefs ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_SIZE).append(' '); - sb.append(database.sqlEnforceSize ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_TYPES).append(' '); - sb.append(database.sqlEnforceTypes ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_TDC).append(' '); - sb.append(Tokens.T_DELETE).append(' '); - sb.append(database.sqlEnforceTDCD ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_TDC).append(' '); - sb.append(Tokens.T_UPDATE).append(' '); - sb.append(database.sqlEnforceTDCU ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - - if (!database.sqlTranslateTTI) { - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_TRANSLATE).append(' ').append(Tokens.T_TTI); - sb.append(' ').append(Tokens.T_TYPES).append(' '); - sb.append(database.sqlTranslateTTI ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - } - - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_SYS).append(' ').append(Tokens.T_INDEX); - sb.append(' ').append(Tokens.T_NAMES).append(' '); - sb.append(database.sqlSysIndexNames ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - - if (!database.sqlCharLiteral) { - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_CHARACTER).append(' '); - sb.append(Tokens.T_LITERAL).append(' '); - sb.append(database.sqlCharLiteral ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - } - - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_CONCAT_WORD).append(' '); - sb.append(Tokens.T_NULLS).append(' '); - sb.append(database.sqlConcatNulls ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - - if (!database.sqlNullsFirst) { - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_NULLS).append(' '); - sb.append(Tokens.T_FIRST).append(' '); - sb.append(database.sqlNullsFirst ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - } - - if (!database.sqlNullsOrder) { - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_NULLS).append(' '); - sb.append(Tokens.T_ORDER).append(' '); - sb.append(database.sqlNullsOrder ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - } - - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_UNIQUE).append(' '); - sb.append(Tokens.T_NULLS).append(' '); - sb.append(database.sqlUniqueNulls ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_CONVERT).append(' '); - sb.append(Tokens.T_TRUNCATE).append(' '); - sb.append(database.sqlConvertTruncate ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_AVG).append(' '); - sb.append(Tokens.T_SCALE).append(' '); - sb.append(database.sqlAvgScale); - list.add(sb.toString()); - sb.setLength(0); - - if (database.sqlMaxRecursive - != HsqlDatabaseProperties.getIntegerPropertyDefault( - HsqlDatabaseProperties.sql_max_recursive)) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_MAX).append(' '); - sb.append(Tokens.T_RECURSIVE).append(' '); - sb.append(database.sqlMaxRecursive); - list.add(sb.toString()); - sb.setLength(0); - } - - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_DOUBLE).append(' '); - sb.append(Tokens.T_NAN).append(' '); - sb.append(database.sqlDoubleNaN ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - - if (database.sqlIgnoreCase) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_IGNORECASE).append(' '); - sb.append(database.sqlIgnoreCase ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.sqlLongvarIsLob) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_LONGVAR).append(' '); - sb.append(Tokens.T_IS).append(' '); - sb.append(Tokens.T_LOB).append(' '); - sb.append(database.sqlLongvarIsLob ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.sqlLowerCaseIdentifier) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_LOWER).append(' '); - sb.append(Tokens.T_CASE).append(' '); - sb.append(Tokens.T_IDENTIFIER).append(' '); - sb.append(database.sqlLowerCaseIdentifier ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (!database.sqlTruncateTrailing) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_TRUNCATE).append(' '); - sb.append(Tokens.T_TRAILING).append(' '); - sb.append(database.sqlTruncateTrailing ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.sqlSyntaxDb2) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_SYNTAX).append(' '); - sb.append(Tokens.T_DB2).append(' '); - sb.append(database.sqlSyntaxDb2 ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.sqlSyntaxMss) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_SYNTAX).append(' '); - sb.append(Tokens.T_MSS).append(' '); - sb.append(database.sqlSyntaxMss ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.sqlSyntaxMys) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_SYNTAX).append(' '); - sb.append(Tokens.T_MYS).append(' '); - sb.append(database.sqlSyntaxMys ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.sqlSyntaxOra) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_SYNTAX).append(' '); - sb.append(Tokens.T_ORA).append(' '); - sb.append(database.sqlSyntaxOra ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - if (database.sqlSyntaxPgs) { - sb.append("SET DATABASE ").append(Tokens.T_SQL).append(' '); - sb.append(Tokens.T_SYNTAX).append(' '); - sb.append(Tokens.T_PGS).append(' '); - sb.append(database.sqlSyntaxPgs ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - // - int delay = propWriteDelay; - boolean millis = delay > 0 && delay < 1000; - - if (millis) { - if (delay < 20) { - delay = 20; - } - } else { - delay /= 1000; - } - - sb.append("SET FILES ").append(Tokens.T_WRITE).append(' '); - sb.append(Tokens.T_DELAY).append(' ').append(delay); - - if (millis) { - sb.append(' ').append(Tokens.T_MILLIS); - } - - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_BACKUP); - sb.append(' ').append(Tokens.T_INCREMENT).append(' '); - sb.append(Tokens.T_TRUE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_CACHE); - sb.append(' ').append(Tokens.T_SIZE).append(' '); - sb.append(propCacheMaxSize / 1024); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_CACHE); - sb.append(' ').append(Tokens.T_ROWS).append(' '); - sb.append(propCacheMaxRows); - list.add(sb.toString()); - - { - int fileScale = propDataFileScale; - - if (!indexRoots && fileScale < 32) { - fileScale = 32; - } - - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_SCALE); - sb.append(' ').append(fileScale); - list.add(sb.toString()); - sb.setLength(0); - } - - if (propDataFileSpace != 0) { - sb.append("SET FILES ").append(Tokens.T_SPACE).append(' '); - sb.append(propDataFileSpace); - list.add(sb.toString()); - sb.setLength(0); - } - - sb.append("SET FILES ").append(Tokens.T_LOB).append(' '); - sb.append(Tokens.T_SCALE); - sb.append(' ').append(getLobFileScale()); - list.add(sb.toString()); - sb.setLength(0); - - if (propCompressLobs) { - sb.append("SET FILES ").append(Tokens.T_LOB).append(' '); - sb.append(Tokens.T_COMPRESSED).append(' '); - sb.append(propCompressLobs ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - } - - sb.append("SET FILES ").append(Tokens.T_DEFRAG).append(' '); - sb.append(propDataFileDefragLimit); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_NIO).append(' '); - sb.append(propNioDataFile ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_NIO).append(' '); - sb.append(Tokens.T_SIZE).append(' '); - sb.append(propNioMaxSize / (1024 * 1024)); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_LOG).append(' '); - sb.append(propLogData ? Tokens.T_TRUE - : Tokens.T_FALSE); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_LOG).append(' '); - sb.append(Tokens.T_SIZE).append(' ').append(propLogSize); - list.add(sb.toString()); - sb.setLength(0); - sb.append("SET FILES ").append(Tokens.T_CHECK).append(' '); - sb.append(propFilesTimestamp); - list.add(sb.toString()); - sb.setLength(0); - - String[] array = new String[list.size()]; - - list.toArray(array); - - return array; - } - - public void backup(String destPath, boolean script, boolean blocking, - boolean compressed, boolean files) { - - if (!backupState.compareAndSet(stateNormal, stateBackup)) { - throw Error.error(ErrorCode.BACKUP_ERROR, "backup in progress"); - } - - if (blocking) { - database.lobManager.lock(); - - try { - synchronized (this) { - backupInternal(destPath, script, blocking, compressed, - files); - } - } finally { - backupState.set(stateNormal); - database.lobManager.unlock(); - } - } else { - try { - backupInternal(destPath, script, blocking, compressed, files); - } finally { - backupState.set(stateNormal); - } - } - } - - public SimpleDateFormat fileDateFormat = - new SimpleDateFormat("yyyyMMdd'T'HHmmss"); - private static char runtimeFileDelim = - System.getProperty("file.separator").charAt(0); - DbBackup backup; - - void backupInternal(String destPath, boolean script, boolean blocking, - boolean compressed, boolean asFiles) { - - String scriptName = null; - String dbPath = database.getPath(); - /* If want to add db Id also, will need to pass either Database - * instead of dbPath, or pass dbPath + Id from StatementCommand. - */ - String instanceName = new File(dbPath).getName(); - char lastChar = destPath.charAt(destPath.length() - 1); - boolean generateName = (lastChar == '/' - || lastChar == runtimeFileDelim); - File archiveFile; - - if (asFiles) { - if (!generateName) { - throw Error.error(null, ErrorCode.UNSUPPORTED_FILENAME_SUFFIX, - 0, new String[] { - "", "/" - }); - } - - destPath = getSecurePath(destPath, true, false); - - if (destPath == null) { - throw Error.error(ErrorCode.BACKUP_ERROR, - "access to directory denied"); - } - - archiveFile = new File(destPath); - - archiveFile.mkdirs(); - - File[] files = FileUtil.getDatabaseMainFileList(destPath - + instanceName); - - if (files == null || files.length != 0) { - throw Error.error(ErrorCode.BACKUP_ERROR, - "files exist in directory"); - } - } else { - String defaultSuffix = compressed ? ".tar.gz" - : ".tar"; - - if (generateName) { - archiveFile = - (new File(destPath.substring(0, destPath.length() - 1), - instanceName + '-' - + fileDateFormat.format(new java.util.Date()) - + defaultSuffix)); - } else { - archiveFile = new File(destPath); - } - - boolean nameImpliesCompress = - archiveFile.getName().endsWith(".tar.gz") - || archiveFile.getName().endsWith(".tgz"); - - if ((!nameImpliesCompress) - && !archiveFile.getName().endsWith(".tar")) { - throw Error.error(null, ErrorCode.UNSUPPORTED_FILENAME_SUFFIX, - 0, new String[] { - archiveFile.getName(), ".tar, .tar.gz, .tgz" - }); - } - - if (compressed != nameImpliesCompress) { - throw Error.error(null, ErrorCode.COMPRESSION_SUFFIX_MISMATCH, - 0, new String[] { - String.valueOf(compressed), archiveFile.getName() - }); - } - - if (archiveFile.exists()) { - throw Error.error(ErrorCode.BACKUP_ERROR, - "file exists :" + archiveFile.getName()); - } - } - - if (blocking) { - log.checkpointClose(); - } - - try { - logInfoEvent("Initiating backup of instance '" + instanceName - + "'"); - - // By default, DbBackup will throw if archiveFile (or - // corresponding work file) already exist. That's just what we - // want here. - if (script) { - String path = getTempDirectoryPath(); - - if (path == null) { - return; - } - - path = path + "/" + new File(database.getPath()).getName(); - scriptName = path + scriptFileExtension; - - ScriptWriterText dsw = new ScriptWriterText(database, - scriptName, true, true, true); - - dsw.writeAll(); - dsw.close(); - - backup = new DbBackup(archiveFile, path, true); - - backup.write(); - } else { - backup = new DbBackup(archiveFile, dbPath); - - backup.setAbortUponModify(false); - - if (!blocking) { - InputStreamWrapper isw; - File file = null; - - if (hasCache()) { - DataFileCache dataFileCache = getCache(); - RAShadowFile shadowFile = - dataFileCache.getShadowFile(); - - file = new File(dataFileCache.dataFileName); - isw = new InputStreamWrapper( - new FileInputStream(file)); - - isw.setSizeLimit(dataFileCache.fileStartFreePosition); - backup.setStream(dataFileExtension, isw); - - InputStreamInterface isi = shadowFile.getInputStream(); - - backup.setStream(backupFileExtension, isi); - } - - // log - file = new File(log.getLogFileName()); - - long fileLength = file.length(); - - if (fileLength == 0) { - backup.setFileIgnore(logFileExtension); - } else { - isw = new InputStreamWrapper( - new FileInputStream(file)); - - isw.setSizeLimit(fileLength); - backup.setStream(logFileExtension, isw); - } - } - - if (asFiles) { - backup.writeAsFiles(); - } else { - backup.write(); - } - } - - logInfoEvent("Successfully backed up instance '" + instanceName - + "' to '" + destPath + "'"); - } catch (IOException ioe) { - throw Error.error(ioe, ErrorCode.FILE_IO_ERROR, ioe.toString()); - } catch (TarMalformatException tme) { - throw Error.error(tme, ErrorCode.FILE_IO_ERROR, tme.toString()); - } finally { - if (scriptName != null) { - FileUtil.getFileUtil().delete(scriptName); - } - - if (blocking) { - log.checkpointReopen(); - } - } - } - - /** - * Returns a secure path or null for a user-defined path when - * hsqldb.allow_full_path is false. Returns the path otherwise. - * - */ - public String getSecurePath(String path, boolean allowFull, - boolean includeRes) { - - if (database.getType() == DatabaseType.DB_RES) { - if (includeRes) { - return path; - } else { - return null; - } - } - - if (database.getType() == DatabaseType.DB_MEM) { - if (propTextAllowFullPath) { - return path; - } else { - return null; - } - } - - // absolute paths - if (path.startsWith("/") || path.startsWith("\\") - || path.contains(":")) { - if (allowFull || propTextAllowFullPath) { - return path; - } else { - return null; - } - } - - if (path.contains("..")) { - if (allowFull || propTextAllowFullPath) { - - // allow - } else { - return null; - } - } - - String fullPath = - new File(new File(database.getPath() - + ".properties").getAbsolutePath()).getParent(); - - if (fullPath != null) { - path = fullPath + File.separator + path; - } - - return path; - } - - public boolean isNewDatabase() { - return isNewDatabase; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/PersistentStore.java b/database/hsqldb/src/org/hsqldb/persist/PersistentStore.java deleted file mode 100644 index ac93cba9..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/PersistentStore.java +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Row; -import org.hsqldb.RowAction; -import org.hsqldb.Session; -import org.hsqldb.TableBase; -import org.hsqldb.index.Index; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.rowio.RowInputInterface; - -/** - * Interface for a store for CachedObject objects. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public interface PersistentStore { - - int SHORT_STORE_SIZE = 2; - int INT_STORE_SIZE = 4; - int LONG_STORE_SIZE = 8; - PersistentStore[] emptyArray = new PersistentStore[]{}; - - boolean isRowStore(); - - TableBase getTable(); - - long getTimestamp(); - - void setTimestamp(long timestamp); - - boolean isMemory(); - - void setMemory(boolean mode); - - /** get object with keep, ensuring future gets will return the same instance of the object */ - CachedObject get(long key, boolean keep); - - CachedObject get(CachedObject object, boolean keep); - - /** add new object */ - void add(CachedObject object, boolean keep); - - void add(Session session, CachedObject object, boolean tx); - - boolean canRead(Session session, long key, int mode, int[] colMap); - - boolean canRead(Session session, CachedObject object, int mode, - int[] colMap); - - CachedObject get(RowInputInterface in); - - CachedObject get(CachedObject object, RowInputInterface in); - - CachedObject getNewInstance(int size); - - int getDefaultObjectSize(); - - CachedObject getNewCachedObject(Session session, Object object, - boolean tx); - - void removeAll(); - - /** remove both persisted and cached copies */ - void remove(CachedObject object); - - /** commit persisted image */ - void commitPersistence(CachedObject object); - - // - void delete(Session session, Row row); - - RowAction addDeleteActionToRow(Session session, Row row, int[] colMap, - boolean isMV); - - void indexRow(Session session, Row row); - - void commitRow(Session session, Row row, int changeAction, int txModel); - - void rollbackRow(Session session, Row row, int changeAction, int txModel); - - void postCommitAction(Session session, RowAction rowAction); - - // - void indexRows(Session session); - - RowIterator rowIterator(); - - // - DataFileCache getCache(); - - void setCache(DataFileCache cache); - - TableSpaceManager getSpaceManager(); - - void setSpaceManager(TableSpaceManager manager); - - void release(); - - PersistentStore getAccessorStore(Index index); - - CachedObject getAccessor(Index key); - - void setAccessors(long base, long[] accessors, long cardinality); - - void setAccessor(Index key, CachedObject accessor); - - void setAccessor(Index key, long accessor); - - double searchCost(Session session, Index idx, int count, int opType); - - long elementCount(); - - long elementCount(Session session); - - long elementCountUnique(Index index); - - boolean hasNull(int pos); - - void resetAccessorKeys(Session session, Index[] keys); - - Index[] getAccessorKeys(); - - void moveData(Session session, PersistentStore other, int[] colIndex, - int adjust); - - void reindex(Session session, Index index, Index useIndex); - - void setReadOnly(boolean readonly); - - void readLock(); - - void readUnlock(); - - void writeLock(); - - void writeUnlock(); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollection.java b/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollection.java deleted file mode 100644 index 1c723f8c..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollection.java +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.TableBase; - -public interface PersistentStoreCollection { - - PersistentStore getStore(TableBase key); - - void removeStore(TableBase key); - - void release(); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollectionDatabase.java b/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollectionDatabase.java deleted file mode 100644 index e07da142..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollectionDatabase.java +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.concurrent.atomic.AtomicLong; - -import org.hsqldb.Database; -import org.hsqldb.TableBase; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.LongKeyHashMap; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public class PersistentStoreCollectionDatabase -implements PersistentStoreCollection { - - private Database database; - private AtomicLong persistentStoreIdSequence = new AtomicLong(); - private final LongKeyHashMap rowStoreMap = new LongKeyHashMap(); - - public PersistentStoreCollectionDatabase(Database db) { - this.database = db; - } - - synchronized public PersistentStore getStore(TableBase table) { - - long persistenceId = table.getPersistenceId(); - PersistentStore store = - (PersistentStore) rowStoreMap.get(persistenceId); - - if (store == null) { - store = database.logger.newStore(null, this, table); - - rowStoreMap.put(persistenceId, store); - - table.store = store; - } - - return store; - } - - synchronized public void setStore(TableBase table, PersistentStore store) { - rowStoreMap.put(table.getPersistenceId(), store); - - table.store = store; - } - - public void release() { - - if (rowStoreMap.isEmpty()) { - return; - } - - Iterator it = rowStoreMap.values().iterator(); - - while (it.hasNext()) { - PersistentStore store = (PersistentStore) it.next(); - - store.release(); - } - - rowStoreMap.clear(); - } - - synchronized public void removeStore(TableBase table) { - - PersistentStore store = - (PersistentStore) rowStoreMap.get(table.getPersistenceId()); - - if (store != null) { - store.removeAll(); - store.release(); - rowStoreMap.remove(table.getPersistenceId()); - } - } - - public long getNextId() { - return persistentStoreIdSequence.getAndIncrement(); - } - - public void setNewTableSpaces() { - - DataFileCache dataCache = database.logger.getCache(); - - if (dataCache == null) { - return; - } - - Iterator it = rowStoreMap.values().iterator(); - - while (it.hasNext()) { - PersistentStore store = (PersistentStore) it.next(); - - if (store == null) { - continue; - } - - TableBase table = store.getTable(); - - if (table.getTableType() == TableBase.CACHED_TABLE) { - TableSpaceManager tableSpace = - dataCache.spaceManager.getTableSpace(table.getSpaceID()); - - store.setSpaceManager(tableSpace); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollectionSession.java b/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollectionSession.java deleted file mode 100644 index 5c235093..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/PersistentStoreCollectionSession.java +++ /dev/null @@ -1,423 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.HsqlException; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.lib.HsqlDeque; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.LongKeyHashMap; - -/** - * Collection of PersistenceStore items currently used by a session. - * An item is retrieved based on key returned by - * TableBase.getPersistenceId(). - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public class PersistentStoreCollectionSession -implements PersistentStoreCollection { - - private final Session session; - private final LongKeyHashMap rowStoreMapSession = new LongKeyHashMap(); - private LongKeyHashMap rowStoreMapTransaction = new LongKeyHashMap(); - private LongKeyHashMap rowStoreMapStatement = new LongKeyHashMap(); - private LongKeyHashMap rowStoreMapRoutine = new LongKeyHashMap(); - private HsqlDeque rowStoreListStack; - - public PersistentStoreCollectionSession(Session session) { - this.session = session; - } - - synchronized public void removeStore(TableBase table) { - - switch (table.persistenceScope) { - - case TableBase.SCOPE_ROUTINE : - rowStoreMapRoutine.remove(table.getPersistenceId()); - break; - - case TableBase.SCOPE_STATEMENT : - rowStoreMapStatement.remove(table.getPersistenceId()); - break; - - // TEMP TABLE default, SYSTEM_TABLE + INFO_SCHEMA_TABLE - case TableBase.SCOPE_FULL : - case TableBase.SCOPE_TRANSACTION : - rowStoreMapTransaction.remove(table.getPersistenceId()); - break; - - case TableBase.SCOPE_SESSION : - rowStoreMapSession.remove(table.getPersistenceId()); - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, - "PersistentStoreCollectionSession"); - } - } - - synchronized public PersistentStore getViewStore(long persistenceId) { - return (PersistentStore) rowStoreMapStatement.get(persistenceId); - } - - synchronized public PersistentStore getStore(TableBase table) { - - PersistentStore store; - - switch (table.persistenceScope) { - - case TableBase.SCOPE_ROUTINE : - store = (PersistentStore) rowStoreMapRoutine.get( - table.getPersistenceId()); - - if (store == null) { - store = session.database.logger.newStore(session, this, - table); - - rowStoreMapRoutine.put(table.getPersistenceId(), store); - } - - return store; - - case TableBase.SCOPE_STATEMENT : - store = (PersistentStore) rowStoreMapStatement.get( - table.getPersistenceId()); - - if (store == null) { - store = session.database.logger.newStore(session, this, - table); - - rowStoreMapStatement.put(table.getPersistenceId(), store); - } - - return store; - - // TEMP TABLE default, SYSTEM_TABLE + INFO_SCHEMA_TABLE - case TableBase.SCOPE_FULL : - case TableBase.SCOPE_TRANSACTION : - store = (PersistentStore) rowStoreMapTransaction.get( - table.getPersistenceId()); - - if (store == null) { - store = session.database.logger.newStore(session, this, - table); - - rowStoreMapTransaction.put(table.getPersistenceId(), - store); - } - - if (table.getTableType() == TableBase.INFO_SCHEMA_TABLE) { - session.database.dbInfo.setStore(session, (Table) table, - store); - } - - return store; - - case TableBase.SCOPE_SESSION : - store = (PersistentStore) rowStoreMapSession.get( - table.getPersistenceId()); - - if (store == null) { - store = session.database.logger.newStore(session, this, - table); - - rowStoreMapSession.put(table.getPersistenceId(), store); - } - - return store; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, - "PersistentStoreCollectionSession"); - } - } - - synchronized public void clearAllTables() { - - clearSessionTables(); - clearTransactionTables(); - clearStatementTables(); - clearRoutineTables(); - closeSessionDataCache(); - } - - synchronized public void clearResultTables(long actionTimestamp) { - - if (rowStoreMapSession.isEmpty()) { - return; - } - - Iterator it = rowStoreMapSession.values().iterator(); - - while (it.hasNext()) { - PersistentStore store = (PersistentStore) it.next(); - - if (store.getTimestamp() == actionTimestamp) { - store.release(); - it.remove(); - } - } - } - - synchronized public void clearSessionTables() { - - if (rowStoreMapSession.isEmpty()) { - return; - } - - Iterator it = rowStoreMapSession.values().iterator(); - - while (it.hasNext()) { - PersistentStore store = (PersistentStore) it.next(); - - store.release(); - } - - rowStoreMapSession.clear(); - } - - synchronized public void clearTransactionTables() { - - if (rowStoreMapTransaction.isEmpty()) { - return; - } - - Iterator it = rowStoreMapTransaction.values().iterator(); - - while (it.hasNext()) { - PersistentStore store = (PersistentStore) it.next(); - - store.release(); - } - - rowStoreMapTransaction.clear(); - } - - synchronized public void clearStatementTables() { - - if (rowStoreMapStatement.isEmpty()) { - return; - } - - Iterator it = rowStoreMapStatement.values().iterator(); - - while (it.hasNext()) { - PersistentStore store = (PersistentStore) it.next(); - - store.release(); - } - - rowStoreMapStatement.clear(); - } - - synchronized public void clearRoutineTables() { - - if (rowStoreMapRoutine.isEmpty()) { - return; - } - - Iterator it = rowStoreMapRoutine.values().iterator(); - - while (it.hasNext()) { - PersistentStore store = (PersistentStore) it.next(); - - store.release(); - } - - rowStoreMapRoutine.clear(); - } - - synchronized public PersistentStore findStore(TableBase table) { - - PersistentStore store = null; - - switch (table.persistenceScope) { - - case TableBase.SCOPE_ROUTINE : - store = (PersistentStore) rowStoreMapRoutine.get( - table.getPersistenceId()); - break; - - case TableBase.SCOPE_STATEMENT : - store = (PersistentStore) rowStoreMapStatement.get( - table.getPersistenceId()); - break; - - // TEMP TABLE default, SYSTEM_TABLE + INFO_SCHEMA_TABLE - case TableBase.SCOPE_FULL : - case TableBase.SCOPE_TRANSACTION : - store = (PersistentStore) rowStoreMapTransaction.get( - table.getPersistenceId()); - break; - - case TableBase.SCOPE_SESSION : - store = (PersistentStore) rowStoreMapSession.get( - table.getPersistenceId()); - break; - } - - return store; - } - - synchronized public void resetAccessorKeys(Session session, Table table, - Index[] indexes) { - - PersistentStore store = findStore(table); - - if (store == null) { - return; - } - - store.resetAccessorKeys(session, indexes); - } - - synchronized public void moveData(Table oldTable, Table newTable, - int[] colIndex, int adjust) { - - PersistentStore store = findStore(oldTable); - - if (store == null) { - return; - } - - PersistentStore newStore = getStore(newTable); - - try { - newStore.moveData(session, store, colIndex, adjust); - } catch (HsqlException e) { - newStore.release(); - removeStore(newTable); - - throw e; - } - - removeStore(oldTable); - } - - synchronized public void push(boolean isRoutine) { - - if (rowStoreListStack == null) { - rowStoreListStack = new HsqlDeque(); - } - - Object[] array = rowStoreMapStatement.valuesToArray(); - - rowStoreListStack.add(array); - rowStoreMapStatement.clear(); - - if (isRoutine) { - array = rowStoreMapRoutine.valuesToArray(); - - rowStoreListStack.add(array); - rowStoreMapRoutine.clear(); - } - } - - synchronized public void pop(boolean isRoutine) { - - Object[] array; - - if (isRoutine) { - array = (Object[]) rowStoreListStack.removeLast(); - - clearRoutineTables(); - - for (int i = 0; i < array.length; i++) { - PersistentStore store = (PersistentStore) array[i]; - - rowStoreMapRoutine.put(store.getTable().getPersistenceId(), - store); - } - } - - array = (Object[]) rowStoreListStack.removeLast(); - - clearStatementTables(); - - for (int i = 0; i < array.length; i++) { - PersistentStore store = (PersistentStore) array[i]; - - rowStoreMapStatement.put(store.getTable().getPersistenceId(), - store); - } - } - - DataFileCacheSession resultCache; - - synchronized public DataFileCacheSession getSessionDataCache() { - - if (resultCache == null) { - String path = session.database.logger.getTempDirectoryPath(); - - if (path == null) { - return null; - } - - try { - resultCache = - new DataFileCacheSession(session.database, - path + "/session_" - + Long.toString(session.getId())); - - resultCache.open(false); - } catch (Throwable t) { - return null; - } - } - - return resultCache; - } - - private void closeSessionDataCache() { - - if (resultCache != null) { - try { - resultCache.release(); - resultCache.deleteDataFile(); - } catch (HsqlException e) {} - - resultCache = null; - } - } - - synchronized public void release() { - clearAllTables(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RAFile.java b/database/hsqldb/src/org/hsqldb/persist/RAFile.java deleted file mode 100644 index ee05d07c..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RAFile.java +++ /dev/null @@ -1,428 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.EOFException; -import java.io.FileDescriptor; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - -import org.hsqldb.Database; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.EventLogInterface; -import org.hsqldb.lib.HsqlByteArrayInputStream; -import org.hsqldb.lib.HsqlByteArrayOutputStream; - -/** - * This class is a wrapper for a random access file such as that used for - * CACHED table storage. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.7.2 - */ -final class RAFile implements RandomAccessInterface { - - static final int DATA_FILE_RAF = 0; - static final int DATA_FILE_NIO = 1; - static final int DATA_FILE_JAR = 2; - static final int DATA_FILE_STORED = 3; - static final int DATA_FILE_SINGLE = 4; - static final int DATA_FILE_TEXT = 5; - - // - static final int bufferScale = 13; - static final int bufferSize = 1 << bufferScale; - static final long bufferMask = 0xffffffffffffffffL << bufferScale; - - // - final EventLogInterface logger; - final RandomAccessFile file; - final FileDescriptor fileDescriptor; - private final boolean readOnly; - final String fileName; - final byte[] buffer; - final HsqlByteArrayInputStream ba; - final byte[] valueBuffer; - final HsqlByteArrayOutputStream vbao; - final HsqlByteArrayInputStream vbai; - long bufferOffset; - long fileLength; - final boolean extendLength; - - // - long seekPosition; - int cacheHit; - - /** - * seekPosition is the position in seek() calls or after reading or writing - * realPosition is the file position - */ - static RandomAccessInterface newScaledRAFile(Database database, - String name, boolean readonly, - int type) throws FileNotFoundException, IOException { - - if (type == DATA_FILE_JAR) { - return new RAFileInJar(name); - } else if (type == DATA_FILE_TEXT) { - return new RAFile(database.logger, name, readonly, false, true); - } else if (type == DATA_FILE_RAF) { - return new RAFile(database.logger, name, readonly, true, false); - } else { - java.io.File fi = new java.io.File(name); - long length = fi.length(); - - if (length > database.logger.propNioMaxSize) { - return new RAFile(database.logger, name, readonly, true, - false); - } - - return new RAFileHybrid(database, name, readonly); - } - } - - RAFile(EventLogInterface logger, String name, boolean readonly, - boolean extendLengthToBlock, - boolean commitOnChange) throws FileNotFoundException, IOException { - - this.logger = logger; - this.fileName = name; - this.readOnly = readonly; - this.extendLength = extendLengthToBlock; - - String accessMode = readonly ? "r" - : commitOnChange ? "rws" - : "rw"; - - this.file = new RandomAccessFile(name, accessMode); - buffer = new byte[bufferSize]; - ba = new HsqlByteArrayInputStream(buffer); - valueBuffer = new byte[8]; - vbao = new HsqlByteArrayOutputStream(valueBuffer); - vbai = new HsqlByteArrayInputStream(valueBuffer); - fileDescriptor = file.getFD(); - fileLength = length(); - - readIntoBuffer(); - } - - public long length() throws IOException { - return file.length(); - } - - public void seek(long position) throws IOException { - - if (readOnly && fileLength < position) { - throw new IOException("read beyond end of file"); - } - - seekPosition = position; - } - - public long getFilePointer() { - return seekPosition; - } - - private void readIntoBuffer() throws IOException { - - long filePos = seekPosition & bufferMask; - long readLength = fileLength - filePos; - - if (readLength > buffer.length) { - readLength = buffer.length; - } - - if (readLength < 0) { - throw new IOException("read beyond end of file"); - } - - try { - file.seek(filePos); - file.readFully(buffer, 0, (int) readLength); - - bufferOffset = filePos; - } catch (IOException e) { - resetPointer(); - logger.logWarningEvent("Read Error " + filePos + " " + readLength, - e); - - throw e; - } - } - - public int read() throws IOException { - - if (seekPosition >= fileLength) { - return -1; - } - - if (seekPosition < bufferOffset - || seekPosition >= bufferOffset + buffer.length) { - readIntoBuffer(); - } else { - cacheHit++; - } - - int val = buffer[(int) (seekPosition - bufferOffset)] & 0xff; - - seekPosition++; - - return val; - } - - public long readLong() throws IOException { - - vbai.reset(); - read(valueBuffer, 0, 8); - - return vbai.readLong(); - } - - public int readInt() throws IOException { - - vbai.reset(); - read(valueBuffer, 0, 4); - - return vbai.readInt(); - } - - public void read(byte[] b, int offset, int length) throws IOException { - - try { - if (seekPosition + length > fileLength) { - throw new EOFException(); - } - - if (length > buffer.length - && (seekPosition < bufferOffset - || seekPosition >= bufferOffset + buffer.length)) { - file.seek(seekPosition); - file.readFully(b, offset, length); - - seekPosition += length; - - return; - } - - if (seekPosition < bufferOffset - || seekPosition >= bufferOffset + buffer.length) { - readIntoBuffer(); - } else { - cacheHit++; - } - - ba.reset(); - - if (seekPosition - bufferOffset - != ba.skip(seekPosition - bufferOffset)) { - throw new EOFException(); - } - - int bytesRead = ba.read(b, offset, length); - - seekPosition += bytesRead; - - if (bytesRead < length) { - file.seek(seekPosition); - file.readFully(b, offset + bytesRead, length - bytesRead); - - seekPosition += (length - bytesRead); - } - } catch (IOException e) { - resetPointer(); - logger.logWarningEvent("failed to read a byte array", e); - - throw e; - } - } - - public void write(byte[] b, int off, int length) throws IOException { - - try { - file.seek(seekPosition); - - if (seekPosition < bufferOffset + buffer.length - && seekPosition + length > bufferOffset) { - writeToBuffer(b, off, length); - } - - file.write(b, off, length); - - seekPosition += length; - - if (!extendLength && fileLength < seekPosition) { - fileLength = seekPosition; - } - } catch (IOException e) { - resetPointer(); - logger.logWarningEvent("failed to write a byte array", e); - - throw e; - } - } - - public void writeInt(int i) throws IOException { - - vbao.reset(); - vbao.writeInt(i); - write(valueBuffer, 0, 4); - } - - public void writeLong(long i) throws IOException { - - vbao.reset(); - vbao.writeLong(i); - write(valueBuffer, 0, 8); - } - - public void close() throws IOException { - file.close(); - } - - public boolean isReadOnly() { - return readOnly; - } - - public boolean ensureLength(long newLength) { - - if (newLength <= fileLength) { - return true; - } - - try { - extendLength(newLength); - } catch (IOException e) { - return false; - } - - return true; - } - - public boolean setLength(long newLength) { - - try { - file.setLength(newLength); - file.seek(0); - - fileLength = file.length(); - seekPosition = 0; - - readIntoBuffer(); - - return true; - } catch (Throwable t) { - return false; - } - } - - public void synch() { - - try { - fileDescriptor.sync(); - } catch (Throwable t) { - try { - fileDescriptor.sync(); - } catch (Throwable tt) { - logger.logSevereEvent("RA file sync error ", tt); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, null); - } - } - } - - private int writeToBuffer(byte[] b, int off, int len) { - - int count = ArrayUtil.copyBytes(seekPosition - off, b, off, len, - bufferOffset, buffer, buffer.length); - - return count; - } - - private long getExtendLength(long position) { - - if (!extendLength) { - return position; - } - - int scaleUp; - - if (position < 256 * 1024) { - scaleUp = 2; - } else if (position < 1024 * 1024) { - scaleUp = 6; - } else if (position < 32 * 1024 * 1024) { - scaleUp = 8; - } else { - scaleUp = 12; - } - - position = ArrayUtil.getBinaryNormalisedCeiling(position, - bufferScale + scaleUp); - - return position; - } - - /** - * Some old JVM's do not allow seek beyond end of file, so zeros must be written - * first in that case. Reported by bohgammer@users in Open Disucssion - * Forum. - */ - private void extendLength(long position) throws IOException { - - long newSize = getExtendLength(position); - - if (newSize > fileLength) { - try { - file.seek(newSize - 1); - file.write(0); - - fileLength = newSize; - } catch (IOException e) { - logger.logWarningEvent("data file enlarge failed ", e); - - throw e; - } - } - } - - private void resetPointer() { - - try { - seekPosition = 0; - fileLength = length(); - bufferOffset = -buffer.length; // invalid buffer - } catch (Throwable e) {} - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RAFileHybrid.java b/database/hsqldb/src/org/hsqldb/persist/RAFileHybrid.java deleted file mode 100644 index a285664a..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RAFileHybrid.java +++ /dev/null @@ -1,194 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.IOException; - -import org.hsqldb.Database; - -/** - * Mixed NIO / non-NIO version of ScaledRAFile. - * This class is used only for storing a CACHED - * TABLE .data file and cannot be used for TEXT TABLE source files. - * - * Due to various issues with java.nio classes, this class will use a mapped - * channel of fixed size. After reaching this size, the file and channel are - * closed and a new one opened, up to the maximum size. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.3 - * @since 1.7.2 - */ -public final class RAFileHybrid implements RandomAccessInterface { - - final Database database; - final String fileName; - final boolean isReadOnly; - boolean preNio; - boolean isNio; - long initialMaxLength = RAFileNIO.largeBufferSize / 2; - RandomAccessInterface store; - - public RAFileHybrid(Database database, String name, - boolean readOnly) throws IOException { - - this.database = database; - this.fileName = name; - this.isReadOnly = readOnly; - - long fileLength; - java.io.File fi = new java.io.File(name); - - fileLength = fi.length(); - - newStore(fileLength); - } - - public long length() throws IOException { - return store.length(); - } - - public void seek(long position) throws IOException { - store.seek(position); - } - - public long getFilePointer() throws IOException { - return store.getFilePointer(); - } - - public int read() throws IOException { - return store.read(); - } - - public void read(byte[] b, int offset, int length) throws IOException { - store.read(b, offset, length); - } - - public void write(byte[] b, int offset, int length) throws IOException { - store.write(b, offset, length); - } - - public int readInt() throws IOException { - return store.readInt(); - } - - public void writeInt(int i) throws IOException { - store.writeInt(i); - } - - public long readLong() throws IOException { - return store.readLong(); - } - - public void writeLong(long i) throws IOException { - store.writeLong(i); - } - - public void close() throws IOException { - store.close(); - } - - public boolean isReadOnly() { - return store.isReadOnly(); - } - - public boolean ensureLength(long newLength) { - - if (newLength <= initialMaxLength) { - return store.ensureLength(newLength); - } else if (preNio) { - try { - newStore(newLength); - } catch (IOException e) {} - } - - if (store.ensureLength(newLength)) { - return true; - } else if (isNio) { - try { - newStore(newLength); - } catch (IOException e) {} - } - - return store.ensureLength(newLength); - } - - public boolean setLength(long newLength) { - return store.setLength(newLength); - } - - public Database getDatabase() { - return null; - } - - public void synch() { - store.synch(); - } - - void newStore(long requiredPosition) throws IOException { - - long currentPosition = 0; - - if (store == null) { - preNio = requiredPosition <= database.logger.propNioMaxSize; - } else { - currentPosition = store.getFilePointer(); - - store.synch(); - store.close(); - } - - if (preNio && initialMaxLength <= requiredPosition) { - try { - store = new RAFileNIO(database.logger, fileName, isReadOnly, - requiredPosition, - database.logger.propNioMaxSize); - - store.seek(currentPosition); - - preNio = false; - isNio = true; - - return; - } catch (Throwable e) { - preNio = false; - - // log event - } - } - - isNio = false; - store = new RAFile(database.logger, fileName, isReadOnly, true, false); - - store.seek(currentPosition); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RAFileInJar.java b/database/hsqldb/src/org/hsqldb/persist/RAFileInJar.java deleted file mode 100644 index 1a58fc60..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RAFileInJar.java +++ /dev/null @@ -1,277 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.DataInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -import org.hsqldb.Database; -import org.hsqldb.lib.HsqlByteArrayInputStream; - -/** - * This class is a random access wrapper around a DataInputStream object and - * enables access to cached tables when a database is included in a jar. - * - * A proof-of-concept prototype was first contributed by winfriedthom@users. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.8.0 - */ -final class RAFileInJar implements RandomAccessInterface { - - DataInputStream file; - final String fileName; - long fileLength; - boolean bufferDirty = true; - byte[] buffer = new byte[4096]; - HsqlByteArrayInputStream ba = new HsqlByteArrayInputStream(buffer); - long bufferOffset; - - // - long seekPosition; - long realPosition; - - RAFileInJar(String name) throws FileNotFoundException, IOException { - - fileName = name; - fileLength = getLength(); - - resetStream(); - } - - public long length() { - return fileLength; - } - - /** - * Some JVM's do not allow seek beyond end of file, so zeros are written - * first in that case. Reported by bohgammer@users in Open Disucssion - * Forum. - */ - public void seek(long position) { - seekPosition = position; - } - - public long getFilePointer() { - return seekPosition; - } - - private void readIntoBuffer() throws IOException { - - long filePos = seekPosition; - - bufferDirty = false; - - long subOffset = filePos % buffer.length; - long readLength = fileLength - (filePos - subOffset); - - if (readLength <= 0) { - throw new IOException("read beyond end of file"); - } - - if (readLength > buffer.length) { - readLength = buffer.length; - } - - fileSeek(filePos - subOffset); - file.readFully(buffer, 0, (int) readLength); - - bufferOffset = filePos - subOffset; - realPosition = bufferOffset + readLength; - } - - public int read() throws IOException { - - if (seekPosition >= fileLength) { - return -1; - } - - if (bufferDirty || seekPosition < bufferOffset - || seekPosition >= bufferOffset + buffer.length) { - readIntoBuffer(); - } - - ba.reset(); - ba.skip(seekPosition - bufferOffset); - - int val = ba.read(); - - seekPosition++; - - return val; - } - - public long readLong() throws IOException { - - long hi = readInt(); - long lo = readInt(); - - return (hi << 32) + (lo & 0xffffffffL); - } - - public int readInt() throws IOException { - - if (bufferDirty || seekPosition < bufferOffset - || seekPosition >= bufferOffset + buffer.length) { - readIntoBuffer(); - } - - ba.reset(); - ba.skip(seekPosition - bufferOffset); - - int val = ba.readInt(); - - seekPosition += 4; - - return val; - } - - public void read(byte[] b, int offset, int length) throws IOException { - - if (bufferDirty || seekPosition < bufferOffset - || seekPosition >= bufferOffset + buffer.length) { - readIntoBuffer(); - } - - ba.reset(); - ba.skip(seekPosition - bufferOffset); - - int bytesRead = ba.read(b, offset, length); - - seekPosition += bytesRead; - - if (bytesRead < length) { - if (seekPosition != realPosition) { - fileSeek(seekPosition); - } - - file.readFully(b, offset + bytesRead, length - bytesRead); - - seekPosition += (length - bytesRead); - realPosition = seekPosition; - } - } - - public void write(byte[] b, int off, int len) {} - - public void writeInt(int i) {} - - public void writeLong(long i) {} - - public void close() throws IOException { - file.close(); - } - - public boolean isReadOnly() { - return true; - } - - private long getLength() throws IOException { - - int count = 0; - - resetStream(); - - while (true) { - if (file.read() < 0) { - break; - } - - count++; - } - - return count; - } - - private void resetStream() throws IOException { - - if (file != null) { - file.close(); - } - - InputStream fis = null; - - try { - fis = getClass().getResourceAsStream(fileName); - - if (fis == null) { - ClassLoader cl = - Thread.currentThread().getContextClassLoader(); - - if (cl != null) { - fis = cl.getResourceAsStream(fileName); - } - } - } catch (Throwable t) { - - // - } finally { - if (fis == null) { - throw new FileNotFoundException(fileName); - } - } - - file = new DataInputStream(fis); - } - - private void fileSeek(long position) throws IOException { - - long skipPosition = realPosition; - - if (position < skipPosition) { - resetStream(); - - skipPosition = 0; - } - - while (position > skipPosition) { - skipPosition += file.skip(position - skipPosition); - } - } - - public boolean ensureLength(long newLong) { - return true; - } - - public boolean setLength(long newLength) { - return false; - } - - public Database getDatabase() { - return null; - } - - public void synch() {} -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RAFileNIO.java b/database/hsqldb/src/org/hsqldb/persist/RAFileNIO.java deleted file mode 100644 index 9be6f326..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RAFileNIO.java +++ /dev/null @@ -1,553 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.FileDescriptor; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.MappedByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.channels.FileChannel.MapMode; - -import org.hsqldb.Database; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.EventLogInterface; -import org.hsqldb.lib.java.JavaSystem; - -/** - * NIO version of ScaledRAFile. This class is used only for storing a CACHED - * TABLE .data file and cannot be used for TEXT TABLE source files. - * - * Once the maximum data file size allowed for NIO is reached, an ordinary - * ScaledRAFile is used for data access. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.0.5 - */ -final class RAFileNIO implements RandomAccessInterface { - - private final EventLogInterface logger; - private final boolean readOnly; - private final long maxLength; - private long fileLength; - private RandomAccessFile file; - private FileDescriptor fileDescriptor; - private MappedByteBuffer buffer; - private long bufferPosition; - private int bufferLength; - private long currentPosition; - private FileChannel channel; - private boolean buffersModified; - - // - private MappedByteBuffer[] buffers = new MappedByteBuffer[]{}; - - // - private static final String JVM_ERROR = "NIO access failed"; - - // - static final int largeBufferScale = 24; - static final int largeBufferSize = 1 << largeBufferScale; - static final long largeBufferMask = 0xffffffffffffffffL - << largeBufferScale; - - RAFileNIO(EventLogInterface logger, String name, boolean readOnly, - long requiredLength, long maxLength) throws IOException { - - this.logger = logger; - this.maxLength = maxLength; - - java.io.File tempFile = new java.io.File(name); - - if (readOnly) { - requiredLength = tempFile.length(); - } else { - if (tempFile.length() > requiredLength) { - requiredLength = tempFile.length(); - } - - requiredLength = - ArrayUtil.getBinaryNormalisedCeiling(requiredLength, - largeBufferScale); - } - - file = new RandomAccessFile(name, readOnly ? "r" - : "rw"); - this.readOnly = readOnly; - this.channel = file.getChannel(); - this.fileDescriptor = file.getFD(); - - if (ensureLength(requiredLength)) { - buffer = buffers[0]; - bufferLength = buffer.limit(); - bufferPosition = 0; - currentPosition = 0; - } else { - close(); - - IOException io = new IOException("NIO buffer allocation failed"); - - throw io; - } - } - - public long length() throws IOException { - - try { - return file.length(); - } catch (IOException e) { - logger.logWarningEvent(JVM_ERROR, e); - - throw e; - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public void seek(long newPos) throws IOException { - - try { - positionBufferSeek(newPos); - buffer.position((int) (newPos - bufferPosition)); - } catch (IllegalArgumentException e) { - logger.logWarningEvent(JVM_ERROR, e); - - IOException io = JavaSystem.toIOException(e); - - throw io; - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public long getFilePointer() throws IOException { - - try { - return currentPosition; - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public int read() throws IOException { - - try { - - if (currentPosition == fileLength) { - return -1; - } - - int value = buffer.get(); - - positionBufferMove(1); - - return value; - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public void read(byte[] b, int offset, int length) throws IOException { - - try { - while (true) { - checkBuffer(); - - long transferLength = bufferPosition + bufferLength - - currentPosition; - - if (transferLength > length) { - transferLength = length; - } - - buffer.get(b, offset, (int) transferLength); - positionBufferMove((int) transferLength); - - length -= transferLength; - offset += transferLength; - - if (length == 0) { - break; - } - } - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public int readInt() throws IOException { - - try { - int value = buffer.getInt(); - - positionBufferMove(4); - - return value; - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public long readLong() throws IOException { - - try { - long value = buffer.getLong(); - - positionBufferMove(8); - - return value; - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public void write(byte[] b, int offset, int length) throws IOException { - - long transferLength; - - try { - buffersModified = true; - - while (true) { - checkBuffer(); - - transferLength = bufferPosition + bufferLength - - currentPosition; - - if (transferLength > length) { - transferLength = length; - } - - buffer.put(b, offset, (int) transferLength); - positionBufferMove((int) transferLength); - - length -= transferLength; - offset += transferLength; - - if (length == 0) { - break; - } - } - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public void writeInt(int i) throws IOException { - - try { - buffersModified = true; - - buffer.putInt(i); - positionBufferMove(4); - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public void writeLong(long i) throws IOException { - - try { - buffersModified = true; - - buffer.putLong(i); - positionBufferMove(8); - } catch (Throwable t) { - logger.logWarningEvent(JVM_ERROR, t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } - } - - public void close() throws IOException { - - Throwable thrown = null; - - try { - logger.logDetailEvent("NIO file close, size: " + fileLength); - - buffer = null; - channel = null; - - for (int i = 0; i < buffers.length; i++) { - thrown = JavaSystem.unmap(buffers[i]); - - buffers[i] = null; - } - - file.close(); - } catch (Throwable t) { - logger.logWarningEvent("NIO buffer close error", t); - - IOException io = JavaSystem.toIOException(t); - - throw io; - } finally { - if (thrown != null) { - logger.logWarningEvent("NIO buffer unmap exception", thrown); - } - } - } - - public boolean isReadOnly() { - return readOnly; - } - - public boolean ensureLength(long newLength) { - - if (newLength > maxLength) { - return false; - } - - while (newLength > fileLength) { - if (!enlargeFile(newLength)) { - return false; - } - } - - return true; - } - - private boolean enlargeFile(long newFileLength) { - - try { - long newBufferLength; - - if (readOnly) { - newBufferLength = largeBufferSize; - - if (file.length() - fileLength < largeBufferSize) { - newBufferLength = file.length() - fileLength; - } - } else { - newBufferLength = largeBufferSize; - } - - MapMode mapMode = readOnly ? FileChannel.MapMode.READ_ONLY - : FileChannel.MapMode.READ_WRITE; - - if (!readOnly && file.length() < fileLength + newBufferLength) { - file.seek(fileLength + newBufferLength - 1); - file.writeByte(0); - } - - MappedByteBuffer[] newBuffers = - new MappedByteBuffer[buffers.length + 1]; - MappedByteBuffer newBuffer = channel.map(mapMode, fileLength, - newBufferLength); - - System.arraycopy(buffers, 0, newBuffers, 0, buffers.length); - - newBuffers[buffers.length] = newBuffer; - buffers = newBuffers; - fileLength += newBufferLength; - - logger.logDetailEvent("NIO buffer instance, file size " - + fileLength); - } catch (Throwable e) { - logger.logDetailEvent("NOI buffer allocate failed, file size " - + newFileLength); - - return false; - } - - return true; - } - - public boolean setLength(long newLength) { - - if (newLength > fileLength) { - return enlargeFile(newLength); - } else { - try { - seek(0); - } catch (Throwable t) { - - // - } - - return true; - } - } - - public Database getDatabase() { - return null; - } - - public void synch() { - - boolean error = false; - int errIndex = 0; - - for (int i = 0; i < buffers.length; i++) { - try { - buffers[i].force(); - } catch (Throwable t) { - logger.logWarningEvent("NIO buffer force error: pos " - + i * largeBufferSize + " ", t); - - if (!error) { - errIndex = i; - } - - error = true; - } - } - - if (error) { - for (int i = errIndex; i < buffers.length; i++) { - try { - buffers[i].force(); - } catch (Throwable t) { - logger.logWarningEvent("NIO buffer force error " - + i * largeBufferSize + " ", t); - } - } - } - - try { - fileDescriptor.sync(); - - buffersModified = false; - } catch (Throwable t) { - logger.logSevereEvent("NIO RA file sync error ", t); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, null); - } - } - - private void positionBufferSeek(long offset) { - - if (offset < bufferPosition - || offset >= bufferPosition + bufferLength) { - setCurrentBuffer(offset); - } - - buffer.position((int) (offset - bufferPosition)); - - currentPosition = offset; - } - - private void positionBufferMove(int relOffset) { - - long offset = currentPosition + relOffset; - - if (offset >= bufferPosition + bufferLength) { - setCurrentBuffer(offset); - } - - buffer.position((int) (offset - bufferPosition)); - - currentPosition = offset; - } - - private void setCurrentBuffer(long offset) { - - int bufferIndex = (int) (offset >> largeBufferScale); - - // when moving to last position in file - if (bufferIndex == buffers.length) { - bufferIndex = buffers.length - 1; - bufferPosition = (long) bufferIndex * largeBufferSize; - buffer = buffers[bufferIndex]; - - return; - } - - buffer = buffers[bufferIndex]; - bufferPosition = offset & largeBufferMask; - } - - /** - * checks for two types of potential errors before reads and writes and - * fixes them. - * - */ - private void checkBuffer() { - - if (readOnly) { - return; - } - - int bufferIndex = (int) (currentPosition >> largeBufferScale); - - if (currentPosition != bufferPosition + buffer.position()) { - buffer = buffers[bufferIndex]; - bufferPosition = currentPosition & largeBufferMask; - - buffer.position((int) (currentPosition - bufferPosition)); - } else if (buffer != buffers[bufferIndex]) { - buffer = buffers[bufferIndex]; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RAFileSimple.java b/database/hsqldb/src/org/hsqldb/persist/RAFileSimple.java deleted file mode 100644 index 2d7c7050..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RAFileSimple.java +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; - -import org.hsqldb.Database; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.EventLogInterface; - -/** - * This class is a simple wrapper for a random access file such as used - * for backup and lobs. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -final class RAFileSimple implements RandomAccessInterface { - - final RandomAccessFile file; - final boolean readOnly; - final EventLogInterface logger; - - RAFileSimple(EventLogInterface logger, String name, - String openMode) throws FileNotFoundException, IOException { - - this.file = new RandomAccessFile(name, openMode); - this.logger = logger; - readOnly = openMode.equals("r"); - } - - public long length() throws IOException { - return file.length(); - } - - public void seek(long position) throws IOException { - file.seek(position); - } - - public long getFilePointer() throws IOException { - return file.getFilePointer(); - } - - public int read() throws IOException { - return file.read(); - } - - public long readLong() throws IOException { - return file.readLong(); - } - - public int readInt() throws IOException { - return file.readInt(); - } - - public void read(byte[] b, int offset, int length) throws IOException { - file.readFully(b, offset, length); - } - - public void write(byte[] b, int off, int len) throws IOException { - file.write(b, off, len); - } - - public void writeInt(int i) throws IOException { - file.writeInt(i); - } - - public void writeLong(long i) throws IOException { - file.writeLong(i); - } - - public void close() throws IOException { - file.close(); - } - - public boolean isReadOnly() { - return readOnly; - } - - public boolean ensureLength(long newLength) { - - try { - if (!readOnly && file.length() < newLength) { - file.seek(newLength - 1); - file.writeByte(0); - } - } catch (IOException e) { - logger.logWarningEvent("data file enlarge failed ", e); - - return false; - } - - return true; - } - - public boolean setLength(long newLength) { - - try { - file.setLength(newLength); - - return true; - } catch (Throwable t) { - return false; - } - } - - public Database getDatabase() { - return null; - } - - public void synch() { - - try { - file.getFD().sync(); - } catch (Throwable t) { - try { - file.getFD().sync(); - } catch (Throwable tt) { - logger.logSevereEvent("RA file sync error ", t); - - throw Error.error(t, ErrorCode.FILE_IO_ERROR, null); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RAShadowFile.java b/database/hsqldb/src/org/hsqldb/persist/RAShadowFile.java deleted file mode 100644 index 04d03f14..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RAShadowFile.java +++ /dev/null @@ -1,342 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; - -import org.hsqldb.Database; -import org.hsqldb.lib.EventLogInterface; -import org.hsqldb.lib.HsqlByteArrayOutputStream; -import org.hsqldb.lib.InputStreamInterface; -import org.hsqldb.lib.java.JavaSystem; -import org.hsqldb.map.BitMap; - -/** - * Wrapper for random access file for incremental backup of the .data file. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public class RAShadowFile { - - private static final int headerSize = 12; - final EventLogInterface logger; - final String pathName; - final RandomAccessInterface source; - RandomAccessInterface dest; - final int pageSize; - final long maxSize; - final BitMap bitMap; - boolean zeroPageSet; - long savedLength; - long synchLength; - byte[] buffer; - HsqlByteArrayOutputStream byteArrayOutputStream; - - RAShadowFile(EventLogInterface logger, RandomAccessInterface source, - String pathName, long maxSize, int pageSize) { - - this.logger = logger; - this.pathName = pathName; - this.source = source; - this.pageSize = pageSize; - this.maxSize = maxSize; - - int bitSize = (int) (maxSize / pageSize); - - if (maxSize % pageSize != 0) { - bitSize++; - } - - bitMap = new BitMap(bitSize, false); - buffer = new byte[pageSize + headerSize]; - byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer); - } - - int copy(long fileOffset, int size) throws IOException { - - // always copy the first page - int pageCount = 0; - - if (!zeroPageSet) { - pageCount += copy(0); - - bitMap.set(0); - - zeroPageSet = true; - } - - if (fileOffset >= maxSize) { - return pageCount; - } - - long endOffset = fileOffset + size; - - if (endOffset > maxSize) { - endOffset = maxSize; - } - - int startPageOffset = (int) (fileOffset / pageSize); - int endPageOffset = (int) (endOffset / pageSize); - - if (endOffset % pageSize == 0) { - endPageOffset--; - } - - for (; startPageOffset <= endPageOffset; startPageOffset++) { - pageCount += copy(startPageOffset); - } - - return pageCount; - } - - private int copy(int pageOffset) throws IOException { - - if (bitMap.set(pageOffset) == 1) { - return 0; - } - - long position = (long) pageOffset * pageSize; - int readSize = pageSize; - int writeSize = buffer.length; - - if (maxSize - position < pageSize) { - readSize = (int) (maxSize - position); - } - - if (dest == null) { - open(); - } - - long writePos = dest.length(); - - try { - byteArrayOutputStream.reset(); - - if (readSize < pageSize) { - byteArrayOutputStream.fill(0, buffer.length); - byteArrayOutputStream.reset(); - } - - byteArrayOutputStream.writeInt(pageSize); - byteArrayOutputStream.writeLong(position); - source.seek(position); - source.read(buffer, headerSize, readSize); - dest.seek(writePos); - dest.write(buffer, 0, writeSize); - - savedLength = writePos + writeSize; - - return 1; - } catch (Throwable t) { - bitMap.unset(pageOffset); - dest.seek(0); - dest.setLength(writePos); - close(); - logger.logSevereEvent("shadow backup failure pos " + position - + " " + readSize, t); - - throw JavaSystem.toIOException(t); - } - } - - private void open() throws IOException { - dest = new RAFileSimple(logger, pathName, "rw"); - } - - /** - * Called externally after a series of copy() calls. - * Called internally after a restore or when error in writing - */ - void close() throws IOException { - - if (dest != null) { - dest.synch(); - dest.close(); - - dest = null; - } - } - - public void synch() { - - if (dest != null) { - dest.synch(); - - synchLength = savedLength; - } - } - - public long getSavedLength() { - return savedLength; - } - - public InputStreamInterface getInputStream() { - return new InputStreamShadow(); - } - - private static RandomAccessInterface getStorage(Database database, - String pathName, String openMode) throws IOException { - return new RAFileSimple(database.logger, pathName, openMode); - } - - /** todo - take account of incomplete addition of block due to lack of disk */ - - // buggy database files had size == position == 0 at the end - public static void restoreFile(Database database, String sourceName, - String destName) throws IOException { - - RandomAccessInterface source = getStorage(database, sourceName, "r"); - RandomAccessInterface dest = getStorage(database, destName, "rw"); - - while (source.getFilePointer() != source.length()) { - int size = source.readInt(); - long position = source.readLong(); - byte[] buffer = new byte[size]; - - source.read(buffer, 0, buffer.length); - dest.seek(position); - dest.write(buffer, 0, buffer.length); - } - - source.close(); - dest.synch(); - dest.close(); - } - - class InputStreamShadow implements InputStreamInterface { - - FileInputStream is; - long limitSize = 0; - long fetchedSize = 0; - boolean initialised = false; - - public int read() throws IOException { - - if (!initialised) { - initialise(); - } - - if (fetchedSize == limitSize) { - return -1; - } - - int byteread = is.read(); - - if (byteread < 0) { - throw new IOException("backup file not complete " - + fetchedSize + " " + limitSize); - } - - fetchedSize++; - - return byteread; - } - - public int read(byte[] bytes) throws IOException { - return read(bytes, 0, bytes.length); - } - - public int read(byte[] bytes, int offset, - int length) throws IOException { - - if (!initialised) { - initialise(); - } - - if (fetchedSize == limitSize) { - return -1; - } - - if (limitSize >= 0 && limitSize - fetchedSize < length) { - length = (int) (limitSize - fetchedSize); - } - - int count = is.read(bytes, offset, length); - - if (count < 0) { - throw new IOException("backup file not complete " - + fetchedSize + " " + limitSize); - } - - fetchedSize += count; - - return count; - } - - public long skip(long count) { - return 0; - } - - public int available() { - return 0; - } - - public void close() throws IOException { - - if (is != null) { - is.close(); - } - } - - public void setSizeLimit(long count) { - limitSize = count; - } - - public long getSizeLimit() { - - if (!initialised) { - initialise(); - } - - return limitSize; - } - - private void initialise() { - - limitSize = synchLength; - - logger.logDetailEvent("shadow file size for backup: " + limitSize); - - if (limitSize > 0) { - try { - is = new FileInputStream(pathName); - } catch (FileNotFoundException e) {} - } - - initialised = true; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RandomAccessInterface.java b/database/hsqldb/src/org/hsqldb/persist/RandomAccessInterface.java deleted file mode 100644 index 9103832a..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RandomAccessInterface.java +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.IOException; - -/** -* @author Fred Toussi (fredt@users dot sourceforge.net) -* @version 2.2.9 -* @since 2.0.0 -*/ -public interface RandomAccessInterface { - - long length() throws IOException; - - void seek(long position) throws IOException; - - long getFilePointer() throws IOException; - - int read() throws IOException; - - void read(byte[] b, int offset, int length) throws IOException; - - void write(byte[] b, int offset, int length) throws IOException; - - int readInt() throws IOException; - - void writeInt(int i) throws IOException; - - long readLong() throws IOException; - - void writeLong(long i) throws IOException; - - void close() throws IOException; - - boolean isReadOnly(); - - void synch(); - - boolean ensureLength(long newLong); - - boolean setLength(long newLength); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowInsertInterface.java b/database/hsqldb/src/org/hsqldb/persist/RowInsertInterface.java deleted file mode 100644 index 7aae4c99..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowInsertInterface.java +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Row; -import org.hsqldb.Table; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.5.0 - */ -public interface RowInsertInterface { - - void insert(Table table, PersistentStore store, Object[] rowData); - - void finishTable(); - - void close(); - - /** - * returns the position of the error that caused an exception - */ - long getErrorLineNumber(); - - void setStartLineNumber(long number); - - interface modes { - - int rollbackOnError = 0; // not used - int stopOnError = 1; - int continueOnError = 2; - int discardOnError = 3; - int checkUntillError = 4; - } - - interface ErrorLogger { - - void writeLogStatement(long lineNumber, String s); - - void writeRow(long lineNumber, Row row); - - void close(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowInsertSimple.java b/database/hsqldb/src/org/hsqldb/persist/RowInsertSimple.java deleted file mode 100644 index dca2a92f..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowInsertSimple.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Database; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.scriptio.ScriptWriterText; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.5.0 - */ -public class RowInsertSimple implements RowInsertInterface { - - final Session session; - final ErrorLogger callback; - final int mode; - - public RowInsertSimple(Session session, ErrorLogger callback, int mode) { - - this.session = session; - this.callback = callback; - this.mode = mode; - } - - public void finishTable() {} - - public void close() { - callback.close(); - } - - public long getErrorLineNumber() { - return 0L; - } - - public void insert(Table table, PersistentStore store, Object[] rowData) { - table.insertFromScript(session, store, rowData); - } - - public void setStartLineNumber(long number) {} - - public static class InsertErrorHandler implements ErrorLogger { - - Database database; - String fileNamePath; - ScriptWriterText scrwriter; - - public InsertErrorHandler(Database database, String fileNamePath) { - this.database = database; - this.fileNamePath = fileNamePath; - } - - public void writeLogStatement(long lineNumber, String s) { - - setScrWriter(); - - try { - - // todo - write line number etc - scrwriter.writeLogStatement(null, s); - } catch (Throwable t) {} - } - - public void writeRow(long lineNumber, Row row) { - - setScrWriter(); - - try { - - // todo - write line number etc - scrwriter.writeInsertStatement(null, row, - (Table) row.getTable()); - } catch (Throwable t) {} - } - - public void close() { - - if (scrwriter != null) { - scrwriter.close(); - } - } - - private void setScrWriter() { - - if (scrwriter == null) { - String timestamp = database.logger.fileDateFormat.format( - new java.util.Date()); - String name = fileNamePath + "." + timestamp + ".reject"; - - scrwriter = new ScriptWriterText(database, name, false, false, - true); - } - } - } - - public static class DefaultErrorHandler implements ErrorLogger { - - public DefaultErrorHandler() {} - - public void writeLogStatement(long lineNumber, String s) {} - - public void writeRow(long lineNumber, Row row) {} - - public void close() {} - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowInsertVersioning.java b/database/hsqldb/src/org/hsqldb/persist/RowInsertVersioning.java deleted file mode 100644 index 649d4149..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowInsertVersioning.java +++ /dev/null @@ -1,194 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.index.Index; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.navigator.RowSetNavigatorClient; -import org.hsqldb.types.DateTimeType; -import org.hsqldb.types.TimestampData; -import org.hsqldb.types.Type; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.5.0 - */ -public class RowInsertVersioning implements RowInsertInterface { - - final Session session; - final ErrorLogger callback; - final int mode; - RowSetNavigatorClient rowSet = new RowSetNavigatorClient(64); - Table table = null; - PersistentStore store; - Index index = null; - - public RowInsertVersioning(Session session, ErrorLogger callback, - int mode) { - - this.session = session; - this.callback = callback; - this.mode = mode; - } - - public void finishTable() { - applyChangeSet(); - } - - public void close() { - callback.close(); - } - - public long getErrorLineNumber() { - return 0L; - } - - public void insert(Table table, PersistentStore store, Object[] rowData) { - - if (this.table != table) { - resetTable(table, store); - } - - if (isSameRowSet(rowData)) { - rowSet.add(rowData); - } else { - applyChangeSet(); - rowSet.add(rowData); - } - } - - public void setStartLineNumber(long number) {} - - boolean isSameRowSet(Object[] rowData) { - - if (rowSet.isEmpty()) { - return true; - } - - return index.compareRow(session, rowData, rowSet.getData(0)) == 0; - } - - void applyChangeSet() { - - if (rowSet.getSize() == 0) { - return; - } - - int startNewRow = 0; - RowIterator it = index.findFirstRow(session, store, rowSet.getData(0)); - boolean reportFailed = false; - Row currentRow = null; - - while (it.next()) { - if (!isSameRowSet(it.getCurrent())) { - break; - } - - currentRow = it.getCurrentRow(); - - TimestampData ts = currentRow.getSystemStartVersion(); - Object[] newData = rowSet.getData(startNewRow); - int compare = compareColumn(ts, newData, - table.getSystemPeriodStartIndex()); - - if (compare < 0) { - // both start and end row TS are before new data row - ts = currentRow.getSystemEndVersion(); - compare = compareColumn(ts, newData, - table.getSystemPeriodStartIndex()); - - if (compare <= 0) { - continue; - } else { - reportFailed = true; - - break; - } - } - - if (compare > 0) { - reportFailed = true; - - break; - } - - ts = currentRow.getSystemEndVersion(); - compare = compareColumn(ts, newData, - table.getSystemPeriodEndIndex()); - - if (compare == 0) { - startNewRow++; - - continue; - } - - if (ts.getSeconds() == DateTimeType.epochLimitSeconds) { - it.removeCurrent(); - - break; - } - } - - if (reportFailed) { - for (int i = startNewRow; i < rowSet.getSize(); i++) { - Object[] newData = rowSet.getData(i); - Row newRow = new Row(table, newData); - - callback.writeRow(0, newRow); - } - } else { - for (int i = startNewRow; i < rowSet.getSize(); i++) { - Object[] newData = rowSet.getData(i); - - table.insertFromScript(session, store, newData); - } - } - - rowSet.clear(); - } - - void resetTable(Table newTable, PersistentStore newStore) { - - table = newTable; - store = newStore; - index = newTable.getPrimaryIndex(); - } - - int compareColumn(TimestampData ts, Object[] data, int colIndex) { - return Type.SQL_TIMESTAMP_WITH_TIME_ZONE.compare(session, ts, - data[colIndex]); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVL.java b/database/hsqldb/src/org/hsqldb/persist/RowStoreAVL.java deleted file mode 100644 index 00dbe9f4..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVL.java +++ /dev/null @@ -1,794 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; - -import org.hsqldb.ColumnSchema; -import org.hsqldb.Database; -import org.hsqldb.HsqlException; -import org.hsqldb.OpTypes; -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.RowAction; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.index.IndexAVL; -import org.hsqldb.index.IndexAVLCheck.IndexAVLProbe; -import org.hsqldb.index.IndexStats; -import org.hsqldb.index.NodeAVL; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.LongKeyHashMap; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.types.LobData; -import org.hsqldb.types.Type; - -/** - * Base implementation of PersistentStore for different table types. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public abstract class RowStoreAVL implements PersistentStore { - - Database database; - TableSpaceManager tableSpace; - Index[] indexList = Index.emptyArray; - CachedObject[] accessorList = CachedObject.emptyArray; - TableBase table; - long baseElementCount; - AtomicLong elementCount = new AtomicLong(); - long storageSize; - boolean[] nullsList; - double[][] searchCost; - boolean isSchemaStore; - public LongKeyHashMap rowActionMap; - - // - ReadWriteLock lock; - Lock readLock; - Lock writeLock; - - // for result tables - // for INFORMATION SCHEMA tables - private long timestamp; - - // - PersistentStore[] subStores = PersistentStore.emptyArray; - - public boolean isRowStore() { - return true; - } - - public boolean isRowSet() { - return false; - } - - public TableBase getTable() { - return table; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public abstract boolean isMemory(); - - public void setMemory(boolean mode) {} - - public abstract CachedObject get(long key, boolean keep); - - public abstract CachedObject get(CachedObject object, boolean keep); - - public int compare(Session session, long key) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVL"); - } - - public abstract void add(Session session, CachedObject object, boolean tx); - - public final void add(CachedObject object, boolean keep) {} - - public boolean canRead(Session session, long pos, int mode, int[] colMap) { - return true; - } - - public boolean canRead(Session session, CachedObject object, int mode, - int[] colMap) { - - RowAction action = ((Row) object).rowAction; - - if (action == null) { - return true; - } - - return action.canRead(session, mode); - } - - public abstract CachedObject get(RowInputInterface in); - - public CachedObject get(CachedObject object, RowInputInterface in) { - return object; - } - - public CachedObject getNewInstance(int size) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVL"); - } - - public int getDefaultObjectSize() { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVL"); - } - - public abstract CachedObject getNewCachedObject(Session session, - Object object, boolean tx); - - public abstract void removeAll(); - - public abstract void remove(CachedObject object); - - public abstract void commitPersistence(CachedObject object); - - public RowAction addDeleteActionToRow(Session session, Row row, - int[] colMap, boolean isMV) { - - synchronized (row) { - return RowAction.addDeleteAction(session, table, this, row, - colMap); - } - } - - public abstract DataFileCache getCache(); - - public TableSpaceManager getSpaceManager() { - return tableSpace; - } - - public void setSpaceManager(TableSpaceManager manager) { - tableSpace = manager; - } - - public abstract void setCache(DataFileCache cache); - - public abstract void release(); - - public PersistentStore getAccessorStore(Index index) { - return null; - } - - public CachedObject getAccessor(Index key) { - - int position = key.getPosition(); - - if (position >= accessorList.length) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVL"); - } - - return accessorList[position]; - } - - /** - * Basic delete with no logging or referential checks. - */ - public void delete(Session session, Row row) { - - writeLock(); - - try { - for (int i = 0; i < indexList.length; i++) { - indexList[i].delete(session, this, row); - } - - for (int i = 0; i < subStores.length; i++) { - subStores[i].delete(session, row); - } - - row.delete(this); - - long count = elementCount.decrementAndGet(); - - if (count > 16 * 1024 && count < baseElementCount / 2) { - baseElementCount = count; - searchCost = null; - } - } finally { - writeUnlock(); - } - } - - public void indexRow(Session session, Row row) { - - int i = 0; - - writeLock(); - - try { - for (; i < indexList.length; i++) { - indexList[i].insert(session, this, row); - } - - int j = 0; - - try { - for (j = 0; j < subStores.length; j++) { - subStores[j].indexRow(session, row); - } - } catch (HsqlException e) { - - // unique index violation - rollback insert - int count = j; - - j = 0; - - for (; j < count; j++) { - subStores[j].delete(session, row); - } - - throw e; - } - - long count = elementCount.incrementAndGet(); - - if (count > 16 * 1024 && count > baseElementCount * 2) { - baseElementCount = count; - searchCost = null; - } - } catch (HsqlException e) { - int count = i; - - i = 0; - - // unique index violation - rollback insert - for (; i < count; i++) { - indexList[i].delete(session, this, row); - } - - if (rowActionMap != null) { - rowActionMap.remove(row.getPos()); - } - - remove(row); - - throw e; - } catch (Throwable t) { - int count = i; - - i = 0; - - // unique index violation - rollback insert - for (; i < count; i++) { - indexList[i].delete(session, this, row); - } - - if (rowActionMap != null) { - rowActionMap.remove(row.getPos()); - } - - // do not remove as there may be still be reference - throw Error.error(ErrorCode.GENERAL_ERROR, t); - } finally { - writeUnlock(); - } - } - - public abstract void commitRow(Session session, Row row, int changeAction, - int txModel); - - public abstract void rollbackRow(Session session, Row row, - int changeAction, int txModel); - - public abstract void postCommitAction(Session session, RowAction action); - - // - public final void indexRows(Session session) { - - writeLock(); - - try { - for (int i = 1; i < indexList.length; i++) { - setAccessor(indexList[i], null); - } - - RowIterator it = rowIterator(); - - while (it.next()) { - Row row = it.getCurrentRow(); - - ((RowAVL) row).clearNonPrimaryNodes(); - - for (int i = 1; i < indexList.length; i++) { - indexList[i].insert(session, this, row); - } - } - } finally { - writeUnlock(); - } - } - - public RowIterator rowIterator() { - - Index index = indexList[0]; - - for (int i = 0; i < indexList.length; i++) { - if (indexList[i].isClustered()) { - index = indexList[i]; - - break; - } - } - - return index.firstRow(this); - } - - public void setAccessors(long base, long[] accessors, long cardinality) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVL"); - } - - public void setAccessor(Index key, CachedObject accessor) { - accessorList[key.getPosition()] = accessor; - } - - public void setAccessor(Index key, long accessor) {} - - public void resetAccessorKeys(Session session, Index[] keys) { - - searchCost = null; - - if (indexList.length == 0 || accessorList[0] == null) { - indexList = keys; - accessorList = new CachedObject[indexList.length]; - - return; - } - - // method might be called twice - if (indexList == keys) { - return; - } - - Index[] oldIndexList = indexList; - CachedObject[] oldAccessors = accessorList; - int limit = indexList.length; - int diff = keys.length - indexList.length; - int position = 0; - - if (diff < -1) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVL"); - } else if (diff == -1) { - limit = keys.length; - } else if (diff == 0) { - return; - } else if (diff == 1) { - - // - } else { - for (; position < limit; position++) { - if (indexList[position] != keys[position]) { - break; - } - } - - Index[] tempKeys = (Index[]) ArrayUtil.toAdjustedArray(indexList, - null, position, 1); - - tempKeys[position] = keys[position]; - - resetAccessorKeys(session, tempKeys); - resetAccessorKeys(session, keys); - - return; - } - - for (; position < limit; position++) { - if (indexList[position] != keys[position]) { - break; - } - } - - accessorList = (CachedObject[]) ArrayUtil.toAdjustedArray(accessorList, - null, position, diff); - indexList = keys; - - try { - if (diff > 0) { - insertIndexNodes(session, indexList[0], indexList[position]); - } else { - dropIndexFromRows(indexList[0], oldIndexList[position]); - } - } catch (HsqlException e) { - accessorList = oldAccessors; - indexList = oldIndexList; - - throw e; - } - } - - public Index[] getAccessorKeys() { - return indexList; - } - - public double searchCost(Session session, Index index, int count, - int opType) { - - if (count == 0) { - return elementCount.get(); - } - - if (opType != OpTypes.EQUAL) { - return ((double) elementCount.get()) / 2; - } - - if (index.isUnique() && count == index.getColumnCount()) { - return 1; - } - - int position = index.getPosition(); - - synchronized (this) { - if (searchCost == null || searchCost.length != indexList.length) { - searchCost = new double[indexList.length][]; - } - - if (searchCost[position] == null) { - searchCost[position] = indexList[position].searchCost(session, - this); - } - - return searchCost[index.getPosition()][count - 1]; - } - } - - public long elementCount() { - - Index index = this.indexList[0]; - - if (elementCount.get() < 0) { - readLock(); - - try { - long count = index.size(null, this); - - elementCount.set(count); - } finally { - readUnlock(); - } - } - - return elementCount.get(); - } - - public long elementCount(Session session) { - - if (session == null) { - return elementCount(); - } - - Index index = this.indexList[0]; - - if (session.database.txManager.isMVRows()) { - switch (table.getTableType()) { - - case TableBase.MEMORY_TABLE : - case TableBase.CACHED_TABLE : - case TableBase.TEXT_TABLE : - readLock(); - - try { - return index.size(session, this); - } finally { - readUnlock(); - } - default : - } - } - - return elementCount(); - } - - public long elementCountUnique(Index index) { - return 0; - } - - final void setElementCount(long size) { - elementCount.set(size); - } - - public boolean hasNull(int pos) { - return false; - } - - /** - * Moves the data from an old store to new after changes to table - * The colIndex argument is the indexes of the columns that were - * removed, type modified or added. The adjust argument is {-1 | 0 | +1}. - */ - public final void moveData(Session session, PersistentStore other, - int[] colIndex, int adjust) { - - try { - Table table = (Table) this.table; - RowIterator it = other.rowIterator(); - - while (it.next()) { - Row row = it.getCurrentRow(); - Object[] olddata = row.getData(); - Object[] data = table.getEmptyRowData(); - - ArrayUtil.copyAdjustArray(olddata, data, colIndex, adjust); - - for (int i = 0; i < colIndex.length; i++) { - if (adjust == 0) { - Type oldtype = - other.getTable().getColumnTypes()[colIndex[i]]; - Type newtype = - this.table.getColumnTypes()[colIndex[i]]; - Object oldvalue = olddata[colIndex[i]]; - Object value = newtype.convertToType(session, - oldvalue, - oldtype); - - data[colIndex[i]] = value; - - table.systemSetIdentityColumn(session, data); - } else if (adjust > 0) { - ColumnSchema column = table.getColumn(colIndex[i]); - Object value = - table.getColumnDefaultOrGeneratedValue(session, - column, data); - - data[colIndex[i]] = value; - - table.systemSetIdentityColumn(session, data); - } else {} - } - - table.enforceRowConstraints(session, data); - - // get object without RowAction - Row newrow = (Row) getNewCachedObject(session, data, false); - - indexRow(session, newrow); - } - - if (table.isTemp()) { - return; - } - - if (colIndex.length == 0) { - return; - } - - if (adjust <= 0) { - Type type = other.getTable().getColumnTypes()[colIndex[0]]; - - if (type != null && type.isLobType()) { - it = other.rowIterator(); - - while (it.next()) { - Row row = it.getCurrentRow(); - Object[] olddata = row.getData(); - LobData oldvalue = (LobData) olddata[colIndex[0]]; - - if (oldvalue != null) { - session.sessionData.adjustLobUsageCount(oldvalue, - -1); - } - } - } - } - - if (adjust >= 0) { - Type type = this.table.getColumnTypes()[colIndex[0]]; - - if (type != null && type.isLobType()) { - it = rowIterator(); - - while (it.next()) { - Row row = it.getCurrentRow(); - Object[] data = row.getData(); - LobData value = (LobData) data[colIndex[0]]; - - if (value != null) { - session.sessionData.adjustLobUsageCount(value, +1); - } - } - } - } - } catch (OutOfMemoryError e) { - throw Error.error(ErrorCode.OUT_OF_MEMORY, e); - } - } - - public void reindex(Session session, Index index, Index useIndex) { - - writeLock(); - - try { - - // get the iterator first in case the index set null - RowIterator it; - - if (useIndex == null) { - it = table.rowIterator(this); - } else { - it = useIndex.firstRow(this); - } - - setAccessor(index, null); - - while (it.next()) { - RowAVL row = (RowAVL) it.getCurrentRow(); - - row.getNode(index.getPosition()).delete(); - index.insert(session, this, row); - } - } finally { - writeUnlock(); - } - } - - public IndexStats[] checkIndexes(Session session, int mode) { - - IndexStats[] indexStats = new IndexStats[accessorList.length]; - - for (int i = 0; i < indexList.length; i++) { - IndexAVL index = (IndexAVL) indexList[i]; - NodeAVL node = (NodeAVL) accessorList[i]; - IndexAVLProbe probe = new IndexAVLProbe(session, this, index, - node); - - probe.probe(); - - indexStats[i] = probe.getStats(); - } - - return indexStats; - } - - public void setReadOnly(boolean readOnly) {} - - public void readLock() {} - - public void readUnlock() {} - - public void writeLock() {} - - public void writeUnlock() {} - - void dropIndexFromRows(Index primaryIndex, Index oldIndex) { - - RowIterator it = primaryIndex.firstRow(this); - int position = oldIndex.getPosition() - 1; - - while (it.next()) { - Row row = it.getCurrentRow(); - int i = position; - NodeAVL backnode = ((RowAVL) row).getNode(0); - - while (i-- > 0) { - backnode = backnode.nNext; - } - - backnode.nNext = backnode.nNext.nNext; - } - - it.release(); - } - - boolean insertIndexNodes(Session session, Index primaryIndex, - Index newIndex) { - - writeLock(); - - try { - int position = newIndex.getPosition(); - RowIterator it = primaryIndex.firstRow(this); - int rowCount = 0; - HsqlException error = null; - - try { - while (it.next()) { - Row row = it.getCurrentRow(); - - ((RowAVL) row).insertNode(position); - - // count before inserting - rowCount++; - - newIndex.insert(session, this, row); - } - - it.release(); - - return true; - } catch (OutOfMemoryError e) { - error = Error.error(ErrorCode.OUT_OF_MEMORY, e); - } catch (HsqlException e) { - error = e; - } - - // backtrack on error - // rowCount rows have been modified - it = primaryIndex.firstRow(this); - - while (it.next()) { - Row row = it.getCurrentRow(); - NodeAVL backnode = ((RowAVL) row).getNode(0); - int j = 0; - - while (backnode != null) { - backnode = backnode.nNext; - - j++; - } - - if (j < indexList.length) { - break; - } - - backnode = ((RowAVL) row).getNode(position - 1); - backnode.nNext = backnode.nNext.nNext; - } - - it.release(); - - throw error; - } finally { - writeUnlock(); - } - } - - /** - * Used with memory indexes - */ - void destroyIndexes() { - - if (indexList.length == 0) { - return; - } - - IndexAVL idx = (IndexAVL) indexList[0]; - NodeAVL root = (NodeAVL) accessorList[0]; - - idx.unlinkNodes(this, root); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLDisk.java b/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLDisk.java deleted file mode 100644 index dc374de8..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLDisk.java +++ /dev/null @@ -1,659 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.RowAVLDisk; -import org.hsqldb.RowAVLDiskLarge; -import org.hsqldb.RowAction; -import org.hsqldb.RowActionBase; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TransactionManager; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.index.NodeAVL; -import org.hsqldb.index.NodeAVLDisk; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.DoubleLongIndex; -import org.hsqldb.lib.LongKeyHashMap; -import org.hsqldb.lib.LongLookup; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/* - * Implementation of PersistentStore for CACHED tables. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public class RowStoreAVLDisk extends RowStoreAVL { - - DataFileCache cache; - RowOutputInterface rowOut; - boolean largeData; - - public RowStoreAVLDisk(DataFileCache cache, Table table) { - - this.table = table; - this.database = table.database; - this.indexList = table.getIndexList(); - this.accessorList = new CachedObject[indexList.length]; - this.cache = cache; - rowOut = cache.rowOut.duplicate(); - largeData = database.logger.getDataFileFactor() > 1; - - cache.adjustStoreCount(1); - - rowActionMap = new LongKeyHashMap(8); - largeData = database.logger.propLargeData; - tableSpace = cache.spaceManager.getTableSpace(table.getSpaceID()); - lock = new ReentrantReadWriteLock(true); - readLock = lock.readLock(); - writeLock = lock.writeLock(); - } - - public boolean isMemory() { - return false; - } - - private void set(CachedObject object) { - - if (database.txManager.isMVRows()) { - RowAction action = (RowAction) rowActionMap.get(object.getPos()); - - if (action != null) { - ((Row) object).rowAction = action; - } - } - } - - public CachedObject get(long key, boolean keep) { - - CachedObject object = cache.get(key, this, keep); - - return object; - } - - public CachedObject get(long key) { - - CachedObject object = cache.get(key, this, false); - - return object; - } - - public CachedObject get(CachedObject object, boolean keep) { - - object = cache.get(object, this, keep); - - return object; - } - - public void add(Session session, CachedObject object, boolean tx) { - - int size = object.getRealSize(rowOut); - - size += indexList.length * NodeAVLDisk.SIZE_IN_BYTE; - size = rowOut.getStorageSize(size); - - object.setStorageSize(size); - - long pos = tableSpace.getFilePosition(size); - - object.setPos(pos); - - if (tx) { - RowAction action = RowAction.addInsertAction(session, table, this, - (Row) object); - - if (database.txManager.isMVRows()) { - rowActionMap.put(object.getPos(), action); - } - } - - cache.add(object, false); - - storageSize += size; - } - - public boolean canRead(Session session, long pos, int mode, int[] colMap) { - - if (database.txManager.isMVRows()) { - RowAction action = (RowAction) rowActionMap.get(pos); - - if (action == null) { - return true; - } - - return action.canRead(session, mode); - } - - return true; - } - - public boolean canRead(Session session, CachedObject object, int mode, - int[] colMap) { - - RowAction action = ((Row) object).rowAction; - - if (action == null) { - return true; - } - - return action.canRead(session, mode); - } - - public CachedObject get(RowInputInterface in) { - - Row row; - - if (largeData) { - row = new RowAVLDiskLarge(this, in); - } else { - row = new RowAVLDisk(this, in); - } - - set(row); - - return row; - } - - public CachedObject getNewCachedObject(Session session, Object object, - boolean tx) { - - Row row; - - if (largeData) { - row = new RowAVLDiskLarge(table, (Object[]) object, this); - } else { - row = new RowAVLDisk(table, (Object[]) object, this); - } - - add(session, row, tx); - - return row; - } - - public void delete(Session session, Row row) { - - try { - row = (Row) get(row, true); - - super.delete(session, row); - } finally { - row.keepInMemory(false); - } - } - - public void indexRow(Session session, Row row) { - - try { - row = (Row) get(row, true); - - super.indexRow(session, row); - } finally { - row.keepInMemory(false); - } - } - - public void removeAll() { - - if (cache.spaceManager.isMultiSpace()) { - if (tableSpace.isDefaultSpace()) { - LongLookup pointerLookup = getPointerList(); - - removeDefaultSpaces(pointerLookup); - } else { - cache.spaceManager.freeTableSpace(tableSpace.getSpaceID()); - } - } - - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - } - - public void remove(CachedObject object) { - - cache.remove(object); - tableSpace.release(object.getPos(), object.getStorageSize()); - - storageSize -= object.getStorageSize(); - } - - public void commitPersistence(CachedObject row) {} - - public void postCommitAction(Session session, RowAction action) { - - if (action.getType() == RowAction.ACTION_NONE) { - Lock mapLock = rowActionMap.getWriteLock(); - - mapLock.lock(); - - try { - - // remove only if not changed - if (action.getType() == RowActionBase.ACTION_NONE) { - rowActionMap.remove(action.getPos()); - } - } finally { - mapLock.unlock(); - } - } else if (action.getType() == RowAction.ACTION_DELETE_FINAL - && !action.isDeleteComplete()) { - action.setDeleteComplete(); - - Row row = action.getRow(); - - delete(session, row); - - // remove info after delete but before removing persistence - rowActionMap.remove(row.getPos()); - remove(row); - } - } - - public void commitRow(Session session, Row row, int changeAction, - int txModel) { - - Object[] data = row.getData(); - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - database.logger.writeDeleteStatement(session, (Table) table, - data); - - if (txModel == TransactionManager.LOCKS) { - remove(row); - } - break; - - case RowAction.ACTION_INSERT : - database.logger.writeInsertStatement(session, row, - (Table) table); - break; - - case RowAction.ACTION_INSERT_DELETE : - - // INSERT + DELETE - if (txModel == TransactionManager.LOCKS) { - remove(row); - } - break; - - case RowAction.ACTION_DELETE_FINAL : - delete(session, row); - - // remove info after delete but before removing persistence - if (database.txManager.isMVRows()) { - rowActionMap.remove(row.getPos()); - } - - remove(row); - break; - } - } - - public void rollbackRow(Session session, Row row, int changeAction, - int txModel) { - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - if (txModel == TransactionManager.LOCKS) { - row = (Row) get(row, true); - - ((RowAVL) row).setNewNodes(this); - row.keepInMemory(false); - indexRow(session, row); - } else { - RowAction ra = row.getAction(); - - if (ra.getType() == RowAction.ACTION_NONE) { - rowActionMap.remove(row.getPos()); - } - } - break; - - case RowAction.ACTION_INSERT : - delete(session, row); - - // remove info after delete but before removing persistence - if (database.txManager.isMVRows()) { - rowActionMap.remove(row.getPos()); - } - - remove(row); - break; - - case RowAction.ACTION_INSERT_DELETE : - if (txModel == TransactionManager.LOCKS) { - remove(row); - } else { - - // INSERT + DELETE - delete(session, row); - - // remove info after delete but before removing persistence - rowActionMap.remove(row.getPos()); - remove(row); - } - break; - } - } - - public RowAction addDeleteActionToRow(Session session, Row row, - int[] colMap, boolean isMV) { - - RowAction action = null; - - if (!isMV) { - synchronized (row) { - return RowAction.addDeleteAction(session, table, this, row, - colMap); - } - } - - row = (Row) cache.get(row, this, true); - - Lock mapLock = rowActionMap.getWriteLock(); - - mapLock.lock(); - - try { - action = RowAction.addDeleteAction(session, table, this, row, - colMap); - - if (action != null) { - rowActionMap.put(action.getPos(), action); - } - } finally { - mapLock.unlock(); - row.keepInMemory(false); - } - - return action; - } - - public DataFileCache getCache() { - return cache; - } - - /** - * Works only for TEXT TABLE as others need specific spaceManager - */ - public void setCache(DataFileCache cache) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVLDisk"); - } - - public void release() { - - cache.adjustStoreCount(-1); - - cache = null; - - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - } - - public CachedObject getAccessor(Index key) { - - int position = key.getPosition(); - - if (position >= accessorList.length) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVLDisk"); - } - - NodeAVL node = (NodeAVL) accessorList[position]; - - if (node == null) { - return null; - } - - RowAVL row = (RowAVL) get(node.getRow(this), false); - - node = row.getNode(key.getPosition()); - accessorList[key.getPosition()] = node; - - return node; - } - - /** - * Sets the index roots of a cached table to specified file pointers. - * If a file pointer is -1 then the particular index root is null. A null - * index root signifies an empty table. Accordingly, all index roots should - * be null or all should be a valid file pointer/reference. - */ - public void setAccessors(long base, long[] accessors, long cardinality) { - - for (int index = 0; index < indexList.length; index++) { - setAccessor(indexList[index], accessors[index]); - } - - setElementCount(cardinality); - } - - public void setAccessor(Index key, long accessor) { - - CachedObject object = get(accessor, false); - - if (object != null) { - NodeAVL node = ((RowAVL) object).getNode(key.getPosition()); - - object = node; - } - - setAccessor(key, object); - } - - public void resetAccessorKeys(Session session, Index[] keys) { - - if (indexList.length == 0 || accessorList[0] == null) { - indexList = keys; - accessorList = new CachedObject[indexList.length]; - - return; - } - - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVLDisk"); - } - - public void setReadOnly(boolean readOnly) {} - - public void setSpaceManager(Session session) { - - if (table.getSpaceID() == DataSpaceManager.tableIdDefault) { - return; - } - - TableSpaceManager tableSpace = - cache.spaceManager.getTableSpace(table.getSpaceID()); - - setSpaceManager(tableSpace); - moveDataToSpace(session); - } - - public void moveDataToSpace(Session session) { - - Table table = (Table) this.table; - long rowCount = elementCount(); - - if (rowCount == 0) { - return; - } - - if (rowCount > Integer.MAX_VALUE) { - - // error too big - return; - } - - writeLock(); - - try { - LongLookup pointerLookup = getPointerList(); - LongLookup removeList = pointerLookup.duplicate(); - - moveDataToNewSpace(cache, pointerLookup); - - CachedObject[] newAccessorList = - new CachedObject[accessorList.length]; - - for (int i = 0; i < accessorList.length; i++) { - Index key = indexList[i]; - long pos = pointerLookup.lookup(accessorList[i].getPos()); - RowAVL row = (RowAVL) cache.get(pos, this, false); - NodeAVL node = row.getNode(key.getPosition()); - - newAccessorList[key.getPosition()] = node; - } - - removeDefaultSpaces(removeList); - - accessorList = newAccessorList; - } finally { - writeUnlock(); - } - - database.logger.logDetailEvent("table written " - + table.getName().name); - } - - public void moveDataToSpace(DataFileCache targetCache, - LongLookup pointerLookup) { - populatePointerList(pointerLookup); - moveDataToNewSpace(targetCache, pointerLookup); - } - - private DoubleLongIndex getPointerList() { - - DoubleLongIndex pointerLookup = - new DoubleLongIndex((int) elementCount()); - - populatePointerList(pointerLookup); - - return pointerLookup; - } - - private void populatePointerList(LongLookup pointerLookup) { - - RowIterator it = indexList[0].firstRow(this); - - while (it.next()) { - CachedObject row = it.getCurrentRow(); - - pointerLookup.addUnsorted(row.getPos(), row.getStorageSize()); - } - - pointerLookup.sort(); - } - - private void moveDataToNewSpace(DataFileCache targetCache, - LongLookup pointerLookup) { - - int spaceId = table.getSpaceID(); - TableSpaceManager targetSpace = - targetCache.spaceManager.getTableSpace(spaceId); - - for (int i = 0; i < pointerLookup.size(); i++) { - long newPos = targetSpace.getFilePosition( - (int) pointerLookup.getLongValue(i)); - - pointerLookup.setLongValue(i, newPos); - } - - RowIterator it = indexList[0].firstRow(this); - - while (it.next()) { - CachedObject row = it.getCurrentRow(); - long newPos = pointerLookup.lookup(row.getPos()); - - // write - targetCache.rowOut.reset(); - row.write(targetCache.rowOut, pointerLookup); - targetCache.saveRowOutput(newPos); - } - } - - private void removeDefaultSpaces(LongLookup removeList) { - - DataSpaceManager manager = cache.spaceManager; - int scale = cache.getDataFileScale(); - - for (int i = 0; i < removeList.size(); i++) { - long pos = removeList.getLongKey(i); - long size = removeList.getLongValue(i) / scale; - - removeList.setLongValue(i, size); - cache.release(pos); - } - - removeList.compactLookupAsIntervals(); - manager.freeTableSpace(DataSpaceManager.tableIdDefault, removeList, 0, - 0); - } - - long getStorageSizeEstimate() { - - if (elementCount.get() == 0) { - return 0; - } - - CachedObject accessor = getAccessor(indexList[0]); - CachedObject row = get(accessor.getPos(), false); - - return row.getStorageSize() * elementCount.get(); - } - - public void readLock() { - readLock.lock(); - } - - public void readUnlock() { - readLock.unlock(); - } - - public void writeLock() { - writeLock.lock(); - } - - public void writeUnlock() { - writeLock.unlock(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLDiskData.java b/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLDiskData.java deleted file mode 100644 index 9c31d2c2..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLDiskData.java +++ /dev/null @@ -1,315 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.hsqldb.HsqlException; -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.RowAVLDiskData; -import org.hsqldb.RowAction; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TransactionManager; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowOutputInterface; - -/* - * Implementation of PersistentStore for TEXT tables. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public class RowStoreAVLDiskData extends RowStoreAVL { - - TextCache cache; - RowOutputInterface rowOut; - AtomicInteger accessCount; - - public RowStoreAVLDiskData(Table table) { - - this.database = table.database; - this.table = table; - this.indexList = table.getIndexList(); - this.accessorList = new CachedObject[indexList.length]; - lock = new ReentrantReadWriteLock(); - readLock = lock.readLock(); - writeLock = lock.writeLock(); - } - - public Object[] getData(RowAVLDiskData row) { - - cache.writeLock.lock(); - - try { - cache.get(row, this, false); - - return row.getData(); - } finally { - cache.writeLock.unlock(); - } - } - - public int getNextAccessCount() { - return accessCount.incrementAndGet(); - } - - public CachedObject get(long key, boolean keep) { - - CachedObject object = cache.get(key, this, keep); - - return object; - } - - public CachedObject get(CachedObject object, boolean keep) { - - object = cache.get(object, this, keep); - - return object; - } - - public void add(Session session, CachedObject object, boolean tx) { - - cache.writeLock.lock(); - - try { - int size = object.getRealSize(rowOut); - - object.setStorageSize(size); - - long pos = tableSpace.getFilePosition(size); - - object.setPos(pos); - - if (tx) { - RowAction.addInsertAction(session, table, this, (Row) object); - } - - cache.add(object, false); - } finally { - cache.writeLock.unlock(); - } - } - - public CachedObject get(RowInputInterface in) { - - RowAVLDiskData row = new RowAVLDiskData(this, table, in); - - cache.cache.put(row); - - return row; - } - - public CachedObject get(CachedObject object, RowInputInterface in) { - - Object[] rowData = in.readData(table.getColumnTypes()); - - ((RowAVLDiskData) object).setData(rowData); - - return object; - } - - public CachedObject getNewCachedObject(Session session, Object object, - boolean tx) { - - Row row = new RowAVLDiskData(this, table, (Object[]) object); - - add(session, row, tx); - - return row; - } - - public void indexRow(Session session, Row row) { - super.indexRow(session, row); - } - - public boolean isMemory() { - return false; - } - - public void removeAll() { - - destroyIndexes(); - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - } - - public void remove(CachedObject object) { - cache.remove(object); - } - - public CachedObject getAccessor(Index key) { - - int position = key.getPosition(); - - if (position >= accessorList.length) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVL"); - } - - return accessorList[position]; - } - - public void commitPersistence(CachedObject row) { - - try { - cache.saveRow(row); - } catch (HsqlException e1) {} - } - - public void postCommitAction(Session session, RowAction action) { - - if (action.getType() == RowAction.ACTION_DELETE_FINAL - && !action.isDeleteComplete()) { - action.setDeleteComplete(); - - Row row = action.getRow(); - - if (row == null) { - row = (Row) get(action.getPos(), false); - } - - delete(session, row); - remove(row); - } - } - - public void commitRow(Session session, Row row, int changeAction, - int txModel) { - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - cache.removePersistence(row); - break; - - case RowAction.ACTION_INSERT : - commitPersistence(row); - break; - - case RowAction.ACTION_INSERT_DELETE : - - // INSERT + DELETE - if (txModel == TransactionManager.LOCKS) { - remove(row); - } else { - delete(session, row); - remove(row); - } - break; - - case RowAction.ACTION_DELETE_FINAL : - throw Error.runtimeError(ErrorCode.U_S0500, "RowStore"); - } - } - - public void rollbackRow(Session session, Row row, int changeAction, - int txModel) { - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - if (txModel == TransactionManager.LOCKS) { - ((RowAVL) row).setNewNodes(this); - indexRow(session, row); - } - break; - - case RowAction.ACTION_INSERT : - if (txModel == TransactionManager.LOCKS) { - delete(session, row); - remove(row); - } - break; - - case RowAction.ACTION_INSERT_DELETE : - - // INSERT + DELETE - if (txModel == TransactionManager.LOCKS) { - remove(row); - } else { - delete(session, row); - remove(row); - } - break; - } - } - - public DataFileCache getCache() { - return cache; - } - - public void setCache(DataFileCache cache) { - - this.cache = (TextCache) cache; - this.tableSpace = - cache.spaceManager.getTableSpace(DataSpaceManager.tableIdDefault); - accessCount = cache.getAccessCount(); - rowOut = cache.rowOut; - } - - /** - * Does not adjust usage count - */ - public void release() { - - destroyIndexes(); - table.database.logger.textTableManager.closeTextCache((Table) table); - - cache = null; - - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - } - - public void readLock() { - readLock.lock(); - } - - public void readUnlock() { - readLock.unlock(); - } - - public void writeLock() { - writeLock.lock(); - } - - public void writeUnlock() { - writeLock.unlock(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLHybrid.java b/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLHybrid.java deleted file mode 100644 index 1dbe6813..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLHybrid.java +++ /dev/null @@ -1,387 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.Arrays; - -import org.hsqldb.HsqlException; -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.RowAVLDisk; -import org.hsqldb.RowAction; -import org.hsqldb.Session; -import org.hsqldb.TableBase; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.index.IndexAVL; -import org.hsqldb.index.NodeAVL; -import org.hsqldb.index.NodeAVLDisk; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.rowio.RowInputInterface; - -/* - * Implementation of PersistentStore for result sets. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public class RowStoreAVLHybrid extends RowStoreAVL { - - DataFileCache cache; - private final int maxMemoryRowCount; - private boolean useDisk; - boolean isCached; - long rowIdSequence = 0; - - public RowStoreAVLHybrid(Session session, TableBase table, - boolean diskBased) { - - this.table = table; - this.maxMemoryRowCount = session.getResultMemoryRowCount(); - this.useDisk = diskBased; - - if (maxMemoryRowCount == 0) { - this.useDisk = false; - } - - if (table.getTableType() == TableBase.RESULT_TABLE) { - setTimestamp(session.getActionSCN()); - } - -// test code to force use of cache -/* - if (diskBased) { - this.maxMemoryRowCount = 0; - this.useDisk = true; - } -*/ - -// - resetAccessorKeys(session, table.getIndexList()); - - nullsList = new boolean[table.getColumnCount()]; - } - - public boolean isMemory() { - return !isCached; - } - - public void setMemory(boolean mode) { - useDisk = !mode; - } - - public CachedObject get(long i, boolean keep) { - - try { - if (isCached) { - return cache.get(i, this, keep); - } else { - throw Error.runtimeError(ErrorCode.U_S0500, - "RowStoreAVLHybrid"); - } - } catch (HsqlException e) { - return null; - } - } - - public CachedObject get(CachedObject object, boolean keep) { - - try { - if (object.isMemory()) { - return object; - } - - if (isCached) { - return cache.get(object, this, keep); - } else { - return object; - } - } catch (HsqlException e) { - return null; - } - } - - public void add(Session session, CachedObject object, boolean tx) { - - if (isCached) { - int size = object.getRealSize(cache.rowOut); - - size += indexList.length * NodeAVLDisk.SIZE_IN_BYTE; - size = cache.rowOut.getStorageSize(size); - - object.setStorageSize(size); - - long pos = tableSpace.getFilePosition(size); - - object.setPos(pos); - cache.add(object, false); - } - - Object[] data = ((Row) object).getData(); - - for (int i = 0; i < nullsList.length; i++) { - if (data[i] == null) { - nullsList[i] = true; - } - } - } - - public CachedObject get(RowInputInterface in) { - - try { - if (isCached) { - return new RowAVLDisk(this, in); - } - } catch (HsqlException e) { - return null; - } - - return null; - } - - public CachedObject getNewCachedObject(Session session, Object object, - boolean tx) { - - if (!isCached) { - if (useDisk && elementCount.get() >= maxMemoryRowCount) { - changeToDiskTable(session); - } - } - - Row row; - - if (isCached) { - row = new RowAVLDisk(table, (Object[]) object, this); - } else { - long id = rowIdSequence++; - - row = new RowAVL(table, (Object[]) object, id, this); - } - - add(session, row, tx); - - return row; - } - - public void indexRow(Session session, Row row) { - - try { - row = (Row) get(row, true); - - super.indexRow(session, row); - } finally { - row.keepInMemory(false); - } - } - - public void removeAll() { - - if (!isCached) { - destroyIndexes(); - } - - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - - Arrays.fill(nullsList, false); - } - - public void remove(CachedObject object) { - - if (object.isMemory()) { - return; - } - - if (isCached) { - cache.remove(object); - } - } - - public void commitPersistence(CachedObject row) {} - - public void postCommitAction(Session session, RowAction rowAction) {} - - public void commitRow(Session session, Row row, int changeAction, - int txModel) { - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - remove(row); - break; - - case RowAction.ACTION_INSERT : - break; - - case RowAction.ACTION_INSERT_DELETE : - - // INSERT + DELEETE - remove(row); - break; - - case RowAction.ACTION_DELETE_FINAL : - throw Error.runtimeError(ErrorCode.U_S0500, "RowStore"); - } - } - - public void rollbackRow(Session session, Row row, int changeAction, - int txModel) { - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - row = (Row) get(row, true); - - ((RowAVL) row).setNewNodes(this); - row.keepInMemory(false); - indexRow(session, row); - break; - - case RowAction.ACTION_INSERT : - delete(session, row); - remove(row); - break; - - case RowAction.ACTION_INSERT_DELETE : - - // INSERT + DELEETE - remove(row); - break; - } - } - - // - public DataFileCache getCache() { - return cache; - } - - public void setCache(DataFileCache cache) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVLHybrid"); - } - - public void release() { - - if (isCached) { - cache.adjustStoreCount(-1); - - cache = null; - isCached = false; - } else { - destroyIndexes(); - } - - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - } - - public CachedObject getAccessor(Index key) { - - int position = key.getPosition(); - NodeAVL node = (NodeAVL) accessorList[position]; - - if (node == null) { - return null; - } - - RowAVL oldRow = node.getRow(this); - RowAVL row = (RowAVL) get(oldRow, false); - - node = row.getNode(key.getPosition()); - accessorList[key.getPosition()] = node; - - return node; - } - - public synchronized void resetAccessorKeys(Session session, Index[] keys) { - - if (indexList.length == 0 || accessorList[0] == null) { - indexList = keys; - accessorList = new CachedObject[indexList.length]; - - return; - } - - if (isCached) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVLHybrid"); - } - - super.resetAccessorKeys(session, keys); - } - - public boolean hasNull(int pos) { - return nullsList[pos]; - } - - public final void changeToDiskTable(Session session) { - - cache = - session.sessionData.persistentStoreCollection - .getSessionDataCache(); - - if (cache == null) { - useDisk = false; - - return; - } - - tableSpace = - cache.spaceManager.getTableSpace(DataSpaceManager.tableIdDefault); - isCached = true; - - cache.adjustStoreCount(1); - - if (elementCount.get() == 0) { - return; - } - - IndexAVL idx = (IndexAVL) indexList[0]; - NodeAVL root = (NodeAVL) accessorList[0]; - RowIterator iterator = table.rowIterator(this); - - ArrayUtil.fillArray(accessorList, null); - ArrayUtil.fillArray(nullsList, false); - elementCount.set(0); - - while (iterator.next()) { - Row row = iterator.getCurrentRow(); - Row newRow = (Row) getNewCachedObject(session, row.getData(), - false); - - indexRow(session, newRow); - } - - idx.unlinkNodes(this, root); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLHybridExtended.java b/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLHybridExtended.java deleted file mode 100644 index 1cc3f249..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLHybridExtended.java +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.RowAction; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TableBase; -import org.hsqldb.index.Index; -import org.hsqldb.index.NodeAVL; -import org.hsqldb.navigator.RowIterator; - -/* - * Implementation of PersistentStore for information schema and temp tables. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.0.1 - */ -public class RowStoreAVLHybridExtended extends RowStoreAVLHybrid { - - Session session; - - public RowStoreAVLHybridExtended(Session session, TableBase table, - boolean diskBased) { - - super(session, table, diskBased); - - this.session = session; - } - - public CachedObject getNewCachedObject(Session session, Object object, - boolean tx) { - - if (!resettingAccessor && table.getIndexCount() != indexList.length) { - resetAccessorKeys(session, table.getIndexList()); - } - - return super.getNewCachedObject(session, object, tx); - } - - public synchronized void add(Session session, CachedObject object, - boolean tx) { - - super.add(session, object, tx); - - if (tx) { - RowAction.addInsertAction(session, table, this, (Row) object); - } - } - - public void indexRow(Session session, Row row) { - - NodeAVL node = ((RowAVL) row).getNode(0); - int count = 0; - - while (node != null) { - count++; - - node = node.nNext; - } - - if (isCached && row.isMemory() || count != indexList.length) { - row = (Row) getNewCachedObject(session, row.getData(), true); - } - - super.indexRow(session, row); - } - - /** - * Row might have changed from memory to disk or indexes added - */ - public void delete(Session session, Row row) { - - NodeAVL node = ((RowAVL) row).getNode(0); - int count = 0; - - while (node != null) { - count++; - - node = node.nNext; - } - - if ((isCached && row.isMemory()) || count != indexList.length) { - row = ((Table) table).getDeleteRowFromLog(session, row.getData()); - } - - if (row != null) { - super.delete(session, row); - } - } - - public synchronized double searchCost(Session session, Index index, - int count, int opType) { - - if (table.getIndexCount() != indexList.length) { - resetAccessorKeys(session, table.getIndexList()); - } - - return super.searchCost(session, index, count, opType); - } - - boolean resettingAccessor = false; - - public CachedObject getAccessor(Index key) { - - if (!resettingAccessor && key.getPosition() > 0 - && table.getIndexCount() != indexList.length) { - resetAccessorKeys(session, table.getIndexList()); - } - - return super.getAccessor(key); - } - - public synchronized void resetAccessorKeys(Session session, Index[] keys) { - - resettingAccessor = true; - - try { - if (indexList.length == 0 || accessorList[0] == null) { - indexList = keys; - accessorList = new CachedObject[indexList.length]; - - return; - } - - boolean result; - - if (isCached) { - resetAccessorKeysCached(keys); - } else { - super.resetAccessorKeys(session, keys); - } - } finally { - resettingAccessor = false; - } - } - - private void resetAccessorKeysCached(Index[] keys) { - - RowStoreAVLHybrid tempStore = new RowStoreAVLHybridExtended(session, - table, true); - - tempStore.changeToDiskTable(session); - - tempStore.indexList = indexList; - tempStore.accessorList = accessorList; - - tempStore.elementCount.set(elementCount.get()); - - // - indexList = keys; - accessorList = new CachedObject[indexList.length]; - - elementCount.set(0); - - RowIterator iterator = tempStore.rowIterator(); - - while (iterator.next()) { - Row row = iterator.getCurrentRow(); - Row newRow = (Row) getNewCachedObject(session, row.getData(), - false); - - indexRow(session, newRow); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLMemory.java b/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLMemory.java deleted file mode 100644 index 297cc6f1..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowStoreAVLMemory.java +++ /dev/null @@ -1,218 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.hsqldb.Row; -import org.hsqldb.RowAVL; -import org.hsqldb.RowAction; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.TransactionManager; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.rowio.RowInputInterface; - -/* - * Implementation of PersistentStore for MEMORY tables. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public class RowStoreAVLMemory extends RowStoreAVL { - - AtomicInteger rowIdSequence = new AtomicInteger(); - - public RowStoreAVLMemory(Table table) { - - this.database = table.database; - this.table = table; - this.indexList = table.getIndexList(); - this.accessorList = new CachedObject[indexList.length]; - lock = new ReentrantReadWriteLock(true); - readLock = lock.readLock(); - writeLock = lock.writeLock(); - } - - public boolean isMemory() { - return true; - } - - public CachedObject get(long i, boolean keep) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVLMemory"); - } - - public CachedObject get(CachedObject object, boolean keep) { - return object; - } - - public void add(Session session, CachedObject object, boolean tx) {} - - public CachedObject get(RowInputInterface in) { - throw Error.runtimeError(ErrorCode.U_S0500, "RowStoreAVLMemory"); - } - - public CachedObject getNewCachedObject(Session session, Object object, - boolean tx) { - - long id = rowIdSequence.getAndIncrement(); - Row row = new RowAVL(table, (Object[]) object, id, this); - - if (tx) { - RowAction.addInsertAction(session, table, this, row); - } - - return row; - } - - public void removeAll() { - - destroyIndexes(); - setTimestamp(0); - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - } - - public void remove(CachedObject object) {} - - public void release(long i) {} - - public void commitPersistence(CachedObject row) {} - - public void postCommitAction(Session session, RowAction action) { - - if (action.getType() == RowAction.ACTION_DELETE_FINAL - && !action.isDeleteComplete()) { - action.setDeleteComplete(); - - Row row = action.getRow(); - - delete(session, row); - } - } - - public void commitRow(Session session, Row row, int changeAction, - int txModel) { - - if (!database.logger.isCurrentlyLogged()) { - return; - } - - Object[] data = row.getData(); - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - database.logger.writeDeleteStatement(session, (Table) table, - data); - break; - - case RowAction.ACTION_INSERT : - database.logger.writeInsertStatement(session, row, - (Table) table); - break; - - case RowAction.ACTION_INSERT_DELETE : - - // INSERT + DELETE - break; - - case RowAction.ACTION_DELETE_FINAL : - throw Error.runtimeError(ErrorCode.U_S0500, "RowStore"); - } - } - - public void rollbackRow(Session session, Row row, int changeAction, - int txModel) { - - switch (changeAction) { - - case RowAction.ACTION_DELETE : - if (txModel == TransactionManager.LOCKS) { - ((RowAVL) row).setNewNodes(this); - indexRow(session, row); - } - break; - - case RowAction.ACTION_INSERT : - delete(session, row); - remove(row); - break; - - case RowAction.ACTION_INSERT_DELETE : - - // INSERT + DELETE - if (txModel == TransactionManager.LOCKS) { - remove(row); - } else { - delete(session, row); - remove(row); - } - break; - } - } - - // - public DataFileCache getCache() { - return null; - } - - public void setCache(DataFileCache cache) {} - - public void release() { - - destroyIndexes(); - setTimestamp(0); - elementCount.set(0); - ArrayUtil.fillArray(accessorList, null); - } - - public void readLock() { - readLock.lock(); - } - - public void readUnlock() { - readLock.unlock(); - } - - public void writeLock() { - writeLock.lock(); - } - - public void writeUnlock() { - writeLock.unlock(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/RowStoreDataChange.java b/database/hsqldb/src/org/hsqldb/persist/RowStoreDataChange.java deleted file mode 100644 index 156dbbd1..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/RowStoreDataChange.java +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.HsqlException; -import org.hsqldb.Row; -import org.hsqldb.RowDiskDataChange; -import org.hsqldb.Session; -import org.hsqldb.TableBase; -import org.hsqldb.rowio.RowInputInterface; - -/* - * Implementation of PersistentStore for data change lists. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.4.0 - * @since 2.2.7 - */ -public class RowStoreDataChange extends RowStoreAVLHybrid { - - Session session; - - public RowStoreDataChange(Session session, TableBase table) { - - super(session, table, true); - - this.session = session; - - super.changeToDiskTable(session); - } - - public CachedObject getNewCachedObject(Session session, Object object, - boolean tx) { - - Row row = new RowDiskDataChange(table, (Object[]) object, this, null); - - add(session, row, tx); - - return row; - } - - public CachedObject get(RowInputInterface in) { - - try { - return new RowDiskDataChange(session, this, in); - } catch (HsqlException e) { - return null; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/ScriptLoader.java b/database/hsqldb/src/org/hsqldb/persist/ScriptLoader.java deleted file mode 100644 index e72a557f..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/ScriptLoader.java +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Session; -import org.hsqldb.result.Result; -import org.hsqldb.scriptio.ScriptReaderText; - -public class ScriptLoader { - - public static Result loadScriptData(Session session, String pathName, - int mode, boolean isVersioning) { - - ScriptReaderText scr = null; - - try { - scr = new ScriptReaderText(session.getDatabase(), pathName, false); - - RowInsertInterface.ErrorLogger errorLogger; - - if (mode == RowInsertInterface.modes.continueOnError) { - errorLogger = new RowInsertSimple.InsertErrorHandler( - session.getDatabase(), pathName); - } else { - errorLogger = new RowInsertSimple.DefaultErrorHandler(); - } - - RowInsertInterface rowInsert; - - if (isVersioning) { - rowInsert = new RowInsertVersioning(session, errorLogger, mode); - } else { - rowInsert = new RowInsertSimple(session, errorLogger, mode); - } - - scr.setInserter(rowInsert); - scr.readExistingData(session); - - return Result.updateZeroResult; - } catch (Throwable t) { - return Result.newErrorResult(t); - } finally { - if (scr != null) { - scr.close(); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/ScriptRunner.java b/database/hsqldb/src/org/hsqldb/persist/ScriptRunner.java deleted file mode 100644 index a9b2cc39..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/ScriptRunner.java +++ /dev/null @@ -1,278 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.EOFException; - -import org.hsqldb.Database; -import org.hsqldb.HsqlException; -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.Statement; -import org.hsqldb.StatementDML; -import org.hsqldb.StatementTypes; -import org.hsqldb.Table; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.IntKeyHashMap; -import org.hsqldb.map.ValuePool; -import org.hsqldb.result.Result; -import org.hsqldb.scriptio.ScriptReaderBase; -import org.hsqldb.scriptio.ScriptReaderDecode; -import org.hsqldb.scriptio.ScriptReaderText; -import org.hsqldb.scriptio.StatementLineTypes; - -/** - * Restores the state of a Database instance from an SQL log file.

    - * - * If there is an error, processing stops at that line and the message is - * logged to the application log. If memory runs out, an exception is thrown. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since 1.7.2 - */ -public class ScriptRunner { - - /** - * This is used to read the *.log file and manage any necessary - * transaction rollback. - */ - public static void runScript(Database database, String logFilename, - boolean fullReplay) { - - Crypto crypto = database.logger.getCrypto(); - ScriptReaderBase scr; - - try { - if (crypto == null) { - scr = new ScriptReaderText(database, logFilename, false); - } else { - scr = new ScriptReaderDecode(database, logFilename, crypto, - true); - } - } catch (Throwable e) { - - // catch out-of-memory errors and terminate - if (e instanceof EOFException) { - - // end of file - normal end - } else { - - // stop processing on bad script line - database.logger.logSevereEvent("opening log file", e); - } - - return; - } - - runScript(database, scr, fullReplay); - } - - private static void runScript(Database database, ScriptReaderBase scr, - boolean fullReplay) { - - IntKeyHashMap sessionMap = new IntKeyHashMap(); - Session current = null; - int currentId = 0; - String statement; - int statementType; - Statement dummy = new StatementDML(StatementTypes.UPDATE_CURSOR, null); - String databaseFile = database.getCanonicalPath(); - String action = fullReplay ? "open aborted" - : "open continued"; - - dummy.setCompileTimestamp(Long.MAX_VALUE); - database.setReferentialIntegrity(false); - - try { - while (scr.readLoggedStatement(current)) { - int sessionId = scr.getSessionNumber(); - - if (current == null || currentId != sessionId) { - currentId = sessionId; - current = (Session) sessionMap.get(currentId); - - if (current == null) { - - // note the sessionId does not match the sessionId of - // new session - current = - database.getSessionManager().newSessionForLog( - database); - - sessionMap.put(currentId, current); - } - } - - Result result = null; - - statementType = scr.getStatementType(); - - switch (statementType) { - - case StatementLineTypes.SET_FILES_CHECK_STATEMENT : - result = null; - - // fall through - case StatementLineTypes.ANY_STATEMENT : - statement = scr.getLoggedStatement(); - - Statement cs; - - try { - cs = current.compileStatement(statement); - result = current.executeCompiledStatement(cs, - ValuePool.emptyObjectArray, 0); - } catch (Throwable e) { - result = Result.newErrorResult(e); - } - - if (result != null && result.isError()) { - if (result.getException() != null) { - throw result.getException(); - } - - throw Error.error(result); - } - break; - - case StatementLineTypes.COMMIT_STATEMENT : - current.commit(false); - break; - - case StatementLineTypes.INSERT_STATEMENT : { - current.sessionContext.currentStatement = dummy; - current.sessionContext.invalidStatement = false; - - current.beginAction(dummy); - - Object[] data = scr.getData(); - - scr.getCurrentTable().insertNoCheckFromLog(current, - data); - current.endAction(Result.updateOneResult); - - break; - } - case StatementLineTypes.DELETE_STATEMENT : { - current.sessionContext.currentStatement = dummy; - - current.beginAction(dummy); - - Table table = scr.getCurrentTable(); - PersistentStore store = table.getRowStore(current); - Object[] data = scr.getData(); - Row row = table.getDeleteRowFromLog(current, data); - - if (row != null) { - current.addDeleteAction(table, store, row, null); - } - - current.endAction(Result.updateOneResult); - - break; - } - case StatementLineTypes.SET_SCHEMA_STATEMENT : { - HsqlName name = - database.schemaManager.findSchemaHsqlName( - scr.getCurrentSchema()); - - current.setCurrentSchemaHsqlName(name); - - break; - } - case StatementLineTypes.SESSION_ID : { - break; - } - default : - throw Error.error(ErrorCode.ERROR_IN_LOG_FILE); - } - - if (current.isClosed()) { - current = null; - - sessionMap.remove(currentId); - } - } - } catch (HsqlException e) { - if (e.getErrorCode() == -ErrorCode.ERROR_IN_LOG_FILE) { - throw e; - } - - // stop processing on bad log line - String error = "statement error processing log - " + action + " " - + scr.getFileNamePath() + " line: " - + scr.getLineNumber(); - - database.logger.logSevereEvent(error, e); - - if (fullReplay) { - throw Error.error(e, ErrorCode.ERROR_IN_LOG_FILE, error); - } - } catch (OutOfMemoryError e) { - String error = "out of memory processing log - " + databaseFile - + " line: " + scr.getLineNumber(); - - // catch out-of-memory errors and terminate - database.logger.logSevereEvent(error, e); - - throw Error.error(ErrorCode.OUT_OF_MEMORY, e); - } catch (Throwable t) { - HsqlException e = - Error.error(t, ErrorCode.ERROR_IN_LOG_FILE, - ErrorCode.M_DatabaseScriptReader_read, - new String[] { - scr.getLineNumber() + " " + databaseFile, t.getMessage() - }); - - // stop processing on bad script line - String error = "statement error processing log - " + action - + scr.getFileNamePath() + " line: " - + scr.getLineNumber(); - - database.logger.logSevereEvent(error, e); - - if (fullReplay) { - throw e; - } - } finally { - if (scr != null) { - scr.close(); - } - - database.getSessionManager().closeAllSessions(); - database.setReferentialIntegrity(true); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/SimpleStore.java b/database/hsqldb/src/org/hsqldb/persist/SimpleStore.java deleted file mode 100644 index 87bbb41b..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/SimpleStore.java +++ /dev/null @@ -1,213 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Row; -import org.hsqldb.RowAction; -import org.hsqldb.Session; -import org.hsqldb.TableBase; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.index.Index; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.rowio.RowInputInterface; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.3.0 - */ -public abstract class SimpleStore implements PersistentStore { - - protected DataFileCache cache; - protected TableSpaceManager spaceManager; - protected int defaultObjectSize; - - public boolean isRowStore() { - return false; - } - - public CachedObject get(CachedObject object, boolean keep) { - return cache.get(object, this, keep); - } - - public CachedObject get(long i, boolean keep) { - return cache.get(i, this, keep); - } - - public void remove(CachedObject object) { - - if (cache != null) { - cache.remove(object); - spaceManager.release(object.getPos(), object.getStorageSize()); - } - } - - public boolean canRead(Session session, long pos, int mode, int[] colMap) { - return true; - } - - public boolean canRead(Session session, CachedObject object, int mode, - int[] colMap) { - return true; - } - - public void commitPersistence(CachedObject object) {} - - public int getDefaultObjectSize() { - return defaultObjectSize; - } - - public CachedObject getNewCachedObject(Session session, Object object, - boolean tx) { - throw Error.runtimeError(ErrorCode.U_S0500, "PersistentStore"); - } - - public void removeAll() {} - - public DataFileCache getCache() { - return cache; - } - - public TableSpaceManager getSpaceManager() { - return spaceManager; - } - - public void setSpaceManager(TableSpaceManager manager) { - spaceManager = manager; - } - - public boolean isMemory() { - return cache == null; - } - - public void reindex(Session session, Index index, Index useIndex) {} - - public void setCache(DataFileCache cache) { - this.cache = cache; - } - - public void release() {} - - public PersistentStore getAccessorStore(Index index) { - return null; - } - - public CachedObject getAccessor(Index key) { - return null; - } - - public double searchCost(Session session, Index idx, int count, - int opType) { - return 1; - } - - public long elementCount() { - return 0; - } - - public long elementCount(Session session) { - return 0; - } - - public long elementCountUnique(Index index) { - return 0; - } - - public void setAccessors(long base, long[] accessors, long cardinality) {} - - public void setAccessor(Index key, CachedObject accessor) {} - - public void setAccessor(Index key, long accessor) {} - - public boolean hasNull(int pos) { - return false; - } - - public void resetAccessorKeys(Session session, Index[] keys) {} - - public void setMemory(boolean mode) {} - - public void delete(Session session, Row row) {} - - public RowAction addDeleteActionToRow(Session session, Row row, - int[] colMap, boolean isMV) { - return null; - } - - public CachedObject get(CachedObject object, RowInputInterface in) { - return object; - } - - public void indexRow(Session session, Row row) {} - - public void indexRows(Session session) {} - - public RowIterator rowIterator() { - return null; - } - - public Index[] getAccessorKeys() { - return null; - } - - public void moveData(Session session, PersistentStore other, - int[] colIndex, int adjust) {} - - public void setReadOnly(boolean readonly) {} - - public void readLock() {} - - public void readUnlock() {} - - public void writeLock() {} - - public void writeUnlock() {} - - public TableBase getTable() { - return null; - } - - public long getTimestamp() { - return 0; - } - - public void setTimestamp(long timestamp) {} - - public void commitRow(Session session, Row row, int changeAction, - int txModel) {} - - public void rollbackRow(Session session, Row row, int changeAction, - int txModel) {} - - public void postCommitAction(Session session, RowAction rowAction) {} -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TableSpaceManager.java b/database/hsqldb/src/org/hsqldb/persist/TableSpaceManager.java deleted file mode 100644 index 29238bc2..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TableSpaceManager.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (c) 2001-2020, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.lib.LongLookup; - -/** - * Manages allocation of space for rows.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.3.0 - */ -public interface TableSpaceManager { - - int getSpaceID(); - - /** - * Deallocates a deleted block - */ - void release(long pos, int rowSize); - - /** - * Allocates a block - */ - long getFilePosition(int rowSize); - - boolean hasFileRoom(long blockSize); - - void addFileBlock(long blockFreePos, long blockLimit); - - void initialiseFileBlock(LongLookup lookup, long blockFreePos, - long blockLimit); - - void reset(); - - long getLostBlocksSize(); - - boolean isDefaultSpace(); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TableSpaceManagerBlocks.java b/database/hsqldb/src/org/hsqldb/persist/TableSpaceManagerBlocks.java deleted file mode 100644 index 1f742ca1..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TableSpaceManagerBlocks.java +++ /dev/null @@ -1,366 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.DoubleIntIndex; -import org.hsqldb.lib.DoubleLongIndex; -import org.hsqldb.lib.LongLookup; - -/** - * Manages allocation of space for rows.

    - * Maintains a list of free file blocks with fixed capacity.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.3.0 - */ -public class TableSpaceManagerBlocks implements TableSpaceManager { - - // - final DataSpaceManager spaceManager; - final int scale; - final int fileBlockSize; - final int spaceID; - - // - private DoubleIntIndex spaceList; - private DoubleIntIndex oldList; - private DoubleLongIndex oldLargeList; - private final int capacity; - private long requestGetCount; - private long releaseCount; - private long requestCount; - private long requestSize; - boolean isModified; - boolean isInitialised; - - // - long freshBlockFreePos = 0; - long freshBlockLimit = 0; - long currentBlockFloor = 0; - long currentBlockLimit = 0; - int fileBlockIndex = -1; - - /** - * - */ - public TableSpaceManagerBlocks(DataSpaceManager spaceManager, int spaceId, - int fileBlockSize, int capacity, - int fileScale) { - - this.spaceManager = spaceManager; - this.spaceID = spaceId; - this.fileBlockSize = fileBlockSize; - this.capacity = capacity; - this.scale = fileScale; - this.spaceList = new DoubleIntIndex(capacity, true); - - spaceList.setValuesSearchTarget(); - - oldList = new DoubleIntIndex(capacity, true); - } - - public boolean hasFileRoom(long blockSize) { - return freshBlockLimit - freshBlockFreePos > blockSize; - } - - public void addFileBlock(long blockFreePos, long blockLimit) { - - int released = (int) (freshBlockLimit - freshBlockFreePos); - - if (released > 0) { - release(freshBlockFreePos / scale, released); - } - - initialiseFileBlock(null, blockFreePos, blockLimit); - } - - public void initialiseFileBlock(LongLookup spaceList, long blockFreePos, - long blockLimit) { - - isInitialised = true; - freshBlockFreePos = blockFreePos; - freshBlockLimit = blockLimit; - currentBlockFloor = (freshBlockFreePos / fileBlockSize) - * (fileBlockSize / scale); - currentBlockLimit = freshBlockLimit / scale; - - if (spaceList != null) { - ((DoubleIntIndex) spaceList).copyTo(this.spaceList); - } - } - - private boolean getNewMainBlock(long rowSize) { - - long blockCount; - long blockSize; - long position; - - // called only on initialisation - if (!isInitialised) { - isInitialised = true; - - spaceManager.initialiseTableSpace(this); - - if (freshBlockFreePos + rowSize <= freshBlockLimit) { - return true; - } - } - - blockCount = (fileBlockSize + rowSize) / fileBlockSize; - blockSize = blockCount * fileBlockSize; - position = spaceManager.getFileBlocks(spaceID, (int) blockCount); - - if (position < 0) { - return false; - } - - if (position != freshBlockLimit) { - long released = freshBlockLimit - freshBlockFreePos; - - if (released > 0) { - release(freshBlockFreePos / scale, (int) released); - } - - freshBlockFreePos = position; - freshBlockLimit = position; - } - - freshBlockLimit += blockSize; - currentBlockFloor = (freshBlockFreePos / fileBlockSize) - * (fileBlockSize / scale); - currentBlockLimit = freshBlockLimit / scale; - - if (oldList.size() + spaceList.size() > oldList.capacity()) { - resetOldList(); - } - - oldList.addUnsorted(spaceList); - resetOldList(); - spaceList.clear(); - - return true; - } - - private long getNewBlock(long rowSize) { - - if (freshBlockFreePos + rowSize > freshBlockLimit) { - boolean result = getNewMainBlock(rowSize); - - if (!result) { - throw Error.error(ErrorCode.DATA_FILE_IS_FULL); - } - } - - long position = freshBlockFreePos; - - freshBlockFreePos += rowSize; - - return position / scale; - } - - public int getSpaceID() { - return spaceID; - } - - synchronized public void release(long pos, int rowSize) { - - int rowUnits = rowSize / scale; - - isModified = true; - - releaseCount++; - - if (pos + rowUnits >= Integer.MAX_VALUE) { - if (oldLargeList == null) { - oldLargeList = new DoubleLongIndex(capacity); - } - - oldLargeList.addUnsorted(pos, rowUnits); - - if (oldLargeList.size() == capacity) { - resetOldList(); - } - - return; - } - - if ((pos >= currentBlockFloor && pos < currentBlockLimit)) { - spaceList.add(pos, rowUnits); - - if (spaceList.size() == capacity) { - resetList(false); - } - } else { - oldList.addUnsorted(pos, rowUnits); - - if (oldList.size() == capacity) { - resetOldList(); - } - } - } - - /** - * Returns the position of a free block or throws - */ - synchronized public long getFilePosition(int rowSize) { - - requestGetCount++; - - if (capacity == 0) { - return getNewBlock(rowSize); - } - - int index = -1; - int rowUnits = rowSize / scale; - - if (spaceList.size() > 0) { - if (spaceList.getValue(0) >= rowUnits) { - index = 0; - } else { - index = spaceList.findFirstGreaterEqualKeyIndex(rowUnits); - - if (index == -1) { - spaceList.compactLookupAsIntervals(); - spaceList.setValuesSearchTarget(); - - index = spaceList.findFirstGreaterEqualKeyIndex(rowUnits); - } - } - } - - if (index == -1) { - return getNewBlock(rowSize); - } - - requestCount++; - - requestSize += rowSize; - - int key = spaceList.getKey(index); - int units = spaceList.getValue(index); - int difference = units - rowUnits; - - spaceList.remove(index); - - if (difference > 0) { - int pos = key + rowUnits; - - spaceList.add(pos, difference); - } - - return key; - } - - public void reset() { - - if (freshBlockFreePos == 0) { - fileBlockIndex = -1; - } else { - fileBlockIndex = (int) (freshBlockFreePos / fileBlockSize); - } - - resetOldList(); - resetList(true); - - freshBlockFreePos = 0; - freshBlockLimit = 0; - currentBlockFloor = 0; - currentBlockLimit = 0; - } - - public long getLostBlocksSize() { - - long total = freshBlockLimit - freshBlockFreePos - + spaceList.getTotalValues() * scale - + oldList.getTotalValues() * scale; - - return total; - } - - public boolean isDefaultSpace() { - return spaceID == DataSpaceManager.tableIdDefault; - } - - public int getFileBlockIndex() { - return fileBlockIndex; - } - - private void resetList(boolean full) { - - spaceList.compactLookupAsIntervals(); - - if (full) { - spaceManager.freeTableSpace(spaceID, spaceList, freshBlockFreePos, - freshBlockLimit); - spaceList.clear(); - spaceList.setValuesSearchTarget(); - } else { - if (spaceList.size() > capacity - 32) { - int limit = capacity / 2; - - for (int i = 0; i < limit; i++) { - int pos = spaceList.getKey(i); - int rowUnits = spaceList.getValue(i); - - oldList.addUnsorted(pos, rowUnits); - - if (oldList.size() == capacity) { - resetOldList(); - } - } - - spaceList.removeRange(0, limit); - resetOldList(); - } - - spaceList.setValuesSearchTarget(); - } - } - - private void resetOldList() { - - if (oldList.size() > 0) { - oldList.compactLookupAsIntervals(); - spaceManager.freeTableSpace(spaceID, oldList, 0, 0); - oldList.clear(); - } - - if (oldLargeList != null && oldLargeList.size() > 0) { - oldLargeList.compactLookupAsIntervals(); - spaceManager.freeTableSpace(spaceID, oldLargeList, 0, 0); - oldLargeList.clear(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TableSpaceManagerSimple.java b/database/hsqldb/src/org/hsqldb/persist/TableSpaceManagerSimple.java deleted file mode 100644 index aafec550..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TableSpaceManagerSimple.java +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.LongLookup; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.3.0 - */ -public class TableSpaceManagerSimple implements TableSpaceManager { - - DataFileCache cache; - final int scale; - - public TableSpaceManagerSimple(DataFileCache cache) { - this.cache = cache; - this.scale = cache.getDataFileScale(); - } - - public int getSpaceID() { - return DataSpaceManager.tableIdDefault; - } - - public void release(long pos, int rowSize) {} - - /** - * Returns the position of a free block or throws. - */ - public long getFilePosition(int rowSize) { - - cache.writeLock.lock(); - - try { - long filePosition = cache.getFileFreePos(); - long position; - long newFreePosition; - - position = filePosition / scale; - newFreePosition = filePosition + rowSize; - - if (newFreePosition > cache.maxDataFileSize) { - cache.logSevereEvent("data file reached maximum size " - + cache.dataFileName, null); - - throw Error.error(ErrorCode.DATA_FILE_IS_FULL); - } - - cache.fileFreePosition = newFreePosition; - - return position; - } finally { - cache.writeLock.unlock(); - } - } - - public boolean hasFileRoom(long blockSize) { - return true; - } - - public void addFileBlock(long blockFreePos, long blockLimit) {} - - public void initialiseFileBlock(LongLookup lookup, long blockFreePos, - long blockLimit) {} - - public void reset() {} - - public long getLostBlocksSize() { - return 0; - } - - public boolean isDefaultSpace() { - return true; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TextCache.java b/database/hsqldb/src/org/hsqldb/persist/TextCache.java deleted file mode 100644 index 282b995c..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TextCache.java +++ /dev/null @@ -1,455 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Database; -import org.hsqldb.DatabaseType; -import org.hsqldb.HsqlException; -import org.hsqldb.Row; -import org.hsqldb.Table; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.lib.HsqlByteArrayOutputStream; -import org.hsqldb.lib.LongKeyHashMap; -import org.hsqldb.rowio.RowInputText; -import org.hsqldb.rowio.RowInputTextQuoted; -import org.hsqldb.rowio.RowOutputText; -import org.hsqldb.rowio.RowOutputTextQuoted; - -// Ito Kazumitsu 20030328 - patch 1.7.2 - character encoding support -// Dimitri Maziuk - patch for NL in string support -// sqlbob@users - updated for 1.8.0 to allow new-lines in fields -// fredt@users - updated for 1.8.0 to allow correct behaviour with transactions - -/** - * Acts as a buffer manager for a single TEXT table and its Row data.

    - * - * Handles read/write operations on the table's text format data file using a - * compatible pair of org.hsqldb.rowio input/output class instances. - * - * - * fredt - This used to write rows as soon as they are inserted - * but now this is subject to transaction management. - * A memory buffer contains the rows not yet committed. - * Refactored for version 2.2.6. - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since 1.7.0 - */ -public class TextCache extends DataFileCache { - - // - TextFileSettings textFileSettings; - - //state of Cache - protected String header; - protected Table table; - private LongKeyHashMap uncommittedCache; - HsqlByteArrayOutputStream buffer = new HsqlByteArrayOutputStream(128); - - // - - /** - * The source string for a cached table is evaluated and the parameters - * are used to open the source file.

    - * - * Settings are used in this order: (1) settings specified in the - * source string for the table (2) global database settings in - * *.properties file (3) program defaults - */ - TextCache(Table table, String name) { - - super(table.database, name); - - this.table = table; - uncommittedCache = new LongKeyHashMap(); - } - - protected void initParams(Database database, String settingsString, - boolean defrag) { - - this.database = database; - fa = FileUtil.getFileUtil(); - textFileSettings = new TextFileSettings(database.getProperties(), - settingsString); - dataFileName = textFileSettings.getFileName(); - - if (dataFileName == null) { - throw Error.error(ErrorCode.X_S0501); - } - - dataFileName = ((FileUtil) fa).canonicalOrAbsolutePath(dataFileName); - maxCacheRows = textFileSettings.getMaxCacheRows(); - maxCacheBytes = textFileSettings.getMaxCacheBytes(); - - // max size is 256G - maxDataFileSize = (long) Integer.MAX_VALUE * Logger.largeDataFactor; - cachedRowPadding = 1; - dataFileScale = 1; - } - - protected void initBuffers() { - - if (textFileSettings.isQuoted || textFileSettings.isAllQuoted) { - rowIn = new RowInputTextQuoted(textFileSettings); - rowOut = new RowOutputTextQuoted(textFileSettings); - } else { - rowIn = new RowInputText(textFileSettings); - rowOut = new RowOutputText(textFileSettings); - } - } - - /** - * Opens a data source file. - */ - public void open(boolean readonly) { - - fileFreePosition = 0; - - try { - int type = database.getType() == DatabaseType.DB_RES - ? RAFile.DATA_FILE_JAR - : RAFile.DATA_FILE_TEXT; - - dataFile = RAFile.newScaledRAFile(database, dataFileName, - readonly, type); - fileFreePosition = dataFile.length(); - - if (fileFreePosition > maxDataFileSize) { - throw Error.error(ErrorCode.DATA_FILE_IS_FULL); - } - - initBuffers(); - - spaceManager = new DataSpaceManagerSimple(this, readonly); - } catch (Throwable t) { - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_TextCache_opening_file_error, - new String[] { - dataFileName, t.toString() - }); - } - - cacheReadonly = readonly; - } - - public void release() { - close(); - } - - /** - * Writes newly created rows to disk. In the current implementation, - * such rows have already been saved, so this method just removes a - * source file that has no rows. - */ - public void close() { - - if (dataFile == null) { - return; - } - - writeLock.lock(); - - try { - cache.saveAll(); - - boolean empty = (dataFile.length() - <= textFileSettings.bytesForLineEnd.length); - - dataFile.synch(); - dataFile.close(); - - dataFile = null; - - if (empty && !cacheReadonly) { - FileUtil.getFileUtil().delete(dataFileName); - } - - uncommittedCache.clear(); - } catch (Throwable t) { - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_TextCache_closing_file_error, - new String[] { - dataFileName, t.toString() - }); - } finally { - writeLock.unlock(); - } - } - - /** - * Closes the source file and deletes it if it is not read-only. - */ - void purge() { - - writeLock.lock(); - - try { - uncommittedCache.clear(); - - if (cacheReadonly) { - release(); - } else { - if (dataFile != null) { - dataFile.close(); - - dataFile = null; - } - - FileUtil.getFileUtil().delete(dataFileName); - } - } catch (Throwable t) { - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_TextCache_purging_file_error, - new String[] { - dataFileName, t.toString() - }); - } finally { - writeLock.unlock(); - } - } - - /** - * - */ - public void remove(CachedObject object) { - - writeLock.lock(); - - try { - long pos = object.getPos(); - CachedObject row = (CachedObject) uncommittedCache.remove(pos); - - if (row != null) { - return; - } - - cache.release(pos); - } finally { - writeLock.unlock(); - } - } - - public void removePersistence(CachedObject row) { - - writeLock.lock(); - - try { - clearRowImage(row); - } finally { - writeLock.unlock(); - } - } - - private void clearRowImage(CachedObject row) { - - try { - int length = row.getStorageSize(); - int count = length - textFileSettings.bytesForLineEnd.length; - - rowOut.reset(); - - HsqlByteArrayOutputStream out = rowOut.getOutputStream(); - - for (; count > 0; count -= textFileSettings.bytesForSpace.length) { - out.write(textFileSettings.bytesForSpace); - } - - out.write(textFileSettings.bytesForLineEnd); - dataFile.seek(row.getPos()); - dataFile.write(out.getBuffer(), 0, out.size()); - } catch (Throwable t) { - throw Error.runtimeError(ErrorCode.U_S0500, t.getMessage()); - } - } - - public void add(CachedObject object, boolean keep) { - - writeLock.lock(); - - try { - uncommittedCache.put(object.getPos(), object); - } finally { - writeLock.unlock(); - } - } - - /** cannot use isInMemory() for text cached object */ - public CachedObject get(CachedObject object, PersistentStore store, - boolean keep) { - - if (object == null) { - return null; - } - - writeLock.lock(); - - try { - CachedObject existing = cache.get(object.getPos()); - - if (existing != null) { - return object; - } - - try { - buffer.reset(object.getStorageSize()); - dataFile.seek(object.getPos()); - dataFile.read(buffer.getBuffer(), 0, object.getStorageSize()); - buffer.setSize(object.getStorageSize()); - - String rowString = - buffer.toString(textFileSettings.charEncoding); - - ((RowInputText) rowIn).setSource(rowString, object.getPos(), - buffer.size()); - store.get(object, rowIn); - cache.put(object); - - Row row = (Row) object; - - if (textFileSettings.isNullDef) { - table.generateDefaultForNull(row.getData()); - } - - return object; - } catch (Throwable t) { - database.logger.logSevereEvent(dataFileName - + " getFromFile problem " - + object.getPos(), t); - cache.clearUnchanged(); - - return object; - } - } finally { - writeLock.unlock(); - } - } - - public CachedObject get(long i, PersistentStore store, boolean keep) { - throw Error.runtimeError(ErrorCode.U_S0500, "TextCache"); - } - - protected void saveRows(CachedObject[] rows, int offset, int count) { - - // no-op - } - - /** - * The row is always in uncommittedCache. - * Saves the row as normal and removes it - */ - public void saveRow(CachedObject row) { - - writeLock.lock(); - - try { - setFileModified(); - saveRowNoLock(row); - uncommittedCache.remove(row.getPos()); - cache.put(row); - } catch (Throwable e) { - database.logger.logSevereEvent("saveRow failed", e); - - throw Error.error(ErrorCode.DATA_FILE_ERROR, e); - } finally { - writeLock.unlock(); - } - } - - public String getHeader() { - return header; - } - - public void setHeaderInitialise(String header) { - this.header = header; - } - - public void setHeader(String header) { - - if (textFileSettings.isIgnoreFirst && fileFreePosition == 0) { - try { - writeHeader(header); - - this.header = header; - } catch (HsqlException e) { - throw new HsqlException( - e, Error.getMessage(ErrorCode.GENERAL_IO_ERROR), - ErrorCode.GENERAL_IO_ERROR); - } - - return; - } - - throw Error.error(ErrorCode.TEXT_TABLE_HEADER); - } - - private void writeHeader(String header) { - - try { - byte[] buf = null; - String firstLine = header + TextFileSettings.NL; - - buf = firstLine.getBytes(textFileSettings.charEncoding); - - dataFile.seek(0); - dataFile.write(buf, 0, buf.length); - - fileFreePosition = buf.length; - } catch (Throwable t) { - throw Error.error(ErrorCode.TEXT_FILE_IO, t); - } - } - - public long getLineNumber() { - return ((RowInputText) rowIn).getLineNumber(); - } - - public TextFileSettings getTextFileSettings() { - return textFileSettings; - } - - public boolean isIgnoreFirstLine() { - return textFileSettings.isIgnoreFirst; - } - - protected void setFileModified() { - fileModified = true; - } - - public TextFileReader getTextFileReader() { - return TextFileReader8.newTextFileReader(dataFile, textFileSettings, - rowIn, cacheReadonly); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TextFileOps.java b/database/hsqldb/src/org/hsqldb/persist/TextFileOps.java deleted file mode 100644 index 92f569ce..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TextFileOps.java +++ /dev/null @@ -1,254 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.Database; -import org.hsqldb.Row; -import org.hsqldb.Session; -import org.hsqldb.Table; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.navigator.RowIterator; -import org.hsqldb.result.Result; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowInputText; -import org.hsqldb.rowio.RowInputTextQuoted; -import org.hsqldb.rowio.RowOutputInterface; -import org.hsqldb.rowio.RowOutputText; -import org.hsqldb.rowio.RowOutputTextQuoted; -import org.hsqldb.types.Type; - -/** - * Read and write delimited text files. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 2.7.0 -*/ -public class TextFileOps { - - public static Result loadTextData(Session session, String fileSettings, - Table table, int mode) { - - TextFileReader reader; - Database database = session.database; - FileUtil fa = FileUtil.getFileUtil(); - TextFileSettings textFileSettings = - new TextFileSettings(database.getProperties(), fileSettings); - String dataFileName = textFileSettings.getFileName(); - RandomAccessInterface dataFile; - RowInputInterface rowIn; - RowInsertSimple rowInsert; - - if (dataFileName == null || dataFileName.length() == 0) { - throw Error.error(ErrorCode.X_S0501); - } - - dataFileName = fa.canonicalOrAbsolutePath(dataFileName); - - boolean exists = FileUtil.getFileUtil().exists(dataFileName); - - if (!exists) { - throw Error.error(null, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_TextCache_opening_file_error, - new String[] { - dataFileName, "file does not exist" - }); - } - - try { - dataFile = RAFile.newScaledRAFile(database, dataFileName, true, - RAFile.DATA_FILE_TEXT); - } catch (Throwable t) { - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_TextCache_opening_file_error, - new String[] { - dataFileName, t.toString() - }); - } - - if (textFileSettings.isQuoted || textFileSettings.isAllQuoted) { - rowIn = new RowInputTextQuoted(textFileSettings); - } else { - rowIn = new RowInputText(textFileSettings); - } - - reader = TextFileReader8.newTextFileReader(dataFile, textFileSettings, - rowIn, true); - - RowInsertInterface.ErrorLogger callback; - - if (mode == RowInsertInterface.modes.continueOnError) { - callback = new RowInsertSimple.InsertErrorHandler(database, - dataFileName); - } else { - callback = new RowInsertSimple.DefaultErrorHandler(); - } - - rowInsert = new RowInsertSimple(session, callback, mode); - - PersistentStore store = table.getRowStore(session); - Type[] types = table.getColumnTypes(); - boolean ignoreFirst = textFileSettings.isIgnoreFirst; - - try { - while (true) { - rowIn = reader.readObject(); - - if (rowIn == null) { - break; - } - - if (ignoreFirst) { - ignoreFirst = false; - - continue; - } - - Object[] data = rowIn.readData(types); - - if (textFileSettings.isNullDef) { - table.generateDefaultForNull(data); - } - - table.generateAndCheckData(session, data); - - if (mode == RowInsertInterface.modes.checkUntillError) { - continue; - } - - rowInsert.insert(table, store, data); - } - - rowInsert.finishTable(); - } catch (Throwable t) { - long linenumber = reader.getLineNumber(); - - throw Error.error(t, ErrorCode.TEXT_FILE, 0, new String[] { - String.valueOf(linenumber), t.toString() - }); - } finally { - rowInsert.close(); - - try { - if (callback != null) { - callback.close(); - } - } catch (Exception e) {} - - try { - dataFile.close(); - } catch (Exception e) {} - } - - return Result.newUpdateCountResult((int) reader.getLineNumber()); - } - - public static Result unloadTextData(Session session, String fileSettings, - Table table) { - - Database database = session.database; - FileUtil fa = FileUtil.getFileUtil(); - TextFileSettings textFileSettings = - new TextFileSettings(database.getProperties(), fileSettings); - String dataFileName = textFileSettings.getFileName(); - RandomAccessInterface dataFile; - RowOutputInterface rowOut; - int lineCount = 0; - - if (dataFileName == null || dataFileName.length() == 0) { - throw Error.error(ErrorCode.X_S0501); - } - - dataFileName = fa.canonicalOrAbsolutePath(dataFileName); - - boolean exists = FileUtil.getFileUtil().exists(dataFileName); - - if (exists) { - throw Error.error(null, ErrorCode.TEXT_SOURCE_EXISTS, - ErrorCode.M_TextCache_opening_file_error, - new String[] { - dataFileName, "file exists" - }); - } - - try { - dataFile = new RAFileSimple(database.logger, dataFileName, "rw"); - } catch (Throwable t) { - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_TextCache_opening_file_error, - new String[]{ dataFileName }); - } - - if (textFileSettings.isQuoted || textFileSettings.isAllQuoted) { - rowOut = new RowOutputTextQuoted(textFileSettings); - } else { - rowOut = new RowOutputText(textFileSettings); - } - - PersistentStore store = table.getRowStore(session); - Type[] types = table.getColumnTypes(); - RowIterator it = table.rowIteratorForScript(store); - long filePosition = 0; - - try { - while (it.next()) { - rowOut.reset(); - - Row row = it.getCurrentRow(); - - rowOut.writeData(row, types); - rowOut.writeEnd(); - dataFile.seek(filePosition); - dataFile.write(rowOut.getOutputStream().getBuffer(), 0, - rowOut.getOutputStream().size()); - - filePosition += rowOut.getOutputStream().size(); - - lineCount++; - } - - dataFile.synch(); - } catch (Throwable t) { - throw Error.error(t, ErrorCode.FILE_IO_ERROR, - ErrorCode.M_TextCache_opening_file_error, - new String[]{ dataFileName }); - } finally { - try { - dataFile.close(); - } catch (Exception e) {} - } - - return Result.newUpdateCountResult((int) lineCount); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TextFileReader.java b/database/hsqldb/src/org/hsqldb/persist/TextFileReader.java deleted file mode 100644 index 3f0587d5..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TextFileReader.java +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.rowio.RowInputInterface; - -/** - * Reader interface for text files. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 2.3.4 -*/ -public interface TextFileReader { - - String getHeaderLine(); - - long getLineNumber(); - - void readHeaderLine(); - - RowInputInterface readObject(); -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TextFileReader16.java b/database/hsqldb/src/org/hsqldb/persist/TextFileReader16.java deleted file mode 100644 index cea44522..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TextFileReader16.java +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.IOException; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowInputText; - -/** - * Reader for UTF-16 text files. - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 2.3.4 -*/ -public class TextFileReader16 extends TextFileReader8 -implements TextFileReader { - - TextFileReader16(RandomAccessInterface dataFile, - TextFileSettings textFileSettings, - RowInputInterface rowIn, boolean isReadOnly) { - - super(); - - this.dataFile = dataFile; - this.textFileSettings = textFileSettings; - this.rowIn = rowIn; - this.buffer = StringCreator.getStringCreator(char.class, - textFileSettings.charEncoding); - - skipBOM(); - } - - private void skipBOM() { - - try { - if (textFileSettings.isUTF16) { - dataFile.seek(0); - - if (dataFile.read() == 0xFE && dataFile.read() == 0xFF) { - position = 2; - } else { - dataFile.seek(0); - - if (dataFile.read() == 0xFF && dataFile.read() == 0xFE) { - position = 2; - - textFileSettings.setLittleEndianByteOrderMark(); - } - } - } - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE_IO, e); - } - } - - int getByteSizeForChar() { - return 2; - } - - int readChar() { - - try { - int c1 = dataFile.read(); - - if (c1 == -1) { - return -1; - } - - int c2 = dataFile.read(); - - if (c2 == -1) { - return -1; - } - - if (textFileSettings.isLittleEndian) { - int temp = c1; - - c1 = c2; - c2 = temp; - } - - return (char) ((c1 << 8) + c2); - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE_IO, e); - } - } - - public String getHeaderLine() { - return header; - } - - public long getLineNumber() { - return ((RowInputText) rowIn).getLineNumber(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TextFileReader8.java b/database/hsqldb/src/org/hsqldb/persist/TextFileReader8.java deleted file mode 100644 index c2a8aaf2..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TextFileReader8.java +++ /dev/null @@ -1,502 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.CharArrayWriter; -import org.hsqldb.lib.HsqlByteArrayOutputStream; -import org.hsqldb.rowio.RowInputInterface; -import org.hsqldb.rowio.RowInputText; - -// fredt@users - 2.3.4 - patch for user-defined quote char by Damjan Jovanovic - -/** - * Reader for 8-bit text files. - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 2.2.7 -*/ -public class TextFileReader8 implements TextFileReader { - - RandomAccessInterface dataFile; - RowInputInterface rowIn; - TextFileSettings textFileSettings; - String header; - boolean isReadOnly; - StringCreator buffer; - long position = 0; - - TextFileReader8() {} - - TextFileReader8(RandomAccessInterface dataFile, - TextFileSettings textFileSettings, - RowInputInterface rowIn, boolean isReadOnly) { - - this.dataFile = dataFile; - this.textFileSettings = textFileSettings; - this.rowIn = rowIn; - this.isReadOnly = isReadOnly; - this.buffer = StringCreator.getStringCreator(byte.class, - textFileSettings.charEncoding); - - skipBOM(); - } - - static TextFileReader newTextFileReader(RandomAccessInterface dataFile, - TextFileSettings textFileSettings, RowInputInterface rowIn, - boolean isReadOnly) { - - if (textFileSettings.isUTF16) { - return new TextFileReader16(dataFile, textFileSettings, rowIn, - isReadOnly); - } else { - return new TextFileReader8(dataFile, textFileSettings, rowIn, - isReadOnly); - } - } - - private void skipBOM() { - - try { - if (textFileSettings.isUTF8) { - dataFile.seek(0); - - if (dataFile.read() == 0xEF && dataFile.read() == 0xBB - && dataFile.read() == 0xBF) { - position = 3; - } - } - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE_IO, e); - } - } - - public RowInputInterface readObject() { - - boolean hasQuote = false; - boolean complete = false; - boolean wasCR = false; - boolean wasNormal = false; - long currentPos; - long fieldPos; - boolean quotedField = false; - - buffer.reset(); - - position = findNextUsedLinePos(); - - if (position == -1) { - return null; - } - - try { - dataFile.seek(position); - - currentPos = 0; - fieldPos = -1; - - while (!complete) { - int c = readChar(); - - wasNormal = false; - - if (c == -1) { - if (buffer.size() == 0) { - return null; - } - - complete = true; - - if (wasCR) { - break; - } - - if (!isReadOnly) { - dataFile.write( - textFileSettings.bytesForLineEnd, 0, - textFileSettings.bytesForLineEnd.length); - - for (int i = 0; - i < textFileSettings.bytesForLineEnd.length; - i++) { - buffer.write(textFileSettings.bytesForLineEnd[i]); - } - } - - break; - } - - if (c == textFileSettings.singleSeparator) { - - // quoted field reset - if (!hasQuote) { - fieldPos = currentPos; - quotedField = false; - hasQuote = false; - } - } else if (c == textFileSettings.quoteChar) { - wasNormal = true; - complete = wasCR; - wasCR = false; - - // quoted field can begin only after separator - // or anywhere when separator is multibyte - if (textFileSettings.isQuoted) { - if (textFileSettings.singleSeparator == 0 - || currentPos == fieldPos + 1) { - quotedField = true; - } - } - - if (quotedField) { - hasQuote = !hasQuote; - } - } else { - switch (c) { - - case TextFileSettings.CR_CHAR : - wasCR = !hasQuote; - break; - - case TextFileSettings.LF_CHAR : - complete = !hasQuote; - break; - - default : - wasNormal = true; - complete = wasCR; - wasCR = false; - } - } - - buffer.write(c); - - currentPos++; - } - - if (complete) { - if (wasNormal) { - buffer.setSize(buffer.size() - 1); - } - - String rowString; - - try { - rowString = buffer.getString(); - } catch (UnsupportedEncodingException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - - ((RowInputText) rowIn).setSource(rowString, position, - buffer.getByteSize()); - - position += rowIn.getSize(); - - return rowIn; - } - - return null; - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE_IO, e); - } - } - - public void readHeaderLine() { - - boolean complete = false; - boolean wasCR = false; - boolean wasNormal = false; - - buffer.reset(); - - try { - dataFile.seek(position); - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE_IO, e); - } - - while (!complete) { - wasNormal = false; - - int c; - - try { - c = readChar(); - - if (c == -1) { - if (buffer.size() == 0) { - return; - } - - complete = true; - - if (!isReadOnly) { - dataFile.write( - textFileSettings.bytesForLineEnd, 0, - textFileSettings.bytesForLineEnd.length); - - for (int i = 0; - i < textFileSettings.bytesForLineEnd.length; - i++) { - buffer.write(textFileSettings.bytesForLineEnd[i]); - } - } - - break; - } - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE, e); - } - - switch (c) { - - case TextFileSettings.CR_CHAR : - wasCR = true; - break; - - case TextFileSettings.LF_CHAR : - complete = true; - break; - - default : - wasNormal = true; - complete = wasCR; - wasCR = false; - } - - if (wasCR || complete) { - continue; - } - - buffer.write(c); - } - - if (wasNormal) { - buffer.setSize(buffer.size() - 1); - } - - try { - header = buffer.getString(); - } catch (UnsupportedEncodingException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - - position += buffer.getByteSize(); - } - - /** - * Searches from file pointer, pos, and finds the beginning of the first - * line that contains any non-space character. Increments the row counter - * when a blank line is skipped. - * - * If none found return -1 - */ - private long findNextUsedLinePos() { - - try { - long firstPos = position; - long currentPos = position; - boolean wasCR = false; - - dataFile.seek(position); - - while (true) { - int c = readChar(); - - currentPos += getByteSizeForChar(); - - switch (c) { - - case TextFileSettings.CR_CHAR : - wasCR = true; - break; - - case TextFileSettings.LF_CHAR : - wasCR = false; - - ((RowInputText) rowIn).skippedLine(); - - firstPos = currentPos; - break; - - case ' ' : - if (wasCR) { - wasCR = false; - - ((RowInputText) rowIn).skippedLine(); - } - break; - - case -1 : - return -1; - - default : - if (wasCR) { - wasCR = false; - - ((RowInputText) rowIn).skippedLine(); - } - - return firstPos; - } - } - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE_IO, e); - } - } - - int getByteSizeForChar() { - return 1; - } - - int readChar() { - - try { - int c1 = dataFile.read(); - - return c1; - } catch (IOException e) { - throw Error.error(ErrorCode.TEXT_FILE_IO, e); - } - } - - public String getHeaderLine() { - return header; - } - - public long getLineNumber() { - return ((RowInputText) rowIn).getLineNumber(); - } - - static abstract class StringCreator { - - static StringCreator getStringCreator(Class cl, String encoding) { - - if (byte.class.equals(cl)) { - return new StringCreatorBytes(encoding); - } else if (char.class.equals(cl)) { - return new StringCreatorChars(); - } else { - throw Error.runtimeError(ErrorCode.U_S0500, "StringCreator"); - } - } - - abstract void reset(); - - abstract void write(int c); - - abstract int size(); - - abstract void setSize(int size); - - abstract String getString() throws UnsupportedEncodingException; - - abstract int getByteSize(); - } - - static class StringCreatorBytes extends StringCreator { - - private HsqlByteArrayOutputStream buffer; - private String encoding; - - StringCreatorBytes(String encoding) { - this.buffer = new HsqlByteArrayOutputStream(128); - this.encoding = encoding; - } - - void reset() { - buffer.reset(); - } - - void write(int c) { - buffer.write(c); - } - - int size() { - return buffer.size(); - } - - void setSize(int size) { - buffer.setSize(size); - } - - String getString() throws UnsupportedEncodingException { - return buffer.toString(encoding); - } - - int getByteSize() { - return buffer.size(); - } - } - - static class StringCreatorChars extends StringCreator { - - private CharArrayWriter buffer; - - StringCreatorChars() { - this.buffer = new CharArrayWriter(128); - } - - void reset() { - buffer.reset(); - } - - void write(int c) { - buffer.write(c); - } - - int size() { - return buffer.size(); - } - - void setSize(int size) { - buffer.setSize(size); - } - - String getString() { - - String string = new String(buffer.getBuffer(), 0, buffer.size()); - - return string; - } - - int getByteSize() { - return buffer.size() * 2; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TextFileSettings.java b/database/hsqldb/src/org/hsqldb/persist/TextFileSettings.java deleted file mode 100644 index 15fe06b3..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TextFileSettings.java +++ /dev/null @@ -1,381 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import java.io.UnsupportedEncodingException; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * Parser and container for text table settings. - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 2.2.6 - */ -public class TextFileSettings { - - //state of Cache - public static final String NL = System.getProperty("line.separator"); - public String fs; - public String vs; - public String lvs; - public String qc; - public char quoteChar; - public String stringEncoding; - public boolean isQuoted; - public boolean isAllQuoted; - public boolean isIgnoreFirst; - public boolean isNullDef; - public String charEncoding; - public boolean isUTF8; - public boolean isUTF16; - public boolean hasUTF16BOM; - public boolean isLittleEndian; - - // - private static final byte[] BYTES_NL = NL.getBytes(); - private static final byte[] SP = new byte[]{ ' ' }; - - // - String dataFileName; - int maxCacheRows; - int maxCacheBytes; - char singleSeparator = 0; - byte[] bytesForLineEnd = BYTES_NL; - byte[] bytesForSpace = SP; - - // - static final char DOUBLE_QUOTE_CHAR = '\"'; - static final char BACKSLASH_CHAR = '\\'; - public static final char LF_CHAR = '\n'; - public static final char CR_CHAR = '\r'; - - /** - * The source string for a cached table is evaluated and the parameters - * are used to open the source file.

    - * - * Settings are used in this order: (1) settings specified in the - * source string for the table (2) global database settings - * (3) program defaults - */ - TextFileSettings(HsqlDatabaseProperties dbProps, String settingsString) { - - HsqlProperties tableprops = - HsqlProperties.delimitedArgPairsToProps(settingsString, "=", ";", - "textdb"); - - switch (tableprops.errorCodes.length) { - - case 0 : - - // no source file name - this.dataFileName = null; - break; - - case 1 : - - // source file name is the only key without a value - this.dataFileName = tableprops.errorKeys[0].trim(); - break; - - default : - throw Error.error(ErrorCode.X_S0502); - } - - //-- Get separators: from database properties, then from table properties - fs = dbProps.getStringProperty(HsqlDatabaseProperties.textdb_fs); - fs = tableprops.getProperty(HsqlDatabaseProperties.textdb_fs, fs); - vs = dbProps.getStringProperty(HsqlDatabaseProperties.textdb_vs); - vs = tableprops.getProperty(HsqlDatabaseProperties.textdb_vs, vs); - lvs = dbProps.getStringProperty(HsqlDatabaseProperties.textdb_lvs); - lvs = tableprops.getProperty(HsqlDatabaseProperties.textdb_lvs, lvs); - qc = dbProps.getStringProperty(HsqlDatabaseProperties.textdb_qc); - qc = tableprops.getProperty(HsqlDatabaseProperties.textdb_qc, qc); - - if (vs == null) { - vs = fs; - } - - if (lvs == null) { - lvs = fs; - } - - fs = translateSep(fs); - vs = translateSep(vs); - lvs = translateSep(lvs); - qc = translateSep(qc); - - if (fs.length() == 0 || vs.length() == 0 || lvs.length() == 0) { - throw Error.error(ErrorCode.X_S0503); - } - - if (qc.length() != 1) { - throw Error.error(ErrorCode.X_S0504); - } - - quoteChar = qc.charAt(0); - - if (quoteChar > 0x007F) { - throw Error.error(ErrorCode.X_S0504); - } - - //-- get booleans - isIgnoreFirst = - dbProps.isPropertyTrue(HsqlDatabaseProperties.textdb_ignore_first); - isIgnoreFirst = tableprops.isPropertyTrue( - HsqlDatabaseProperties.textdb_ignore_first, isIgnoreFirst); - isQuoted = - dbProps.isPropertyTrue(HsqlDatabaseProperties.textdb_quoted); - isQuoted = - tableprops.isPropertyTrue(HsqlDatabaseProperties.textdb_quoted, - isQuoted); - isAllQuoted = - dbProps.isPropertyTrue(HsqlDatabaseProperties.textdb_all_quoted); - isAllQuoted = - tableprops.isPropertyTrue(HsqlDatabaseProperties.textdb_all_quoted, - isAllQuoted); - isNullDef = - dbProps.isPropertyTrue(HsqlDatabaseProperties.textdb_null_def); - isNullDef = - tableprops.isPropertyTrue(HsqlDatabaseProperties.textdb_null_def, - isNullDef); - - //-- get string - stringEncoding = - dbProps.getStringProperty(HsqlDatabaseProperties.textdb_encoding); - stringEncoding = - tableprops.getProperty(HsqlDatabaseProperties.textdb_encoding, - stringEncoding); - charEncoding = stringEncoding; - - // UTF-8 files can begin with BOM 3-byte sequence - // UTF-16 files can begin with BOM 2-byte sequence for big-endian - // UTF-16BE files (big-endian) have no BOM - // UTF-16LE files (little-endian) have no BOM - if ("UTF8".equals(stringEncoding)) { - isUTF8 = true; - } else if ("UTF-8".equals(stringEncoding)) { - isUTF8 = true; - } else if ("UTF-16".equals(stringEncoding)) { - - // avoid repeating the BOM in each encoded string - charEncoding = "UTF-16BE"; - isUTF16 = true; - } else if ("UTF-16BE".equals(stringEncoding)) { - isUTF16 = true; - } else if ("UTF-16LE".equals(stringEncoding)) { - isUTF16 = true; - isLittleEndian = true; - } - - setSpaceAndLineEnd(); - - if (fs.length() == 1 || (fs.length() == 2 && fs.endsWith("\n"))) { - singleSeparator = fs.charAt(0); - } - - // - //-- get size and scale - int cacheScale = dbProps.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_scale); - - cacheScale = tableprops.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_scale, cacheScale); - - int cacheSizeScale = dbProps.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_size_scale); - - cacheSizeScale = tableprops.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_size_scale, cacheSizeScale); - -// - maxCacheRows = (1 << cacheScale) * 3; - maxCacheRows = dbProps.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_rows, maxCacheRows); - maxCacheRows = tableprops.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_rows, maxCacheRows); - maxCacheBytes = ((1 << cacheSizeScale) * maxCacheRows) / 1024; - - if (maxCacheBytes < 4) { - maxCacheBytes = 4; - } - - maxCacheBytes = dbProps.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_size, maxCacheBytes); - maxCacheBytes = tableprops.getIntegerProperty( - HsqlDatabaseProperties.textdb_cache_size, maxCacheBytes); - maxCacheBytes *= 1024; - } - - String getFileName() { - return dataFileName; - } - - int getMaxCacheRows() { - return maxCacheRows; - } - - int getMaxCacheBytes() { - return maxCacheBytes; - } - - /** - * for UTF-16 with BOM in file - */ - void setLittleEndianByteOrderMark() { - - if ("UTF-16".equals(stringEncoding)) { - charEncoding = "UTF-16LE"; - isLittleEndian = true; - hasUTF16BOM = true; - - // normal - BOM is expected - } else { - - // abnormal - no BOM allowed - must use "UTF-16" as encoding - throw Error.error(ErrorCode.X_S0531); - } - } - - void setSpaceAndLineEnd() { - - try { - if (isUTF16) { - bytesForLineEnd = NL.getBytes(charEncoding); - bytesForSpace = " ".getBytes(charEncoding); - } - } catch (UnsupportedEncodingException e) { - throw Error.error(ErrorCode.X_S0531, e); - } - } - - private static String translateSep(String sep) { - return translateSep(sep, false); - } - - /** - * Translates the escaped characters in a separator string and returns - * the non-escaped string. - */ - private static String translateSep(String sep, boolean isProperty) { - - if (sep == null) { - return null; - } - - int next = sep.indexOf(BACKSLASH_CHAR); - - if (next != -1) { - int start = 0; - char[] sepArray = sep.toCharArray(); - char ch = 0; - int len = sep.length(); - StringBuilder sb = new StringBuilder(len); - - do { - sb.append(sepArray, start, next - start); - - start = ++next; - - if (next >= len) { - sb.append(BACKSLASH_CHAR); - - break; - } - - if (!isProperty) { - ch = sepArray[next]; - } - - if (ch == 'n') { - sb.append(LF_CHAR); - - start++; - } else if (ch == 'r') { - sb.append(CR_CHAR); - - start++; - } else if (ch == 't') { - sb.append('\t'); - - start++; - } else if (ch == BACKSLASH_CHAR) { - sb.append(BACKSLASH_CHAR); - - start++; - } else if (ch == 'u') { - start++; - - sb.append( - (char) Integer.parseInt( - sep.substring(start, start + 4), 16)); - - start += 4; - } else if (sep.startsWith("semi", next)) { - sb.append(';'); - - start += 4; - } else if (sep.startsWith("space", next)) { - sb.append(' '); - - start += 5; - } else if (sep.startsWith("quote", next)) { - sb.append(DOUBLE_QUOTE_CHAR); - - start += 5; - } else if (sep.startsWith("apos", next)) { - sb.append('\''); - - start += 4; - } else if (sep.startsWith("colon", next)) { - sb.append(':'); - - start += 5; - } else { - sb.append(BACKSLASH_CHAR); - sb.append(sepArray[next]); - - start++; - } - } while ((next = sep.indexOf(BACKSLASH_CHAR, start)) != -1); - - sb.append(sepArray, start, len - start); - - sep = sb.toString(); - } - - return sep; - } -} diff --git a/database/hsqldb/src/org/hsqldb/persist/TextTableStorageManager.java b/database/hsqldb/src/org/hsqldb/persist/TextTableStorageManager.java deleted file mode 100644 index b0b043db..00000000 --- a/database/hsqldb/src/org/hsqldb/persist/TextTableStorageManager.java +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.persist; - -import org.hsqldb.HsqlException; -import org.hsqldb.Table; -import org.hsqldb.lib.HashMap; -import org.hsqldb.lib.Iterator; - -/* - * Manages the TEXT TABLE caches in the database. A separate class from - * version 2.3.3 - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.3 - * @since 1.7.0 - */ -public class TextTableStorageManager { - - // - private HashMap textCacheList = new HashMap(); - - TextTableStorageManager() {} - - /** - * Opens the TextCache object. - */ - public DataFileCache openTextFilePersistence(Table table, String source, - boolean readOnlyData, boolean reversed) { - - closeTextCache(table); - - TextCache c = new TextCache(table, source); - - c.open(readOnlyData || reversed); - textCacheList.put(table.getName(), c); - - return c; - } - - /** - * Closes the TextCache object. - */ - public void closeTextCache(Table table) { - - TextCache c = (TextCache) textCacheList.remove(table.getName()); - - if (c != null) { - try { - c.close(); - } catch (HsqlException e) {} - } - } - - public void closeAllTextCaches(boolean delete) { - - Iterator it = textCacheList.values().iterator(); - - while (it.hasNext()) { - TextCache textCache = ((TextCache) it.next()); - - // use textCache.table to cover both cache and table readonly - if (delete && !textCache.table.isDataReadOnly()) { - textCache.purge(); - } else { - textCache.close(); - } - } - } - - public boolean isAnyTextCacheModified() { - - Iterator it = textCacheList.values().iterator(); - - while (it.hasNext()) { - if (((TextCache) it.next()).isModified()) { - return true; - } - } - - return false; - } -} diff --git a/database/hsqldb/src/org/hsqldb/resources/ResourceBundleHandler.java b/database/hsqldb/src/org/hsqldb/resources/ResourceBundleHandler.java deleted file mode 100644 index 3c9944c7..00000000 --- a/database/hsqldb/src/org/hsqldb/resources/ResourceBundleHandler.java +++ /dev/null @@ -1,245 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.resources; - -import java.lang.reflect.Method; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.hsqldb.lib.HashMap; -import org.hsqldb.lib.HsqlArrayList; - -/** - * A ResourceBundle helper class.

    - * - * Allows clients to get/set locale and get at localized resource bundle - * content in a resource path independent manner, without having to worry - * about handling exception states or deal directly with ResourceBundle - * object instances. Instead, clients receive numeric handles to the - * underlying objects. Rather than causing exception states, missing or - * inaccessible resources and underlying MissingResource and NullPointer - * exceptions result in null return values when attempting to retrieve a - * resource.

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.7.2 - * @since 1.7.2 - */ -public final class ResourceBundleHandler { - - /** Used to synchronize access */ - private static final Object mutex = new Object(); - - /** The Locale used internally to fetch resource bundles. */ - private static Locale locale = Locale.getDefault(); - - /** Map: Integer object handle maps to: ResourceBundle object. */ - private static HashMap bundleHandleMap = new HashMap(); - - /** List whose elements are ResourceBundle objects */ - private static HsqlArrayList bundleList = new HsqlArrayList(); - - /** - * The resource path prefix of the ResourceBundle objects - * handled by this class. - */ - private static final String prefix = "org.hsqldb.resources."; - - /** JDK 1.1 compliance */ - private static final Method newGetBundleMethod = getNewGetBundleMethod(); - - /** Pure utility class: external construction disabled. */ - private ResourceBundleHandler() {} - - /** - * Getter for property locale.

    - * - * @return Value of property locale. - */ - public static Locale getLocale() { - - synchronized (mutex) { - return locale; - } - } - - /** - * Setter for property locale.

    - * - * @param l the new locale - * @throws IllegalArgumentException when the new locale is null - */ - public static void setLocale(Locale l) throws IllegalArgumentException { - - synchronized (mutex) { - if (l == null) { - throw new IllegalArgumentException("null locale"); - } - - locale = l; - } - } - - /** - * Retrieves an int handle to the ResourceBundle - * object corresponding to the specified name and current - * Locale, using the specified ClassLoader.

    - * - * @return int handle to the ResourceBundle - * object corresponding to the specified name and - * current Locale, or -1 if no such bundle - * can be found - * @param cl The ClassLoader to use in the search - * @param name of the desired bundle - */ - public static int getBundleHandle(String name, ClassLoader cl) { - - Integer bundleHandle; - ResourceBundle bundle; - String bundleName; - String bundleKey; - - bundleName = prefix + name; - - synchronized (mutex) { - bundleKey = locale.toString() + bundleName; - bundleHandle = (Integer) bundleHandleMap.get(bundleKey); - - if (bundleHandle == null) { - bundle = getBundle(bundleName, locale, cl); - - bundleList.add(bundle); - - bundleHandle = Integer.valueOf(bundleList.size() - 1); - - bundleHandleMap.put(bundleKey, bundleHandle); - } - } - - return bundleHandle.intValue(); - } - - /** - * Retrieves, from the ResourceBundle object corresponding - * to the specified handle, the String value corresponding - * to the specified key. null is retrieved if either there - * is no ResourceBundle object for the handle or there is no - * String value for the specified key.

    - * - * @param handle an int handle to a - * ResourceBundle object - * @param key A String key to a String value - * @return The String value corresponding to the specified handle and key. - */ - public static String getString(int handle, String key) { - - ResourceBundle bundle; - String s; - - synchronized (mutex) { - if (handle < 0 || handle >= bundleList.size() || key == null) { - bundle = null; - } else { - bundle = (ResourceBundle) bundleList.get(handle); - } - } - - if (bundle == null) { - s = null; - } else { - try { - s = bundle.getString(key); - } catch (Exception e) { - s = null; - } - } - - return s; - } - - /** - * One-shot initialization of JDK 1.2+ ResourceBundle.getBundle() method - * having ClassLoader in the signature. - */ - private static Method getNewGetBundleMethod() { - - Class clazz; - Class[] args; - - clazz = ResourceBundle.class; - args = new Class[] { - String.class, Locale.class, ClassLoader.class - }; - - try { - return clazz.getMethod("getBundle", args); - } catch (Exception e) { - return null; - } - } - - /** - * Retrieves a resource bundle using the specified base name, locale, and - * class loader. This is a JDK 1.1 compliant substitution for the - * ResourceBundle method with the same name and signature. If there - * is a problem using the JDK 1.2 functionality (the class loader is - * specified non-null and the underlying method is not available or there - * is a security exception, etc.), then the behaviour reverts to that - * of JDK 1.1. - * - * @param name the base name of the resource bundle, a fully - * qualified class name - * @param locale the locale for which a resource bundle is desired - * @param cl the class loader from which to load the resource bundle - */ - public static ResourceBundle getBundle(String name, Locale locale, - ClassLoader cl) - throws NullPointerException, - MissingResourceException { - - if (cl == null) { - return ResourceBundle.getBundle(name, locale); - } else if (newGetBundleMethod == null) { - return ResourceBundle.getBundle(name, locale); - } else { - try { - return (ResourceBundle) newGetBundleMethod.invoke(null, - new Object[] { - name, locale, cl - }); - } catch (Exception e) { - return ResourceBundle.getBundle(name, locale); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/resources/info-column-remarks.properties b/database/hsqldb/src/org/hsqldb/resources/info-column-remarks.properties deleted file mode 100644 index a14c797d..00000000 --- a/database/hsqldb/src/org/hsqldb/resources/info-column-remarks.properties +++ /dev/null @@ -1,396 +0,0 @@ -# default column-remarks -# SYSTEM_ALLTYPEINFO -SYSTEM_ALLTYPEINFO_TYPE_NAME=the HSQLDB-specific data type name; this is the canonical name used in CREATE TABLE and ALTER TABLE statements. -SYSTEM_ALLTYPEINFO_DATA_TYPE=SQL data type. This may be a java.sql.Types data type, a SQL 200n data type or an HSQLDB-specific data type. For datetime or interval data types, this column returns the concise data type (such as SQL_TYPE_TIME or SQL_INTERVAL_YEAR_TO_MONTH). -SYSTEM_ALLTYPEINFO_PRECISION=The maximum column size for this data type. For numeric data, this is the maximum precision. For string data, this is the length in characters. For datetime data types, this is the length in characters of the string representation (assuming the maximum allowed precision of the fractional seconds component). NULL for data types where column size is not applicable. For interval data types, this is the number of characters in the character representation of the interval literal (as defined by the interval leading precision). -SYSTEM_ALLTYPEINFO_LITERAL_PREFIX=the character or characters used to prefix a literal of this type; for example, a single quotation mark (') for character data types; NULL for data types where a literal prefix is not applicable -SYSTEM_ALLTYPEINFO_LITERAL_SUFFIX=the character or characters used to terminate a literal of this type; for example, a single quotation mark (') for character data types; NULL for data types where a literal suffix is not applicable -SYSTEM_ALLTYPEINFO_CREATE_PARAMS=A list of keywords, separated by commas, corresponding to each parameter that may be specified in parentheses when issuing DDL relative to the data type. The keywords in the list, in the language of the current Locale, may be any of the following: length, precision, scale. They appear in the order that the syntax requires that they be used. For example, CREATE_PARAMS for DECIMAL with an English locale would be "precision,scale"; CREATE_PARAMS for VARCHAR would be "length". The value is NULL if there are no parameters for the data type definition; for example, INTEGER. -SYSTEM_ALLTYPEINFO_NULLABLE=NULL values allowed for this type?: { No Nulls | Nullable | Unknown } -SYSTEM_ALLTYPEINFO_CASE_SENSITIVE=TRUE if the type is case-sensitive in collations and comparisons; FALSE otherwise -SYSTEM_ALLTYPEINFO_SEARCHABLE=use of WHERE?: { None | Char (Only WHERE .. LIKE) | Basic (Except WHERE .. LIKE) | Searchable (All forms of WHERE...) } -SYSTEM_ALLTYPEINFO_UNSIGNED_ATTRIBUTE=TRUE if the data type is unsigned; NULL the attribute is not applicable to the data type or the data type is not numeric. -SYSTEM_ALLTYPEINFO_FIXED_PREC_SCALE=TRUE if the data type has predefined fixed precision and scale , like a money data type. NULL for non-numeric types. -SYSTEM_ALLTYPEINFO_AUTO_INCREMENT=NULL if the attribute is not applicable to the data type or the data type is not numeric. If TRUE, this indicates that when an insert is made, a unique value is inserted into the column at insert time. The increment is not defined. An application should not assume that auto-increment values start at any particular point or increment by any particular value. -SYSTEM_ALLTYPEINFO_LOCAL_TYPE_NAME=Localized version of the name of the data type; NULL if a localized name is not supported. This name is intended for display only, such as in dialog boxes -SYSTEM_ALLTYPEINFO_MINIMUM_SCALE=minimum scale supported -SYSTEM_ALLTYPEINFO_MAXIMUM_SCALE=maximum scale supported -SYSTEM_ALLTYPEINFO_SQL_DATA_TYPE=The value of the SQL data type as it would appear in the SQL CLI SQL_DESC_TYPE field of the SQLDA. -SYSTEM_ALLTYPEINFO_SQL_DATETIME_SUB=When the value of SQL_DATA_TYPE is SQL_DATETIME or SQL_INTERVAL, this column contains the datetime/interval subcode. For data types other than datetime and interval, this column is NULL. -SYSTEM_ALLTYPEINFO_NUM_PREC_RADIX=For numeric types, this column contains the value 10 to indicate that COLUMN_SIZE specifies a number of decimal digits. Otherwise, this column is NULL. -SYSTEM_ALLTYPEINFO_INTERVAL_PRECISION=If the data type is an interval data type, then this column contains the value of the interval leading precision. Otherwise, this column is NULL. -SYSTEM_ALLTYPEINFO_AS_TAB_COL=TRUE if the engine supports this data type as a table column, else FALSE -SYSTEM_ALLTYPEINFO_AS_PROC_COL=TRUE if the engine supports this data type as a procedure parameter or return type, else FALSE -SYSTEM_ALLTYPEINFO_MAX_PREC_ACT=same as PRECISION except for data types whose precision cannot be represented by an INTEGER column value -SYSTEM_ALLTYPEINFO_MIN_SCALE_ACT=same as MINIMUM_SCALE except for data types whose minimum scale cannot be represented by a SMALLINT column value -SYSTEM_ALLTYPEINFO_MAX_SCALE_ACT=same as MAXIMUM_SCALE except for data types whose maximum scale cannot be represented by a SMALLINT column value -SYSTEM_ALLTYPEINFO_COL_ST_CLS_NAME=the fully qualified name of the Java class that HSQLDB uses to represent values of this type in memory -SYSTEM_ALLTYPEINFO_COL_ST_IS_SUP=TRUE if the Java class that HSQLDB uses to represent values of this type in memory is supported under the hosting JVM and engine build options -SYSTEM_ALLTYPEINFO_STD_MAP_CLS_NAME=the fully qualified name of the Java class that the JDBC standard mapping uses to represent values of this type -SYSTEM_ALLTYPEINFO_STD_MAP_IS_SUP=TRUE if the Java class that the JDBC standard mapping uses to represent values of this type is supported under the current JVM -SYSTEM_ALLTYPEINFO_CST_MAP_CLS_NAME=the fully qualified name of the Java class that HSQLDB provides to represent values of this type via the JDBC interface -SYSTEM_ALLTYPEINFO_CST_MAP_IS_SUP=TRUE if the Java class that HSQLDB provides to represent values of this type via the JDBC interface is supported under the hosting JVM and engine build options -SYSTEM_ALLTYPEINFO_MCOL_JDBC=the maximum character octet length of this type if it is representable via the JDBC interface (i.e. as an INTEGER column value) -SYSTEM_ALLTYPEINFO_MCOL_ACT=same as MCOL_JDBC except for data types whose maximum character octet length cannot be represented by an INTEGER column value -SYSTEM_ALLTYPEINFO_DEF_OR_FIXED_SCALE=the default or fixed scale of numeric types; NULL if not applicable of the type is not numeric -SYSTEM_ALLTYPEINFO_REMARKS=a localized explanatory comment on the data type -SYSTEM_ALLTYPEINFO_TYPE_SUB=the variant tag for this variation of the data type. 1 = standard, 2 = identity, 4 = ignore case -# SYSTEM_BESTROWIDENTIFIER -SYSTEM_BESTROWIDENTIFIER_SCOPE=actual scope of result, as defined in java.sql.DatabaseMetadata -SYSTEM_BESTROWIDENTIFIER_COLUMN_NAME=simple column name -SYSTEM_BESTROWIDENTIFIER_DATA_TYPE=SQL data type. This may be a java.sql.Types data type, a SQL 200n data type or an HSQLDB-specific data type. For datetime or interval data types, this column returns the concise data type (such as SQL_TYPE_TIME or SQL_INTERVAL_YEAR_TO_MONTH). -SYSTEM_BESTROWIDENTIFIER_TYPE_NAME=the HSQLDB-specific data type name; this is the canonical name used in CREATE TABLE and ALTER TABLE statements. -SYSTEM_BESTROWIDENTIFIER_COLUMN_SIZE=precision for number types; length for variable sized types; NULL for others -SYSTEM_BESTROWIDENTIFIER_BUFFER_LENGTH=The maximum length in bytes of data, if definitely known, that would be transferred to a buffer on a fetch operation. For numeric data, this size may be different than the size of the data stored on the data source. This value is the same as the COLUMN_SIZE column for binary data. This value is the twice the COLUMN_SIZE column for character data. If the actual value is larger than can be represented in an INTEGER column value, this is NULL. -SYSTEM_BESTROWIDENTIFIER_DECIMAL_DIGITS=scale of column for number types -SYSTEM_BESTROWIDENTIFIER_PSEUDO_COLUMN=is this a pseudo column like an Oracle ROWID? -SYSTEM_BESTROWIDENTIFIER_TABLE_CAT=catalog in which the table containing the column is defined -SYSTEM_BESTROWIDENTIFIER_TABLE_SCHEM=schema in which the table containing the column is defined -SYSTEM_BESTROWIDENTIFIER_TABLE_NAME=simple name of the table containing the column -SYSTEM_BESTROWIDENTIFIER_NULLABLE=is the column nullable? -SYSTEM_BESTROWIDENTIFIER_IN_KEY=does column participate in primary or alternate key? -# SYSTEM_CACHEINFO -#SYSTEM_CACHEINFO_CACHE_CLASS=FQN of the Java Class implementing the cache -#SYSTEM_CACHEINFO_CACHE_HASH=the in-memory hashCode() of the Cache object -SYSTEM_CACHEINFO_CACHE_FILE=absolute path of the file underlying the cache object -#SYSTEM_CACHEINFO_CACHE_LENGTH=length of the cache object's row data array -SYSTEM_CACHEINFO_MAX_CACHE_COUNT=maximum number of rows that will be buffered in memory by this cache -SYSTEM_CACHEINFO_MAX_CACHE_BYTES=approximate maximum size, in bytes, of row data that will be buffered in memory by this cache -SYSTEM_CACHEINFO_CACHE_SIZE=number of rows currently cached -SYSTEM_CACHEINFO_CACHE_BYTES=approximate number of row data bytes currently cached -SYSTEM_CACHEINFO_FILE_FREE_BYTES=aggregate size, in octets, of all allocation units considered available for reuse -#SYSTEM_CACHEINFO_SMALLEST_FREE_ITEM=size, in octets, of smallest allocation unit available for reuse -#SYSTEM_CACHEINFO_LARGEST_FREE_ITEM=size, in octets, of largest allocation unit available for reuse -SYSTEM_CACHEINFO_FILE_FREE_COUNT=number of allocation units available for reuse -SYSTEM_CACHEINFO_FILE_FREE_POS=one greater than largest file position known to be allocated -#SYSTEM_CACHEINFO_MAX_CACHE_SIZE=maximum allowable number of cached Row objects -#SYSTEM_CACHEINFO_MAX_CACHE_BYTE_SIZE=limit on memory consumption of cached Row objects -#SYSTEM_CACHEINFO_MULTIPLIER_MASK=binary mask used to calculate indices into row data array -#SYSTEM_CACHEINFO_WRITER_LENGTH=length of row write buffer array -# INFORMATION_SCHEMA_CATALOG_NAME -INFORMATION_SCHEMA_CATALOG_NAME_CATALOG_NAME=catalog name -# SYSTEM_COLUMNPRIVILEGES -SYSTEM_COLUMNPRIVILEGES_TABLE_CAT=catalog in which the table containing the column is defined -SYSTEM_COLUMNPRIVILEGES_TABLE_SCHEM=schema in which the table containing the column is defined -SYSTEM_COLUMNPRIVILEGES_TABLE_NAME=simple name of the table containing the column is defined -SYSTEM_COLUMNPRIVILEGES_COLUMN_NAME=simple name of the column -SYSTEM_COLUMNPRIVILEGES_GRANTOR=grantor of access -SYSTEM_COLUMNPRIVILEGES_GRANTEE=grantee of access -SYSTEM_COLUMNPRIVILEGES_PRIVILEGE=name of access, e.g. one of { ALL, SELECT, INSERT, UPDATE, DELETE, ...} -SYSTEM_COLUMNPRIVILEGES_IS_GRANTABLE=grantable?: YES - may grant to others, NO - not permitted to grant to others, NULL - unknown -# SYSTEM_COLUMNS -SYSTEM_COLUMNS_TABLE_CAT=catalog in which the table containing the column is defined -SYSTEM_COLUMNS_TABLE_SCHEM=schema in which the table containing the column is defined -SYSTEM_COLUMNS_TABLE_NAME=simple name of the table containing the column -SYSTEM_COLUMNS_COLUMN_NAME=simple name of the column -SYSTEM_COLUMNS_DATA_TYPE=SQL data type. This may be a java.sql.Types data type, a SQL 200n data type or an HSQLDB-specific data type. For datetime or interval data types, this column returns the concise data type (such as SQL_TYPE_TIME or SQL_INTERVAL_YEAR_TO_MONTH). -SYSTEM_COLUMNS_TYPE_NAME=the HSQLDB-specific data type name; this is the canonical name used in CREATE TABLE and ALTER TABLE statements. -SYSTEM_COLUMNS_COLUMN_SIZE=precision for number types; length for sized types; NULL if not applicable -SYSTEM_COLUMNS_BUFFER_LENGTH=The maximum length in bytes of data, if definitely known, that would be transferred to a buffer on a fetch operation. For numeric data, this size may be different than the size of the data stored on the data source. This value is the same as the COLUMN_SIZE column for binary data. This value is the twice the COLUMN_SIZE column for character data. If the actual value is larger than can be represented in an INTEGER column value, this is NULL. -SYSTEM_COLUMNS_DECIMAL_DIGITS=# of fractional digits (scale) for number types -SYSTEM_COLUMNS_NUM_PREC_RADIX=Radix of reported numeric precision (i.e. base of number types) -SYSTEM_COLUMNS_NULLABLE=is NULL allowed?: { columnNoNulls (maybe not), columnNullable (definitely), columnNullableUnknown } -SYSTEM_COLUMNS_REMARKS=explanitory comment describing the column (may be NULL) -SYSTEM_COLUMNS_COLUMN_DEF=default value (may be NULL) -SYSTEM_COLUMNS_SQL_DATA_TYPE=The value of the SQL data type as it would appear in the SQL CLI SQL_DESC_TYPE field of the SQLDA. -SYSTEM_COLUMNS_SQL_DATETIME_SUB=When the value of SQL_DATA_TYPE is SQL_DATETIME or SQL_INTERVAL, this column contains the datetime/interval subcode. For data types other than datetime and interval, this column is NULL. -SYSTEM_COLUMNS_CHAR_OCTET_LENGTH=for char types, the maximum number of bytes in the column, if the value can be represented as an INTEGER column value, else NULL -SYSTEM_COLUMNS_ORDINAL_POSITION=index of column in table (starting at 1) -SYSTEM_COLUMNS_IS_NULLABLE=is column nullable?: { YES (might allow) | NO (definitely not) | '' (unknown) } -SYSTEM_COLUMNS_SCOPE_CATLOG=catalog of table that is the scope of a reference attribute (NULL if DATA_TYPE isn't REF) -SYSTEM_COLUMNS_SCOPE_SCHEMA=schema of table that is the scope of a reference attribute (NULL if the DATA_TYPE isn't REF) -SYSTEM_COLUMNS_SCOPE_TABLE=table name that this the scope of a reference attribute (NULL if the DATA_TYPE isn't REF) -SYSTEM_COLUMNS_SOURCE_DATA_TYPE=source type of a distinct type or user-generated Ref type, SQL type from DITypes (NULL if DATA_TYPE isn't DISTINCT or user-generated REF) -SYSTEM_COLUMNS_TYPE_SUB=the HSQLDB-specific type subidentifier (1:default, 2:identity, 4:ignorecase) -# SYSTEM_CROSSREFERENCE -SYSTEM_CROSSREFERENCE_PKTABLE_CAT=the catalog in which the referenced table is defined -SYSTEM_CROSSREFERENCE_PKTABLE_SCHEM=the schema in which the referenced table is defined -SYSTEM_CROSSREFERENCE_PKTABLE_NAME=simple name of the referenced table -SYSTEM_CROSSREFERENCE_PKCOLUMN_NAME=simple name of the referenced column -SYSTEM_CROSSREFERENCE_FKTABLE_CAT=the catalog in which the referencing table is defined -SYSTEM_CROSSREFERENCE_FKTABLE_SCHEM=the schema in which the referencing table is defined -SYSTEM_CROSSREFERENCE_FKTABLE_NAME=the simple name of the referencing table -SYSTEM_CROSSREFERENCE_FKCOLUMN_NAME=the simple name of the referencing column -SYSTEM_CROSSREFERENCE_KEY_SEQ=sequence number within foreign key definition -SYSTEM_CROSSREFERENCE_UPDATE_RULE=how does an update of referenced row columns affect referencing rows?: e.g. { Cascade | Set Null | Set Default | Restrict (No Action) } -SYSTEM_CROSSREFERENCE_DELETE_RULE=how does deletion of a referenced row affect referencing rows?: e.g. { Cascade | Set Null | Set Default | Restrict (No Action) } -SYSTEM_CROSSREFERENCE_FK_NAME=the name of the foreign key -SYSTEM_CROSSREFERENCE_PK_NAME=the name of the referenced column set (usually the name of a primary key constraint, but may be a unique constraint or even the name of a non-unique index previous to 1.7.0) -SYSTEM_CROSSREFERENCE_DEFERRABILITY=foreign key constraints deferred until commit?: e.g. { initially deferred | initially immediate | not deferrable } -# SYSTEM_INDEXINFO -SYSTEM_INDEXINFO_TABLE_CAT=catalog in which the table using the index is defined -SYSTEM_INDEXINFO_TABLE_SCHEM=schema in which the table using the index is defined -SYSTEM_INDEXINFO_TABLE_NAME=simple name of the table using the index -SYSTEM_INDEXINFO_NON_UNIQUE=can index values be non-unique? -SYSTEM_INDEXINFO_INDEX_QUALIFIER=catalog in which the index is defined -SYSTEM_INDEXINFO_INDEX_NAME=simple name of the index -SYSTEM_INDEXINFO_TYPE=index type: e.g. { Clustered | Hashed | Other } -SYSTEM_INDEXINFO_ORDINAL_POSITION=column sequence number within index -SYSTEM_INDEXINFO_COLUMN_NAME=simple column name -SYSTEM_INDEXINFO_ASC_OR_DESC=column sort sequence: e.g. { "A" (Ascending) | "D" (Descending) } -SYSTEM_INDEXINFO_CARDINALITY=index cardinality: # of unique values in the index (currently unused) -SYSTEM_INDEXINFO_PAGES=index page use (currently unused) -SYSTEM_INDEXINFO_FILTER_CONDITION=filter condition, if any (currently unused) -# SYSTEM_LOBS -SYSTEM_LOBS_NAME=Java classfile encoded absolute name of a resource ( /dir1/.../dirn/resourcename.ext) -SYSTEM_LOBS_CONTENT=binary content of Java class file or resource -SYSTEM_LOBS_CONTENT_TYPE=content type (possibly a mime-type value) -SYSTEM_LOBS_MD5=MD5 hash of content (efficiently detects and avoids attempts to reload identical content) -SYSTEM_LOBS_CREATED=time at which content was initially loaded -SYSTEM_LOBS_MODIFIED=time at which content was last modified -# SYSTEM_PRIMARYKEYS -SYSTEM_PRIMARYKEYS_TABLE_CAT=catalog in which table containing primary key is defined -SYSTEM_PRIMARYKEYS_TABLE_SCHEM=schema in which table containing primary key is defined -SYSTEM_PRIMARYKEYS_TABLE_NAME=simple name of table containing primary key -SYSTEM_PRIMARYKEYS_COLUMN_NAME=simple name of column participating in primary key -SYSTEM_PRIMARYKEYS_KEY_SEQ=sequence number of column within primary key -SYSTEM_PRIMARYKEYS_PK_NAME=primary key name -# SYSTEM_PROCEDURECOLUMNS -SYSTEM_PROCEDURECOLUMNS_PROCEDURE_CAT=catalog in which procedure is defined -SYSTEM_PROCEDURECOLUMNS_PROCEDURE_SCHEM=schema in which procedure is defined -SYSTEM_PROCEDURECOLUMNS_PROCEDURE_NAME=procedure identifier -SYSTEM_PROCEDURECOLUMNS_COLUMN_NAME=( result column | call parameter | return value ) name -SYSTEM_PROCEDURECOLUMNS_COLUMN_TYPE=kind of column/parameter: { Unknown | IN | INOUT | OUT | RETURN | RESULT } -SYSTEM_PROCEDURECOLUMNS_DATA_TYPE=SQL data type. This may be a java.sql.Types data type, a SQL 200n data type or an HSQLDB-specific data type. For datetime or interval data types, this column returns the concise data type (such as SQL_TYPE_TIME or SQL_INTERVAL_YEAR_TO_MONTH). -SYSTEM_PROCEDURECOLUMNS_TYPE_NAME=the HSQLDB-specific data type name; for data types supported as table column types, this is the canonical name used in CREATE TABLE and ALTER TABLE statements. -SYSTEM_PROCEDURECOLUMNS_PRECISION=precision for number types; max length for sized types; fixed or max length for others if known, or NULL if not applicable -SYSTEM_PROCEDURECOLUMNS_LENGTH=The maximum length in bytes of data, if definitely known, that would be transferred to a buffer on a fetch operation. For numeric data, this size may be different than the size of the data stored on the data source. This value is the same as the COLUMN_SIZE column for binary data. This value is the twice the COLUMN_SIZE column for character data. If the actual value is unknown or is larger than can be represented in an INTEGER column value, this is NULL. -SYSTEM_PROCEDURECOLUMNS_SCALE=scale (# of fractional digits) for number types -SYSTEM_PROCEDURECOLUMNS_RADIX=Radix of reported numeric precision (i.e. base of number types) -SYSTEM_PROCEDURECOLUMNS_NULLABLE=can column contain NULL: { No Nulls | Nullable | Unknown }? -SYSTEM_PROCEDURECOLUMNS_REMARKS=comment describing parameter or result column -SYSTEM_PROCEDURECOLUMNS_SPECIFIC_NAME=typically, (but not limited to) the fully qualified name and signature of the Java method providing the SQL-invoked routine's entry point -SYSTEM_PROCEDURECOLUMNS_SEQ=provides the ability to deliver rows in JDBC DataseMetaData sort contrct order -# SYSTEM_PROCEDURES -SYSTEM_PROCEDURES_PROCEDURE_CAT=catalog in which procedure is defined -SYSTEM_PROCEDURES_PROCEDURE_SCHEM=schema in which procedure is defined -SYSTEM_PROCEDURES_PROCEDURE_NAME=procedure identifier -SYSTEM_PROCEDURES_REMARKS=explanatory comment on the procedure -SYSTEM_PROCEDURES_PROCEDURE_TYPE=kind of procedure: { Unknown | No Result | Returns Result } -SYSTEM_PROCEDURES_NUM_INPUT_PARAMS=number of procedure input parameters -SYSTEM_PROCEDURES_NUM_OUTPUT_PARAMS=number of procedure output parameters -SYSTEM_PROCEDURES_NUM_RESULT_SETS=number of result sets returned by procedure (if any) -SYSTEM_PROCEDURES_ORIGIN=how was named procedure introduced to system?: e.g. { BUILTIN | USER CLASS GRANT | ALIAS | TRIGGER | MODULE | ...} -SYSTEM_PROCEDURES_SPECIFIC_NAME=typically, (but not limited to) the fully qualified name and signature of the Java method providing the SQL-invoked routine's entry point -# SYSTEM_PROPERTIES -SYSTEM_PROPERTIES_PROPERTY_SCOPE=the scope of the property, e.g. ( TEMPORARY | TRANSACTION | SESSION | ...} -SYSTEM_PROPERTIES_PROPERTY_NAMESPACE=the namespace in which the property is applicable, e.g. ( database.properties | org.hsqldb.Database | java.sql.DatabaseMetaData | ...) -SYSTEM_PROPERTIES_PROPERTY_NAME=the name of the property -SYSTEM_PROPERTIES_PROPERTY_VALUE=the current value of the property -SYSTEM_PROPERTIES_PROPERTY_CLASS=the type of the value, e.g. ( int | boolean | java.lang.String | ...) -# SYSTEM_SCHEMAS -SYSTEM_SCHEMAS_TABLE_SCHEM=schema name -SYSTEM_SCHEMAS_TABLE_CATALOG=catalog in which schema is defined -SYSTEM_SCHEMAS_IS_DEFAULT=whether the described schema is the default schema -# SYSTEM_SESSIONS -SYSTEM_SESSIONS_SESSION_ID=session identifier -SYSTEM_SESSIONS_CONNECTED=time at which session connected to database -SYSTEM_SESSIONS_USER_NAME=name of session user, as known to the database -SYSTEM_SESSIONS_IS_ADMIN=is session user an admin user? -SYSTEM_SESSIONS_AUTOCOMMIT=is session in autocommit mode? -SYSTEM_SESSIONS_READONLY=is session in read-only mode? -SYSTEM_SESSIONS_MAXROWS=what is the session's MAXROWS setting? -SYSTEM_SESSIONS_LAST_IDENTITY=what is the last identity value used by this session? -SYSTEM_SESSIONS_TRANSACTION_SIZE=how many undo items are there in this session's transaction buffer? -#since 1.8.0 -SYSTEM_SESSIONS_SCHEMA=this session's current default schema -# SYSTEM_SESSIONINFO -SYSTEM_SESSIONINFO_KEY=KEY: { SESSION_ID | AUTOCOMMIT | USER | CONNECTION_READONLY | DATABASE_READONLY | MAXROWS | DATABASE | IDENTITY ... } -SYSTEM_SESSIONINFO_VALUE=VALUE: the value corresponding to the indicated key (see JavaDocs) -# SYSTEM_TABLEPRIVILEGES -SYSTEM_TABLEPRIVILEGES_TABLE_CAT=table catalog -SYSTEM_TABLEPRIVILEGES_TABLE_SCHEM=table schema -SYSTEM_TABLEPRIVILEGES_TABLE_NAME=table name -SYSTEM_TABLEPRIVILEGES_GRANTOR=grantor of access -SYSTEM_TABLEPRIVILEGES_GRANTEE=grantee of access -SYSTEM_TABLEPRIVILEGES_PRIVILEGE=name of access: e.g. one of { ALL | SELECT | INSERT | UPDATE | DELETE } -SYSTEM_TABLEPRIVILEGES_IS_GRANTABLE=for grantee: YES - may grant to others, NO - may not grant to others, NULL - unknown -# SYSTEM_TABLES -SYSTEM_TABLES_TABLE_CAT=table catalog -SYSTEM_TABLES_TABLE_SCHEM=table schema -SYSTEM_TABLES_TABLE_NAME=table name -SYSTEM_TABLES_TABLE_TYPE=table type: e.g. one of { TABLE | VIEW | SYSTEM TABLE | GLOBAL TEMPORARY ... } -SYSTEM_TABLES_REMARKS=explanatory comment on the table -SYSTEM_TABLES_TYPE_CAT=table type catalog -SYSTEM_TABLES_TYPE_SCHEM=table type schema -SYSTEM_TABLES_TYPE_NAME=table type name -SYSTEM_TABLES_SELF_REFERENCING_COL_NAME=name of the designated "identifier" column of typed table (null if not typed) -SYSTEM_TABLES_REF_GENERATION=how are values in SELF_REFERENCING_COL_NAME created?: e.g. one of { "SYSTEM" | "USER" | "DERIVED" | NULL } -SYSTEM_TABLES_HSQLDB_TYPE=the HSQLDB-specific type of the table, e.g. ( MEMORY | CACHED | TEXT | ...) -SYSTEM_TABLES_READ_ONLY=TRUE if the table is read-only, else FALSE -# SYSTEM_TABLETYPES -SYSTEM_TABLETYPES_TABLE_TYPE=table type name -# SYSTEM_TEXTTABLES -SYSTEM_TEXTTABLES_TABLE_CAT=table catalog -SYSTEM_TEXTTABLES_TABLE_SCHEM=table schema -SYSTEM_TEXTTABLES_TABLE_NAME=table name -SYSTEM_TEXTTABLES_DATA_SOURCE_DEFINTION=the "spec" proption of the table's SET TABLE ... SOURCE DDL declaration -SYSTEM_TEXTTABLES_FILE_PATH=path to table's text file data source -SYSTEM_TEXTTABLES_FILE_ENCODING=encoding of table's text file data source -SYSTEM_TEXTTABLES_FIELD_SEPARATOR=the default field separator -SYSTEM_TEXTTABLES_VARCHAR_SEPARATOR=varchar field separator -SYSTEM_TEXTTABLES_LONGVARCHAR_SEPARATOR=longvarchar field separator -SYSTEM_TEXTTABLES_IS_IGNORE_FIRST=ignores first line of file? -# added to reflect 1.7.2 RC1 -SYSTEM_TEXTTABLES_IS_QUOTED=fields are quoted if necessary? -#-- -SYSTEM_TEXTTABLES_IS_ALL_QUOTED=every field is quoted? -SYSTEM_TEXTTABLES_IS_DESC=read rows starting at end of file? -# SYSTEM_TYPEINFO -SYSTEM_TYPEINFO_TYPE_NAME=the HSQLDB-specific data type name; this is the canonical name used in CREATE TABLE and ALTER TABLE statements. -SYSTEM_TYPEINFO_DATA_TYPE=SQL data type. This may be a java.sql.Types data type, a SQL 200n data type or an HSQLDB-specific data type. For datetime or interval data types, this column returns the concise data type (such as SQL_TYPE_TIME or SQL_INTERVAL_YEAR_TO_MONTH). -SYSTEM_TYPEINFO_PRECISION=The maximum column size for this data type. For numeric data, this is the maximum precision. For string data, this is the length in characters. For datetime data types, this is the length in characters of the string representation (assuming the maximum allowed precision of the fractional seconds component). NULL for data types where column size is not applicable. For interval data types, this is the number of characters in the character representation of the interval literal (as defined by the interval leading precision). -SYSTEM_TYPEINFO_LITERAL_PREFIX=the character or characters used to prefix a literal of this type; for example, a single quotation mark (') for character data types; NULL for data types where a literal prefix is not applicable -SYSTEM_TYPEINFO_LITERAL_SUFFIX=the character or characters used to terminate a literal of this type; for example, a single quotation mark (') for character data types; NULL for data types where a literal suffix is not applicable -SYSTEM_TYPEINFO_CREATE_PARAMS=A list of keywords, separated by commas, corresponding to each parameter that may be specified in parentheses when issuing DDL relative to the data type. The keywords in the list, in the language of the current Locale, may be any of the following: length, precision, scale. They appear in the order that the syntax requires that they be used. For example, CREATE_PARAMS for DECIMAL with an English locale would be "precision,scale"; CREATE_PARAMS for VARCHAR would be "length". The value is NULL if there are no parameters for the data type definition; for example, INTEGER. -SYSTEM_TYPEINFO_NULLABLE=NULL values allowed for this type?: { No Nulls | Nullable | Unknown } -SYSTEM_TYPEINFO_CASE_SENSITIVE=TRUE if the type is case-sensitive in collations and comparisons; FALSE otherwise -SYSTEM_TYPEINFO_SEARCHABLE=use of WHERE?: { None | Char (Only WHERE .. LIKE) | Basic (Except WHERE .. LIKE) | Searchable (All forms of WHERE...) } -SYSTEM_TYPEINFO_UNSIGNED_ATTRIBUTE=TRUE if the data type is unsigned; NULL the attribute is not applicable to the data type or the data type is not numeric. -SYSTEM_TYPEINFO_FIXED_PREC_SCALE=TRUE if the data type has predefined fixed precision and scale , like a money data type. NULL for non-numeric types. -SYSTEM_TYPEINFO_INTERVAL_PRECISION=if the data type is an interval data type, then this column contains the value of the interval leading precision. Otherwise, this column is NULL. -SYSTEM_TYPEINFO_AUTO_INCREMENT=NULL if the attribute is not applicable to the data type or the data type is not numeric. If TRUE, this indicates that when an insert is made, a unique value is inserted into the column at insert time. The increment is not defined. An application should not assume that auto-increment values start at any particular point or increment by any particular value. -SYSTEM_TYPEINFO_LOCAL_TYPE_NAME=Localized version of the name of the data type; NULL if a localized name is not supported. This name is intended for display only, such as in dialog boxes -SYSTEM_TYPEINFO_MINIMUM_SCALE=minimum scale supported -SYSTEM_TYPEINFO_MAXIMUM_SCALE=maximum scale supported -SYSTEM_TYPEINFO_SQL_DATA_TYPE=The value of the SQL data type as it would appear in the SQL CLI SQL_DESC_TYPE field of the SQLDA. -SYSTEM_TYPEINFO_SQL_DATETIME_SUB=When the value of SQL_DATA_TYPE is SQL_DATETIME or SQL_INTERVAL, this column contains the datetime/interval subcode. For data types other than datetime and interval, this column is NULL. -SYSTEM_TYPEINFO_NUM_PREC_RADIX=For numeric types, this column contains the value 10 to indicate that COLUMN_SIZE specifies a number of decimal digits. Otherwise, this column is NULL. -SYSTEM_TYPEINFO_TYPE_SUB=the variant tag for this variation of the data type. 1 = standard, 2 = identity, 4 = ignore case -# SYSTEM_UDTS -SYSTEM_UDTS_TYPE_CAT=type's catalog -SYSTEM_UDTS_TYPE_SCHEM=type's schema -SYSTEM_UDTS_TYPE_NAME=type's DBMS name -SYSTEM_UDTS_CLASS_NAME=type's Java class name -SYSTEM_UDTS_DATA_TYPE=type value defined in DITypes, from one of { "JAVA_OBJECT" | "STRUCT" | "DISTINCT" } -SYSTEM_UDTS_BASE_TYPE=type code of the source type of a DISTINCT type or the type that implements the user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in DITypes (null if DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) -SYSTEM_UDTS_REMARKS=explanatory comment on the user defined type -# SYSTEM_USERS -SYSTEM_USERS_USER_NAME=user name -SYSTEM_USERS_ADMIN=has the administrative privilege? -SYSTEM_USERS_INITIAL_SCHEMA=initial schema for user -SYSTEM_USERS_AUTHENTICATION=method of identification for the user -SYSTEM_USERS_PASSWORD_DIGEST=password digest -# SYSTEM_VERSIONCOLUMNS -SYSTEM_VERSIONCOLUMNS_TABLE_CAT=table catalog -SYSTEM_VERSIONCOLUMNS_TABLE_SCHEM=table schema -SYSTEM_VERSIONCOLUMNS_TABLE_NAME=simple table name -SYSTEM_VERSIONCOLUMNS_SCOPE=not used -SYSTEM_VERSIONCOLUMNS_COLUMN_NAME=column name -SYSTEM_VERSIONCOLUMNS_DATA_TYPE=SQL data type from DITypes -SYSTEM_VERSIONCOLUMNS_TYPE_NAME=Data source dependent type name -SYSTEM_VERSIONCOLUMNS_COLUMN_SIZE=precision -SYSTEM_VERSIONCOLUMNS_BUFFER_LENGTH=length of column value in bytes -SYSTEM_VERSIONCOLUMNS_DECIMAL_DIGITS=scale -SYSTEM_VERSIONCOLUMNS_PSEUDO_COLUMN=is this a pseudo column like an Oracle ROWID: { Unknown | Not Pseudo | Pseudo }? -# SYSTEM_VIEWS -SYSTEM_VIEWS_TABLE_CATALOG=name of catalog in which view is defined -SYSTEM_VIEWS_TABLE_SCHEMA=unqualified name of schema in which view is defined -SYSTEM_VIEWS_TABLE_NAME=simple name of view -SYSTEM_VIEWS_VIEW_DEFINITION=the character representation of the query expression contained in the corresponding view descriptor. -SYSTEM_VIEWS_CHECK_OPTION={"CASCADED" | "LOCAL" | "NONE"} -SYSTEM_VIEWS_IS_UPDATABLE={"YES" | "NO"} -SYSTEM_VIEWS_VALID={TRUE | FALSE} -# Since 1.7.2 RC1 -# SYSTEM_CHECK_COLUMN_USAGE -SYSTEM_CHECK_COLUMN_USAGE_CONSTRAINT_CATALOG=constraint catalog name -SYSTEM_CHECK_COLUMN_USAGE_CONSTRAINT_SCHEMA=constraint schema name -SYSTEM_CHECK_COLUMN_USAGE_CONSTRAINT_NAME=constraint identifier -SYSTEM_CHECK_COLUMN_USAGE_TABLE_CATALOG=table catalog name -SYSTEM_CHECK_COLUMN_USAGE_TABLE_SCHEMA= table schema name -SYSTEM_CHECK_COLUMN_USAGE_TABLE_NAME=table name -SYSTEM_CHECK_COLUMN_USAGE_COLUMN_NAME=name of column referenced explicitly or implicitly as contained in the of the constraint being described. -# SYSTEM_CHECK_CONSTRAINTS -SYSTEM_CHECK_CONSTRAINTS_CONSTRAINT_CATALOG=constraint catalog name -SYSTEM_CHECK_CONSTRAINTS_CONSTRAINT_SCHEMA=constraint schema name -SYSTEM_CHECK_CONSTRAINTS_CONSTRAINT_NAME=constraint identifier -SYSTEM_CHECK_CONSTRAINTS_CHECK_CLAUSE=the character representation of the contained in the , , or that defined the check constraint being described, or NULL if it cannot be described without truncation -# SYSTEM_CHECK_ROUTINE_USAGE -SYSTEM_CHECK_ROUTINE_USAGE_CONSTRAINT_CATALOG=constraint catalog name -SYSTEM_CHECK_ROUTINE_USAGE_CONSTRAINT_SCHEMA=constraint schema name -SYSTEM_CHECK_ROUTINE_USAGE_CONSTRAINT_NAME=constraint identifier -SYSTEM_CHECK_ROUTINE_USAGE_SPECIFIC_CATALOG=catalog name of specific name of routine -SYSTEM_CHECK_ROUTINE_USAGE_SPECIFIC_SCHEMA=schema name of specific name of routine -SYSTEM_CHECK_ROUTINE_USAGE_SPECIFIC_NAME=specific name of SQL-invoked routine identified as the subject routine of either a , a , a , or a contained in the or in the contained in either a or a -# CONSTRAINT_TABLE_USAGE -CONSTRAINT_TABLE_USAGE_TABLE_CATALOG=table catalog name -CONSTRAINT_TABLE_USAGE_TABLE_SCHEMA=table schema name -CONSTRAINT_TABLE_USAGE_TABLE_NAME=name of a table identified by a
    simply contained in a
    contained in the lt;search condition> of the constraint being described. -CONSTRAINT_TABLE_USAGE_CONSTRAINT_CATALOG=constraint catalog name -CONSTRAINT_TABLE_USAGE_CONSTRAINT_SCHEMA=constraint schema name -CONSTRAINT_TABLE_USAGE_CONSTRAINT_NAME=constraint identifier -# SYSTEM_SEQUENCES -SYSTEM_SEQUENCES_SEQUENCE_CATALOG=sequence catalog name -SYSTEM_SEQUENCES_SEQUENCE_SCHEMA=sequence schema name -SYSTEM_SEQUENCES_SEQUENCE_NAME=sequence identifier -SYSTEM_SEQUENCES_DTD_IDENTIFIER=implementation dependent data type descriptor identifier -SYSTEM_SEQUENCES_MAXIMUM_VALUE=sequence maximum value -SYSTEM_SEQUENCES_MINIMUM_VALUE=sequence minimum value -SYSTEM_SEQUENCES_INCREMENT=sequence increment -SYSTEM_SEQUENCES_CYCLE_OPTION=sequence cycle option ('YES' | 'NO') -SYSTEM_SEQUENCES_START_WITH=sequence start with value -# SYSTEM_TABLE_CONSTRAINTS -SYSTEM_TABLE_CONSTRAINTS_CONSTRAINT_CATALOG=constraint catalog name -SYSTEM_TABLE_CONSTRAINTS_CONSTRAINT_SCHEMA=constraint schema name -SYSTEM_TABLE_CONSTRAINTS_CONSTRAINT_NAME=constraint identifier -SYSTEM_TABLE_CONSTRAINTS_CONSTRAINT_TYPE=('UNIQUE' | 'PRIMARY KEY' | 'FOREIGN KEY' | 'CHECK') -SYSTEM_TABLE_CONSTRAINTS_TABLE_CATALOG=table catalog name -SYSTEM_TABLE_CONSTRAINTS_TABLE_SCHEMA=table schema name -SYSTEM_TABLE_CONSTRAINTS_TABLE_NAME=table identifier -SYSTEM_TABLE_CONSTRAINTS_IS_DEFERRABLE=('YES' | 'NO') -SYSTEM_TABLE_CONSTRAINTS_INITIALLY_DEFERRED=('YES' | 'NO') -# SYSTEM_USAGE_PRIVILEGES -SYSTEM_USAGE_PRIVILEGES_GRANTOR= of the user or role who granted usage privileges on the object -SYSTEM_USAGE_PRIVILEGES_GRANTEE= of some user or role, or ?PUBLIC? to indicate all users, to whom the usage privilege being described is granted -SYSTEM_USAGE_PRIVILEGES_OBJECT_CATALOG=object catalog name -SYSTEM_USAGE_PRIVILEGES_OBJECT_SCHEMA=object catalog schema -SYSTEM_USAGE_PRIVILEGES_OBJECT_NAME=identifier of the object to which the privilege applies -SYSTEM_USAGE_PRIVILEGES_OBJECT_TYPE=(DOMAIN' | 'CHARACTER SET' | 'COLLATION' | 'TRANSLATION' | 'SEQUENCE') -SYSTEM_USAGE_PRIVILEGES_IS_GRANTABLE=('YES' | 'NO') -# SYSTEM_VIEW_COLUMN_USAGE -SYSTEM_VIEW_COLUMN_USAGE_VIEW_CATALOG=view catalog name -SYSTEM_VIEW_COLUMN_USAGE_VIEW_SCHEMA=view schema name -SYSTEM_VIEW_COLUMN_USAGE_VIEW_NAME=view identifier -SYSTEM_VIEW_COLUMN_USAGE_TABLE_CATALOG=table catalog name -SYSTEM_VIEW_COLUMN_USAGE_TABLE_SCHEMA=table schema name -SYSTEM_VIEW_COLUMN_USAGE_TABLE_NAME=table identifier -SYSTEM_VIEW_COLUMN_USAGE_COLUMN_NAME=column of table that is explicitly or implicitly referenced in the of the view being described. -# SYSTEM_VIEW_ROUTINE_USAGE -SYSTEM_VIEW_ROUTINE_USAGE_TABLE_CATALOG=view catalog name -SYSTEM_VIEW_ROUTINE_USAGE_TABLE_SCHEMA=view schema name -SYSTEM_VIEW_ROUTINE_USAGE_TABLE_NAME=view identifier -SYSTEM_VIEW_ROUTINE_USAGE_SPECIFIC_CATALOG=catalog name of specific name of routine -SYSTEM_VIEW_ROUTINE_USAGE_SPECIFIC_SCHEMA=schema name of specific name of routine -SYSTEM_VIEW_ROUTINE_USAGE_SPECIFIC_NAME=specific name of SQL-invoked subject routine of either a , a , a , or a contained in the - -SYSTEM_VIEW_TABLE_USAGE_VIEW_CATALOG=view catalog name -SYSTEM_VIEW_TABLE_USAGE_VIEW_SCHEMA=view schema name -SYSTEM_VIEW_TABLE_USAGE_VIEW_NAME=view identifier -SYSTEM_VIEW_TABLE_USAGE_TABLE_CATALOG=table catalog name -SYSTEM_VIEW_TABLE_USAGE_TABLE_SCHEMA=table schema name -SYSTEM_VIEW_TABLE_USAGE_TABLE_NAME=table identified by a
    simply contained in a
    that is contained in the of the view being described. -# Since 1.8.0 -# SYSTEM_AUTHORIZATIONS -SYSTEM_AUTHORIZATIONS_AUTHORIZATION_NAME=a or -SYSTEM_AUTHORIZATIONS_AUTHORIZATION_TYPE=('USER' | 'ROLE') whether the AUTHORIZATION_NAME is a known or is a defined by a . -# SYSTEM_COLLATIONS -SYSTEM_COLLATIONS_COLLATION_CATALOG=catalog name of the collation being described -SYSTEM_COLLATIONS_COLLATION_SCHEMA=unqualified schema name of the collation being described -SYSTEM_COLLATIONS_COLLATION_NAME=qualified identifier of the collation being described -SYSTEM_COLLATIONS_PAD_ATTRIBUTE=('NO PAD' | 'PAD SPACE') whether the collation being described has the NO PAD or PAD SPACE characteristic -SYSTEM_COLLATIONS_COLLATION_TYPE=NULL (deprecated) -SYSTEM_COLLATIONS_COLLATION_DEFINITION=NULL (deprecated) -SYSTEM_COLLATIONS_COLLATION_DICTIONARY=NULL (deprecated) -SYSTEM_COLLATIONS_CHARACTER_REPERTOIRE_NAME=the name of the charater repertoire to which the collation being described is applicable. -# SYSTEM_ROLE_AUTHORIZATION_DESCRIPTORS -SYSTEM_ROLE_AUTHORIZATION_DESCRIPTORS_ROLE_NAME=the of some by the or the of a . -SYSTEM_ROLE_AUTHORIZATION_DESCRIPTORS_GRANTEE=an , possibly PUBLIC, or specified as a contained in a , or the of the current SQLsession when the is executed. -SYSTEM_ROLE_AUTHORIZATION_DESCRIPTORS_GRANTOR=the of the user or role who granted the role identified by ROLE_NAME to the user or role identified by the value of GRANTEE. -# SYSTEM_SCHEMATA -SYSTEM_SCHEMATA_CATALOG_NAME=the name of the catalog of the described schema -SYSTEM_SCHEMATA_SCHEMA_NAME=the unqualified schema name of the described schema -SYSTEM_SCHEMATA_SCHEMA_OWNER=the authorization identifier that owns the schema. -SYSTEM_SCHEMATA_DEFAULT_CHARACTER_SET_CATALOG=the catalog name of the default character set for columns and domains in the schema. -SYSTEM_SCHEMATA_DEFAULT_CHARACTER_SET_SCHEMA=the unqualified schema name of the default character set for columns and domains in the schema. -SYSTEM_SCHEMATA_DEFAULT_CHARACTER_SET_NAME=the qualified identifier of the default character set for columns and domains in the schemata. -SYSTEM_SCHEMATA_SQL_PATH=the character representation of the schema's , or null if it cannot be represented without truncation diff --git a/database/hsqldb/src/org/hsqldb/resources/info-table-remarks.properties b/database/hsqldb/src/org/hsqldb/resources/info-table-remarks.properties deleted file mode 100644 index f9c22647..00000000 --- a/database/hsqldb/src/org/hsqldb/resources/info-table-remarks.properties +++ /dev/null @@ -1,99 +0,0 @@ -#table remarks -SYSTEM_ALLTYPEINFO=a description of all non user-defined data types known to this database and the level of support for them in various capacities -SYSTEM_BESTROWIDENTIFIER=for each accessible table defined within this database, the optimal set of visible columns that uniquely identifies a row -SYSTEM_CACHEINFO=the current state of the system row caching mechanism -SYSTEM_COLUMNS=the visible columns of each accessible table defined within this database -SYSTEM_COLUMN_SEQUENCE_USAGE=the name of the sequences used by autogenerated columns -SYSTEM_COMMENTS=comments on tables, views, columns, sequences, triggers and routines defined by users or system -SYSTEM_CONNECTION_PROPERTIES=properties defined for the current connection -SYSTEM_CROSSREFERENCE=a description of how the accessible tables defined within this database import visible columns to enforce referential integrity -SYSTEM_INDEXINFO=information about the indices of each accessible table defined within this database -SYSTEM_INDEXSTATS=storage space used by the indices of each accessible table defined within this database -SYSTEM_KEY_INDEX_USAGE=names of indexes generated by the system for each constraint -SYSTEM_PRIMARYKEYS=the visible columns of the primary key of each accessible table defined within this database -SYSTEM_PROCEDURECOLUMNS=a description of the return type, parameters and result columns of each accessible callable procedure, SQL function, trigger body and UDT method defined within this database -SYSTEM_PROCEDURES=the procedures, SQL functions, trigger body routines and UDT methods defined within the database -SYSTEM_PROPERTIES=the system properties and operating parameters of this database -SYSTEM_SCHEMAS=the accessible schemas defined within this database -SYSTEM_SEQUENCES=the visible sequences in this database -SYSTEM_SESSIONINFO=information about the current database session -SYSTEM_SESSIONS=the visible sessions open in this database -SYSTEM_SYNONYMS=the synonyms for tables and other objects defined in this database -SYSTEM_TABLES=the accessible tables defined within this database -SYSTEM_TABLESTATS=cardinality and storage space used by tables and table spaces -SYSTEM_TABLETYPES=the types of tables that can be created/found within this database -SYSTEM_TEXTTABLES=the data source descriptors of the accessible TEXT TABLE objects defined within this database -SYSTEM_TYPEINFO=a description of predefined table column data types known to this database -SYSTEM_UDTS=the user-defined types that are available within this database -SYSTEM_USERS=users defined within this database -SYSTEM_VERSIONCOLUMNS=the visible columns of the accessible tables that are automatically updated when any value in a row is updated -ADMINISTRABLE_ROLE_AUTHORIZATIONS=one row for each role that can be granted -APPLICABLE_ROLES=one row for each role granted to an authorization -ASSERTIONS= -AUTHORIZATIONS=one row for each user and one row for each role -CHARACTER_SETS=one row for each character set name -COLLATIONS=one row for each character collation descriptor. -COLUMNS=one row for each column of table of view -COLUMN_COLUMN_USAGE=one row for each usage of a column in a generated column definition -COLUMN_DOMAIN_USAGE=one row for each usage of a domain as the type of a column -COLUMN_PRIVILEGES=the visible user level access permissions of each visible column of each accessible table defined within this database -COLUMN_UDT_USAGE=one row for each usage of a user defined type as the type of a column -CONSTRAINT_COLUMN_USAGE=one row for each column identified by a contained in the of a check constraint, domain constraint, or assertion. -CHECK_CONSTRAINT_ROUTINE_USAGE=one row for each SQL-invoked routine identified as the subject routine of either a , a , a , or a contained in an , a , or a
    . -CHECK_CONSTRAINTS=one row for each domain constraint, table check constraint, and assertion. -CONSTRAINT_PERIOD_USAGE=one row for each usage of a period in a referential constraint -CONSTRAINT_TABLE_USAGE=one row for each table identified by a
    simply contained in a
    contained in the of a check constraint, domain constraint, or assertion. -DATA_TYPE_PRIVILEGES=one row for each usage privilege granted on a user defined type -DOMAINS=one row for each domain identified -DOMAIN_CONSTRAINTS=one row for each check constraint included in a domain definition -ELEMENT_TYPES= -ENABLED_ROLES= -INFORMATION_SCHEMA_CATALOG_NAME=the catalog defined within this database -JARS= -JAR_JAR_USAGE= -KEY_COLUMN_USAGE=one row for each column used in s primary key or unique constraint -KEY_PERIOD_USAGE=one row for each period used in s primary key or unique constraint -PARAMETERS=one row for each routine parameter -PERIODS=one row for each system time or application period -REFERENTIAL_CONSTRAINTS=one row for each foreign key constraint -ROLE_AUTHORIZATION_DESCRIPTORS=one row for each role granted directly to a grantee -ROLE_COLUMN_GRANTS=one row for each privilege on a column granted to a role -ROLE_ROUTINE_GRANTS=one row for each usage grant on a routine to a role -ROLE_TABLE_GRANTS=one row for each privilege grant on a table to a role -ROLE_UDT_GRANTS=one row for each usage grant on a user defined type to a role -ROLE_USAGE_GRANTS=one row for each usage grant to a role -ROUTINES=one row for each routine -ROUTINE_COLUMN_USAGE=one row for each table column usage in a routine -ROUTINE_JAR_USAGE= -ROUTINE_PERIOD_USAGE=one row for each usage of a period in a routine -ROUTINE_PRIVILEGES=one row for each usage privilege on a routine -ROUTINE_ROUTINE_USAGE=one row for each usage of a routine in a routine -ROUTINE_SEQUENCE_USAGE=one row for each usage of a sequence in a routine -ROUTINE_TABLE_USAGE=one row for each usage of a table in a routine -SCHEMATA=one row for each schema -SEQUENCES=one row for each external sequence generator -SQL_FEATURES=list of supported SQL Standard features -SQL_IMPLEMENTATION_INFO=list of implementation specific limits -SQL_PACKAGES=list of supported SQL Standard packages -SQL_PARTS=list of supported SQL Standard parts -SQL_SIZING=list of size limits for names and database objects -SQL_SIZING_PROFILES=list of supported SQL Standard packages -TABLES=one row for each table or view -TABLE_CONSTRAINTS=one row for each table constraint associated with a table -TABLE_PRIVILEGES=the visible user level access permissions for each accessible table defined within this database -TRANSLATIONS= -TRIGGERED_UPDATE_COLUMNS=one row for each column in a foreign key cascade action -TRIGGERS=one row for each trigger definition -TRIGGER_COLUMN_USAGE=one row for each usage of a table column in a trigger definition -TRIGGER_PERIOD_USAGE=one row for each usage of a period in a trigger definition -TRIGGER_ROUTINE_USAGE=one row for each usage of a routine in a trigger definition -TRIGGER_SEQUENCE_USAGE= one row for each usage of a sequence in a trigger definition -TRIGGER_TABLE_USAGE=one row for each usage of a table or view in a trigger definition -UDT_PRIVILEGES=one row for each usage privilege on a user defined type -USAGE_PRIVILEGES=one row for each usage privilege granted on character set or domain -USER_DEFINED_TYPES=one row for each user defined type -VIEW_COLUMN_USAGE=one row for each column of a table that is explicitly or implicitly referenced in the of the view being described -VIEW_PERIOD_USAGE=one row for each usage of period in a view -VIEW_ROUTINE_USAGE=one row for each SQL-invoked routine identified as the subject routine of either a , a , a , or a contained in a -VIEW_TABLE_USAGE=one row for each table identified by a
    simply contained in a
    that is contained in the of a view -VIEWS=the view descriptors of the accessible views defined within this database diff --git a/database/hsqldb/src/org/hsqldb/resources/information-schema.sql b/database/hsqldb/src/org/hsqldb/resources/information-schema.sql deleted file mode 100644 index 3a7a5f82..00000000 --- a/database/hsqldb/src/org/hsqldb/resources/information-schema.sql +++ /dev/null @@ -1,600 +0,0 @@ --- author Fred Toussi (fredt@users dot sourceforge.net) version 2.7.2 -/*system_procedures*/ -SELECT ROUTINE_CATALOG AS PROCEDURE_CAT, ROUTINE_SCHEMA AS PROCEDURE_SCHEM, -ROUTINE_NAME AS PROCEDURE_NAME, 0, 0, 0, -CAST( NULL AS VARCHAR(256)) AS REMARKS, -CASE WHEN ROUTINE_TYPE = 'PROCEDURE' THEN 1 ELSE 2 END CASE AS PROCEDURE_TYPE, -SPECIFIC_NAME FROM INFORMATION_SCHEMA.ROUTINES - -/*data_type_privileges*/ -SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, -'TABLE', DTD_IDENTIFIER -FROM COLUMNS -UNION -SELECT DOMAIN_CATALOG, DOMAIN_SCHEMA, DOMAIN_NAME, -'DOMAIN', DTD_IDENTIFIER -FROM DOMAINS -UNION -SELECT SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME, -'ROUTINE', DTD_IDENTIFIER -FROM PARAMETERS -UNION -SELECT SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME, -'ROUTINE', DTD_IDENTIFIER -FROM ROUTINES -WHERE DTD_IDENTIFIER IS NOT NULL -UNION -SELECT USER_DEFINED_TYPE_CATALOG, USER_DEFINED_TYPE_SCHEMA, -USER_DEFINED_TYPE_NAME, 'USER-DEFINED TYPE', SOURCE_DTD_IDENTIFIER -FROM USER_DEFINED_TYPES -WHERE SOURCE_DTD_IDENTIFIER IS NOT NULL -UNION -SELECT USER_DEFINED_TYPE_CATALOG, USER_DEFINED_TYPE_SCHEMA, -USER_DEFINED_TYPE_NAME, 'USER-DEFINED TYPE', REF_DTD_IDENTIFIER -FROM USER_DEFINED_TYPES -WHERE REF_DTD_IDENTIFIER IS NOT NULL; -/*sql_features*/ -VALUES -('B011', 'Embedded Ada', '', '', 'NO', CAST(NULL AS CHARACTER), ''), -('B012', 'Embedded C', '', '', 'NO', NULL, ''), -('B013', 'Embedded COBOL', '', '', 'NO', NULL, ''), -('B014', 'Embedded Fortran', '', '', 'NO', NULL, ''), -('B015', 'Embedded MUMPS', '', '', 'NO', NULL, ''), -('B016', 'Embedded Pascal', '', '', 'NO', NULL, ''), -('B017', 'Embedded PL/I', '', '', 'NO', NULL, ''), -('B021', 'Direct SQL', '', '', 'YES', NULL, ''), -('B031', 'Basic dynamic SQL', '', '', 'NO', NULL, ''), -('B032', 'Extended dynamic SQL', '', '', 'NO', NULL, ''), -('B032', 'Extended dynamic SQL', '01', 'describe input statement', 'NO', NULL, ''), -('B033', 'Untyped SQL-invoked function arguments', '', '', 'NO', NULL, ''), -('B034', 'Dynamic specification of cursor attributes', '', '', 'NO', NULL, ''), -('B041', 'Extensions to embedded SQL exception declarations', '', '', 'NO', NULL, ''), -('B051', 'Enhanced execution rights', '', '', 'NO', NULL, ''), -('B111', 'Module language Ada', '', '', 'NO', NULL, ''), -('B112', 'Module language C', '', '', 'NO', NULL, ''), -('B113', 'Module language COBOL', '', '', 'NO', NULL, ''), -('B114', 'Module language Fortran', '', '', 'NO', NULL, ''), -('B115', 'Module language MUMPS', '', '', 'NO', NULL, ''), -('B116', 'Module language Pascal', '', '', 'NO', NULL, ''), -('B117', 'Module language PL/I', '', '', 'NO', NULL, ''), -('B121', 'Routine language Ada', '', '', 'NO', NULL, ''), -('B122', 'Routine language C', '', '', 'NO', NULL, ''), -('B123', 'Routine language COBOL', '', '', 'NO', NULL, ''), -('B124', 'Routine language Fortran', '', '', 'NO', NULL, ''), -('B125', 'Routine language MUMPS', '', '', 'NO', NULL, ''), -('B126', 'Routine language Pascal', '', '', 'NO', NULL, ''), -('B127', 'Routine language PL/I', '', '', 'NO', NULL, ''), -('B128', 'Routine language SQL', '', '', 'YES', NULL, 'only schema-contained routines'), -('C011', 'Call-Level Interface', '', '', 'YES', NULL, 'via JDBC'), -('E011', 'Numeric data types', '', '', 'YES', NULL, ''), -('E011', 'Numeric data types', '01', 'INTEGER and SMALLINT data types', 'YES', NULL, ''), -('E011', 'Numeric data types', '02', 'REAL, DOUBLE PRECISION, and FLOAT data types', 'YES', NULL, ''), -('E011', 'Numeric data types', '03', 'DECIMAL and NUMERIC data types', 'YES', NULL, ''), -('E011', 'Numeric data types', '04', 'Arithmetic operators', 'YES', NULL, ''), -('E011', 'Numeric data types', '05', 'Numeric comparison', 'YES', NULL, ''), -('E011', 'Numeric data types', '06', 'Implicit casting among the numeric data types', 'YES', NULL, ''), -('E021', 'Character data types', '', '', 'YES', NULL, ''), -('E021', 'Character string types', '01', 'CHARACTER data type', 'YES', NULL, ''), -('E021', 'Character string types', '02', 'CHARACTER VARYING data type', 'YES', NULL, ''), -('E021', 'Character string types', '03', 'Character literals', 'YES', NULL, ''), -('E021', 'Character string types', '04', 'CHARACTER_LENGTH function', 'YES', NULL, ''), -('E021', 'Character string types', '05', 'OCTET_LENGTH function', 'YES', NULL, ''), -('E021', 'Character string types', '06', 'SUBSTRING function', 'YES', NULL, ''), -('E021', 'Character string types', '07', 'Character concatenation', 'YES', NULL, ''), -('E021', 'Character string types', '08', 'UPPER and LOWER functions', 'YES', NULL, ''), -('E021', 'Character string types', '09', 'TRIM function', 'YES', NULL, ''), -('E021', 'Character string types', '10', 'Implicit casting among the character string types', 'YES', NULL, ''), -('E021', 'Character string types', '11', 'POSITION function', 'YES', NULL, ''), -('E021', 'Character string types', '12', 'Character comparison', 'YES', NULL, ''), -('E031', 'Identifiers', '', '', 'YES', NULL, ''), -('E031', 'Identifiers', '01', 'Delimited identifiers', 'YES', NULL, ''), -('E031', 'Identifiers', '02', 'Lower case identifiers', 'YES', NULL, ''), -('E031', 'Identifiers', '03', 'Trailing underscore', 'YES', NULL, ''), -('E051', 'Basic query specification', '', '', 'YES', NULL, ''), -('E051', 'Basic query specification', '01', 'SELECT DISTINCT', 'YES', NULL, ''), -('E051', 'Basic query specification', '02', 'GROUP BY clause', 'YES', NULL, ''), -('E051', 'Basic query specification', '04', 'GROUP BY can contain columns not in
    \n"); - storeResult(new java.util.Date().toString(), 0, 0, 0); - storeResult(filepath + " " + tableType + " " + nioMode, bigrows, - 0, 0); - } catch (Exception e) {} - - user = "sa"; - password = ""; - - try { - sStatement = null; - cConnection = null; - - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - if (filedb) { - deleteDatabase(filepath); - - cConnection = DriverManager.getConnection(url + filepath, - user, password); - sStatement = cConnection.createStatement(); - -// sStatement.execute("SET FILES WRITE DELAY " + 2); - sStatement.execute("SET FILES DEFRAG " + 0); - sStatement.execute("SET FILES LOG SIZE " + 0); - sStatement.execute("SET FILES SCALE 64"); - sStatement.execute("SET FILES SPACE TRUE"); - sStatement.execute("SET DATABASE EVENT LOG LEVEL 3"); - sStatement.execute("SET FILES CACHE ROWS " + cacheRows); - sStatement.execute("SET FILES CACHE SIZE " + cacheSize); - sStatement.execute("SET FILES NIO " + nioMode); - sStatement.execute("SET FILES BACKUP INCREMENT " + true); - sStatement.execute("SHUTDOWN"); - cConnection.close(); - } - } catch (Exception e) { - e.printStackTrace(); - System.out.println("TestSql.setUp() error: " + e.getMessage()); - } - } - - /** - * Fill up the cache - * - * - */ - public void testFillUp() { - - StopWatch sw = new StopWatch(); - String ddl1 = "DROP TABLE test IF EXISTS"; - String ddl11 = "DROP TABLE zip IF EXISTS"; - String ddl2 = "CREATE TABLE zip( zip INT IDENTITY )"; - String ddl3 = "CREATE " + tableType + " TABLE test( id INT IDENTITY," - + " firstname VARCHAR(20), " + " lastname VARCHAR(20), " - + " zip INTEGER, " + " filler VARCHAR(300))"; - String ddl31 = "SET TABLE test SOURCE \"test.csv;cache_rows=" - + cacheRows + "\""; - - String ddl32 = "SET TABLE test SOURCE HEADER " - + "'id, name, lastname, zip, filler'"; - String ddl33 = "SET TABLE test NEW SPACE"; - // adding extra index will slow down inserts a bit - String ddl4 = "CREATE INDEX idx1 ON TEST (lastname)"; - - // adding this index will slow down inserts a lot - String ddl5 = "CREATE INDEX idx2 ON TEST (zip)"; - - // referential integrity checks will slow down inserts a bit - String ddl6 = - "ALTER TABLE test add constraint c1 FOREIGN KEY (zip) REFERENCES zip(zip) ON DELETE CASCADE;"; - String ddl7 = "CREATE TEMP TABLE temptest( id INT," - + " firstname VARCHAR, " + " lastname VARCHAR, " - + " zip INTEGER, " + " filler VARCHAR)"; - String mddl1 = "DROP TABLE test2 IF EXISTS"; - String mddl2 = "CREATE " + tableType - + " TABLE test2( id1 INT, id2 INT," - + " firstname VARCHAR, " + " lastname VARCHAR, " - + " zip INTEGER, " + " filler VARCHAR, " - + " PRIMARY KEY (id1,id2) )"; - String mdd13 = "SET TABLE test2 SOURCE \"test2.csv;cache_rows=" - + cacheRows + "\""; - - try { - -// System.out.println("Connecting"); - sw.zero(); - - cConnection = null; - sStatement = null; - cConnection = DriverManager.getConnection(url + filepath, user, - password); - - System.out.println("connection time -- " + sw.elapsedTime()); - sw.zero(); - - sStatement = cConnection.createStatement(); - - java.util.Random randomgen = new java.util.Random(); - -// sStatement.execute("SET WRITE_DELAY " + writeDelay); - sStatement.execute(ddl1); - sStatement.execute(ddl2); - sStatement.execute(ddl3); - - if (tableType.equals("TEXT")) { - sStatement.execute(ddl31); - sStatement.execute(ddl32); - } else { - sStatement.execute(ddl33); - } - -// System.out.println("test table with no index"); - if (indexLastName) { - sStatement.execute(ddl4); - System.out.println("created index on lastname"); - } - - if (indexZip) { - sStatement.execute(ddl5); - System.out.println("created index on zip"); - } - - if (addForeignKey) { - sStatement.execute(ddl6); - System.out.println("added foreign key"); - } - - if (createTempTable) { - sStatement.execute(ddl7); - System.out.println("created temp table"); - } - - if (multikeytable) { - sStatement.execute(mddl1); - sStatement.execute(mddl2); - - if (tableType.equals("TEXT")) { - sStatement.execute(mdd13); - } - - System.out.println("created multi key table"); - } - -// sStatement.execute("CREATE INDEX idx3 ON tempTEST (zip);"); - System.out.println("complete setup time -- " + sw.elapsedTime() - + " ms"); - fillUpBigTable(randomgen); - - if (multikeytable) { - fillUpMultiTable(randomgen); - } - - sw.zero(); - - if (shutdown) { - sStatement.execute("SHUTDOWN"); - - long time = sw.elapsedTime(); - - storeResult("shutdown", 0, time, 0); - System.out.println("shutdown time -- " + time + " ms"); - } - - cConnection.close(); - } catch (SQLException e) { - System.out.println(e.getMessage()); - } - } - - private void fillUpBigTable(Random randomgen) throws SQLException { - - StopWatch sw = new StopWatch(); - int i; - PreparedStatement ps = - cConnection.prepareStatement("INSERT INTO zip VALUES(?)"); - - for (i = 0; i <= smallrows; i++) { - ps.setInt(1, i); - ps.execute(); - } - - ps.close(); - cConnection.commit(); - sStatement.execute("SET DATABASE REFERENTIAL INTEGRITY " - + this.refIntegrity); - - ps = cConnection.prepareStatement( - "INSERT INTO test (firstname,lastname,zip,filler) VALUES (?,?,?,?)"); - - ps.setString(1, "Julia"); - ps.setString(2, "Clancy"); - - for (i = 0; i < bigrows; i++) { - ps.setInt(3, nextIntRandom(randomgen, smallrows)); - - { - - // small rows - long nextrandom = randomgen.nextLong(); - int randomlength = (int) nextrandom & 0x7f; - - if (randomlength > filler.length()) { - randomlength = filler.length(); - } - - String varfiller = filler.substring(0, randomlength); - - ps.setString(4, nextrandom + varfiller); - } - -/* - { - // big rows - long nextrandom = randomgen.nextLong(); - int randomlength = (int) nextrandom & 0x7ff; - - if (randomlength > filler.length() * 20) { - randomlength = filler.length() * 20; - } - - StringBuilder sb = new StringBuilder(0xff); - - for (int j = 0; j < 20; j++) { - sb.append(filler); - } - - String varfiller = sb.substring(0, randomlength); - - ps.setString(4, nextrandom + varfiller); - } -*/ - ps.execute(); - - if ((i + 1) % 100000 == 0) { - cConnection.commit(); - } - - if (reportProgress && (i + 1) % 10000 == 0) { - System.out.println("insert " + (i + 1) + " : " - + sw.elapsedTime()); - } - - // delete and add 4000 rows to introduce fragmentation - if (deleteWhileInsert && i != 0 - && i % deleteWhileInsertInterval == 0) { - sStatement.execute("CALL IDENTITY();"); - - ResultSet rs = sStatement.getResultSet(); - - rs.next(); - - int lastId = rs.getInt(1); - - sStatement.execute("DECLARE LOCAL TEMPORARY TABLE TEMPT (LIKE TEST) ON COMMIT PRESERVE ROWS"); - sStatement.execute( - "INSERT INTO tempt SELECT * FROM test WHERE id > " - + (lastId - 4000)); - sStatement.execute("DELETE FROM test WHERE id > " - + (lastId - 4000)); - sStatement.execute("INSERT INTO test SELECT * FROM tempt"); - sStatement.execute("DROP TABLE SESSION.TEMPT"); - } - } - - ps.close(); - cConnection.commit(); - - long time = sw.elapsedTime(); - long rate = ((long) i * 1000) / (time + 1); - - storeResult("insert", i, time, rate); - System.out.println("insert time for " + i + " rows -- " + time - + " ms -- " + rate + " tps"); - } - - private void fillUpMultiTable(Random randomgen) throws SQLException { - - StopWatch sw = new StopWatch(); - int i; - PreparedStatement ps = cConnection.prepareStatement( - "INSERT INTO test2 (id1, id2, firstname,lastname,zip,filler) VALUES (?,?,?,?,?,?)"); - - ps.setString(3, "Julia"); - ps.setString(4, "Clancy"); - - int id1 = 0; - - for (i = 0; i < bigrows; i++) { - int id2 = nextIntRandom(randomgen, Integer.MAX_VALUE); - - if (i % 1000 == 0) { - id1 = nextIntRandom(randomgen, Integer.MAX_VALUE); - } - - ps.setInt(1, id1); - ps.setInt(2, id2); - ps.setInt(5, nextIntRandom(randomgen, smallrows)); - - long nextrandom = randomgen.nextLong(); - int randomlength = (int) nextrandom & 0x7f; - - if (randomlength > filler.length()) { - randomlength = filler.length(); - } - - String varfiller = filler.substring(0, randomlength); - - ps.setString(6, nextrandom + varfiller); - - try { - ps.execute(); - } catch (SQLException e) { - e.printStackTrace(); - } - - if (reportProgress && (i + 1) % 10000 == 0) { - System.out.println("insert " + (i + 1) + " : " - + sw.elapsedTime()); - } - } - - ps.close(); - System.out.println("total multi key rows inserted: " + i); - System.out.println("insert time: " + sw.elapsedTime() + " rps: " - + (i * 1000L / (sw.elapsedTime() + 1))); - } - - protected void tearDown() { - - try { - writer.write("\n
    \n"); - writer.close(); - } catch (Exception e) {} - } - - protected void checkResults() { - - try { - StopWatch sw = new StopWatch(); - ResultSet rs; - - cConnection = DriverManager.getConnection(url + filepath, user, - password); - - long time = sw.elapsedTime(); - - storeResult("reopen", 0, time, 0); - System.out.println("database reopen time -- " + time + " ms"); - sw.zero(); - - sStatement = cConnection.createStatement(); - - checkSelects(); - checkUpdates(); - sw.zero(); - - if (shutdown) { - sStatement.execute("SHUTDOWN"); - - time = sw.elapsedTime(); - - storeResult("shutdown", 0, time, 0); - System.out.println("shutdown time -- " + time + " ms"); - } - - cConnection.close(); - -// System.out.println("database close time -- " + sw.elapsedTime() + " ms"); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - void selectZip() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - - try { - PreparedStatement ps = cConnection.prepareStatement( - "SELECT TOP 1 firstname,lastname,zip,filler FROM test WHERE zip = ?"); - - for (; i < bigops; i++) { - ps.setInt(1, nextIntRandom(randomgen, smallrows)); - ps.execute(); - - if ((i + 1) == 100 && sw.elapsedTime() > 50000) { - slow = true; - } - - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("Select " + (i + 1) + " : " - + sw.elapsedTime() + " rps: " - + (i * 1000L / (sw.elapsedTime() + 1))); - } - } - } catch (SQLException e) { - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = ((long) i * 1000) / (time + 1); - - storeResult("select random zip", i, time, rate); - System.out.println("select time for random zip " + i + " rows -- " - + time + " ms -- " + rate + " tps"); - } - - void selectID() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - - try { - PreparedStatement ps = cConnection.prepareStatement( - "SELECT firstname,lastname,zip,filler FROM test WHERE id = ?"); - - for (i = 0; i < smallops; i++) { - ps.setInt(1, nextIntRandom(randomgen, bigrows - 1)); - ps.execute(); - - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("Select " + (i + 1) + " : " - + (sw.elapsedTime() + 1)); - } - } - - ps.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = ((long) i * 1000) / (time + 1); - - storeResult("select random id", i, time, rate); - System.out.println("select time for random id " + i + " rows -- " - + time + " ms -- " + rate + " tps"); - } - - void selectZipTable() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - - try { - PreparedStatement ps = cConnection.prepareStatement( - "SELECT zip FROM zip WHERE zip = ?"); - - for (i = 0; i < bigops; i++) { - ps.setInt(1, nextIntRandom(randomgen, smallrows - 1)); - ps.execute(); - - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("Select " + (i + 1) + " : " - + (sw.elapsedTime() + 1)); - } - } - - ps.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = ((long) i * 1000) / (time + 1); - - storeResult("select random zip (zip table)", i, time, rate); - System.out.println("select time for random zip from zip table " + i - + " rows -- " + time + " ms -- " + rate + " tps"); - } - - private void countTestID() { - - try { - StopWatch sw = new StopWatch(); - ResultSet rs; - long time; - long rate; - - // the tests use different indexes - // use primary index - sStatement.execute("SELECT count(*) from TEST where id > -1"); - - rs = sStatement.getResultSet(); - - rs.next(); - - time = sw.elapsedTime(); - rate = ((long) bigrows * 1000) / (time + 1); - - storeResult("count (index on id)", rs.getInt(1), time, rate); - System.out.println("count time (index on id) " + rs.getInt(1) - + " rows -- " + time + " ms -- " + rate - + " tps"); - sw.zero(); - sStatement.execute("SELECT count(*) from TEST"); - - rs = sStatement.getResultSet(); - - rs.next(); - - time = sw.elapsedTime(); - rate = (1000L) / (time + 1); - - storeResult("count (index on id)", rs.getInt(1), time, rate); - System.out.println("count time (full count) " + rs.getInt(1) - + " rows -- " + time + " ms -- " + rate - + " tps"); - } catch (SQLException e) {} - } - - private void countTestZip() { - - try { - StopWatch sw = new StopWatch(); - - sStatement.execute("SELECT count(*) from TEST where zip > -1"); - - ResultSet rs = sStatement.getResultSet(); - - rs.next(); - - long time = (long) sw.elapsedTime(); - long rate = ((long) bigrows * 1000) / (time + 1); - - storeResult("count (index on zip)", rs.getInt(1), time, rate); - System.out.println("count time (index on zip) " + rs.getInt(1) - + " rows -- " + time + " ms -- " + rate - + " tps"); - } catch (SQLException e) {} - } - - private void countZip() { - - try { - StopWatch sw = new StopWatch(); - - sStatement.execute("SELECT count(*) from zip where zip > -1"); - - ResultSet rs = sStatement.getResultSet(); - - rs.next(); - System.out.println("count time (zip table) " + rs.getInt(1) - + " rows -- " + sw.elapsedTime() + " ms"); - } catch (SQLException e) {} - } - - private void updateZip() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - int count = 0; - int random = 0; - - try { - PreparedStatement ps = cConnection.prepareStatement( - "UPDATE test SET filler = filler || zip WHERE zip = ?"); - - for (; i < smallrows; i++) { - random = nextIntRandom(randomgen, smallrows - 1); - - ps.setInt(1, random); - - count += ps.executeUpdate(); - - if (reportProgress && count % 10000 < 20) { - System.out.println("Update " + count + " : " - + (sw.elapsedTime() + 1)); - } - } - - ps.close(); - } catch (SQLException e) { - System.out.println("error : " + random); - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = (i * 1000L) / (time + 1); - - storeResult("update with random zip", i, time, rate); - System.out.println("update time with random zip " + i + " rows -- " - + time + " ms -- " + rate + " tps"); - } - - void updateID() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - int count = 0; - int random = 0; - - try { - PreparedStatement ps = cConnection.prepareStatement( - "UPDATE test SET zip = zip + 1 WHERE id = ? and zip <> " - + smallrows); - - for (i = 0; i < smallops; i++) { - random = nextIntRandom(randomgen, bigrows - 1); - - ps.setInt(1, random); - ps.execute(); - - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("Update " + (i + 1) + " : " - + sw.elapsedTime() + " rps: " - + (i * 1000L / (sw.elapsedTime() + 1))); - } - } - - ps.close(); - } catch (SQLException e) { - System.out.println("error : " + random); - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = (i * 1000L) / (time + 1); - - storeResult("update with random id", i, time, rate); - System.out.println("update time with random id " + i + " rows -- " - + time + " ms -- " + rate + " tps"); - } - - void updateTestString() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - int count = 0; - int random = 0; - - try { - PreparedStatement ps = cConnection.prepareStatement( - "UPDATE test SET filler = ? WHERE id = ? and zip <> " - + smallrows); - - for (i = 0; i < smallops * 2; i++) { - random = nextIntRandom(randomgen, bigrows - 1); - - int randomLength = nextIntRandom(randomgen, filler.length()); - String newFiller = filler.substring(randomLength); - - ps.setString(1, newFiller); - ps.setInt(2, random); - ps.execute(); - - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("Update " + (i + 1) + " : " - + sw.elapsedTime() + " rps: " - + (i * 1000L / (sw.elapsedTime() + 1))); - } - } - - ps.close(); - } catch (SQLException e) { - System.out.println("error : " + random); - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = (i * 1000L) / (time + 1); - - storeResult("update with random id", i, time, rate); - System.out.println("update time with random id " + i + " rows -- " - + time + " ms -- " + rate + " tps"); - } - - void updateIDLinear() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - int count = 0; - int random = 0; - - try { - PreparedStatement ps = cConnection.prepareStatement( - "UPDATE test SET zip = zip + 1 WHERE id = ? and zip <> " - + smallrows); - - for (i = 0; i < bigops; i++) { - random = i; - - ps.setInt(1, random); - - count += ps.executeUpdate(); - - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("Update " + (i + 1) + " : " - + sw.elapsedTime() + " rps: " - + (i * 1000L / (sw.elapsedTime() + 1))); - } - } - - System.out.println(count); - ps.close(); - } catch (SQLException e) { - System.out.println("error : " + random); - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = (i * 1000L) / (time + 1); - - storeResult("update with sequential id", i, time, rate); - System.out.println("update time with sequential id " + i - + " rows -- " + time + " ms -- " + rate + " tps"); - } - - void deleteTest() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - int count = 0; - int random = 0; - - try { - PreparedStatement ps = - cConnection.prepareStatement("DELETE FROM test WHERE id = ?"); - - for (i = 0; count < smallops; i++) { - random = nextIntRandom(randomgen, bigrows); - -// random = i; - ps.setInt(1, random); - - count += ps.executeUpdate(); - -/* - if ((i + 1) % 10000 == 0) { - Statement st = cConnection.createStatement(); - - st.execute("CHECKPOINT DEFRAG"); - st.close(); - } -*/ - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("delete " + (i + 1) + " : " - + sw.elapsedTime() + " rps: " - + (i * 1000L / (sw.elapsedTime() + 1))); - } - } - - ps.close(); - } catch (SQLException e) { - System.out.println("error : " + random); - e.printStackTrace(); - } - - System.out.println(count); - - long time = sw.elapsedTime(); - long rate = (count * 1000L) / (time + 1); - - storeResult("delete with random id", count, time, rate); - System.out.println("delete time for random id " + count + " rows -- " - + time + " ms -- " + rate + " tps"); - } - - void deleteZipTable() { - - StopWatch sw = new StopWatch(); - java.util.Random randomgen = new java.util.Random(); - int i = 0; - boolean slow = false; - int count = 0; - int random = 0; - - try { - PreparedStatement ps = - cConnection.prepareStatement("DELETE FROM zip WHERE zip = ?"); - - for (i = 0; i <= smallrows; i++) { - -// random = randomgen.nextInt(smallrows - 1); - random = i; - - ps.setInt(1, random); - - count += ps.executeUpdate(); - - if (reportProgress && (i + 1) % 10000 == 0 - || (slow && (i + 1) % 100 == 0)) { - System.out.println("delete " + (i + 1) + " : " - + sw.elapsedTime() + " rps: " - + (i * 1000L / (sw.elapsedTime() + 1))); - } - } - - ps.close(); - } catch (SQLException e) { - System.out.println("error : " + random); - e.printStackTrace(); - } - - long time = sw.elapsedTime(); - long rate = ((long) count * 1000) / (time + 1); - - storeResult("delete with random zip", count, time, rate); - System.out.println("delete time for random zip " + count - + " rows -- " + time + " ms -- " + rate + " tps"); - } - - void storeResult(String description, int count, long time, long rate) { - - try { - writer.write("" + description + "" + count - + "" + time + "" + rate - + "\n"); - } catch (Exception e) {} - } - - static void deleteDatabase(String path) { - FileUtil.deleteOrRenameDatabaseFiles(path); - } - - int nextIntRandom(Random r, int range) { - - int b = r.nextInt(); - - if (b == Integer.MIN_VALUE) { - b = Integer.MAX_VALUE; - } - - b = Math.abs(b); - - return b % range; - } - - public static void main(String[] argv) { - - TestCacheSize test = new TestCacheSize(); - HsqlProperties props = HsqlProperties.argArrayToProps(argv, "test"); - - test.bigops = props.getIntegerProperty("test.bigops", test.bigops); - test.bigrows = test.bigops; - test.smallops = test.bigops / 8; - test.tableType = props.getProperty("test.tabletype", test.tableType); - test.nioMode = props.isPropertyTrue("test.nio", test.nioMode); - - if (props.getProperty("test.dbtype", "").equals("mem")) { - test.filepath = "mem:test"; - test.filedb = false; - test.shutdown = false; - } - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - } catch (Exception e) {} - - test.setUp(); - - StopWatch sw = new StopWatch(); - - test.testFillUp(); - test.checkResults(); - - long time = sw.elapsedTime(); - - test.storeResult("total test time", 0, (int) time, 0); - System.out.println("total test time -- " + sw.elapsedTime() + " ms"); - test.tearDown(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestCascade.java b/database/hsqldb/src/org/hsqldb/test/TestCascade.java deleted file mode 100644 index e1892859..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestCascade.java +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -/* - * CascadeDeleteBug.java - * - * Created on June 24, 2002, 8:48 AM - */ -import java.io.File; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.TestCase; - -/** - * Test case to demonstrate catastrophic bug in cascade delete code. - * - * @version 1.0 - * @author David Kopp - */ -public class TestCascade extends TestCase { - - Connection con; - - public TestCascade(String name) { - super(name); - } - - protected void setUp() { - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - createDatabase(); - - con = DriverManager.getConnection("jdbc:hsqldb:testdb/testdb", "sa", ""); - } catch (Exception e) { - e.printStackTrace(); - System.out.println(this + ".setUp() error: " + e.getMessage()); - } - } - - protected void tearDown() { - - try { - con.createStatement().execute("SHUTDOWN"); - con.close(); - } catch (SQLException e) {} - } - - public void testDelete() { - - try { - insertData(con); - - Statement stmt = con.createStatement(); - ResultSet rs = - stmt.executeQuery("SELECT COUNT(EIACODXA) FROM CA"); - - rs.next(); - - int origCount = rs.getInt(1); - - rs.close(); - deleteXBRecord(con); - - rs = stmt.executeQuery("SELECT COUNT(EIACODXA) FROM CA"); - - rs.next(); - - int newCount = rs.getInt(1); - - rs.close(); - stmt.close(); - assertEquals(9, newCount); - } catch (SQLException e) { - this.assertTrue("SQLException thrown", false); - } - } - - private static void createDatabase() throws SQLException { - - TestUtil.deleteDatabase("testdb/testdb"); - - Connection con = DriverManager.getConnection("jdbc:hsqldb:testdb/testdb", - "sa", ""); - String[] saDDL = { - "CREATE CACHED TABLE XB (EIACODXA VARCHAR(10) NOT NULL, LSACONXB VARCHAR(18) NOT NULL, ALTLCNXB VARCHAR(2) NOT NULL, LCNTYPXB VARCHAR(1) NOT NULL, LCNINDXB VARCHAR(1), LCNAMEXB VARCHAR(19), UPDT_BY VARCHAR(32), LST_UPDT TIMESTAMP, CONSTRAINT XPKXB PRIMARY KEY (EIACODXA, LSACONXB, ALTLCNXB, LCNTYPXB));", - -// "CREATE INDEX XIF2XB ON XB (EIACODXA);", - "CREATE CACHED TABLE CA ( EIACODXA VARCHAR(10) NOT NULL, LSACONXB VARCHAR(18) NOT NULL, ALTLCNXB VARCHAR(2) NOT NULL, LCNTYPXB VARCHAR(1) NOT NULL, TASKCDCA VARCHAR(7) NOT NULL, TSKFRQCA NUMERIC(7,4), UPDT_BY VARCHAR(32), LST_UPDT TIMESTAMP, CONSTRAINT XPKCA PRIMARY KEY (EIACODXA, LSACONXB, ALTLCNXB, LCNTYPXB, TASKCDCA), CONSTRAINT R_XB_CA FOREIGN KEY (EIACODXA, LSACONXB, ALTLCNXB, LCNTYPXB) REFERENCES XB ON DELETE CASCADE);", - -// "CREATE INDEX XIF26CA ON CA ( EIACODXA, LSACONXB, ALTLCNXB, LCNTYPXB);" - }; - Statement stmt = con.createStatement(); - - for (int index = 0; index < saDDL.length; index++) { - stmt.executeUpdate(saDDL[index]); - } - - stmt.execute("SHUTDOWN"); - con.close(); - } // createDatabase - - /** - * This method demonstrates the bug in cascading deletes. Before this method, - * the CA table has 12 records. After, it should have 9, but instead it has - * 0. - */ - private static void deleteXBRecord(Connection con) throws SQLException { - - Statement stmt = con.createStatement(); - - stmt.executeUpdate( - "DELETE FROM XB WHERE LSACONXB = 'LEAA' AND EIACODXA = 'T850' AND LCNTYPXB = 'P' AND ALTLCNXB = '00'"); - stmt.close(); - } // deleteXBRecord - - private static void insertData(Connection con) throws SQLException { - - String[] saData = { - "INSERT INTO XB VALUES('T850','LEAA','00','P',NULL,'LCN NAME','sa',NOW)", - "INSERT INTO XB VALUES('T850','LEAA01','00','P',NULL,'LCN NAME','sa',NOW)", - "INSERT INTO XB VALUES('T850','LEAA02','00','P',NULL,'LCN NAME','sa',NOW)", - "INSERT INTO XB VALUES('T850','LEAA03','00','P',NULL,'LCN NAME','sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA','00','P','ABCDEFG',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA','00','P','QRSTUJV',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA','00','P','ZZZZZZZ',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA01','00','P','ABCDEFG',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA01','00','P','QRSTUJV',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA01','00','P','ZZZZZZZ',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA02','00','P','ABCDEFG',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA02','00','P','QRSTUJV',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA02','00','P','ZZZZZZZ',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA03','00','P','ABCDEFG',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA03','00','P','QRSTUJV',3.14,'sa',NOW)", - "INSERT INTO CA VALUES('T850','LEAA03','00','P','ZZZZZZZ',3.14,'sa',NOW)" - }; - Statement stmt = con.createStatement(); - - for (int index = 0; index < saData.length; index++) { - stmt.executeUpdate(saData[index]); - } - } // insertData -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestCollation.java b/database/hsqldb/src/org/hsqldb/test/TestCollation.java deleted file mode 100644 index 1c022c74..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestCollation.java +++ /dev/null @@ -1,250 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Locale; - -import org.hsqldb.lib.HashSet; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.Set; -import org.hsqldb.types.Collation; - -/** - * Test HSQLDBs collation capabilities - * @author frank.schoenheit@sun.com - */ -public class TestCollation extends TestBase { - - Statement statement; - Connection connection; - Iterator collIterator; - Iterator localeIterator; - - /** Creates a new instance of TestCollation */ - public TestCollation(String name) { - super(name, "jdbc:hsqldb:file:testdb/test"); - } - - protected void setUp() throws Exception { - - super.setUp(); - - connection = newConnection(); - statement = connection.createStatement(); - collIterator = Collation.getCollationsIterator(); - localeIterator = Collation.getLocalesIterator(); - } - - protected void tearDown() { - - try { - statement = connection.createStatement(); - - statement.execute("SHUTDOWN"); - } catch (Exception e) {} - - super.tearDown(); - } - - /** - * checks whether expected locales are present and selectable - */ - public void testVerifyAvailability() { - - // let's check whether unknown collation identifiers are rejected - try { - statement.execute( - getSetCollationStmt( - "ThisIsDefinitlyNoValidCollationIdentifier")); - fail("database did not reject invalid collation name"); - } catch (SQLException e) {} - - // let's check whether the DB accepts all known collations - int count = 0; - - while (collIterator.hasNext()) { - String collationName = (String) collIterator.next(); - - try { - statement.execute(getSetCollationStmt(collationName)); - } catch (SQLException e) { - fail("could not set collation '" + collationName - + "'\n exception message: " + e.getMessage()); - } - - ++count; - } - - System.out.println("checked " + count - + " collations for availability."); - - // even if the above worked, we cannot be sure that all locales are really supported. - // The fact that SET DATABASE COLLATION succeeeded only means that a Collator could - // be instantiated with a Locale matching the given collation name. But what if - // Locale.Instance(...) lied, and returned a fallback Locale instance? - // - // Hmm, looking at the documentation of Locale.getAvailableLocales, I'm not sure - // whether it is really feasible. The doc states "returns a list of all installed Locales". - // The "installed" puzzles me - maybe this is really different per installation, and not only - // per JDK version? - Locale[] availableLocales = Locale.getAvailableLocales(); - Set existenceCheck = new HashSet(); - - for (int i = 0; i < availableLocales.length; ++i) { - String availaleName = availableLocales[i].getLanguage(); - - if (availableLocales[i].getCountry().length() > 0) { - availaleName += "-" + availableLocales[i].getCountry(); - } - - existenceCheck.add(availaleName); - } - - String notInstalled = ""; - int expected = 0, - failed = 0; - - while (localeIterator.hasNext()) { - String localeName = (String) localeIterator.next(); - - ++expected; - - if (!existenceCheck.contains(localeName)) { - if (notInstalled.length() > 0) { - notInstalled += "; "; - } - - notInstalled += localeName; - - ++failed; - } - } - - if (notInstalled.length() > 0) { - fail("the following locales are not installed:\n " + notInstalled - + "\n (" + failed + " out of " + expected + ")"); - } - } - - /** - * checks whether sorting via a given collation works as expected - */ - public void testVerifyCollation() { - - String failedCollations = ""; - String failMessage = ""; - - while (collIterator.hasNext()) { - String collationName = (String) collIterator.next(); - String message = checkSorting(collationName); - - if (message.length() > 0) { - if (failedCollations.length() > 0) { - failedCollations += ", "; - } - - failedCollations += collationName; - failMessage += message; - } - } - - if (failedCollations.length() > 0) { - fail("test failed for following collations:\n" + failedCollations - + "\n" + failMessage); - } - } - - /** - * returns an SQL statement to set the database collation - */ - protected final String getSetCollationStmt(String collationName) { - - final String setCollationStmtPre = "SET DATABASE COLLATION \""; - final String setCollationStmtPost = "\""; - - return setCollationStmtPre + collationName + setCollationStmtPost; - } - - /** - * checks sorting a table with according to a given collation - */ - protected String checkSorting(String collationName) { - - String stmt1 = "DROP TABLE WORDLIST IF EXISTS;"; - String stmt2 = - "CREATE TEXT TABLE WORDLIST ( ID INTEGER, WORD VARCHAR(50) );"; - String stmt3 = "SET TABLE WORDLIST SOURCE \"" + collationName - + ".csv;encoding=UTF-8\""; - String selectStmt = "SELECT ID, WORD FROM WORDLIST ORDER BY WORD"; - String returnMessage = ""; - - try { - - // set database collation - statement.execute(getSetCollationStmt(collationName)); - statement.execute(stmt1); - statement.execute(stmt2); - statement.execute(stmt3); - - ResultSet results = statement.executeQuery(selectStmt); - - while (results.next()) { - int expectedPosition = results.getInt(1); - int foundPosition = results.getRow(); - - if (expectedPosition != foundPosition) { - String word = results.getString(2); - - return "testing collation '" + collationName - + "' failed\n" + " word : " + word - + "\n" + " expected position : " - + expectedPosition + "\n" - + " found position : " + foundPosition + "\n"; - } - } - } catch (SQLException e) { - return "testing collation '" + collationName - + "' failed\n exception message: " + e.getMessage() + "\n"; - } - - return ""; - } - - public static void main(String[] argv) { - runWithResult(TestCollation.class, "testVerifyAvailability"); - runWithResult(TestCollation.class, "testVerifyCollation"); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestConnectionSettings.java b/database/hsqldb/src/org/hsqldb/test/TestConnectionSettings.java deleted file mode 100644 index f888fe8d..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestConnectionSettings.java +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright (c) 2001-2020, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - */ -interface TestConnectionSettings { - - String url(); - - String dbPath(); - - String connType(); - - boolean isServlet(); - - class TestConnectionSettingsMem implements TestConnectionSettings { - - public String url() { - return "jdbc:hsqldb:mem:test;sql.enforce_strict_size=true;sql.restrict_exec=true;hsqldb.tx=mvcc"; - } - - public String dbPath() { - return "mem:test;sql.enforce_strict_size=true;sql.restrict_exec=true;hsqldb.tx=mvcc"; - } - - public String connType() { - return "mem:"; - } - - public boolean isServlet() { - return false; - } - } - - class TestConnectionSettingsFile implements TestConnectionSettings { - - public String url() { - return TestDirectorySettings.fileBaseURL - + "unitestdb;sql.enforce_strict_size=true;sql.restrict_exec=true;hsqldb.tx=mvcc"; - } - - public String dbPath() { - return TestDirectorySettings.fileBase + "unitestdb"; - } - - public String connType() { - return "file:"; - } - - public boolean isServlet() { - return false; - } - } - - class TestConnectionSettingsServerMem implements TestConnectionSettings { - - public String url() { - return "jdbc:hsqldb:hsql://localhost/test"; - } - - public String dbPath() { - return "mem:test;sql.enforce_strict_size=true;sql.restrict_exec=true;hsqldb.tx=mvcc"; - } - - public String connType() { - return "hsql:"; - } - - public boolean isServlet() { - return false; - } - } - - class TestConnectionSettingsHttpServerMem - implements TestConnectionSettings { - - public String url() { - return "jdbc:hsqldb:http://localhost:8085/test"; - } - - public String dbPath() { - return "mem:test;sql.enforce_strict_size=true;sql.restrict_exec=true;hsqldb.tx=mvcc"; - } - - public String connType() { - return "http:"; - } - - public boolean isServlet() { - return false; - } - } - - class TestConnectionSettingsServerFile implements TestConnectionSettings { - - public String url() { - return "jdbc:hsqldb:hsql://localhost/test"; - } - - public String dbPath() { - return TestDirectorySettings.fileBase - + "unitestdb;sql.enforce_strict_size=true;sql.restrict_exec=true;hsqldb.tx=mvcc"; - } - - public String connType() { - return "hsql:"; - } - - public boolean isServlet() { - return false; - } - } - - class TestConnectionSettingsHttpServletMem - implements TestConnectionSettings { - - public String url() { - return "jdbc:hsqldb:http://localhost:8080/test"; - } - - public String dbPath() { - return "mem:test;sql.enforce_strict_size=true;sql.restrict_exec=true;hsqldb.tx=mvcc"; - } - - public String connType() { - return "http:"; - } - - public boolean isServlet() { - return true; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestDataCube.java b/database/hsqldb/src/org/hsqldb/test/TestDataCube.java deleted file mode 100644 index 9adab1ba..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestDataCube.java +++ /dev/null @@ -1,2769 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.TestCase; - -/** - * Test cases for HSQLDB aggregates and HAVING clause. - * - * @author Nicholas Quek (kocolipy@users dot sourceforge.net) - * @version 2.5.1 - * @since 2.5.1 - */ - -public class TestDataCube extends TestCase { - - //------------------------------------------------------------ - // Class variables - //------------------------------------------------------------ - private static final String databaseDriver = "org.hsqldb.jdbc.JDBCDriver"; - private static final String databaseURL = "jdbc:hsqldb:mem:."; - private static final String databaseUser = "sa"; - private static final String databasePassword = ""; - - //------------------------------------------------------------ - // Instance variables - //------------------------------------------------------------ - private Connection conn; - private Statement stmt; - - //------------------------------------------------------------ - // Constructors - //------------------------------------------------------------ - - /** - * Constructs a new SubselectTest. - */ - public TestDataCube(String s) { - super(s); - } - - //------------------------------------------------------------ - // Class methods - //------------------------------------------------------------ - protected static Connection getJDBCConnection() throws SQLException { - return DriverManager.getConnection(databaseURL, databaseUser, - databasePassword); - } - - protected void setUp() throws Exception { - - super.setUp(); - - if (conn != null) { - return; - } - - Class.forName(databaseDriver); - - conn = getJDBCConnection(); - stmt = conn.createStatement(); - - try { - stmt.execute("DROP TABLE REVENUE IF EXISTS"); - stmt.execute("DROP TABLE LIABILITY IF EXISTS"); - stmt.execute("DROP TABLE TEST IF EXISTS"); - } catch (Exception x) {} - - stmt.execute("CREATE TABLE REVENUE(CHANNEL VARCHAR(20), YEAR INTEGER, " + - "COUNTRY VARCHAR(2), PROVINCE VARCHAR(20), SALES INTEGER);"); - - //Channel: Internet - addRevenueSource("INTERNET", 2009, "GB", "CAMBRIDGE", 10000); - addRevenueSource("INTERNET", 2009, "GB", "OXFORD", 15000); - addRevenueSource("INTERNET", 2009, "US", "STANFORD", 100000); - addRevenueSource("INTERNET", 2009, "US", "NEW YORK", 175000); - addRevenueSource("INTERNET", 2010, "GB", "CAMBRIDGE", 20000); - addRevenueSource("INTERNET", 2010, "GB", "OXFORD", 25000); - addRevenueSource("INTERNET", 2010, "US", "STANFORD", 200000); - addRevenueSource("INTERNET", 2010, "US", "NEW YORK", 300000); - - //Channel: Direct Sales - addRevenueSource("DIRECT SALES", 2009, "GB", "CAMBRIDGE", 80000); - addRevenueSource("DIRECT SALES", 2009, "GB", "OXFORD", 82000); - addRevenueSource("DIRECT SALES", 2009, "US", "STANFORD", 802500); - addRevenueSource("DIRECT SALES", 2009, "US", "NEW YORK", 800000); - addRevenueSource("DIRECT SALES", 2010, "GB", "CAMBRIDGE", 90000); - addRevenueSource("DIRECT SALES", 2010, "GB", "OXFORD", 91000); - addRevenueSource("DIRECT SALES", 2010, "US", "STANFORD", 900000); - addRevenueSource("DIRECT SALES", 2010, "US", "NEW YORK", 933000); - - stmt.execute("CREATE TABLE LIABILITY(CHANNEL VARCHAR(20), YEAR INTEGER, " + - "COUNTRY VARCHAR(2), LOSSES INTEGER);"); - - addLiabilitySource("INTERNET", 2009, "GB", 1000); - addLiabilitySource("INTERNET", 2010, "GB", 2000); - addLiabilitySource("INTERNET", 2009, "US", 4000); - addLiabilitySource("INTERNET", 2010, "US", 5000); - - stmt.execute("CREATE TABLE TEST(SEL INTEGER, NAME1 VARCHAR(3), NAME2 VARCHAR(3));"); - - stmt.execute("INSERT INTO TEST (SEL, NAME1, NAME2) VALUES (0, 'FOO', 'BAR')"); - stmt.execute("INSERT INTO TEST (SEL, NAME1, NAME2) VALUES (1, 'BAZ', 'FOO')"); - stmt.execute("INSERT INTO TEST (SEL, NAME1, NAME2) VALUES (1, 'FOO', 'QUX')"); - } - - protected void tearDown() throws Exception { - - try { - stmt.execute("DROP TABLE REVENUE IF EXISTS;"); - } catch (Exception x) {} - - if (stmt != null) { - stmt.close(); - - stmt = null; - } - - if (conn != null) { - conn.close(); - - conn = null; - } - - super.tearDown(); - - } - - private void addRevenueSource(String channel, int year, String country, - String province, int sales) throws Exception { - - stmt.execute("INSERT INTO REVENUE VALUES ('" + channel + "', '" + year - + "', '" + country + "', '" + province + "', " - + sales + ");"); - } - private void addLiabilitySource(String channel, int year, String country, int losses) throws Exception { - - stmt.execute("INSERT INTO LIABILITY VALUES ('" + channel + "', '" + year - + "', '" + country + "', " - + losses + ");"); - } - //------------------------------------------------------------ - // CUBE OPERATOR TEST - //------------------------------------------------------------ - /** - * Tests aggregated selection using the CUBE operator with a GROUP_BY clause. - * This is a normal use of the CUBE operator acting on one column. - * The result set will contain two groupings: (CHANNEL), () - */ - public void testAggregatedGroupByCube() throws SQLException { - String sql = "SELECT CHANNEL, SUM(SALES) \n" + - "FROM REVENUE \n" + - "GROUP BY CUBE(CHANNEL);\n"; - Object[][] expected = new Object[][] { - { - null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(845000) - }, { - "DIRECT SALES", Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the CUBE operator with a GROUP_BY clause. - * The CUBE operator acts on several column. - * The result set will contain eight groupings: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, YEAR), (CHANNEL, COUNTRY), (CHANNEL), - * (YEAR, COUNTRY), (YEAR), (COUNTRY), () - */ - public void testAggregatedGroupByCube1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE \n" + - "GROUP BY CUBE(CHANNEL, YEAR, COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000) - }, { - "INTERNET", Integer.valueOf(2009), null, Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000) - }, { - "INTERNET", null, "GB", Integer.valueOf(70000) - }, { - "INTERNET", null, "US", Integer.valueOf(775000) - }, { - "DIRECT SALES", null, "GB", Integer.valueOf(343000) - }, { - "DIRECT SALES", null, "US", Integer.valueOf(3435500) - }, { - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), "GB", Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", Integer.valueOf(2333000) - }, { - null, Integer.valueOf(2009), null, Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, Integer.valueOf(2559000) - }, { - null, null, "GB", Integer.valueOf(413000) - }, { - null, null, "US", Integer.valueOf(4210500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an invalid GROUP BY clause that contains a CUBE operator with no columns. - * A SQLException should be thrown. - */ - public void testInvalidCube() throws SQLException { - String sql = "SELECT SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY CUBE();\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - /** - * Tests an invalid GROUP BY clause that contains a CUBE operator nested within parenthesis - * A SQLException should be thrown. - */ - public void testInvalidCube1() throws SQLException { - String sql = "SELECT CHANNEL, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY (CUBE(CHANNEL));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - //------------------------------------------------------------ - // ROLLUP OPERATOR TEST - //------------------------------------------------------------ - /** - * Tests aggregated selection using the ROLLUP operator with a GROUP_BY clause. - * This is a normal use of the ROLLUP operator acting on one column. - * The result set will contain two groupings: (CHANNEL), () - */ - public void testAggregatedGroupByRollup() throws SQLException { - String sql = "SELECT CHANNEL, SUM(SALES) \n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CHANNEL);\n"; - Object[][] expected = new Object[][] { - { - null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(845000) - }, { - "DIRECT SALES", Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the ROLLUP operator with a GROUP_BY clause. - * The ROLLUP operator acts on several column. - * The result set will contain four groupings: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, YEAR), (CHANNEL), (), - */ - public void testAggregatedGroupByRollup1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CHANNEL, YEAR, COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000) - }, { - "INTERNET", Integer.valueOf(2009), null, Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000) - }, { - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an invalid GROUP BY clause that contains a ROLLUP operator with no columns. - * A SQLException should be thrown. - */ - public void testInvalidRollup() throws SQLException { - String sql = "SELECT SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP();\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - /** - * Tests an invalid GROUP BY clause that contains a ROLLUP operator nested within parenthesis - * A SQLException should be thrown. - */ - public void testInvalidRollup1() throws SQLException { - String sql = "SELECT CHANNEL, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY (ROLLUP(CHANNEL));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - //------------------------------------------------------------ - // GROUPING SETS OPERATOR TEST - //------------------------------------------------------------ - /** - * Tests aggregated selection using the GROUPING SETS operator with a GROUP_BY clause. - * This is a trivial use of the GROUPING SETS operator acting on one group. - * Equivalent to "GROUP BY CHANNEL" - */ - public void testAggregatedGroupByGS() throws SQLException { - String sql = "SELECT CHANNEL, SUM(SALES) \n" + - "FROM REVENUE \n" + - "GROUP BY GROUPING SETS(CHANNEL);\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(845000) - }, { - "DIRECT SALES", Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the GROUPING SETS operator with a GROUP_BY clause. - * The GROUPING SETS operator acts on several groups of dimension 1. - * The result set will contain three groupings: - * (CHANNEL), (YEAR), (COUNTRY) - */ - public void testAggregatedGroupByGS1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE \n" + - "GROUP BY GROUPING SETS(CHANNEL, YEAR, COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), null, Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, Integer.valueOf(2559000) - }, { - null, null, "GB", Integer.valueOf(413000) - }, { - null, null, "US", Integer.valueOf(4210500) - }, - }; - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the GROUPING SETS operator with a GROUP_BY clause. - * The GROUPING SETS operator acts on several groups of various dimensions. - * The result set will contain three groupings: - * (CHANNEL, YEAR, COUNTRY), (YEAR), (COUNTRY, YEAR), () - */ - public void testAggregatedGroupByGS2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE \n" + - "GROUP BY GROUPING SETS((CHANNEL, YEAR, COUNTRY),(YEAR), (COUNTRY, YEAR), ());\n"; - Object[][] expected = new Object[][] {{ - null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000) - }, { - null, Integer.valueOf(2009), null, Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, Integer.valueOf(2559000) - }, { - null, Integer.valueOf(2009), "GB", Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", Integer.valueOf(2333000) - } - }; - compareResults(sql, expected, "00000"); - } - - - /** - * Tests an invalid GROUP BY clause that contains a GROUPING SETS operator with no columns. - * A SQLException should be thrown. - */ - public void testInvalidGS() throws SQLException { - String sql = "SELECT SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY GROUPING SETS();\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - /** - * Tests an invalid GROUP BY clause that contains a GROUPING SETS operator nested within parenthesis - * A SQLException should be thrown. - */ - public void testInvalidGS1() throws SQLException { - String sql = "SELECT COUNTRY, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY (GROUPING SETS(COUNTRY));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - - //------------------------------------------------------------ - // GROUPING OPERATOR TEST - //------------------------------------------------------------ - /** - * Tests grouping display using the GROUPING operator. - * The grouping column will return the bit mask of the columns specified - * Only 1 column is specified, so it will return 0 if the corresponding - * column is included in the grouping criteria of the grouping set for that row, - * and 1 if it is not. - * - * The ROLLUP operator acts on several column, producing four groupings: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, YEAR), (CHANNEL), () - */ - public void testAggregatedGrouping() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES), \n" + - "GROUPING(CHANNEL) AS CH, GROUPING(YEAR) as YR, GROUPING(COUNTRY) AS CO\n" + - "FROM REVENUE\n" + - "GROUP BY ROLLUP(CHANNEL,YEAR,COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - null, null, null, Integer.valueOf(4623500), 1, 1, 1 - }, { - "INTERNET", Integer.valueOf(2009), "GB", Integer.valueOf(25000), 0, 0, 0 - }, { - "INTERNET", Integer.valueOf(2009), "US", Integer.valueOf(275000), 0, 0, 0 - }, { - "INTERNET", Integer.valueOf(2010), "GB", Integer.valueOf(45000), 0, 0, 0 - }, { - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000), 0, 0, 0 - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", Integer.valueOf(162000), 0, 0, 0 - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500), 0, 0, 0 - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", Integer.valueOf(181000), 0, 0, 0 - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000), 0, 0, 0 - }, { - "INTERNET", Integer.valueOf(2009), null, Integer.valueOf(300000), 0, 0, 1 - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000), 0, 0, 1 - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500), 0, 0, 1 - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000), 0, 0, 1 - }, { - "INTERNET", null, null, Integer.valueOf(845000), 0, 1, 1 - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500), 0, 1, 1 - } - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests grouping display using the GROUPING operator with multiple parameters. - * - * The grouping column will return the bit mask of the columns specified - * Bits are assigned with the rightmost argument being the least-significant bit; - * Bits are set to 0 if the corresponding column is included in the grouping - * criteria of the grouping set for that row, and 1 if it is not. - * - * The CUBE operator acts on several column, producing four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - */ - public void testAggregatedGrouping1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES), GROUPING(CHANNEL, YEAR) " + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL,YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500), 3, - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000), 0, - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000), 0, - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500), 0, - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000), 0, - }, { - "INTERNET", null, Integer.valueOf(845000), 1, - }, { - "DIRECT SALES", null, Integer.valueOf(3778500), 1 - }, { - null, Integer.valueOf(2009), Integer.valueOf(2064500), 2, - }, { - null, Integer.valueOf(2010), Integer.valueOf(2559000), 2, - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the interaction between the GROUPING operator and the - * DECODE OPERATOR. - * - * If the row does not involve the column in the grouping set, - * it will return 'MULTI-[COLUMN]' instead of NULLs, - * else it will return the value of the column. - * - * The CUBE operator acts on several column, producing four groupings: - * (CHANNEL, COUNTRY), (CHANNEL), (COUNTRY), () - */ - public void testAggregatedDecode() throws SQLException { - String sql = "SELECT DECODE(GROUPING(CHANNEL), 1, 'MULTI-CHANNEL', CHANNEL), DECODE(GROUPING(COUNTRY), 0, COUNTRY, 'MULTI-COUNTRY'), SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - "MULTI-CHANNEL", "MULTI-COUNTRY", Integer.valueOf(4623500), - }, { - "INTERNET", "GB" , Integer.valueOf(70000), - }, { - "INTERNET", "US", Integer.valueOf(775000), - }, { - "DIRECT SALES", "GB", Integer.valueOf(343000), - }, { - "DIRECT SALES", "US", Integer.valueOf(3435500), - }, { - "INTERNET", "MULTI-COUNTRY", Integer.valueOf(845000), - }, { - "DIRECT SALES", "MULTI-COUNTRY", Integer.valueOf(3778500), - }, { - "MULTI-CHANNEL", "GB", Integer.valueOf(413000), - }, { - "MULTI-CHANNEL", "US", Integer.valueOf(4210500), - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the interaction between the GROUPING operator with multiple - * dimensions and the DECODE OPERATOR. - * - * The CUBE operator acts on several column, producing four groupings: - * (CHANNEL, COUNTRY), (CHANNEL), (COUNTRY), () - * - * () evaluates to GRAND TOTAL, (CHANNEL) evaluate to the channel used, - * (COUNTRY) evaluates to the country and (CHANNEL, COUNTRY) evaluates to NULL - */ - public void testAggregatedDecode1() throws SQLException { - String sql = "SELECT DECODE(GROUPING(CHANNEL, COUNTRY), 3, 'GRAND TOTAL', 2, COUNTRY, " + - "1, CHANNEL, 0, null), SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - "GRAND TOTAL", Integer.valueOf(4623500), - }, { - null, Integer.valueOf(70000), - }, { - null, Integer.valueOf(775000), - }, { - null, Integer.valueOf(343000), - }, { - null, Integer.valueOf(3435500), - }, { - "INTERNET", Integer.valueOf(845000), - }, { - "DIRECT SALES", Integer.valueOf(3778500), - }, { - "GB", Integer.valueOf(413000), - }, { - "US", Integer.valueOf(4210500), - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an invalid GROUP BY clause that contains - * a GROUPING operator - * - * A SQLException should be thrown. - */ - public void testInvalidGrouping() throws SQLException { - String sql = "SELECT CHANNEL, COUNTRY, SUM(SALES)\n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, GROUPING(COUNTRY));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42572"); - } - - //------------------------------------------------------------ - // COMPOSITE COLUMNS TEST - //------------------------------------------------------------ - /** - * Tests interaction of composite columns using the CUBE operator. - * - * The CUBE operator produces four groupings: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL), (YEAR, COUNTRY), () - */ - public void testAggregatedComposite() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, (YEAR, COUNTRY));\n"; - Object[][] expected = new Object[][] { - { - null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000) - }, { - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), "GB", Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", Integer.valueOf(2333000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests interaction of composite columns using the ROLLUP operator. - * - * The ROLLUP operator produces three groupings: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, YEAR), () - */ - public void testAggregatedComposite1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY ROLLUP((CHANNEL, YEAR), COUNTRY);\n"; - Object[][] expected = new Object[][] { - { - null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000) - }, { - "INTERNET", Integer.valueOf(2009), null, Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests interaction of multiple composite columns using the CUBE operator. - * - * The ROLLUP operator produces four groupings: - * (CHANNEL, YEAR, COUNTRY, PROVINCE), (CHANNEL, YEAR), (COUNTRY, PROVINCE), () - */ - public void testAggregatedComposite2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE((CHANNEL, YEAR), (COUNTRY, PROVINCE));\n"; - Object[][] expected = new Object[][] { - { - null, null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(10000) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(15000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(100000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(175000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(20000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(200000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(300000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(80000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(82000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(802500) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(800000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(90000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(91000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(900000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(933000) - }, { - "INTERNET", Integer.valueOf(2009), null, null,Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, null, Integer.valueOf(2014000) - }, { - null, null, "GB", "CAMBRIDGE", Integer.valueOf(200000) - }, { - null, null, "GB", "OXFORD", Integer.valueOf(213000) - }, { - null, null, "US", "STANFORD", Integer.valueOf(2002500) - }, { - null, null, "US", "NEW YORK", Integer.valueOf(2208000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - //------------------------------------------------------------ - // CONCATENATED GROUPINGS TEST - //------------------------------------------------------------ - /** - * Tests concatenated groupings using a column with GROUPING SETS. - * - * Two groupings should be produced: - * (CHANNEL, YEAR), (CHANNEL, COUNTRY) - */ - public void testAggregatedConcat() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CHANNEL, GROUPING SETS (YEAR, COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(2009), null, Integer.valueOf(300000), - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000), - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500), - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000), - }, { - "INTERNET", null, "GB", Integer.valueOf(70000), - }, { - "INTERNET", null, "US", Integer.valueOf(775000), - }, { - "DIRECT SALES", null, "GB", Integer.valueOf(343000), - }, { - "DIRECT SALES", null, "US", Integer.valueOf(3435500), - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests concatenated groupings using GROUPING SETS. - * - * Four groupings should be produced: - * (CHANNEL, COUNTRY), (YEAR, COUNTRY), (CHANNEL, PROVINCE), (YEAR, PROVINCE) - */ - public void testAggregatedConcat1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY GROUPING SETS (CHANNEL, YEAR), GROUPING SETS (COUNTRY, PROVINCE);\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", null, "GB" , null, Integer.valueOf(70000), - }, { - "INTERNET", null, "US" , null, Integer.valueOf(775000), - }, { - "DIRECT SALES", null, "GB" , null, Integer.valueOf(343000), - }, { - "DIRECT SALES", null, "US" , null, Integer.valueOf(3435500), - }, { - null, Integer.valueOf(2009), "GB", null, Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", null, Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", null, Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", null, Integer.valueOf(2333000) - }, { - "INTERNET", null, null, "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, null, "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, null, "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, null, "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, null, "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, null, "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, null, "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, null, "NEW YORK", Integer.valueOf(1733000) - }, { - null, Integer.valueOf(2009), null, "CAMBRIDGE", Integer.valueOf(90000) - }, { - null, Integer.valueOf(2009), null, "OXFORD", Integer.valueOf(97000) - }, { - null, Integer.valueOf(2009), null, "STANFORD", Integer.valueOf(902500) - }, { - null, Integer.valueOf(2009), null, "NEW YORK", Integer.valueOf(975000) - }, { - null, Integer.valueOf(2010), null, "CAMBRIDGE", Integer.valueOf(110000) - }, { - null, Integer.valueOf(2010), null, "OXFORD", Integer.valueOf(116000) - }, { - null, Integer.valueOf(2010), null, "STANFORD", Integer.valueOf(1100000) - }, { - null, Integer.valueOf(2010), null, "NEW YORK", Integer.valueOf(1233000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests concatenated groupings using CUBE. - * - * Four groupings should be produced: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, YEAR), (CHANNEL, COUNTRY), (CHANNEL) - */ - public void testAggregatedConcat2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CHANNEL, CUBE(YEAR, COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(2009), "GB", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000) - }, { - "INTERNET", Integer.valueOf(2009), null, Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000) - }, { - "INTERNET", null, "GB", Integer.valueOf(70000) - }, { - "INTERNET", null, "US", Integer.valueOf(775000) - }, { - "DIRECT SALES", null, "GB", Integer.valueOf(343000) - }, { - "DIRECT SALES", null, "US", Integer.valueOf(3435500) - }, { - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - } - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests concatenated groupings using CUBE and GROUPING SETS. - * - * Eight groupings should be produced: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, COUNTRY), (YEAR, COUNTRY), (COUNTRY), - * (CHANNEL, YEAR, PROVINCE), (CHANNEL, PROVINCE), (YEAR, PROVINCE), (PROVINCE) - */ - public void testAggregatedConcat3() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR), GROUPING SETS(COUNTRY, PROVINCE);\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(2009), "GB", null, Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", null, Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", null, Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", null, Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", null, Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", null, Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", null, Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", null, Integer.valueOf(1833000) - }, { - "INTERNET", null, "GB" , null, Integer.valueOf(70000), - }, { - "INTERNET", null, "US" , null, Integer.valueOf(775000), - }, { - "DIRECT SALES", null, "GB" , null, Integer.valueOf(343000), - }, { - "DIRECT SALES", null, "US" , null, Integer.valueOf(3435500), - }, { - null, Integer.valueOf(2009), "GB", null, Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", null, Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", null, Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", null, Integer.valueOf(2333000) - }, { - null, null, "GB", null, Integer.valueOf(413000) - }, { - null, null, "US", null, Integer.valueOf(4210500) - }, { - "INTERNET", Integer.valueOf(2009), null, "CAMBRIDGE", Integer.valueOf(10000) - }, { - "INTERNET", Integer.valueOf(2009), null, "OXFORD", Integer.valueOf(15000) - }, { - "INTERNET", Integer.valueOf(2009), null, "STANFORD", Integer.valueOf(100000) - }, { - "INTERNET", Integer.valueOf(2009), null, "NEW YORK", Integer.valueOf(175000) - }, { - "INTERNET", Integer.valueOf(2010), null, "CAMBRIDGE", Integer.valueOf(20000) - }, { - "INTERNET", Integer.valueOf(2010), null, "OXFORD", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2010), null, "STANFORD", Integer.valueOf(200000) - }, { - "INTERNET", Integer.valueOf(2010), null, "NEW YORK", Integer.valueOf(300000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, "CAMBRIDGE", Integer.valueOf(80000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, "OXFORD", Integer.valueOf(82000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, "STANFORD", Integer.valueOf(802500) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, "NEW YORK", Integer.valueOf(800000) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, "CAMBRIDGE", Integer.valueOf(90000) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, "OXFORD", Integer.valueOf(91000) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, "STANFORD", Integer.valueOf(900000) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, "NEW YORK", Integer.valueOf(933000) - }, { - "INTERNET", null, null, "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, null, "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, null, "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, null, "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, null, "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, null, "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, null, "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, null, "NEW YORK", Integer.valueOf(1733000) - }, { - null, Integer.valueOf(2009), null, "CAMBRIDGE", Integer.valueOf(90000) - }, { - null, Integer.valueOf(2009), null, "OXFORD", Integer.valueOf(97000) - }, { - null, Integer.valueOf(2009), null, "STANFORD", Integer.valueOf(902500) - }, { - null, Integer.valueOf(2009), null, "NEW YORK", Integer.valueOf(975000) - }, { - null, Integer.valueOf(2010), null, "CAMBRIDGE", Integer.valueOf(110000) - }, { - null, Integer.valueOf(2010), null, "OXFORD", Integer.valueOf(116000) - }, { - null, Integer.valueOf(2010), null, "STANFORD", Integer.valueOf(1100000) - }, { - null, Integer.valueOf(2010), null, "NEW YORK", Integer.valueOf(1233000) - }, { - null, null, null, "CAMBRIDGE", Integer.valueOf(200000) - }, { - null, null, null, "OXFORD", Integer.valueOf(213000) - }, { - null, null, null, "STANFORD", Integer.valueOf(2002500) - }, { - null, null, null, "NEW YORK", Integer.valueOf(2208000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests concatenated groupings using GROUPING SETS and ROLLUP. - * - * Six groupings should be produced: - * (CHANNEL, COUNTRY, PROVINCE), (YEAR, COUNTRY, PROVINCE), - * (CHANNEL, COUNTRY), (YEAR, COUNTRY), - * (CHANNEL),(YEAR) - */ - public void testAggregatedConcat4() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY GROUPING SETS(CHANNEL, YEAR), ROLLUP(COUNTRY, PROVINCE);\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", null, "GB", "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, "GB", "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, "US", "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, "US", "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, "GB", "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, "GB", "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, "US", "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, "US", "NEW YORK", Integer.valueOf(1733000) - }, { - null, Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(90000) - }, { - null, Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(97000) - }, { - null, Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(902500) - }, { - null, Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(975000) - }, { - null, Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(110000) - }, { - null, Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(116000) - }, { - null, Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(1100000) - }, { - null, Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(1233000) - }, { - "INTERNET", null, "GB" , null, Integer.valueOf(70000), - }, { - "INTERNET", null, "US" , null, Integer.valueOf(775000), - }, { - "DIRECT SALES", null, "GB" , null, Integer.valueOf(343000), - }, { - "DIRECT SALES", null, "US" , null, Integer.valueOf(3435500), - }, { - null, Integer.valueOf(2009), "GB", null, Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", null, Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", null, Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", null, Integer.valueOf(2333000) - }, { - "INTERNET", null, null, null,Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), null, null,Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, null, Integer.valueOf(2559000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests concatenated groupings using CUBE and ROLLUP. - * - * Twelve groupings should be produced: - * (CHANNEL, YEAR, COUNTRY, PROVINCE), (CHANNEL, COUNTRY, PROVINCE), (YEAR, COUNTRY, PROVINCE), (COUNTRY, PROVINCE), - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, COUNTRY), (YEAR, COUNTRY), (COUNTRY), - * (CHANNEL, YEAR), (CHANNEL), (YEAR), (), - */ - public void testAggregatedConcat5() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR), ROLLUP(COUNTRY, PROVINCE);\n"; - Object[][] expected = new Object[][] {{ - null, null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(10000) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(15000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(100000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(175000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(20000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(200000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(300000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(80000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(82000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(802500) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(800000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(90000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(91000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(900000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(933000) - }, { - "INTERNET", null, "GB", "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, "GB", "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, "US", "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, "US", "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, "GB", "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, "GB", "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, "US", "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, "US", "NEW YORK", Integer.valueOf(1733000) - }, { - null, Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(90000) - }, { - null, Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(97000) - }, { - null, Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(902500) - }, { - null, Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(975000) - }, { - null, Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(110000) - }, { - null, Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(116000) - }, { - null, Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(1100000) - }, { - null, Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(1233000) - }, { - null, null, "GB", "CAMBRIDGE", Integer.valueOf(200000) - }, { - null, null, "GB", "OXFORD", Integer.valueOf(213000) - }, { - null, null, "US", "STANFORD", Integer.valueOf(2002500) - }, { - null, null, "US", "NEW YORK", Integer.valueOf(2208000) - }, { - "INTERNET", Integer.valueOf(2009), "GB", null, Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2009), "US", null, Integer.valueOf(275000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", null, Integer.valueOf(45000) - }, { - "INTERNET", Integer.valueOf(2010), "US", null, Integer.valueOf(500000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", null, Integer.valueOf(162000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", null, Integer.valueOf(1602500) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", null, Integer.valueOf(181000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", null, Integer.valueOf(1833000) - }, { - "INTERNET", null, "GB" , null, Integer.valueOf(70000), - }, { - "INTERNET", null, "US" , null, Integer.valueOf(775000), - }, { - "DIRECT SALES", null, "GB" , null, Integer.valueOf(343000), - }, { - "DIRECT SALES", null, "US" , null, Integer.valueOf(3435500), - }, { - null, Integer.valueOf(2009), "GB", null, Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", null, Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", null, Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", null, Integer.valueOf(2333000) - }, { - null, null, "GB", null, Integer.valueOf(413000) - }, { - null, null, "US", null, Integer.valueOf(4210500) - }, { - "INTERNET", Integer.valueOf(2009), null, null,Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, null, Integer.valueOf(2014000) - }, { - "INTERNET", null, null, null,Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), null, null,Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, null, Integer.valueOf(2559000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - //------------------------------------------------------------ - // NESTED GROUPING TEST - //------------------------------------------------------------ - - /** - * Tests nested groupings using GROUPING SETS within GROUPING SETS. - * - * Three groupings should be produced: - * (CHANNEL), (YEAR), (COUNTRY) - */ - public void testAggregatedNest() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY GROUPING SETS(CHANNEL, GROUPING SETS (YEAR, COUNTRY));\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), null, Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, Integer.valueOf(2559000) - }, { - null, null, "GB", Integer.valueOf(413000), - }, { - null, null, "US", Integer.valueOf(4210500), - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests nested groupings using CUBE within GROUPING SETS. - * - * Five groupings should be produced: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), (), (COUNTRY) - */ - public void testAggregatedNest1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY GROUPING SETS(CUBE(CHANNEL, YEAR), COUNTRY);\n"; - Object[][] expected = new Object[][] {{ - null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), null, Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000) - }, { - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), null, Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, Integer.valueOf(2559000) - }, { - null, null, "GB", Integer.valueOf(413000) - }, { - null, null, "US", Integer.valueOf(4210500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests nested groupings using ROLLUP within GROUPING SETS. - * - * Four groupings should be produced: - * (CHANNEL), (YEAR, COUNTRY), (YEAR), () - */ - public void testAggregatedNest2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY GROUPING SETS(CHANNEL, ROLLUP(YEAR, COUNTRY));\n"; - Object[][] expected = new Object[][] {{ - null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), "GB", Integer.valueOf(187000) - }, { - null, Integer.valueOf(2009), "US", Integer.valueOf(1877500) - }, { - null, Integer.valueOf(2010), "GB", Integer.valueOf(226000) - }, { - null, Integer.valueOf(2010), "US", Integer.valueOf(2333000) - }, { - null, Integer.valueOf(2009), null, Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), null, Integer.valueOf(2559000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests nested groupings using multiple ROLLUP within GROUPING SETS. - * - * Six groupings should be produced: - * (CHANNEL, YEAR), (CHANNEL), (), (COUNTRY, PROVINCE), (COUNTRY), () - */ - public void testAggregatedNest3() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY GROUPING SETS(ROLLUP(CHANNEL, YEAR), ROLLUP(COUNTRY, PROVINCE));\n"; - Object[][] expected = new Object[][] {{ - null, null, null, null, Integer.valueOf(4623500) - }, { - null, null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), null, null, Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, null, Integer.valueOf(2014000) - }, { - "INTERNET", null, null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, null, Integer.valueOf(3778500) - }, { - null, null, "GB", "CAMBRIDGE", Integer.valueOf(200000) - }, { - null, null, "GB", "OXFORD", Integer.valueOf(213000) - }, { - null, null, "US", "STANFORD", Integer.valueOf(2002500) - }, { - null, null, "US", "NEW YORK", Integer.valueOf(2208000) - }, { - null, null, "GB", null, Integer.valueOf(413000) - }, { - null, null, "US", null, Integer.valueOf(4210500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests DISTINCT nested groupings using multiple ROLLUP within GROUPING SETS. - * - * Six groupings should be produced: - * (CHANNEL, YEAR), (CHANNEL), (), (COUNTRY, PROVINCE), (COUNTRY), () - * - * The second empty grouping is eliminated - */ - public void testDistinctAggregatedNest3() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY DISTINCT GROUPING SETS(ROLLUP(CHANNEL, YEAR), ROLLUP(COUNTRY, PROVINCE));\n"; - Object[][] expected = new Object[][] {{ - null, null, null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), null, null, Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, null, Integer.valueOf(2014000) - }, { - "INTERNET", null, null, null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, null, Integer.valueOf(3778500) - }, { - null, null, "GB", "CAMBRIDGE", Integer.valueOf(200000) - }, { - null, null, "GB", "OXFORD", Integer.valueOf(213000) - }, { - null, null, "US", "STANFORD", Integer.valueOf(2002500) - }, { - null, null, "US", "NEW YORK", Integer.valueOf(2208000) - }, { - null, null, "GB", null, Integer.valueOf(413000) - }, { - null, null, "US", null, Integer.valueOf(4210500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an invalid GROUP BY clause that contains - * nested ROLLUP within CUBE - * - * A SQLException should be thrown. - */ - public void testInvalidNesting() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY CUBE(CHANNEL, ROLLUP(YEAR));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - /** - * Tests an invalid GROUP BY clause that contains - * nested CUBE within CUBE - * - * A SQLException should be thrown. - */ - public void testInvalidNesting1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY CUBE(CHANNEL, CUBE(YEAR));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - /** - * Tests an invalid GROUP BY clause that contains - * nested GROUPING SETS within CUBE - * - * A SQLException should be thrown. - */ - public void testInvalidNesting2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY CUBE(GROUPING SETS(CHANNEL), YEAR);\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - /** - * Tests an invalid GROUP BY clause that contains - * nested ROLLUP within ROLLUP - * - * A SQLException should be thrown. - */ - public void testInvalidNesting3() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CHANNEL, ROLLUP(YEAR));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - /** - * Tests an invalid GROUP BY clause that contains - * nested CUBE within ROLLUP - * - * A SQLException should be thrown. - */ - public void testInvalidNesting4() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CUBE(CHANNEL), YEAR);\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - - /** - * Tests an invalid GROUP BY clause that contains - * nested GROUPING SETS within ROLLUP - * - * A SQLException should be thrown. - */ - public void testInvalidNesting5() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CHANNEL, GROUPING SETS(YEAR));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42581"); - } - //------------------------------------------------------------ - // WHERE CLAUSE TEST - //------------------------------------------------------------ - /** - * Tests WHERE clause with text fields. - * - * Rows with {@code COUNTRY <> 'GB'} will be removed before grouping occurs - * - * CUBE will produce four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - */ - public void testAggregatedWhere() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "WHERE COUNTRY = 'GB'\n" + - "GROUP BY CUBE(CHANNEL, YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(413000), - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(25000), - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(45000), - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(162000), - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(181000), - }, { - "INTERNET", null, Integer.valueOf(70000), - }, { - "DIRECT SALES", null, Integer.valueOf(343000), - }, { - null, Integer.valueOf(2009), Integer.valueOf(187000), - }, { - null, Integer.valueOf(2010), Integer.valueOf(226000), - } - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests WHERE clause with numerical fields. - * - * Rows with {@code SALES <= 20000} will be removed before grouping occurs - * - * ROLLUP will produce three groupings: - * (CHANNEL, YEAR), (CHANNEL), () - */ - public void testAggregatedWhere1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "WHERE SALES > 20000\n" + - "GROUP BY ROLLUP(CHANNEL, YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4578500), - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(275000), - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(525000), - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500), - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000), - }, { - "INTERNET", null, Integer.valueOf(800000), - }, { - "DIRECT SALES", null, Integer.valueOf(3778500), - } - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests WHERE clause with multiple fields. - * - * Rows with {@code COUNTRY <> 'US' or YEAR = 2009} will be removed before grouping occurs - * - * CUBE will produce four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - */ - public void testAggregatedWhere2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "WHERE COUNTRY = 'US' AND YEAR <> 2009\n" + - "GROUP BY CUBE(CHANNEL, YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(2333000), - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(500000), - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(1833000), - }, { - "INTERNET", null, Integer.valueOf(500000), - }, { - "DIRECT SALES", null, Integer.valueOf(1833000), - }, { - null, Integer.valueOf(2010), Integer.valueOf(2333000), - } - }; - - compareResults(sql, expected, "00000"); - } - - //------------------------------------------------------------ - // HAVING CLAUSE TEST - //------------------------------------------------------------ - - /** - * Tests HAVING clause with aggregated column and multiple - * HAVING conditions - * - * ROLLUP will produce four groupings: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, YEAR), (CHANNEL), () - * which are then filtered by the HAVING condition - */ - public void testAggregatedHaving() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY ROLLUP(CHANNEL,YEAR,COUNTRY) \n" + - "HAVING SUM(SALES) >= 500000 AND SUM(SALES) < 2000000;\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(2010), "US", Integer.valueOf(500000), - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", Integer.valueOf(1602500), - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000), - }, { - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000), - }, { - "DIRECT SALES", Integer.valueOf(2009), null, Integer.valueOf(1764500), - }, { - "INTERNET", null, null, Integer.valueOf(845000), - } - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests HAVING clause with numerical column - * - * CUBE will produce four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - * which are then filtered by the HAVING condition - */ - public void testAggregatedHaving1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR)\n" + - "HAVING MIN(YEAR) <> 2010;\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), Integer.valueOf(2064500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests HAVING clause with text column - * - * CUBE will produce four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - * which are then filtered by the HAVING condition - */ - public void testAggregatedHaving2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR)\n" + - "HAVING MIN(CHANNEL) = 'INTERNET';\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - //------------------------------------------------------------ - // ORDER BY CLAUSE TEST - //------------------------------------------------------------ - - /** - * Tests ORDER BY clause - * - * CUBE will produce four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR),() - */ - public void testAggregatedOrder() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR)\n" + - "ORDER BY SALES;\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000), - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000), - }, { - "INTERNET", null, Integer.valueOf(845000), - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500), - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000), - }, { - null, Integer.valueOf(2009), Integer.valueOf(2064500), - }, { - null, Integer.valueOf(2010), Integer.valueOf(2559000), - }, { - "DIRECT SALES", null, Integer.valueOf(3778500), - }, { - null, null, Integer.valueOf(4623500), - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests ORDER BY clause by descending order - * - * CUBE will produce four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR),() - */ - public void testAggregatedOrder1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR)\n" + - "ORDER BY SALES DESC;\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500), - }, { - "DIRECT SALES", null, Integer.valueOf(3778500), - }, { - null, Integer.valueOf(2010), Integer.valueOf(2559000), - }, { - null, Integer.valueOf(2009), Integer.valueOf(2064500), - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000), - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500), - }, { - "INTERNET", null, Integer.valueOf(845000), - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000), - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000), - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests ORDER BY clause with multiple columns - * - * CUBE will produce four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR),() - */ - public void testAggregatedOrder2() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR)\n" + - "ORDER BY YEAR DESC, SALES ASC;\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", null, Integer.valueOf(845000), - }, { - "DIRECT SALES", null, Integer.valueOf(3778500), - }, { - null, null, Integer.valueOf(4623500), - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000), - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000), - }, { - null, Integer.valueOf(2010), Integer.valueOf(2559000), - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000), - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500), - }, { - null, Integer.valueOf(2009), Integer.valueOf(2064500), - }, - }; - - compareResults(sql, expected, "00000"); - } - - //------------------------------------------------------------ - // Miscellaneous columns TEST - //------------------------------------------------------------ - - /** - * Tests the interaction with renamed columns with - * aggregated selection using the CUBE operator with a GROUP_BY clause. - * The CUBE operator produces four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - */ - public void testAggregatedRename() throws SQLException { - String sql = "SELECT CHANNEL as ROUTES, YEAR, SUM(SALES) as SALES\n" + - "FROM REVENUE \n" + - "GROUP BY CUBE(CHANNEL, YEAR)\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, Integer.valueOf(3778500) - }, { - null, Integer.valueOf(2009), Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), Integer.valueOf(2559000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the interaction with renamed columns with - * aggregated selection using the ROLLUP operator with a GROUP_BY clause. - * The CUBE operates on renamed columns - * - * The CUBE operator produces four groupings: - * (CHANNEL, YEAR), (CHANNEL), () - */ - public void testAggregatedRename1() throws SQLException { - String sql = "SELECT CHANNEL as ROUTES, YEAR as CALENDAR, SUM(SALES) as SALES\n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CHANNEL, CALENDAR)\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the CUBE operator with a GROUP_BY clause. - * The order of columns is changed. - * - * The CUBE operator produces four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR),() - */ - public void testAggregatedReorder() throws SQLException { - String sql = "SELECT YEAR, SUM(SALES) as SALES, CHANNEL\n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, Integer.valueOf(4623500), null - }, { - Integer.valueOf(2009), Integer.valueOf(300000), "INTERNET" - }, { - Integer.valueOf(2010), Integer.valueOf(545000), "INTERNET" - }, { - Integer.valueOf(2009), Integer.valueOf(1764500), "DIRECT SALES" - }, { - Integer.valueOf(2010), Integer.valueOf(2014000), "DIRECT SALES" - }, { - null, Integer.valueOf(845000), "INTERNET" - }, { - null, Integer.valueOf(3778500), "DIRECT SALES" - }, { - Integer.valueOf(2009), Integer.valueOf(2064500), null - }, { - Integer.valueOf(2010), Integer.valueOf(2559000), null - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the CUBE operator with a GROUP_BY clause. - * The order of columns in CUBE is changed. - * - * The CUBE operator produces four groupings: - * (YEAR, CHANNEL), (YEAR), (CHANNEL), () - */ - public void testAggregatedReorder1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, SUM(SALES) as SALES\n" + - "FROM REVENUE \n" + - "GROUP BY CUBE(YEAR, CHANNEL)\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000) - }, { - null, Integer.valueOf(2009), Integer.valueOf(2064500) - }, { - null, Integer.valueOf(2010), Integer.valueOf(2559000) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the ROLLUP operator with a GROUP_BY clause. - * The order of columns in ROLLUP is changed and renamed. - * - * The ROLLUP operator produces four groupings: - * (YEAR, CHANNEL), (YEAR), () - */ - public void testAggregatedReorder2() throws SQLException { - String sql = "SELECT CHANNEL as ROUTES, SUM(SALES) as SALES, YEAR AS CALENDAR\n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CALENDAR, ROUTES)\n"; - Object[][] expected = new Object[][] {{ - null, Integer.valueOf(4623500), null - }, { - "INTERNET", Integer.valueOf(300000), Integer.valueOf(2009) - }, { - "INTERNET", Integer.valueOf(545000), Integer.valueOf(2010) - }, { - "DIRECT SALES", Integer.valueOf(1764500), Integer.valueOf(2009) - }, { - "DIRECT SALES", Integer.valueOf(2014000), Integer.valueOf(2010) - }, { - null, Integer.valueOf(2064500), Integer.valueOf(2009) - }, { - null, Integer.valueOf(2559000), Integer.valueOf(2010) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection using the GROUPING SETS operator - * with a GROUP_BY clause. - * - * Not all columns involved in GROUP BY are displayed - */ - public void testAggregatedMissingColumns() throws SQLException { - String sql = "SELECT CHANNEL, COUNTRY, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY GROUPING SETS((), (CHANNEL), (YEAR, COUNTRY))\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, Integer.valueOf(3778500) - }, { - null, "GB", Integer.valueOf(187000) - }, { - null, "US", Integer.valueOf(1877500) - }, { - null, "GB", Integer.valueOf(226000) - }, { - null, "US", Integer.valueOf(2333000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection with repeated columns using - * the ROLLUP operator with a GROUP_BY clause. - * - * The ROLLUP operator produces five groupings: - * (CHANNEL, YEAR), (CHANNEL, YEAR),(CHANNEL, YEAR),(CHANNEL), () - */ - public void testAggregatedRepeatedColumns() throws SQLException { - String sql = "SELECT CHANNEL as ROUTES, YEAR as CALENDAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY ROLLUP(CHANNEL, YEAR, ROUTES, YEAR)\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection with repeated columns using - * the ROLLUP operator with a GROUP_BY clause. - * - * The ROLLUP operator produces five groupings: - * (CHANNEL, YEAR), (CHANNEL, YEAR),(CHANNEL, YEAR),(CHANNEL), () - * - * The duplicate (CHANNEL, YEAR) groupings are eliminated. - */ - public void testDistinctAggregatedRepeatedColumns() throws SQLException { - String sql = "SELECT CHANNEL as ROUTES, YEAR as CALENDAR, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY DISTINCT ROLLUP(CHANNEL, YEAR, ROUTES, YEAR)\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(4623500) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(2014000) - }, { - "INTERNET", null, Integer.valueOf(845000) - }, { - "DIRECT SALES", null, Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an invalid SELECT statement that contains - * columns not in the GROUP BY clause - * - * A SQLException should be thrown. - */ - public void testInvalidMissingColumns() throws SQLException { - String sql = "SELECT CHANNEL, COUNTRY, SUM(SALES)\n" + - "FROM REVENUE \n" + - "GROUP BY GROUPING SETS(COUNTRY)\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42574"); - } - - //------------------------------------------------------------ - // Aggregate Functions TEST - //------------------------------------------------------------ - - /** - * Tests the data-cube with the MIN aggregate function - * - * The CUBE operator produces four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - */ - public void testAggregatedMin() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, MIN(SALES) as SALES \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(10000) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(10000) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(20000) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(80000) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(90000) - }, { - "INTERNET", null, Integer.valueOf(10000) - }, { - "DIRECT SALES", null, Integer.valueOf(80000) - }, { - null, Integer.valueOf(2009), Integer.valueOf(10000) - }, { - null, Integer.valueOf(2010), Integer.valueOf(20000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the data-cube with the COUNT aggregate function - * - * The CUBE operator produces four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - */ - public void testAggregatedCount() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNT(*) \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, null, Integer.valueOf(16) - }, { - "INTERNET", Integer.valueOf(2009), Integer.valueOf(4) - }, { - "INTERNET", Integer.valueOf(2010), Integer.valueOf(4) - }, { - "DIRECT SALES", Integer.valueOf(2009), Integer.valueOf(4) - }, { - "DIRECT SALES", Integer.valueOf(2010), Integer.valueOf(4) - }, { - "INTERNET", null, Integer.valueOf(8) - }, { - "DIRECT SALES", null, Integer.valueOf(8) - }, { - null, Integer.valueOf(2009), Integer.valueOf(8) - }, { - null, Integer.valueOf(2010), Integer.valueOf(8) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the data-cube with multiple aggregate function (AVG, VAR, STDEV) - * - * The CUBE operator produces two groupings: - * (CHANNEL), () - */ - public void testAggregatedAvg() throws SQLException { - String sql = "SELECT CHANNEL, AVG(SALES), VAR_SAMP(SALES), STDDEV_SAMP(SALES), VAR_POP (SALES), STDDEV_POP(SALES)\n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL);\n"; - Object[][] expected = new Object[][] {{ - null, Integer.valueOf(288968), 1.21995215625E11, Integer.valueOf(349278), 1.143705146484375E11, 338187 - }, { - "INTERNET", Integer.valueOf(105625), 1.1817410714285715E10, Integer.valueOf(108707), 1.0340234375E10, 101686 - }, { - "DIRECT SALES", Integer.valueOf(472312), 1.7276678125E11, Integer.valueOf(415652), 1.5117093359375E11, 388807 - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the data-cube without an aggregate function - * - * The CUBE operator produces four groupings: - * (CHANNEL, YEAR), (CHANNEL), (YEAR), () - */ - public void testAggregatedMissing() throws SQLException { - String sql = "SELECT CHANNEL, YEAR \n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, YEAR);\n"; - Object[][] expected = new Object[][] {{ - null, null - }, { - "INTERNET", Integer.valueOf(2009) - }, { - "INTERNET", Integer.valueOf(2010) - }, { - "DIRECT SALES", Integer.valueOf(2009) - }, { - "DIRECT SALES", Integer.valueOf(2010) - }, { - "INTERNET", null - }, { - "DIRECT SALES", null - }, { - null, Integer.valueOf(2009) - }, { - null, Integer.valueOf(2010) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an invalid GROUP BY clause that contains - * an aggregate function - * - * A SQLException should be thrown. - */ - public void testInvalidAggregate() throws SQLException { - String sql = "SELECT CHANNEL, COUNTRY, SUM(SALES)\n" + - "FROM REVENUE\n" + - "GROUP BY CUBE(CHANNEL, MIN(COUNTRY));\n"; - Object[][] expected = new Object[][]{}; - compareResults(sql, expected, "42572"); - } - - //------------------------------------------------------------ - // Functions in GROUP BY TEST - //------------------------------------------------------------ - - /** - * Tests the interaction of functions within the GROUP BY clause - * and datacube operators. - */ - public void testFunctionGroupBy() throws SQLException { - String sql = "SELECT CASE WHEN A.SEL=1 THEN A.NAME2 ELSE A.NAME1 END AS NAME,\n" + - " COUNT(A.NAME1) AS COUNTER FROM TEST A \n" + - " GROUP BY CUBE(CASE WHEN A.SEL=1 THEN A.NAME2 ELSE A.NAME1 END, A.SEL);\n"; - Object[][] expected = new Object[][]{{ - null, 3 - }, { - "FOO", 1 - }, { - "FOO", 1 - }, { - "QUX", 1 - }, { - "FOO", 2 - }, { - "QUX", 1 - }, { - null, 1 - }, { - null, 2 - }}; - compareResults(sql, expected, "00000"); - } - - public void testFunctionGroupBy1() throws SQLException { - String sql = "SELECT CASE WHEN A.SEL=1 THEN A.NAME2 ELSE A.NAME1 END AS NAME,\n" + - " COUNT(A.NAME1) AS COUNTER FROM TEST A \n" + - " GROUP BY ROLLUP(CASE WHEN A.SEL=1 THEN A.NAME2 ELSE A.NAME1 END);\n"; - Object[][] expected = new Object[][]{{ - null, 3 - }, { - "FOO", 2 - }, { - "QUX", 1 - }}; - compareResults(sql, expected, "00000"); - } - - public void testFunctionGroupBy2() throws SQLException { - String sql = "SELECT CASE WHEN A.SEL=1 THEN A.NAME2 ELSE A.NAME1 END AS NAME,\n" + - " COUNT(A.NAME1) AS COUNTER FROM TEST A \n" + - " GROUP BY GROUPING SETS(CASE WHEN A.SEL=1 THEN A.NAME2 ELSE A.NAME1 END, A.SEL);\n"; - Object[][] expected = new Object[][]{{ - "FOO", 2 - }, { - "QUX", 1 - }, { - null, 1 - }, { - null, 2 - }}; - compareResults(sql, expected, "00000"); - } - - public void testFunctionGroupBy3() throws SQLException { - String sql = "SELECT A.SEL, COALESCE(A.NAME1, A.NAME2) AS NAME,\n" + - "COUNT(A.SEL) AS COUNTER FROM TEST A \n" + - "GROUP BY CUBE(COALESCE(A.NAME1, A.NAME2), A.SEL);\n"; - Object[][] expected = new Object[][]{{ - null, null, 3 - }, { - 0, "FOO", 1 - }, { - 1, "BAZ", 1 - }, { - 1, "FOO", 1 - }, { - null, "FOO", 2 - }, { - null, "BAZ", 1 - }, { - 0, null, 1 - }, { - 1, null, 2 - }}; - compareResults(sql, expected, "00000"); - } - - //------------------------------------------------------------ - // Complex Query TEST - //------------------------------------------------------------ - - /** - * Tests the interaction of multiple features - * Concatenated grouping, nesting and composite columns - * - * Produces seven groupings: - * (CHANNEL, COUNTRY, PROVINCE), (CHANNEL, COUNTRY), (CHANNEL, PROVINCE), (CHANNEL) - * (CHANNEL, YEAR, COUNTRY, PROVINCE), (CHANNEL, YEAR), (CHANNEL) - */ - public void testAggregatedComplex() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY CHANNEL, GROUPING SETS(CUBE(COUNTRY, PROVINCE), ROLLUP(YEAR, (COUNTRY, PROVINCE)));\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", null, "GB", "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, "GB", "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, "US", "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, "US", "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, "GB", "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, "GB", "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, "US", "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, "US", "NEW YORK", Integer.valueOf(1733000) - }, { - "INTERNET", null, "GB" , null, Integer.valueOf(70000), - }, { - "INTERNET", null, "US" , null, Integer.valueOf(775000), - }, { - "DIRECT SALES", null, "GB" , null, Integer.valueOf(343000), - }, { - "DIRECT SALES", null, "US" , null, Integer.valueOf(3435500), - }, { - "INTERNET", null, null, "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, null, "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, null, "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, null, "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, null, "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, null, "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, null, "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, null, "NEW YORK", Integer.valueOf(1733000) - }, { - "INTERNET", null, null, null,Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, null, Integer.valueOf(3778500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(10000) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(15000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(100000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(175000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(20000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(200000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(300000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(80000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(82000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(802500) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(800000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(90000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(91000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(900000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(933000) - }, { - "INTERNET", Integer.valueOf(2009), null, null,Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, null, Integer.valueOf(2014000) - }, { - "INTERNET", null, null, null,Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, null, Integer.valueOf(3778500) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the interaction of multiple features - * Concatenated grouping, nesting and composite columns - * - * Produces seven groupings: - * (CHANNEL, COUNTRY, PROVINCE), (CHANNEL, COUNTRY), (CHANNEL, PROVINCE), (CHANNEL) - * (CHANNEL, YEAR, COUNTRY, PROVINCE), (CHANNEL, YEAR), (CHANNEL) - * - * The duplicate are eliminated - */ - public void testDistinctAggregatedComplex() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, PROVINCE, SUM(SALES) \n" + - "FROM REVENUE\n" + - "GROUP BY DISTINCT CHANNEL, GROUPING SETS(CUBE(COUNTRY, PROVINCE), ROLLUP(YEAR, (COUNTRY, PROVINCE)));\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", null, "GB", "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, "GB", "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, "US", "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, "US", "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, "GB", "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, "GB", "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, "US", "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, "US", "NEW YORK", Integer.valueOf(1733000) - }, { - "INTERNET", null, "GB" , null, Integer.valueOf(70000), - }, { - "INTERNET", null, "US" , null, Integer.valueOf(775000), - }, { - "DIRECT SALES", null, "GB" , null, Integer.valueOf(343000), - }, { - "DIRECT SALES", null, "US" , null, Integer.valueOf(3435500), - }, { - "INTERNET", null, null, "CAMBRIDGE", Integer.valueOf(30000) - }, { - "INTERNET", null, null, "OXFORD", Integer.valueOf(40000) - }, { - "INTERNET", null, null, "STANFORD", Integer.valueOf(300000) - }, { - "INTERNET", null, null, "NEW YORK", Integer.valueOf(475000) - }, { - "DIRECT SALES", null, null, "CAMBRIDGE", Integer.valueOf(170000) - }, { - "DIRECT SALES", null, null, "OXFORD", Integer.valueOf(173000) - }, { - "DIRECT SALES", null, null, "STANFORD", Integer.valueOf(1702500) - }, { - "DIRECT SALES", null, null, "NEW YORK", Integer.valueOf(1733000) - }, { - "INTERNET", null, null, null,Integer.valueOf(845000) - }, { - "DIRECT SALES", null, null, null, Integer.valueOf(3778500) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(10000) - }, { - "INTERNET", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(15000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(100000) - }, { - "INTERNET", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(175000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(20000) - }, { - "INTERNET", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(25000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(200000) - }, { - "INTERNET", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(300000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "CAMBRIDGE", Integer.valueOf(80000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "GB", "OXFORD", Integer.valueOf(82000) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "STANFORD", Integer.valueOf(802500) - }, { - "DIRECT SALES", Integer.valueOf(2009), "US", "NEW YORK", Integer.valueOf(800000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "CAMBRIDGE", Integer.valueOf(90000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "GB", "OXFORD", Integer.valueOf(91000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "STANFORD", Integer.valueOf(900000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", "NEW YORK", Integer.valueOf(933000) - }, { - "INTERNET", Integer.valueOf(2009), null, null,Integer.valueOf(300000) - }, { - "INTERNET", Integer.valueOf(2010), null, null, Integer.valueOf(545000) - }, { - "DIRECT SALES", Integer.valueOf(2009), null, null, Integer.valueOf(1764500) - }, { - "DIRECT SALES", Integer.valueOf(2010), null, null, Integer.valueOf(2014000) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests the data-cube operators acting on values from multiple tables - * with all the other clauses - * - * Produces Eight groupings: - * (CHANNEL, YEAR, COUNTRY), (CHANNEL, YEAR), (CHANNEL, COUNTRY), (CHANNEL) - * (YEAR, COUNTRY), (YEAR), (COUNTRY), () - */ - public void testAggregatedComplex1() throws SQLException { - String sql = "SELECT CHANNEL, YEAR, COUNTRY, SUM(SALES), SUM(LOSSES)\n" + - "FROM REVENUE\n" + - "LEFT JOIN LIABILITY ON REVENUE.CHANNEL = LIABILITY.CHANNEL and REVENUE.YEAR = LIABILITY.YEAR and\n" + - "REVENUE.COUNTRY = LIABILITY.COUNTRY\n" + - "WHERE YEAR = '2010'\n" + - "GROUP BY CUBE(CHANNEL, YEAR, COUNTRY) \n" + - "HAVING SUM(SALES) > 500000 \n" + - "ORDER BY SUM(SALES)\n" + - "LIMIT 5;\n"; - Object[][] expected = new Object[][] {{ - "INTERNET", Integer.valueOf(2010), null, Integer.valueOf(545000), Integer.valueOf(14000) - }, { - "INTERNET", null, null, Integer.valueOf(545000), Integer.valueOf(14000) - }, { - "DIRECT SALES", Integer.valueOf(2010), "US", Integer.valueOf(1833000), null - }, { - "DIRECT SALES", null, "US", Integer.valueOf(1833000), null - }, { - "DIRECT SALES", Integer.valueOf(2010), null, Integer.valueOf(2014000), null - }, - }; - - compareResults(sql, expected, "00000"); - } - - //------------------------------------------------------------ - // Helper methods - //------------------------------------------------------------ - private void compareResults(String sql, Object[][] rows, - String sqlState) throws SQLException { - - ResultSet rs = null; - - try { - rs = stmt.executeQuery(sql); - - assertTrue("Statement <" + sql + "> \nexpecting error code: " - + sqlState, ("00000".equals(sqlState))); - } catch (SQLException sqlx) { - if (!sqlx.getSQLState().equals(sqlState)) { - sqlx.printStackTrace(); - } - - // compare and report SqlState, rather then ErrorCode - assertTrue("Statement <" + sql + "> \nthrows wrong error code: " - + sqlx.getSQLState() + " expecting error code: " - + sqlState, (sqlx.getSQLState().equals(sqlState))); - - return; - } - - int rowCount = 0; - int colCount = rows.length > 0 ? rows[0].length - : 0; - - while (rs.next()) { - assertTrue("Statement <" + sql + "> \nreturned too many rows.", - (rowCount < rows.length)); - - Object[] columns = rows[rowCount]; - - for (int col = 1, i = 0; i < colCount; i++, col++) { - Object result = null; - Object expected = columns[i]; - - if (expected == null) { - result = rs.getString(col); - } else if (expected instanceof String) { - result = rs.getString(col); - } else if (expected instanceof Double) { - result = Double.valueOf(rs.getString(col)); - } else if (expected instanceof Integer) { - result = Integer.valueOf(rs.getInt(col)); - } - - result = rs.wasNull() ? null - : result; - - if (columns[i] != null && !columns[i].equals(result)) { - columns[i] = columns[i]; - } - - assertEquals("Statement <" + sql - + "> \nreturned wrong value at row " + rowCount + " ", columns[i], - result); - } - - rowCount++; - } - - System.out.println(sql); - - assertEquals("Statement <" + sql - + "> \nreturned wrong number of rows.", rows.length, - rowCount); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestDataStructures.java b/database/hsqldb/src/org/hsqldb/test/TestDataStructures.java deleted file mode 100644 index 588689c4..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestDataStructures.java +++ /dev/null @@ -1,502 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Random; -import java.util.Vector; - -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.lib.HsqlDeque; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.List; -import org.hsqldb.lib.StopWatch; - -import junit.framework.TestCase; - -/** - * Randomly excutes methods on the Hsql List data structures and compares the - * results with equivalent calls on the java vector class. - * - * @author dnordahl@users - */ -public class TestDataStructures extends TestCase { - - private static final int NUMBER_OF_TEST_RUNS = 100000; - private static final int NUMBER_OF_ITERATIONS_PER_RUN = 80; - private Random randomGenerator; - - //Commands - private static final int ADD = 1; - private static final int ADD_AT = 2; - private static final int GET = 3; - private static final int REMOVE = 4; - private static final int SET = 5; - private static final int OPTIMIZE = 6; - private static final int REMOVE_ALL = 7; - private Vector listCommandsCalled; - - /** Creates a new instance of TestDataStructures */ - public TestDataStructures(String s) { - - super(s); - - randomGenerator = new Random(System.currentTimeMillis()); - listCommandsCalled = new Vector(NUMBER_OF_ITERATIONS_PER_RUN); - } - - /** Runs a test on the hsqldb lists */ - public void testLists() { - - HsqlArrayList arrayList = new HsqlArrayList(); - HsqlDeque deque = new HsqlDeque(); - Vector vector = new Vector(); - Vector listCommandsCalled = new Vector(NUMBER_OF_ITERATIONS_PER_RUN); - Integer tempInt = null; - int tempCommandCode; - int tempPosition; - boolean arrayListException = false; - boolean dequeException = false; - boolean vectorException = false; - Object arrayListObject = null; - Object linkedListObject = null; - Object vectorObject = null; - - for (int i = 0; i < getRandomInt(3, 12); i++) { // prime the contents with a couple items - tempInt = getRandomInteger(); - - arrayList.add(tempInt); - deque.add(tempInt); - vector.addElement(tempInt); - listCommandsCalled.addElement("Add"); - } - - compareLists(arrayList, deque, vector); - - for (int j = 0; j < NUMBER_OF_ITERATIONS_PER_RUN; j++) { - tempCommandCode = getRandomInt(0, 15); // 0 and 8 are ignored or used for a special op - - switch (tempCommandCode) { - - case ADD : - tempInt = getRandomInteger(); - - listCommandsCalled.addElement("Add"); - arrayList.add(tempInt); - deque.add(tempInt); - vector.addElement(tempInt); - break; - - case ADD_AT : - tempInt = getRandomInteger(); - tempPosition = getRandomInt(0, vector.size()); - - listCommandsCalled.addElement("Add at " + tempPosition); - - try { - arrayList.add(tempPosition, tempInt); - } catch (Exception ex) { - arrayListException = true; - } - - try { - deque.add(tempPosition, tempInt); - } catch (Exception ex) { - dequeException = true; - } - - try { - vector.insertElementAt(tempInt, tempPosition); - } catch (Exception ex) { - vectorException = true; - } - compareLists(arrayList, deque, vector); - break; - - case GET : - tempPosition = getRandomInt(0, vector.size() - 1); - - listCommandsCalled.addElement("Get " + tempPosition); - - try { - arrayListObject = arrayList.get(tempPosition); - } catch (Exception ex) { - arrayListException = true; - } - - try { - linkedListObject = deque.get(tempPosition); - } catch (Exception ex) { - dequeException = true; - } - - try { - vectorObject = vector.elementAt(tempPosition); - } catch (Exception ex) { - vectorException = true; - } - break; - - case REMOVE : - tempPosition = getRandomInt(0, vector.size() - 1); - - listCommandsCalled.addElement("Remove " + tempPosition); - - try { - arrayListObject = arrayList.remove(tempPosition); - } catch (Exception ex) { - arrayListException = true; - } - - try { - linkedListObject = deque.remove(tempPosition); - } catch (Exception ex) { - dequeException = true; - } - - try { - vectorObject = vector.elementAt(tempPosition); - - vector.removeElementAt(tempPosition); - } catch (Exception ex) { - vectorException = true; - } - break; - - case SET : - tempInt = getRandomInteger(); - tempPosition = getRandomInt(0, vector.size() - 1); - - listCommandsCalled.addElement("Set " + tempPosition); - - try { - arrayList.set(tempPosition, tempInt); - } catch (Exception ex) { - arrayListException = true; - } - - try { - deque.set(tempPosition, tempInt); - } catch (Exception ex) { - dequeException = true; - } - - try { - vector.setElementAt(tempInt, tempPosition); - } catch (Exception ex) { - vectorException = true; - } - compareLists(arrayList, deque, vector); - break; - - case OPTIMIZE : - listCommandsCalled.addElement("Optimize"); - arrayList.trim(); - vector.trimToSize(); - break; - - case REMOVE_ALL : - if (getRandomInt(0, 5) == 4) { // to limit the frequency of this call - listCommandsCalled.addElement("Remove all"); - - if (vector.size() == 0) { - break; - } - - for (int k = arrayList.size() - 1; k >= 0; k--) { - arrayList.remove(k); - deque.remove(k); - } - - vector.removeAllElements(); - } - break; - - default : - } - - if (arrayListException || dequeException || vectorException) { - - // if an exception is thrown in vector but not one of the lists or vice versa - if (!(arrayListException && dequeException - && vectorException)) { - if (!(arrayListException && vectorException)) { - System.out.println( - "Exception discrepancy with vector and arraylist"); - } else if (!(dequeException && vectorException)) { - System.out.println( - "Exception discrepancy with vector and linkedlist"); - } else { - System.out.println("Error in TestDataStructures"); - } - - this.printListCommandsCalled(listCommandsCalled); - fail("test failed"); - - //System.exit(0); - } - - return; - } - - if (!objectEquals(linkedListObject, arrayListObject, - vectorObject)) { - System.out.println("Objects returned inconsistent"); - this.printListCommandsCalled(listCommandsCalled); - fail("test failed"); - - //System.exit(0); - } - - compareLists(arrayList, deque, vector); - } - } - - /** - * Compare contents of lists to the vector. Print out stuff if they are - * inconsistent and exit. - */ - public void compareLists(HsqlArrayList arrayList, HsqlDeque linkedList, - Vector vector) { - - boolean arrayListError = false; - boolean linkedListError = false; - - if (!equalsVector(arrayList, vector)) { - System.out.println("Error in array list implementation"); - - arrayListError = true; - } - - if (!equalsVector(linkedList, vector)) { - System.out.println("Error in linked list implementation"); - - linkedListError = true; - } - - if (arrayListError || linkedListError) { - this.printListCommandsCalled(listCommandsCalled); - System.out.flush(); - fail("test failed"); - } - } - - /** Prints the list of commands called so far */ - public void printListCommandsCalled(Vector commands) { - - int commandCode = 0; - - for (int i = 0; i < commands.size(); i++) { - System.out.println((String) commands.elementAt(i)); - } - - System.out.flush(); - } - - /** Returns whether three objects are equal */ - private boolean objectEquals(Object lObject, Object aObject, - Object vObject) { - - if (lObject == null && aObject == null && vObject == null) { - return true; - } - - try { - if (!lObject.equals(vObject)) { - System.out.println("LinkList object returned inconsistent"); - - return false; - } else if (!aObject.equals(vObject)) { - System.out.println("ArrayList object returned inconsistent"); - - return false; - } else { - return true; - } - } catch (NullPointerException ex) { - return false; - } - } - - /** Returns a random integer in the range of the lowBound and highBound */ - private int getRandomInt(int lowBound, int highBound) { - - double random = randomGenerator.nextDouble(); - - return ((int) (((highBound - lowBound) * random) + .5)) + lowBound; - } - - /** - * Returns an Integer object with a value between Integer.MIN_VALUE and - * Integer.MAX_VALUE - */ - private Integer getRandomInteger() { - return Integer.valueOf(getRandomInt(0, (int) (Integer.MAX_VALUE / 100.0))); - } - - /** Tells whether the given list contains the same data as the vector */ - private boolean equalsVector(List list, Vector vector) { - - if (list.size() != vector.size()) { - return false; - } - - Iterator listElements = list.iterator(); - Enumeration vectorElements = vector.elements(); - Object listObj = null; - Object vectorObj = null; - - while (listElements.hasNext()) { - listObj = listElements.next(); - vectorObj = vectorElements.nextElement(); - - if (!listObj.equals(vectorObj)) { - return false; - } - } - - return true; - } - - public void testGrowth() { - - HsqlArrayList d = new HsqlArrayList(); - - for (int i = 0; i < 12; i++) { - d.add(Integer.valueOf(i)); - } - - for (int i = 0; i < d.size(); i++) { - System.out.println(d.get(i)); - } - - d = new HsqlArrayList(); - - for (int i = 0; i < 12; i++) { - d.add(Integer.valueOf(i)); - } - - d.set(11, Integer.valueOf(11)); - - for (int i = 0; i < d.size(); i++) { - System.out.println(d.get(i)); - } - - Iterator it = d.iterator(); - - for (int i = 0; it.hasNext(); i++) { - Integer value = (Integer) it.next(); - - System.out.println(value); - assertEquals(i, value.intValue()); - } - - //- - assertEquals(12, d.size()); - } - - public void testSpeed() { - - randomGenerator = new Random(System.currentTimeMillis()); - - int TEST_RUNS = 1000000; - int LOOP_COUNT = 1000; - HsqlArrayList arrayList = new HsqlArrayList(TEST_RUNS); - ArrayList utilArrayList = new ArrayList(TEST_RUNS); - Vector vector = new Vector(TEST_RUNS); - Integer value = Integer.valueOf(randomGenerator.nextInt()); - Integer INT_0 = Integer.valueOf(0); - StopWatch sw = new StopWatch(); - - System.out.println(sw.currentElapsedTimeToMessage("time")); - - for (int i = 0; i < TEST_RUNS; i++) { - arrayList.add(INT_0); - } - - for (int i = 0; i < TEST_RUNS; i++) { - for (int j = 0; j < LOOP_COUNT; j++) { - arrayList.set(i, INT_0); - } - } - - System.out.println( - sw.currentElapsedTimeToMessage("time HsqlArrayList")); - sw.zero(); - - for (int i = 0; i < TEST_RUNS; i++) { - utilArrayList.add(INT_0); - } - - for (int i = 0; i < TEST_RUNS; i++) { - for (int j = 0; j < LOOP_COUNT; j++) { - utilArrayList.set(i, INT_0); - } - } - - System.out.println(sw.currentElapsedTimeToMessage("time ArrayList")); - sw.zero(); - - for (int i = 0; i < TEST_RUNS; i++) { - vector.addElement(INT_0); - } - - for (int i = 0; i < TEST_RUNS; i++) { - for (int j = 0; j < LOOP_COUNT; j++) { - vector.setElementAt(INT_0, i); - } - } - - System.out.println(sw.currentElapsedTimeToMessage("time Vector")); - } - - public static void main(String[] args) { - - TestDataStructures test = new TestDataStructures("testLists"); - - for (int i = 0; i < NUMBER_OF_TEST_RUNS; i++) { - test.testLists(); - - if (i % 1000 == 0) { - System.out.println("Finished " + i + " tests"); - System.out.flush(); - } - } - - System.out.println( - "After " + NUMBER_OF_TEST_RUNS + " tests of a maximum of " - + NUMBER_OF_ITERATIONS_PER_RUN - + " list commands each test, the list tests passed"); - test.testGrowth(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestDatabaseMetaData.java b/database/hsqldb/src/org/hsqldb/test/TestDatabaseMetaData.java deleted file mode 100644 index 74792528..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestDatabaseMetaData.java +++ /dev/null @@ -1,296 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.Types; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.hsqldb.jdbc.JDBCDatabaseMetaData; - -public class TestDatabaseMetaData extends TestBase { - - public TestDatabaseMetaData(String name) { - super(name); - } - - public void testOne() throws Exception { - - Connection conn = newConnection(); - PreparedStatement pstmt; - int updateCount; - - try { - pstmt = conn.prepareStatement("DROP TABLE t1 IF EXISTS"); - - pstmt.executeUpdate(); - pstmt.close(); - - pstmt = conn.prepareStatement( - "CREATE TABLE t1 (cha CHARACTER, dec DECIMAL, doub DOUBLE, lon BIGINT, \"IN\" INTEGER, sma SMALLINT, tin TINYINT, " - + "dat DATE DEFAULT CURRENT_DATE, tim TIME DEFAULT CURRENT_TIME, timest TIMESTAMP DEFAULT CURRENT_TIMESTAMP );"); - updateCount = pstmt.executeUpdate(); - - assertTrue("expected update count of zero", updateCount == 0); - - pstmt = conn.prepareStatement("CREATE INDEX t1 ON t1 (cha );"); - updateCount = pstmt.executeUpdate(); - pstmt = conn.prepareStatement("DROP TABLE t2 IF EXISTS"); - updateCount = pstmt.executeUpdate(); - pstmt = conn.prepareStatement( - "CREATE TABLE t2 (cha CHARACTER, dec DECIMAL, doub DOUBLE, lon BIGINT, \"IN\" INTEGER, sma SMALLINT, tin TINYINT, " - + "dat DATE DEFAULT CURRENT_DATE, tim TIME DEFAULT CURRENT_TIME, timest TIMESTAMP DEFAULT CURRENT_TIMESTAMP );"); - updateCount = pstmt.executeUpdate(); - pstmt = conn.prepareStatement("CREATE INDEX t2 ON t2 (cha );"); - updateCount = pstmt.executeUpdate(); - - DatabaseMetaData dbmd = conn.getMetaData(); - ResultSet rsp = dbmd.getTablePrivileges(null, null, "T1"); - - while (rsp.next()) { - System.out.println("Table: " + rsp.getString(3) + " priv: " - + rsp.getString(6)); - } - - rsp = dbmd.getIndexInfo(null, null, "T1", false, false); - - while (rsp.next()) { - System.out.println("Table: " + rsp.getString(3) - + " IndexName: " + rsp.getString(6)); - } - - rsp = dbmd.getIndexInfo(null, null, "T2", false, false); - - while (rsp.next()) { - System.out.println("Table: " + rsp.getString(3) - + " IndexName: " + rsp.getString(6)); - } - - pstmt = conn.prepareStatement("DROP INDEX t2;"); - updateCount = pstmt.executeUpdate(); - rsp = dbmd.getIndexInfo(null, null, "T2", false, false); - - assertTrue("expected getIndexInfo returns empty resultset", - rsp.next() == false); - - ResultSet rs = dbmd.getTables(null, null, "T1", - new String[]{ "TABLE" }); - ArrayList tablesarr = new ArrayList(); - int i; - - for (i = 0; rs.next(); i++) { - String tempstr = - rs.getString("TABLE_NAME").trim().toLowerCase(); - - tablesarr.add(tempstr); - } - - rs.close(); - assertTrue("expected table t1 count of 1", i == 1); - - Iterator it = tablesarr.iterator(); - - for (; it.hasNext(); ) { - - // create new ArrayList and HashMap for the table - String tablename = ((String) it.next()).trim(); - List collist = new ArrayList(30); - - rs = dbmd.getColumns(null, null, tablename.toUpperCase(), - null); - - for (i = 0; rs.next(); i++) { - collist.add( - rs.getString("COLUMN_NAME").trim().toLowerCase()); - } - - rs.close(); - } - - pstmt = conn.prepareStatement("DROP TABLE t_1 IF EXISTS"); - - pstmt.executeUpdate(); - pstmt.close(); - - pstmt = conn.prepareStatement( - "CREATE TABLE t_1 (cha CHARACTER(10), deci DECIMAL(10,2), doub DOUBLE, lon BIGINT, \"IN\" INTEGER, sma SMALLINT, tin TINYINT, " - + "dat DATE DEFAULT CURRENT_DATE, tim TIME DEFAULT CURRENT_TIME, timest TIMESTAMP DEFAULT CURRENT_TIMESTAMP, bool BOOLEAN );"); - updateCount = pstmt.executeUpdate(); - - assertTrue("expected update count of zero", updateCount == 0); - - rs = dbmd.getTables(null, null, "T\\_1", new String[]{ "TABLE" }); - - for (i = 0; rs.next(); i++) { - String tempstr = - rs.getString("TABLE_NAME").trim().toLowerCase(); - - tablesarr.add(tempstr); - } - - rs.close(); - - if (i != 1) { - System.out.println("expected table t_1 count of 1 but was " + i); - } - - assertEquals("expected table t_1 count of 1", 1, i); - - // test various methods - dbmd.getPrimaryKeys(null, null, "T_1"); - dbmd.getImportedKeys(null, null, "T_1"); - dbmd.getCrossReference(null, null, "T_1", null, null, "T_1"); - - // test ResultSetMetaData - pstmt = conn.prepareStatement( - "INSERT INTO T_1 (cha, deci, doub) VALUES ('name', 10.23, 0)"); - - pstmt.executeUpdate(); - pstmt.close(); - - pstmt = conn.prepareStatement("SELECT * FROM T_1"); - rs = pstmt.executeQuery(); - - ResultSetMetaData md = rs.getMetaData(); - int x = md.getColumnDisplaySize(1); - int y = md.getColumnDisplaySize(2); - int b = md.getPrecision(2); - int c = md.getScale(1); - int d = md.getScale(2); - String e = md.getColumnClassName(10); - boolean testresult = (x == 10) && (y == 12) && (b == 10) - && (c == 0) && (d == 2) - && e.equals("java.sql.Timestamp"); - - assertTrue("wrong result metadata", testresult); - - e = md.getColumnClassName(11); - testresult = e.equals("java.lang.Boolean"); - - assertTrue("wrong result metadata", testresult); - pstmt.close(); - - // - } catch (Exception e) { - assertTrue("unable to prepare or execute DDL", false); - } finally { - conn.close(); - } - } - - /** - * Basic test of DatabaseMetaData functions that access system tables - */ - public void testTwo() throws Exception { - - Connection conn = newConnection(); - int updateCount; - ResultSet result = null; - String s = ""; - - try { - TestUtil.testScript(conn, "testrun/hsqldb/TestSelf01Function.txt"); - TestUtil.testScript(conn, "testrun/hsqldb/TestSelf01Procedure.txt"); - - DatabaseMetaData dbmeta = conn.getMetaData(); - - dbmeta.allProceduresAreCallable(); - result = dbmeta.getBestRowIdentifier(null, null, "T_1", - DatabaseMetaData.bestRowTransaction, - true); - result = dbmeta.getCatalogs(); - result = dbmeta.getColumnPrivileges(null, "PUBLIC", "T_1", "%"); - - while(result.next()) { - s = result.getString(3); - } - result = dbmeta.getColumns("PUBLIC", "PUBLIC", "T_1", "%"); - result = dbmeta.getCrossReference(null, null, "T_1", null, null, "T_1"); - result = dbmeta.getExportedKeys(null, null, "T_1"); - result = dbmeta.getFunctionColumns(null, "%", "%", "%"); - result = dbmeta.getFunctions(null, "%", "%"); - - while(result.next()) { - s = result.getString(3); - } - - result = dbmeta.getImportedKeys("PUBLIC", "PUBLIC", "T_1"); - result = dbmeta.getIndexInfo("PUBLIC", "PUBLIC", "T1", true, true); - result = dbmeta.getPrimaryKeys("PUBLIC", "PUBLIC", "T_1"); - result = dbmeta.getProcedureColumns(null, null, "%", "%"); - result = dbmeta.getProcedures("PUBLIC", "%", "%"); - - while(result.next()) { - s = result.getString(3); - s = result.getString(9); - } - - result = dbmeta.getSchemas(null, "#"); - result = dbmeta.getTablePrivileges(null, "%", "%"); - result = dbmeta.getUDTs(null, "%", "%", new int[]{ Types.DISTINCT }); - } catch (Exception e) { - assertTrue("unable to prepare or execute DDL", false); - } finally { - conn.close(); - } - } - - /** - * Basic test of DatabaseMetaData functions that access functions - */ - public void testThree() throws Exception { - - Connection conn = newConnection(); - int updateCount; - - try { - TestUtil.testScript(conn, "testrun/hsqldb/TestSelf.txt"); - - DatabaseMetaData dbmeta = conn.getMetaData(); - int txIsolation = dbmeta.getDefaultTransactionIsolation(); - String userName = dbmeta.getUserName(); - boolean isReadOnly = dbmeta.isReadOnly(); - String collation = ((JDBCDatabaseMetaData) dbmeta).getDatabaseDefaultCollation(); - assertEquals("SQL_TEXT", collation); - } catch (Exception e) { - assertTrue("unable to prepare or execute DDL", false); - } finally { - conn.close(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestDateTime.java b/database/hsqldb/src/org/hsqldb/test/TestDateTime.java deleted file mode 100644 index 50c2e7a5..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestDateTime.java +++ /dev/null @@ -1,334 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; -import java.text.DateFormat; -import java.util.Calendar; - -/** - * Tests for normalisation of Time and Date values. - * Based on the original test submission. - * @author Miro Halas - */ -public class TestDateTime extends TestBase { - - public TestDateTime(String s) { - super(s); - } - - protected void setUp() throws Exception { - - super.setUp(); - - Connection connection = newConnection(); - Statement statement = connection.createStatement(); - - statement.execute("drop table time_test if exists"); - statement.execute("drop table date_test if exists"); - statement.execute("create table time_test(time_test time)"); - statement.execute("create table date_test(date_test date)"); - connection.close(); - } - - /** - * Test the database support for Date objects. Date object ignores the time - * portion of the Java Date. - * - * This class inserts date into database, then retrieve it back using - * different java time - * - * @throws Throwable - an error has occured during test - */ - public void testBasicDateSupport() throws Throwable { - - final String INSERT_DATE = - "insert into date_test(date_test) values (?)"; - - // See OracleTests class why we need to select tablename.* - final String SELECT_DATE = - "select date_test.* from date_test where date_test = ?"; - final String DELETE_DATE = "delete from date_test where date_test = ?"; - Calendar calGenerate = Calendar.getInstance(); - java.sql.Date insertDate; - Connection connection = newConnection(); - PreparedStatement insertStatement; - int iUpdateCount = 0; - - // Set date of my birthday ;-) - calGenerate.set(1995, 9, 15, 1, 2, 3); - - insertDate = new java.sql.Date(calGenerate.getTimeInMillis()); - insertStatement = connection.prepareStatement(INSERT_DATE); - - insertStatement.setDate(1, insertDate); - - iUpdateCount = insertStatement.executeUpdate(); - - insertStatement.close(); - assertEquals( - "Exactly one record with date data shoud have been inserted.", - iUpdateCount, 1); - - // Now select it back to be sure it is there - PreparedStatement selectStatement = null; - PreparedStatement deleteStatement = null; - ResultSet results = null; - java.sql.Date retrievedDate = null; - boolean bHasMoreThanOne; - int iDeletedCount = 0; - - // Set different time, since when we are dealing with just dates it - // shouldn't matter - calGenerate.set(1995, 9, 15, 2, 3, 4); - - java.sql.Date selectDate = - new java.sql.Date(calGenerate.getTimeInMillis()); - - selectStatement = connection.prepareStatement(SELECT_DATE); - - // try with setDate() - selectStatement.setDate(1, selectDate); - - results = selectStatement.executeQuery(); - - // Get the date from the database - assertTrue("The inserted date is not in the database.", - results.next()); - - // try with setObject() - selectStatement.setObject(1, selectDate); - - results = selectStatement.executeQuery(); - - // Get the date from the database - assertTrue("The inserted date is not in the database.", - results.next()); - - - retrievedDate = results.getDate(1); - deleteStatement = connection.prepareStatement(DELETE_DATE); - - deleteStatement.setDate(1, insertDate); - - iDeletedCount = deleteStatement.executeUpdate(); - - deleteStatement.close(); - assertEquals( - "Exactly one record with date data shoud have been deleted.", - iDeletedCount, 1); - - boolean result = retrievedDate.toString().startsWith( - insertDate.toString().substring(0, 10)); - - assertTrue( - "The date retrieved from database " - + DateFormat.getDateTimeInstance().format(retrievedDate) - + " is not the same as the inserted one " - + DateFormat.getDateTimeInstance().format(insertDate), result); - } - - public void testBasicDefaultTimeSupport() throws Throwable { - - final String INSERT_TIME = - "insert into time_test(time_test) values (?)"; - - // See OracleTests class why we need to select tablename.* - final String SELECT_TIME = - "select time_test.* from time_test where time_test = ?"; - final String DELETE_TIME = "delete from time_test where time_test = ?"; - java.sql.Time insertTime; - Connection connection = newConnection(); - PreparedStatement insertStatement; - int iUpdateCount = 0; - - insertTime = new java.sql.Time(3600000); - insertStatement = connection.prepareStatement(INSERT_TIME); - - insertStatement.setTime(1, insertTime); - - iUpdateCount = insertStatement.executeUpdate(); - - insertStatement.close(); - assertEquals( - "Exactly one record with time data shoud have been inserted.", - iUpdateCount, 1); - - // Now select it back to be sure it is there - PreparedStatement selectStatement = null; - PreparedStatement deleteStatement = null; - ResultSet results = null; - java.sql.Time retrievedTime; - int iDeletedCount = 0; - java.sql.Time selectTime; - - selectStatement = connection.prepareStatement(SELECT_TIME); - selectTime = new java.sql.Time(3600000); - - selectStatement.setTime(1, selectTime); - - results = selectStatement.executeQuery(); - - // Get the date from the database - assertTrue("The inserted time is not in the database.", - results.next()); - - retrievedTime = results.getTime(1); - - // - deleteStatement = connection.prepareStatement(DELETE_TIME); - - deleteStatement.setTime(1, insertTime); - - iDeletedCount = deleteStatement.executeUpdate(); - - assertEquals( - "Exactly one record with time data shoud have been deleted.", - iDeletedCount, 1); - - // And now test the date - assertNotNull( - "The inserted time shouldn't be retrieved as null from the database", - retrievedTime); - - // Ignore milliseconds when comparing dates - String selectString = selectTime.toString(); - String retrievedString = retrievedTime.toString(); - boolean result = retrievedString.equals(selectString); - - assertTrue( - "The time retrieved from database " - + DateFormat.getDateTimeInstance().format(retrievedTime) - + " is not the same as the inserted one " - + DateFormat.getDateTimeInstance().format(insertTime), result); - } - - /** - * Test the database support for Time objects. Time object ignores the date - * portion of the Java Date. - * - * This class inserts time into database, then retrieve it back using - * different java date and deletes it using cursor. - * - * Uses the already setup connection and transaction. - * No need to close the connection since base class is doing it for us. - * - * @throws Throwable - an error has occured during test - */ - public void testBasicTimeSupport() throws Throwable { - - final String INSERT_TIME = - "insert into time_test(time_test) values (?)"; - - // See OracleTests class why we need to select tablename.* - final String SELECT_TIME = - "select time_test.* from time_test where time_test = ?"; - final String DELETE_TIME = "delete from time_test where time_test = ?"; - Calendar calGenerate = Calendar.getInstance(); - java.sql.Time insertTime; - Connection connection = newConnection(); - PreparedStatement insertStatement; - int iUpdateCount = 0; - - // Set date of my birthday ;-) - calGenerate.set(1995, 9, 15, 1, 2, 3); - - insertTime = new java.sql.Time(calGenerate.getTime().getTime()); - insertStatement = connection.prepareStatement(INSERT_TIME); - - insertStatement.setTime(1, insertTime, calGenerate); - - iUpdateCount = insertStatement.executeUpdate(); - - insertStatement.close(); - assertEquals( - "Exactly one record with time data shoud have been inserted.", - iUpdateCount, 1); - - // Now select it back to be sure it is there - PreparedStatement selectStatement = null; - PreparedStatement deleteStatement = null; - ResultSet results = null; - java.sql.Time retrievedTime; - int iDeletedCount = 0; - java.sql.Time selectTime; - - selectStatement = connection.prepareStatement(SELECT_TIME); - - // Set different date, since when we are dealing with just time it - // shouldn't matter - // fredt - but make sure the date is in the same daylight saving range as today ! - calGenerate.set(1975, 9, 16, 1, 2, 3); - - selectTime = new java.sql.Time(calGenerate.getTime().getTime()); - - selectStatement.setTime(1, selectTime, calGenerate); - - results = selectStatement.executeQuery(); - - // Get the date from the database - assertTrue("The inserted time is not in the database.", - results.next()); - - retrievedTime = results.getTime(1, calGenerate); - - // - deleteStatement = connection.prepareStatement(DELETE_TIME); - - deleteStatement.setTime(1, insertTime, calGenerate); - - iDeletedCount = deleteStatement.executeUpdate(); - - assertEquals( - "Exactly one record with time data shoud have been deleted.", - iDeletedCount, 1); - - // And now test the date - assertNotNull( - "The inserted time shouldn't be retrieved as null from the database", - retrievedTime); - - // Ignore milliseconds when comparing dates - String selectString = selectTime.toString(); - String retrievedString = retrievedTime.toString(); - boolean result = retrievedString.equals(selectString); - - assertTrue( - "The time retrieved from database " - + DateFormat.getDateTimeInstance().format(retrievedTime) - + " is not the same as the inserted one " - + DateFormat.getDateTimeInstance().format(insertTime), result); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestDatetimeSimple.java b/database/hsqldb/src/org/hsqldb/test/TestDatetimeSimple.java deleted file mode 100644 index 82ba0e9e..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestDatetimeSimple.java +++ /dev/null @@ -1,364 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.Date; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.TimeZone; - -import junit.framework.TestCase; - -/** - * Date Test Case. - */ -public class TestDatetimeSimple extends TestCase { - - private Calendar calendar = Calendar.getInstance(); - static String connectionURL = - "jdbc:hsqldb:file:/hsql/tests/testdatetimesimple"; - - static { - try { - Class.forName("org.hsqldb.jdbcDriver"); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException( - " failed. JDBC Driver class not in CLASSPATH"); - } - } - - public void testTimestampParam() throws SQLException { - - System.out.println("testTimestampParam " + TimeZone.getDefault()); - - Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:db", "sa", - ""); - Statement stmt = c.createStatement(); - - stmt.execute("create table dual (c0 integer)"); - stmt.executeUpdate("insert into dual values (2)"); - - ResultSet set = stmt.executeQuery( - "select to_number(to_char((select current_timestamp + c0 day from dual), 'YYYYMMDD')) from dual"); - - if (set.next()) { - System.out.println("stmt res=" + set.getInt(1)); - } - - set.close(); - - PreparedStatement pstmt = c.prepareStatement( - "select to_number(to_char((select ? + c0 day from dual), 'YYYYMMDD')) from dual"); - - pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis())); - - set = pstmt.executeQuery(); - - if (set.next()) { - System.out.println("pstmt res=" + set.getInt(1)); - } - - pstmt = c.prepareStatement( - "select to_number(to_char((select ? - c0 day from dual), 'YYYYMMDD')) from dual"); - - pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis())); - - set = pstmt.executeQuery(); - - if (set.next()) { - System.out.println("pstmt res=" + set.getInt(1)); - } - - pstmt = c.prepareStatement( - "select extract(hour from ((localtimestamp + 26 hour) - ?) day to hour ) from dual"); - - pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis())); - - set = pstmt.executeQuery(); - - if (set.next()) { - System.out.println("pstmt res=" + set.getInt(1)); - } - - pstmt = c.prepareStatement( - "select extract(hour from (localtimestamp + 27 hour) - cast(? as timestamp) ) from dual"); - - pstmt.setTimestamp(1, new Timestamp(System.currentTimeMillis())); - - set = pstmt.executeQuery(); - - if (set.next()) { - System.out.println("pstmt res=" + set.getInt(1)); - } - - c.close(); - } - - public void testSimple() throws SQLException { - - System.out.println("testSimple " + TimeZone.getDefault()); - TestUtil.deleteDatabase("/hsql/tests/testdatetimesimple"); - - Connection conn = DriverManager.getConnection(connectionURL, "SA", ""); - ResultSet rs; - PreparedStatement ps; - Statement st = conn.createStatement(); - - st.executeUpdate("SET TIME ZONE INTERVAL '-5:00' HOUR TO MINUTE"); - st.executeUpdate("DROP TABLE t IF EXISTS"); - st.executeUpdate("CREATE TABLE t(i int, d date)"); - st.executeUpdate("INSERT INTO t VALUES(1, '2008-11-27')"); - - rs = st.executeQuery("SELECT d FROM t"); - - rs.next(); - System.out.println("Object: " + rs.getObject("d") // - + " ; Timestamp: " + rs.getTimestamp("d") // - + " ; Date: " + rs.getDate("d") // - + " ; String: " + rs.getString("d")); - rs.close(); - - rs = st.executeQuery("SELECT count(*) c FROM t WHERE d = " - + "'2008-11-27'"); - - rs.next(); - System.out.println("Match? " + (rs.getInt("c") > 0)); - st.executeUpdate("DELETE FROM t"); - - /* This is prohibited: - - st.executeUpdate("INSERT INTO t VALUES(2, '2008-11-27 0:00:00')"); - - Q: Do we want to prohibit this, even though we permit the same - usage with PreparedStatement using a Timestamp, as follows? - - A: In the disallowed case, a String that is not a data string is used, - while in the other case, a timestamp object is used. It follows the - cast specification, which requires the String to be a valid date - string, and allows casting from a TIMESTAMP object to DATE - - */ - ps = conn.prepareStatement("INSERT INTO t VALUES(3, ?)"); - - ps.setTimestamp(1, java.sql.Timestamp.valueOf("2008-10-27 0:00:00")); - ps.execute(); - ps.close(); - - rs = st.executeQuery("SELECT d FROM t"); - - rs.next(); - System.out.println("Object: " + rs.getObject("d") // - + " ; Date: " + rs.getDate("d") // - + " ; Timestamp: " + rs.getTimestamp("d") + // - "; String: " + rs.getString("d")); - rs.close(); - - rs = st.executeQuery("SELECT count(*) c FROM t WHERE d = " - + "'2008-10-27'"); - - /* FRED: When the DATE value is inserted with a TIMESTAMP, - * all matches using a date fail. The query here fails regardless - * of what date I use. */ - rs.next(); - System.out.println("Match? " + (rs.getInt("c") > 0)); - - /* ******** TIMESTAMP COL BELOW ********* */ - st.executeUpdate("DROP TABLE t2 IF EXISTS"); - st.executeUpdate("CREATE TABLE t2(i int, ts timestamp)"); - /* These all failed with the original version - st.executeUpdate("INSERT INTO t2 VALUES(1, '2008-11-27')"); - st.executeUpdate("INSERT INTO t2 VALUES(1, timestamp '2008-11-27')"); - in both cases, the string is not a valid timestamp string - */ - st.executeUpdate( - "INSERT INTO t2 VALUES(1, timestamp '2008-11-27 12:30:00')"); - st.executeUpdate("INSERT INTO t2 VALUES(1, '2008-11-27 12:30:00')"); - - /* FOLLOWING ALL WORK AS EXPECTED: */ - ps = conn.prepareStatement("INSERT INTO t2 VALUES(2, ?)"); - - ps.setTimestamp(1, java.sql.Timestamp.valueOf("2008-10-27 0:00:00")); - ps.execute(); - ps.close(); - - rs = st.executeQuery("SELECT ts FROM t2"); - - rs.next(); - System.out.println("Object: " + rs.getObject("ts") // - + " ; Timestamp: " + rs.getTimestamp("ts") // - + " ; Date: " + rs.getObject("ts") // - + "; String: " + rs.getString("ts")); - rs.close(); - - // these failed execute in original version - st.executeUpdate("INSERT INTO t2 VALUES(1, '2008-11-27')"); - st.executeUpdate("INSERT INTO t2 VALUES(1, timestamp '2008-11-27')"); - st.executeUpdate("SHUTDOWN"); - conn.close(); - } - - public void testValues() throws SQLException { - - System.out.println("testValues " + TimeZone.getDefault()); - TestUtil.deleteDatabase("/hsql/tests/testdatetimesimple"); - - Connection conn = DriverManager.getConnection(connectionURL, "SA", ""); - ResultSet rs; - PreparedStatement ps; - String s; - Object o; - java.sql.Date d; - java.sql.Timestamp ts; - Statement st = conn.createStatement(); - - st.executeUpdate("SET TIME ZONE INTERVAL '-5:00' HOUR TO MINUTE"); - st.executeUpdate("DROP TABLE t3 IF EXISTS"); - st.executeUpdate("CREATE TABLE t3(d date)"); - st.executeUpdate("INSERT INTO t3 VALUES('2008-11-27')"); - - rs = st.executeQuery("SELECT d FROM t3"); - - rs.next(); - - s = rs.getString("d"); - o = rs.getObject("d"); - d = rs.getDate("d"); - ts = rs.getTimestamp("d"); - - System.out.println("2008-11-27 INSERTED" + "\n String: " + s - + "\n Object: " + o + "\n Date: " + dump(d) - + "\n Timestamp: " + dump(ts) + '\n'); - rs.close(); - st.executeUpdate("DROP TABLE ts IF EXISTS"); - st.executeUpdate( - "CREATE TABLE ts(id integer generated by default as identity (start with 1), ts timestamp, tsz timestamp with time zone)"); - st.executeUpdate( - "INSERT INTO ts VALUES DEFAULT, LOCALTIMESTAMP, CURRENT_TIMESTAMP"); - - rs = st.executeQuery("CALL CURRENT_DATE"); - - rs.next(); - - o = rs.getObject(1); - d = rs.getDate(1); - s = rs.getString(1); - ts = rs.getTimestamp(1); - - System.out.println("CURRENT_DATE @" + new java.util.Date() - + "\n String: " + s + "\n Object: " + o - + "\n Date: " + dump(d) + "\n Timestamp: " - + dump(ts) + '\n'); - rs.close(); - - rs = st.executeQuery("CALL LOCALTIMESTAMP"); - - rs.next(); - - o = rs.getObject(1); - s = rs.getString(1); - ts = rs.getTimestamp(1); - - System.out.println("LOCALTIMESTAMP @" + new java.util.Date() - + "\n String: " + s + "\n Object: " + o - + "\n Timestamp: " + dump(ts) + '\n'); - rs.close(); - - rs = st.executeQuery("CALL CURRENT_TIMESTAMP"); - - rs.next(); - - s = rs.getString(1); - o = rs.getObject(1); - ts = rs.getTimestamp(1); - - System.out.println("CURRENT_TIMESTAMP @" + new java.util.Date() - + "\n String: " + s + "\n Object: " + o - + "\n Timestamp: " + dump(ts) + '\n'); - rs.close(); - st.executeUpdate("SHUTDOWN"); - conn.close(); - } - - public void testDateRangeCheck() throws SQLException { - - Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:db", "sa", - ""); - Statement stmt = c.createStatement(); - - stmt.execute("create table testdate (d date)"); - stmt.executeUpdate("insert into testdate values DATE'2017-01-19'"); - - PreparedStatement pstmt = - c.prepareStatement("insert into testdate values ?"); - - try { - calendar.set(2500, 1, 1); - pstmt.setDate(1, new Date(calendar.getTimeInMillis())); - pstmt.executeUpdate(); - fail("invalid date beyond 9999CE accepted"); - } catch (SQLException e) {} - } - - public static String dump(java.sql.Timestamp t) { - return "String (" + t.toString() + ')'; - } - - public static String dump(java.sql.Date d) { - return "String (" + d.toString() + ')'; - } - - public static void main(String[] argv) { - - TestDatetimeSimple testA = new TestDatetimeSimple(); - String[] zones = { - "GMT+05:00", "GMT", "GMT-05:00" - }; - - try { - for (int i = 0; i < zones.length; i++) { - TimeZone timeZone = TimeZone.getTimeZone(zones[i]); - - TimeZone.setDefault(timeZone); - testA.testSimple(); - testA.testValues(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestDbBackup.java b/database/hsqldb/src/org/hsqldb/test/TestDbBackup.java deleted file mode 100644 index 30c73049..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestDbBackup.java +++ /dev/null @@ -1,701 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.SimpleDateFormat; - -import org.hsqldb.lib.tar.DbBackupMain; -import org.hsqldb.lib.tar.TarMalformatException; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.framework.TestCase; - -public class TestDbBackup extends TestCase { - - public TestDbBackup() throws IOException, SQLException {} - - static protected File baseDir = new File("TestDbBackup-" - + System.currentTimeMillis()); - - static { - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException( - " failed. JDBC Driver class not in CLASSPATH"); - } - } - - /** - * Individual test methods may or may not need a Connection. - * If they do, they run setupConn() then use 'conn', and it will be - * automatically closed by the tearDown() method. - * - * @see #tearDown() - */ - protected void setupConn(String id) throws SQLException { - conn = getConnection(id); - alreadyShut = false; - } - - protected void shutdownAndCloseConn() throws SQLException { - - if (conn == null) { - return; - } - - if (!alreadyShut) { - conn.createStatement().executeUpdate("SHUTDOWN"); - - alreadyShut = true; - } - - if (verbose) { - System.err.println("Shut down 'db1'"); - } - - conn.close(); - - conn = null; - } - - /** - * Use setupConn() to set up this Connection for just this individual test. - * - * @see #setupConn(String) - */ - protected Connection conn = null; - protected boolean alreadyShut = false; - - /** - * Remove the specified directory and all of it's descendants. - * - * @throws IOException if unable to completely remove the specified dir - */ - protected void rmR(File dir) throws IOException { - - if (!dir.exists()) { - throw new IOException("Specified dir does not exist: " - + dir.getAbsolutePath()); - } - - File[] children = dir.listFiles(); - - for (int i = 0; i < children.length; i++) { - if (children[i].isDirectory()) { - rmR(children[i]); - } else if (!children[i].delete()) { - if (!children[i].delete()) { - throw new IOException("Failed to remove '" - + children[i].getAbsolutePath() - + "'"); - } - } - } - - if (!dir.delete()) { - throw new IOException("Failed to remove '" + dir.getAbsolutePath() - + "'"); - } - } - - /** - * Accommodate JUnit's test-runner conventions. - */ - public TestDbBackup(String s) throws IOException, SQLException { - super(s); - } - - /** - * JUnit convention for cleanup. - * - * Called after each test*() method. - */ - protected void tearDown() throws IOException, SQLException { - - if (baseDir.exists()) { - rmR(baseDir); - - if (verbose) { - System.err.println("Tore down"); - } - } - } - - static boolean verbose = Boolean.getBoolean("VERBOSE"); - - /** - * Specifically, this method creates and populates "db1", then closes it. - * - * Invoked before each test*() invocation by JUnit. - */ - protected void setUp() throws IOException, SQLException { - - if (verbose) { - System.err.println("Set-upping"); - } - - if (baseDir.exists()) { - throw new IOException("Please wipe out work directory '" + baseDir - + ", which is probably left over from an " - + "aborted test run"); - } - - try { - setupConn("db1"); - - Statement st = conn.createStatement(); - - st.executeUpdate("CREATE TABLE t(i int);"); - st.executeUpdate("INSERT INTO t values(34);"); - conn.commit(); - } catch (SQLException se) {} - finally { - shutdownAndCloseConn(); - } - } - - /** - * Make sure to close after using the returned connection - * (like in a finally block). - */ - protected Connection getConnection(String id) throws SQLException { - - Connection c = DriverManager.getConnection("jdbc:hsqldb:file:" - + baseDir.getAbsolutePath() + '/' + id + "/dbfile", "SA", ""); - - if (verbose) { - System.err.println("Opening JDBC URL '" + "jdbc:hsqldb:file:" - + baseDir.getAbsolutePath() + '/' + id - + "/dbfile"); - } - - c.setAutoCommit(false); - - return c; - } - - /** - * This method allows to easily run this unit test independent of the other - * unit tests, and without dealing with Ant or unrelated test suites. - */ - public static void main(String[] sa) { - - if (sa.length > 0 && !sa[sa.length - 1].equals("-g")) { - TestDbBackup.baseDir = new File(sa[0]); - - if (baseDir.exists()) { - throw new IllegalArgumentException( - "If you specify a work directory, it must not exist " - + "yet. (This makes it much easier for us to clean up " - + "after ourselves)."); - } - - System.err.println("Using user-specified base dir: " - + baseDir.getAbsolutePath()); - } - - junit.textui.TestRunner runner = new junit.textui.TestRunner(); - junit.framework.TestResult result = - runner.run(runner.getTest(TestDbBackup.class.getName())); - - System.exit(result.wasSuccessful() ? 0 - : 1); - } - - public void testSanity() throws SQLException { - - try { - setupConn("db1"); - - ResultSet rs = - conn.createStatement().executeQuery("SELECT * FROM t;"); - - rs.next(); - assertEquals("Wrong table 't' contents", 34, rs.getInt("i")); - } finally { - shutdownAndCloseConn(); - } - } - - public void testBasicBackup() - throws SQLException, IOException, TarMalformatException { - mainBackupAndRestore("basic.tar"); - } - - public void testGzip() - throws SQLException, IOException, TarMalformatException { - mainBackupAndRestore("compressed.tar.gz"); - } - - /** - * Test all forms of online backups with explicit filenames. - */ - public void testOnlineBackup() - throws SQLException, IOException, TarMalformatException { - - onlineBackupAndRestore("online.tar", true, false, "db11"); - onlineBackupAndRestore("online.tar.gz", false, true, "db12"); - onlineBackupAndRestore("online.tgz", false, true, "db13"); - } - - public void onlineBackupAndRestore(String baseTarName, boolean populate, - boolean compress, - String restoreDest) - throws SQLException, IOException, - TarMalformatException { - - try { - setupConn("db1"); - conn.createStatement().executeUpdate("DELETE FROM t"); - - // For this case, we wipe the data that we so carefully set up, - // so that we can call this method repeatedly without worrying - // about left-over data from a previous run. - conn.commit(); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(1)"); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(2)"); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(3)"); - conn.commit(); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(4)"); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(5)"); - conn.createStatement().executeUpdate("BACKUP DATABASE TO '" - + baseDir.getAbsolutePath() - + '/' + baseTarName - + "' BLOCKING" - + (compress ? "" - : " NOT COMPRESSED")); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(6)"); - conn.commit(); - conn.createStatement().executeUpdate("SHUTDOWN"); - - alreadyShut = true; - - if (verbose) { - System.err.println("Shut down 'db1'"); - } - } finally { - shutdownAndCloseConn(); - } - - File destDir = new File(baseDir, restoreDest); - - if (!destDir.mkdir()) { - throw new IOException("Failed to make new dir. to restore to: " - + destDir.getAbsolutePath()); - } - - DbBackupMain.main(new String[] { - "--extract", baseDir.getAbsolutePath() + '/' + baseTarName, - destDir.getAbsolutePath() - }); - - try { - setupConn(restoreDest); - conn.createStatement().executeUpdate("ROLLBACK"); - - ResultSet rs = conn.createStatement().executeQuery( - "SELECT count(*) c FROM t;"); - - rs.next(); - - // 3 committed, 5 uncommited before saving: - assertEquals("Wrong table 't' contents", 5, rs.getInt("c")); - } finally { - shutdownAndCloseConn(); - } - } - - public void mainBackupAndRestore(String baseTarName) - throws SQLException, IOException, TarMalformatException { - - DbBackupMain.main(new String[] { - "--save", baseDir.getAbsolutePath() + '/' + baseTarName, - baseDir.getAbsolutePath() + "/db1/dbfile" - }); - - File destDir = new File(baseDir, "mainrestored"); - - if (!destDir.mkdir()) { - throw new IOException("Failed to make new dir. to restore to: " - + destDir.getAbsolutePath()); - } - - DbBackupMain.main(new String[] { - "--extract", baseDir.getAbsolutePath() + '/' + baseTarName, - destDir.getAbsolutePath() - }); - - try { - setupConn("mainrestored"); - - ResultSet rs = - conn.createStatement().executeQuery("SELECT * FROM t;"); - - rs.next(); - assertEquals("Wrong table 't' contents", 34, rs.getInt("i")); - } finally { - shutdownAndCloseConn(); - } - } - - public void testMainAlreadyOpen() - throws SQLException, IOException, TarMalformatException { - - try { - setupConn("db1"); - - try { - String backupPath = baseDir.getAbsolutePath() - + "/mainOpen.tar"; - String dbPath = baseDir.getAbsolutePath() + "/db1/dbfile"; - String[] args = new String[] { - "--save", backupPath, dbPath - }; - - DbBackupMain.main(args); - } catch (IllegalStateException ioe) { - return; - } - } finally { - shutdownAndCloseConn(); - } - - fail("Backup from main() did not throw even though DB is open"); - } - - /** - * Test that bad explicit filenames are rejected for onilne backups. - */ - public void testTarFileNames() - throws SQLException, IOException, TarMalformatException { - - boolean caught; - - try { - setupConn("db1"); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(2)"); - conn.commit(); - - // #1: COMPRESSED -> no-extension - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad' BLOCKING COMPRESSED"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested compression " - + "to file '/x/bad'"); - } - - // #2: NOT COMPRESSED -> no-extension - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad' BLOCKING NOT COMPRESSED"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested " - + "no-compression to file '/x/bad'"); - } - - // #3: COMPRESSED -> *.txt - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad.txt' BLOCKING COMPRESSED"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested compression " - + "to file '/x/bad.txt'"); - } - - // #4: NOT COMPRESSED -> *.txt - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad.txt' BLOCKING NOT COMPRESSED"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested " - + "no-compression to file '/x/bad.txt'"); - } - - // #5: DEFAULT -> *.tar - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad.tar' BLOCKING"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested default " - + "to file '/x/bad.tar'"); - } - - // #6: COMPRESSION -> *.tar - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad.tar' BLOCKING COMPRESSED"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested compression " - + "to file '/x/bad.tar'"); - } - - // #7: NOT COMPRESSED -> *.tar.gz - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad.tar.gz' BLOCKING NOT COMPRESSED"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested " - + "non-compression to file '/x/bad.tar.gz'"); - } - - // #8: NOT COMPRESSED -> *.tgz - caught = false; - - try { - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/x/bad.tgz' BLOCKING NOT COMPRESSED"); - } catch (SQLException se) { - caught = true; - } - - if (!caught) { - fail("BACKUP did not throw even though requested " - + "non-compression to file '/x/bad.tgz'"); - } - - // Finally run a test to ensure that the attempts above didn't - // fail for some unexpected reason. - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/positivetest.tar' BLOCKING NOT COMPRESSED"); - } finally { - shutdownAndCloseConn(); - } - } - - /** - * Test that correct DB names are generated when user supplies just a - * directory. - * - * N.b. This test may not work right if tests are run at midnight. - * This limitation will be removed once we can update the FilenameFilters - * with Java 4's java.util.regex. - */ - public void testAutoNaming() - throws SQLException, IOException, TarMalformatException { - - boolean caught; - int fileCount; - - try { - setupConn("db1"); - conn.createStatement().executeUpdate("INSERT INTO t VALUES(2)"); - conn.commit(); - - fileCount = baseDir.listFiles(autoTarFilenameFilter).length; - - if (fileCount != 0) { - throw new IllegalStateException( - Integer.toString(fileCount) - + " auto-tar files exist in baseDir '" - + baseDir.getAbsolutePath() - + "' before starting testAutoNaming"); - } - - fileCount = baseDir.listFiles(autoTarGzFilenameFilter).length; - - if (fileCount != 0) { - throw new IllegalStateException( - Integer.toString(fileCount) - + " auto-tar.gz files exist in baseDir '" - + baseDir.getAbsolutePath() - + "' before starting testAutoNaming"); - } - - conn.createStatement().executeUpdate( - "BACKUP DATABASE TO '" + baseDir.getAbsolutePath() - + "/' BLOCKING NOT COMPRESSED"); - - fileCount = baseDir.listFiles(autoTarFilenameFilter).length; - - if (fileCount != 1) { - fail(Integer.toString(fileCount) - + " auto-tar files exist in baseDir '" - + baseDir.getAbsolutePath() - + "' after writing a non-compressed backup"); - } - - fileCount = baseDir.listFiles(autoTarGzFilenameFilter).length; - - if (fileCount != 0) { - fail(Integer.toString(fileCount) - + " auto-tar.gz files exist in baseDir '" - + baseDir.getAbsolutePath() - + "' after writing a non-compressed backup"); - } - - conn.createStatement().executeUpdate("BACKUP DATABASE TO '" - + baseDir.getAbsolutePath() - + "/' BLOCKING COMPRESSED"); - - fileCount = baseDir.listFiles(autoTarFilenameFilter).length; - - if (fileCount != 1) { - fail(Integer.toString(fileCount) - + " auto-tar files exist in baseDir '" - + baseDir.getAbsolutePath() - + "' after writing both backups"); - } - - fileCount = baseDir.listFiles(autoTarGzFilenameFilter).length; - - if (fileCount != 1) { - fail(Integer.toString(fileCount) - + " auto-tar.gz files exist in baseDir '" - + baseDir.getAbsolutePath() - + "' after writing a compressed backup"); - } - } finally { - shutdownAndCloseConn(); - } - } - - public static Test suite() throws IOException, SQLException { - - TestSuite newSuite = new TestSuite(); - - newSuite.addTest(new TestDbBackup("testSanity")); - newSuite.addTest(new TestDbBackup("testBasicBackup")); - newSuite.addTest(new TestDbBackup("testMainAlreadyOpen")); - newSuite.addTest(new TestDbBackup("testGzip")); - newSuite.addTest(new TestDbBackup("testOnlineBackup")); - newSuite.addTest(new TestDbBackup("testTarFileNames")); - newSuite.addTest(new TestDbBackup("testAutoNaming")); - - return newSuite; - } - - private String autoMiddlingString = - "-" + new SimpleDateFormat("yyyyMMdd").format(new java.util.Date()) - + 'T'; - FilenameFilter autoTarFilenameFilter = new FilenameFilter() { - - private String suffixFormat = "-yyyyMMddTHHmmss.tar"; - - public boolean accept(File dir, String name) { - - if (name.length() < suffixFormat.length() + 1) { - - // Require variable name length >= 1 char - return false; - } - - int suffixPos = name.length() - suffixFormat.length(); - - // Would like to use Java 1.4's java.util.regex here. - return name.endsWith(".tar") && name.substring( - suffixPos, suffixPos + autoMiddlingString.length()).equals( - autoMiddlingString); - } - }; - FilenameFilter autoTarGzFilenameFilter = new FilenameFilter() { - - private String suffixFormat = "-yyyyMMddTHHmmss.tar.gz"; - - public boolean accept(File dir, String name) { - - if (name.length() < suffixFormat.length() + 1) { - - // Require variable name length >= 1 char - return false; - } - - int suffixPos = name.length() - suffixFormat.length(); - - // Would like to use Java 1.4's java.util.regex here. - return name.endsWith(".tar.gz") && name.substring( - suffixPos, suffixPos + autoMiddlingString.length()).equals( - autoMiddlingString); - } - }; -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestDirectorySettings.java b/database/hsqldb/src/org/hsqldb/test/TestDirectorySettings.java deleted file mode 100644 index 436020c2..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestDirectorySettings.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -public class TestDirectorySettings { - public static final String fileBase = "c://hsql/"; - public static final String fileBaseURL = "jdbc:hsqldb:file:" + fileBase; - - public static final String fileBaseUser = "c://hsql_dbs/"; - public static final String fileBaseURLUser = "jdbc:hsqldb:file:" + fileBaseUser; -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestGroupByHaving.java b/database/hsqldb/src/org/hsqldb/test/TestGroupByHaving.java deleted file mode 100644 index 7a7180a6..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestGroupByHaving.java +++ /dev/null @@ -1,355 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.TestCase; - -/** - * Test cases for HSQL aggregates and HAVING clause. - * - * @author Tony Lai ((tony_lai@users dot sourceforge.net) - */ - -// fredt@users - modified to remove dependecy on DBUnit -public class TestGroupByHaving extends TestCase { - - //------------------------------------------------------------ - // Class variables - //------------------------------------------------------------ - private static final String databaseDriver = "org.hsqldb.jdbc.JDBCDriver"; - private static final String databaseURL = "jdbc:hsqldb:mem:."; - private static final String databaseUser = "sa"; - private static final String databasePassword = ""; - - //------------------------------------------------------------ - // Instance variables - //------------------------------------------------------------ - private Connection conn; - private Statement stmt; - - //------------------------------------------------------------ - // Constructors - //------------------------------------------------------------ - - /** - * Constructs a new SubselectTest. - */ - public TestGroupByHaving(String s) { - super(s); - } - - //------------------------------------------------------------ - // Class methods - //------------------------------------------------------------ - protected static Connection getJDBCConnection() throws SQLException { - return DriverManager.getConnection(databaseURL, databaseUser, - databasePassword); - } - - protected void setUp() throws Exception { - - super.setUp(); - - if (conn != null) { - return; - } - - Class.forName(databaseDriver); - - conn = getJDBCConnection(); - stmt = conn.createStatement(); - - // I decided not the use the "IF EXISTS" clause since it is not a - // SQL standard. - try { - -// stmt.execute("drop table employee"); - stmt.execute("drop table employee if exists"); - } catch (Exception x) {} - - stmt.execute("create table employee(id int, " - + "firstname VARCHAR(50), " + "lastname VARCHAR(50), " - + "salary decimal(10, 2), " + "superior_id int, " - + "CONSTRAINT PK_employee PRIMARY KEY (id), " - + "CONSTRAINT FK_superior FOREIGN KEY (superior_id) " - + "REFERENCES employee(ID))"); - addEmployee(1, "Mike", "Smith", 160000, -1); - addEmployee(2, "Mary", "Smith", 140000, -1); - - // Employee under Mike - addEmployee(10, "Joe", "Divis", 50000, 1); - addEmployee(11, "Peter", "Mason", 45000, 1); - addEmployee(12, "Steve", "Johnson", 40000, 1); - addEmployee(13, "Jim", "Hood", 35000, 1); - - // Employee under Mike - addEmployee(20, "Jennifer", "Divis", 60000, 2); - addEmployee(21, "Helen", "Mason", 50000, 2); - addEmployee(22, "Daisy", "Johnson", 40000, 2); - addEmployee(23, "Barbara", "Hood", 30000, 2); - } - - protected void tearDown() throws Exception { - - // I decided not the use the "IF EXISTS" clause since it is not a - // SQL standard. - try { - -// stmt.execute("drop table employee"); - stmt.execute("drop table employee if exists"); - } catch (Exception x) {} - - if (stmt != null) { - stmt.close(); - - stmt = null; - } - - if (conn != null) { - conn.close(); - - conn = null; - } - - super.tearDown(); - - } - - private void addEmployee(int id, String firstName, String lastName, - double salary, int superiorId) throws Exception { - - stmt.execute("insert into employee values(" + id + ", '" + firstName - + "', '" + lastName + "', " + salary + ", " - + (superiorId <= 0 ? "null" - : ("" + superiorId)) + ")"); - } - - /** - * Tests aggregated selection with a GROUP_BY clause. This is - * a normal use of the GROUP_BY clause. The first two employees - * do not have a superior, and must be grouped within the same group, - * according to GROUP_BY standard. - */ - public void testAggregatedGroupBy() throws SQLException { - - String sql = "select avg(salary), max(id) from employee " - + "group by superior_id " + "order by superior_id " + ""; - Object[][] expected = new Object[][] { - { - Double.valueOf(150000), Integer.valueOf(2) - }, { - Double.valueOf(42500), Integer.valueOf(13) - }, { - Double.valueOf(45000), Integer.valueOf(23) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection with a GROUP_BY clause and a - * HAVING clause. - *

    - * This is a typical use of the GROUP_BY + HAVING clause. - * The first two employees are eliminated due to the HAVING - * condition. - *

    - * This test uses aggregated function to eliminate first group. - */ - public void testAggregatedGroupByHaving1() throws SQLException { - - String sql = "select avg(salary), max(id) from employee " - + "group by superior_id " + "having max(id) > 5 " - + "order by superior_id " + ""; - Object[][] expected = new Object[][] { - { - Double.valueOf(42500), Integer.valueOf(13) - }, { - Double.valueOf(45000), Integer.valueOf(23) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests aggregated selection with a GROUP_BY clause and a - * HAVING clause. - *

    - * This is a typical use of the GROUP_BY + HAVING clause. - * The first two employees are eliminated due to the HAVING - * condition. - *

    - * This test uses GROUP_BY column to eliminate first group. - */ - public void testAggregatedGroupByHaving2() throws SQLException { - - String sql = "select avg(salary), max(id) from employee " - + "group by superior_id " - + "having superior_id is not null " - + "order by superior_id " + ""; - Object[][] expected = new Object[][] { - { - Double.valueOf(42500), Integer.valueOf(13) - }, { - Double.valueOf(45000), Integer.valueOf(23) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an unusual usage of the HAVING clause, without a - * GROUP BY clause. - *

    - * Only one row is returned by the aggregate selection without a - * GROUP BY clause. The HAVING clause is applied to the - * only returned row. In this case, the HAVING condition is - * satisfied. - */ - public void testHavingWithoutGroupBy1() throws SQLException { - - String sql = "select avg(salary), max(id) from employee " - + "having avg(salary) > 1000 " + ""; - Object[][] expected = new Object[][] { - { - Double.valueOf(65000), Integer.valueOf(23) - }, - }; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an unusual usage of the HAVING clause, without a - * GROUP BY clause. - *

    - * Only one row is returned by the aggregate selection without a - * GROUP BY clause. The HAVING clause is applied to the - * only returned row. In this case, the HAVING condition is - * NOT satisfied. - */ - public void testHavingWithoutGroupBy2() throws SQLException { - - String sql = "select avg(salary), max(id) from employee " - + "having avg(salary) > 1000000 " + ""; - Object[][] expected = new Object[][]{}; - - compareResults(sql, expected, "00000"); - } - - /** - * Tests an invalid HAVING clause that contains columns not in - * the GROUP BY clause. A SQLException should be thrown. - */ - public void testInvalidHaving() throws SQLException { - - String sql = "select avg(salary), max(id) from employee " - + "group by lastname " - + "having (max(id) > 1) and (superior_id > 1) " + ""; - Object[][] expected = new Object[][]{}; - - compareResults(sql, expected, "42573"); - } - - //------------------------------------------------------------ - // Helper methods - //------------------------------------------------------------ - private void compareResults(String sql, Object[][] rows, - String sqlState) throws SQLException { - - ResultSet rs = null; - - try { - rs = stmt.executeQuery(sql); - - assertTrue("Statement <" + sql + "> \nexpecting error code: " - + sqlState, ("00000".equals(sqlState))); - } catch (SQLException sqlx) { - if (!sqlx.getSQLState().equals(sqlState)) { - sqlx.printStackTrace(); - } - - assertTrue("Statement <" + sql + "> \nthrows wrong error code: " - + sqlx.getErrorCode() + " expecting error code: " - + sqlState, (sqlx.getSQLState().equals(sqlState))); - - return; - } - - int rowCount = 0; - int colCount = rows.length > 0 ? rows[0].length - : 0; - - while (rs.next()) { - assertTrue("Statement <" + sql + "> \nreturned too many rows.", - (rowCount < rows.length)); - - Object[] columns = rows[rowCount]; - - for (int col = 1, i = 0; i < colCount; i++, col++) { - Object result = null; - Object expected = columns[i]; - - if (expected == null) { - result = rs.getString(col); - result = rs.wasNull() ? null - : result; - } else if (expected instanceof String) { - result = rs.getString(col); - } else if (expected instanceof Double) { - result = Double.valueOf(rs.getString(col)); - } else if (expected instanceof Integer) { - result = Integer.valueOf(rs.getInt(col)); - } - - assertEquals("Statement <" + sql - + "> \nreturned wrong value.", columns[i], - result); - } - - rowCount++; - } - - assertEquals("Statement <" + sql - + "> \nreturned wrong number of rows.", rows.length, - rowCount); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestHTTPKeepAlive.java b/database/hsqldb/src/org/hsqldb/test/TestHTTPKeepAlive.java deleted file mode 100644 index a1ea69f2..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestHTTPKeepAlive.java +++ /dev/null @@ -1,180 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Enumeration; -import java.util.concurrent.atomic.AtomicInteger; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -/** - * This tests simply executes more than 2^16 times a 'SELECT *' on a 2-row - * table. If no Keep-Alive is used your OS will run out of ports for connections - * being repeatedly opened for each SELECT that is executed. If Keep-Alive is - * being used, this test will complete in a about 5 seconds on an ivy-bridge - * class machine - * - * @author Aart de Vries - */ -public class TestHTTPKeepAlive extends TestBase { - - static AtomicInteger failCount = new AtomicInteger(); - static AtomicInteger executeCount = new AtomicInteger(); - private Statement stmnt; - private Connection connection; - - public TestHTTPKeepAlive(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - - connection = newConnection(); - stmnt = connection.createStatement(); - - stmnt.execute( - "CREATE TABLE IF NOT EXISTS link_table (id INTEGER PRIMARY KEY NOT NULL, other TINYINT NOT NULL)"); - stmnt.execute("INSERT INTO link_table VALUES ((0, 1),(1, 2))"); - } - - protected void tearDown() { - - try { - stmnt.execute("DROP TABLE IF EXISTS link_table"); - connection.close(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("TestSql.tearDown() error: " + e.getMessage()); - } - - super.tearDown(); - } - - class KeepAliveThread extends Thread { - - public void run() { - - Connection c = null; - - try { - c = newConnection(); - - final Statement statement = c.createStatement(); - - for (int i = 0; i <= 16500; i++) { - statement.executeQuery("SELECT * FROM link_table"); - executeCount.incrementAndGet(); - } - } catch (SQLException e) { - e.printStackTrace(System.out); - } finally { - try { - if (c != null) { - c.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - class TimeoutThread extends Thread { - - public void run() { - - Thread t = new KeepAliveThread(); - - t.start(); - - try { - t.join(15000); - - if (t.isAlive()) { // If thread still running, then it's probably blocked because the ports are exhausted - failCount.incrementAndGet(); - fail("Keep-Alive is probably not being used"); - } - } catch (InterruptedException ex) {} - } - } - - public void testKeepAlive() { - - Thread t1 = new TimeoutThread(); - - t1.start(); - - Thread t2 = new TimeoutThread(); - - t2.start(); - - Thread t3 = new TimeoutThread(); - - t3.start(); - - Thread t4 = new TimeoutThread(); - - t4.start(); - - try { - t1.join(); - t2.join(); - t3.join(); - t4.join(); - } catch (InterruptedException e) {} - - System.out.println("testKeepAlive completed " + executeCount - + "connections.\n"); - } - - public static void main(String[] argv) { - - TestResult result = new TestResult(); - TestCase testKeepAlive = new TestHTTPKeepAlive("testKeepAlive"); - - testKeepAlive.run(result); - System.out.println("TestKeepAlive error count: " - + result.failureCount()); - - Enumeration e = result.failures(); - - while (e.hasMoreElements()) { - System.out.println(e.nextElement()); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestHarness.java b/database/hsqldb/src/org/hsqldb/test/TestHarness.java deleted file mode 100644 index fad8ae66..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestHarness.java +++ /dev/null @@ -1,278 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/* Filename: TestHarness.java - * Created on May 18, 2005 - * Author: Carl Gould - * Copyright Calmetrics 2005 - * Project: HSQLDB_Test - */ -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Properties; - -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -/** - * Describe this class - * - * @author Carl - */ -public class TestHarness extends JFrame { - - protected String dbURL; - protected JTextArea textArea; - - public static void main(String[] args) { - - if (args.length == 0) { - args = new String[]{ "testrecovery" }; - } - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - } catch (Exception e) { - System.out.println("ERROR: failed to load HSQLDB JDBC driver."); - e.printStackTrace(); - - return; - } - - new TestHarness("jdbc:hsqldb:file:" + args[0]); - } - - public TestHarness(String url) { - - super("HSQLDB Test Harness"); - - this.dbURL = url; - - setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - addWindowListener(new WindowAdapter() { - - public void windowClosing(WindowEvent e) { - doClose(); - } - }); - initComponents(); - setSize(400, 400); - setLocation(200, 200); - setVisible(true); - - try { - Connection c = getConnection("sa", "password", true); - - textArea.setText("Database already exists."); - c.close(); - } catch (SQLException e1) { - doCreate(); - } - } - - protected void initComponents() { - - Container main = getContentPane(); - - textArea = new JTextArea(); - - JPanel buttons = new JPanel(new FlowLayout()); - JButton close = new JButton("Close Gracefully"); - - close.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - doClose(); - } - }); - - JButton create = new JButton("Add Row"); - - create.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - doInsert(); - } - }); - - JButton list = new JButton("List Data"); - - list.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - doListing(); - } - }); - - JButton kill = new JButton("Kill"); - - kill.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.exit(0); - } - }); - buttons.add(create); - buttons.add(list); - buttons.add(kill); - buttons.add(close); - main.add(new JScrollPane(textArea), BorderLayout.CENTER); - main.add(buttons, BorderLayout.SOUTH); - } - - protected void doInsert() { - - try { - Connection con = getConnection("ABCD", "dcba", false); - - if (con != null) { - Statement stmt = con.createStatement(); - ResultSet rs = stmt.executeQuery( - "SELECT NEXT VALUE FOR MySeq FROM Dummy"); - - rs.next(); - - int id = rs.getInt(1); - - stmt.executeUpdate("INSERT INTO MyTable (Id, Name) VALUES (" - + id + ", 'This is row #" + id + "')"); - append("Row #" + id + " added"); - stmt.close(); - con.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - - protected void doListing() { - - try { - Connection con = getConnection("ABCD", "dcba", false); - - if (con != null) { - Statement stmt = con.createStatement(); - ResultSet rs = stmt.executeQuery( - "SELECT * FROM MyTable ORDER BY Id ASC"); - - append("Listing 'MyTable'...."); - - while (rs.next()) { - append(" " + rs.getString(1) + ", " + rs.getString(2)); - } - - append("...done."); - stmt.close(); - con.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - - private void append(String s) { - textArea.setText(textArea.getText() + "\n" + s); - } - - protected void doClose() { - - try { - Connection con = getConnection("sa", "password", false); - - if (con != null) { - Statement stmt = con.createStatement(); - - stmt.execute("SHUTDOWN"); - stmt.close(); - con.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - - System.exit(0); - } - - protected void doCreate() { - - try { - Connection con = getConnection("sa", "", false); - - if (con != null) { - Statement stmt = con.createStatement(); - - stmt.execute("SET PASSWORD 'password'"); - stmt.execute("CREATE USER abcd PASSWORD 'dcba'"); - stmt.execute("CREATE SEQUENCE MySeq"); - stmt.execute( - "CREATE TABLE MyTable (Id INT PRIMARY KEY, Name VARCHAR(100) NOT NULL)"); - stmt.execute("CREATE TABLE Dummy (Blah VARCHAR(100) NOT NULL)"); - stmt.execute( - "INSERT INTO Dummy (Blah) VALUES ('dummy value')"); - stmt.execute("GRANT ALL ON MyTable TO abcd"); - stmt.execute("GRANT ALL ON Dummy TO abcd"); - stmt.execute("GRANT ALL ON SEQUENCE MySeq TO abcd"); - stmt.close(); - con.close(); - textArea.setText("Database created."); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - - protected Connection getConnection(String username, String password, - boolean ifExists) throws SQLException { - - Properties props = new Properties(); - - props.put("user", username); - props.put("password", password); - props.put("ifexists", String.valueOf(ifExists)); - - return DriverManager.getConnection(dbURL, props); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestHashStructures.java b/database/hsqldb/src/org/hsqldb/test/TestHashStructures.java deleted file mode 100644 index 4363a4b2..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestHashStructures.java +++ /dev/null @@ -1,603 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.util.Random; - -import org.hsqldb.lib.DoubleIntIndex; -import org.hsqldb.lib.StopWatch; - -import junit.framework.TestCase; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - */ -public class TestHashStructures extends TestCase { - - public TestHashStructures(String s) { - super(s); - } - - Random randomgen = new java.util.Random(); - - public void testHashMap() throws Exception { - - int passed = 0; - int testSize = 33; - org.hsqldb.lib.HashMap hMap = new org.hsqldb.lib.HashMap(); - org.hsqldb.lib.IntKeyHashMap hIntMap = - new org.hsqldb.lib.IntKeyHashMap(); - java.util.HashMap uMap = new java.util.HashMap(); - - try { - populateBySerialIntKeys(uMap, hMap, testSize); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - // - - populateByRandomIntKeys(uMap, hMap, testSize); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - // - depopulateRandomly(uMap, hMap, 20); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - // - populateBySerialIntKeys(uMap, hMap, testSize); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - // - depopulateByIterator(uMap, hMap, 20); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - } catch (Exception e) {} - - assertTrue(passed == 5); - } - - public void testIntKeyHashMap() throws Exception { - - int passed = 0; - int testSize = 33; - org.hsqldb.lib.IntKeyHashMap hIntMap = - new org.hsqldb.lib.IntKeyHashMap(); - java.util.HashMap uMap = new java.util.HashMap(); - - try { - populateBySerialIntKeysInt(uMap, hIntMap, testSize); - compareByUIteratorInt(uMap, hIntMap); - - passed++; - - populateByRandomIntKeysInt(uMap, hIntMap, testSize); - compareByUIteratorInt(uMap, hIntMap); - compareByHIteratorInt(uMap, hIntMap); - - passed++; - - // - depopulateByIntIterator(uMap, hIntMap, 20); - compareByUIteratorInt(uMap, hIntMap); - compareByHIteratorInt(uMap, hIntMap); - - passed++; - - // - clearByIntIterator(uMap, hIntMap); - compareByUIteratorInt(uMap, hIntMap); - compareByHIteratorInt(uMap, hIntMap); - - passed++; - - // - - populateBySerialIntKeysInt(uMap, hIntMap, testSize); - compareByUIteratorInt(uMap, hIntMap); - compareByHIteratorInt(uMap, hIntMap); - - passed++; - - // - clearByIntIterator(uMap, hIntMap); - compareByUIteratorInt(uMap, hIntMap); - compareByHIteratorInt(uMap, hIntMap); - } catch (Exception e) {} - - assertTrue(passed == 5); - } - - public void testHashMappedList() throws Exception { - - int passed = 0; - int testSize = 33; - org.hsqldb.lib.OrderedHashMap hMap = - new org.hsqldb.lib.OrderedHashMap(); - java.util.HashMap uMap = new java.util.HashMap(); - - try { - populateBySerialIntKeys(uMap, hMap, testSize); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - populateByRandomIntKeys(uMap, hMap, testSize); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - depopulateRandomly(uMap, hMap, 20); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - populateByRandomIntKeys(uMap, hMap, testSize); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - - depopulateRandomly(uMap, hMap, 20); - populateBySerialIntKeys(uMap, hMap, testSize); - compareByUIterator(uMap, hMap); - compareByHIterator(uMap, hMap); - - passed++; - } catch (Exception e) {} - - assertTrue(passed == 5); - } - - public void testDoubleIntLookup() throws Exception { - - int passed = 0; - int testSize = 512; - org.hsqldb.lib.IntKeyHashMap hIntMap = - new org.hsqldb.lib.IntKeyHashMap(); - DoubleIntIndex intLookup = new DoubleIntIndex(12); - - try { - populateBySerialIntKeysInt(intLookup, hIntMap, testSize); - compareByHIteratorInt(intLookup, hIntMap); - - passed++; - - hIntMap.clear(); - intLookup.clear(); - populateByRandomIntKeysInt(intLookup, hIntMap, testSize); - compareByHIteratorInt(intLookup, hIntMap); - - passed++; - } catch (Exception e) {} - - assertTrue(passed == 2); - } - - public void testDoubleIntSpeed() throws Exception { - - boolean failed = false; - int testSize = 500; - org.hsqldb.lib.IntKeyHashMap hIntMap = - new org.hsqldb.lib.IntKeyHashMap(); - DoubleIntIndex intLookup = new DoubleIntIndex(testSize); - - populateByRandomIntKeysInt(intLookup, hIntMap, testSize); - compareByHIteratorInt(intLookup, hIntMap); - - int[] sample = getSampleIntArray(intLookup, 100); - int[] sampleVals = new int[sample.length]; - int i = 0; - int j = 0; - StopWatch sw = new StopWatch(); - - try { - for (j = 0; j < 10000; j++) { - for (i = 0; i < sample.length; i++) { - int pos = intLookup.findFirstEqualKeyIndex(sample[i]); - - sampleVals[i] = intLookup.getValue(pos); - - intLookup.remove(pos); - } - - for (i = 0; i < sample.length; i++) { - intLookup.addUnique(sample[i], sampleVals[i]); - } - } - - System.out.println( - sw.elapsedTimeToMessage("Double int table times")); - intLookup.findFirstEqualKeyIndex(0); // sort - compareByHIteratorInt(intLookup, hIntMap); - } catch (Exception e) { - System.out.println( - sw.elapsedTimeToMessage("Double int table error: i =" + i)); - - failed = true; - } - - assertTrue(!failed); - } - - int[] getSampleIntArray(org.hsqldb.lib.DoubleIntIndex index, int size) { - - int[] array = new int[size]; - org.hsqldb.lib.IntKeyHashMap map = new org.hsqldb.lib.IntKeyHashMap(); - - for (; map.size() < size; ) { - int pos = nextIntRandom(randomgen, index.size()); - - map.put(pos, null); - } - - org.hsqldb.lib.Iterator it = map.keySet().iterator(); - - for (int i = 0; i < size; i++) { - int pos = it.nextInt(); - - array[i] = index.getKey(pos); - } - - return array; - } - - void populateBySerialIntKeys(java.util.HashMap uMap, - org.hsqldb.lib.HashMap hMap, - int testSize) throws Exception { - - for (int i = 0; i < testSize; i++) { - int intValue = randomgen.nextInt(); - - uMap.put(Integer.valueOf(i), Integer.valueOf(intValue)); - hMap.put(Integer.valueOf(i), Integer.valueOf(intValue)); - - if (uMap.size() != hMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - } - - void populateBySerialIntKeysInt(java.util.HashMap uMap, - org.hsqldb.lib.IntKeyHashMap hMap, - int testSize) throws Exception { - - for (int i = 0; i < testSize; i++) { - int intValue = randomgen.nextInt(); - - uMap.put(Integer.valueOf(i), Integer.valueOf(intValue)); - hMap.put(i, Integer.valueOf(intValue)); - - if (uMap.size() != hMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - } - - void populateBySerialIntKeysInt(DoubleIntIndex intLookup, - org.hsqldb.lib.IntKeyHashMap hMap, - int testSize) throws Exception { - - for (int i = 0; i < testSize; i++) { - int intValue = randomgen.nextInt(); - - intLookup.addUnique(i, intValue); - hMap.put(i, Integer.valueOf(intValue)); - - if (intLookup.size() != hMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - } - - void populateByRandomIntKeysInt(DoubleIntIndex intLookup, - org.hsqldb.lib.IntKeyHashMap hMap, - int testSize) throws Exception { - - for (int i = 0; i < testSize; i++) { - int intValue = randomgen.nextInt(); - - intLookup.addUnique(intValue, i); - hMap.put(intValue, Integer.valueOf(i)); - - // actually this can happen as duplicates are allowed in DoubleIntTable - if (intLookup.size() != hMap.size()) { - throw new Exception("Duplicate random in int lookup"); - } - } - } - - void populateByRandomIntKeys(java.util.HashMap uMap, - org.hsqldb.lib.HashMap hMap, - int testSize) throws Exception { - - for (int i = 0; i < testSize; i++) { - int intValue = randomgen.nextInt(); - - uMap.put(Integer.valueOf(intValue), Integer.valueOf(i)); - hMap.put(Integer.valueOf(intValue), Integer.valueOf(i)); - - if (uMap.size() != hMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - } - - void populateByRandomIntKeysInt(java.util.HashMap uMap, - org.hsqldb.lib.IntKeyHashMap hMap, - int testSize) throws Exception { - - for (int i = 0; i < testSize; i++) { - int intValue = randomgen.nextInt(); - - uMap.put(Integer.valueOf(intValue), Integer.valueOf(i)); - hMap.put(intValue, Integer.valueOf(i)); - - if (uMap.size() != hMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - } - - void depopulateRandomly(java.util.HashMap uMap, - org.hsqldb.lib.HashMap hMap, - int testCount) throws Exception { - - int removeCount = 0; - int size = uMap.size(); - - if (testCount > size / 2) { - testCount = size / 2; - } - - while (removeCount < testCount) { - java.util.Iterator uIt = uMap.keySet().iterator(); - - for (int i = 0; uIt.hasNext(); i++) { - Object uKey = uIt.next(); - int intValue = randomgen.nextInt(size); - - if (intValue == i) { - uIt.remove(); - hMap.remove(uKey); - - removeCount++; - } - - if (uMap.size() != hMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - } - } - - void depopulateByIterator(java.util.HashMap uMap, - org.hsqldb.lib.HashMap hMap, - int testCount) throws Exception { - - org.hsqldb.lib.Iterator hIt = hMap.keySet().iterator(); - - System.out.println(uMap.size()); - - for (int i = 0; hIt.hasNext(); i++) { - Object key = hIt.next(); - int check = randomgen.nextInt(2); - - if (check == i % 2) { - hIt.remove(); - uMap.remove(key); - } - - if (uMap.size() != hMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - - System.out.println(uMap.size()); - } - - void depopulateByIntIterator(java.util.HashMap uMap, - org.hsqldb.lib.IntKeyHashMap hIntMap, - int testCount) throws Exception { - - org.hsqldb.lib.Iterator hIt = hIntMap.keySet().iterator(); - - System.out.println(uMap.size()); - - for (int i = 0; hIt.hasNext(); i++) { - Object key = Integer.valueOf(hIt.nextInt()); - int check = randomgen.nextInt(2); - - if (check == i % 2) { - hIt.remove(); - uMap.remove(key); - } - - if (uMap.size() != hIntMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - - System.out.println(uMap.size()); - } - - void clearByIntIterator(java.util.HashMap uMap, - org.hsqldb.lib.IntKeyHashMap hIntMap) - throws Exception { - - org.hsqldb.lib.Iterator hIt = hIntMap.keySet().iterator(); - - System.out.println(uMap.size()); - - for (int i = 0; hIt.hasNext(); i++) { - Object key = Integer.valueOf(hIt.nextInt()); - - hIt.remove(); - uMap.remove(key); - - if (uMap.size() != hIntMap.size()) { - throw new Exception("HashMap size mismatch"); - } - } - - System.out.println(uMap.size()); - } - - void compareByUIterator(java.util.HashMap uMap, - org.hsqldb.lib.HashMap hMap) throws Exception { - - java.util.Iterator uIt = uMap.keySet().iterator(); - - for (int i = 0; uIt.hasNext(); i++) { - Object uKey = uIt.next(); - Object oU = uMap.get(uKey); - Object hU = hMap.get(uKey); - - if (!oU.equals(hU)) { - throw new Exception("HashMap value mismatch"); - } - } - } - - void compareByHIterator(java.util.HashMap uMap, - org.hsqldb.lib.HashMap hMap) throws Exception { - - org.hsqldb.lib.Iterator hIt = hMap.keySet().iterator(); - - for (int i = 0; hIt.hasNext(); i++) { - Object hKey = hIt.next(); - Object oU = uMap.get(hKey); - Object hU = hMap.get(hKey); - - if (!oU.equals(hU)) { - throw new Exception("HashMap value mismatch"); - } - } - } - - void compareByUIteratorInt(java.util.HashMap uMap, - org.hsqldb.lib.IntKeyHashMap hMap) - throws Exception { - - java.util.Iterator uIt = uMap.keySet().iterator(); - - for (int i = 0; uIt.hasNext(); i++) { - Object uKey = uIt.next(); - Object oU = uMap.get(uKey); - Object hU = hMap.get(uKey); - - if (!oU.equals(hU)) { - throw new Exception("HashMap value mismatch"); - } - } - } - - void compareByHIteratorInt(java.util.HashMap uMap, - org.hsqldb.lib.IntKeyHashMap hMap) - throws Exception { - - org.hsqldb.lib.Iterator hIt = hMap.keySet().iterator(); - - for (int i = 0; hIt.hasNext(); i++) { - Integer hKey = Integer.valueOf(hIt.nextInt()); - Object oU = uMap.get(hKey); - Object hU = hMap.get(hKey.intValue()); - - if (!oU.equals(hU)) { - throw new Exception("HashMap value mismatch"); - } - } - } - - void compareByHIteratorInt(DoubleIntIndex intLookup, - org.hsqldb.lib.IntKeyHashMap hMap) - throws Exception { - - org.hsqldb.lib.Iterator hIt = hMap.keySet().iterator(); - - for (int i = 0; hIt.hasNext(); i++) { - int hK = hIt.nextInt(); - int lookup = intLookup.findFirstEqualKeyIndex(hK); - int lV = intLookup.getValue(lookup); - - if (lV == 0) { - Object o = hMap.get(hK); - } - Integer hV = (Integer) hMap.get(hK); - - if (hV.intValue() != lV) { - throw new Exception("HashMap value mismatch"); - } - } - } - - int nextIntRandom(Random r, int range) { - - int b = r.nextInt(); - - if (b == Integer.MIN_VALUE) { - b = Integer.MAX_VALUE; - } - - b = Math.abs(b); - - return b % range; - } - - public static void main(String[] argv) { - - try { - TestHashStructures test = new TestHashStructures("testHashMap"); - - test.testHashMap(); - test.testIntKeyHashMap(); - test.testHashMappedList(); - test.testDoubleIntLookup(); - test.testDoubleIntSpeed(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestINPredicateParameterizationAndCorrelation.java b/database/hsqldb/src/org/hsqldb/test/TestINPredicateParameterizationAndCorrelation.java deleted file mode 100644 index 03196237..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestINPredicateParameterizationAndCorrelation.java +++ /dev/null @@ -1,222 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -/** - * HSQLDB TestINPredicate Junit test case.

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.7.2 - */ -public class TestINPredicateParameterizationAndCorrelation extends TestBase { - - public TestINPredicateParameterizationAndCorrelation(String name) { - super(name); - } - - /* Implements the TestINPredicate test */ - public void test() throws Exception { - - Connection conn = newConnection(); - Statement stmt = conn.createStatement(); - PreparedStatement pstmt; - ResultSet rs; - int actualCount; - int expectedCount; - String sql; - - stmt.execute("drop table test if exists"); - - sql = "create table test(id int)"; - - stmt.execute(sql); - - sql = "insert into test values(?)"; - pstmt = conn.prepareStatement(sql); - - for (int i = 0; i < 10; i++) { - pstmt.setInt(1, i); - pstmt.addBatch(); - } - - pstmt.executeBatch(); - - // - sql = "select count(*) from test where id in(?,?)"; - pstmt = conn.prepareStatement(sql); - - pstmt.setInt(1, 0); - pstmt.setInt(2, 9); - - rs = pstmt.executeQuery(); - - rs.next(); - - expectedCount = 2; - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - // - sql = "select count(*) from test a, test b where 0 in(a.id, b.id)"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from test a, test b where ? in (a.id, b.id)"; - pstmt = conn.prepareStatement(sql); - - pstmt.setInt(1, 0); - - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - // - expectedCount = 20; - sql = "select count(*) from test a, test b where a.id in(?, ?)"; - pstmt = conn.prepareStatement(sql); - - pstmt.setInt(1, 0); - pstmt.setInt(2, 9); - - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - // - expectedCount = 10; - sql = "select count(*) from test a, test b where ? in(?, b.id)"; - pstmt = conn.prepareStatement(sql); - - pstmt.setInt(1, 0); - pstmt.setInt(2, 9); - - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - // - expectedCount = 1; - sql = "select count(*) from test a where ? in(select b.id from test b where a.id = b.id)"; - pstmt = conn.prepareStatement(sql); - - pstmt.setInt(1, 0); - - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - // - sql = "select count(*) from " - + "(select * from test where id in (1,2)) a," - + "(select * from test where id in (3,4)) b " - + "where a.id < 2 and b.id < 4"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from " - + "(select * from test where id in (?,?)) a," - + "(select * from test where id in (?,?)) b " - + "where a.id < ? and b.id < ?"; - pstmt = conn.prepareStatement(sql); - - pstmt.setInt(1, 1); - pstmt.setInt(2, 2); - pstmt.setInt(3, 3); - pstmt.setInt(4, 4); - pstmt.setInt(5, 2); - pstmt.setInt(6, 4); - - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("row count: ", expectedCount, actualCount); - } - - /* Runs TestINPredicate test from the command line*/ - public static void main(String[] args) throws Exception { - - TestResult result; - TestCase test; - java.util.Enumeration failures; - int count; - - result = new TestResult(); - test = new TestINPredicateParameterizationAndCorrelation("test"); - - test.run(result); - - count = result.failureCount(); - - System.out.println( - "TestINPredicateParameterizationAndCorrelation failure count: " - + count); - - failures = result.failures(); - - while (failures.hasMoreElements()) { - System.out.println(failures.nextElement()); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestInstantiation.java b/database/hsqldb/src/org/hsqldb/test/TestInstantiation.java deleted file mode 100644 index aaf5ed56..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestInstantiation.java +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.IOException; -import java.net.ServerSocket; -import java.net.Socket; -import java.sql.SQLException; - -import org.hsqldb.server.HsqlServerFactory; -import org.hsqldb.server.HsqlSocketRequestHandler; - -/** - * Test the HsqlServerFactory interface. After running, connect to the - * server at port 9999 using the database manager. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.7.0 - */ -public class TestInstantiation { - - public TestInstantiation() { - - try { - ServerSocket serversocket; - Socket socket; - String m_DatabaseName; - HsqlSocketRequestHandler m_hsrh; - - m_DatabaseName = "mem:."; - serversocket = new ServerSocket(9999); - - while (true) { - socket = serversocket.accept(); - m_hsrh = HsqlServerFactory.createHsqlServer(m_DatabaseName, - true, false); - - m_hsrh.handleConnection(socket); - } - } catch (IOException e1) { - System.out.println(e1.getMessage()); - } catch (SQLException e2) { - System.out.println(e2.getMessage()); - } - } - - public static void main(String[] argv) { - new TestInstantiation(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestJDBCGeneratedColumns.java b/database/hsqldb/src/org/hsqldb/test/TestJDBCGeneratedColumns.java deleted file mode 100644 index 6d7add2b..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestJDBCGeneratedColumns.java +++ /dev/null @@ -1,375 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; -import java.sql.SQLException; - -public class TestJDBCGeneratedColumns extends TestBase { - - public TestJDBCGeneratedColumns(String name) { - super(name); - } - - public void testInsert() { - - String s = null; - Connection c = null; - - try { - c = newConnection(); - - Statement st = c.createStatement(); - - s = "DROP TABLE T IF EXISTS"; - - st.execute(s); - - s = "CREATE TABLE T (I INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 33), C CHARACTER(10))"; - - st.execute(s); - st.close(); - - s = "INSERT INTO T (C) VALUES('TEST')"; - } catch (Exception e) { - System.out.print(e); - } - - testWithSQL(c, s); - } - - public void testMerge() { - - String s = null; - Connection c = null; - - try { - c = newConnection(); - - Statement st = c.createStatement(); - - s = "DROP TABLE T IF EXISTS"; - - st.execute(s); - - s = "CREATE TABLE T (I INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 33), C CHARACTER(10))"; - - st.execute(s); - st.close(); - - s = "MERGE INTO T TU USING (VALUES(20)) AS TEMP(ID) ON TU.I = TEMP.ID WHEN NOT MATCHED THEN INSERT(C) VALUES('TEST')"; - } catch (Exception e) { - System.out.print(e); - } - - testWithSQL(c, s); - } - - private void testWithSQL(Connection c, String s) { - - boolean successPrepared = false; - boolean successDirect = false; - - try { - Statement st = c.createStatement(); - - st.execute(s, Statement.RETURN_GENERATED_KEYS); - - ResultSet rs = st.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("generated: " + rs.getInt(1)); - - successDirect = rs.getInt(1) == 33; - } - - PreparedStatement ps = c.prepareStatement(s, - Statement.RETURN_GENERATED_KEYS); - - ps.execute(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared = rs.getInt(1) == 34; - } - - ps.close(); - - ps = c.prepareStatement(s, new int[]{ 1 }); - - ps.execute(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared &= rs.getInt(1) == 35; - } - - ps.close(); - - ps = c.prepareStatement(s, new String[]{ "I" }); - - ps.execute(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared &= rs.getInt(1) == 36; - successPrepared &= rs.getBigDecimal(1).intValue() == 36; - } - - ps.close(); - - ps = c.prepareStatement(s, new String[] { - "I", "C" - }); - - ps.execute(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared &= rs.getInt(1) == 37; - successPrepared &= rs.getBigDecimal(1).intValue() == 37; - successPrepared &= rs.getString(2).startsWith("TEST"); - } - - ps.close(); - - ps = c.prepareStatement(s, new String[] { - "C", "I" - }); - - ps.execute(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(2)); - - successPrepared &= rs.getInt(2) == 38; - successPrepared &= rs.getBigDecimal(2).intValue() == 38; - successPrepared &= rs.getString(1).startsWith("TEST"); - } - - ps.close(); - } catch (Exception e) { - System.out.print(e); - } - - assertTrue(successPrepared); - assertTrue(successDirect); - } - - public void testInsertUpdate() throws SQLException { - - Connection conn = newConnection(); - boolean successPrepared = false; - boolean successDirect = false; - String create = "CREATE TABLE PUBLIC.BEWERTUNG (" - + "BEWERTUNGSID INTEGER NOT NULL IDENTITY," - + "TID INTEGER," + "JURORID INTEGER NOT NULL," - + "RUNDE INTEGER NOT NULL," - + "CONSTRAINT SYS_PK_10126 PRIMARY KEY (BEWERTUNGSID)," - + ") "; - String sqlquery = - "MERGE INTO bewertung pu USING " + "(VALUES ?,?,?) AS " - + "temp (tid,jurorid,runde) " - + "ON temp.tid = pu.tid and temp.jurorid=pu.jurorid and temp.runde=pu.runde " - + "WHEN MATCHED THEN UPDATE SET RUNDE = 103 " - + "WHEN NOT MATCHED THEN INSERT (TID,JURORID,RUNDE) " - + "VALUES (temp.tid,temp.jurorid,temp.runde)"; - - conn.createStatement().execute(create); - PreparedStatement preparedStatement = conn.prepareStatement(sqlquery, - Statement.RETURN_GENERATED_KEYS); - - preparedStatement.setInt(1, 1); //TID - preparedStatement.setInt(2, 2); //JURORID - preparedStatement.setInt(3, 3); //RUNDE - - int rowsAffected = preparedStatement.executeUpdate(); - ResultSet rs = preparedStatement.getGeneratedKeys(); - - if (rs.next()) { - System.out.println(rs.getInt(1)); - } else { - assertTrue(rowsAffected == 0); - } - - rowsAffected = preparedStatement.executeUpdate(); - rs = preparedStatement.getGeneratedKeys(); - - if (rs.next()) { - System.out.println(rs.getInt(1)); - } else { - assertTrue(rowsAffected == 0); - } - } - - public void testBatchInsert() { - - boolean successPrepared = false; - boolean successDirect = false; - - try { - Connection c = newConnection(); - Statement st = c.createStatement(); - String s = "DROP TABLE T IF EXISTS"; - - st.execute(s); - - s = "CREATE TABLE T (I INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 33), C CHARACTER(10))"; - - st.execute(s); - - s = "INSERT INTO T (C) VALUES('TEST')"; - - PreparedStatement ps = c.prepareStatement(s, - Statement.RETURN_GENERATED_KEYS); - - ps.addBatch(); - ps.addBatch(); - ps.executeBatch(); - - ResultSet rs = ps.getGeneratedKeys(); - int val = 33; - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared = rs.getInt(1) == val; - - val++; - } - - ps.close(); - - ps = c.prepareStatement(s, new int[]{ 1 }); - - ps.addBatch(); - ps.addBatch(); - ps.executeBatch(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared &= rs.getInt(1) == val; - - val++; - } - - ps.close(); - - ps = c.prepareStatement(s, new String[]{ "I" }); - - ps.addBatch(); - ps.addBatch(); - ps.executeBatch(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared &= rs.getInt(1) == val; - successPrepared &= rs.getBigDecimal(1).intValue() == val; - - val++; - } - - ps.close(); - - ps = c.prepareStatement(s, new String[] { - "I", "C" - }); - - ps.addBatch(); - ps.addBatch(); - ps.executeBatch(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(1)); - - successPrepared &= rs.getInt("I") == val; - successPrepared &= rs.getBigDecimal(1).intValue() == val; - successPrepared &= rs.getString("C").startsWith("TEST"); - - val++; - } - - ps.close(); - - ps = c.prepareStatement(s, new String[] { - "C", "I" - }); - - ps.addBatch(); - ps.addBatch(); - ps.executeBatch(); - - rs = ps.getGeneratedKeys(); - - while (rs.next()) { - System.out.println("" + rs.getInt(2)); - - successPrepared &= rs.getInt(2) == val; - successPrepared &= rs.getBigDecimal(2).intValue() == val; - successPrepared &= rs.getString(1).startsWith("TEST"); - - val++; - } - - ps.close(); - } catch (Exception e) { - System.out.print(e); - } - - assertTrue(successPrepared); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestJDBCSavepoints.java b/database/hsqldb/src/org/hsqldb/test/TestJDBCSavepoints.java deleted file mode 100644 index f9290d19..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestJDBCSavepoints.java +++ /dev/null @@ -1,568 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Savepoint; -import java.sql.Statement; - -import org.hsqldb.server.WebServer; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -import org.hsqldb.server.Server; - -/** - * Tests JDBC java.sql.Savepoint support in context of new engine SQL-savepoint - * support and new HSQL protocol extensions for savepoint support.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.7.2 - * @since 1.7.2 - */ -public class TestJDBCSavepoints extends TestCase { - -// You change the url and serverProps to reflect your preferred settings - // String serverProps = "database.0=mem:test;dbname.0=;silent=false;trace=true" // debugging - String serverProps = - "database.0=mem:test;dbname.0=;silent=true;trace=false"; - String url = "jdbc:hsqldb:hsql://localhost"; - - // String url = "jdbc:hsqldb:http://localhost"; - String user; - String password; - Statement stmt; - Connection conn1; - Connection conn2; - - // Server server; - // this exercises everything: - // the engine and JDBC savepoint support, - // the new HSQL protocol and tunneling HSQL protocol over HTTP - Server server; - - public TestJDBCSavepoints(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - user = "sa"; - password = ""; - stmt = null; - conn1 = null; - conn2 = null; - server = new Server(); - -// server = new WebServer(); - server.putPropertiesFromString(serverProps); - server.start(); - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - conn1 = DriverManager.getConnection(url, user, password); - conn2 = DriverManager.getConnection(url, user, password); - stmt = conn1.createStatement(); - } catch (Exception e) { - - //e.printStackTrace(); - System.out.println(this + ".setUp() error: " + e.getMessage()); - throw e; - } - } - - protected void tearDown() { - - try { - conn1.close(); - } catch (Exception e) { - - //e.printStackTrace(); - System.out.println(this + ".tearDown() error: " + e.getMessage()); - } - - try { - conn2.close(); - } catch (Exception e) { - - //e.printStackTrace(); - System.out.println(this + ".tearDown() error: " + e.getMessage()); - } - - server.stop(); - } - - public void testJDBCSavepoints() throws Exception { - - String sql; - String msg; - int i; - PreparedStatement ps; - ResultSet rs; - Savepoint sp1; - Savepoint sp2; - Savepoint sp3; - Savepoint sp4; - Savepoint sp5; - Savepoint sp6; - Savepoint sp7; - int rowcount = 0; - - sql = "drop table t if exists"; - - stmt.executeUpdate(sql); - - sql = "create table t(id int, fn varchar(40), ln varchar(40), zip int)"; - - stmt.executeUpdate(sql); - conn1.setAutoCommit(true); - - //-- Test 1 : The execution of an SQL savepoint statement shall - // raise an exception in the absence of an active - // enclosing transaction - // fredt@users - there is always an active transaction when autocommit - // is true. The transaction is committed automatically if the next - // Statement.execute() or similar call is performed successfully. -/* - msg = "savepoint set successfully in the abscence of an active transaction"; - try { - conn.setSavepoint("savepoint1"); - assertTrue(msg,false); - } catch (Exception e) {} - -*/ - - //-- setup for following tests - conn1.setAutoCommit(false); - - sql = "insert into t values(?,?,?,?)"; - ps = conn1.prepareStatement(sql); - - ps.setString(2, "Mary"); - ps.setString(3, "Peterson-Clancy"); - - i = 0; - - for (; i < 10; i++) { - ps.setInt(1, i); - ps.setInt(4, i); - ps.executeUpdate(); - } - - sp1 = conn1.setSavepoint("savepoint1"); - - for (; i < 20; i++) { - ps.setInt(1, i); - ps.setInt(4, i); - ps.executeUpdate(); - } - - sp2 = conn1.setSavepoint("savepoint2"); - - for (; i < 30; i++) { - ps.setInt(1, i); - ps.setInt(4, i); - ps.executeUpdate(); - } - - sp3 = conn1.setSavepoint("savepoint3"); - - for (; i < 40; i++) { - ps.setInt(1, i); - ps.setInt(4, i); - ps.executeUpdate(); - } - - sp4 = conn1.setSavepoint("savepoint4"); - - for (; i < 50; i++) { - ps.setInt(1, i); - ps.setInt(4, i); - ps.executeUpdate(); - } - - sp5 = conn1.setSavepoint("savepoint5"); - sp6 = conn1.setSavepoint("savepoint6"); - sp7 = conn1.setSavepoint("savepoint7"); - rs = stmt.executeQuery("select count(*) from t"); - - rs.next(); - - rowcount = rs.getInt(1); - - rs.close(); - - //-- Test 2 : count of rows matches # rows inserted (assertion req'd by - // following tests, but not directly related to the feature - // being tested) - msg = "select count(*) from t value"; - - try { - assertEquals(msg, 50, rowcount); - } catch (Exception e) {} - - conn2.setAutoCommit(false); - conn2.setSavepoint("savepoint1"); - conn2.setSavepoint("savepoint2"); - - //-- test 3 : A JDBC Savepoint shall be considered invalid if used to - // release an SQL-savepoint in an SQL-session other than that - // of the originating Connection object - msg = "savepoint released succesfully on non-originating connection"; - - try { - conn2.releaseSavepoint(sp2); - assertTrue(msg, false); - } catch (Exception e) {} - - //-- test 4 : A JDBC Savepoint shall be invalid if used to roll back to - // an SQL-savepoint in an SQL-session other than that of the - // originating Connection object - try { - conn2.rollback(sp1); - - msg = "succesful rollback to savepoint on " - + "non-originating connection"; - - assertTrue(msg, false); - } catch (Exception e) {} - - //-- test 5 : Direct execution of a statement shall - // not fail to release an existing indicated savepoint, - // regardless of how the indicated savepoint was created - msg = "direct execution of statement failed to " - + "release JDBC-created SQL-savepoint with identical savepoint name"; - - try { - conn2.createStatement().executeUpdate( - "release savepoint \"savepoint2\""); - } catch (Exception e) { - try { - assertTrue(msg, false); - } catch (Exception e2) {} - } - - //-- test 6 : Direct execution of a statement - // shall not fail to roll back to an existing indicated - // savepoint due and only due to how the indicated savepoint - // was created - msg = "direct execution of statement failed to " - + "roll back to existing JDBC-created SQL-savepoint with identical " - + "savepoint name"; - - try { - conn2.createStatement().executeUpdate( - "rollback to savepoint \"savepoint1\""); - } catch (Exception e) { - e.printStackTrace(); - - try { - assertTrue(msg, false); - } catch (Exception e2) {} - } - - conn1.releaseSavepoint(sp6); - - //-- test 7 : Releasing an SQL-savepoint shall destroy that savepoint - msg = "savepoint released succesfully > 1 times"; - - try { - conn1.releaseSavepoint(sp6); - assertTrue(msg, false); - } catch (Exception e) {} - - //-- test 8 : Releasing an SQL-savepoint shall destroy all subsequent SQL- - // savepoints in the same savepoint level - msg = "savepoint released successfully after preceding savepoint released"; - - try { - conn1.releaseSavepoint(sp7); - assertTrue(msg, false); - } catch (Exception e) {} - - //-- test 9 : Releasing an SQL-savepoint shall not affect preceding - // savepoints - msg = "preceding same-point savepoint destroyed by following savepoint release"; - - try { - conn1.releaseSavepoint(sp5); - } catch (Exception e) { - try { - assertTrue(msg, false); - } catch (Exception e2) {} - } - - conn1.rollback(sp4); - - rs = stmt.executeQuery("select count(*) from t"); - - rs.next(); - - rowcount = rs.getInt(1); - - rs.close(); - - //-- Test 10 : count of rows matches # rows inserted less the number - // of insertions rolled back - msg = "select * rowcount after 50 inserts - 10 rolled back:"; - - try { - assertEquals(msg, 40, rowcount); - } catch (Exception e) {} - - //-- test 11 : An SQL-savepoint shall be destroyed in the - // process of rolling back to that savepoint - msg = "savepoint rolled back succesfully > 1 times"; - - try { - conn1.rollback(sp4); - assertTrue(msg, false); - } catch (Exception e) {} - - conn1.rollback(sp3); - - rs = stmt.executeQuery("select count(*) from t"); - - rs.next(); - - rowcount = rs.getInt(1); - - rs.close(); - - //-- Test 12 : count of rows matches # rows inserted less the number - // of insertions rolled back - msg = "select count(*) after 50 inserts - 20 rolled back:"; - - try { - assertEquals(msg, 30, rowcount); - } catch (Exception e) {} - - //-- test 13 : An SQL-savepoint shall be destroyed in the - // process of rolling back to that savepoint - msg = "savepoint released succesfully after use in rollback"; - - try { - conn1.releaseSavepoint(sp3); - assertTrue(msg, false); - } catch (Exception e) {} - - conn1.rollback(sp1); - - //-- test 14 : All subsequent savepoints (in a savepoint level) - // shall be destroyed by the process of rolling back to - // a preceeding savepoint (in the same savepoint level) - msg = "savepoint rolled back without raising an exception after " - + "rollback to a preceeding savepoint"; - - try { - conn1.rollback(sp2); - assertTrue(msg, false); - } catch (Exception e) {} - - conn1.rollback(); - - //-- test 15 : All subsequent savepoints (in a savepoint level) - // shall be destroyed by the process of - // rolling back the active transaction - msg = "savepoint released succesfully when it should have been " - + "destroyed by a full rollback"; - - try { - conn1.releaseSavepoint(sp1); - assertTrue(msg, false); - } catch (Exception e) {} - - conn1.setAutoCommit(false); - - sp1 = conn1.setSavepoint("savepoint1"); - - conn1.rollback(); - conn1.setAutoCommit(false); - conn1.createStatement().executeUpdate("savepoint \"savepoint1\""); - - //-- test 16 : A JDBC Savepoint shall be considered invalid if used to - // release an SQL-savepoint other than precisely the - // one created in correspondence to the creation of that - // JDBC Savepoint object - // fredt@users - we allow this if the name is valid -/* - msg = "JDBC Savepoint used to successfully release an identically named " - + "savepoint in a transaction distinct from the originating " - + "transaction"; - try { - conn1.releaseSavepoint(sp1); - assertTrue(msg, false); - } catch (Exception e) {} -*/ - conn1.setAutoCommit(false); - - sp1 = conn1.setSavepoint("savepoint1"); - - conn1.createStatement().executeUpdate("savepoint \"savepoint1\""); - - //-- test 17 : A JDBC Savepoint shall be considered invalid if used to - // release an SQL-savepoint other than precisely the - // one created in correspondence to the creation of that - // JDBC Savepoint object - // fredt@users - we allow this if the name is valid -/* - msg = "JDBC Savepoint used to successfully release an identically named " - + "savepoint in a transaction other than the originating " - + "transaction"; - try { - conn1.releaseSavepoint(sp1); - assertTrue(msg, false); - } catch (Exception e) {} -*/ - - //-- test 18 : A JDBC Savepoint shall be considered invalid if used to - // roll back to an SQL-savepoint other than precisely the - // one created in correspondence to the creation of that - // JDBC Savepoint object - // fredt@users - we allow this if the name is valid -/* - msg = "JDBC Savepoint used to successfully to roll back to an " - + "identically named savepoint in a transaction distinct " - + "from the originating transaction"; - try { - conn1.rollback(sp1); - assertTrue(msg, false); - } catch (Exception e) {} -*/ - conn1.setAutoCommit(false); - - sp1 = conn1.setSavepoint("savepoint1"); - - conn1.createStatement().executeUpdate("savepoint \"savepoint1\""); - - //-- test 19 : A JDBC Savepoint shall be considered invalid if used to - // roll back to an SQL-savepoint other than precisely the - // one created in correspondence to the creation of that - // JDBC Savepoint object - // fredt@users - we allow this if the name is valid -/* - msg = "JDBC Savepoint used to successfully release an identically named " - + "savepoint in a transaction other than the originating " - + "transaction"; - try { - conn1.releaseSavepoint(sp1); - assertTrue(msg, false); - } catch (Exception e) {} -*/ - } - - public void testJDBCAutoSavepoints() throws Exception { - - String sql; - int i; - PreparedStatement ps; - ResultSet rs; - Savepoint sp1; - int rowcount = 0; - - sql = "drop table t if exists"; - - stmt.executeUpdate(sql); - - sql = "create table t(id int, fn varchar(40), ln varchar(40), zip int)"; - - stmt.executeUpdate(sql); - - //-- setup for following tests - conn1.setAutoCommit(false); - - sql = "insert into t values(?,?,?,?)"; - ps = conn1.prepareStatement(sql); - - ps.setString(2, "Mary"); - ps.setString(3, "Peterson-Clancy"); - - i = 0; - - for (; i < 10; i++) { - ps.setInt(1, i); - ps.setInt(4, i); - ps.executeUpdate(); - } - - sp1 = conn1.setSavepoint(); - - for (; i < 12; i++) { - ps.setInt(1, i); - ps.setInt(4, i); - ps.executeUpdate(); - } - - conn1.rollback(sp1); - - rs = stmt.executeQuery("select count(*) from t"); - - rs.next(); - - rowcount = rs.getInt(1); - - assertEquals(10, rowcount); - rs.close(); - } - - /** - * @param args the command line arguments - */ - public static void main(String[] args) throws Exception { - - TestResult result; - TestCase test; - java.util.Enumeration failures; - int count; - - result = new TestResult(); - test = new TestJDBCSavepoints("testJDBCSavepoints"); - - test.run(result); - - count = result.failureCount(); - - System.out.println("TestJDBCSavepoints failure count: " + count); - - failures = result.failures(); - - while (failures.hasMoreElements()) { - System.out.println(failures.nextElement()); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestJavaFunctions.java b/database/hsqldb/src/org/hsqldb/test/TestJavaFunctions.java deleted file mode 100644 index d7125ff2..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestJavaFunctions.java +++ /dev/null @@ -1,384 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.math.BigInteger; -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; - -import org.hsqldb.jdbc.JDBCConnection; -import org.hsqldb.jdbc.JDBCResultSet; -import org.hsqldb.navigator.RowSetNavigator; -import org.hsqldb.navigator.RowSetNavigatorClient; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultMetaData; -import org.hsqldb.types.BinaryData; -import org.hsqldb.types.Type; - -//#ifdef JAVA8 -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.OffsetTime; -import java.time.ZoneOffset; -//#endif JAVA8 - -public class TestJavaFunctions extends TestBase { - - public TestJavaFunctions() { - super("TestJavaFunction"); - } - - protected void setUp() throws Exception { - - super.setUp(); - - try { - prepareDatabase(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - void prepareDatabase() throws SQLException { - - Connection c = newConnection(); - Statement s = c.createStatement(); - - s.executeUpdate("DROP FUNCTION TEST_QUERY IF EXISTS"); - s.executeUpdate("DROP FUNCTION TEST_CUSTOM_RESULT IF EXISTS"); - s.executeUpdate("DROP FUNCTION SORT_BYTE_ARRAY IF EXISTS"); - s.executeUpdate("DROP TABLE T IF EXISTS"); - s.executeUpdate("CREATE TABLE T(C VARCHAR(20), I INT)"); - s.executeUpdate("INSERT INTO T VALUES 'Thames', 10"); - s.executeUpdate("INSERT INTO T VALUES 'Fleet', 12"); - s.executeUpdate("INSERT INTO T VALUES 'Brent', 14"); - s.executeUpdate("INSERT INTO T VALUES 'Westbourne', 16"); - s.executeUpdate( - "CREATE FUNCTION TEST_QUERY(INT) RETURNS TABLE(N VARCHAR(20), I INT) " - + " READS SQL DATA LANGUAGE JAVA EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestJavaFunctions.getQueryResult'"); - s.executeUpdate( - "CREATE FUNCTION TEST_CUSTOM_RESULT(BIGINT, BIGINT) RETURNS TABLE(I BIGINT, N VARBINARY(1000)) " - + " READS SQL DATA LANGUAGE JAVA EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestJavaFunctions.getCustomResult'"); - s.executeUpdate( - "CREATE FUNCTION SORT_BYTE_ARRAY(VARBINARY(20)) RETURNS VARBINARY(20) " - + " NO SQL LANGUAGE JAVA EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestJavaFunctions.getSortedByteArray'"); - s.executeUpdate("CHECKPOINT"); - c.close(); - } - - public void testOne() throws SQLException { - - Connection c = newConnection(); - CallableStatement s = c.prepareCall("CALL TEST_QUERY(16)"); - - s.execute(); - - ResultSet r = s.getResultSet(); - - while (r.next()) { - String temp = "" + r.getInt(2) + " " + r.getString(1); - - System.out.println(temp); - } - - s = c.prepareCall("CALL TEST_CUSTOM_RESULT(6, 19)"); - - s.execute(); - - r = s.getResultSet(); - - while (r.next()) { - String temp = - "" + r.getLong(1) + " " - + org.hsqldb.lib.StringConverter.byteArrayToSQLHexString( - r.getBytes(2)); - - System.out.println(temp); - } - - r = s.executeQuery(); - s = c.prepareCall("CALL TEST_CUSTOM_RESULT(6, 1900)"); - - try { - s.execute(); - - r = s.getResultSet(); - - fail("exception not thrown"); - } catch (SQLException e) { - System.out.println(e.getMessage()); - } - - c.close(); - } - -//#ifdef JAVA8 - public void testTwo() throws SQLException { - - Connection c = newConnection(); - Statement statement = c.createStatement(); - - // create function and link it to Java method - statement.executeUpdate( - "CREATE FUNCTION EXAMPLE_FUNCTION (months INTERVAL MONTH, days INTERVAL DAY)" - + " RETURNS CHAR VARYING(100)" - + " LANGUAGE JAVA DETERMINISTIC NO SQL" - + " EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestJavaFunctions.exampleIntervalFunction';"); - - // use the function and print the result - final ResultSet result = statement.executeQuery( - "CALL EXAMPLE_FUNCTION(INTERVAL '3' MONTH, INTERVAL '5' DAY)"); - - while (result.next()) { - System.out.println(result.getString(1)); - } - } - - public void testThree() throws SQLException { - - Connection c = newConnection(); - Statement statement = c.createStatement(); - - // create function and link it to Java method - statement.executeUpdate( - "CREATE FUNCTION TIMESTAMP_FUNCTION (ts TIMESTAMP, tsz TIMESTAMP WITH TIME ZONE)" - + " RETURNS CHAR VARYING(100)" - + " LANGUAGE JAVA DETERMINISTIC NO SQL" - + " EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestJavaFunctions.exampleTimestampFunction';"); - - // use the function and print the result - ResultSet result = statement.executeQuery( - "CALL TIMESTAMP_FUNCTION(TIMESTAMP'2019-01-01 01:02:03', TIMESTAMP'2019-01-01 01:02:03+5:00')"); - - while (result.next()) { - System.out.println(result.getString(1)); - } - - System.out.println( - "TIMESTAMP'2019-01-01 01:02:03', TIMESTAMP'2019-01-01 01:02:03+5:00'"); - System.out.println(OffsetDateTime.of(2019, 1, 1, 1, 2, 3, 0, - ZoneOffset.ofHours(5))); - - result = - statement.executeQuery("CALL TIMESTAMP'2019-01-01 01:02:03+5:00'"); - - while (result.next()) { - System.out.println(result.getString(1)); - } - } - - public void testFour() throws SQLException { - - Connection c = newConnection(); - Statement statement = c.createStatement(); - - // create function and link it to Java method - statement.executeUpdate( - "CREATE FUNCTION TIME_FUNCTION (t TIME, tz TIME WITH TIME ZONE)" - + " RETURNS CHAR VARYING(100)" - + " LANGUAGE JAVA DETERMINISTIC NO SQL" - + " EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestJavaFunctions.exampleTimeFunction';"); - - // use the function and print the result - ResultSet result = statement.executeQuery( - "CALL TIME_FUNCTION(TIME'01:02:03', TIME'01:02:03+5:00')"); - - while (result.next()) { - System.out.println(result.getString(1)); - } - - System.out.println("TIME'01:02:03', TIME'01:02:03+5:00'"); - System.out.println(OffsetTime.of(1, 2, 3, 0, ZoneOffset.ofHours(5))); - - result = statement.executeQuery("CALL TIME'01:02:03+5:00'"); - - while (result.next()) { - System.out.println(result.getString(1)); - } - } - - public void testFive() throws SQLException { - - Connection connection = newConnection(); - Statement statement = connection.createStatement(); - - statement.execute("DROP TABLE IF EXISTS ts CASCADE"); - statement.execute( - "CREATE TABLE ts (id INTEGER PRIMARY KEY, expiry TIMESTAMP(9))"); - - String insert = "INSERT INTO ts (id, expiry) VALUES(1, ?)"; - PreparedStatement preparedStatement = - connection.prepareStatement(insert); - Timestamp timestampBefore = new Timestamp(System.currentTimeMillis()); - - timestampBefore.setNanos(123456789); - preparedStatement.setTimestamp(1, timestampBefore); - preparedStatement.executeUpdate(); - - ResultSet resultSet = - statement.executeQuery("SELECT id, expiry from ts where id = 1"); - - if (resultSet.next()) { - Timestamp timestampAfter = resultSet.getTimestamp("expiry"); - - assertEquals(timestampBefore, timestampAfter); - } - - statement.execute("DELETE FROM ts"); - - Instant inst = Instant.ofEpochSecond(0, 123456789); - preparedStatement.setObject(1, inst); - preparedStatement.executeUpdate(); - - resultSet = - statement.executeQuery("SELECT id, expiry from ts where id = 1"); - - if (resultSet.next()) { - Timestamp timestampAfter = resultSet.getTimestamp("expiry"); - - assertEquals(inst.getEpochSecond(), timestampAfter.getTime() / 1000); - assertEquals(inst.getNano(), timestampAfter.getNanos()); - } - } - - public static String exampleIntervalFunction(final java.time.Period months, - final java.time.Duration days) { - return "[months, days] : " + months.toString() + ", " - + days.toString(); - } - - public static String exampleTimestampFunction(final java.sql.Timestamp ts, - final java.time.OffsetDateTime tsz) { - return "[ts, tsz] : " + ts.toString() + ", " + tsz.toString(); - } - - public static String exampleTimeFunction(final java.sql.Time t, - final java.time.OffsetTime tz) { - return "[ts, tsz] : " + t.toString() + ", " + tz.toString(); - } - -//#endif JAVA8 - public static ResultSet getQueryResult(Connection connection, - int i) throws SQLException { - - Statement st = connection.createStatement(); - - return st.executeQuery("SELECT * FROM T WHERE I < " + i); - } - - public static ResultSet getQueryResult(Connection connection, - String p1) throws SQLException { - return getQueryResult(connection, 13); - } - - public static ResultSet getQueryResult(Connection connection, String p1, - String p2) throws SQLException { - return getQueryResult(connection, 20); - } - - public static byte[] getSortedByteArray(byte[] bytes) throws SQLException { - - bytes = (byte[]) java.util.Arrays.copyOf(bytes, bytes.length); - - java.util.Arrays.sort(bytes); - - return bytes; - } - - public static byte[][] getSortedArrayByteArray(byte[][] bytes) - throws SQLException { - - bytes = (byte[][]) java.util.Arrays.copyOf(bytes, bytes.length); - - java.util.Arrays.sort(bytes); - - return bytes; - } - - private static Result newTwoColumnResult() { - - Type[] types = new Type[2]; - - types[0] = Type.SQL_BIGINT; - types[1] = Type.SQL_VARBINARY_DEFAULT; - - ResultMetaData meta = ResultMetaData.newSimpleResultMetaData(types); - RowSetNavigator navigator = new RowSetNavigatorClient(); - Result result = Result.newDataResult(meta); - - result.setNavigator(navigator); - - return result; - } - - public static ResultSet getCustomResult(Connection connection, long start, - long end) throws SQLException { - - Result result = newTwoColumnResult(); - - if (end < start) { - long temp = start; - - start = end; - end = temp; - } - - if (end > 1000) { - throw org.hsqldb.jdbc.JDBCUtil.invalidArgument( - "value larger than 100"); - } - - if (end > start + 100) { - end = start + 100; - } - - for (long i = start; i < end; i++) { - Object[] row = new Object[2]; - - row[0] = Long.valueOf(i); - row[1] = new BinaryData(BigInteger.valueOf(i).toByteArray(), - false); - - result.navigator.add(row); - } - - result.navigator.reset(); - - return new JDBCResultSet((JDBCConnection) connection, null, result, - result.metaData); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestKarl.java b/database/hsqldb/src/org/hsqldb/test/TestKarl.java deleted file mode 100644 index db8a03b2..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestKarl.java +++ /dev/null @@ -1,286 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.sql.Connection; -import java.sql.Date; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Calendar; -import java.util.GregorianCalendar; - -/** - * @author karl - * - */ -public class TestKarl { - - static final String SHUTDOWN = "SHUTDOWN"; - static final String SHUTDOWN_IMMEDIATELY = "SHUTDOWN IMMEDIATELY"; - static final String SHUTDOWN_COMPACT = "SHUTDOWN COMPACT"; - - public static void main(String[] args) { - - Connection c = null; - - try { - - //copy db - File f = new File("db"); - - if (!f.exists()) { - f.mkdir(); - } else { - File[] list = f.listFiles(); - - for (int i = 0; i < list.length; i++) { - list[i].delete(); - } - } - - copy("save/brwahl.properties", "db/brwahl.properties"); - copy("save/brwahl.script", "db/brwahl.script"); - copy("save/waehler.csv", "db/waehler.csv"); - - // config test - String shutdown = SHUTDOWN; - boolean autocommit = false; - - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - c = DriverManager.getConnection("jdbc:hsqldb:file:db/brwahl", - "sa", ""); - - c.setAutoCommit(autocommit); - - // open ok - printMeta(c); - printTable(c, "WAEHLER"); - - // test existing - doUpdateInsertDeleteWaehler(c); - printTable(c, "WAEHLER"); - - // test new - doCreateTableTest(c); - printTable(c, "TEST"); - - // colse - Statement st = c.createStatement(); - - st.execute(shutdown); - st.close(); - c.close(); - - c = null; - - // reopen test - System.out.println("\nDB OK? ..."); - - c = DriverManager.getConnection("jdbc:hsqldb:file:db/brwahl", - "sa", ""); - - c.setAutoCommit(false); - printTable(c, "WAEHLER"); - printTable(c, "TEST"); - doUpdateInsertDeleteWaehler(c); - c.rollback(); - - if (!autocommit) { - doCreateTableTest(c); - c.rollback(); - } - - c.close(); - - c = null; - } catch (SQLException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (c != null) { - try { - c.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - } - } - - private static void doCreateTableTest(Connection p_connection) - throws SQLException { - - System.out.println("CREATE TESTTABLE START ..."); - - Statement st = p_connection.createStatement(); - - st.executeUpdate("DROP TABLE TEST IF EXISTS"); - st.executeUpdate("CREATE TABLE TEST (TEST INTEGER)"); - st.close(); - System.out.println("END CREATE TESTTABLE"); - System.out.println("INSERT INTO TESTTABLE START ..."); - - PreparedStatement p = p_connection.prepareStatement( - "INSERT INTO TEST (TEST) values (?)"); - - p.setInt(1, 123); - p.execute(); - p.close(); - System.out.println("END INSERT INTO TESTTABLE"); - } - - private static void doUpdateInsertDeleteWaehler(Connection p_connection) - throws SQLException { - - System.out.println("UPDATE WAEHLER START ..."); - - PreparedStatement p = p_connection.prepareStatement( - "UPDATE WAEHLER SET AUSTRITTSDATUM=? WHERE NAME=?"); - - p.setDate(1, null); - p.setString(2, "Muster1"); - p.execute(); - p.close(); - System.out.println("END UPDATE WAEHLER"); - System.out.println("INSERT INTO WAEHLER START ..."); - - p = p_connection.prepareStatement( - "INSERT INTO WAEHLER (NAME, AUSTRITTSDATUM) VALUES (?,?)"); - - Calendar cal = GregorianCalendar.getInstance(); - - p.setString(1, "Muster3"); - p.setDate(2, new Date(cal.getTimeInMillis()), cal); - p.execute(); - p.close(); - System.out.println("END INSERT INTO WAEHLER"); - System.out.println("DELETE FROM WAEHLER START ..."); - - p = p_connection.prepareStatement( - "DELETE FROM WAEHLER WHERE NAME = ?"); - - p.setString(1, "Muster2"); - p.execute(); - p.close(); - System.out.println("END DELETE FROM WAEHLER"); - } - - private static void printTable(Connection p_connection, - String p_table) throws SQLException { - - System.out.println("GET TABLE " + p_table + " START ..."); - - Statement st = p_connection.createStatement(); - ResultSet rs = st.executeQuery("SELECT * FROM " + p_table); - int col_count = rs.getMetaData().getColumnCount(); - - for (int i = 1; i <= col_count; i++) { - System.out.print(rs.getMetaData().getColumnLabel(i) + "\t"); - } - - System.out.println(); - - while (rs.next()) { - for (int i = 1; i <= col_count; i++) { - System.out.print(rs.getObject(i)); - System.out.print("\t"); - } - - System.out.println(); - } - - st.close(); - System.out.println("... END GET TABLE " + p_table); - } - - private static void printMeta(Connection p_connection) - throws SQLException { - - System.out.println("GET METADATA START ..."); - - ResultSet rs = p_connection.getMetaData().getTables(null, null, null, - null); - - System.out.println(rs.toString()); - - int col_count = rs.getMetaData().getColumnCount(); - - for (int i = 1; i <= col_count; i++) { - System.out.print(rs.getMetaData().getColumnLabel(i) + "\t"); - } - - System.out.println(); - - while (rs.next()) { - for (int i = 1; i <= col_count; i++) { - System.out.print(rs.getObject(i)); - System.out.print("\t"); - } - - System.out.println(); - } - - System.out.println("END GET METADATA"); - } - - private static void copy(String src, String dest) throws IOException { - - File inputFile = new File(src); - File outputFile = new File(dest); - - if (!inputFile.exists()) { - return; - } - - FileInputStream in = new FileInputStream(inputFile); - FileOutputStream out = new FileOutputStream(outputFile); - int c; - - while ((c = in.read()) != -1) { - out.write(c); - } - - in.close(); - out.close(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestLibSpeed.java b/database/hsqldb/src/org/hsqldb/test/TestLibSpeed.java deleted file mode 100644 index e8575d2c..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestLibSpeed.java +++ /dev/null @@ -1,239 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import org.hsqldb.lib.DoubleIntIndex; -import org.hsqldb.lib.HashSet; -import org.hsqldb.lib.IntKeyHashMap; -import org.hsqldb.lib.IntKeyIntValueHashMap; -import org.hsqldb.lib.IntValueHashMap; -import org.hsqldb.lib.StopWatch; - -/** - * @author Fred Toussi (fredt@users dot sourceforge.net) - */ -public class TestLibSpeed { - - static final String[][] sNumeric = { - { - "ABS", "org.hsqldb.Library.abs" - }, { - "ACOS", "java.lang.Math.acos" - }, { - "ASIN", "java.lang.Math.asin" - }, { - "ATAN", "java.lang.Math.atan" - }, { - "ATAN2", "java.lang.Math.atan2" - }, { - "CEILING", "java.lang.Math.ceil" - }, { - "COS", "java.lang.Math.cos" - }, { - "COT", "org.hsqldb.Library.cot" - }, { - "DEGREES", "java.lang.Math.toDegrees" - }, { - "EXP", "java.lang.Math.exp" - }, { - "FLOOR", "java.lang.Math.floor" - }, { - "LOG", "java.lang.Math.log" - }, { - "LOG10", "org.hsqldb.Library.log10" - }, { - "MOD", "org.hsqldb.Library.mod" - }, { - "PI", "org.hsqldb.Library.pi" - }, { - "POWER", "java.lang.Math.pow" - }, { - "RADIANS", "java.lang.Math.toRadians" - }, { - "RAND", "java.lang.Math.random" - }, { - "ROUND", "org.hsqldb.Library.round" - }, { - "SIGN", "org.hsqldb.Library.sign" - }, { - "SIN", "java.lang.Math.sin" - }, { - "SQRT", "java.lang.Math.sqrt" - }, { - "TAN", "java.lang.Math.tan" - }, { - "TRUNCATE", "org.hsqldb.Library.truncate" - }, { - "BITAND", "org.hsqldb.Library.bitand" - }, { - "BITOR", "org.hsqldb.Library.bitor" - }, { - "ROUNDMAGIC", "org.hsqldb.Library.roundMagic" - } - }; - static HashSet hashSet = new HashSet(); - static DoubleIntIndex doubleIntLookup = - new DoubleIntIndex(sNumeric.length); - static IntKeyIntValueHashMap intKeyIntValueHashLookup = - new IntKeyIntValueHashMap(); - static IntValueHashMap intValueHashLookup = - new IntValueHashMap(sNumeric.length); - static IntKeyHashMap intKeyHashLookup = new IntKeyHashMap(); - - static { - doubleIntLookup.setKeysSearchTarget(); - - java.util.Random randomgen = new java.util.Random(); - int[] row = new int[2]; - - for (int i = 0; i < sNumeric.length; i++) { - hashSet.add(sNumeric[i][0]); - intKeyIntValueHashLookup.put(randomgen.nextInt(sNumeric.length), - i); - intKeyHashLookup.put(i, Integer.valueOf(i)); - doubleIntLookup.add(randomgen.nextInt(sNumeric.length), i); - intValueHashLookup.put(sNumeric[i][0], - randomgen.nextInt(sNumeric.length)); - } - } - - static int count = 100000; - - public TestLibSpeed() { - - java.util.Random randomgen = new java.util.Random(); - StopWatch sw = new StopWatch(); - int dummy = 0; - - System.out.println("set lookup "); - - for (int k = 0; k < 3; k++) { - sw.zero(); - - for (int j = 0; j < count; j++) { - for (int i = 0; i < sNumeric.length; i++) { - int r = randomgen.nextInt(sNumeric.length); - - hashSet.contains(sNumeric[r][0]); - - dummy += r; - } - } - - System.out.println("HashSet contains " + sw.elapsedTime()); - sw.zero(); - - for (int j = 0; j < count; j++) { - for (int i = 0; i < sNumeric.length; i++) { - int r = randomgen.nextInt(sNumeric.length); - - intKeyIntValueHashLookup.get(r, -1); - - dummy += r; - } - } - - System.out.println("IntKeyIntValueHashMap Lookup with array " - + sw.elapsedTime()); - sw.zero(); - - for (int j = 0; j < count; j++) { - for (int i = 0; i < sNumeric.length; i++) { - int r = randomgen.nextInt(sNumeric.length); - - intKeyHashLookup.get(r); - - dummy += r; - } - } - - System.out.println("IntKeyHashMap Lookup " + sw.elapsedTime()); - sw.zero(); - - for (int j = 0; j < count; j++) { - for (int i = 0; i < sNumeric.length; i++) { - int r = randomgen.nextInt(sNumeric.length); - - doubleIntLookup.findFirstEqualKeyIndex(r); - - dummy += r; - } - } - - System.out.println("DoubleIntTable Lookup " + sw.elapsedTime()); - sw.zero(); - - for (int j = 0; j < count; j++) { - for (int i = 0; i < sNumeric.length; i++) { - int r = randomgen.nextInt(sNumeric.length); - - intValueHashLookup.get(sNumeric[r][0], 0); - - dummy += r; - } - } - - System.out.println("IntKeyIntValueHashMap Lookup " - + sw.elapsedTime()); - sw.zero(); - - for (int j = 0; j < count; j++) { - for (int i = 0; i < sNumeric.length; i++) { - int r = randomgen.nextInt(sNumeric.length); - - dummy += r; - } - } - - System.out.println("emptyOp " + sw.elapsedTime()); - sw.zero(); - - for (int j = 0; j < count; j++) { - for (int i = 0; i < sNumeric.length; i++) { - int r = randomgen.nextInt(sNumeric.length); - - doubleIntLookup.findFirstEqualKeyIndex(r); - - dummy += r; - } - } - - System.out.println("DoubleIntTable Lookup " + sw.elapsedTime()); - sw.zero(); - System.out.println("Object Cache Test " + sw.elapsedTime()); - } - } - - public static void main(String[] argv) { - TestLibSpeed ls = new TestLibSpeed(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestLikePredicateOptimizations.java b/database/hsqldb/src/org/hsqldb/test/TestLikePredicateOptimizations.java deleted file mode 100644 index be990845..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestLikePredicateOptimizations.java +++ /dev/null @@ -1,335 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -/** - * HSQLDB TestLikePredicate Junit test case.

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.7.2 - */ -public class TestLikePredicateOptimizations extends TestBase { - - public TestLikePredicateOptimizations(String name) { - super(name); - } - - /* Implements the TestLikePredicate test */ - public void test() throws Exception { - - Connection conn = newConnection(); - Statement stmt = conn.createStatement(); - PreparedStatement pstmt; - ResultSet rs; - String sql; - int expectedCount; - int actualCount; - - stmt.execute("drop table test if exists"); - stmt.execute("drop table empty if exists"); - - sql = "create table test(name varchar(255))"; - - stmt.execute(sql); - - sql = "create index idx on test(name)"; - - stmt.execute(sql); - - sql = "create table empty(name varchar(255))"; - - stmt.execute(sql); - - sql = "insert into empty values 'name10'"; - - stmt.execute(sql); - - sql = "insert into empty values 'name11'"; - - stmt.execute(sql); - - sql = "insert into test values(?)"; - pstmt = conn.prepareStatement(sql); - - for (int i = 0; i < 10000; i++) { - pstmt.setString(1, "name" + i); - pstmt.addBatch(); - } - - pstmt.executeBatch(); - - sql = "select TOP 20 * from test where name like '%me4%' order by name"; - rs = stmt.executeQuery(sql); - - int countOne = 0; - int countTwo = 0; - - while (rs.next()) { - countOne++; - } - - sql = "select TOP 20 * from test where name like ? order by name"; - pstmt = conn.prepareStatement(sql); - - pstmt.setString(1, "%me4%"); - - rs = pstmt.executeQuery(); - - while (rs.next()) { - countTwo++; - } - - assertEquals("\"" + sql + "\"", countOne, countTwo ); - -// - sql = "select count(*) from test where name = (select max(name) from empty)"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from test where name like (select min(name) from empty)"; - pstmt = conn.prepareStatement(sql); - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - sql = "select count(*) from test where (select max(name) from empty where empty.name = test.name and empty.name > ?) like '%ame11%'"; - pstmt = conn.prepareStatement(sql); - - pstmt.setString(1, "n"); - - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - -// -- - sql = "select count(*) from test where name = ''"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from test where name like ''"; - pstmt = conn.prepareStatement(sql); - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - // -- - sql = "SELECT t.name FROM test t WHERE ((SELECT t2.name from test t2 where t2.name=?) like '%name5000%')"; - pstmt = conn.prepareStatement(sql); - - pstmt.setString(1, "name5000"); - - rs = pstmt.executeQuery(); - - assertEquals(rs.next(), true); - - String actual = rs.getString(1); - - assertEquals(actual, "name0"); - -// -- -// -- - sql = "select count(*) from test where name is not null"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from test where name like '%'"; - pstmt = conn.prepareStatement(sql); - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - -// -- - sql = "select count(*) from test where substring(name from 1 for 6) = 'name44'"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from test where name like 'name44%'"; - pstmt = conn.prepareStatement(sql); - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - -// -- - sql = "select count(*) from test where left(name,5) = 'name4' and right(name,1) = '5'"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from test where name like 'name4%5'"; - pstmt = conn.prepareStatement(sql); - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - - sql = "select count(*) from test"; - rs = stmt.executeQuery(sql); - - rs.next(); - - expectedCount = rs.getInt(1); - sql = "select count(*) from test where name like '%'"; - pstmt = conn.prepareStatement(sql); - rs = pstmt.executeQuery(); - - rs.next(); - - actualCount = rs.getInt(1); - - assertEquals("\"" + sql + "\"", expectedCount, actualCount); - -// -- - String result = "true"; - String presult = "false"; - - stmt.execute("drop table test1 if exists"); - - sql = "CREATE TABLE test1 (col CHAR(30))"; - pstmt = conn.prepareStatement(sql); - - pstmt.execute(); - - sql = "INSERT INTO test1 (col) VALUES ('one')"; - pstmt = conn.prepareStatement(sql); - - pstmt.execute(); - - sql = "SELECT * FROM test1 WHERE ( col LIKE ? )"; - pstmt = conn.prepareStatement(sql); - - pstmt.setString(1, "on%"); - - rs = pstmt.executeQuery(); - - if (rs.next()) { - presult = rs.getString("COL"); - } - - sql = "SELECT * FROM test1 WHERE ( col LIKE 'one' )"; - pstmt = conn.prepareStatement(sql); - rs = pstmt.executeQuery(); - - if (rs.next()) { - result = rs.getString("COL"); - } - - assertEquals("\"" + sql + "\"", result, presult); - - sql = "SELECT * FROM test1 WHERE ( col LIKE 'one' ESCAPE CAST(? AS CHAR) )"; - pstmt = conn.prepareStatement(sql); - pstmt.setString(1, "%"); - rs = pstmt.executeQuery(); - - if (rs.next()) { - result = rs.getString("COL"); - } - - assertEquals("\"" + sql + "\"", result, presult); - - sql = "SELECT * FROM test1 WHERE ( col LIKE 'one' ESCAPE ? )"; - pstmt = conn.prepareStatement(sql); - pstmt.setString(1, "%"); - rs = pstmt.executeQuery(); - - if (rs.next()) { - result = rs.getString("COL"); - } - - assertEquals("\"" + sql + "\"", result, presult); - } - - /* Runs TestLikePredicate test from the command line*/ - public static void main(String[] args) throws Exception { - - TestResult result; - TestCase test; - java.util.Enumeration failures; - int count; - - result = new TestResult(); - test = new TestLikePredicateOptimizations("test"); - - test.run(result); - - count = result.failureCount(); - - System.out.println("TestLikePredicateOptimizations failure count: " - + count); - - failures = result.failures(); - - while (failures.hasMoreElements()) { - System.out.println(failures.nextElement()); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestLobs.java b/database/hsqldb/src/org/hsqldb/test/TestLobs.java deleted file mode 100644 index d6899804..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestLobs.java +++ /dev/null @@ -1,1053 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.CharArrayReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import javax.sql.rowset.serial.SerialBlob; - -import org.hsqldb.jdbc.JDBCBlob; -import org.hsqldb.jdbc.JDBCClob; -import org.hsqldb.lib.HsqlByteArrayInputStream; -import org.hsqldb.lib.StopWatch; - -public class TestLobs extends TestBase { - - Connection connection; - Statement statement; - - public TestLobs(String name) { - super(name); - } - - protected void setUp() throws Exception { - - System.out.println("SetUp (sub-)test: " + getName()); - super.setUp(); - - try { - connection = super.newConnection(); - statement = connection.createStatement(); - - statement.execute("SET DATABASE EVENT LOG SQL LEVEL 4"); - statement.execute("SET TABLE SYSTEM_LOBS.BLOCKS TYPE CACHED;"); - statement.execute("SET TABLE SYSTEM_LOBS.LOBS TYPE CACHED;"); - statement.execute("SET TABLE SYSTEM_LOBS.LOB_IDS TYPE CACHED;"); - } catch (Exception e) { - System.out.println(e); - } - } - - public void testBlobA() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE BLOBTEST IF EXISTS"; - String ddl1 = - "CREATE TABLE BLOBTEST(ID IDENTITY, BLOBFIELD BLOB(100000))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - - try { - String dml0 = "insert into blobtest(blobfield) values(?)"; - String dql0 = "select * from blobtest;"; - PreparedStatement ps = connection.prepareStatement(dml0); - byte[] data = new byte[] { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 - }; - Blob blob = new JDBCBlob(data); - - ps.setBlob(1, blob); - ps.executeUpdate(); - - data[4] = 50; - blob = new JDBCBlob(data); - - ps.setBlob(1, blob); - ps.executeUpdate(); - ps.close(); - - ps = connection.prepareStatement(dql0); - - ResultSet rs = ps.executeQuery(); - - rs.next(); - - Blob blob1 = rs.getBlob(2); - - rs.next(); - - Blob blob2 = rs.getBlob(2); - byte[] data1 = blob1.getBytes(1, 10); - byte[] data2 = blob2.getBytes(1, 10); - - assertTrue(data1[4] == 5 && data2[4] == 50); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testBlobB() { - - System.out.println("Starting (sub-)test: " + getName()); - - ResultSet rs; - byte[] ba; - byte[] baR1 = new byte[] { - (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4, (byte) 0xF5, - (byte) 0xF6, (byte) 0xF7, (byte) 0xF8, (byte) 0xF9, (byte) 0xFA, - (byte) 0xFB - }; - byte[] baR2 = new byte[] { - (byte) 0xE1, (byte) 0xE2, (byte) 0xE3, (byte) 0xE4, (byte) 0xE5, - (byte) 0xE6, (byte) 0xE7, (byte) 0xE8, (byte) 0xE9, (byte) 0xEA, - (byte) 0xEB, (byte) 0xEC - }; - - try { - connection.setAutoCommit(false); - - Statement st = connection.createStatement(); - - st.executeUpdate("DROP TABLE blo IF EXISTS"); - st.executeUpdate("CREATE TABLE blo (id INTEGER PRIMARY KEY, b blob( 100))"); - - PreparedStatement ps = connection.prepareStatement( - "INSERT INTO blo(id, b) values(2, ?)"); - - ps.setBlob(1, new SerialBlob(baR1)); - ps.executeUpdate(); - - rs = st.executeQuery("SELECT b FROM blo WHERE id = 2"); - - if (!rs.next()) { - assertTrue("No row with id 2", false); - } - - java.sql.Blob blob1 = rs.getBlob("b"); - - System.out.println("Size of retrieved blob: " + blob1.length()); - - byte[] baOut = blob1.getBytes(1, (int) blob1.length()); - - if (baOut.length != baR1.length) { - assertTrue("Expected array len " + baR1.length + ", got len " - + baOut.length, false); - } - - for (int i = 0; i < baOut.length; i++) { - if (baOut[i] != baR1[i]) { - assertTrue("row2 byte " + i + " differs", false); - } - } - - rs.close(); - connection.commit(); - - rs = st.executeQuery("SELECT b FROM blo WHERE id = 2"); - - if (!rs.next()) { - assertTrue("No row with id 2", false); - } - - ba = rs.getBytes("b"); - - if (ba.length != baR1.length) { - assertTrue("row2 byte length differs", false); - } - - blob1 = rs.getBlob("b"); - ba = blob1.getBytes(1, baR1.length); - - - for (int i = 0; i < ba.length; i++) { - if (ba[i] != baR1[i]) { - fail("row2 byte " + i + " differs"); - } - } - - rs.close(); - connection.rollback(); - - rs = st.executeQuery("SELECT b FROM blo WHERE id = 2"); - - if (!rs.next()) { - assertTrue("No row with id 2", false); - } - - blob1 = rs.getBlob("b"); - ba = blob1.getBytes(1, baR1.length); - - if (ba.length != baR1.length) { - assertTrue("row2 byte length differs", false); - } - - for (int i = 0; i < baOut.length; i++) { - if (baOut[i] != baR1[i]) { - fail("row2 byte " + i + " differs"); - } - } - - rs.close(); - - // again with stream - ps.setBinaryStream(1, new HsqlByteArrayInputStream(baR2), - baR2.length); - ps.executeUpdate(); - - connection.commit(); - - rs = st.executeQuery("SELECT b FROM blo WHERE id = 2"); - - if (!rs.next()) { - assertTrue("No row with id 2", false); - } - - if (!rs.next()) { - assertTrue("No second row with id 2", false); - } - - blob1 = rs.getBlob("b"); - - System.out.println("Size of retrieved blob: " + blob1.length()); - - //System.out.println("Value = (" + rs.getString("b") + ')'); - baOut = blob1.getBytes(1, (int) blob1.length()); - - if (baOut.length != baR2.length) { - assertTrue("Expected array len " + baR2.length + ", got len " - + baOut.length, false); - } - - for (int i = 0; i < baOut.length; i++) { - if (baOut[i] != baR2[i]) { - fail("row2 byte " + i + " differs"); - } - } - - rs.close(); - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testBlobC() { - - System.out.println("Starting (sub-)test: " + getName()); - - ResultSet rs; - byte[] ba; - byte[] baR2 = new byte[] { - (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4, (byte) 0xF5, - (byte) 0xF6, (byte) 0xF7, (byte) 0xF8, (byte) 0xF9, (byte) 0xFA, - (byte) 0xFB - }; - - try { - connection.setAutoCommit(false); - - Statement st = connection.createStatement(); - - st.executeUpdate("DROP TABLE blo IF EXISTS"); - st.executeUpdate("CREATE TABLE blo (id INTEGER, b blob( 100))"); - - PreparedStatement ps = connection.prepareStatement( - "INSERT INTO blo(id, b) values(2, ?)"); - - // again with stream - ps.setBinaryStream(1, new HsqlByteArrayInputStream(baR2), - baR2.length); - ps.executeUpdate(); - - connection.commit(); - - rs = st.executeQuery("SELECT b FROM blo WHERE id = 2"); - - if (!rs.next()) { - assertTrue("No row with id 2", false); - } - - Blob blob1 = rs.getBlob("b"); - - System.out.println("Size of retrieved blob: " + blob1.length()); - - //System.out.println("Value = (" + rs.getString("b") + ')'); - byte[] baOut = blob1.getBytes(1, (int) blob1.length()); - - if (baOut.length != baR2.length) { - assertTrue("Expected array len " + baR2.length + ", got len " - + baOut.length, false); - } - - for (int i = 0; i < baOut.length; i++) { - if (baOut[i] != baR2[i]) { - fail("row2 byte " + i + " differs"); - } - } - - rs.close(); - connection.commit(); - connection.close(); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testBlobH() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl1 = "DROP TABLE BLOBTEST IF EXISTS"; - String ddl2 = "CREATE TABLE BLOBTEST(A INTEGER, B BLOB)"; - - statement.execute(ddl1); - statement.execute(ddl2); - } catch (SQLException e) {} - - try { - String dml0 = "insert into blobtest values(1, ?)"; - String dql0 = "select * from blobtest"; - PreparedStatement ps = connection.prepareStatement(dml0); - byte[] data = new byte[] { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 - }; - - connection.setAutoCommit(false); - - Blob blob = connection.createBlob(); - - blob.setBytes(1, data); - ps.setBlob(1, blob); - ps.executeUpdate(); - - data[4] = 50; - blob = new JDBCBlob(data); - - ps.setBlob(1, blob); - ps.executeUpdate(); - ps.close(); - connection.commit(); - - ps = connection.prepareStatement(dql0); - - ResultSet rs = ps.executeQuery(); - - rs.next(); - - Blob blob1 = rs.getBlob(2); - - rs.next(); - - Blob blob2 = rs.getBlob(2); - byte[] data1 = blob1.getBytes(1, 10); - byte[] data2 = blob2.getBytes(1, 10); - - assertTrue(data1[4] == 5 && data2[4] == 50); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - public void testClobA() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE CLOBTEST IF EXISTS"; - String ddl1 = - "CREATE TABLE CLOBTEST(ID IDENTITY, CLOBFIELD CLOB(100000))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) {} - - try { - String dml0 = "insert into clobtest(clobfield) values(?)"; - String dql0 = "select * from clobtest;"; - PreparedStatement ps = connection.prepareStatement(dml0); - String data = "Testing clob insert and select ops"; - Clob clob = new JDBCClob(data); - - ps.setClob(1, clob); - ps.executeUpdate(); - - data = data.replaceFirst("insert", "INSERT"); - clob = new JDBCClob(data); - - ps.setClob(1, clob); - ps.executeUpdate(); - ps.close(); - - ps = connection.prepareStatement(dql0); - - ResultSet rs = ps.executeQuery(); - - rs.next(); - - Clob clob1 = rs.getClob(2); - - rs.next(); - - Clob clob2 = rs.getClob(2); - String string = rs.getString(2); - int data1 = clob1.getSubString(1, data.length()).indexOf("insert"); - int data2 = clob2.getSubString(1, data.length()).indexOf("INSERT"); - - assertTrue(data1 == data2 && data1 > 0); - assertTrue(string.equals(clob2.getSubString(1, data.length()))); - rs.close(); - - // test with stream - rs = ps.executeQuery(); - - rs.next(); - - InputStream is = rs.getAsciiStream(2); - StringBuilder sb = new StringBuilder(); - - try { - while (true) { - int c = is.read(); - - if (c < 0) { - break; - } - - sb.append((char) c); - } - } catch (IOException ie) {} - - string = rs.getString(2); - - assertTrue(string.equals(sb.toString())); - rs.next(); - rs.getAsciiStream(2); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testClobB() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE CLOBTEST IF EXISTS"; - String ddl1 = - "CREATE TABLE CLOBTEST(ID IDENTITY, V VARCHAR(10), I INT, CLOBFIELD CLOB(100000))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) {} - - try { - String dml0 = "insert into clobtest values(default, ?, ?, ?)"; - String dql0 = "select * from clobtest;"; - PreparedStatement ps = connection.prepareStatement(dml0); - String data = "Testing clob insert and select ops"; - Clob clob = new JDBCClob(data); - - ps.setString(1, "test"); - ps.setInt(2, 5); - ps.setClob(3, clob); - ps.executeUpdate(); - - data = data.replaceFirst("insert", "INSERT"); - clob = new JDBCClob(data); - - ps.setClob(3, clob); - ps.executeUpdate(); - - PreparedStatement ps2 = connection.prepareStatement(dql0); - ResultSet rs = ps2.executeQuery(); - - rs.next(); - - Clob clob1 = rs.getClob(4); - - rs.next(); - - Clob clob2 = rs.getClob(4); - int data1 = clob1.getSubString(1, data.length()).indexOf("insert"); - int data2 = clob2.getSubString(1, data.length()).indexOf("INSERT"); - - assertTrue(data1 == data2 && data1 > 0); - - // - Clob clob3 = new JDBCClob(data); - Reader reader = clob3.getCharacterStream(); - - ps.setCharacterStream(3, reader, (int) clob3.length()); - ps.executeUpdate(); - - // - reader = clob2.getCharacterStream(); - - try { - ps.setCharacterStream(3, reader, (int) clob3.length()); - ps.executeUpdate(); - } catch (SQLException e) {} - - connection.commit(); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testClobC() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE VARIABLE IF EXISTS"; - String ddl1 = - "CREATE TABLE VARIABLE (stateid varchar(128), varid numeric(16,0), " - + "scalabilitypassivated char(1) DEFAULT 'N', value clob (2G), scopeguid varchar(128)," - + "primary key (stateid, varid, scalabilitypassivated, scopeguid))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) {} - - try { - String dml0 = "INSERT INTO VARIABLE VALUES (?, ?, 'N', ?, ?)"; - String dml1 = - "UPDATE VARIABLE SET value = ? WHERE stateid = ? AND " - + "varid = ? AND scalabilitypassivated = 'N' AND scopeguid = ?"; - PreparedStatement ps = connection.prepareStatement(dml0); - - // - String resourceFileName = "/org/hsqldb/resources/lob-schema.sql"; - InputStreamReader reader = null; - - try { - InputStream fis = - getClass().getResourceAsStream(resourceFileName); - - reader = new InputStreamReader(fis, "ISO-8859-1"); - } catch (Exception e) {} - - ps.setString(1, "test-id-1"); - ps.setLong(2, 23456789123456L); - ps.setCharacterStream(3, reader, 1000); - ps.setString(4, "test-scope-1"); - ps.executeUpdate(); - - try { - InputStream fis = - getClass().getResourceAsStream(resourceFileName); - - fis = getClass().getResourceAsStream(resourceFileName); - reader = new InputStreamReader(fis, "ISO-8859-1"); - - for (int i = 0; i < 100; i++) { - reader.read(); - } - } catch (Exception e) {} - - // - ps.setString(1, "test-id-2"); - ps.setLong(2, 23456789123457L); - ps.setCharacterStream(3, reader, 100); - ps.setString(4, "test-scope-2"); - ps.addBatch(); - ps.setString(1, "test-id-3"); - ps.setLong(2, 23456789123458L); - ps.setCharacterStream(3, reader, 100); - ps.setString(4, "test-scope-3"); - ps.addBatch(); - - int[] results = ps.executeBatch(); - - // - try { - InputStream fis = - getClass().getResourceAsStream(resourceFileName); - - fis = getClass().getResourceAsStream(resourceFileName); - reader = new InputStreamReader(fis, "ISO-8859-1"); - - for (int i = 0; i < 100; i++) { - reader.read(); - } - } catch (Exception e) {} - - ps = connection.prepareStatement(dml1); - - ps.setCharacterStream(1, reader, 500); - ps.setString(2, "test-id-1"); - ps.setLong(3, 23456789123456L); - ps.setString(4, "test-scope-1"); - ps.executeUpdate(); - ps.close(); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testClobD() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE VARIABLE IF EXISTS"; - String ddl1 = - "CREATE TABLE VARIABLE (stateid varchar(128), varid numeric(16,0), " - + "scalabilitypassivated char(1) DEFAULT 'N', value clob(20000), scopeguid varchar(128)," - + "primary key (stateid, varid, scalabilitypassivated, scopeguid))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) {} - - try { - String dml0 = "INSERT INTO VARIABLE VALUES (?, ?, 'N', ?, ?)"; - String dml1 = - "UPDATE VARIABLE SET value = ? WHERE stateid = ? AND " - + "varid = ? AND scalabilitypassivated = 'N' AND scopeguid = ?"; - PreparedStatement ps = connection.prepareStatement(dml0); - - connection.setAutoCommit(false); - - // - JDBCClob dataClob = - new JDBCClob("the quick brown fox jumps on the lazy dog"); - Reader reader = null; - StopWatch sw = new StopWatch(); - - sw.start(); - - for (int i = 0; i < 1000; i++) { - reader = dataClob.getCharacterStream(); - - ps.setString(1, "test-id-1" + i); - ps.setLong(2, 23456789123456L + i); - ps.setCharacterStream(3, reader, dataClob.length()); - ps.setString(4, "test-scope-1" + i); - ps.executeUpdate(); - connection.commit(); - } - - sw.stop(); - System.out.println(sw.elapsedTimeToMessage("Time for inserts")); - - ps = connection.prepareStatement(dml1); - - sw.zero(); - sw.start(); - - for (int i = 100; i < 200; i++) { - reader = dataClob.getCharacterStream(); - - ps.setCharacterStream(1, reader, dataClob.length()); - ps.setString(2, "test-id-1" + i); - ps.setLong(3, 23456789123456L + i); - ps.setString(4, "test-scope-1" + i); - ps.executeUpdate(); - connection.commit(); - } - - connection.commit(); - sw.stop(); - System.out.println(sw.elapsedTimeToMessage("Time for updates")); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testClobE() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE VARIABLE IF EXISTS"; - String ddl1 = - "CREATE TABLE VARIABLE (stateid varchar(128), varid numeric(16,0), " - + "scalabilitypassivated char(1) DEFAULT 'N', value clob(2000), scopeguid varchar(128)," - + "primary key (stateid, varid, scalabilitypassivated, scopeguid))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) { - System.out.println(e.getMessage()); - } - - try { - String dml0 = "INSERT INTO VARIABLE VALUES (?, ?, 'N', ?, ?)"; - String dml1 = - "UPDATE VARIABLE SET varid = varid + 1 WHERE stateid = ? AND " - + "varid = ? AND scalabilitypassivated = 'N' AND scopeguid = ?"; - PreparedStatement ps = connection.prepareStatement(dml0); - - connection.setAutoCommit(false); - - // - JDBCClob dataClob = - new JDBCClob("the quick brown fox jumps on the lazy dog"); - Reader reader = null; - StopWatch sw = new StopWatch(); - - sw.start(); - - for (int i = 0; i < 100; i++) { - reader = dataClob.getCharacterStream(); - - ps.setString(1, "test-id-1" + i); - ps.setLong(2, 23456789123456L + i); - ps.setCharacterStream(3, reader, dataClob.length()); - ps.setString(4, "test-scope-1" + i); - ps.executeUpdate(); - connection.commit(); - } - - sw.stop(); - System.out.println(sw.elapsedTimeToMessage("Time for inserts")); - - ps = connection.prepareStatement(dml1); - - sw.zero(); - sw.start(); - - for (int i = 10; i < 20; i++) { - ps.setString(1, "test-id-1" + i); - ps.setLong(2, 23456789123456L + i); - ps.setString(3, "test-scope-1" + i); - ps.executeUpdate(); - connection.commit(); - } - - connection.commit(); - - ResultSet rs = statement.executeQuery("SELECT * FROM VARIABLE"); - - while (rs.next()) { - Clob clob = rs.getClob(4); - long dataLength = dataClob.length(); - long clobLength = clob.length(); - - assertTrue(dataLength == clobLength); - assertTrue( - dataClob.getSubString(1, 30).equals( - clob.getSubString(1, 30))); - } - - rs = statement.executeQuery( - "SELECT CAST(SUBSTRING(VALUE FROM 19) AS VARCHAR(100)),STATEID," - + "CHARACTER_LENGTH(VALUE),CAST(VALUE AS VARCHAR(100)) FROM " - + "VARIABLE WHERE VALUE='THE QUICK BROWN FOX JUMPS ON THE LAZY DOG'" - + "AND STATEID>'TEST-ID-197'"); - - while (rs.next()) { - assertTrue(rs.getString(1).equals("x jumps on the lazy dog")); - } - - sw.stop(); - System.out.println(sw.elapsedTimeToMessage("Time for updates")); - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testClobF() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE CLOBTEST IF EXISTS"; - String ddl1 = - "CREATE TABLE CLOBTEST(ID IDENTITY, CLOBFIELD CLOB(100000))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) {} - - try { - String dml0 = "insert into clobtest(clobfield) values ?"; - String value = "0123456789"; - PreparedStatement ps = connection.prepareStatement(dml0); - - ps.setString(1, value); - ps.executeUpdate(); - - String dq1 = "select CHARACTER_LENGTH(clobfield) from clobtest;"; - ResultSet rs = statement.executeQuery(dq1); - - rs.next(); - - int length = rs.getInt(1); - - assertTrue(value.length() == length); - rs.close(); - - String dq3 = "delete from clobtest;"; - - statement.execute(dq3); - - char[] testChars = new char[11111]; - - for (int i = 0, j = 32; i < testChars.length; i++, j++) { - if (j > 255) { - j = 32; - } - - testChars[i] = (char) j; - } - - ps.setCharacterStream(1, new CharArrayReader(testChars), - testChars.length); - ps.executeUpdate(); - - String dq2 = "select clobfield from clobtest;"; - - rs = statement.executeQuery(dq2); - - rs.next(); - - Reader reader = rs.getCharacterStream(1); - char[] newChars = new char[testChars.length]; - - try { - reader.read(newChars); - } catch (IOException e) { - fail("test failure"); - } - - for (int i = 0; i < testChars.length; i++) { - if (testChars[i] != newChars[i]) { - fail("test failure"); - } - } - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testClobG() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl0 = "DROP TABLE CLOBTEST IF EXISTS"; - String ddl1 = - "CREATE TABLE CLOBTEST(ID IDENTITY, CLOBFIELD CLOB(100000))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) {} - - try { - String dml0 = "insert into clobtest(clobfield) values ?"; - String value = "0123456789"; - PreparedStatement ps = connection.prepareStatement(dml0); - Clob clob = connection.createClob(); - - clob.setString(1, value); - ps.setClob(1, clob); - ps.executeUpdate(); - - String dq1 = "select CHARACTER_LENGTH(clobfield) from clobtest;"; - ResultSet rs = statement.executeQuery(dq1); - - rs.next(); - - int length = rs.getInt(1); - - assertTrue(value.length() == length); - rs.close(); - - String dq3 = "delete from clobtest;"; - - statement.execute(dq3); - - char[] testChars = new char[11111]; - - for (int i = 0, j = 32; i < testChars.length; i++, j++) { - if (j > 255) { - j = 32; - } - - testChars[i] = (char) j; - } - - ps.setCharacterStream(1, new CharArrayReader(testChars), - testChars.length); - ps.executeUpdate(); - - String dq2 = "select clobfield from clobtest;"; - - rs = statement.executeQuery(dq2); - - rs.next(); - - Reader reader = rs.getCharacterStream(1); - char[] newChars = new char[testChars.length]; - - try { - reader.read(newChars); - } catch (IOException e) { - fail("test failure"); - } - - for (int i = 0; i < testChars.length; i++) { - if (testChars[i] != newChars[i]) { - fail("test failure"); - } - } - } catch (SQLException e) { - e.printStackTrace(); - fail("test failure"); - } - } - - public void testClobH() { - - System.out.println("Starting (sub-)test: " + getName()); - - try { - String ddl1 = "drop procedure PUBLIC.PROC_H if exists"; - - statement.execute(ddl1); - - ddl1 = "create procedure PUBLIC.PROC_H(out p1 clob, out p2 int) READS SQL DATA BEGIN ATOMIC SET p1 = 'dafsdfasdfaefafeajfiwejifpjajsidojfakmvkamsdjfadpsjfoajsdifjaos'; SET p2 = 0; end"; - - String dml0 = "call PUBLIC.PROC_H(?, ?)"; - - statement.execute(ddl1); - - CallableStatement ps = connection.prepareCall(dml0); - - ps.registerOutParameter(1, java.sql.Types.CLOB); - ps.registerOutParameter(2, java.sql.Types.INTEGER); - ps.execute(); - - String string = ps.getClob(1).getSubString(1, 10); - - System.out.println(string); - } catch (SQLException e) { - e.printStackTrace(); - } - } - -/* - public static void main(String[] args) throws SQLException { - Connection con = null; - PreparedStatement st = null; - ResultSet rs = null; - try { - - DriverManager.registerDriver(new org.hsqldb.jdbc.JDBCDriver()); - con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:7001", - "sa", null); -// con = DriverManager.getConnection("jdbc:hsqldb:mem:mymemdb", "sa", null); - -// con.createStatement().execute("drop table aaa"); - con.createStatement().execute("create table aaa (a integer, b blob)"); - - String insert = "insert into aaa values (1, ?)"; - - st = con.prepareStatement(insert); - - byte[] b = {0, 1}; - - Blob blob = con.createBlob(); - blob.setBytes(1, b); - st.setBlob(1, blob); - -// this does not work too !!! -// st.setBytes(1, b); - - System.out.println("execute"); - st.execute(); - System.out.println("execute end"); - con.commit(); - System.out.println("commit"); - - con.createStatement().execute("shutdown script"); - } catch (SQLException e) { - e.printStackTrace(); - } finally { - if (st != null) { - st.close(); - } - if (con != null) { - con.close(); - } - } - } -*/ - protected void tearDown() { - - System.out.println("TearDown (sub-)test: " + getName()); - - try { - statement = connection.createStatement(); - - statement.execute("SHUTDOWN"); - statement.close(); - - if (!isNetwork) { - connection.close(); - } - } catch (Exception e) {} - - super.tearDown(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestMerge.java b/database/hsqldb/src/org/hsqldb/test/TestMerge.java deleted file mode 100644 index 77887b60..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestMerge.java +++ /dev/null @@ -1,438 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Enumeration; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -/** - * Test merge statements via jdbc against in-memory database - * @author Justin Spadea - */ -public class TestMerge extends TestBase { - - Statement stmnt; - PreparedStatement pstmnt; - Connection connection; - - public TestMerge(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - - try { - connection = newConnection(); - stmnt = connection.createStatement(); - } catch (Exception e) {} - } - - /** - * Prints a table displaying specified columns, and checks the expected - * number of rows. - */ - public static void printTable(Statement statement, String table, - String cols, int expected) throws SQLException { - - int rows = 0; - ResultSet rs = statement.executeQuery("SELECT " + cols + " FROM " + table); - ResultSetMetaData rsmd = rs.getMetaData(); - String result = "Table " + table + ", expecting " + expected - + " rows total:\n"; - - while (rs.next()) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result += rsmd.getColumnLabel(i + 1) + ":" - + rs.getString(i + 1) + ":"; - } - - result += "\n"; - - rows++; - } - - rs.close(); - System.out.println(result); - assertEquals(expected, rows); - } - - /** - * Sets up tables T and S and executes MERGE query on them - */ - private void executeMerge(String merge) throws SQLException { - - // create table T and insert some preliminary data - stmnt.execute("DROP SCHEMA SA IF EXISTS CASCADE;"); - stmnt.execute("CREATE SCHEMA SA AUTHORIZATION SA"); - stmnt.execute("DROP TABLE SA.T IF EXISTS;"); - stmnt.execute( - "CREATE TABLE SA.T (I IDENTITY, A CHAR(10), B CHAR(10));"); - stmnt.execute("INSERT INTO SA.T VALUES ((0, 'A', 'a')," - + "(1, 'B', 'b'), (4, 'C', 'c'));"); - - // create table S and insert some preliminary data - stmnt.execute("DROP TABLE SA.S IF EXISTS;"); - stmnt.execute( - "CREATE TABLE SA.S (I IDENTITY, A CHAR(10), B CHAR(10), C CHAR(10));"); - stmnt.execute( - "INSERT INTO SA.S VALUES ((0, 'D', 'd', 'Dd')," - + "(2, 'E', 'e', 'Ee'), (3, 'F', 'f', 'Ff'), (4, 'G', 'g', 'Gg'));"); - printTable(stmnt, "SA.T", "*", 3); - printTable(stmnt, "SA.S", "*", 4); - stmnt.execute(merge); - } - - public void testMerge1() { - - try { - - // merge statement with table aliases, using both match statements - executeMerge( - "MERGE INTO SA.T X " + - "USING SA.S AS Y " + - "ON X.I = Y.I " + - "WHEN MATCHED THEN " + - "UPDATE SET X.A = Y.A, X.B = 'UPDATED' " + - "WHEN NOT MATCHED THEN " + - "INSERT (I, A, B) VALUES (Y.I, Y.A, 'INSERTED');" - ); - - // table t should now have 5 rows, first and fifth with A/B updated - // to values A/C from S, second should be the same, and third and - // fourth should be the inserted rows that didn't exist before. - printTable(stmnt, "SA.T", "*", 5); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge1 complete\n"); - } - - public void testMerge2() { - - try { - - // merge statement with only update statement - executeMerge( - "MERGE INTO SA.T " + - "USING SA.S " + - "ON T.I = S.I " + - "WHEN MATCHED THEN " + - "UPDATE SET T.A = S.A, T.B = 'UPDATED';" - ); - - // two rows should be updated, nothing inserted - printTable(stmnt, "SA.T", "*", 3); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge2 complete\n"); - } - - public void testMerge3() { - - try { - - // merge statement with only insert statement, without - // specifying insert columns - executeMerge( - "MERGE INTO SA.T " + - "USING SA.S " + - "ON T.I = S.I " + - "WHEN NOT MATCHED THEN " + - "INSERT VALUES (S.I, S.A, 'INSERTED');" - ); - - // two rows should be updated, nothing inserted - printTable(stmnt, "SA.T", "*", 5); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge3 complete\n"); - } - - public void testMerge4() { - - try { - - // merge statement with both update and insert, without - // specifying insert columns - executeMerge( - "MERGE INTO SA.T " + - "USING SA.S " + - "ON T.I = S.I " + - "WHEN MATCHED THEN " + - "UPDATE SET T.A = S.A, T.B = 'UPDATED' " + - "WHEN NOT MATCHED THEN " + - "INSERT VALUES (S.I, S.A, 'INSERTED');" - ); - - // two rows should be updated, two rows inserted - printTable(stmnt, "SA.T", "*", 5); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge4 complete\n"); - } - - public void testMerge5() { - - try { - - // merge statement with select statement as source table, using all - // columns from S - executeMerge( - "MERGE INTO SA.T " + - "USING (SELECT * FROM SA.S) AS X " + - "ON T.I = X.I " + - "WHEN MATCHED THEN " + - "UPDATE SET T.A = X.A, T.B = 'UPDATED' " + - "WHEN NOT MATCHED THEN " + - "INSERT VALUES (X.I, X.A, 'INSERTED');" - ); - - // two rows should be updated, two rows inserted - printTable(stmnt, "SA.T", "*", 5); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge5 complete\n"); - } - - public void testMerge6() { - - try { - - // merge statement with select statement as source table, specifying - // select columns from S - executeMerge( - "MERGE INTO SA.T " + - "USING (SELECT I, A, C FROM SA.S) AS X " + - "ON T.I = X.I " + - "WHEN MATCHED THEN " + - "UPDATE SET T.A = X.A, T.B = 'UPDATED' " + - "WHEN NOT MATCHED THEN " + - "INSERT VALUES (X.I, X.A, 'INSERTED');" - ); - - // two rows should be updated, two rows inserted - printTable(stmnt, "SA.T", "*", 5); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge6 complete\n"); - } - - public void testMerge7() { - - try { - - // merge statement with select statement as source table, with WHERE - // condition that matches a row in T - executeMerge( - "MERGE INTO SA.T " + - "USING (SELECT * FROM SA.S WHERE I = 4) AS X " + - "ON T.I = X.I " + - "WHEN MATCHED THEN " + - "UPDATE SET T.A = X.A, T.B = 'UPDATED' " + - "WHEN NOT MATCHED THEN " + - "INSERT VALUES (X.I, X.A, 'INSERTED');" - ); - - // 1 row should be updated - printTable(stmnt, "SA.T", "*", 3); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge7 complete\n"); - } - - public void testMerge8() { - - try { - - // merge statement with select statement as source table, with WHERE - // condition that does not match a row in T - executeMerge( - "MERGE INTO SA.T " + - "USING (SELECT * FROM SA.S WHERE I = 3) AS X " + - "ON T.I = X.I " + - "WHEN MATCHED THEN " + - "UPDATE SET T.A = X.A, T.B = 'UPDATED' " + - "WHEN NOT MATCHED THEN " + - "INSERT VALUES (X.I, X.A, 'INSERTED');" - ); - - // 1 row should be inserted - printTable(stmnt, "SA.T", "*", 4); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge8 complete\n"); - } - - public void testMerge9() { - - try { - - // merge statement with select statement as source table, with WHERE - // condition that does and does not not match a row in T - executeMerge( - "MERGE INTO SA.T " + - "USING (SELECT * FROM SA.S WHERE I > 2) AS X " + - "ON T.I = X.I " + - "WHEN MATCHED THEN " + - "UPDATE SET T.A = X.A, T.B = 'UPDATED' " + - "WHEN NOT MATCHED THEN " + - "INSERT VALUES (X.I, X.A, 'INSERTED');" - ); - - // 1 row should be inserted, 1 row updated - printTable(stmnt, "SA.T", "*", 4); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge9 complete\n"); - } - - public void testMerge10() { - - try { - - // merge statement with values as source table, with WHERE - // condition that does not not match a row in T - executeMerge("MERGE INTO SA.T " - + "USING (VALUES(10, 'testA', 'testB')) AS X (I, A, B) " - + "ON T.I = X.I " + "WHEN MATCHED THEN " - + "UPDATE SET T.A = X.A, T.B = 'UPDATED' " - + "WHEN NOT MATCHED THEN " - + "INSERT VALUES (X.I, X.A, 'INSERTED');"); - - // 1 row should be inserted - printTable(stmnt, "SA.T", "*", 4); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge10 complete\n"); - } - - public void testMerge11() { - - try { - executeMerge("SET SCHEMA PUBLIC"); - - PreparedStatement ps = connection.prepareStatement( - "MERGE INTO SA.T " - + "USING (VALUES(CAST(? AS INT), 'testA', 'testB')) AS X (I, A, B) " - + "ON T.I = X.I " + "WHEN MATCHED THEN " - + "UPDATE SET T.A = X.A, T.B = 'UPDATED' " - + "WHEN NOT MATCHED THEN " - + "INSERT VALUES (X.I, X.A, 'INSERTED');"); - - ps.setInt(1, 10); - ps.executeUpdate(); - - // 1 row should be inserted - printTable(stmnt, "SA.T", "*", 4); - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMerge10 complete\n"); - } - protected void tearDown() { - - try { - stmnt.execute("DROP SCHEMA SA IF EXISTS CASCADE;"); - connection.close(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("TestSql.tearDown() error: " + e.getMessage()); - } - - super.tearDown(); - } - - public static void main(String[] argv) { - - TestResult result = new TestResult(); - TestCase testA = new TestMerge("testMerge1"); - TestCase testB = new TestMerge("testMerge2"); - TestCase testC = new TestMerge("testMerge3"); - TestCase testD = new TestMerge("testMerge4"); - TestCase testE = new TestMerge("testMerge5"); - TestCase testF = new TestMerge("testMerge6"); - TestCase testG = new TestMerge("testMerge7"); - TestCase testH = new TestMerge("testMerge8"); - TestCase testI = new TestMerge("testMerge9"); - TestCase testJ = new TestMerge("testMerge10"); - TestCase testK = new TestMerge("testMerge11"); - - testA.run(result); - testB.run(result); - testC.run(result); - testD.run(result); - testE.run(result); - testF.run(result); - testG.run(result); - testH.run(result); - testI.run(result); - testJ.run(result); - testK.run(result); - System.out.println("TestMerge error count: " + result.failureCount()); - - Enumeration e = result.failures(); - - while (e.hasMoreElements()) { - System.out.println(e.nextElement()); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestMultiInsert.java b/database/hsqldb/src/org/hsqldb/test/TestMultiInsert.java deleted file mode 100644 index 9c3577fa..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestMultiInsert.java +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Enumeration; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -/** - * Test multiple row insert statements via jdbc against in-memory database - * @author Justin Spadea - */ -public class TestMultiInsert extends TestBase { - - Statement stmnt; - PreparedStatement pstmnt; - Connection connection; - - public TestMultiInsert(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - - try { - connection = super.newConnection(); - stmnt = connection.createStatement(); - } catch (Exception e) {} - } - - private void printTable(String table, String cols, int expected) throws SQLException { - int rows = 0; - ResultSet rs = stmnt.executeQuery("SELECT " + cols + " FROM " + table); - - ResultSetMetaData rsmd = rs.getMetaData(); - String result = "Table " + table + ", expecting " - + expected + " rows total:\n"; - - while (rs.next()) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result += rsmd.getColumnLabel(i + 1) + ":" - + rs.getString(i + 1) + ":"; - } - result += "\n"; - rows++; - } - rs.close(); - System.out.println(result); - assertEquals(expected, rows); - } - - public void testMultiInsert() { - - try { - - // create table T and insert two rows simultaneously - stmnt.execute("DROP TABLE T IF EXISTS;"); - stmnt.execute( - "CREATE TABLE T (I IDENTITY, A CHAR(10), B CHAR(10));"); - stmnt.execute( - "INSERT INTO T VALUES (NULL, 'A', 'a'),(NULL, 'B', 'b');"); - - // print table out - should have two rows - printTable("T", "*", 2); - - // 3 inserts - a normal standard syntax, multi-row syntax for - // single row, and multi-row syntax for two rows - stmnt.execute("INSERT INTO T VALUES(NULL,'single1','s1');"); - stmnt.execute("INSERT INTO T VALUES((NULL,'single2','s2'));"); - stmnt.execute( - "INSERT INTO T VALUES((NULL,'double1','d1'),(NULL,'double2','d2'));"); - - // print table out - should have 6 rows - printTable("T", "*", 6); - - // insert via a prepared statement - both single and multi rows - pstmnt = connection.prepareStatement("INSERT INTO T VALUES (?,?,?)"); - pstmnt.setString(1, null); - pstmnt.setString(2, "prepared1"); - pstmnt.setString(3, "test1"); - pstmnt.executeUpdate(); - pstmnt = connection.prepareStatement("INSERT INTO T VALUES (?,?,?),(null,?,?)"); - pstmnt.setString(1, null); - pstmnt.setString(2, "prepared2"); - pstmnt.setString(3, "test2"); - pstmnt.setString(4, "prepared3"); - pstmnt.setString(5, "test3"); - pstmnt.executeUpdate(); - - // print table out - should have 9 rows - printTable("T", "*", 9); - - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMultiInsert complete"); - - } - - protected void tearDown() { - - try { - connection.close(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("TestSql.tearDown() error: " + e.getMessage()); - } - super.tearDown(); - } - - public static void main(String[] argv) { - - TestResult result = new TestResult(); - TestCase testA = new TestMultiInsert("testMultiInsert"); - - testA.run(result); - System.out.println("TestMultiInsert error count: " + result.failureCount()); - Enumeration e = result.failures(); - while(e.hasMoreElements()) System.out.println(e.nextElement()); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestNullInUnion.java b/database/hsqldb/src/org/hsqldb/test/TestNullInUnion.java deleted file mode 100644 index 277fd410..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestNullInUnion.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.Statement; - -import junit.framework.TestCase; - -public class TestNullInUnion extends TestCase { - - public void testUnionSubquery() throws Exception { - - Class.forName("org.hsqldb.jdbcDriver"); - - Connection con = DriverManager.getConnection("jdbc:hsqldb:mem:test", - "sa", ""); - Statement st = con.createStatement(); - - st.execute( - "CREATE TABLE t1 (id int not null, v1 int, v2 int, primary key(id))"); - st.execute( - "CREATE TABLE t2 (id int not null, v1 int, v3 int, primary key(id))"); - st.execute("INSERT INTO t1 values(1,1,1)"); - st.execute("INSERT INTO t1 values(2,2,2)"); - st.execute("INSERT INTO t2 values(1,3,3)"); - - ResultSet rs = st.executeQuery( - "select t as atable, a as idvalue, b as value1, c as value2, d as value3 from(" - + "(select 't1' as t, t1.id as a, t1.v1 as b, t1.v2 as c, null as d from t1) union" - + "(select 't2' as t, t2.id as a, t2.v1 as b, null as c, t2.v3 as d from t2)) order by atable, idvalue"); - - assertTrue(rs.next()); - assertEquals("t1", rs.getObject("atable")); - assertEquals(1, rs.getInt("idvalue")); - assertEquals(1, rs.getInt("value1")); - assertEquals(1, rs.getInt("value2")); - assertEquals(null, rs.getObject("value3")); - assertTrue(rs.next()); - assertEquals("t1", rs.getObject("atable")); - assertEquals(2, rs.getInt("idvalue")); - assertEquals(2, rs.getInt("value1")); - assertEquals(2, rs.getInt("value2")); - assertEquals(null, rs.getObject("value3")); - assertTrue(rs.next()); - assertEquals("t2", rs.getObject("atable")); - assertEquals(1, rs.getInt("idvalue")); - assertEquals(3, rs.getInt("value1")); - assertEquals(null, rs.getObject("value2")); - assertEquals(3, rs.getInt("value3")); //this fails! - assertFalse(rs.next()); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestPeriodPredicates.java b/database/hsqldb/src/org/hsqldb/test/TestPeriodPredicates.java deleted file mode 100644 index ac72563c..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestPeriodPredicates.java +++ /dev/null @@ -1,1104 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.hsqldb.Scanner; -import org.hsqldb.Session; -import org.hsqldb.jdbc.JDBCConnection; -import org.hsqldb.types.DateTimeType; -import org.hsqldb.types.IntervalType; -import org.hsqldb.types.Type; -import org.hsqldb.types.Types; - -import junit.framework.Assert; - -/** - * Tests the period predicates implementation of the {@link DateTimeType} class. - *

    - * TODO: Add tests with intervals, other date types/time and time zone. - * - * @author Pascal-Eric Servais (peservais@users dot sourceforge.net) - * @version 2.5.0 - * @since 2.3.4 - */ -public class TestPeriodPredicates extends TestBase { - - private Scanner scanner; - private Connection conn; - private Session session; - private Statement statement; - - public TestPeriodPredicates(String name) { - - super(name, "jdbc:hsqldb:mem:test"); - - scanner = new Scanner(); - } - - protected void setUp() throws Exception { - - super.setUp(); - - conn = super.newConnection(); - session = (Session) ((JDBCConnection) conn).getSession(); - statement = conn.createStatement(); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-12 01:02:03') - * OVERLAPS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodOverlapsSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-12 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.overlaps(session, a, ta, b, tb)); - assertTrue(DateTimeType.overlaps(session, b, tb, a, ta)); - } - - public void testSQLFirstPeriodOverlapsSecondPeriod() throws SQLException { - - String sql = - "CALL" - + "(TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-12 01:02:03')" - + "OVERLAPS" - + "(TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03')"; - ResultSet r = statement.executeQuery(sql); - - r.next(); - Boolean v = r.getBoolean(1); - boolean value = v.booleanValue(); - assertTrue(value); - r.close(); - } - - /** - * (TIMESTAMP '2000-01-12 01:02:03', TIMESTAMP '1999-12-01 01:02:03') - * OVERLAPS - * (TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-01-01 01:02:03') - * is true - */ - public void testFirstPeriodOverlapsSecondPeriod_reversed() { - - Object[] a = { - scanner.newTimestamp("2000-01-12 01:02:03"), - scanner.newTimestamp("1999-12-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newTimestamp("2000-01-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.overlapsRelaxed(session, a, ta, b, tb)); - assertTrue(DateTimeType.overlapsRelaxed(session, b, tb, a, ta)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * OVERLAPS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is false - */ - public void testFirstPeriodDoesNotOverlapSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.overlaps(session, a, ta, b, tb)); - assertFalse(DateTimeType.overlaps(session, b, tb, a, ta)); - } - - public void testSQLFirstPeriodDoesNotOverlapSecondPeriod() throws SQLException { - - String sql = - "CALL " - + "PERIOD(TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03')" - + "OVERLAPS " - + "PERIOD(TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03')"; - ResultSet r = statement.executeQuery(sql); - - r.next(); - Boolean v = r.getBoolean(1); - boolean value = v.booleanValue(); - assertFalse(value); - r.close(); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-01 01:02:03') - * OVERLAPS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is false - */ - public void testFirstPeriodDoesNotOverlapSecondPeriod2() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.overlaps(session, a, ta, b, tb)); - assertFalse(DateTimeType.overlaps(session, b, tb, a, ta)); - } - - public void testSQLFirstPeriodDoesNotOverlapSecondPeriod2() throws SQLException { - - String sql = - "CALL " - + "PERIOD(TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-01 01:02:03')" - + "OVERLAPS " - + "PERIOD(TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03')"; - ResultSet r = statement.executeQuery(sql); - - r.next(); - Boolean v = r.getBoolean(1); - boolean value = v.booleanValue(); - assertFalse(value); - r.close(); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-01 01:02:04') - * OVERLAPS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodOverlapsSecondPeriodByOneSecond() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-01 01:02:04") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.overlaps(session, a, ta, b, tb)); - assertTrue(DateTimeType.overlaps(session, b, tb, a, ta)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '40' DAY) - * OVERLAPS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodOverlapsSecondPeriodWithInterval() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "40", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.overlaps(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * OVERLAPS - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '40' DAY) - * is true - */ - public void testFirstPeriodOverlapsSecondPeriodWithIntervalReversed() { - - Object[] a2 = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Object[] b2 = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "40", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - - assertTrue(DateTimeType.overlaps(session, b2, tb, a2, ta)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '31' DAY) - * OVERLAPS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is false - */ - public void testFirstPeriodDoesNotOverlapSecondPeriodWithInterval() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "31", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.overlaps(session, a, ta, b, tb)); - } - - /** - * (INTERVAL '31' DAY, TIMESTAMP '1999-12-01 01:02:03') - * OVERLAPS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is false - */ - public void testPeriodStartingWithInterval() { - - Object[] a = { - scanner.newInterval( - "31", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)), - scanner.newTimestamp("1999-12-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - try { - DateTimeType.overlaps(null, a, ta, b, tb); - fail("It is illegal to start a period with an interval"); - } catch (Exception e) {} - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '31' DAY) - * PRECEDES - * (TIMESTAMP '2000-01-01 01:02:03', INTERVAL '31' DAY) - * is true - */ - public void testFirstPeriodPrecedesSecondPeriodWithInterval() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "31", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newInterval( - "31", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - - assertTrue(DateTimeType.precedes(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-01 01:02:03') - * PRECEDES - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodPrecedesSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.precedes(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * PRECEDES - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-12 01:02:03') - * is false - */ - public void testFirstPeriodDoesNotPrecedesSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-12 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.precedes(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-01 01:02:04') - * PRECEDES - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is false - */ - public void testFirstPeriodDoesNotPrecedesSecondPeriod2() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-01 01:02:04") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.precedes(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-01-01 01:02:03', INTERVAL '7' DAY) - * PRECEDES - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '7' DAY) - * is false - */ - public void testFirstPeriodIsAfterSecondPeriodWithInterval() { - - Object[] a = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newInterval( - "7", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "7", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - - assertFalse(DateTimeType.precedes(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-03-01 01:02:03') - * SUCCEEDS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodSucceedsSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newTimestamp("2000-03-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.succeeds(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * SUCCEEDS - * (TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-03-01 01:02:03') - * is false - */ - public void testFirstPeriodDoesNotSucceedsSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newTimestamp("2000-03-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.succeeds(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-03-01 01:02:03') - * SUCCEEDS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:04') - * is false - */ - public void testFirstPeriodDoesNotSucceedsSecondPeriod2() { - - Object[] a = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newTimestamp("2000-03-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:04") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.succeeds(session, a, ta, b, tb)); - } - - public void testSQLFirstPeriodDoesNotSucceedsSecondPeriod2() throws SQLException { - - String sql = - "CALL " - + "PERIOD(TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-03-01 01:02:03')" - + "SUCCEEDS " - + "PERIOD(TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:04')"; - ResultSet r = statement.executeQuery(sql); - - r.next(); - Boolean v = r.getBoolean(1); - boolean value = v.booleanValue(); - assertFalse(value); - r.close(); - } - - /** - * (TIMESTAMP '2000-02-01 01:02:03', INTERVAL '31' DAY) - * SUCCEEDS - * (TIMESTAMP '2000-01-01 01:02:03', , INTERVAL '31' DAY) - * is true - */ - public void testFirstPeriodSucceedsSecondPeriodWithInterval() { - - Object[] a = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newInterval( - "31", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newInterval( - "31", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - - assertTrue(DateTimeType.succeeds(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-02-01 01:02:03', INTERVAL '31' DAY) - * SUCCEEDS - * (TIMESTAMP '2000-01-01 01:02:03', , INTERVAL '32' DAY) - * is true - */ - public void testFirstPeriodDoesNotSucceedsSecondPeriodWithInterval() { - - Object[] a = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newInterval( - "31", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newInterval( - "32", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - - assertFalse(DateTimeType.succeeds(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-12 01:02:03') - * EQUALS - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-12 01:02:03') - * is true - */ - public void testFirstPeriodEqualsSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-12 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-12 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.equals(session, a, ta, b, tb)); - assertTrue(DateTimeType.equals(session, b, tb, a, ta)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '10' DAY) - * EQUALS - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-11 01:02:03') - * is true - */ - public void testFirstPeriodEqualsSecondPeriodWithOneInterval() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "10", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-11 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.equals(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '10' DAY) - * EQUALS - * (TIMESTAMP '1999-12-01 01:02:03', INTERVAL '10' DAY) - * is true - */ - public void testFirstPeriodEqualsSecondPeriodWithTwoIntervals() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "10", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newInterval( - "10", - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0)) - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, 2, 0) - }; - - assertTrue(DateTimeType.equals(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-02 01:02:03') - * CONTAINS - * TIMESTAMP '1999-12-01 01:02:03' - * is false - */ - public void testFirstPeriodCannotContainsSecondPeriodIfTheyAreEquals() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:01"), - scanner.newTimestamp("1999-12-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), null - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.contains(session, a, ta, b, tb, true)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * CONTAINS - * TIMESTAMP '1999-12-01 01:02:03' - * is true - */ - public void testFirstPeriodContainsItsStartDate() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), null - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.contains(session, a, ta, b, tb, true)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * CONTAINS - * TIMESTAMP '1999-12-31 01:02:03' - * is false - */ - public void testFirstPeriodDoesNotContainsItsEndDate() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-31 01:02:03"), null - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.contains(session, a, ta, b, tb, true)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * CONTAINS - * (TIMESTAMP '1999-12-30 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * is true - */ - public void testFirstPeriodContainsSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-30 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.contains(session, a, ta, b, tb, false)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * CONTAINS - * (TIMESTAMP '1999-12-31 01:02:02', TIMESTAMP '1999-12-31 01:02:03') - * is true - */ - public void testFirstPeriodContainsItselfMinus1Second() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-31 01:02:02"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.contains(session, a, ta, b, tb, false)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * CONTAINS - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * is true - */ - public void testFirstPeriodContainsSecondPeriodEvenIfEquals() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.contains(session, a, ta, b, tb, false)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-31 01:02:03') - * CONTAINS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-12-31 01:02:03') - * is false - */ - public void testFirstPeriodCannotContainsSecondPeriodWhenPrecedes() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("1999-12-31 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-12-31 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.contains(session, a, ta, b, tb, false)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-01 01:02:03') - * PRECEDES - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodImmediatelyPrecedesSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.immediatelyPrecedes(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '2000-01-01 01:02:02') - * PRECEDES - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodDoesNotImmediatelyPrecedesSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("1999-12-01 01:02:03"), - scanner.newTimestamp("2000-01-01 01:02:02") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertFalse(DateTimeType.immediatelyPrecedes(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-03-01 01:02:03') - * SUCCEEDS - * (TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodImmediatelySucceedsSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newTimestamp("2000-03-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:03"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.immediatelySucceeds(session, a, ta, b, tb)); - } - - /** - * (TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-03-01 01:02:03') - * SUCCEEDS - * (TIMESTAMP '2000-01-01 01:02:04', TIMESTAMP '2000-02-01 01:02:03') - * is true - */ - public void testFirstPeriodDoesNotImmediatelySucceedsSecondPeriod() { - - Object[] a = { - scanner.newTimestamp("2000-02-01 01:02:03"), - scanner.newTimestamp("2000-03-01 01:02:03") - }; - Object[] b = { - scanner.newTimestamp("2000-01-01 01:02:04"), - scanner.newTimestamp("2000-02-01 01:02:03") - }; - Type[] ta = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - Type[] tb = { - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0), - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0) - }; - - assertTrue(DateTimeType.immediatelySucceeds(session, a, ta, b, tb)); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestPreparedStatements.java b/database/hsqldb/src/org/hsqldb/test/TestPreparedStatements.java deleted file mode 100644 index 39a46b11..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestPreparedStatements.java +++ /dev/null @@ -1,476 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.TestCase; - -import java.sql.Array; - -/** - * @author fredt@users - */ -public class TestPreparedStatements extends TestCase { - - private Connection con = null; - - private static class sqlStmt { - - boolean prepare; - boolean update; - String command; - Object[] args; - Object ret; - - sqlStmt(String c) { - - command = c; - prepare = false; - update = false; - } - - sqlStmt(String c, boolean p, boolean u, Object[] a) { - - command = c; - prepare = p; - update = u; - args = a; - } - - sqlStmt(String c, boolean p, boolean u, Object[] a, Object r) { - - command = c; - prepare = p; - update = u; - args = a; - ret = r; - } - } - - private sqlStmt[] stmtArray = { - new sqlStmt("drop table public.ivtest if exists cascade"), - new sqlStmt( - "create cached table ivtest(interval1 INTERVAL YEAR TO MONTH," - + " interval2 INTERVAL DAY TO SECOND(3))"), - new sqlStmt("drop table public.dttest if exists cascade"), - new sqlStmt("create cached table dttest(adate date not null, " - + "atime time not null,bg int, primary key(adate,atime))"), - new sqlStmt( - "insert into dttest values(current_date - 10 day, current_time + 1 hour, 1)", - false, true, null), - new sqlStmt( - "insert into dttest values(current_date - 8 day, current_time - 5 hour, 2)", - false, true, null), - new sqlStmt( - "insert into dttest values(current_date - 7 day, current_time - 4 hour, 3)", - false, true, null), - new sqlStmt("insert into dttest values(current_date, '12:44:31', 4)", - false, true, null), - new sqlStmt( - "insert into dttest values(current_date + 3 day, current_time - 12 hour, 5)", - false, true, null), - new sqlStmt("insert into dttest values(current_date + 1 day, current_time - 1 hour, 6)", false, true, null), - new sqlStmt("select atime adate from dttest where atime = ? and adate = ?", - true, false, new Object[] { - "12:44:31", new java.sql.Date(System.currentTimeMillis()) - }), new sqlStmt("insert into ivtest values ?, ?", true, true, - new Object[] { - "1-10", "10 02:15:30.333" - }), new sqlStmt( - "insert into ivtest values CAST (? AS INTERVAL YEAR TO MONTH), CAST (? AS INTERVAL DAY TO SECOND)", - true, true, new Object[] { - "1-10", "10 02:15:30.333" - }), new sqlStmt("script", true, false, null), - new sqlStmt("drop table public.bintest if exists cascade"), - new sqlStmt("create cached table bintest(val BIGINT, id BINARY(100))"), - new sqlStmt("insert into bintest values ?, ?", true, true, - new Object[] { - 10L, new byte[] { - 1, 2, 3, 4, 5 - } - }), new sqlStmt("select val from bintest where id = ?", true, false, - new Object[]{ new byte[] { - 1, 2, 3, 4, 5 - } }, 10L), - }; - - public TestPreparedStatements(String name) { - super(name); - } - - protected void setUp() { - - String url = "jdbc:hsqldb:mem:test"; - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - con = java.sql.DriverManager.getConnection(url, "sa", ""); - } catch (Exception e) {} - } - - public void testA() { - - int i = 0; - - try { - for (i = 0; i < stmtArray.length; i++) { - int j; - - System.out.println(" -- #" + i + " ----------------------- "); - - if (stmtArray[i].prepare) { - Object[] stmtArgs = stmtArray[i].args; - PreparedStatement ps = null; - - System.out.println(" -- preparing\n<<<\n" - + stmtArray[i].command + "\n>>>\n"); - - ps = con.prepareStatement(stmtArray[i].command); - - if (stmtArgs != null) { - System.out.print(" -- setting " + stmtArgs.length - + " Args ["); - - for (j = 0; j < stmtArgs.length; j++) { - System.out.print((j > 0 ? "; " - : "") + stmtArgs[j]); - ps.setObject(j + 1, stmtArgs[j]); - } - - System.out.println("]"); - } - - System.out.println(" -- executing "); - - if (stmtArray[i].update) { - int r = ps.executeUpdate(); - - System.out.println(" ***** ps.executeUpdate gave me " - + r); - } else { - boolean b = ps.execute(); - int count = 0; - - if (b) { - ResultSet rs = ps.getResultSet(); - - while (rs.next()) { - if (count == 0 && stmtArray[i].ret != null) { - super.assertEquals(stmtArray[i].ret, - rs.getObject(1)); - } - - count++; - } - - System.out.print( - " ***** ps.execute returned result row count " - + count); - } else { - System.out.print(" ***** ps.execute gave me " + b); - } - } - } else { - System.out.println(" -- executing directly\n<<<\n" - + stmtArray[i].command + "\n>>>\n"); - - Statement s = con.createStatement(); - boolean b = s.execute(stmtArray[i].command); - - System.out.println(" ***** st.execute gave me " + b); - } - } - } catch (Exception e) { - System.out.println(i + " ?? Caught Exception " + e); - super.fail(); - } - - assertTrue(true); - } - - public void testB() throws SQLException, ClassNotFoundException { - - Statement statement = con.createStatement(); - - statement.execute("DROP TABLE IF EXISTS users CASCADE"); - statement.execute( - "CREATE TABLE IF NOT EXISTS users (id INTEGER, name VARCHAR(25), PRIMARY KEY(id))"); - statement.executeUpdate("INSERT INTO users VALUES(1, 'Ramiro')"); - statement.executeUpdate("INSERT INTO users VALUES(2, 'Chanukya')"); - - String storedProcedure1 = - "CREATE PROCEDURE sp_say_hi(IN greeting_p VARCHAR(10)) " - + "READS SQL DATA DYNAMIC RESULT SETS 2 " + "BEGIN ATOMIC " - + "DECLARE result CURSOR WITH RETURN FOR SELECT COALESCE(greeting_p, 'Hi')+' '+name as greeting FROM users FOR READ ONLY; " - + "DECLARE result1 CURSOR WITH RETURN FOR SELECT * FROM users FOR READ ONLY; " - + "OPEN result; " + "OPEN result1; " + "END"; - - statement.execute(storedProcedure1); - - String sqlCall = "CALL sp_say_hi(?)"; - CallableStatement callableStatement = con.prepareCall(sqlCall); - - callableStatement.setObject("GREETING_P", "Hola"); - - boolean result = callableStatement.execute(); - - assertFalse(result); - - int value = callableStatement.getUpdateCount(); - - assertTrue(value == 0); - - result = callableStatement.getMoreResults(); - - assertTrue(result); - - ResultSet result1 = callableStatement.getResultSet(); - - assertTrue(result1.next()); - - result = callableStatement.getMoreResults(); - - assertTrue(result); - - ResultSet result2 = callableStatement.getResultSet(); - - assertTrue(result2.next()); - - result = callableStatement.getMoreResults(); - - assertFalse(result); - - value = callableStatement.getUpdateCount(); - - assertTrue(value == -1); - } - - public void testC() throws SQLException, ClassNotFoundException { - - Statement statement = con.createStatement(); - - statement.execute("DROP TABLE IF EXISTS testusers"); - statement.execute( - "CREATE TABLE IF NOT EXISTS testusers (id INTEGER, name VARCHAR(25), PRIMARY KEY(id))"); - statement.executeUpdate("INSERT INTO testusers VALUES(1, 'John')"); - statement.executeUpdate("INSERT INTO testusers VALUES(2, 'Tom')"); - statement.executeUpdate("INSERT INTO testusers VALUES(3, 'Carl')"); - statement.executeUpdate("INSERT INTO testusers VALUES(4, 'Greg')"); - statement.executeUpdate("INSERT INTO testusers VALUES(5, 'David')"); - statement.executeUpdate("INSERT INTO testusers VALUES(6, 'Keith')"); - - String select = "SELECT name FROM testusers WHERE name IN (UNNEST(?))"; - PreparedStatement preparedStatement = con.prepareStatement(select, - ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - String[] ids = new String[] { - "Paul", "Greg", "Tom" - }; - Array array = con.createArrayOf("VARCHAR", ids); - - preparedStatement.setArray(1, array); - - ResultSet result1 = preparedStatement.executeQuery(); - - assertTrue(result1.next()); - assertTrue(result1.next()); -/* - String select2 = "SELECT name FROM testusers WHERE name IN (CAST(? AS VARCHAR(10) ARRAY))"; - PreparedStatement preparedStatement2 = con.prepareStatement(select2, - ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - - preparedStatement2.setArray(1, array); - - ResultSet result2 = preparedStatement2.executeQuery(); - - assertTrue(result2.next()); - assertTrue(result2.next()); -*/ - } - - public void testD() throws SQLException, ClassNotFoundException { - - String select = "SET SCHEMA ?"; - PreparedStatement preparedStatement = con.prepareStatement(select); - - preparedStatement.setString(1, "INFORMATION_SCHEMA"); - - int updateCount = preparedStatement.executeUpdate(); - - assertEquals(0, updateCount); - } - - /** - * two statements with same SQL - */ - public void testE() throws SQLException, ClassNotFoundException { - - Statement statement = con.createStatement(); - - statement.execute("DROP TABLE IF EXISTS testusers"); - statement.execute( - "CREATE TABLE IF NOT EXISTS testusers (id INTEGER, name VARCHAR(25), PRIMARY KEY(id))"); - - try { - statement.executeUpdate("INSERT INTO testusers VALUES(1, 'John')"); - statement.executeUpdate("INSERT INTO testusers VALUES(2, 'Tom')"); - statement.executeUpdate("INSERT INTO testusers VALUES(3, 'Carl')"); - statement.executeUpdate("INSERT INTO testusers VALUES(4, 'Greg')"); - statement.executeUpdate( - "INSERT INTO testusers VALUES(5, 'David')"); - statement.executeUpdate( - "INSERT INTO testusers VALUES(6, 'Keith')"); - } catch (SQLException e) {} - - String select = "SELECT name FROM testusers WHERE name = ?"; - PreparedStatement preparedStatementOne = con.prepareStatement(select, - ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - - preparedStatementOne.setString(1, "Tom"); - - ResultSet result1 = preparedStatementOne.executeQuery(); - - assertTrue(result1.next()); - - PreparedStatement preparedStatementTwo = con.prepareStatement(select, - ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - - preparedStatementTwo.setString(1, "Tom"); - - ResultSet result2 = preparedStatementTwo.executeQuery(); - - assertTrue(result2.next()); - - // close first statement - preparedStatementOne.close(); - - // second statement should still be valid - preparedStatementTwo.setString(1, "Greg"); - - result2 = preparedStatementTwo.executeQuery(); - - assertTrue(result2.next()); - } - - /** - * two statements with same SQL - */ - public void testF() throws SQLException, ClassNotFoundException { - - Statement st = con.createStatement(); - - st.execute("DROP TABLE IF EXISTS testtable"); - st.execute("CREATE TABLE testtable (column1 DATE)"); - st.execute("INSERT INTO testtable VALUES (sysdate)"); - - PreparedStatement pst = con.prepareStatement( - "select * from testtable where column1 between ?-? and ?"); - Date date = new Date(System.currentTimeMillis()); - - pst.setDate(1, date); - pst.setInt(2, 3); - pst.setDate(3, date); - - ResultSet resultSet = pst.executeQuery(); - } - - /** - * generated column name case-sensitivity - */ - public void testG() throws SQLException, ClassNotFoundException { - - Statement st = con.createStatement(); - - st.execute("DROP TABLE IF EXISTS testtable"); - st.execute("CREATE TABLE testtable (id INT GENERATED BY DEFAULT AS IDENTITY, column1 DATE)"); - st.execute("INSERT INTO testtable (column1) VALUES (sysdate)", new String[]{"id"}); - - ResultSet rs = st.getGeneratedKeys(); - - boolean genFound = rs.next(); - - assertTrue(genFound); - - PreparedStatement pst = con.prepareStatement( - "select * from testtable where column1 between ?-? and ?"); - Date date = new Date(System.currentTimeMillis()); - - pst.setDate(1, date); - pst.setInt(2, 3); - pst.setDate(3, date); - - ResultSet resultSet = pst.executeQuery(); - - boolean found = rs.next(); - - } - - public void testH() throws SQLException { - - String sqlOne = "with t1(f1) as (select cast(? as int) from (values(0)) t), t2(f2) as (select cast(? as int) from (values(0)) t) select f1 + f2 from t1, t2"; - String sqlTwo = "with t1(f1) as (select cast(:first as int) from (values(0)) t), t2(f2) as (select cast(:sec as int) from (values(0)) t) select f1 + f2 from t1, t2"; - - PreparedStatement pst = con.prepareStatement(sqlOne); - - pst.setInt(1, 3); - pst.setInt(2, 2); - - ResultSet rs = pst.executeQuery(); - - assertTrue(rs.next()); - - int val = rs.getInt(1); - assertEquals(5, val); - - pst = con.prepareStatement(sqlOne); - - pst.setInt(1, 3); - pst.setInt(2, 2); - - rs = pst.executeQuery(); - - assertTrue(rs.next()); - - val = rs.getInt(1); - assertEquals(5, val); - - } - - -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestPreparedSubQueries.java b/database/hsqldb/src/org/hsqldb/test/TestPreparedSubQueries.java deleted file mode 100644 index c2c99d05..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestPreparedSubQueries.java +++ /dev/null @@ -1,317 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; -import java.sql.Timestamp; - -import junit.framework.TestCase; - -/** - * @author kloska@users - * @author fredt@users - */ -public class TestPreparedSubQueries extends TestCase { - - private Connection con = null; - - private static class sqlStmt { - - boolean prepare; - boolean update; - String command; - - sqlStmt(String c, boolean p, boolean u) { - - prepare = p; - command = c; - update = u; - } - } - - private sqlStmt[] stmtArray = { - new sqlStmt("drop table a if exists cascade", false, false), - new sqlStmt("create cached table a (a int identity,b int)", false, - false), - new sqlStmt("create index bIdx on a(b)", false, false), - new sqlStmt("insert into a(b) values(1)", true, true), - new sqlStmt("insert into a(b) values(2)", true, true), - new sqlStmt("insert into a(b) values(3)", true, true), - new sqlStmt("insert into a(b) values(4)", true, true), - new sqlStmt("insert into a(b) values(5)", true, true), - new sqlStmt("insert into a(b) values(6)", true, true), - new sqlStmt( - "update a set b=100 where b>(select b from a X where X.a=2)", - true, true), - new sqlStmt("update a set b=200 where b>(select b from a where a=?)", - true, true), - new sqlStmt( - "update a set b=300 where b>(select b from a X where X.a=?)", - true, true) - }; - private Object[][] stmtArgs = { - {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Integer.valueOf(2) }, - { Integer.valueOf(2) } - }; - - public TestPreparedSubQueries(String name) { - super(name); - } - - protected void setUp() { - - String url = "jdbc:hsqldb:testdb/test"; - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - con = java.sql.DriverManager.getConnection(url, "sa", ""); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void testA() { - - try { - int i = 0; - - for (i = 0; i < stmtArray.length; i++) { - int j; - - System.out.println(" -- #" + i + " ----------------------- "); - - if (stmtArray[i].prepare) { - PreparedStatement ps = null; - - System.out.println(" -- preparing\n<<<\n" - + stmtArray[i].command + "\n>>>\n"); - - ps = con.prepareStatement(stmtArray[i].command); - - System.out.print(" -- setting " + stmtArgs[i].length - + " Args ["); - - for (j = 0; j < stmtArgs[i].length; j++) { - System.out.print((j > 0 ? "; " - : "") + stmtArgs[i][j]); - ps.setObject(j + 1, stmtArgs[i][j]); - } - - System.out.println("]"); - System.out.println(" -- executing "); - - if (stmtArray[i].update) { - int r = ps.executeUpdate(); - - System.out.println(" ***** ps.executeUpdate gave me " - + r); - } else { - boolean b = ps.execute(); - - System.out.print(" ***** ps.execute gave me " + b); - } - } else { - System.out.println(" -- executing directly\n<<<\n" - + stmtArray[i].command + "\n>>>\n"); - - Statement s = con.createStatement(); - boolean b = s.execute(stmtArray[i].command); - - System.out.println(" ***** st.execute gave me " + b); - } - } - } catch (Exception e) { - System.out.println(" ?? Caught Exception " + e); - assertTrue(false); - } - - assertTrue(true); - } - - public void testGenerated() { - - boolean valid = false; - - try { - Statement s = con.createStatement(); - - s.execute("drop table a if exists"); - s.execute("create cached table a (a int identity,b int)"); - s.execute("insert into a(b) values(1)", - Statement.RETURN_GENERATED_KEYS); - - ResultSet r = s.getGeneratedKeys(); - - while (r.next()) { - r.getInt(1); - - valid = true; - } - - r.close(); - assertTrue(valid); - s.execute("insert into a(b) values(2)", new int[]{ 1 }); - - r = s.getGeneratedKeys(); - - while (r.next()) { - r.getInt(1); - - valid = true; - } - - assertTrue(valid); - - s.execute("insert into a(b) values(2)", new String[]{ "A" }); - - r = s.getGeneratedKeys(); - - while (r.next()) { - r.getInt(1); - - valid = true; - } - - assertTrue(valid); - - s.execute("drop table a if exists"); - s.execute("create cached table a (g int generated always as (a + b), a int generated always as identity (start with 5), b int, c timestamp default current_timestamp)"); - s.execute("insert into a(b) values(1)", - Statement.RETURN_GENERATED_KEYS); - - r = s.getGeneratedKeys(); - - while (r.next()) { - int v = r.getInt(2); - - valid = true; - - assertEquals(v, 5); - - } - - r.close(); - assertTrue(valid); - s.execute("insert into a(b) values(2)", new int[]{ 1 }); - - r = s.getGeneratedKeys(); - - while (r.next()) { - int v = r.getInt(1); - - valid = true; - - assertEquals(v, 8); - } - - assertTrue(valid); - - s.execute("insert into a(b) values(2)", new String[]{ "A", "G", "C" }); - - r = s.getGeneratedKeys(); - - while (r.next()) { - Timestamp tv = r.getTimestamp(3); - - int iv = r.getInt(1); - - valid = true; - - assertEquals(iv, 7); - - long diff = System.currentTimeMillis() - tv.getTime(); - - if (diff > 100 || diff <0) { - fail("timestamp not correct"); - } - - } - - assertTrue(valid); - - } catch (Exception e) { - assertTrue(false); - } - } - - public void testIdentity() { - - boolean valid = false; - - try { - Statement s = con.createStatement(); - - s.execute("drop table a if exists"); - s.execute("create cached table a (a int identity, b int)"); - - PreparedStatement p1 = - con.prepareStatement("insert into a(b) values ?"); - - p1.setInt(1, 10); - p1.executeUpdate(); - - PreparedStatement p2 = con.prepareStatement("call identity()"); - ResultSet r = p2.executeQuery(); - - while (r.next()) { - r.getInt(1); - - valid = true; - } - - p1.setInt(1, 11); - p1.executeUpdate(); - - PreparedStatement ps3 = con.prepareStatement( - "select count(*) from a where a in ((select a from a where b = ?) union (select ? from a))"); - - ps3.setInt(1, 10); - ps3.setInt(2, 1); - - r = ps3.executeQuery(); - - while (r.next()) { - int value = r.getInt(1); - - valid = value == 2; - } - - assertTrue(valid); - } catch (Exception e) { - assertTrue(false); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestQuotes.java b/database/hsqldb/src/org/hsqldb/test/TestQuotes.java deleted file mode 100644 index 8e5f94c7..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestQuotes.java +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Test handling of quote characters in strings - * - * @author David Walend - * @author Jason van Zyl - */ -public class TestQuotes extends TestCase { - - private static final String CREATETABLE = - "create table if not exists quotetest (test varchar(100))"; - private static final String DELETE = "delete from quotetest"; - private static final String TESTSTRING = - "insert into quotetest (test) values (?)"; - private static final String NOQUOTES = "the house of the dog of kevin"; - private static final String QUOTES = "kevin's dog's house"; - private static final String RESULT = "select * from quotetest"; - - public TestQuotes(String testName) { - super(testName); - } - - /** - * Run all related test methods - */ - public static Test suite() { - return new TestSuite(org.hsqldb.test.TestQuotes.class); - } - - public void testSetString() { - - Connection connection = null; - Statement statement = null; - PreparedStatement pStatement = null; - ResultSet rs1 = null; - ResultSet rs2 = null; - - try { - DriverManager.registerDriver(new org.hsqldb.jdbc.JDBCDriver()); - - connection = DriverManager.getConnection("jdbc:hsqldb:mem:.", "sa", - ""); - statement = connection.createStatement(); - - statement.executeUpdate(CREATETABLE); - - pStatement = connection.prepareStatement(TESTSTRING); - - pStatement.setString(1, NOQUOTES); - pStatement.executeUpdate(); - - rs1 = statement.executeQuery(RESULT); - - rs1.next(); - - String result1 = rs1.getString(1); - - assertTrue("result1 is -" + result1 + "- not -" + NOQUOTES + "-", - NOQUOTES.equals(result1)); - statement.executeUpdate(DELETE); - pStatement.setString(1, QUOTES); - pStatement.executeUpdate(); - - rs2 = statement.executeQuery(RESULT); - - rs2.next(); - - String result2 = rs2.getString(1); - - assertTrue("result2 is " + result2, QUOTES.equals(result2)); - } catch (SQLException sqle) { - fail(sqle.getMessage()); - } finally { - if (rs2 != null) { - try { - rs2.close(); - } catch (SQLException sqle) { - sqle.printStackTrace(); - } - } - - if (rs1 != null) { - try { - rs1.close(); - } catch (SQLException sqle) { - sqle.printStackTrace(); - } - } - - if (statement != null) { - try { - statement.close(); - } catch (SQLException sqle) { - sqle.printStackTrace(); - } - } - - if (pStatement != null) { - try { - pStatement.close(); - } catch (SQLException sqle) { - sqle.printStackTrace(); - } - } - - if (connection != null) { - try { - connection.close(); - } catch (SQLException sqle) { - sqle.printStackTrace(); - } - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestSchemaParse.java b/database/hsqldb/src/org/hsqldb/test/TestSchemaParse.java deleted file mode 100644 index 881e6a93..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestSchemaParse.java +++ /dev/null @@ -1,1028 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.TestCase; - -public class TestSchemaParse extends TestCase { - - Connection con = null; - Statement statement; - private static final String ipref = "INFORMATION_SCHEMA."; - - protected void setUp() throws Exception { - - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - con = DriverManager.getConnection("jdbc:hsqldb:mem:parsetest", "sa", - ""); - statement = con.createStatement(); - - execSQL("SET AUTOCOMMIT false", 0); - execSQL("CREATE TABLE tsttbl (i INT, vc VARCHAR(100))", 0); - execSQL( - "CREATE TABLE bigtbl (i INT, vc VARCHAR(100), i101 INT, i102 INT, " - + "i103 INT, i104 INT, i105 INT, i106 INT, i107 INT, " - + "i108 INT, i109 INT, i110 INT, i111 INT, i112 INT, " - + "i113 INT, i114 INT, i115 INT, i116 INT, i117 INT, " - + "i118 INT, i119 INT)", 0); - execSQL("INSERT INTO tsttbl VALUES (1, 'one')", 1); - execSQL("INSERT INTO tsttbl VALUES (2, 'two')", 1); - execSQL("CREATE TABLE joinedtbl (i2 INT, vc2 VARCHAR(100))", 0); - execSQL("INSERT INTO joinedtbl VALUES (2, 'zwei')", 1); - execSQL("CREATE TABLE indexedtbl (i3 INT, vc3 VARCHAR(100))", 0); - execSQL("INSERT INTO indexedtbl VALUES (3, 'tres')", 1); - execSQL("CREATE TABLE triggedtbl (i4 INT, vc4 VARCHAR(100))", 0); - - // Can't test text tables in memory-only DB. - //execSQL("CREATE TEXT TABLE texttbl (i5 INT, vc5 VARCHAR(100))", 0); - execSQL("INSERT INTO triggedtbl VALUES (4, 'quatro')", 1); - execSQL("CREATE FUNCTION tstali(VARCHAR(100)) RETURNS VARCHAR(100) " - + "LANGUAGE JAVA EXTERNAL NAME " - + "'CLASSPATH:org.hsqldb.test.BlaineTrig.capitalize'", 0); - execSQL("CREATE UNIQUE INDEX tstind ON indexedtbl (i3)", 0); - execSQL("CREATE SEQUENCE tstseq", 0); - execSQL("CREATE TRIGGER tsttrig AFTER INSERT ON triggedtbl CALL \"" - + "org.hsqldb.test.BlaineTrig\"", 0); - execSQL("CREATE USER tstuser PASSWORD fake", 0); - execSQL("CREATE TABLE constrainedtbl (i6 INT, vc6 VARCHAR(100), " - + "CONSTRAINT ucons UNIQUE(i6))", 0); - execSQL("CREATE TABLE primarytbl (i8 INT, i18 INT, vc8 VARCHAR(100), " - + "UNIQUE(i8), UNIQUE(i18))", 0); - execSQL( - "CREATE TABLE foreigntbl (i7 INT, vc7 VARCHAR(100), " - + "CONSTRAINT tstfk FOREIGN KEY (i7) REFERENCES primarytbl (i8))", 0); - execSQL("CREATE TABLE playtbl (i9 INT, vc9 VARCHAR(100))", 0); - execSQL("CREATE TABLE toindextbl (i10 INT, vc10 VARCHAR(100))", 0); - execSQL("INSERT INTO toindextbl VALUES (10, 'zehn')", 1); - - // Do the view last since it can cause dependendies with indexes, etc. - execSQL("CREATE VIEW tstview AS SELECT * FROM tsttbl WHERE i < 10", 0); - execSQL("COMMIT", 0); - } - - // Want to permit the SHUTDOWN SQL command in tearDown() to fail iff - // the test method run has tested SHUTDOWN. - private boolean shutdownTested = false; - - protected void tearDown() throws Exception { - - // Shut down to destroy all of the DB objects (only works because - // it's an in-memory instance. - execSQL("SHUTDOWN", shutdownTested); - - if (con != null) { - con.close(); - } - - super.tearDown(); - } - - public void test2pTables() throws Exception { - - String prefix = "public."; - - execSQL("DROP VIEW tstview", 0); // Just so deps don't cause problems - - // Select commands - assertEquals(2, queryRowCount("SELECT i FROM " + prefix - + "tsttbl WHERE i IN (1, 2, 3)")); - execSQL("CREATE TABLE " + prefix - + "newtbl AS (SELECT * FROM tsttbl) WITH DATA", 0); - assertEquals(2, queryRowCount("SELECT admin FROM " + ipref - + "system_users")); - assertEquals("Sub-query", 1, - queryRowCount("SELECT vc FROM " + prefix - + "tsttbl WHERE i = (\n" - + " SELECT i2 FROM " + prefix - + "joinedtbl\n" + ")")); - assertEquals("Join", 1, - queryRowCount("SELECT vc FROM " + prefix + "tsttbl, " - + prefix + "joinedtbl\n" - + "WHERE tsttbl.i = joinedtbl.i2\n" - + "AND joinedtbl.vc2 = 'zwei'")); - - // Selects using Labels/Aliases - assertEquals( - 2, queryRowCount( - "SELECT ali.i FROM " + prefix - + "tsttbl ali WHERE ali.i IN (1, 2, 3)")); - execSQL("CREATE TABLE " + prefix - + "newtbl2 AS (SELECT * FROM tsttbl) WITH DATA", 0); - execSQL("CREATE TABLE newtbl3 AS (SELECT * FROM " + prefix - + "tsttbl ali) WITH DATA", 0); - execSQL("CREATE TABLE " + prefix + "newtbl4 AS (SELECT * FROM " - + prefix + "tsttbl ali) WITH DATA", 0); - assertEquals(2, queryRowCount("SELECT ali.admin FROM " + ipref - + "system_users ali")); - assertEquals("Sub-query", 1, - queryRowCount("SELECT ali.vc FROM " + prefix - + "tsttbl ali WHERE i = (\n" - + " SELECT bali.i2 FROM " + prefix - + "joinedtbl bali\n" + ")")); - assertEquals("Join", 1, - queryRowCount("SELECT ali.vc FROM " + prefix - + "tsttbl ali, " + prefix - + "joinedtbl bali\n" - + "WHERE ali.i = bali.i2\n" - + "AND bali.vc2 = 'zwei'")); - /* Mixed aliases not working yet - assertEquals("Join", 1, queryRowCount( - "SELECT ali.vc FROM " + prefix + "tsttbl ali, " + prefix - + "joinedtbl bali\nWHERE tsttbl.i = joinedtbl.i2\n" - + "AND bali.vc2 = 'zwei'")); - */ - - // Alter Table commands - execSQL("ALTER TABLE " + prefix + "playtbl RENAME TO " + prefix - + "renamedtbl", 0); - execSQL("ALTER TABLE " + prefix + "renamedtbl RENAME TO " + prefix - + "playtbl", 0); - execSQL("ALTER TABLE " + prefix - + "constrainedtbl ADD CONSTRAINT con1 CHECK (i6 > 4)", 0); - execSQL("ALTER TABLE " + prefix - + "tsttbl ADD COLUMN vco1 VARCHAR(100)", 0); - execSQL("ALTER TABLE " + prefix + "tsttbl DROP COLUMN vco1", 0); - execSQL("ALTER TABLE " + prefix - + "tsttbl ADD COLUMN vco1 VARCHAR(100)", 0); - execSQL("ALTER TABLE " + prefix - + "tsttbl ALTER COLUMN vco1 RENAME TO j1", 0); - execSQL("ALTER TABLE " + prefix - + "constrainedtbl DROP CONSTRAINT con1", 0); - execSQL("ALTER TABLE " + prefix + "foreigntbl DROP CONSTRAINT tstfk", - 0); - execSQL("ALTER TABLE " + prefix - + "foreigntbl ADD CONSTRAINT tstfk FOREIGN KEY " - + "(i7) REFERENCES primarytbl (i8)", 0); - execSQL("ALTER TABLE " + prefix - + "playtbl ADD CONSTRAINT ucons9 UNIQUE (i9)", 0); - - // Drop table command - execSQL("DROP TABLE " + prefix + "playtbl", 0); - - // Set table readonly command - execSQL("SET TABLE " + prefix + "tsttbl READONLY true", 0); - execSQL("SET TABLE " + prefix + "tsttbl READONLY false", 0); - - // Create table commands - execSQL("CREATE TABLE " + prefix + "tsttbly (i INT, vc VARCHAR(100))", - 0); - execSQL("CREATE CACHED TABLE " + prefix - + "tsttblx (i INT, vc VARCHAR(100))", 0); - execSQL("CREATE TABLE constrz (i6 INT, vc6 VARCHAR(100), " - + "CONSTRAINT uconsz UNIQUE(i6))", 0); - execSQL( - "CREATE TABLE forztbl (i7 INT, vc7 VARCHAR(100), " - + "CONSTRAINT tstfkz FOREIGN KEY (i7) REFERENCES primarytbl (i8))", 0); - - // Update command - execSQL("UPDATE " + prefix + "tsttbl SET vc = 'eleven' WHERE i = 1", - 1); - - // delete - execSQL("DELETE FROM " + prefix + "tsttbl WHERE i = 1", 1); - - // grant, revoke - execSQL("GRANT ALL ON " + prefix + "tsttbl TO tstuser", 0); - execSQL("REVOKE ALL ON " + prefix + "tsttbl FROM tstuser RESTRICT", 0); - } - - public void test2pViews() throws Exception { - - String prefix = "public."; - - assertEquals(2, queryRowCount("SELECT i FROM " + prefix - + "tstview WHERE i IN (1, 2, 3)")); - assertEquals(2, queryRowCount("SELECT i FROM tstview")); - assertEquals(2, queryRowCount("SELECT ali.i FROM tstview ali")); - assertEquals("Sub-query", 1, - queryRowCount("SELECT vc FROM " + prefix - + "tstview WHERE i = (\n" - + " SELECT i2 FROM " + prefix - + "joinedtbl\n" + ")")); - assertEquals("Join", 1, - queryRowCount("SELECT vc FROM " + prefix + "tstview, " - + prefix + "joinedtbl\n" - + "WHERE tstview.i = joinedtbl.i2\n" - + "AND joinedtbl.vc2 = 'zwei'")); - assertEquals( - 2, queryRowCount( - "SELECT i FROM " + prefix - + "tstview ali WHERE ali.i IN (1, 2, 3)")); - - // view - execSQL("CREATE VIEW " + prefix - + "tstview2 AS SELECT * FROM tsttbl WHERE i < 10", 0); - - // grant, revoke - execSQL("GRANT ALL ON " + prefix + "tstview TO tstuser", 0); - execSQL("REVOKE ALL ON " + prefix + "tstview FROM tstuser RESTRICT", - 0); - - // drop - execSQL("DROP VIEW tstview", 0); - } - - public void test2pSequences() throws Exception { - - String prefix = "public."; - - execSQL("CREATE SEQUENCE " + prefix + "tstseq2", 0); - execSQL("ALTER SEQUENCE " + prefix + "tstseq RESTART WITH 23", 0); - assertEquals(1, queryRowCount("SELECT next value FOR " + prefix - + "tstseq FROM tsttbl WHERE i = 1")); - execSQL("DROP SEQUENCE " + prefix + "tstseq", 0); - } - - public void test2pConstraints() throws Exception { - - String prefix = "public."; - - // Some named constraints - execSQL("CREATE TABLE constbl1 (i11 INT, vc12 VARCHAR(100), " - + "CONSTRAINT " + prefix + "uconsw UNIQUE(vc12))", 0); - execSQL("CREATE TABLE constbl2 (i11 INT, vc12 VARCHAR(100), " - + "CONSTRAINT " + prefix + "chk CHECK (i11 > 4))", 0); - execSQL("CREATE TABLE for2tbl (i7 INT, vc7 VARCHAR(100), " - + "CONSTRAINT " + prefix - + "tstfk2 FOREIGN KEY (i7) REFERENCES primarytbl (i8))", 0); - execSQL("CREATE TABLE for3tbl (i7 INT, vc7 VARCHAR(100), " - + "CONSTRAINT " + prefix + "tstpk2 PRIMARY KEY (i7))", 0); - execSQL("ALTER TABLE constrainedtbl ADD CONSTRAINT " + prefix - + "con1 CHECK (i6 > 4)", 0); - execSQL("ALTER TABLE foreigntbl ADD CONSTRAINT " + prefix - + "tstfkm FOREIGN KEY " - + "(i7) REFERENCES primarytbl (i18)", 0); - execSQL("ALTER TABLE for3tbl DROP CONSTRAINT " + prefix + "tstpk2", 0); - } - - public void test2pIndexes() throws Exception { - - String prefix = "public."; - - execSQL("CREATE UNIQUE INDEX playind ON playtbl (i9)", 0); - execSQL("CREATE UNIQUE INDEX bigind ON bigtbl (i)", 0); - execSQL("CREATE UNIQUE INDEX " + prefix + "tstind2 ON tsttbl (i)", 0); - execSQL("ALTER INDEX " + prefix + "playind RENAME TO renamedind", 0); - execSQL("ALTER INDEX " + prefix + "renamedind RENAME TO " + prefix - + "tstind22", 0); - execSQL("ALTER INDEX tstind RENAME TO " + prefix + "renamedind", 0); - execSQL("DROP INDEX " + prefix + "bigind", 0); - } - - public void test2pAliases() throws Exception { - - String prefix = "public."; - - // All occurrences of "expect" in this method indicate bugs. - // When fixed, don't change the value of "expect" in the method body. - int expect = 0; - - expect = SQL_ABORT; - - execSQL( - "CREATE FUNCTION " + prefix + "tstalias(A VARCHAR(100)) " - + "RETURNS VARCHAR(100) " - + "LANGUAGE JAVA EXTERNAL NAME \'org.hsqldb.test.BlaineTrig.capitalize\'", 0); - - // Following should not throw an exception: - assertEquals( - 1, queryRowCount( - "SELECT " + prefix - + "tstalias('helo') FROM tsttbl WHERE i = 1")); - } - - public void test2pTriggers() throws Exception { - - String prefix = "public."; - - execSQL("CREATE TRIGGER " + prefix - + "tsttrig2 AFTER INSERT ON triggedtbl " - + "CALL \"org.hsqldb.test.BlaineTrig\"", 0); - execSQL("DROP TRIGGER " + prefix + "tsttrig", 0); - } - - public void testSanityCheck() throws Exception { - - // All occurrences of "expect" in this method indicate bugs. - // When fixed, change the value of "expect" to 0: - int expect = SQL_ABORT; - - // The most basic CREATEs and INSERTs would have already failed - // in the setup method. - // Get rid of view early so it doesn't cause dependency problems. - assertEquals(2, queryRowCount("SELECT i FROM tstview")); - execSQL("DROP VIEW tstview", 0); - execSQL("CREATE CACHED TABLE cachtbl (i INT, vc VARCHAR(100))", 0); - execSQL("SET TABLE tsttbl READONLY true", 0); - execSQL("SET TABLE tsttbl READONLY false", 0); - execSQL("INSERT INTO tsttbl VALUES (11, 'eleven')", 1); - assertEquals(1, queryRowCount("SELECT i FROM tsttbl WHERE i = 1")); - assertEquals( - 2, queryRowCount("SELECT i FROM tsttbl WHERE i IN (1, 2, 3)")); - execSQL("ALTER SEQUENCE tstseq RESTART WITH 13", 0); - execSQL("ALTER TABLE playtbl RENAME TO renamedtbl", 0); - execSQL("ALTER TABLE renamedtbl RENAME TO playtbl", 0); - execSQL("DROP INDEX tstind", 0); - execSQL("DROP TABLE bigtbl", 0); - execSQL("DROP SEQUENCE tstseq", 0); - execSQL("SET FILES LOG SIZE 5", 0); - execSQL("UPDATE tsttbl SET vc = 'eleven' WHERE i = 1", 1); - execSQL( - "ALTER TABLE constrainedtbl ADD CONSTRAINT con1 CHECK (i6 > 4)", - 0); - - // Can't test text tables in in-memory DB. - execSQL("COMMIT", 0); - execSQL("DELETE FROM tsttbl WHERE i < 10", 2); - assertEquals(1, queryRowCount("SELECT i FROM tsttbl")); - execSQL("ROLLBACK", 0); - assertEquals(3, queryRowCount("SELECT i FROM tsttbl")); - - // Remember that inserts must change after adding a column. - execSQL("ALTER TABLE tsttbl ADD COLUMN vco1 VARCHAR(100)", 0); - execSQL("ALTER TABLE tsttbl DROP COLUMN vco1", 0); - execSQL("CREATE UNIQUE INDEX tstind ON tsttbl (i)", 0); - execSQL("SET AUTOCOMMIT true", 0); - execSQL("SET AUTOCOMMIT false", 0); - execSQL("SET IGNORECASE true", 0); - execSQL("SET IGNORECASE false", 0); - execSQL("SET PASSWORD blah", 0); - execSQL("SET PASSWORD 'blah'", 0); - execSQL("SET DATABASE REFERENTIAL INTEGRITY true", 0); - execSQL("GRANT ALL ON playtbl TO tstuser", 0); - execSQL("REVOKE ALL ON playtbl FROM tstuser RESTRICT", 0); - -// TODO: These should not throw a Null Pointer exception. - execSQL("ALTER INDEX tstind RENAME TO renamedind", 0); - execSQL("ALTER INDEX renamedind RENAME TO tstind", 0); - execSQL("ALTER USER tstuser SET PASSWORD frank", 0); - execSQL("ALTER USER tstuser SET PASSWORD 'frank'", 0); - execSQL("ALTER TABLE tsttbl ADD COLUMN vco1 VARCHAR(100)", 0); - execSQL("ALTER TABLE tsttbl ALTER COLUMN vco1 RENAME TO j1", 0); - execSQL("ALTER TABLE constrainedtbl DROP CONSTRAINT con1", 0); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", 0); - execSQL("ALTER TABLE foreigntbl ADD CONSTRAINT tstfk FOREIGN KEY " - + "(i7) REFERENCES primarytbl (i8)", 0); - assertEquals("Sub-query", 1, - queryRowCount("SELECT vc FROM tsttbl WHERE i = (\n" - + " SELECT i2 FROM joinedtbl\n" + ")")); - assertEquals( - "Join", 1, - queryRowCount( - "SELECT vc FROM tsttbl, joinedtbl WHERE tsttbl.i = joinedtbl.i2\n" - + "AND joinedtbl.vc2 = 'zwei'")); - - // Over-specified table names - assertEquals( - "Over-specified Query 1", 1, - queryRowCount("SELECT tsttbl.i FROM tsttbl WHERE tsttbl.i = 1")); - assertEquals("Over-specified Query 2", 1, - queryRowCount("SELECT tsttbl.i FROM tsttbl WHERE i = 1")); - assertEquals("Over-specified Query 3", 1, - queryRowCount("SELECT i FROM tsttbl WHERE tsttbl.i = 1")); - - // HSQLDB labels, Oracle aliases - assertEquals("Trivial Label/alias 1", 1, - queryRowCount("SELECT i FROM tsttbl ali WHERE i = 1")); - assertEquals("Trivial Label/alias 2", 1, - queryRowCount("SELECT i FROM tsttbl AS ali WHERE i = 1")); - assertEquals( - "Trivial Label/alias 3", 1, - queryRowCount("SELECT ali.i FROM tsttbl ali WHERE i = 1")); - assertEquals( - "Trivial Label/alias 4", 1, - queryRowCount("SELECT i FROM tsttbl ali WHERE ali.i = 1")); - assertEquals( - "Trivial Label/alias 5", 1, - queryRowCount("SELECT ali.i FROM tsttbl ali WHERE ali.i = 1")); - - /* - * Uncomment when this mixing of aliases and real names is fixed. - * - * assertEquals("Mixed Label/aliases 1", 1, queryRowCount( - * "SELECT tsttbl.i FROM tsttbl ali WHERE i = 1")); - * assertEquals("Mixed Label/aliases 2", 1, queryRowCount( - * "SELECT i FROM tsttbl ali WHERE tsttbl.i = 1")); - * assertEquals("Mixed Label/aliases 3", 1, queryRowCount( - * "SELECT tsttbl.i FROM tsttbl ali WHERE tsttbl.i = 1")); - * assertEquals("Mixed Label/aliases 4", 1, queryRowCount( - * "SELECT tsttbl.i FROM tsttbl ali WHERE ali.i = 1")); - * assertEquals("Mixed Label/aliases 5", 1, queryRowCount( - * "SELECT ali.i FROM tsttbl ali WHERE tsttbl.i = 1")); - */ - assertEquals( - "Join w/Labels/aliases 1", 1, - queryRowCount( - "SELECT vc FROM tsttbl ali1, joinedtbl ali2\n" - + "WHERE i = i2 AND vc2 = 'zwei'")); - assertEquals( - "Join w/Labels/aliases 2", 1, - queryRowCount( - "SELECT vc FROM tsttbl ali1, joinedtbl ali2\n" - + "WHERE ali1.i = i2 AND ali2.vc2 = 'zwei'")); - assertEquals( - "Join w/Labels/aliases 3", 1, - queryRowCount( - "SELECT ali1.vc FROM tsttbl ali1, joinedtbl ali2\n" - + "WHERE ali1.i = i2 AND ali2.vc2 = 'zwei'")); - assertEquals( - "Join w/Labels/aliases 4", 1, - queryRowCount( - "SELECT ali1.vc FROM tsttbl ali1, joinedtbl ali2\n" - + "WHERE i = i2 AND vc2 = 'zwei'")); - - /* - * Uncomment when this mixing of aliases and real names is fixed. - * assertEquals("Join w/Mixed Labels/aliases 1", 1, queryRowCount( - * "SELECT vc FROM tsttbl ali1, joinedtbl ali2\n" - * + "WHERE tsttbl.i = i2 AND vc2 = 'zwei'")); - * assertEquals("Join w/Mixed Labels/aliases 2", 1, queryRowCount( - * "SELECT vc FROM tsttbl ali1, joinedtbl ali2\n" - * + "WHERE tsttbl.i = i2 AND joinedtbl.vc2 = 'zwei'")); - * assertEquals("Join w/Mixed Labels/aliases 3", 1, queryRowCount( - * "SELECT ali1.vc FROM tsttbl ali1, joinedtbl ali2\n" - * + "WHERE ali1.i = i2 AND joinedtbl.vc2 = 'zwei'")); - * assertEquals("Join w/Mixed Labels/aliases 4", 1, queryRowCount( - * "SELECT tsttbl.vc FROM tsttbl ali1, joinedtbl ali2\n" - * + "WHERE ali1.i = i2 AND ali2.vc2 = 'zwei'")); - * assertEquals("Join w/Mixed Labels/aliases 5", 1, queryRowCount( - * "SELECT tsttbl.vc FROM tsttbl ali1, joinedtbl ali2\n" - * + "WHERE i = i2 AND vc2 = 'zwei'")); - * assertEquals("Join w/Mixed Labels/aliases 6", 1, queryRowCount( - * "SELECT tsttbl.vc FROM tsttbl ali1, joinedtbl ali2\n" - * + "WHERE i = i2 AND joinedtbl.vc2 = 'zwei'")); - */ - execSQL("CHECKPOINT bad", expect); - execSQL("INSERT INTO tsttbl(i, vc) VALUES (12, 'twelve')", 1); - execSQL("CREATE TABLE newtbl AS (SELECT * FROM tsttbl) WITH DATA", 0); - } - - public void testTwoPartKeywords() throws Exception { - multiPartKeywords("public."); - } - - public void testInvalidTwoPartKeywords() throws Exception { - multiPartKeywords("alpha."); - } - - public void testThreePartKeywords() throws Exception { - multiPartKeywords("public.public."); - } - - public void testInvalidThreePartKeywords() throws Exception { - multiPartKeywords("alpha.public."); - } - - public void multiPartKeywords(String pref) throws Exception { - - /* - * Search for "expect =". This indicates a bug that needs fixing. - */ - /* - * IMPORTANT!!!! When fixed, the method should NOT change the - * expect value from SQL_ABORT. - * Where "expect" is used there is always a real error. - */ - int expect = SQL_ABORT; - - // If > 2 name parts. E.g. "x.y.z". - boolean manyParter = (pref.lastIndexOf('.') != pref.indexOf('.')); - - // Prep for we will attempt to drop later - execSQL("DROP VIEW tstview", 0); // Don't want dep. problems - execSQL("CREATE TABLE adroptbl (i INT, vc VARCHAR(100))", 0); - execSQL("CREATE TABLE bdroptbl (i INT, vc VARCHAR(100))", 0); - execSQL("CREATE UNIQUE INDEX adropind ON adroptbl (i)", 0); - execSQL("CREATE UNIQUE INDEX bdropind ON bdroptbl (i)", 0); - execSQL("CREATE SEQUENCE bdropseq", 0); - execSQL("CREATE SEQUENCE adropseq", 0); - execSQL("CREATE TRIGGER adroptrig AFTER INSERT ON adroptbl CALL \"" - + "org.hsqldb.test.BlaineTrig\"", 0); - execSQL("CREATE TRIGGER bdroptrig AFTER INSERT ON bdroptbl CALL \"" - + "org.hsqldb.test.BlaineTrig\"", 0); - execSQL("CREATE VIEW adropviewx AS SELECT * FROM adroptbl", 0); - execSQL("CREATE VIEW bdropviewx AS SELECT * FROM bdroptbl", 0); - execSQL("ALTER TABLE playtbl ADD COLUMN newc VARCHAR(100)", 0); // prep - execSQL("SET TABLE tsttbl READONLY false", 0); // reset - execSQL("SET TABLE tsttbl READONLY " + pref + "true", expect); - execSQL(pref + "CREATE SEQUENCE tstseqa", expect); - execSQL(pref + "SET PROPERTY \"hsqldb.first_identity\" 4", expect); - execSQL("SET " + pref + "PROPERTY \"hsqldb.first_identity\" 4", - expect); - - /* This block not keywords, but other non-Strings */ - execSQL("SELECT i FROM tsttbl WHERE i = " + pref + "1", expect); - execSQL("SELECT i FROM tsttbl WHERE vc = " + pref + "'1.3'", expect); - execSQL("SELECT i FROM tsttbl WHERE vc = " + pref + "1", expect); - execSQL("SELECT i FROM tsttbl WHERE i = " + pref + "'1.3'", expect); - execSQL("SELECT i FROM tsttbl WHERE " + pref + "1 = " + pref + "1", - expect); - execSQL("SELECT i FROM tsttbl WHERE " + pref + "'1.3' = " + pref - + "'1.3'", expect); - execSQL("SELECT i FROM tsttbl WHERE " + pref + "true = " + pref - + "true", expect); - execSQL("SELECT i FROM tsttbl WHERE i " + pref + "IN (2, 4)", expect); - execSQL("SELECT i FROM tsttbl WHERE i < 3 y.AND i > 0", expect); - execSQL("SELECT i FROM tsttbl WHERE i < y.3 AND i > 0", expect); - execSQL("INSERT INTO tsttbl VALUES (" + pref + "1, 'one')", expect); - execSQL("CREATE VIEW tstviewx AS SELECT " + pref - + "* FROM tsttbl WHERE i < 10", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL("INSERT INTO tsttbl VALUES (1, " + pref + "'one')", expect); - execSQL("CREATE UNIQUE INDEX tstinda ON toindextbl (" + pref + "i10)", - expect); - execSQL("DROP INDEX tstinda IF EXISTS", 0); // reset - execSQL("CREATE VIEW tstviewx AS SELECT * FROM tsttbl WHERE i < " - + pref + "10", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL("xDROP VIEW adropview", expect); - execSQL("DROP xVIEW bdropview", expect); - execSQL("xDROP TRIGGER adroptrig", expect); - execSQL("DROP xTRIGGER bdroptrig", expect); - execSQL("xDROP INDEX adropind", expect); - execSQL("DROP xINDEX bdropind", expect); - execSQL("xDROP TABLE adroptbl", expect); - execSQL("DROP xTABLE bdroptbl", expect); - execSQL("xDROP SEQUENCE adropseq", expect); - execSQL("DROP xSEQUENCE bdropseq", expect); - execSQL("SET LOGSIZE " + pref + "5", expect); - - // Can't test text tables in in-memory DB. - execSQL(pref + "SET TABLE texttbl SOURCE \"test.csv;fs=|\"", expect); - execSQL("SET " + pref + "TABLE texttbl SOURCE \"test.csv;fs=|\"", - expect); - execSQL("SET TABLE texttbl " + pref + "SOURCE \"test.csv;fs=|\"", - expect); - execSQL("SET TABLE texttbl SOURCE " + pref + "\"test.csv;fs=|\"", - expect); - execSQL("UPDATE tsttbl SET vc = " + pref + "'eleven' WHERE i = 1", - expect); - execSQL("UPDATE tsttbl SET vc = 'eleven' WHERE i = " + pref + "1", - expect); - execSQL("ALTER SEQUENCE tstseq RESTART WITH " + pref + "13", expect); - execSQL("ALTER TABLE constrainedtbl ADD CONSTRAINT con1 CHECK (i6 > " - + pref + "4)", expect); - execSQL(pref + "INSERT INTO tsttbl VALUES (1, 'one')", expect); - execSQL("INSERT " + pref + "INTO tsttbl VALUES (1, 'one')", expect); - execSQL(pref + "DELETE FROM tsttbl WHERE i < 10", expect); - execSQL(pref + "SELECT i FROM tsttbl", expect); - execSQL("SELECT i " + pref + "FROM tsttbl", expect); - execSQL("SELECT i FROM tsttbl " + pref + "WHERE i > 0", expect); - execSQL(pref + "CREATE ALIAS alpha.tstalia " - + "FOR \"org.hsqldb.test.BlaineTrig.capitalize\"", expect); - execSQL("CREATE " + pref + "ALIAS tstalib " - + "FOR \"org.hsqldb.test.BlaineTrig.capitalize\"", expect); - execSQL("CREATE ALIAS tstalic " + pref - + "FOR \"org.hsqldb.test.BlaineTrig.capitalize\"", expect); - execSQL("CREATE ALIAS tstalid " + "FOR " + pref - + "\"org.hsqldb.test.BlaineTrig.capitalize\"", expect); - execSQL("ALTER " + pref + "TABLE playtbl DROP COLUMN newc", expect); - execSQL("CREATE " + pref + "SEQUENCE tstseqb", expect); - execSQL("CREATE " + pref - + "TRIGGER tsttrigx AFTER INSERT ON triggedtbl CALL '" - + "org.hsqldb.test.BlaineTrig'", expect); - execSQL("CREATE " + pref + "USER tstusera PASSWORD fake", expect); - execSQL("CREATE VIEW tstviewx " + pref - + "AS SELECT * FROM tsttbl WHERE i < 10", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL("CREATE UNIQUE " + pref + "INDEX tstinda ON toindextbl (i10)", - expect); - execSQL("DROP INDEX tstinda IF EXISTS", 0); // reset - execSQL("CREATE " + pref + "INDEX tstinda ON toindextbl (i10)", - expect); - execSQL("DROP INDEX tstinda IF EXISTS", 0); // reset - execSQL("CREATE TRIGGER tsttrigy " + pref - + "AFTER INSERT ON triggedtbl CALL \"" - + "org.hsqldb.test.BlaineTrig\"", expect); - execSQL("CREATE USER tstuserb " + pref + "PASSWORD fake", expect); - execSQL("CREATE VIEW tstviewx AS " + pref - + "SELECT * FROM tsttbl WHERE i < 10", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL("CREATE UNIQUE INDEX tstinda " + pref + "ON toindextbl (i10)", - expect); - execSQL("DROP INDEX tstinda IF EXISTS", 0); // reset - execSQL("CREATE TRIGGER tsttrigz AFTER " + pref - + "INSERT ON triggedtbl CALL \"" - + "org.hsqldb.test.BlaineTrig\"", expect); - execSQL("CREATE VIEW tstviewx AS SELECT * " + pref - + "FROM tsttbl WHERE i < 10", expect); - execSQL("CREATE USER tstuserc PASSWORD " + pref + "fake", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL("CREATE TRIGGER tsttriga AFTER INSERT " + pref - + "ON triggedtbl CALL \"" - + "org.hsqldb.test.BlaineTrig\"", expect); - execSQL("CREATE TRIGGER tsttrigb AFTER INSERT ON triggedtbl " + pref - + "CALL \"" + "org.hsqldb.test.BlaineTrig\"", expect); - execSQL("CREATE VIEW tstviewx AS SELECT * FROM tsttbl " + pref - + "WHERE i < 10", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL("CREATE TRIGGER tsttrigc AFTER INSERT ON triggedtbl CALL " - + pref + "\"org.hsqldb.test.BlaineTrig'", expect); - execSQL("CREATE " + pref + "UNIQUE INDEX tstindx ON toindextbl (i10)", - expect); - execSQL("DROP INDEX tstinda IF EXISTS", 0); // reset - execSQL( - "CREATE " + pref - + "VIEW tstviewx AS SELECT * FROM tsttbl WHERE i < 10", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL(pref + "CREATE USER tstuserd PASSWORD fake", expect); - execSQL(pref - + "CREATE TRIGGER tsttrigd AFTER INSERT ON triggedtbl CALL \"" - + "org.hsqldb.test.BlaineTrig\"", expect); - execSQL( - pref - + "CREATE VIEW tstviewx AS SELECT * FROM tsttbl WHERE i < 10", expect); - execSQL("DROP VIEW tstviewx IF EXISTS", 0); // reset - execSQL(pref + "CREATE UNIQUE INDEX tstinda ON toindextbl (i10)", - expect); - execSQL("DROP INDEX tstinda IF EXISTS", 0); // reset - execSQL("CREATE TABLE t1 (i " + pref + "INT, vc VARCHAR)", expect); - execSQL("DROP TABLE t1 IF EXISTS", 0); // reset - execSQL("CREATE TABLE t1 (i INT, vc " + pref + "VARCHAR)", expect); - execSQL("DROP TABLE t1 IF EXISTS", 0); // reset - execSQL(pref + "CREATE TABLE t1 (i INT, vc VARCHAR)", expect); - execSQL("DROP TABLE t1 IF EXISTS", 0); // reset - execSQL("CREATE " + pref + "TABLE t1 (i INT, vc VARCHAR)", expect); - execSQL("DROP TABLE t1 IF EXISTS", 0); // reset - execSQL("CREATE TABLE t1 (i " + pref + "INT, vc VARCHAR)", expect); - execSQL("DROP TABLE t1 IF EXISTS", 0); // reset - execSQL("CREATE TABLE t1 (i INT, vc " + pref + "VARCHAR)", expect); - execSQL("DROP TABLE t1 IF EXISTS", 0); // reset - execSQL("DELETE " + pref + "FROM tsttbl WHERE i < 10", expect); - execSQL("DELETE FROM tsttbl " + pref + "WHERE i < 10", expect); - execSQL(pref + "SET AUTOCOMMIT true", expect); - execSQL("SET " + pref + "AUTOCOMMIT true", expect); - execSQL("SET AUTOCOMMIT false", 0); // reset - execSQL(pref + "SET IGNORECASE true", expect); - execSQL("SET " + pref + "IGNORECASE true", expect); - execSQL(pref + "SET LOGSIZE 5", expect); - execSQL("SET " + pref + "LOGSIZE 5", expect); - execSQL(pref + "SET PASSWORD blah", expect); - execSQL("SET " + pref + "PASSWORD blah", expect); - execSQL(pref + "SET REFERENTIAL_INTEGRITY true", expect); - execSQL("SET " + pref + "REFERENTIAL_INTEGRITY true", expect); - - // Can't test text tables in in-memory DB. - execSQL(pref + "SET SCRIPTFORMAT text", expect); - execSQL("SET " + pref + "SCRIPTFORMAT text", expect); - execSQL(pref + "SET TABLE tsttbl READONLY true", expect); - execSQL("SET " + pref + "TABLE tsttbl READONLY true", expect); - execSQL("SET TABLE tsttbl READONLY false", 0); // reset - execSQL(pref + "GRANT ALL ON playtbl TO tstuser", expect); - execSQL("GRANT " + pref + "ALL ON playtbl TO tstuser", expect); - execSQL("GRANT ALL " + pref + "ON playtbl TO tstuser", expect); - execSQL("GRANT ALL ON playtbl " + pref + "TO tstuser", expect); - execSQL("GRANT ALL ON playtbl TO " + pref + "tstuser", expect); - execSQL(pref + "REVOKE ALL ON playtbl FROM tstuser RESTRICT", expect); - execSQL("REVOKE " + pref + "ALL ON playtbl FROM tstuser RESTRICT", - expect); - execSQL("REVOKE ALL " + pref + "ON playtbl FROM tstuser RESTRICT", - expect); - execSQL("REVOKE ALL ON playtbl " + pref + "FROM tstuser RESTRICT", - expect); - execSQL("REVOKE ALL ON playtbl FROM " + pref + "tstuser RESTRICT", - expect); - execSQL("GRANT ALL ON playtbl TO tstuser", 0); // reset - execSQL(pref + "COMMIT", expect); - execSQL(pref + "ROLLBACK", expect); - execSQL(pref + "UPDATE tsttbl SET vc = 'eleven' WHERE i = 1", expect); - execSQL("UPDATE tsttbl " + pref + "SET vc = 'eleven' WHERE i = 1", - expect); - execSQL("UPDATE tsttbl SET vc = 'eleven' " + pref + "WHERE i = 1", - expect); - execSQL(pref + "ALTER INDEX tstind RENAME TO renamedind", expect); - execSQL("ALTER INDEX tstind " + pref + "RENAME TO renamedind", expect); - execSQL("ALTER " + pref + "INDEX tstind RENAME TO renamedind", expect); - execSQL("ALTER INDEX tstind RENAME " + pref + "TO renamedind", expect); - execSQL(pref + "ALTER SEQUENCE tstseq RESTART WITH 13", expect); - execSQL("ALTER " + pref + "SEQUENCE tstseq RESTART WITH 13", expect); - execSQL("ALTER SEQUENCE tstseq " + pref + "RESTART WITH 13", expect); - execSQL("ALTER SEQUENCE tstseq RESTART " + pref + "WITH 13", expect); - execSQL("ALTER USER tstuser SET PASSWORD " + pref + "frank", expect); - execSQL(pref + "ALTER USER tstuser SET PASSWORD frank", expect); - execSQL("ALTER " + pref + "USER tstuser SET PASSWORD frank", expect); - execSQL("ALTER USER tstuser " + pref + "SET PASSWORD frank", expect); - execSQL("ALTER USER tstuser SET " + pref + "PASSWORD frank", expect); - execSQL(pref + "ALTER TABLE tsttbl ADD COLUMN vco1 VARCHAR", expect); - execSQL("ALTER " + pref + "TABLE tsttbl ADD COLUMN vco2 VARCHAR", - expect); - execSQL("ALTER TABLE tsttbl " + pref + "ADD COLUMN vco3 VARCHAR", - expect); - execSQL("ALTER TABLE tsttbl ADD " + pref + "COLUMN vco4 VARCHAR", - expect); - execSQL("ALTER TABLE tsttbl ADD " + pref + "COLUMN vco5 " + pref - + "VARCHAR", expect); - execSQL("ALTER TABLE bigtbl DROP " + pref + "COLUMN i103", expect); - execSQL("ALTER TABLE bigtbl " + pref + "DROP COLUMN i102", expect); - execSQL(pref + "ALTER TABLE bigtbl DROP COLUMN i101", expect); - execSQL(pref + "ALTER TABLE bigtbl ALTER COLUMN i104 RENAME TO j1", - expect); - execSQL("ALTER " + pref - + "TABLE bigtbl ALTER COLUMN i105 RENAME TO j2", expect); - execSQL("ALTER TABLE bigtbl " + pref - + "ALTER COLUMN i106 RENAME TO j3", expect); - execSQL("ALTER TABLE bigtbl ALTER " + pref - + "COLUMN i107 RENAME TO j4", expect); - execSQL("ALTER TABLE bigtbl ALTER COLUMN i108 " + pref - + "RENAME TO j5", expect); - execSQL("ALTER TABLE bigtbl ALTER COLUMN i109 RENAME " + pref - + "TO j6", expect); - execSQL( - pref - + "ALTER TABLE constrainedtbl ADD CONSTRAINT con2 CHECK (i6 > 4)", expect); - execSQL( - "ALTER " + pref - + "TABLE constrainedtbl ADD CONSTRAINT con3 CHECK (i6 > 4)", expect); - execSQL("ALTER TABLE constrainedtbl " + pref - + "ADD CONSTRAINT con4 CHECK (i6 > 4)", expect); - execSQL( - "ALTER TABLE constrainedtbl ADD CONSTRAINT con1 CHECK (i6 > 4)", - true); // setup - execSQL( - "ALTER TABLE constrainedtbl ADD CONSTRAINT con2 CHECK (i6 > 4)", - true); // setup - execSQL( - "ALTER TABLE constrainedtbl ADD CONSTRAINT con3 CHECK (i6 > 4)", - true); // setup - execSQL( - "ALTER TABLE constrainedtbl ADD CONSTRAINT con4 CHECK (i6 > 4)", - true); // setup - execSQL("ALTER TABLE constrainedtbl ADD " + pref - + "CONSTRAINT con5 CHECK (i6 > 4)", expect); - execSQL("ALTER TABLE constrainedtbl ADD CONSTRAINT con6 " + pref - + "CHECK (i6 > 4)", expect); - execSQL("ALTER TABLE constrainedtbl DROP CONSTRAINT ucons", true); // reset - execSQL( - pref - + "ALTER TABLE constrainedtbl ADD CONSTRAINT ucons UNIQUE (i6)", expect); - execSQL("ALTER TABLE constrainedtbl DROP CONSTRAINT ucons", true); // reset - execSQL( - "ALTER " + pref - + "TABLE constrainedtbl ADD CONSTRAINT ucons UNIQUE (i6)", expect); - execSQL("ALTER TABLE constrainedtbl DROP CONSTRAINT ucons", true); // reset - execSQL("ALTER TABLE constrainedtbl " + pref - + "ADD CONSTRAINT ucons UNIQUE (i6)", expect); - execSQL("ALTER TABLE constrainedtbl DROP CONSTRAINT ucons", true); // reset - execSQL("ALTER TABLE constrainedtbl ADD " + pref - + "CONSTRAINT ucons UNIQUE (i6)", expect); - execSQL("ALTER TABLE constrainedtbl DROP CONSTRAINT ucons", true); // reset - execSQL("ALTER TABLE constrainedtbl ADD CONSTRAINT ucons " + pref - + "UNIQUE (i6)", expect); - execSQL("ALTER TABLE constrainedtbl ADD CONSTRAINT ucons UNIQUE (i6)", - true); // reset - execSQL(pref + "ALTER TABLE playtbl RENAME TO renamedtbl", expect); - execSQL("ALTER TABLE renamedtbl RENAME TO playtbl", true); // reset - execSQL("ALTER " + pref + "TABLE playtbl RENAME TO renamedtbl", - expect); - execSQL("ALTER TABLE renamedtbl RENAME TO playtbl", true); // reset - execSQL("ALTER TABLE playtbl " + pref + "RENAME TO renamedtbl", - expect); - execSQL("ALTER TABLE renamedtbl RENAME TO playtbl", true); // reset - execSQL("ALTER TABLE playtbl RENAME " + pref + "TO renamedtbl", - expect); - execSQL(pref + "ALTER TABLE constrainedtbl DROP CONSTRAINT con1", - expect); - execSQL("ALTER " + pref + "TABLE constrainedtbl DROP CONSTRAINT con2", - expect); - execSQL("ALTER TABLE constrainedtbl " + pref + "DROP CONSTRAINT con3", - expect); - execSQL("ALTER TABLE constrainedtbl DROP " + pref + "CONSTRAINT con4", - expect); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", true); // reset - execSQL(pref - + "ALTER TABLE foreigntbl ADD CONSTRAINT tstfk FOREIGN KEY " - + "(i7) REFERENCES primarytbl (i8)", expect); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", true); // reset - execSQL("ALTER " + pref - + "TABLE foreigntbl ADD CONSTRAINT tstfk FOREIGN KEY " - + "(i7) REFERENCES primarytbl (i8)", expect); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", true); // reset - execSQL("ALTER TABLE foreigntbl " + pref - + "ADD CONSTRAINT tstfk FOREIGN KEY " - + "(i7) REFERENCES primarytbl (i8)", expect); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", true); // reset - execSQL("ALTER TABLE foreigntbl ADD " + pref - + "CONSTRAINT tstfk FOREIGN KEY " - + "(i7) REFERENCES primarytbl (i8)", expect); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", true); // reset - execSQL("ALTER TABLE foreigntbl ADD CONSTRAINT tstfk " + pref - + "FOREIGN KEY " + "(i7) REFERENCES primarytbl (i8)", expect); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", true); // reset - execSQL("ALTER TABLE foreigntbl ADD CONSTRAINT tstfk FOREIGN " + pref - + "KEY " + "(i7) REFERENCES primarytbl (i8)", expect); - execSQL("ALTER TABLE foreigntbl DROP CONSTRAINT tstfk", true); // reset - execSQL("ALTER TABLE foreigntbl ADD CONSTRAINT tstfk FOREIGN KEY " - + "(i7) " + pref + "REFERENCES primarytbl (i8)", expect); - - /* - // KEEP THESE TEST CASES AT THE BOTTOM!!!! Can wreck all following - // tests in current method, even when this test succeeds. - // Can only run one successful SHUTDOWN command in one test case. - execSQL(pref + "SHUTDOWN", SQL_ABORT); - execSQL(pref + "SHUTDOWN IMMEDIATELY", SQL_ABORT); - */ - shutdownTested = true; - - /* Failing - execSQL(pref + "SHUTDOWN BADARG", SQL_ABORT); - execSQL("Bad SHUTDOWN command did shut down database", - "SET LOGSIZE " + pref + "5", 0); - */ - execSQL("SHUTDOWN IMMEDIATELY", 0); - } - - public void testThreePartNames() throws Exception { - execSQL("SELECT public.tsttbl.i FROM public.beta.tsttbl\n" - + "WHERE public.tsttbl.i = 1", SQL_ABORT); - } - - /** - * This method seems to be obsolete. - */ - public void testBasicQueries() throws Exception { - - String prefix = "public."; - - assertEquals(2, queryRowCount("SELECT i FROM " + prefix + "tsttbl")); - assertEquals(1, queryRowCount("SELECT vc FROM " + prefix - + "tsttbl WHERE i = 1")); - assertEquals(1, queryRowCount("SELECT vc FROM " + prefix - + "tsttbl WHERE i = (\n" - + " SELECT i2 FROM " + prefix - + "joinedtbl\n" + ")")); - } - - /* @todo fredt - need to define additional identifiers to use for all cases of expect */ - private static final int SQL_ABORT = -1234; - private static final int SQL_INITIAL = -1233; - private static final int SQL_FAIL = -1; - - private void execSQL(String s, boolean ignoreError) throws SQLException { - - try { - statement.execute(s); - statement.getUpdateCount(); - } catch (SQLException se) { - if (!ignoreError) { - throw se; - } - -//else System.err.println("FAILURE of (" + s + ')'); - } - } - - private void execSQL(String m, String s, int expect) { - - int retval = SQL_INITIAL; - - try { - statement.execute(s); - - retval = statement.getUpdateCount(); - } catch (SQLException se) { - retval = SQL_ABORT; - } - - assertEquals(m, expect, retval); - } - - /* @todo fredt - this method body seems to be incorrect */ - private void execSQL(String s, int expect) { - execSQL(s, s, expect); - } - - private int queryRowCount(String query) throws SQLException { - - int count = 0; - - if (!statement.execute(query)) { - return count; - } - - ResultSet rs = statement.getResultSet(); - - try { - while (rs.next()) { - count++; - } - } finally { - rs.close(); - } - - return count; - } - - private int tableRowCount(String tableName) throws SQLException { - - String query = "SELECT count(*) FROM " + tableName; - - if (!statement.execute(query)) { - return 0; - } - - ResultSet rs = statement.getResultSet(); - - try { - if (!rs.next()) { - throw new SQLException("0 rows returned by (" + query + ')'); - } - - int count = rs.getInt(1); - - if (rs.next()) { - throw new SQLException("> 1 row returned by (" + query + ')'); - } - - return count; - } finally { - rs.close(); - } - - //throw new Exception("Failed to get rowcount for " + tableName); - } - - public TestSchemaParse() { - super(); - } - - public TestSchemaParse(String s) { - super(s); - } - - /** - * This method allows to easily run this unit test independent of the other - * unit tests, and without dealing with Ant or unrelated test suites. - */ - public static void main(String[] sa) { - - junit.textui.TestRunner runner = new junit.textui.TestRunner(); - junit.framework.TestResult result = - runner.run(runner.getTest(TestSchemaParse.class.getName())); - - System.exit(result.wasSuccessful() ? 0 - : 1); - } - - public static junit.framework.Test suite() { - - junit.framework.TestSuite newSuite = new junit.framework.TestSuite(); - - newSuite.addTest(new TestSchemaParse("testSanityCheck")); - newSuite.addTest(new TestSchemaParse("testTwoPartKeywords")); - newSuite.addTest(new TestSchemaParse("testThreePartKeywords")); - newSuite.addTest(new TestSchemaParse("testThreePartNames")); - newSuite.addTest(new TestSchemaParse("testBasicQueries")); - newSuite.addTest(new TestSchemaParse("test2pTables")); - newSuite.addTest(new TestSchemaParse("test2pViews")); - newSuite.addTest(new TestSchemaParse("test2pSequences")); - newSuite.addTest(new TestSchemaParse("test2pIndexes")); - newSuite.addTest(new TestSchemaParse("test2pAliases")); - newSuite.addTest(new TestSchemaParse("test2pConstraints")); - newSuite.addTest(new TestSchemaParse("test2pTriggers")); - - return newSuite; - } - - public void fire(int i, String name, String table, Object[] row1, - Object[] row2) {} - - public static String capitalize(String inString) { - return inString.toUpperCase(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestScript.java b/database/hsqldb/src/org/hsqldb/test/TestScript.java deleted file mode 100644 index e7c3c0b9..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestScript.java +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; - -public class TestScript extends TestBase { - -// String path = "TestSelf002SerializableLocks.txt"; -// String path = "TestSelf00NewJoins.txt"; -// String path = "TestSelf01AllNewFeatures.txt"; -// String path = "TestSelf01Aggregates.txt"; -// String path = "TestSelf01Cascade.txt"; -// String path = "TestSelf01DateTime.txt"; -// String path = "TestSelf02DateTime.txt"; -// String path = "TestSelf01Etc.txt"; -// String path = "TestSelf01hsqldb_schema.txt"; -// String path = "TestSelf01ForeignKeys.txt"; -// String path = "TestSelf01Function.txt"; -// String path = "TestSelf01Indexes.txt"; -// String path = "TestSelf01IndexUse.txt"; -// String path = "TestSelf01LimitOpt.txt"; -// String path = "TestSelf01MysInsert.txt"; -// String path = "TestSelf01Overriding.txt"; -// String path = "TestSelf01QueryOptimise2.txt"; -// String path = "TestSelf01Procedure.txt"; -// String path = "TestSelf01Problems.txt"; - String path = "TestSelf01RecursiveIssues.txt"; -// String path = "TestSelf01RecursiveQueries.txt"; -// String path = "TestSelf01RoutineHandlers.txt"; -// String path = "TestSelf01Subquery.txt"; -// String path = "TestSelf01RightJoin.txt"; -// String path = "TestSelf01Temp.txt"; -// String path = "TestSelf01TempTables.txt"; -// String path = "TestSelf01Triggers.txt"; -// String path = "TestSelf01UDAggregates.txt"; -// String path = "TestSelf01WithSubquery.txt"; -// String path = "TestSelf02Arrays.txt"; -// String path = "TestSelf02Function.txt"; -// String path = "TestSelf02Merge.txt"; -// String path = "TestSelf02Sequence.txt"; -// String path = "TestSelf02Synonym.txt"; -// String path = "TestSelf02PeriodPredicates.txt"; -// String path = "TestSelf02UpdatableViews.txt"; -// String path = "TestSelf02UpdatableViews.txt"; -// String path = "TestSelf03Procedure.txt"; -// String path = "TestSelf04UnionCorresponding.txt"; -// String path = "TestSelf07OrderLimitNulls.txt"; -// String path = "TestSelf06Generated.txt"; -// String path = "TestSelf08Collations.txt"; -// String path = "TestAny.txt"; - -// String path = "TestSelf.txt"; -// String path = "TestSelfArrays.txt"; -// String path = "TestSelf3PartNames.txt"; -// String path = "TestSelfArithmetic.txt"; -// String path = "TestSelfAlterColumn.txt"; -// String path = "TestSelfCaseWhen.txt"; -// String path = "TestSelfCheckConstraints.txt"; -// String path = "TestSelfColGrant.txt"; -// String path = "TestSelfCreate.txt"; -// String path = "TestSelfConstraints.txt"; -// String path = "TestSelfDomainTypes.txt"; -// String path = "TestSelfErrorChecks.txt"; -// String path = "TestSelfFunction.txt"; -// String path = "TestSelfGrantees.txt"; -// String path = "TestSelfGroupBy.txt"; -// String path = "TestSelfInsertDeleteQueries.txt"; -// String path = "TestSelfInterval.txt"; -// String path = "TestSelfInternalFunctions.txt"; -// String path = "TestSelfFieldLimits.txt"; -// String path = "TestSelfFKModes.txt"; -// String path = "TestSelfInPredicateReferencing.txt"; -// String path = "TestSelfInsteadOfTriggers.txt"; -// String path = "TestSelfIssues.txt"; -// String path = "TestSelfJoins.txt"; -// String path = "TestSelfLeftJoin.txt"; -// String path = "TestSelfNameResolution.txt"; -// String path = "TestSelfImmediateShutdown.txt"; -// String path = "TestSelfInsertDeleteQueries.txt"; -// String path = "TestSelfInPredicateReferencing.txt"; -// String path = "TestSelfJSON.txt"; -// String path = "TestSelfMultiGrants.txt"; -// String path = "TestSelfNot.txt"; -// String path = "TestSelfOrderLimits.txt"; -// String path = "TestSelfRoleNesting.txt"; -// String path = "TestSelfRowLevelGrants.txt"; -// String path = "TestSelfQueries.txt"; -// String path = "TestSelfSchemaPersistB1.txt"; -// String path = "TestSelfSeqRightsA.txt"; -// String path = "TestSelfStoredProcedure.txt"; -// String path = "TestSelfStoredProcedureTypes.txt"; -// String path = "TestSelfSubselects.txt"; -// String path = "TestSelfSysTables.txt"; -// String path = "TestSelfTempTable1.txt"; -// String path = "TestSelfTransaction.txt"; -// String path = "TestSelfTriggers.txt"; -// String path = "TestSelfTriggers2.txt"; -// String path = "TestSelfUnions.txt"; -// String path = "TestSelfUserFunction.txt"; -// String path = "TestSelfVerify.txt"; -// String path = "TestSelfViews.txt"; -// String path = "TestSelfViewGrants.txt"; -// String path = "TestSelfSeqRightsA.txt"; -// String path = "TestSelfSysTables.txt"; -// String path = "TestTemp.txt"; - public TestScript(String name) { - super(name, "jdbc:hsqldb:mem:test"); -// super(name, "jdbc:hsqldb:file:test1"); - } - - public void test() throws java.lang.Exception { - - TestUtil.deleteDatabase("test"); - - Connection conn = newConnection(); - String fullPath = "testrun/hsqldb/" + path; - - TestUtil.testScript(conn, fullPath); -// conn.createStatement().execute("SHUTDOWN"); - } - - public static void main(String[] Args) throws Exception { - - TestScript ts = new TestScript("test"); - - ts.test(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestScriptRunner.java b/database/hsqldb/src/org/hsqldb/test/TestScriptRunner.java deleted file mode 100644 index 9ac83961..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestScriptRunner.java +++ /dev/null @@ -1,374 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.io.File; -import java.io.Reader; -import java.io.InputStreamReader; -import java.io.IOException; -import java.io.FileReader; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.util.ArrayList; -import java.util.Iterator; -import java.lang.reflect.Method; -import org.hsqldb.test.TestUtil; -import org.hsqldb.util.RCData; - -/** - * @see #main - */ -class TestScriptRunner { - protected static final String DEFAULT_RCFILE = "testscriptrunner.rc"; - public static String LS = System.getProperty("line.separator"); - public static String SYNTAX_MSG = - "java " + TestScriptRunner.class.getName() - + " [--optionalSwitches...] --urlid=URLID1 [script1.tsql [[--urlid=URLIDX] scriptY.tsql...]...]" - + LS - + " Specify one input file name as '-' to read from stdin." + LS - + " No scripts specified will read from only stdin." + LS - + " Simple single-threaded example with RC file '" + DEFAULT_RCFILE - + "':" + LS - + "java " + TestScriptRunner.class.getName() - + "--urlid=URLID script1.tsql script2.tsql" + LS + LS - + "OPTIONAL SWITCHES:" + LS - + " --verbose Obviously..." + LS - + " --threads Each script runs in a parallel thread (dflt. sequential)." - + LS - + " --rcfile=/path/to/file.rc (Defaults to '" + DEFAULT_RCFILE - + "')" + LS - + " --populate Use TestCacheSize class to populate one database" + LS - + " --sqltool=URLID Invoke an interactive SqlTool session on given URLID" + LS - + "(This last is useful for troubleshooting and interactive script dev)."; - - public boolean verbose = false; - public boolean threaded = false; - - /** - * Executes specified SQL test scripts. - * - * Run java org.hsqldb.util.TestScriptRunner with no - * args to display syntax help. - * - * The TestCacheSize database population uses the database details - * as generated in TestCacheSize. It would be nice to get these - * from the RC file, but alas, TestCacheSize does much magical work - * based on components of the URL, for example. Therefore our user - * must make a URLID definition to match that generated by - * TestCacheSize for the DB type requested below. We must use that - * as the URLID for scripts (and/or SqlTool session) which we want - * to connect to the same database. - */ - public static void main(String[] sa) throws IOException, SQLException { - // Make a copy if argv so we can change it safely - int argIndex = 0; - boolean threaded = false; - boolean verbose = false; - boolean populate = false; - String rcFile = DEFAULT_RCFILE; - Map scriptFileMap = new HashMap(); // scriptname -> URLID - String currentUrlid = null; - String sqlToolUrlid = null; - Method sqlToolMainMethod = null; - - try { - for (int i = 0; i < sa.length; i++) { - if (sa[i].equals("--verbose")) { - verbose = true; - continue; - } - if (sa[i].equals("--threads")) { - threaded = true; - continue; - } - if (sa[i].equals("--populate")) { - populate = true; - continue; - } - if (sa[i].startsWith("--rcfile=")) { - rcFile = sa[i].substring("--rcfile=".length()); - continue; - } - if (sa[i].startsWith("--urlid=")) { - currentUrlid = sa[i].substring("--urlid=".length()); continue; - } - if (sa[i].startsWith("--sqltool=")) { - sqlToolUrlid = sa[i].substring("--sqltool=".length()); - continue; - } - if (currentUrlid == null) { - throw new IllegalArgumentException( - "You must specify 'urlid' before script files."); - } - if (scriptFileMap.containsKey(sa[i])) - throw new IllegalArgumentException( - TestScriptRunner.class.getName() - + " can't handle the same script name twice. " - + "(Just copy or sym-link the script)."); - scriptFileMap.put(sa[i], currentUrlid); - } - if (currentUrlid == null) throw new IllegalArgumentException(); - if (scriptFileMap.size() < 1) { - scriptFileMap.put("-", currentUrlid); - } - } catch (IllegalArgumentException e) { - if (e.getMessage() != null) System.err.println(e.getMessage()); - System.err.println(SYNTAX_MSG); - System.exit(2); - } - - if (sqlToolUrlid != null) { - Class sqlToolClass = null; - try { - sqlToolClass = Class.forName("org.hsqldb.util.SqlTool"); - } catch (Exception e) { - System.err.println("SqlTool class not accessible. " - + "Re-run without '--sqltool' switch."); - System.exit(3); - } - try { - sqlToolMainMethod = sqlToolClass. - getMethod("objectMain", new Class[] {sa.getClass()} ); - } catch (Exception e) { - System.err.println("SqlTool integration failure: " + e); - System.exit(3); - } - } - TestScriptRunner runner = new TestScriptRunner(rcFile, scriptFileMap); - runner.setVerbose(verbose); - runner.setThreaded(threaded); - TestCacheSize tcs = populate ? populate() : null; - runner.establishConnections(); - boolean success = runner.runScripts(); - if (sqlToolMainMethod != null) try { - sqlToolMainMethod.invoke(null, new Object[] { new String[] { - "--rcfile=" + rcFile, sqlToolUrlid }}); - } catch (Exception e) { - System.err.println("SqlTool failed: " + e); - e.printStackTrace(); - } - if (tcs != null) tcs.tearDown(); - System.exit(success ? 0 : 1); - } - - List scriptRuns = new ArrayList(); - - private class ScriptRun extends Thread { - private Reader reader; - private Connection conn = null; - private RCData rcdata; - private boolean success = false; - - public ScriptRun(String name, Reader reader, RCData rcdata) { - super(name); - this.reader = reader; - this.rcdata = rcdata; - } - - public boolean getSuccess() { - return success; - } - - public void connect() throws SQLException { - if (conn != null) { - throw new IllegalStateException("Thread '" + getName() - + "' has already been connected"); - } - try { - conn = rcdata.getConnection(); - } catch (Exception e) { - throw new RuntimeException( - "Failed to connect to get JDBC connection for '" - + getName() + "'", e); - } - conn.setAutoCommit(false); - System.out.println("ScriptRun '" + getName() + "' connected with " - + RCData.tiToString(conn.getTransactionIsolation()) + '.'); - } - - public void run() { - try { - TestUtil.testScript(conn, getName(), reader); - success = true; - } catch (TestUtil.TestRuntimeException tre) { - System.err.println("Script '" + getName() + "' failed"); - } catch (IOException ioe) { - System.err.println("Aborting thread for script '" + getName() - + "' due to: " + ioe); - throw new RuntimeException(ioe); - } catch (SQLException se) { - System.err.println("Aborting thread for script '" + getName() - + "' due to: " + se); - throw new RuntimeException(se); - } finally { try { - conn.close(); - } catch (SQLException se) { - System.err.println("Failed to close JDBC connection for '" - + getName() + "': " + se); - } } - } - } - - public void setVerbose(boolean verbose) { - this.verbose = verbose; - } - public void setThreaded(boolean threaded) { - this.threaded = threaded; - } - - public TestScriptRunner(String rcFileString, Map scriptFileMap) - throws IOException { - TestUtil.setAbortOnErr(true); - Map rcdataMap = new HashMap(); - File rcFile = new File(rcFileString); - if (!rcFile.isFile()) - throw new IllegalArgumentException( - "RC file '" + rcFileString + "' not a file"); - - String scriptPath, urlid; - Iterator it; - File file; - Reader reader = null; - - it = scriptFileMap.values().iterator(); - while (it.hasNext()) { - urlid = (String) it.next(); - if (rcdataMap.containsKey(urlid)) continue; - try { - rcdataMap.put(urlid, new RCData(rcFile, urlid)); - } catch (Exception e) { - throw new RuntimeException( - "Failed to instantiate RCData with file '" - + rcFile + "' for urlid '" + urlid + "'", e); - } - } - - it = scriptFileMap.keySet().iterator(); - while (it.hasNext()) { - scriptPath = (String) it.next(); - urlid = (String) scriptFileMap.get(scriptPath); - - if (scriptPath.equals("-")) { - reader = new InputStreamReader(System.in); - } else { - file = new File(scriptPath); - if (!file.isFile()) throw new IOException("'" + file - + "' is not a file"); - if (!file.canRead()) throw new IOException("'" + file - + "' is not readable"); - reader = new FileReader(file); - } - scriptRuns.add(new ScriptRun(scriptPath, - reader, (RCData) rcdataMap.get(urlid))); - } - } - - public void establishConnections() throws SQLException { - for (int i = 0; i < scriptRuns.size(); i++) - ((ScriptRun) scriptRuns.get(i)).connect(); - if (verbose) System.out.println(Integer.toString(scriptRuns.size()) - + " connection threads connected"); - } - - public boolean runScripts() { - ScriptRun scriptRun; - for (int i = 0; i < scriptRuns.size(); i++) { - scriptRun = (ScriptRun) scriptRuns.get(i); - if (verbose) System.out.print("Starting " + (++i) + " / " - + scriptRuns.size() + "..."); - scriptRun.start(); - if (verbose) System.out.println(" +"); - if (!threaded) try { - scriptRun.join(); - } catch (InterruptedException ie) { - throw new RuntimeException( - "Interrupted while waiting for script '" - + scriptRun.getName() + "' to execute", ie); - } - } - if (threaded) { - if (verbose) - System.out.println( - "All scripts started. Will now wait for them."); - for (int i = 0; i < scriptRuns.size(); i++) try { - ((ScriptRun) scriptRuns.get(i)).join(); - } catch (InterruptedException ie) { - throw new RuntimeException( - "Interrupted while waiting for script to execute", ie); - } - } - for (int i = 0; i < scriptRuns.size(); i++) { - if (!((ScriptRun) scriptRuns.get(i)).getSuccess()) return false; - } - return true; - } - - /** - * Copied directly from TestCacheSize.main(). - * - * My goal is to configure population of this database by a properties - * file, not by command line (which would just be too many settings - * along with the main settings), nor by System Properties (ditto). - * I see nothing in the TestCacheSize source code to allow loading by - * a properties file, however. - */ - static protected TestCacheSize populate() { - TestCacheSize test = new TestCacheSize(); - - /* Use all defaults - HsqlProperties props = HsqlProperties.argArrayToProps(argv, "test"); - - test.bigops = props.getIntegerProperty("test.bigops", test.bigops); - test.bigrows = test.bigops; - test.smallops = test.bigops / 8; - test.cacheScale = props.getIntegerProperty("test.scale", - test.cacheScale); - test.logType = props.getProperty("test.logtype", test.logType); - test.tableType = props.getProperty("test.tabletype", test.tableType); - test.nioMode = props.isPropertyTrue("test.nio", test.nioMode); - */ - - test.filepath = "mem:test"; - test.filedb = false; - test.shutdown = false; - - test.setUp(); - test.testFillUp(); - //test.checkResults(); - //System.out.println("total test time -- " + sw.elapsedTime() + " ms"); - return test; - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestScripts.java b/database/hsqldb/src/org/hsqldb/test/TestScripts.java deleted file mode 100644 index 00d46c68..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestScripts.java +++ /dev/null @@ -1,206 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.File; -import java.sql.Connection; -import java.sql.DriverManager; -import java.util.ArrayList; -import java.util.HashMap; - -/** - * Runs test scripts against a single database, using persistent connection(s) - * across multiple test script(s). - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ -class TestScripts extends TestUtil { - - /** - * Run java org.hsqldb.util.TestScripts --help. - * For each script run, the connection will be closed or persisted - * depending on whether "--ephConnId=x" or "--persistConnId=x" preceded - * the file name (defaulting to closing). - * So, by default, for each script file, a new connection will be made - * and closed immediately after the script runs. - */ - public static void main(String[] argv) { - - if (argv.length > 0 && argv[0].equals("--help")) { - System.err.println(SYNTAX_MSG); - System.exit(2); - } - - ArrayList scripts = new ArrayList(); - ArrayList connIds = new ArrayList(); - ArrayList retains = new ArrayList(); - int i = -1; - int curscript = 0; - - // java.util.ArrayLists may contain null elements. - connIds.add(null); - retains.add(null); - - String newName = null; - - while (++i < argv.length) { - if (argv[i].startsWith("--ephConnId=")) { - newName = getIdName(argv[i]); - - if (newName == null - || connIds.set(connIds.size() - 1, getIdName(argv[i])) - != null) { - System.err.println(SYNTAX_MSG); - System.exit(2); - } - - if (retains.set(retains.size() - 1, Boolean.FALSE) != null) { - System.err.println(SYNTAX_MSG); - System.exit(2); - } - } else if (argv[i].startsWith("--persistConnId=")) { - newName = getIdName(argv[i]); - - if (newName == null - || connIds.set(connIds.size() - 1, newName) != null) { - System.err.println(SYNTAX_MSG); - System.exit(2); - } - - if (retains.set(retains.size() - 1, Boolean.TRUE) != null) { - System.err.println(SYNTAX_MSG); - System.exit(2); - } - } else if (argv[i].startsWith("-")) { - System.err.println(SYNTAX_MSG); - System.exit(2); - } else { - scripts.add(argv[i]); - connIds.add(null); - retains.add(null); - } - } - - test(DEF_URL, DEF_USER, DEF_PASSWORD, DEF_DB, - (String[]) scripts.toArray(new String[0]), - (String[]) connIds.toArray(new String[0]), - (Boolean[]) retains.toArray(new Boolean[0])); - } - - private static String getIdName(String s) { - - int nameStart = s.indexOf('=') + 1; - - if (nameStart < 1) { - return null; - } - - if (nameStart == s.length()) { - throw new RuntimeException( - "Leave off '=' if you do not want to name a connection"); - } - - return s.substring(nameStart); - } - - private static final String SYNTAX_MSG = "SYNTAX java " - + TestScripts.class.getName() - + " [--ephConnId=x | --persistConnId=x] file1.txt..."; - - static String DEF_DB = "testdb/test3"; - static String DEF_URL = "jdbc:hsqldb:file:" + DEF_DB - + ";sql.enforce_strict_size=true"; - static String DEF_USER = "SA"; - static String DEF_PASSWORD = ""; - - static void test(String url, String user, String password, String db, - String[] scriptList, String[] idList, - Boolean[] persistList) { - - if (scriptList.length < 1) { - System.err.println("Nothing to do. No scripts specified."); - - return; - } - - HashMap connMap = new HashMap(); - - if (db != null) { - deleteDatabase(db); - } - - try { - DriverManager.registerDriver(new org.hsqldb.jdbc.JDBCDriver()); - - Connection cConnection = null; - String id; - - for (int i = 0; i < scriptList.length; i++) { - id = idList[i]; - - System.out.println("ID: " + id); - - cConnection = ((id == null) ? null - : (Connection) connMap.get(id)); - - if (cConnection == null) { - System.out.println("Getting NEW conn"); - - cConnection = DriverManager.getConnection(url, user, - password); - - if (id != null) { - - // If new named conn., then store it. - connMap.put(id, cConnection); - System.out.println("Storing NEW conn"); - } - } - - testScript(cConnection, scriptList[i]); - - if (persistList[i] == null ||!persistList[i].booleanValue()) { - if (id != null) { - connMap.remove(id); - System.out.println("Removed conn"); - } - - cConnection.close(); - System.out.println("Closed conn"); - } - } - } catch (Exception e) { - e.printStackTrace(); - print("TestSelf init error: " + e.getMessage()); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestSql.java b/database/hsqldb/src/org/hsqldb/test/TestSql.java deleted file mode 100644 index 41c4d8de..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestSql.java +++ /dev/null @@ -1,936 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -import java.sql.Date; - -/** - * Test sql statements via jdbc against in-memory database - * @author Fred Toussi (fredt@users dot sourceforge.net) - */ -public class TestSql extends TestBase { - - Statement stmnt; - PreparedStatement pstmnt; - Connection connection; - String getColumnName = "false"; - - public TestSql(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - - connection = super.newConnection(); - stmnt = connection.createStatement(); - } - - public void testMetaData() { - - String ddl01 = "DROP TABLE ADDRESSBOOK IF EXISTS"; - String ddl02 = "DROP TABLE ADDRESSBOOK_CATEGORY IF EXISTS"; - String ddl03 = "DROP TABLE USER IF EXISTS"; - String ddl1 = - "CREATE TABLE USER(USER_ID INTEGER NOT NULL PRIMARY KEY,LOGIN_ID VARCHAR(128) NOT NULL,USER_NAME VARCHAR(254) DEFAULT ' ' NOT NULL,CREATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,UPDATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,LAST_ACCESS_DATE TIMESTAMP,CONSTRAINT IXUQ_LOGIN_ID0 UNIQUE(LOGIN_ID))"; - String ddl2 = - "CREATE TABLE ADDRESSBOOK_CATEGORY(USER_ID INTEGER NOT NULL,CATEGORY_ID INTEGER DEFAULT 0 NOT NULL,CATEGORY_NAME VARCHAR(60) DEFAULT '' NOT NULL,CONSTRAINT SYS_PK_ADDRESSBOOK_CATEGORY PRIMARY KEY(USER_ID,CATEGORY_ID),CONSTRAINT FK_ADRBKCAT1 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID) ON DELETE CASCADE)"; - String ddl3 = - "CREATE TABLE ADDRESSBOOK(USER_ID INTEGER NOT NULL,ADDRESSBOOK_ID INTEGER NOT NULL,CATEGORY_ID INTEGER DEFAULT 0 NOT NULL,FIRST VARCHAR(64) DEFAULT '' NOT NULL,LAST VARCHAR(64) DEFAULT '' NOT NULL,NOTE VARCHAR(128) DEFAULT '' NOT NULL,CONSTRAINT SYS_PK_ADDRESSBOOK PRIMARY KEY(USER_ID,ADDRESSBOOK_ID),CONSTRAINT FK_ADRBOOK1 FOREIGN KEY(USER_ID,CATEGORY_ID) REFERENCES ADDRESSBOOK_CATEGORY(USER_ID,CATEGORY_ID) ON DELETE CASCADE)"; - String result1 = "1"; - String result2 = "2"; - String result3 = "3"; - String result4 = "4"; - String result5 = "5"; - - try { - stmnt.execute(ddl01); - stmnt.execute(ddl02); - stmnt.execute(ddl03); - stmnt.execute(ddl1); - stmnt.execute(ddl2); - stmnt.execute(ddl3); - - DatabaseMetaData md = connection.getMetaData(); - - { - System.out.println("Testing DatabaseMetaData methods"); - System.out.println(md.getDatabaseMajorVersion()); - System.out.println(md.getDatabaseMinorVersion()); - System.out.println(md.getDatabaseProductName()); - System.out.println(md.getDatabaseProductVersion()); - System.out.println(md.getDefaultTransactionIsolation()); - System.out.println(md.getDriverMajorVersion()); - System.out.println(md.getDriverMinorVersion()); - System.out.println(md.getDriverName()); - System.out.println(md.getDriverVersion()); - System.out.println(md.getExtraNameCharacters()); - System.out.println(md.getIdentifierQuoteString()); - System.out.println(md.getJDBCMajorVersion()); - System.out.println(md.getJDBCMinorVersion()); - System.out.println(md.getMaxBinaryLiteralLength()); - System.out.println(md.getMaxCatalogNameLength()); - System.out.println(md.getMaxColumnsInGroupBy()); - System.out.println(md.getMaxColumnsInIndex()); - System.out.println(md.getMaxColumnsInOrderBy()); - System.out.println(md.getMaxColumnsInSelect()); - System.out.println(md.getMaxColumnsInTable()); - System.out.println(md.getMaxConnections()); - System.out.println(md.getMaxCursorNameLength()); - System.out.println(md.getMaxIndexLength()); - System.out.println(md.getMaxProcedureNameLength()); - System.out.println(md.getMaxRowSize()); - System.out.println(md.getMaxSchemaNameLength()); - System.out.println(md.getMaxStatementLength()); - System.out.println(md.getMaxStatements()); - System.out.println(md.getMaxTableNameLength()); - System.out.println(md.getMaxUserNameLength()); - System.out.println(md.getNumericFunctions()); - System.out.println(md.getProcedureTerm()); - System.out.println(md.getResultSetHoldability()); - System.out.println(md.getSchemaTerm()); - System.out.println(md.getSearchStringEscape()); - System.out.println( - "Testing DatabaseMetaData.getSQLKeywords()"); - System.out.println(md.getSQLKeywords()); - System.out.println(md.getSQLStateType()); - System.out.println( - "Testing DatabaseMetaData.getStringFunctions()"); - System.out.println(md.getStringFunctions()); - System.out.println( - "Testing DatabaseMetaData.getSystemFunctions()"); - System.out.println(md.getSystemFunctions()); - System.out.println( - "Testing DatabaseMetaData.getTimeDateFunctions()"); - System.out.println(md.getTimeDateFunctions()); - System.out.println(md.getURL()); - System.out.println(md.getUserName()); - System.out.println(DatabaseMetaData.importedKeyCascade); - System.out.println(md.isCatalogAtStart()); - System.out.println(md.isReadOnly()); - - ResultSet rs; - - rs = md.getPrimaryKeys(null, null, "USER"); - - ResultSetMetaData rsmd = rs.getMetaData(); - String result0 = ""; - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result0 += rs.getString(i + 1) + ":"; - } - - result0 += "\n"; - } - - rs.close(); - System.out.println(result0); - } - - { - ResultSet rs; - - rs = md.getBestRowIdentifier(null, null, "USER", 0, true); - - ResultSetMetaData rsmd = rs.getMetaData(); - String result0 = ""; - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result0 += rs.getString(i + 1) + ":"; - } - - result0 += "\n"; - } - - rs.close(); - System.out.println(result0); - } - - { - ResultSet rs = md.getImportedKeys(null, null, "ADDRESSBOOK"); - ResultSetMetaData rsmd = rs.getMetaData(); - - result1 = ""; - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result1 += rs.getString(i + 1) + ":"; - } - - result1 += "\n"; - } - - rs.close(); - System.out.println(result1); - } - - { - ResultSet rs = md.getCrossReference(null, null, - "ADDRESSBOOK_CATEGORY", - null, null, "ADDRESSBOOK"); - ResultSetMetaData rsmd = rs.getMetaData(); - - result2 = ""; - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result2 += rs.getString(i + 1) + ":"; - } - - result2 += "\n"; - } - - rs.close(); - System.out.println(result2); - } - - { - ResultSet rs = md.getExportedKeys(null, null, "USER"); - ResultSetMetaData rsmd = rs.getMetaData(); - - result3 = ""; - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result3 += rs.getString(i + 1) + ":"; - } - - result3 += "\n"; - } - - rs.close(); - System.out.println(result3); - } - - { - ResultSet rs = md.getCrossReference(null, null, "USER", null, - null, - "ADDRESSBOOK_CATEGORY"); - ResultSetMetaData rsmd = rs.getMetaData(); - - result4 = ""; - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result4 += rs.getString(i + 1) + ":"; - } - - result4 += "\n"; - } - - rs.close(); - System.out.println(result4); - } - - { - stmnt.execute("DROP TABLE T IF EXISTS;"); - stmnt.execute( - "CREATE TABLE T (I IDENTITY, A CHAR(20), B CHAR(20));"); - stmnt.execute( - "INSERT INTO T VALUES (NULL, 'get_column_name', '" - + getColumnName + "');"); - - ResultSet rs = stmnt.executeQuery( - "SELECT I, A, B, A \"aliasA\", B \"aliasB\", 1 FROM T;"); - ResultSetMetaData rsmd = rs.getMetaData(); - - result5 = ""; - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result5 += rsmd.getColumnName(i + 1) + ":" - + rs.getString(i + 1) + ":"; - } - - result5 += "\n"; - } - - rs.close(); - - rs = stmnt.executeQuery( - "SELECT I, A, B, A \"aliasA\", B \"aliasB\", 1 FROM T;"); - rsmd = rs.getMetaData(); - - for (; rs.next(); ) { - for (int i = 0; i < rsmd.getColumnCount(); i++) { - result5 += rsmd.getColumnLabel(i + 1) + ":" - + rs.getString(i + 1) + ":"; - } - - result5 += "\n"; - } - - System.out.println(result5); - System.out.println("first column identity: " - + rsmd.isAutoIncrement(1)); - rsmd.isCaseSensitive(1); - rsmd.isCurrency(1); - rsmd.isDefinitelyWritable(1); - rsmd.isNullable(1); - rsmd.isReadOnly(1); - rsmd.isSearchable(1); - rsmd.isSigned(1); - rsmd.isWritable(1); - rs.close(); - - // test identity with PreparedStatement - pstmnt = connection.prepareStatement( - "INSERT INTO T VALUES (?,?,?)"); - - pstmnt.setString(1, null); - pstmnt.setString(2, "test"); - pstmnt.setString(3, "test2"); - pstmnt.executeUpdate(); - - pstmnt = connection.prepareStatement("call identity()"); - - ResultSet rsi = pstmnt.executeQuery(); - - rsi.next(); - - int identity = rsi.getInt(1); - - System.out.println("call identity(): " + identity); - rsi.close(); - } - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testMetaData complete"); - - // assert equality of exported and imported with xref - assertEquals(result1, result2); - assertEquals(result3, result4); - } - - /** - * Demonstration of a reported bug.

    - * Because all values were turned into strings with toString before - * PreparedStatement.executeQuery() was called, special values such as - * NaN were not accepted. - * - * This test can be extended to cover various conversions through JDBC - * - */ - public void testDoubleNaN() { - - double value = 0; - boolean wasEqual = false; - String message = "DB operation completed"; - String ddl1 = "DROP TABLE t1 IF EXISTS;"; - String ddl2 = - "CREATE TABLE t1 ( d DECIMAL, f DOUBLE, l BIGINT, i INTEGER, s SMALLINT, t TINYINT, " - + "dt DATE DEFAULT CURRENT_DATE, ti TIME DEFAULT CURRENT_TIME, ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP );"; - - try { - stmnt.execute(ddl1); - stmnt.execute(ddl2); - - PreparedStatement ps = connection.prepareStatement( - "INSERT INTO t1 (d,f,l,i,s,t,dt,ti,ts) VALUES (?,?,?,?,?,?,?,?,?)"); - - ps.setString(1, "0.2"); - ps.setDouble(2, 0.2); - ps.setLong(3, java.lang.Long.MAX_VALUE); - ps.setInt(4, Integer.MAX_VALUE); - ps.setInt(5, Short.MAX_VALUE); - ps.setInt(6, 0); - ps.setDate(7, new java.sql.Date(System.currentTimeMillis())); - ps.setTime(8, new java.sql.Time(System.currentTimeMillis())); - ps.setTimestamp( - 9, new java.sql.Timestamp(System.currentTimeMillis())); - ps.execute(); - ps.setInt(1, 0); - ps.setDouble(2, java.lang.Double.NaN); - ps.setLong(3, java.lang.Long.MIN_VALUE); - ps.setInt(4, Integer.MIN_VALUE); - ps.setInt(5, Short.MIN_VALUE); - ps.setInt(6, 0); - - // allowed conversions - ps.setTimestamp( - 7, new java.sql.Timestamp(System.currentTimeMillis() + 1)); - ps.setTime(8, new java.sql.Time(System.currentTimeMillis() + 1)); - ps.setDate(9, new java.sql.Date(System.currentTimeMillis() + 1)); - ps.execute(); - - // - ps.setInt(1, 0); - ps.setDouble(2, java.lang.Double.POSITIVE_INFINITY); - ps.setInt(4, Integer.MIN_VALUE); - - // test conversion - // ps.setObject(5, Boolean.TRUE); // no longer converts boolean to int - // ps.setBoolean(5, true); - ps.setObject(5, Short.valueOf((short) 2), Types.SMALLINT); - ps.setObject(6, Integer.valueOf(2), Types.TINYINT); - - // allowed conversions - ps.setObject(7, new java.sql.Date(System.currentTimeMillis() + 2)); - ps.setObject(8, new java.sql.Time(System.currentTimeMillis() + 2)); - ps.setObject(9, new java.sql.Timestamp(System.currentTimeMillis() - + 2)); - ps.execute(); - ps.setObject(1, Float.valueOf(0), Types.INTEGER); - ps.setObject(4, Float.valueOf(1), Types.INTEGER); - ps.setDouble(2, java.lang.Double.NEGATIVE_INFINITY); - ps.execute(); - - ResultSet rs = - stmnt.executeQuery("SELECT d, f, l, i, s*2, t FROM t1"); - boolean result = rs.next(); - - value = rs.getDouble(2); - -// int smallintValue = rs.getShort(3); - int integerValue = rs.getInt(4); - - if (rs.next()) { - value = rs.getDouble(2); - wasEqual = Double.isNaN(value); - integerValue = rs.getInt(4); - - // tests for conversion - // getInt on DECIMAL - integerValue = rs.getInt(1); - } - - if (rs.next()) { - value = rs.getDouble(2); - wasEqual = wasEqual && value == Double.POSITIVE_INFINITY; - } - - if (rs.next()) { - value = rs.getDouble(2); - wasEqual = wasEqual && value == Double.NEGATIVE_INFINITY; - } - - rs = stmnt.executeQuery("SELECT MAX(i) FROM t1"); - - if (rs.next()) { - int max = rs.getInt(1); - - System.out.println("Max value for i: " + max); - } - - try { - - // cause errors - ps.setString(5, "three"); - fail("update did not fail"); - } catch (SQLException e) {} - - { - stmnt.execute("drop table CDTYPE if exists"); - - // test for the value MAX(column) in an empty table - stmnt.execute( - "CREATE TABLE cdType (ID INTEGER NOT NULL, name VARCHAR(50), PRIMARY KEY(ID))"); - - rs = stmnt.executeQuery("SELECT MAX(ID) FROM cdType"); - - if (rs.next()) { - int max = rs.getInt(1); - - System.out.println("Max value for ID: " + max); - } else { - System.out.println("Max value for ID not returned"); - } - - stmnt.executeUpdate( - "INSERT INTO cdType VALUES (10,'Test String');"); - stmnt.execute("CALL IDENTITY();"); - - try { - stmnt.executeUpdate( - "INSERT INTO cdType VALUES (10,'Test String');"); - } catch (SQLException e1) { - stmnt.execute("ROLLBACK"); - connection.rollback(); - } - } - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testDoubleNaN complete"); - - // assert new behaviour - assertEquals(true, wasEqual); - } - - public void testAny() { - - try { - String ddldrop = "drop table PRICE_RELATE_USER_ORDER_V2 if exists"; - String ddl = "create table PRICE_RELATE_USER_ORDER_V2 " - + "(ID_ORDER_V2 BIGINT, ID_USER NUMERIC, DATE_CREATE TIMESTAMP)"; - String sql = "insert into PRICE_RELATE_USER_ORDER_V2 " - + "(ID_ORDER_V2, ID_USER, DATE_CREATE) " + "values " - + "(?, ?, ?)"; - Statement st = connection.createStatement(); - - st.execute(ddldrop); - st.execute(ddl); - - PreparedStatement ps = connection.prepareStatement(sql); - - ps.setLong(1, 1); - ps.setNull(2, Types.NUMERIC); - ps.setTimestamp( - 3, new java.sql.Timestamp(System.currentTimeMillis())); - ps.execute(); - } catch (SQLException e) { - e.printStackTrace(); - System.out.println("TestSql.testAny() error: " + e.getMessage()); - } - - System.out.println("testAny complete"); - } - - /** - * Fix for bug #1201135 - */ - public void testBinds() { - - try { - PreparedStatement pstmt = - connection.prepareStatement("drop table test if exists"); - - pstmt.execute(); - - pstmt = - connection.prepareStatement("create table test (id integer)"); - - pstmt.execute(); - - pstmt = - connection.prepareStatement("insert into test values (10)"); - - pstmt.execute(); - - pstmt = - connection.prepareStatement("insert into test values (20)"); - - pstmt.execute(); - - pstmt = connection.prepareStatement( - "select count(*) from test where id is null"); - - ResultSet rs = pstmt.executeQuery(); - - rs.next(); - - int count = rs.getInt(1); - - assertEquals(0, count); - - pstmt = - connection.prepareStatement("select limit ? 2 id from test"); - - pstmt.setInt(1, 0); - - rs = pstmt.executeQuery(); - - rs.next(); - - count = rs.getInt(1); - - assertEquals(10, count); - pstmt.setInt(1, 1); - - rs = pstmt.executeQuery(); - - rs.next(); - - count = rs.getInt(1); - - assertEquals(20, count); - } catch (SQLException e) { - e.printStackTrace(); - System.out.println("TestSql.testBinds() error: " + e.getMessage()); - } - } - - // miscellaneous tests - public void testX1() { - - String tableDDL = - "create table lo_attribute ( " - + "learningid varchar(15) not null, " - + "ordering integer not null," - + "attribute_value_data varchar(85)," - + "constraint PK_LO_ATTR primary key (learningid, ordering))"; - - try { - Statement stmt = connection.createStatement(); - - stmt.execute("drop table lo_attribute if exists"); - stmt.execute(tableDDL); - stmt.execute( - "insert into lo_attribute values('abcd', 10, 'cdef')"); - stmt.execute( - "insert into lo_attribute values('bcde', 20, 'cdef')"); - } catch (SQLException e) { - assertEquals(0, 1); - } - - try { - String prepared = - "update lo_attribute set " - + " ordering = (ordering - 1) where ordering > ?"; - PreparedStatement ps = connection.prepareStatement(prepared); - - ps.setInt(1, 10); - ps.execute(); - } catch (SQLException e) { - assertEquals(0, 1); - } - - try { - connection.setAutoCommit(false); - - java.sql.Savepoint savepoint = - connection.setSavepoint("savepoint"); - - connection.createStatement().executeQuery("CALL true;"); - connection.rollback(savepoint); - } catch (SQLException e) { - assertEquals(0, 1); - } - } - - /** - * In 1.8.0.2, this fails in client / server due to column type of the - * second select for b1 being boolean, while the first select is interpreted - * as varchar. The rowOutputBase class attempts to cast the Java Boolean - * into String. - */ - public void testUnionColumnTypes() { - - try { - Connection conn = newConnection(); - Statement stmt = conn.createStatement(); - - stmt.execute("DROP TABLE test1 IF EXISTS"); - stmt.execute("DROP TABLE test2 IF EXISTS"); - stmt.execute("CREATE TABLE test1 (id int, b1 boolean)"); - stmt.execute("CREATE TABLE test2 (id int)"); - stmt.execute("INSERT INTO test1 VALUES(1,true)"); - stmt.execute("INSERT INTO test2 VALUES(2)"); - - ResultSet rs = stmt.executeQuery( - "select id,null as b1 from test2 union select id, b1 from test1"); - Boolean[] array = new Boolean[2]; - - for (int i = 0; rs.next(); i++) { - boolean boole = rs.getBoolean(2); - - array[i] = Boolean.valueOf(boole); - - if (rs.wasNull()) { - array[i] = null; - } - } - - boolean result = (array[0] == null && array[1] == Boolean.TRUE) - || (array[0] == Boolean.TRUE && array[1] == null); - - assertTrue(result); - } catch (SQLException e) { - e.printStackTrace(); - System.out.println("TestSql.testUnionColumnType() error: " - + e.getMessage()); - } - } - - public void testUnionSubquery() throws Exception { - - Statement st = connection.createStatement(); - - st.execute("DROP TABLE t1 if exists;"); - st.execute("DROP TABLE t2 if exists;"); - st.execute( - "CREATE TABLE t1 (id int not null, v1 int, v2 int, primary key(id))"); - st.execute( - "CREATE TABLE t2 (id int not null, v1 int, v3 int, primary key(id))"); - st.execute("INSERT INTO t1 values(1,1,1)"); - st.execute("INSERT INTO t1 values(2,2,2)"); - st.execute("INSERT INTO t2 values(1,3,3)"); - - ResultSet rs = st.executeQuery( - "select t as atable, a as idvalue, b as value1, c as value2, d as value3 from(" - + "(select 't1' as t, t1.id as a, t1.v1 as b, t1.v2 as c, null as d from t1) union" - + "(select 't2' as t, t2.id as a, t2.v1 as b, null as c, t2.v3 as d from t2)) order by atable, idvalue"); - - assertTrue(rs.next()); - assertEquals("t1", rs.getObject("atable")); - assertEquals(1, rs.getInt("idvalue")); - assertEquals(1, rs.getInt("value1")); - assertEquals(1, rs.getInt("value2")); - assertEquals(null, rs.getObject("value3")); - assertTrue(rs.next()); - assertEquals("t1", rs.getObject("atable")); - assertEquals(2, rs.getInt("idvalue")); - assertEquals(2, rs.getInt("value1")); - assertEquals(2, rs.getInt("value2")); - assertEquals(null, rs.getObject("value3")); - assertTrue(rs.next()); - assertEquals("t2", rs.getObject("atable")); - assertEquals(1, rs.getInt("idvalue")); - assertEquals(3, rs.getInt("value1")); - assertEquals(null, rs.getObject("value2")); - assertEquals(3, rs.getInt("value3")); //this fails! - assertFalse(rs.next()); - } - - public void testPreparedWithManyParams() throws Exception { - - int count = 40; - String tabledef = "CREATE TABLE T1 ("; - - for (int i = 0; i < count; i++) { - if (i != 0) { - tabledef = tabledef + ','; - } - - tabledef = tabledef + "COL_" + i + " INT NOT NULL"; - } - - tabledef += ");"; - - String querydef = "INSERT INTO T1("; - - for (int i = 0; i < count; i++) { - if (i != 0) { - querydef = querydef + ','; - } - - querydef = querydef + "COL_" + i; - } - - querydef += ") VALUES ("; - - for (int i = 0; i < count; i++) { - if (i != 0) { - querydef = querydef + ','; - } - - querydef = querydef + "?"; - } - - querydef += ");"; - - Statement st = connection.createStatement(); - - st.execute("DROP TABLE T1 IF EXISTS;"); - st.execute(tabledef); - - PreparedStatement ps = connection.prepareStatement(querydef); - - for (int i = 0; i < count; i++) { - ps.setInt(i + 1, i + 311); - } - - ps.executeUpdate(); - } - - static byte[] b1 = { - 0, 1, -128, 44, 12 - }; - static byte[] b2 = { - 10, 127 - }; - - public void testBinaryFunction() throws Exception { - - Statement sStatement = null; - ResultSet r; - boolean mismatch; - - sStatement = connection.createStatement(); - - try { - - // prepared statements - String s = - "create table bintest(id int primary key, bin varbinary(100))"; - - sStatement.execute(s); - - s = "insert into bintest values ( ?, ?)"; - - PreparedStatement p = connection.prepareStatement(s); - - p.clearParameters(); - p.setInt(1, 10); - p.setBytes(2, b1); - p.executeUpdate(); - p.clearParameters(); - p.setInt(1, 20); - p.setBytes(2, b2); - p.executeUpdate(); - - byte[] b1n; - byte[] b2n; - - s = "select \"org.hsqldb.lib.ArrayUtil.countStartElementsAt\"(bin,0, ?) " - + "from bintest"; - p = connection.prepareStatement(s); - - p.setBytes(1, b2); - - r = p.executeQuery(); - - r.next(); - - int integer1 = r.getInt(1); - - r.next(); - - int integer2 = r.getInt(1); - - s = "select \"org.hsqldb.lib.StringConverter.hexStringToByteArray\"" - + "(\"org.hsqldb.lib.StringConverter.byteArrayToHexString\"(x'abcd')) " - + "from bintest"; - r = sStatement.executeQuery(s); - - r.next(); - - b1n = r.getBytes(1); - - r.next(); - - b1n = r.getBytes(1); - - //-- - s = "select \"org.hsqldb.lib.StringConverter.byteArrayToHexString\"(bin) " - + "from bintest"; - r = sStatement.executeQuery(s); - - r.next(); - - b1n = r.getBytes(1); - - r.next(); - - b1n = r.getBytes(1); - s = "create table obj(id int,o object)"; - - sStatement.execute(s); - - s = "insert into obj values(?,?)"; - p = connection.prepareStatement(s); - - p.setInt(1, 1); - - int[] ia1 = { - 1, 2, 3 - }; - - p.setObject(2, ia1); - p.executeUpdate(); - p.clearParameters(); - p.setInt(1, 2); - - java.awt.Rectangle r1 = new java.awt.Rectangle(10, 11, 12, 13); - - p.setObject(2, r1); - p.executeUpdate(); - - r = sStatement.executeQuery("SELECT o FROM obj ORDER BY id DESC"); - - r.next(); - - java.awt.Rectangle r2 = (java.awt.Rectangle) r.getObject(1); - - if (r2.x != 10 || r2.y != 11 || r2.width != 12 - || r2.height != 13) { - throw new Exception("Object data error: Rectangle"); - } - - r.next(); - - int[] ia2 = (int[]) (r.getObject(1)); - - if (ia2[0] != 1 || ia2[1] != 2 || ia2[2] != 3 || ia2.length != 3) { - throw new Exception("Object data error: int[]"); - } - - sStatement.close(); - } catch (Exception e) { - assertEquals(0, 1); - } - } - - protected void tearDown() { - - try { - stmnt.execute("SHUTDOWN"); - connection.close(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("TestSql.tearDown() error: " + e.getMessage()); - } - - super.tearDown(); - } - - public static void main(String[] argv) { - - TestResult result = new TestResult(); - TestCase testA = new TestSql("testMetaData"); - TestCase testB = new TestSql("testDoubleNaN"); - TestCase testC = new TestSql("testAny"); - - testA.run(result); - testB.run(result); - testC.run(result); - System.out.println("TestSql error count: " + result.failureCount()); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestSqlPeriodPredicates.java b/database/hsqldb/src/org/hsqldb/test/TestSqlPeriodPredicates.java deleted file mode 100644 index 0abceb8a..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestSqlPeriodPredicates.java +++ /dev/null @@ -1,388 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLDataException; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -/** - * Base tests for the period predicates queries. - * - * @author Pascal-Eric Servais (peservais at users dot sourceforge dot net) - * @version 2.3.4 - * @since 2.3.4 - */ -public class TestSqlPeriodPredicates extends TestBase { - - private Connection conn; - - public TestSqlPeriodPredicates(String name) throws Exception { - - super(name); - } - - public void setUp() throws Exception { - super.setUp(); - conn = newConnection(); - - Statement stmt = conn.createStatement(); - stmt.executeUpdate("DROP TABLE PUBLIC.emp IF EXISTS"); - stmt.executeUpdate("CREATE TABLE PUBLIC.emp (emp_id INTEGER NOT NULL,name VARCHAR(30),salary DECIMAL(10,2),dept_id INTEGER,bus_start DATETIME NOT NULL,bus_end DATETIME NOT NULL);"); - - stmt.executeUpdate( - "insert into PUBLIC.emp (emp_id, name, salary, dept_id, bus_start, bus_end)" - + "values" - + "(1, 'Tom', 300000.00, 1, TIMESTAMP '2000-01-01 01:02:03', TIMESTAMP '2000-02-01 01:02:03')," - + "(2, 'Tom', 305000.00, 1, TIMESTAMP '2000-02-01 01:02:03', TIMESTAMP '2000-03-01 01:02:03')," - + "(3, 'Tom', 310000.00, 1, TIMESTAMP '2000-03-01 01:02:03', TIMESTAMP '2000-04-01 01:02:03')" - + ";"); - - stmt.close(); - } - - public void tearDown() { - super.tearDown(); - } - - /** - * Set the two parameters of the prepared statement, execute the query and validate the returned result set. - */ - private void executeAndTestQuery(PreparedStatement stmt, String periodStart, String periodEnd, int... expectedIds) throws SQLException { - stmt.setString(1, periodStart); - stmt.setString(2, periodEnd); - - ResultSet rs = stmt.executeQuery(); - assertAllIdsPresent(rs, expectedIds); - rs.close(); - } - - /** - * Validate that all the expected ids are contained within the result set. - * - * @param rs result set containing the result of the query - * @param expectedIds list if the expected ids. If null, expects an empty result set. - * @throws SQLException exception - */ - private void assertAllIdsPresent(ResultSet rs, int ...expectedIds) throws - SQLException { - Set expected = new TreeSet (); - Set found = new TreeSet (); - if (expectedIds != null) { - for (int id : expectedIds) { - expected.add(id); - } - } - while (rs.next()) { - found.add(rs.getInt(1)); - } - assertEquals(expected.size(), found.size()); - assertTrue(found.containsAll(expected)); - } - - public void testFirstPeriodOverlapsSecondPeriod() throws SQLException { - - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) OVERLAPS PERIOD (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-01-01 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-01-12 01:02:03'", 1); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-12-31 01:02:03'", 1, 2, 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-04-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'"); - - stmt.close(); - } - - public void testFirstPeriodOverlapsSecondPeriodReversed() throws - SQLException { - - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (?, ?) OVERLAPS PERIOD (BUS_START, BUS_END);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-01-12 01:02:03'", 1); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-01-01 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-12-31 01:02:03'", 1, 2, 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-04-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'"); - - stmt.close(); - } - - public void testFirstPeriodEqualsSecondPeriod() throws SQLException { - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) EQUALS PERIOD (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - ResultSet rs; - - executeAndTestQuery(stmt, "TIMESTAMP '2000-02-01 01:02:03'", - "TIMESTAMP '2000-03-01 01:02:03'", 2); - stmt.close(); - - query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (?, ?) EQUALS PERIOD (BUS_START, BUS_END);"; - stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-02-01 01:02:03'", - "TIMESTAMP '2000-03-01 01:02:03'", 2); - stmt.close(); - - query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) EQUALS PERIOD (TIMESTAMP '2000-03-01 01:02:03', TIMESTAMP '2000-04-01 01:02:03');"; - stmt = conn.prepareStatement(query); - rs = stmt.executeQuery(); - assertAllIdsPresent(rs, 3); - rs.close(); - - stmt.close(); - } - - public void testFirstPeriodContainsSecondPeriod() throws SQLException { - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) CONTAINS PERIOD (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-02-01 01:02:03'", - "TIMESTAMP '2000-02-01 01:02:04'", 2); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-03-01 01:02:03'", - "TIMESTAMP '1999-04-01 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-03-01 01:02:03'", - "TIMESTAMP '2000-03-30 01:02:03'", 3); - - stmt.close(); - - query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (?, ?) CONTAINS PERIOD (BUS_START, BUS_END);"; - stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-03-01 01:02:03'", - "TIMESTAMP '2001-03-01 01:02:03'", 1, 2, 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-01 01:02:03'", - "TIMESTAMP '2001-04-01 01:02:03'", 1, 2, 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-31 01:02:03'", - "TIMESTAMP '2000-03-01 01:02:03'", 2); - - stmt.close(); - } - - public void testFirstPeriodContainsDate() throws SQLException { - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) CONTAINS TIMESTAMP '2000-02-01 01:02:03';"; - PreparedStatement stmt = conn.prepareStatement(query); - ResultSet rs; - - rs = stmt.executeQuery(); - assertAllIdsPresent(rs, 2); - rs.close(); - stmt.close(); - - query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) CONTAINS TIMESTAMP '1999-02-01 01:02:03';"; - stmt = conn.prepareStatement(query); - rs = stmt.executeQuery(); - assertAllIdsPresent(rs); - rs.close(); - - stmt.close(); - } - - public void testFirstPeriodPrecedesSecondPeriod() throws SQLException { - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) PRECEDES PERIOD (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-04-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'", 1, 2, 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-03-31 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'", 1, 2); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-03-01 01:02:03'", - "TIMESTAMP '1999-03-30 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-01-12 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-02-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'", 1); - - stmt.close(); - } - - public void testFirstPeriodSuccedesSecondPeriod() throws SQLException { - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) SUCCEEDS PERIOD (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-04-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-03-01 01:02:03'", - "TIMESTAMP '1999-03-30 01:02:03'", 1, 2, 3); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-01-12 01:02:03'", 2, 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-01 01:02:03'", - "TIMESTAMP '2000-03-01 01:02:03'", 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-02-01 01:02:03'", - "TIMESTAMP '2000-03-01 01:02:03'", 3); - - stmt.close(); - } - - public void testFirstPeriodImmediatelyPrecedesSecondPeriod() throws - SQLException { - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) IMMEDIATELY PRECEDES PERIOD (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-04-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'", 3); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-03-31 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-03-01 01:02:03'", - "TIMESTAMP '1999-03-30 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-02-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'", 1); - - stmt.close(); - } - - public void testFirstPeriodImmediatelySuccedesSecondPeriod() throws - SQLException { - String query = "SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) IMMEDIATELY SUCCEEDS PERIOD (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-04-01 01:02:03'", - "TIMESTAMP '2000-05-01 01:02:03'"); - - executeAndTestQuery(stmt, "TIMESTAMP '1999-12-01 01:02:03'", - "TIMESTAMP '2000-01-01 01:02:03'", 1); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-01 01:02:03'", - "TIMESTAMP '2000-02-01 01:02:03'", 2); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-02-01 01:02:03'", - "TIMESTAMP '2000-03-01 01:02:03'", 3); - - stmt.close(); - } - - /** - * When omiting the {@code PERIOD} keyword, it is possible to use a period constructor - * with the same date as start and and date. - */ - public void testPeriodOverlapsSinglePointInTime() throws SQLException { - - String query = - "SELECT emp_id FROM PUBLIC.EMP WHERE (BUS_START, BUS_END) OVERLAPS (?, ?);"; - PreparedStatement stmt = conn.prepareStatement(query); - - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-11 01:02:03'", - "TIMESTAMP '2000-01-11 01:02:03'", 1); - - stmt.close(); - - query = - "SELECT emp_id FROM PUBLIC.EMP WHERE (?, ?) OVERLAPS (BUS_START, BUS_END);"; - stmt = conn.prepareStatement(query); - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-11 01:02:03'", - "TIMESTAMP '2000-01-11 01:02:03'", 1); - - stmt.close(); - } - - /** - * When using the {@code PERIOD} keyword, the start date of the period must be before the end date. - */ - public void testInvalidPeriodDateSpecification() { - PreparedStatement stmt = null; - List predicates = new ArrayList (); - Collections.addAll(predicates, "OVERLAPS", "EQUALS", "CONTAINS", - "PRECEDES", "SUCCEEDS", "IMMEDIATELY PRECEDES", - "IMMEDIATELY SUCCEEDS"); - for (String predicate : predicates) { - String query = String.format("SELECT emp_id FROM PUBLIC.EMP WHERE PERIOD (BUS_START, BUS_END) %s PERIOD (?, ?);", - predicate); - try { - stmt = conn.prepareStatement(query); - // testing with start after end - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-11 01:02:03'", - "TIMESTAMP '2000-01-10 01:02:03'"); - fail(String.format( - "An exception should have been raised for predicate %s when start is after end!", - predicate)); - } catch (SQLDataException e) { - // This is Ok. The test pass. - assertEquals("22020", e.getSQLState()); - } catch (SQLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } - - try { - // testing with start equals end - executeAndTestQuery(stmt, "TIMESTAMP '2000-01-11 01:02:03'", - "TIMESTAMP '2000-01-11 01:02:03'"); - fail(String.format( - "An exception should have been raised for predicate %s when start equals end!", - predicate)); - } catch (SQLDataException e) { - // This is Ok. The test pass. - assertEquals("22020", e.getSQLState()); - } catch (SQLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } - } - } - -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestSqlPersistent.java b/database/hsqldb/src/org/hsqldb/test/TestSqlPersistent.java deleted file mode 100644 index cf66a7a6..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestSqlPersistent.java +++ /dev/null @@ -1,600 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -/** - * Test sql statements via jdbc against a database with cached tables - * @author Fred Toussi (fredt@users dot sourceforge.net) - */ -public class TestSqlPersistent extends TestCase { - - // change the url to reflect your preferred db location and name -// String url = "jdbc:hsqldb:hsql://localhost/mytest"; - String url = TestDirectorySettings.fileBaseURL + "test/testpersistent"; - String user; - String password; - Statement stmnt; - Connection connection; - - public TestSqlPersistent(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - - user = "sa"; - password = ""; - stmnt = null; - connection = null; - - TestUtil.deleteDatabase(TestDirectorySettings.fileBase + "test/testpersistent"); - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - connection = DriverManager.getConnection(url, user, password); - stmnt = connection.createStatement(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("TestSqlPersistence.setUp() error: " - + e.getMessage()); - } - } - - /** - * demonstration of bug fix #482109 - inserting Integers - * and Strings with PreparedStatement.setObject() did not work; - * String, Integer and Array types are inserted and retrieved

    - * - * demonstration of retrieving values using different getXXX methods - */ - public void testInsertObject() { - - Object stringValue = null; - Object integerValue = null; - Object arrayValue = null; - Object bytearrayValue = null; - Object stringValueResult = null; - Object integerValueResult = null; - Object arrayValueResult = null; - boolean wasNull = false; - String message = "DB operation completed"; - - try { - String sqlString = "DROP TABLE PREFERENCE IF EXISTS;" - + "CREATE CACHED TABLE PREFERENCE (" - + "User_Id INTEGER NOT NULL, " - + "Pref_Name VARCHAR(30) NOT NULL, " - + "Pref_Value OBJECT NOT NULL, " - + "DateCreated DATETIME DEFAULT NOW NOT NULL, " - + "PRIMARY KEY(User_Id, Pref_Name) )"; - - stmnt.execute(sqlString); - - sqlString = "INSERT INTO PREFERENCE " - + "(User_Id,Pref_Name,Pref_Value,DateCreated) " - + "VALUES (?,?,?,current_timestamp)"; - - PreparedStatement ps = connection.prepareStatement(sqlString); - - // initialise - stringValue = "String Value for Preference 1"; - integerValue = Integer.valueOf(1000); - arrayValue = new Double[] { - Double.valueOf(1), Double.valueOf(Double.NaN), - Double.valueOf(Double.NEGATIVE_INFINITY), - Double.valueOf(Double.POSITIVE_INFINITY) - }; - bytearrayValue = new byte[] { - 1, 2, 3, 4, 5, 6, - }; - - // String as Object - ps.setInt(1, 1); - ps.setString(2, "String Type Object 1"); - -// fredt - in order to store Strings in OBJECT columns setObject should -// explicitly be called with a Types.OTHER type -// ps.setObject(3, stringValue); will throw an exception - ps.setObject(3, stringValue, Types.OTHER); - ps.execute(); - - // Integer as Object - ps.setInt(1, 2); - ps.setString(2, "Integer Type Object 2"); - -// ps.setObject(3, integerValue, Types.OTHER); should work too - ps.setObject(3, integerValue); - ps.execute(); - - // Array as object - ps.setInt(1, 3); - ps.setString(2, "Array Type Object 3"); - /* - ps.setCharacterStream( - 2, new java.io.StringReader("Array Type Object 3"), 19); - */ - - // ps.setObject(3, arrayValue, Types.OTHER); should work too - ps.setObject(3, arrayValue); - ps.execute(); - - // byte arrray as object - ps.setInt(1, 3); - ps.setString(2, "byte Array Type Object 3"); - /* - ps.setCharacterStream( - 2, new java.io.StringReader("byte Array Type Object 3"), 19); - */ - - // ps.setObject(3, bytearrayValue); will fail - // must use this to indicate we are inserting into an OTHER column - ps.setObject(3, bytearrayValue, Types.OTHER); - ps.execute(); - - ResultSet rs = stmnt.executeQuery("SELECT * FROM PREFERENCE"); - boolean result = rs.next(); - - // a string can be retrieved as a String or a stream - // as Unicode string - String str = rs.getString(2); - - System.out.println(str); - - // as Unicode stream - InputStream is = rs.getUnicodeStream(2); - int c; - - while ((c = is.read()) > -1) { - c = is.read(); - - System.out.print((char) c); - } - - System.out.println(); - - // as ASCII stream, ignoring the high order bytes - is = rs.getAsciiStream(2); - - while ((c = is.read()) > -1) { - System.out.print((char) c); - } - - System.out.println(); - - // JAVA 2 specific - // as character stream via a Reader - Reader re = rs.getCharacterStream(2); - - while ((c = re.read()) > -1) { - System.out.print((char) c); - } - - // retrieving objects inserted into the third column - stringValueResult = rs.getObject(3); - - rs.next(); - - integerValueResult = rs.getObject(3); - - rs.next(); - - arrayValueResult = rs.getObject(3); - - // how to check if the last retrieved value was null - wasNull = rs.wasNull(); - - // cast objects to original types - will throw if type is wrong - String castStringValue = (String) stringValueResult; - Integer castIntegerValue = (Integer) integerValueResult; - Double[] castDoubleArrayValue = (Double[]) arrayValueResult; - - { - sqlString = "DELETE FROM PREFERENCE WHERE user_id = ?"; - - PreparedStatement st = connection.prepareStatement(sqlString); - - st.setString(1, "2"); - - int ret = st.executeUpdate(); - - // here, ret is equal to 1, that is expected - //conn.commit(); // not needed, as far as AUTO_COMMIT is set to TRUE - st.close(); - - st = connection.prepareStatement( - "SELECT user_id FROM PREFERENCE WHERE user_id=?"); - - st.setString(1, "2"); - - rs = st.executeQuery(); - - while (rs.next()) { - System.out.println(rs.getString(1)); - } - } - } catch (SQLException e) { - System.out.println(e.getMessage()); - } catch (IOException e1) {} - - /* - boolean success = stringValue.equals(stringValueResult) - && integerValue.equals(integerValueResult) - && java.util.Arrays.equals((Double[]) arrayValue, - (Double[]) arrayValueResult); - */ - boolean success = true; - - assertEquals(true, success); - } - - public void testSelectObject() throws IOException { - - String stringValue = ""; - Integer integerValue = null; - Double[] arrayValue = null; - byte[] byteArrayValue = null; - String stringValueResult = null; - Integer integerValueResult = null; - Double[] arrayValueResult = null; - boolean wasNull = false; - String message = "DB operation completed"; - - try { - String sqlString = "DROP TABLE TESTOBJECT IF EXISTS;" - + "CREATE CACHED TABLE TESTOBJECT (" - + "ID INTEGER NOT NULL IDENTITY, " - + "STOREDOBJECT OTHER, STOREDBIN BINARY(100) )"; - - stmnt.execute(sqlString); - - sqlString = "INSERT INTO TESTOBJECT " - + "(STOREDOBJECT, STOREDBIN) " + "VALUES (?,?)"; - - PreparedStatement ps = connection.prepareStatement(sqlString); - - // initialise - stringValue = "Test String Value"; - integerValue = Integer.valueOf(1000); - arrayValue = new Double[] { - Double.valueOf(1), Double.valueOf(Double.NaN), - Double.valueOf(Double.NEGATIVE_INFINITY), - Double.valueOf(Double.POSITIVE_INFINITY) - }; - byteArrayValue = new byte[] { - 1, 2, 3 - }; - - // String as Object -// fredt - in order to store Strings in OBJECT columns setObject should -// explicitly be called with a Types.OTHER type - ps.setObject(1, stringValue, Types.OTHER); - ps.setBytes(2, byteArrayValue); - ps.execute(); - - // Integer as Object - ps.setObject(1, integerValue, Types.OTHER); - ps.setBinaryStream(2, new ByteArrayInputStream(byteArrayValue), - byteArrayValue.length); - ps.execute(); - - // Array as object - ps.setObject(1, arrayValue, Types.OTHER); - - // file as binary - works fine but file path and name has to be modified for test environment - /* - int length = (int) new File("c://ft/db.jar").length(); - FileInputStream fis = new FileInputStream("c://ft/db.jar"); - ps.setBinaryStream(2,fis,length); - */ - ps.execute(); - - ResultSet rs = stmnt.executeQuery("SELECT * FROM TESTOBJECT"); - boolean result = rs.next(); - - // retrieving objects inserted into the third column - stringValueResult = (String) rs.getObject(2); - - rs.next(); - - integerValueResult = (Integer) rs.getObject(2); - - rs.next(); - - arrayValueResult = (Double[]) rs.getObject(2); - - // cast objects to original types - will throw if type is wrong - String castStringValue = (String) stringValueResult; - Integer castIntegerValue = (Integer) integerValueResult; - Double[] castDoubleArrayValue = (Double[]) arrayValueResult; - - for (int i = 0; i < arrayValue.length; i++) { - if (!arrayValue[i].equals(arrayValueResult[i])) { - System.out.println("array mismatch: " + arrayValue[i] - + " : " + arrayValueResult[i]); - } - } - - rs.close(); - ps.close(); - - sqlString = "SELECT * FROM TESTOBJECT WHERE STOREDOBJECT = ?"; - ps = connection.prepareStatement(sqlString); - - ps.setObject(1, Integer.valueOf(1000)); - - rs = ps.executeQuery(); - - rs.next(); - - Object returnVal = rs.getObject(2); - - rs.next(); - } catch (SQLException e) { - System.out.println(e.getMessage()); - } - - boolean success = stringValue.equals(stringValueResult) - && integerValue.equals(integerValueResult) - && java.util.Arrays.equals((Double[]) arrayValue, - (Double[]) arrayValueResult); - - assertEquals(true, success); - - try { - String sqlString = "drop table objects if exists"; - PreparedStatement ps = connection.prepareStatement(sqlString); - - ps.execute(); - - sqlString = - "create cached table objects (object_id INTEGER IDENTITY," - + "object_name VARCHAR(128) NOT NULL,role_name VARCHAR(128) NOT NULL," - + "value LONGVARBINARY(1000) NOT NULL,description LONGVARCHAR(1000))"; - ps = connection.prepareStatement(sqlString); - - ps.execute(); - - sqlString = - "INSERT INTO objects VALUES(1, 'name','role',?,'description')"; - ps = connection.prepareStatement(sqlString); - - ps.setBytes(1, new byte[] { - 1, 2, 3, 4, 5 - }); - ps.executeUpdate(); - - sqlString = "UPDATE objects SET value = ?, description = ? WHERE " - + "object_name = ? AND role_name = ?"; - ps = connection.prepareStatement(sqlString); - - ps.setBytes(1, new byte[] { - 1, 2, 3, 4, 5 - }); - ps.setString(2, "desc"); - ps.setString(3, "new"); - ps.setString(4, "role"); - ps.executeUpdate(); - } catch (SQLException e) { - System.out.println(e.getMessage()); - } - } - - public void testDoubleNaN() { - doTestDoubleNan(false); - } - - private void doTestDoubleNan(boolean shutdown) { - - double value = 0; - boolean wasEqual = false; - String message = "DB operation completed"; - String ddl1 = - "DROP TABLE t1 IF EXISTS;" - + "CREATE TABLE t1 ( d DECIMAL, f DOUBLE, l BIGINT, i INTEGER, s SMALLINT, t TINYINT, " - + "dt DATE DEFAULT CURRENT_DATE, ti TIME DEFAULT CURRENT_TIME, ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP );"; - - try { - stmnt.execute(ddl1); - - PreparedStatement ps = connection.prepareStatement( - "INSERT INTO t1 (d,f,l,i,s,t,dt,ti,ts) VALUES (?,?,?,?,?,?,?,?,?)"); - - ps.setString(1, "0.2"); - ps.setDouble(2, 0.2); - ps.setLong(3, java.lang.Long.MAX_VALUE); - ps.setInt(4, Integer.MAX_VALUE); - ps.setInt(5, Short.MAX_VALUE); - ps.setInt(6, 0); - ps.setDate(7, new java.sql.Date(System.currentTimeMillis())); - ps.setTime(8, new java.sql.Time(System.currentTimeMillis())); - ps.setTimestamp( - 9, new java.sql.Timestamp(System.currentTimeMillis())); - ps.execute(); - ps.setInt(1, 0); - ps.setDouble(2, java.lang.Double.NaN); - ps.setLong(3, java.lang.Long.MIN_VALUE); - ps.setInt(4, Integer.MIN_VALUE); - ps.setInt(5, Short.MIN_VALUE); - ps.setInt(6, 0); - - // allowed conversions - ps.setTimestamp( - 7, new java.sql.Timestamp(System.currentTimeMillis() + 1)); - ps.setTime(8, new java.sql.Time(System.currentTimeMillis() + 1)); - ps.setDate(9, new java.sql.Date(System.currentTimeMillis() + 1)); - ps.execute(); - - // - ps.setInt(1, 0); - ps.setDouble(2, java.lang.Double.POSITIVE_INFINITY); - ps.setInt(4, Integer.MIN_VALUE); - - // test conversion - // ps.setObject(5, Boolean.TRUE); // no longer converts boolean to int - // ps.setBoolean(5, true); - ps.setObject(5, Short.valueOf((short) 2), Types.SMALLINT); - ps.setObject(6, Integer.valueOf(2), Types.TINYINT); - - // allowed conversions - ps.setObject(7, new java.sql.Date(System.currentTimeMillis() + 2)); - ps.setObject(8, new java.sql.Time(System.currentTimeMillis() + 2)); - ps.setObject(9, new java.sql.Timestamp(System.currentTimeMillis() - + 2)); - ps.execute(); - ps.setObject(1, Float.valueOf(0), Types.INTEGER); - ps.setObject(4, Float.valueOf(1), Types.INTEGER); - ps.setDouble(2, java.lang.Double.NEGATIVE_INFINITY); - ps.execute(); - - ResultSet rs = - stmnt.executeQuery("SELECT d, f, l, i, s*2, t FROM t1"); - boolean result = rs.next(); - - value = rs.getDouble(2); - -// int smallintValue = rs.getShort(3); - int integerValue = rs.getInt(4); - - if (rs.next()) { - value = rs.getDouble(2); - wasEqual = Double.isNaN(value); - integerValue = rs.getInt(4); - - // tests for conversion - // getInt on DECIMAL - integerValue = rs.getInt(1); - } - - if (rs.next()) { - value = rs.getDouble(2); - wasEqual = wasEqual && value == Double.POSITIVE_INFINITY; - } - - if (rs.next()) { - value = rs.getDouble(2); - wasEqual = wasEqual && value == Double.NEGATIVE_INFINITY; - } - - rs = stmnt.executeQuery("SELECT MAX(i) FROM t1"); - - if (rs.next()) { - int max = rs.getInt(1); - - System.out.println("Max value for i: " + max); - } - - try { - - // cause errors - ps.setString(5, "three"); - fail("update did not fail"); - } catch (SQLException e) {} - - { - stmnt.execute("drop table CDTYPE if exists"); - - // test for the value MAX(column) in an empty table - stmnt.execute( - "CREATE TABLE cdType (ID INTEGER NOT NULL, name VARCHAR(50), PRIMARY KEY(ID))"); - - rs = stmnt.executeQuery("SELECT MAX(ID) FROM cdType"); - - if (rs.next()) { - int max = rs.getInt(1); - - System.out.println("Max value for ID: " + max); - } else { - System.out.println("Max value for ID not returned"); - } - - stmnt.executeUpdate( - "INSERT INTO cdType VALUES (10,'Test String');"); - stmnt.execute("CALL IDENTITY();"); - - try { - stmnt.executeUpdate( - "INSERT INTO cdType VALUES (10,'Test String');"); - } catch (SQLException e1) { - connection.rollback(); - } - } - } catch (SQLException e) { - fail(e.getMessage()); - } - - System.out.println("testDoubleNaN complete"); - - // assert new behaviour - assertEquals(true, wasEqual); - } - - protected void tearDown() { - - try { - stmnt.execute("SHUTDOWN"); - connection.close(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("TestSql.tearDown() error: " + e.getMessage()); - } - } - - public static void main(String[] argv) { - - TestResult result = new TestResult(); - TestCase testC = new TestSqlPersistent("testInsertObject"); - TestCase testD = new TestSqlPersistent("testSelectObject"); - - testC.run(result); - testD.run(result); - System.out.println("TestSqlPersistent error count: " - + result.failureCount()); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestStoredProcedure.java b/database/hsqldb/src/org/hsqldb/test/TestStoredProcedure.java deleted file mode 100644 index 8db7c967..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestStoredProcedure.java +++ /dev/null @@ -1,573 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.TestCase; -import junit.framework.TestResult; - -/** - * Tests for stored procedures. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.3 - * @since 2.0.1 - */ -public class TestStoredProcedure extends TestBase { - - public TestStoredProcedure(String name) { - super(name); - } - - protected void setUp() throws Exception { - super.setUp(); - } - - public void testOne() throws Exception { - - Connection conn = newConnection(); - Statement statement; - - try { - statement = conn.createStatement(); - - ResultSet rs = statement.executeQuery( - "call \"org.hsqldb.test.TestStoredProcedure.procTest1\"()"); - - rs.next(); - - int cols = rs.getInt(1); - - assertFalse("test result not correct", false); - } catch (Exception e) {} - - try { - statement = conn.createStatement(); - - statement.execute( - "CREATE temp TABLE MYTABLE(COL1 INTEGER,COL2 VARCHAR(10));"); - statement.execute( - "CREATE PROCEDURE proc1(IN P1 INT, IN P2 INT, OUT P3 INT) " - + "SPECIFIC P2 LANGUAGE JAVA DETERMINISTIC MODIFIES SQL DATA EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestStoredProcedure.procTest2'"); - - CallableStatement c = conn.prepareCall("call proc1(1,2,?)"); - - c.execute(); - - int value = c.getInt(1); - - c.close(); - statement.execute( - "CREATE FUNCTION func1(IN P1 INT, IN P2 INT) " - + "RETURNS TABLE(C1 INT, C2 INT) " - + "SPECIFIC F1 LANGUAGE JAVA DETERMINISTIC EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestStoredProcedure.funcTest1'"); - - c = conn.prepareCall("call func1(1,2)"); - - boolean isResult = c.execute(); - - assertTrue(isResult); - - ResultSet rs = c.getResultSet(); - - rs.next(); - assertEquals(value, 2); - - rs = c.executeQuery(); - - rs.next(); - assertEquals(value, 2); - } catch (Exception e) { - assertTrue("unexpected error", false); - } finally { - conn.close(); - } - } - - public void testTwo() throws Exception { - - Connection conn = newConnection(); - Statement statement; - int updateCount; - - try { - statement = conn.createStatement(); - - statement.execute("create user testusert2 password 'test'"); - statement.execute("create table testtablet2(v varchar(20))"); - statement.execute( - "insert into testtablet2 values ('tennis'), ('tent'), ('television'), ('radio')"); - - ResultSet rs = statement.executeQuery( - "call \"org.hsqldb.test.TestStoredProcedure.funcTest2\"('test')"); - - rs.next(); - - boolean b = rs.getBoolean(1); - - rs.close(); - assertTrue("test result not correct", b); - statement.execute( - "create function func2(varchar(20)) returns boolean " - + "SPECIFIC F2 LANGUAGE JAVA DETERMINISTIC NO SQL CALLED ON NULL INPUT EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestStoredProcedure.funcTest2'"); - - rs = statement.executeQuery("call func2('test')"); - - rs.next(); - - b = rs.getBoolean(1); - - rs.close(); - assertTrue("test result not correct", b); - - rs = statement.executeQuery( - "select count(*) from testtablet2 where func2(v)"); - - rs.next(); - - int count = rs.getInt(1); - - assertTrue("test result not correct", count == 3); - statement.execute( - "grant execute on specific function public.f2 to testusert2"); - - boolean isResult = statement.execute("call func2('test')"); - - assertTrue(isResult); - - rs = statement.getResultSet(); - - rs.next(); - - b = rs.getBoolean(1); - - assertTrue("test result not correct", b); - } catch (Exception e) { - assertTrue("unable to execute call to procedure", false); - } finally { - conn.close(); - } - } - - public void testThree() throws SQLException { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("declare varone int default 0;"); - st.execute( - "create procedure proc_inout_result (inout intp int) " - + " language java reads sql data external name 'CLASSPATH:org.hsqldb.test.TestStoredProcedure.procWithResultOne'"); - - CallableStatement cs = - conn.prepareCall("call proc_inout_result(varone)"); - boolean isResult = cs.execute(); - - assertFalse(isResult); - cs.getMoreResults(); - - ResultSet rs = cs.getResultSet(); - - rs.next(); - assertEquals(rs.getString(1), "SYSTEM_LOBS"); - assertEquals(rs.getString(2), "LOB_IDS"); - rs.close(); - } - - public void testFour() throws SQLException { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("declare varone int default 0;"); - st.execute( - "create procedure proc_inout_result_two (inout intp int) " - + " language java reads sql data dynamic result sets 2 external name 'CLASSPATH:org.hsqldb.test.TestStoredProcedure.procWithResultTwo'"); - - CallableStatement cs = - conn.prepareCall("call proc_inout_result_two(varone)"); - boolean isResult = cs.execute(); - - assertFalse(isResult); - cs.getMoreResults(); - - ResultSet rs = cs.getResultSet(); - - rs.next(); - assertEquals(rs.getString(1), "SYSTEM_LOBS"); - assertEquals(rs.getString(2), "LOB_IDS"); - rs.close(); - - if (cs.getMoreResults()) { - rs = cs.getResultSet(); - - rs.next(); - assertEquals(rs.getString(1), "SYSTEM_LOBS"); - assertEquals(rs.getString(2), "LOBS"); - rs.close(); - } - } - - public void testFourParams() throws SQLException { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute( - "create procedure proc_inout_result_two_params (inout intp int) " - + " language java reads sql data dynamic result sets 2 external name 'CLASSPATH:org.hsqldb.test.TestStoredProcedure.procWithResultTwo'"); - - CallableStatement cs = - conn.prepareCall("{call proc_inout_result_two_params(?)}"); - - cs.setInt(1, 0); - - boolean isResult = cs.execute(); - - assertFalse(isResult); - cs.getMoreResults(); - - ResultSet rs = cs.getResultSet(); - - rs.next(); - assertEquals(rs.getString(1), "SYSTEM_LOBS"); - assertEquals(rs.getString(2), "LOB_IDS"); - rs.close(); - - if (cs.getMoreResults()) { - rs = cs.getResultSet(); - - rs.next(); - assertEquals(rs.getString(1), "SYSTEM_LOBS"); - assertEquals(rs.getString(2), "LOBS"); - rs.close(); - } - - rs = cs.executeQuery(); - - rs.next(); - assertEquals(rs.getString(1), "SYSTEM_LOBS"); - assertEquals(rs.getString(2), "LOB_IDS"); - rs.close(); - } - - public void testFive() throws SQLException { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute( - "create function func_table (in namep varchar(128)) returns table(cola varchar(128), colb varchar(128)) " - + "return table(select schema_name, schema_owner from information_schema.schemata where schema_owner=namep);"); - - CallableStatement cs = conn.prepareCall("call func_table('_SYSTEM')"); - boolean isResult = cs.execute(); - - assertTrue(isResult); - - ResultSet rs = cs.getResultSet(); - - rs.next(); - assertEquals(rs.getString(1), "INFORMATION_SCHEMA"); - assertEquals(rs.getString(2), "_SYSTEM"); - rs.close(); - - // - isResult = st.execute("call func_table('_SYSTEM')"); - - assertTrue(isResult); - - rs = st.getResultSet(); - - rs.next(); - assertEquals(rs.getString(1), "INFORMATION_SCHEMA"); - assertEquals(rs.getString(2), "_SYSTEM"); - rs.close(); - } - - String testSixProcedure = - "CREATE PROCEDURE get_columns_and_table(tname VARCHAR(128), sname VARCHAR(128)) " - + "READS SQL DATA DYNAMIC RESULT SETS 2 " + "BEGIN ATOMIC " - + "DECLARE result1 CURSOR FOR SELECT * FROM information_schema.columns " - + "WHERE table_name = tname AND table_schema = sname; " - + "DECLARE result2 CURSOR FOR SELECT * FROM information_schema.tables " - + "WHERE table_name = tname AND table_schema = sname; " - + "OPEN result1; " + "OPEN result2; " + "END"; - - public void testSix() throws SQLException { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute(testSixProcedure); - - CallableStatement cs = conn.prepareCall( - "call get_columns_and_table('TABLES', 'INFORMATION_SCHEMA')"); - boolean isResult = cs.execute(); - - assertFalse(isResult); - - isResult = cs.getMoreResults(); - - ResultSet rs = cs.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - rs.close(); - - boolean more = cs.getMoreResults(); - - if (more) { - rs = cs.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - } - - cs = conn.prepareCall("call get_columns_and_table(?, ?)"); - - cs.setString(1, "TABLES"); - cs.setString(2, "INFORMATION_SCHEMA"); - - isResult = cs.execute(); - - assertFalse(isResult); - cs.getMoreResults(); - - rs = cs.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - rs.close(); - - more = cs.getMoreResults(); - - if (more) { - rs = cs.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - } - - st = conn.createStatement(); - isResult = st.execute( - "call get_columns_and_table('TABLES', 'INFORMATION_SCHEMA')"); - - assertFalse(isResult); - st.getMoreResults(); - - rs = st.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - rs.close(); - - more = st.getMoreResults(); - - if (more) { - rs = st.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - } - - rs.close(); - - PreparedStatement ps = conn.prepareStatement( - "call get_columns_and_table('TABLES', 'INFORMATION_SCHEMA')"); - - isResult = ps.execute(); - - assertFalse(isResult); - ps.getMoreResults(); - - rs = ps.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - rs.close(); - - more = ps.getMoreResults(); - - if (more) { - rs = ps.getResultSet(); - - rs.next(); - assertEquals("INFORMATION_SCHEMA", rs.getString(2)); - } - - rs.close(); - } - - public static void procWithResultOne(Integer[] intparam, - ResultSet[] resultparam) - throws SQLException { - - Connection conn = - DriverManager.getConnection("jdbc:default:connection"); - - conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); - - Statement st = conn.createStatement(); - ResultSet rs = st.executeQuery( - "select count(*) from information_schema.columns where table_name='LOB_IDS' and table_schema='SYSTEM_LOBS'"); - - if (rs.next()) { - intparam[0] = rs.getInt(1); - - rs.close(); - } - - resultparam[0] = st.executeQuery( - "select table_schema, table_name from information_schema.tables where table_name='LOB_IDS' and table_schema='SYSTEM_LOBS'"); - } - - public static void procWithResultTwo(Connection conn, Integer[] intparam, - ResultSet[] resultparamOne, - ResultSet[] resultparamTwo) - throws SQLException { - - conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); - - Statement st = conn.createStatement(); - ResultSet rs = st.executeQuery( - "select count(*) from information_schema.columns where table_name='LOB_IDS' and table_schema='SYSTEM_LOBS'"); - - if (rs.next()) { - intparam[0] = rs.getInt(1); - - rs.close(); - } - - resultparamOne[0] = st.executeQuery( - "select table_schema, table_name from information_schema.tables where table_name='LOB_IDS' and table_schema='SYSTEM_LOBS'"); - resultparamTwo[0] = st.executeQuery( - "select table_schema, table_name from information_schema.tables where table_name='LOBS' and table_schema='SYSTEM_LOBS'"); - } - - public static void procTest1(Connection conn) - throws java.sql.SQLException { - - int cols; - java.sql.Statement stmt = conn.createStatement(); - - stmt.execute("insert into mytable values(1,'test1');"); - stmt.execute("insert into mytable values(2,'test2');"); - - java.sql.ResultSet rs = stmt.executeQuery("select * from mytable"); - java.sql.ResultSetMetaData meta = rs.getMetaData(); - - cols = meta.getColumnCount(); - - rs.close(); - stmt.close(); - } - - public static void procTest2(int p1, int p2, - Integer[] p3) throws java.sql.SQLException { - - Connection conn = - DriverManager.getConnection("jdbc:default:connection"); - java.sql.Statement stmt = conn.createStatement(); - - stmt.execute("insert into mytable values(" + p1 + ",'test1')"); - stmt.execute("insert into mytable values(" + p2 + ",'test2')"); - - java.sql.ResultSet rs = stmt.executeQuery("select * from mytable"); - java.sql.ResultSetMetaData meta = rs.getMetaData(); - int cols = meta.getColumnCount(); - - p3[0] = Integer.valueOf(cols); - - rs.close(); - stmt.close(); - } - - public static ResultSet funcTest1(int p1, - int p2) throws java.sql.SQLException { - - Connection conn = - DriverManager.getConnection("jdbc:default:connection"); - java.sql.PreparedStatement stmt = conn.prepareStatement( - "select * from mytable where col1 = ? or col1 = ?"); - - stmt.setInt(1, p1); - stmt.setInt(2, p2); - - java.sql.ResultSet rs = stmt.executeQuery(); - - return rs; - } - - public static boolean funcTest2(Connection conn, - String value) - throws java.sql.SQLException { - - if (value != null && value.startsWith("te")) { - return true; - } - - return false; - } - - public static void procTest3(Integer value) throws java.sql.SQLException {} - - public static void main(String[] args) throws Exception { - - TestResult result; - TestCase test; - java.util.Enumeration failures; - int count; - - result = new TestResult(); - test = new TestStoredProcedure("test"); - - test.run(result); - - count = result.failureCount(); - - System.out.println("TestStoredProcedure failure count: " + count); - - failures = result.failures(); - - while (failures.hasMoreElements()) { - System.out.println(failures.nextElement()); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestSubQueriesInPreparedStatements.java b/database/hsqldb/src/org/hsqldb/test/TestSubQueriesInPreparedStatements.java deleted file mode 100644 index f25f1dbc..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestSubQueriesInPreparedStatements.java +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/* - * TestSubQueriesInPreparedStatements.java - * - * Created on July 9, 2003, 4:03 PM - */ -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; - -/** - * - * @author campbell-burnet@users - */ -public class TestSubQueriesInPreparedStatements { - - public static void main(String[] args) throws Exception { - test(); - } - - public static void test() throws Exception { - - Connection conn; - Statement stmnt; - PreparedStatement pstmnt; - Driver driver; - - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - conn = DriverManager.getConnection("jdbc:hsqldb:mem:test", "sa", ""); - stmnt = conn.createStatement(); - pstmnt = conn.prepareStatement("drop table t if exists"); - - boolean result = pstmnt.execute(); - - pstmnt = conn.prepareStatement("create table t(i decimal)"); - - int updatecount = pstmnt.executeUpdate(); - - pstmnt = conn.prepareStatement("insert into t values(?)"); - - for (int i = 0; i < 100; i++) { - pstmnt.setInt(1, i); - pstmnt.executeUpdate(); - } - - pstmnt = conn.prepareStatement( - "select * from (select * from t where i < ?)"); - - System.out.println("Expecting: 0..3"); - pstmnt.setInt(1, 4); - - ResultSet rs = pstmnt.executeQuery(); - - while (rs.next()) { - System.out.println(rs.getInt(1)); - } - - System.out.println("Expecting: 0..4"); - pstmnt.setInt(1, 5); - - rs = pstmnt.executeQuery(); - - while (rs.next()) { - System.out.println(rs.getInt(1)); - } - - pstmnt = conn.prepareStatement( - "select sum(i) from (select i from t where i between ? and ?)"); - - System.out.println("Expecting: 9"); - pstmnt.setInt(1, 4); - pstmnt.setInt(2, 5); - - rs = pstmnt.executeQuery(); - - while (rs.next()) { - System.out.println(rs.getInt(1)); - } - - System.out.println("Expecting: 15"); - pstmnt.setInt(2, 6); - - rs = pstmnt.executeQuery(); - - while (rs.next()) { - System.out.println(rs.getInt(1)); - } - - pstmnt = conn.prepareStatement( - "select * from (select i as c1 from t where i < ?) a, (select i as c2 from t where i < ?) b"); - - System.out.println("Expecting: (0,0)"); - pstmnt.setInt(1, 1); - pstmnt.setInt(2, 1); - - rs = pstmnt.executeQuery(); - - while (rs.next()) { - System.out.println("(" + rs.getInt(1) + "," + rs.getInt(2) + ")"); - } - - System.out.println("Expecting: ((0,0), (0,1), (1,0), (1,1)"); - pstmnt.setInt(1, 2); - pstmnt.setInt(2, 2); - - rs = pstmnt.executeQuery(); - - while (rs.next()) { - System.out.println("(" + rs.getInt(1) + "," + rs.getInt(2) + ")"); - } - - System.out.println("Expecting: ((0,0) .. (3,3)"); - pstmnt.setInt(1, 4); - pstmnt.setInt(2, 4); - - rs = pstmnt.executeQuery(); - - while (rs.next()) { - System.out.println("(" + rs.getInt(1) + "," + rs.getInt(2) + ")"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestSubselect.java b/database/hsqldb/src/org/hsqldb/test/TestSubselect.java deleted file mode 100644 index 5733af0a..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestSubselect.java +++ /dev/null @@ -1,448 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import junit.framework.TestCase; - -/** - * Test cases for HSQL subselects. - * - * @author David Moles Apr 30, 2002 - */ - -// fredt@users - modified to remove dependecy on DBUnit -public class TestSubselect extends TestCase { - - //------------------------------------------------------------ - // Class variables - //------------------------------------------------------------ - private static final String databaseDriver = "org.hsqldb.jdbc.JDBCDriver"; - private static final String databaseURL = TestDirectorySettings.fileBaseURL - + "test/subselect"; - private static final String databaseUser = "sa"; - private static final String databasePassword = ""; - - //------------------------------------------------------------ - // Instance variables - //------------------------------------------------------------ - private Connection jdbcConnection; - - //------------------------------------------------------------ - // Constructors - //------------------------------------------------------------ - - /** - * Constructs a new SubselectTest. - */ - public TestSubselect(String s) { - super(s); - } - - //------------------------------------------------------------ - // Class methods - //------------------------------------------------------------ - protected static Connection getJDBCConnection() throws SQLException { - return DriverManager.getConnection(databaseURL, databaseUser, - databasePassword); - } - - protected void setUp() throws Exception { - - TestUtil.deleteDatabase(TestDirectorySettings.fileBase - + "test/subselect"); - Class.forName(databaseDriver); - - jdbcConnection = getJDBCConnection(); - - createDataset(); - } - - protected void tearDown() throws Exception { - - jdbcConnection.close(); - - jdbcConnection = null; - - super.tearDown(); - } - - void createDataset() throws SQLException { - - Statement statement = jdbcConnection.createStatement(); - - statement.execute("drop table colors if exists; " - + "drop table sizes if exists; " - + "drop table fruits if exists; " - + "drop table trees if exists; "); - statement.execute("create table colors(id int, val varchar(10)); "); - statement.execute("insert into colors values(1,'red'); " - + "insert into colors values(2,'green'); " - + "insert into colors values(3,'orange'); " - + "insert into colors values(4,'indigo'); "); - statement.execute("create table sizes(id int, val varchar(10)); "); - statement.execute("insert into sizes values(1,'small'); " - + "insert into sizes values(2,'medium'); " - + "insert into sizes values(3,'large'); " - + "insert into sizes values(4,'odd'); "); - statement.execute( - "create table fruits(id int, name varchar(20), color_id int); "); - statement.execute( - "insert into fruits values(1, 'golden delicious',2); " - + "insert into fruits values(2, 'macintosh',1); " - + "insert into fruits values(3, 'red delicious',1); " - + "insert into fruits values(4, 'granny smith',2); " - + "insert into fruits values(5, 'tangerine',4);"); - statement.execute( - "create table trees(id int, name varchar(30), fruit_id int, size_id int); "); - statement.execute( - "insert into trees values(1, 'small golden delicious tree',1,1); " - + "insert into trees values(2, 'large macintosh tree',2,3); " - + "insert into trees values(3, 'large red delicious tree',3,3); " - + "insert into trees values(4, 'small red delicious tree',3,1); " - + "insert into trees values(5, 'medium granny smith tree',4,2); "); - statement.close(); - } - - //------------------------------------------------------------ - // Helper methods - //------------------------------------------------------------ - private static void compareResults(String sql, String[] expected, - Connection jdbcConnection) - throws SQLException { - - Statement statement = jdbcConnection.createStatement(); - ResultSet results = statement.executeQuery(sql); - int rowCount = 0; - - while (results.next()) { - assertTrue("Statement <" + sql + "> returned too many rows.", - (rowCount < expected.length)); - assertEquals("Statement <" + sql + "> returned wrong value.", - expected[rowCount], results.getString(1)); - - rowCount++; - } - - assertEquals("Statement <" + sql + "> returned wrong number of rows.", - expected.length, rowCount); - } - - //------------------------------------------------------------ - // Test methods - //------------------------------------------------------------ - - /** - * This test is basically a sanity check of the data set. - */ - public void testSimpleJoin() throws SQLException { - - String sql = - "select trees.id, trees.name, sizes.val, fruits.name, colors.val" - + " from trees, sizes, fruits, colors" - + " where trees.size_id = sizes.id" - + " and trees.fruit_id = fruits.id" - + " and fruits.color_id = colors.id" + " order by 1"; - int expectedRows = 5; - String[] expectedTrees = new String[] { - "small golden delicious tree", "large macintosh tree", - "large red delicious tree", "small red delicious tree", - "medium granny smith tree" - }; - String[] expectedSizes = new String[] { - "small", "large", "large", "small", "medium" - }; - String[] expectedFruits = new String[] { - "golden delicious", "macintosh", "red delicious", "red delicious", - "granny smith" - }; - String[] expectedColors = new String[] { - "green", "red", "red", "red", "green" - }; - Statement statement = jdbcConnection.createStatement(); - ResultSet results = statement.executeQuery(sql); - String[] trees = new String[expectedRows]; - String[] fruits = new String[expectedRows]; - String[] sizes = new String[expectedRows]; - String[] colors = new String[expectedRows]; - int rowCount = 0; - - while (results.next()) { - assertTrue("Statement <" + sql + "> returned too many rows.", - (rowCount <= expectedRows)); - assertEquals("Statement <" + sql - + "> returned rows in wrong order.", (1 + rowCount), - results.getInt(1)); - assertEquals("Statement <" + sql + "> returned wrong value.", - expectedTrees[rowCount], results.getString(2)); - assertEquals("Statement <" + sql + "> returned wrong value.", - expectedSizes[rowCount], results.getString(3)); - assertEquals("Statement <" + sql + "> returned wrong value.", - expectedFruits[rowCount], results.getString(4)); - assertEquals("Statement <" + sql + "> returned wrong value.", - expectedColors[rowCount], results.getString(5)); - - rowCount++; - } - - assertEquals("Statement <" + sql + "> returned wrong number of rows.", - expectedRows, rowCount); - } - - /** - * Inner select with where clause in outer select having column with same name as where clause in inner select - */ - public void testWhereClausesColliding() throws SQLException { - - String sql = - "select name from fruits where id in (select fruit_id from trees where id < 3) order by name"; - String[] expected = new String[] { - "golden delicious", "macintosh" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * As above, with table aliases. - */ - public void testWhereClausesCollidingWithAliases() throws SQLException { - - String sql = - "select a.name from fruits a where a.id in (select b.fruit_id from trees b where b.id < 3) order by name"; - String[] expected = new String[] { - "golden delicious", "macintosh" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Inner select with two tables having columns with the same name, one of which is referred to in the - * subselect, the other of which is not used in the query (both FRUITS and TREES have NAME column, - * but we're only selecting FRUITS.NAME and we're not referring to TREES.NAME at all). - */ - public void testHiddenCollision() throws SQLException { - - String sql = - "select name from fruits where id in (select fruit_id from trees) order by name"; - String[] expected = new String[] { - "golden delicious", "granny smith", "macintosh", "red delicious" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * As above, with table aliases. - */ - public void testHiddenCollisionWithAliases() throws SQLException { - - String sql = - "select a.name from fruits a where a.id in (select b.fruit_id from trees b) order by a.name"; - String[] expected = new String[] { - "golden delicious", "granny smith", "macintosh", "red delicious" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Inner select with where clause in outer select having column with same name as select clause in inner select - */ - public void testWhereSelectColliding() throws SQLException { - - // Yes, this is a nonsensical query - String sql = - "select val from colors where id in (select id from trees where fruit_id = 3) order by val"; - String[] expected = new String[] { - "indigo", "orange" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * As above, with aliases. - */ - public void testWhereSelectCollidingWithAliases() throws SQLException { - - // Yes, this is a nonsensical query - String sql = - "select a.val from colors a where a.id in (select b.id from trees b where b.fruit_id = 3) order by a.val"; - String[] expected = new String[] { - "indigo", "orange" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Inner select involving same table - */ - public void testSameTable() throws SQLException { - - String sql = - "select name from trees where id in (select id from trees where fruit_id = 3) order by name"; - String[] expected = new String[] { - "large red delicious tree", "small red delicious tree" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * As above with aliases. - */ - public void testSameTableWithAliases() throws SQLException { - - String sql = - "select a.name from trees a where a.id in (select b.id from trees b where b.fruit_id = 3) order by a.name"; - String[] expected = new String[] { - "large red delicious tree", "small red delicious tree" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Inner select involving same table as one of two joined tables in outer select - */ - public void testSameTableWithJoin() throws SQLException { - - String sql = - "select sizes.val from trees, sizes where sizes.id = trees.size_id and trees.id in (select id from trees where fruit_id = 3) order by sizes.val"; - String[] expected = new String[] { - "large", "small" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Tests two subselects, anded. - */ - public void testAndedSubselects() throws SQLException { - - String sql = - "select name from trees where size_id in (select id from sizes where val = 'large') and fruit_id in (select id from fruits where color_id = 1) order by name"; - String[] expected = new String[] { - "large macintosh tree", "large red delicious tree" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Test nested subselects. - */ - public void testNestedSubselects() throws SQLException { - - String sql = - "select name from trees where fruit_id in (select id from fruits where color_id in (select id from colors where val = 'red')) order by name"; - String[] expected = new String[] { - "large macintosh tree", "large red delicious tree", - "small red delicious tree" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Inner select with "not in" in outer select where clause. - */ - public void testNotIn() throws SQLException { - - String sql = - "select name from fruits where id not in (select fruit_id from trees) order by name"; - String[] expected = new String[]{ "tangerine" }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Inner select with "not in" in outer select where clause and same table in inner select where clause. - */ - public void testNotInSameTableAndColumn() throws SQLException { - - String sql = - "select name from fruits where id not in (select id from fruits where color_id > 1 ) order by name"; - String[] expected = new String[] { - "macintosh", "red delicious" - }; - - compareResults(sql, expected, jdbcConnection); - } - - /** - * Inner select reusing alias names from outer select, but using them for different tables - */ - public void testAliasScope() throws SQLException { - - String sql = - "select a.val, b.name from sizes a, trees b where a.id = b.size_id and b.id in (select a.id from trees a, fruits b where a.fruit_id = b.id and b.name='red delicious') order by a.val"; - String[] expectedSizes = new String[] { - "large", "small" - }; - String[] expectedTrees = new String[] { - "large red delicious tree", "small red delicious tree" - }; - - assertEquals( - "Programmer error: expected arrays should be of equal length.", - expectedSizes.length, expectedTrees.length); - - Statement statement = jdbcConnection.createStatement(); - ResultSet results = statement.executeQuery(sql); - int rowCount = 0; - - while (results.next()) { - assertTrue("Statement <" + sql + "> returned too many rows.", - (rowCount < expectedSizes.length)); - assertEquals("Statement <" + sql + "> returned wrong value.", - expectedSizes[rowCount], results.getString(1)); - assertEquals("Statement <" + sql + "> returned wrong value.", - expectedTrees[rowCount], results.getString(2)); - - rowCount++; - } - - assertEquals("Statement <" + sql + "> returned wrong number of rows.", - expectedSizes.length, rowCount); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestTextTable.java b/database/hsqldb/src/org/hsqldb/test/TestTextTable.java deleted file mode 100644 index b070dc7b..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestTextTable.java +++ /dev/null @@ -1,576 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.IOException; -import java.io.PrintStream; -import java.sql.SQLException; - -import org.hsqldb.lib.FileUtil; - -import java.sql.Statement; - -/** test various text table features - * - * @author frank.schoenheit@sun.com - */ -public class TestTextTable extends TestBase { - - java.sql.Statement m_statement; - java.sql.Connection m_connection; - - private class TextTableDescriptor { - - private String m_name; - private String m_columnSpec; - private String m_separator; - private String m_separatorSpec; - private Object[][] m_data; - - public TextTableDescriptor(String name, String columnSpec, - String separator, String separatorSpec, - Object[][] data) { - - m_name = name; - m_columnSpec = columnSpec; - m_separator = separator; - m_separatorSpec = separatorSpec; - m_data = data; - } - - public final String getName() { - return m_name; - } - - public final String getColumnSpec() { - return m_columnSpec; - } - - public final String getSeparator() { - return m_separator; - } - - public final String getSeparatorSpec() { - return m_separatorSpec; - } - - public final Object[][] getData() { - return m_data; - } - - public final Object[][] appendRowData(Object[] rowData) { - - Object[][] newData = new Object[m_data.length + 1][rowData.length]; - - for (int row = 0; row < m_data.length; ++row) { - newData[row] = m_data[row]; - } - - newData[m_data.length] = rowData; - m_data = newData; - - return m_data; - } - - /** - * creates a text file as described by this instance - */ - private void createTextFile() { - - PrintStream textFile = null; - - try { - String completeFileName = m_name + ".csv"; - - FileUtil.getFileUtil().delete(completeFileName); - - textFile = new PrintStream( - FileUtil.getFileUtil().openOutputStreamElementAppend( - completeFileName)); - - new java.io.File(completeFileName).deleteOnExit(); - } catch (IOException ex) { - fail(ex.toString()); - } - - for (int row = 0; row < m_data.length; ++row) { - StringBuilder buf = new StringBuilder(); - int colCount = m_data[row].length; - - for (int col = 0; col < colCount; ++col) { - buf.append(m_data[row][col].toString()); - - if (col + 1 != colCount) { - buf.append(m_separator); - } - } - - textFile.println(buf.toString()); - } - - textFile.close(); - } - - private String getDataSourceSpec() { - return m_name + ".csv;encoding=UTF-8;fs=" + m_separatorSpec; - } - - private void createTable(java.sql.Connection connection) - throws SQLException { - - String dropTable = "DROP TABLE \"" + m_name + "\" IF EXISTS;"; - - String createTable = "CREATE TEXT TABLE \"" + m_name + "\" ( " - + m_columnSpec + " );"; - - Statement statement = connection.createStatement(); - statement.execute(dropTable); - statement.execute(createTable); - - boolean test = isReadOnly(m_name); - String setTableSource = "SET TABLE \"" + m_name + "\" SOURCE \"" - + getDataSourceSpec() + "\""; - - statement.execute(setTableSource); - } - } - - TextTableDescriptor m_products = new TextTableDescriptor("products", - "ID INTEGER PRIMARY KEY, \"name\" VARCHAR(20)", "\t", "\\t", - new Object[][] { - new Object[] { - Integer.valueOf(1), "Apples" - }, new Object[] { - Integer.valueOf(2), "Oranges" - } - }); - TextTableDescriptor m_customers = new TextTableDescriptor("customers", - "ID INTEGER PRIMARY KEY," + "\"name\" VARCHAR(50)," - + "\"address\" VARCHAR(50)," + "\"city\" VARCHAR(50)," - + "\"postal\" VARCHAR(50)", ";", "\\semi", new Object[][] { - new Object[] { - Integer.valueOf(1), "Food, Inc.", "Down Under", "Melbourne", "509" - }, new Object[] { - Integer.valueOf(2), "Simply Delicious", "Down Under", "Melbourne", - "518" - }, new Object[] { - Integer.valueOf(3), "Pure Health", "10 Fish St.", "San Francisco", - "94107" - } - }); - - /** Creates a new instance of TestTextTable */ - public TestTextTable(String testName) { - super(testName, "jdbc:hsqldb:file:test"); - } - - /** - * sets up all text files for the test database - */ - private void setupTextFiles() { - m_products.createTextFile(); - m_customers.createTextFile(); - } - - /** - * creates the database tables needed for the test - */ - private void setupDatabase() { - - try { - m_connection = newConnection(); - m_statement = m_connection.createStatement(); - - m_products.createTable(m_connection); - m_customers.createTable(m_connection); - } catch (SQLException ex) { - fail(ex.toString()); - } - } - - public void setUp() throws Exception { - - super.setUp(); - setupTextFiles(); - setupDatabase(); - } - - protected void tearDown() { - executeStatement("SHUTDOWN"); - super.tearDown(); - } - - /** - * returns the data source definition for a given text table - */ - private String getDataSourceSpec(String tableName) { - - String spec = null; - - try { - java.sql.ResultSet results = m_statement.executeQuery( - "SELECT DATA_SOURCE_DEFINTION FROM INFORMATION_SCHEMA.SYSTEM_TEXTTABLES " - + "WHERE TABLE_NAME='" + tableName + "'"); - - results.next(); - - spec = results.getString(1); - } catch (SQLException ex) { - fail("getDataSourceSpec(" + tableName + ") failed: " - + ex.toString()); - } - - return spec; - } - - /** - * determines whether a given table is currently read-only - */ - private boolean isReadOnly(String tableName) { - - boolean isReadOnly = true; - - try { - java.sql.ResultSet systemTables = m_statement.executeQuery( - "SELECT READ_ONLY FROM INFORMATION_SCHEMA.SYSTEM_TABLES " - + "WHERE TABLE_NAME='" + m_products.getName() + "'"); - - systemTables.next(); - - isReadOnly = systemTables.getBoolean(1); - } catch (SQLException ex) { - fail("isReadOnly(" + tableName + ") failed: " + ex.toString()); - } - - return isReadOnly; - } - - /** - * checks different field separators - */ - private void checkSeparators() { - - String[][] separators = new String[][] { - - // special separators - new String[] { - ";", "\\semi" - }, new String[] { - "\"", "\\quote" - }, new String[] { - " ", "\\space" - }, new String[] { - "'", "\\apos" - }, - - //new String[] { "\n", "\\n" }, - // doesn't work as expected - seems I don't understand how this is intended to work? - new String[] { - "\t", "\\t" - }, new String[] { - "\\", "\\" - }, - - // some arbitrary separators which need not to be escaped - new String[] { - ".", "." - }, new String[] { - "-", "-" - }, new String[] { - "#", "#" - }, new String[] { - ",", "," - } - - // unicode character - //new String[] { "\u1234", "\\u1234" } - // doesn't work. How do I specify in a FileOutputStream which encoding to use when writing - // strings? - }; - - for (int i = 0; i < separators.length; ++i) { - String separator = separators[i][0]; - String separatorSpec = separators[i][1]; - - // create the file - String tableName = "customers_" + i; - TextTableDescriptor tempCustomersDesc = - new TextTableDescriptor(tableName, - m_customers.getColumnSpec(), - separator, separatorSpec, - m_customers.getData()); - - tempCustomersDesc.createTextFile(); - - try { - tempCustomersDesc.createTable(m_connection); - } catch (Throwable t) { - fail("checkSeparators: separator '" + separatorSpec - + "' doesn't work: " + t.toString()); - } - - executeStatement("SET TABLE \"" + tableName + "\" SOURCE OFF"); - executeStatement("DROP TABLE \"" + tableName + "\""); - } - } - - /** - * verifies the content of a given table is as expected - * @param tableName - * the name of the table whose content is to check - * @param expectedValues - * the values expected in the table - */ - private void verifyTableContent(String tableName, - Object[][] expectedValues) { - - String selectStmt = "SELECT * FROM \"" + tableName + "\" ORDER BY ID"; - - try { - java.sql.ResultSet results = m_statement.executeQuery(selectStmt); - int row = 0; - - while (results.next()) { - row = results.getRow(); - - Object[] expectedRowContent = expectedValues[row - 1]; - - for (int col = 0; col < expectedRowContent.length; ++col) { - Object expectedValue = expectedRowContent[col]; - Object foundValue = results.getObject(col + 1); - - assertEquals("table " + tableName + ", row " + row - + ", column " + col + ":", expectedValue, - foundValue); - } - } - - // finally ensure that there are not more rows in the table than expected - assertEquals("table " + tableName + "'s row count: ", - expectedValues.length, row); - } catch (junit.framework.AssertionFailedError e) { - throw e; - } catch (Throwable t) { - fail("verifyTableContent(" + tableName + ") failed with " - + t.toString()); - } - } - - /** - * executes a given m_statement - * - *

    Basically, this method calls m_statement.execute(sql), - * but wraps any SQLExceptions into a JUnit error. - */ - private void executeStatement(String sql) { - - try { - m_statement.execute(sql); - } catch (SQLException ex) { - fail(ex.toString()); - } - } - - /** - * verifies the initial content of the "products" text table, plus a simple insertion - */ - private void verifyInitialContent() { - verifyTableContent(m_products.getName(), m_products.getData()); - verifyTableContent(m_customers.getName(), m_customers.getData()); - } - - /** - * does some very basic insertion tests - */ - private void checkInsertions() { - - // check whether inserting a value succeeds - executeStatement("INSERT INTO \"" + m_products.getName() - + "\" VALUES ( 3, 'Pears' )"); - verifyTableContent(m_products.getName(), - m_products.appendRowData(new Object[] { - Integer.valueOf(3), "Pears" - })); - - // check whether the PK constraint works - try { - m_statement.execute("INSERT INTO \"" + m_products.getName() - + "\" VALUES ( 1, 'Green Apples' )"); - fail("PKs do not work as expected."); - } catch (SQLException e) {} - } - - /** - * verifies whether implicit and explicit dis/connections from/to the text table source work - * as expected - */ - private void checkSourceConnection() { - - String sqlSetTable = "SET TABLE \"" + m_products.getName() + "\""; - - // preconditions for the following tests - assertEquals( - "internal error: retrieving the data source does not work properly at all.", - m_products.getDataSourceSpec(), - getDataSourceSpec(m_products.getName())); - assertFalse("internal error: table should not be read-only, initially", - isReadOnly(m_products.getName())); - - // disconnect, see if the table behaves well afterwards - executeStatement(sqlSetTable + " SOURCE OFF"); - assertEquals( - "Disconnecting a text table should not reset the table source.", - m_products.getDataSourceSpec(), - getDataSourceSpec(m_products.getName())); - assertTrue( - "Disconnecting from the table source should put the table into read-only mode.", - isReadOnly(m_products.getName())); - - try { - java.sql.ResultSet tableContent = - m_statement.executeQuery("SELECT * FROM \"" - + m_products.getName() + "\""); - - assertFalse("A disconnected table should be empty.", - tableContent.next()); - } catch (SQLException ex) { - fail("Selecting from a disconnected table should return an empty result set."); - } - - // reconnect, see if the table works as expected then - executeStatement(sqlSetTable + " SOURCE ON"); - verifyTableContent(m_products.getName(), m_products.getData()); - - // check whether dis-/reconnecting a readonly table preserves the readonly-ness - executeStatement(sqlSetTable + " READONLY TRUE"); - assertTrue("Setting the table to read-only failed.", - isReadOnly(m_products.getName())); - executeStatement(sqlSetTable + " SOURCE OFF"); - assertTrue("Still, a disconnected table should be read-only.", - isReadOnly(m_products.getName())); - executeStatement(sqlSetTable + " SOURCE ON"); - assertTrue( - "A reconnected readonly table should preserve its readonly-ness.", - isReadOnly(m_products.getName())); - executeStatement(sqlSetTable + " READONLY FALSE"); - assertFalse("Unable to reset the readonly-ness.", - isReadOnly(m_products.getName())); - - // check whether setting an invalid data source sets the table to readonly, by - // preserving the data source - try { - - // create a malformed file - String fileName = "malformed.csv"; - PrintStream textFile = new PrintStream( - FileUtil.getFileUtil().openOutputStreamElementAppend( - fileName)); - - textFile.println("not a number;some text"); - textFile.close(); - new java.io.File(fileName).deleteOnExit(); - - // try setting it as source - String newDataSourceSpec = fileName + ";encoding=UTF-8;fs=\\semi"; - - try { - m_statement.execute(sqlSetTable + " SOURCE \"" - + newDataSourceSpec + "\""); - fail("a malformed data source was accepted silently."); - } catch (java.sql.SQLException es) { /* that's expected here */ - } - - // new - a malformed data source assignment by user should not survive - // and should revert to the existing one - assertTrue( - "A table with an invalid data source should fall back to original read-only.", - !isReadOnly(m_products.getName())); - assertEquals( - "A data source which cannot be set should nonetheless be remembered.", - m_products.getDataSourceSpec(), - getDataSourceSpec(m_products.getName())); - - // the data source spec should even survive a shutdown - executeStatement("SHUTDOWN"); - - m_connection = newConnection(); - m_statement = m_connection.createStatement(); - - assertEquals("A data source should survive a database shutdown.", - m_products.getDataSourceSpec(), - getDataSourceSpec(m_products.getName())); - assertTrue( - "After shutdown and DB-reconnect, the table should keepe read-only attribute.", - !isReadOnly(m_products.getName())); - - // reconnect after fixing the file - FileUtil.getFileUtil().delete(fileName); - - textFile = new PrintStream( - FileUtil.getFileUtil().openOutputStreamElementAppend( - fileName)); - - textFile.println("1;some text"); - textFile.close(); - m_statement.execute(sqlSetTable + " SOURCE \"" + newDataSourceSpec - + "\""); - assertFalse( - "The file was fixed, reconnect was successful, so the table shouldn't be read-only.", - isReadOnly(m_products.getName())); - - // finally re-create the proper version of the table for any further tests - m_statement.execute(sqlSetTable + " SOURCE \"" - + m_products.getDataSourceSpec() + "\""); - verifyTableContent(m_products.getName(), m_products.getData()); - } catch (junit.framework.AssertionFailedError e) { - throw e; - } catch (Throwable t) { - fail("checkSourceConnection: unable to check invalid data sources, error: " - + t.toString()); - } - } - - /** - * basic tests for text files - */ - public void testTextFiles() { - - verifyInitialContent(); - checkInsertions(); - checkSeparators(); - checkSourceConnection(); - } - - public static void main(String[] argv) { - runWithResult(TestTextTable.class, "testTextFiles"); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestTextTables.java b/database/hsqldb/src/org/hsqldb/test/TestTextTables.java deleted file mode 100644 index b39cc86c..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestTextTables.java +++ /dev/null @@ -1,369 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.DataOutputStream; -import java.io.FileOutputStream; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.hsqldb.lib.FileUtil; - -public class TestTextTables extends TestBase { - - static String url = TestDirectorySettings.fileBaseURL - + "testtext/test;sql.enforce_strict_size=true"; - static String filepath = TestDirectorySettings.fileBase + "testtext/"; - - public TestTextTables(String name) { - super(name, url); - } - - protected void setUp() throws Exception { - super.setUp(); - } - - private void deleteDatabaseAndSources() throws Exception { - - TestUtil.deleteDatabase(filepath + "test"); - TestUtil.delete(filepath + "t.txt"); - TestUtil.delete(filepath + "tt.txt"); - TestUtil.delete(filepath + "tident.txt"); - TestUtil.delete(filepath + "tsingle.txt"); - initDatabase(); - } - - public void testSectionOne() throws Exception { - - deleteDatabaseAndSources(); - initDatabase(); - partA(); - partD(); - } - - public void testSectionTwo() throws Exception { - - deleteDatabaseAndSources(); - initDatabase(); - partB(); - partD(); - } - - public void testSectionThree() throws Exception { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("SHUTDOWN SCRIPT"); - } - - public void testSectionFour() throws Exception { - - partD(); - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("SHUTDOWN"); - } - - public void testSectionFive() throws Exception { - - Connection conn = newConnection(); - - PreparedStatement ps; - - try { - ps = - conn.prepareStatement("insert into tident (c2) values ?"); - } catch (SQLException e) { - return; - } - - for (int i = 0; i < 20; i++) { - ps.setString(1, String.valueOf(i)); - ps.executeUpdate(); - } - - ps.close(); - - ps = conn.prepareStatement("insert into tsingle (c1) values ?"); - - for (int i = 0; i < 20; i++) { - ps.setInt(1, i + 7); - ps.executeUpdate(); - } - - ps.close(); - - Statement st = conn.createStatement(); - - st.execute("SHUTDOWN IMMEDIATELY"); - partD(); - - conn = newConnection(); - st = conn.createStatement(); - - st.execute("insert into tident values default, 'dont know'"); - - int count = st.executeUpdate("update tident set c2 = c2 || ' '"); - - assertEquals("identity table count mismatch", 21, count); - - ResultSet rs = st.executeQuery("select count(*) from tsingle"); - - assertTrue(rs.next()); - assertEquals(20, rs.getInt(1)); - st.execute("set table tsingle read only"); - st.execute("SHUTDOWN SCRIPT"); - - conn = newConnection(); - st = conn.createStatement(); - - st.execute("SHUTDOWN SCRIPT"); - } - - public void testSectionSix() throws Exception { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("set table tsingle read write"); - st.execute("SHUTDOWN SCRIPT"); - - conn = newConnection(); - st = conn.createStatement(); - - st.execute("create memory table tmsingle (c1 int primary key)"); - st.execute("truncate table tident restart identity"); - st.execute("truncate table tsingle restart identity"); - - ResultSet rs = st.executeQuery("select count(*) from tident"); - - assertTrue(rs.next()); - assertEquals(0, rs.getInt(1)); - st.execute("set table tident source off"); - st.execute("set table tsingle source off"); - st.execute("alter table tsingle add unique(c1)"); - st.execute( - "alter table tident add foreign key (c1) references tmsingle(c1)"); - st.execute("set table tident source on"); - st.execute("set table tsingle source on"); - - rs = st.executeQuery("select count(*) from tmsingle"); - - assertTrue(rs.next()); - assertEquals(0, rs.getInt(1)); - - rs = st.executeQuery("select count(*) from tident"); - - assertTrue(rs.next()); - assertEquals(0, rs.getInt(1)); - - PreparedStatement ps = - conn.prepareStatement("insert into tmsingle(c1) values ?"); - - for (int i = 0; i < 20; i++) { - ps.setInt(1, i); - ps.executeUpdate(); - } - - ps.close(); - - ps = conn.prepareStatement("insert into tident (c1, c2) values ?, ?"); - - for (int i = 0; i < 20; i++) { - ps.setInt(1, i); - ps.setString(2, String.valueOf(i)); - ps.executeUpdate(); - } - - ps.close(); - - st = conn.createStatement(); - rs = st.executeQuery("select count(*) from tmsingle"); - - assertTrue(rs.next()); - assertEquals(20, rs.getInt(1)); - - rs = st.executeQuery("select count(*) from tident"); - - assertTrue(rs.next()); - assertEquals(20, rs.getInt(1)); - st.execute("SHUTDOWN SCRIPT"); - - conn = newConnection(); - st = conn.createStatement(); - rs = st.executeQuery("select count(*) from tmsingle"); - - assertTrue(rs.next()); - assertEquals(20, rs.getInt(1)); - - rs = st.executeQuery("select count(*) from tident"); - - assertTrue(rs.next()); - assertEquals(20, rs.getInt(1)); - - conn = newConnection(); - st = conn.createStatement(); - - st.execute("SHUTDOWN"); - } - - /** - * test for malformed strings are reported by Damjan Jovanovic - */ - public void testSectionSeven() throws Exception { - - deleteDatabaseAndSources(); - - String path = TestDirectorySettings.fileBase - + "testtext/malformed.csv"; - - FileUtil.getFileUtil().delete(path); - - FileOutputStream fos = new FileOutputStream(path); - DataOutputStream dos = new DataOutputStream(fos); - - dos.write(new byte[] { - (byte) 0xEF, (byte) 0xBB, (byte) 0xBF - }); - dos.writeBytes("\"one\",tw1o\",\"three\"\r"); - dos.writeBytes("\"one\",\"tw\n2\"o,\"three\"\r"); - dos.writeBytes("one\",\"tw3o\",\"thre\"e\r"); - dos.close(); - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("drop table ttriple if exists"); - st.execute( - "create text table ttriple(col1 varchar(20),col2 varchar(20),col3 varchar(20))"); - st.execute( - "set table ttriple source 'malformed.csv;quoted=true;encoding=UTF-8'"); - - ResultSet rs = st.executeQuery("select * from ttriple"); - - st.execute("SHUTDOWN"); - } - - /** - * test for malformed strings are reported by Damjan Jovanovic - */ - public void testSectionEight() throws Exception { - - deleteDatabaseAndSources(); - - String path = TestDirectorySettings.fileBase - + "testtext/commafield.csv"; - - FileUtil.getFileUtil().delete(path); - - FileOutputStream fos = new FileOutputStream(path); - DataOutputStream dos = new DataOutputStream(fos); - - dos.write(new byte[] { - (byte) 0xEF, (byte) 0xBB, (byte) 0xBF - }); - dos.writeBytes("\",\",\"col 2 line 1\"\r"); - dos.writeBytes("\"col 1 line 2\",\"col 2 line 2\"\r"); - dos.close(); - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("drop table tcomma if exists"); - st.execute( - "create text table tcomma(col1 varchar(20),col2 varchar(20))"); - st.execute( - "set table tcomma source 'commafield.csv;quoted=true;encoding=UTF-8'"); - - ResultSet rs = st.executeQuery("select * from tcomma"); - - rs.next(); - - String c1 = rs.getString(1); - String c2 = rs.getString(2); - - rs.next(); - - String c21 = rs.getString(1); - String c22 = rs.getString(2); - - st.execute("SHUTDOWN"); - } - - void initDatabase() throws Exception { - - Connection conn = newConnection(); - Statement st = conn.createStatement(); - - st.execute("set files write delay 0"); - st.execute("set database transaction control locks"); - } - - void partA() throws Exception { - - Connection conn = newConnection(); - - TestUtil.testScript(conn, "testrun/hsqldb/TestText01.txt"); - - Statement st = conn.createStatement(); - - st.execute("SHUTDOWN"); - } - - void partB() throws Exception { - - Connection conn = newConnection(); - - TestUtil.testScript(conn, "testrun/hsqldb/TestText01.txt"); - - Statement st = conn.createStatement(); - - st.execute("SHUTDOWN IMMEDIATELY"); - } - - void partD() throws Exception { - - Connection conn = newConnection(); - - TestUtil.testScript(conn, "testrun/hsqldb/TestText02.txt"); - - Statement st = conn.createStatement(); - - st.execute("SHUTDOWN"); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestTriggers.java b/database/hsqldb/src/org/hsqldb/test/TestTriggers.java deleted file mode 100644 index 4f48ff12..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestTriggers.java +++ /dev/null @@ -1,186 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; - -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.trigger.Trigger; - -/** - * - * @author fredt - */ -public class TestTriggers extends TestBase { - - Connection conn; - private static String dbPath = "/hsql/testtrig/trigs"; - - public TestTriggers(String testName) { - super(testName, "jdbc:hsqldb:file:" + dbPath); - TestUtil.deleteDatabase(dbPath); - } - - public void setUp() throws Exception { - - super.setUp(); - - try { - openConnection(); - } catch (SQLException ex) { - throw new RuntimeException(ex); - } - } - - public void tearDown() { - - try { - conn.close(); - } catch (SQLException ex) { - throw new RuntimeException(ex); - } - - super.tearDown(); - } - - public void testTriggerAction() { - - runScript(); - - try { - runStatements(); - } catch (SQLException e) { - e.printStackTrace(); - assertTrue(false); - } - - try { - shutdownDatabase(); - } catch (SQLException e) { - e.printStackTrace(); - assertTrue(false); - } - - try { - openConnection(); - } catch (SQLException e) { - e.printStackTrace(); - assertTrue(false); - } - - try { - runStatements(); - } catch (SQLException e) { - e.printStackTrace(); - assertTrue(false); - } - } - - public void testTriggerCondition() { - - } - - private void openConnection() throws SQLException { - conn = newConnection(); - } - - private void runScript() { - TestUtil.testScript(conn, "testrun/hsqldb/TestTriggers.txt"); - } - - private void shutdownDatabase() throws SQLException { - - Statement st = conn.createStatement(); - - st.execute("shutdown"); - st.close(); - } - - private void runStatements() throws SQLException { - - Statement st = conn.createStatement(); - - st.execute("delete from testtrig"); - st.execute("alter table testtrig alter column c1 restart with 0"); - clearCalls(); - st.execute( - "insert into testtrig values (default, 'inserted val 1', 100)"); - checkCallCount(3); - checkCalls(Trigger.INSERT_AFTER, 1); - checkCalls(Trigger.INSERT_BEFORE_ROW, 1); - checkCalls(Trigger.INSERT_AFTER_ROW, 1); - clearCalls(); - st.execute( - "insert into testtrig (c2, c3) select c2, c3 from testtrig where c1 < 0"); - checkCallCount(1); - checkCalls(Trigger.INSERT_AFTER, 1); - checkCalls(Trigger.INSERT_BEFORE_ROW, 0); - checkCalls(Trigger.INSERT_AFTER_ROW, 0); - clearCalls(); - st.execute("update testtrig set c2 = c2 || ' updated' where c1 = 0"); - checkCallCount(3); - checkCalls(Trigger.UPDATE_AFTER, 1); - checkCalls(Trigger.UPDATE_BEFORE_ROW, 1); - checkCalls(Trigger.UPDATE_AFTER_ROW, 1); - clearCalls(); - st.execute("update testtrig set c2 = c2 || ' updated' where c1 < 0"); - checkCallCount(1); - checkCalls(Trigger.UPDATE_AFTER, 1); - checkCalls(Trigger.UPDATE_BEFORE_ROW, 0); - checkCalls(Trigger.UPDATE_AFTER_ROW, 0); - clearCalls(); - st.execute("update testtrig set c2 = null where c1 = 0"); - checkCallCount(1); - checkCalls(Trigger.UPDATE_AFTER, 1); - checkCalls(Trigger.UPDATE_BEFORE_ROW, 0); - checkCalls(Trigger.UPDATE_AFTER_ROW, 0); - st.close(); - } - - void checkCalls(int trigType, int callCount) { - assertEquals("call count mismatch", TriggerClass.callCounts[trigType], - callCount); - } - - void clearCalls() { - - TriggerClass.callCount = 0; - - ArrayUtil.fillArray(TriggerClass.callCounts, 0); - } - - void checkCallCount(int count) { - assertEquals("trigger call mismatch", count, TriggerClass.callCount); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestTypeConversion.java b/database/hsqldb/src/org/hsqldb/test/TestTypeConversion.java deleted file mode 100644 index da36531c..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestTypeConversion.java +++ /dev/null @@ -1,201 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.sql.Array; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -public class TestTypeConversion extends TestBase { - - Connection connection; - Statement statement; - - public TestTypeConversion(String name) { - - super(name); - -// super(name, "jdbc:hsqldb:file:testdb/test3", false, false); -// super(name, "jdbc:hsqldb:mem:test3", false, false); - } - - protected void setUp() throws Exception { - - super.setUp(); - - connection = super.newConnection(); - statement = connection.createStatement(); - } - - public void testStreams() { - - try { - String ddl0 = "DROP TABLE BSTREAM IF EXISTS"; - String ddl1 = - "CREATE TABLE BSTREAM(A INT IDENTITY PRIMARY KEY, B VARBINARY(20))"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) { - e.printStackTrace(); - fail("ddl failure"); - } - - try { - String dml0 = "insert into bstream values(default, ?)"; - String dql0 = "select * from bstream where a = ?"; - PreparedStatement ps1 = connection.prepareStatement(dml0); - PreparedStatement ps2 = connection.prepareStatement(dql0); - byte[] data = new byte[] { - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 - }; - InputStream is = new ByteArrayInputStream(data); - - ps1.setBinaryStream(1, is); - ps1.execute(); - ps1.setObject(1, data); - ps1.execute(); - ps2.setInt(1, 1); - - ResultSet rs = ps2.executeQuery(); - - rs.next(); - - InputStream isr = rs.getBinaryStream(2); - - for (int i = 0; i < data.length; i++) { - int val = isr.read(); - - assertTrue(val == data[i]); - } - } catch (Exception e) { - e.printStackTrace(); - fail("dml failure"); - } - } - - public void testBitA() { - - try { - String ddl0 = "DROP TABLE BITTEST IF EXISTS"; - String ddl1 = - "CREATE TABLE BITTEST(BITA BIT(1), BITB BIT(2), " - + "BITVA BIT VARYING(1), BITVB BIT VARYING(2), ID IDENTITY)"; - - statement.execute(ddl0); - statement.execute(ddl1); - } catch (SQLException e) { - e.printStackTrace(); - fail("ddl failure"); - } - - try { - String dml0 = "insert into bittest values(?, ?, ?, ?, default)"; - String dql0 = "select * from bittest;"; - PreparedStatement ps = connection.prepareStatement(dml0); - byte[] data = new byte[]{ -0x80 }; - - ps.setBoolean(1, true); - ps.setBytes(2, data); - ps.setBytes(3, data); - ps.setBytes(4, data); - ps.executeUpdate(); - - // - data = new byte[]{ 0 }; - - ps.setBoolean(1, false); - ps.setBytes(2, data); - ps.setBytes(3, data); - ps.setBytes(4, data); - ps.executeUpdate(); - ps.close(); - - ps = connection.prepareStatement(dql0); - - ResultSet rs = ps.executeQuery(); - - rs.next(); - - boolean boole = rs.getBoolean(1); - - assertTrue(boole); - - boole = rs.getBoolean(1); - - assertTrue(boole); - rs.next(); - - boole = rs.getBoolean(1); - - assertFalse(boole); - - boole = rs.getBoolean(1); - - assertFalse(boole); - } catch (SQLException e) { - e.printStackTrace(); - fail("dml failure"); - } - } - - public void testArrayA() { - - try { - String ddl0 = "DROP TABLE ARRAYTEST IF EXISTS"; - String ddl1 = "CREATE TABLE ARRAYTEST(A INTEGER ARRAY)"; - String dml1 = "INSERT INTO ARRAYTEST VALUES(ARRAY[0,0])"; - String dml2 = "INSERT INTO ARRAYTEST VALUES ?"; - - statement.execute(ddl0); - statement.execute(ddl1); - statement.execute(dml1); - - PreparedStatement ps = connection.prepareStatement(dml2); - Object[] objects = new Object[] { - "1", 3, 9 - }; - Array array = connection.createArrayOf("INTEGER", objects); - - ps.setArray(1, array); - ps.execute(); - } catch (SQLException e) { - e.printStackTrace(); - fail("array failure"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestUpdatableResultSets.java b/database/hsqldb/src/org/hsqldb/test/TestUpdatableResultSets.java deleted file mode 100644 index a5e81a51..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestUpdatableResultSets.java +++ /dev/null @@ -1,358 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.Reader; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.hsqldb.jdbc.JDBCBlob; -import org.hsqldb.jdbc.JDBCClob; - -public class TestUpdatableResultSets extends TestBase { - - // - Connection connection; - Statement statement; - - public TestUpdatableResultSets(String name) { - super(name); - } - - protected void setUp() throws Exception { - - super.setUp(); - - connection = super.newConnection(); - statement = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_UPDATABLE); - } - - public void testUpdatable() { - - try { - statement.execute("SET DATABASE EVENT LOG SQL LEVEL 3"); - statement.execute("drop table t1 if exists"); - statement.execute( - "create table t1 (i int primary key, v varchar(10), t varbinary(3), b blob(16), c clob(16))"); - - String insert = "insert into t1 values(?,?,?,?,?)"; - String select = "select i, v, t, b, c from t1 where i > ?"; - PreparedStatement ps = connection.prepareStatement(insert); - - for (int i = 0; i < 10; i++) { - ps.setInt(1, i); - ps.setString(2, String.valueOf(i) + " s"); - ps.setBytes(3, new byte[] { - (byte) i, ' ', (byte) i - }); - ps.setBytes(4, new byte[] { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 - }); - ps.setString(5, "123"); - ps.execute(); - } - - ps.close(); - connection.setAutoCommit(false); - - ps = connection.prepareStatement(select, - ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - ps.setInt(1, -1); - - ResultSet rs = ps.executeQuery(); - - while (rs.next()) { - String s = rs.getString(2); - - rs.updateString(2, s + s); - rs.updateRow(); - } - - rs.close(); - - rs = ps.executeQuery(); - - while (rs.next()) { - String s = rs.getString(2); - - System.out.println(s); - } - - connection.rollback(); - - rs = ps.executeQuery(); - - while (rs.next()) { - String s = rs.getString(2); - - System.out.println(s); - } - - connection.commit(); - - rs = ps.executeQuery(); - - Clob c = new JDBCClob("123456789abcdef"); - - if (rs.next()) { - rs.updateClob(5, c); - rs.updateRow(); - } - - connection.rollback(); - - rs = ps.executeQuery(); - - Blob b = new JDBCBlob(new byte[] { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 - }); - - if (rs.next()) { - rs.updateBlob(4, b); - rs.updateRow(); - } - - connection.rollback(); - - rs = ps.executeQuery(); - - if (rs.next()) { - rs.updateClob(5, c); - rs.updateClob(5, c); - rs.updateRow(); - } - - connection.rollback(); - - rs = ps.executeQuery(); - - Reader r = - new java.io.CharArrayReader("123456789abcdef".toCharArray()); - - if (rs.next()) { - rs.updateClob(5, c); - rs.updateClob(5, r, 5); - rs.updateRow(); - } - - connection.rollback(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - public void testDeletable() { - - try { - statement.execute("drop table t1 if exists"); - statement.execute( - "create table t1 (i int primary key, c varchar(10), t varbinary(3))"); - - String insert = "insert into t1 values(?,?,?)"; - String select = "select i, c, t from t1"; - PreparedStatement ps = connection.prepareStatement(insert); - - for (int i = 0; i < 10; i++) { - ps.setInt(1, i); - ps.setString(2, String.valueOf(i) + " s"); - ps.setBytes(3, new byte[] { - (byte) i, ' ', (byte) i - }); - ps.execute(); - } - - connection.setAutoCommit(false); - - ResultSet rs = statement.executeQuery(select); - - while (rs.next()) { - String s = rs.getString(2); - - rs.deleteRow(); - } - - rs.close(); - - rs = statement.executeQuery(select); - - while (rs.next()) { - super.fail("rows not deleted"); - } - - connection.rollback(); - - rs = statement.executeQuery(select); - - while (rs.next()) { - String s = rs.getString(2); - - System.out.println(s); - } - - connection.commit(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - public void testDeletable2() { - - try { - Connection c = - DriverManager.getConnection("jdbc:hsqldb:mem:mytestdb", "SA", - ""); - String createSQL = - "create table test (num INTEGER PRIMARY KEY, str VARCHAR(25))"; - Statement createStmt = c.createStatement(); - - createStmt.execute(createSQL); - createStmt.close(); - - String ins = "insert into test (num,str) values (?,?)"; - PreparedStatement pStmt = c.prepareStatement(ins); - - for (int i = 0; i < 100; i++) { - pStmt.setInt(1, i); - pStmt.setString(2, "String" + i); - pStmt.execute(); - } - - // there should now be 100 rows in the table - String select = "SELECT * FROM test"; - PreparedStatement stmt = c.prepareStatement(select, - ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = stmt.executeQuery(); - - rs.beforeFirst(); - - while (rs.next()) { - int num = rs.getInt("num"); - - if ((num % 7) == 0) { - System.out.println("Deleting row:" + num); - rs.deleteRow(); - } - } - - Statement dropStmt = c.createStatement(); - - dropStmt.execute("drop table test;"); - dropStmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - public void testScrollable() { - - try { - statement.execute("drop table t1 if exists"); - statement.execute( - "create table t1 (i int primary key, c varchar(10), t varbinary(3))"); - statement.close(); - - String insert = "insert into t1 values(?,?,?)"; - String select = "select i, c, t from t1"; - PreparedStatement ps = connection.prepareStatement(insert); - - for (int i = 0; i < 10; i++) { - ps.setInt(1, i); - ps.setString(2, String.valueOf(i) + " s"); - ps.setBytes(3, new byte[] { - (byte) i, ' ', (byte) i - }); - ps.execute(); - } - - connection.setAutoCommit(false); - - statement = - connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - ResultSet srs = statement.executeQuery("select * from t1 limit 2"); - - srs.afterLast(); - - while (srs.previous()) { - String name = srs.getString(2); - float id = srs.getFloat(1); - - System.out.println(name + " " + id); - } - - srs.close(); - - srs = statement.executeQuery("select * from t1 limit 2"); - - srs.absolute(3); - - while (srs.previous()) { - String name = srs.getString(2); - float id = srs.getFloat(1); - - System.out.println(name + " " + id); - } - - srs.absolute(2); - - while (srs.previous()) { - String name = srs.getString(2); - float id = srs.getFloat(1); - - System.out.println(name + " " + id); - } - - srs.absolute(-1); - - while (srs.previous()) { - String name = srs.getString(2); - float id = srs.getFloat(1); - - System.out.println(name + " " + id); - } - - connection.commit(); - } catch (SQLException e) { - e.printStackTrace(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestUpdatableResults.java b/database/hsqldb/src/org/hsqldb/test/TestUpdatableResults.java deleted file mode 100644 index e7809b48..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestUpdatableResults.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; -import java.sql.SQLException; - -public class TestUpdatableResults extends TestBase { - - public TestUpdatableResults(String name) { - super(name); - } - - public void testQuery() { - - try { - Connection c = newConnection(); - Statement st = c.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_UPDATABLE); - String s = - "CREATE TABLE T (I INTEGER, C CHARACTER(10) DEFAULT 'def', B BIT(4) DEFAULT B'1010')"; - - st.execute(s); - - s = "INSERT INTO T VALUES(?,?, DEFAULT)"; - - PreparedStatement ps = c.prepareStatement(s); - - for (int i = 1; i <= 20; i++) { - ps.setInt(1, i); - ps.setString(2, "TEST " + i); - ps.execute(); - } - - c.setAutoCommit(false); - - s = "SELECT * FROM T"; - - ResultSet rs = st.executeQuery(s); - - rs.absolute(10); - rs.updateString(2, "UPDATE10"); - rs.updateRow(); - rs.absolute(11); - rs.deleteRow(); - rs.moveToInsertRow(); - rs.updateInt(1, 1011); - rs.updateString(2, "INSERT1011"); - rs.updateString(3, "0101"); - rs.insertRow(); - try { - rs.moveToInsertRow(); - rs.updateInt(1, 1012); - rs.updateString(2, "INSERT1011"); - rs.insertRow(); - rs.moveToInsertRow(); - rs.updateInt(1, 1012); - rs.insertRow(); - rs.close(); - } catch (SQLException e) { - - } - rs = st.executeQuery(s); - - while (rs.next()) { - System.out.println("" + rs.getInt(1) + " " - + rs.getString(2) + " " - + rs.getString(3)); - } - - s = "SELECT I FROM T"; - - rs = st.executeQuery(s); - - rs.moveToInsertRow(); - rs.updateInt(1, 1012); - rs.insertRow(); - - s = "SELECT I, B FROM T"; - - rs = st.executeQuery(s); - - rs.moveToInsertRow(); - rs.updateInt(1, 1013); - rs.updateString(2, "1111"); - rs.insertRow(); - - s = "SELECT * FROM T WHERE I > 1011"; - rs = st.executeQuery(s); - - while (rs.next()) { - System.out.println("" + rs.getInt(1) + " " - + rs.getString(2) + " " - + rs.getString(3)); - } - - st.execute("SHUTDOWN"); - - if (!isNetwork) { - c.close(); - } - } catch (Exception e) { - System.out.print(e); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestUtil.java b/database/hsqldb/src/org/hsqldb/test/TestUtil.java deleted file mode 100644 index 5ae3fb38..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestUtil.java +++ /dev/null @@ -1,1504 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.LineNumberReader; -import java.io.Reader; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.SimpleDateFormat; - -import org.hsqldb.lib.ArraySort; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.FileUtil; -import org.hsqldb.lib.HsqlArrayList; -import org.hsqldb.lib.LineGroupReader; -import org.hsqldb.lib.StopWatch; -import org.hsqldb.lib.StringComparator; -import org.hsqldb.lib.StringConverter; -import org.hsqldb.lib.StringUtil; - -/** - * Utility class providing methodes for submitting test statements or - * scripts to the database, comparing the results returned with - * the expected results. The test script format is compatible with existing - * scripts. - * - * Script writers be aware that you can't use stderr to distinguish error - * messages. This class writes error messages to stdout. - * - * @author Ewan Slater (ewanslater@users dot sourceforge.net) - * @author Fred Toussi (fredt@users dot sourceforge.net) - */ -public class TestUtil { - - /* - * The executing scripts do have state. This class should be - * redesigned with OOD. - */ - static private final String dbPath = "testdb/test1"; - static private final SimpleDateFormat sdfYMDHMS = - new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - static private boolean abortOnErr = false; - static final private String TIMESTAMP_VAR_STR = "${timestamp}"; - static final String LS = System.getProperty("line.separator", "\n"); - static final boolean oneSessionOnly = false; - - public static void main(String[] argv) { - - StopWatch sw = new StopWatch(true); - - TestUtil.testScripts("testrun/hsqldb", sw); - System.out.println(sw.currentElapsedTimeToMessage("Total time :")); - } - - public static void deleteDatabase(String path) { - FileUtil.deleteOrRenameDatabaseFiles(path); - } - - public static boolean delete(String file) { - return new File(file).delete(); - } - - public static void checkDatabaseFilesDeleted(String path) { - - File[] list = FileUtil.getDatabaseFileList(path); - - if (list.length != 0) { - System.out.println("database files not deleted"); - } - } - - /** - * Expand occurrences of "${timestamp}" in input to time stamps. - */ - static protected void expandStamps(StringBuilder sb) { - - int i = sb.indexOf(TIMESTAMP_VAR_STR); - - if (i < 1) { - return; - } - - String timestamp; - - synchronized (sdfYMDHMS) { - timestamp = sdfYMDHMS.format(new java.util.Date()); - } - - while (i > -1) { - sb.replace(i, i + TIMESTAMP_VAR_STR.length(), timestamp); - - i = sb.indexOf(TIMESTAMP_VAR_STR); - } - } - - static void testScripts(String directory, StopWatch sw) { - - TestUtil.deleteDatabase(dbPath); - - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - - String url = "jdbc:hsqldb:file:" + dbPath + ";sql.enforce_strict_size=true"; - String user = "sa"; - String password = ""; - Connection cConnection = null; - String[] filelist; - String absolute = new File(directory).getAbsolutePath(); - - filelist = new File(absolute).list(); - - ArraySort.sort(filelist, filelist.length, new StringComparator()); - - for (int i = 0; i < filelist.length; i++) { - String fname = filelist[i]; - - if (fname.startsWith("TestSelf") && fname.endsWith(".txt")) { - long elapsed = sw.elapsedTime(); - - if (!oneSessionOnly || cConnection == null) { - cConnection = DriverManager.getConnection(url, user, - password); - } - - print("Opened DB in " - + (double) (sw.elapsedTime() - elapsed) / 1000 - + " s"); - testScript(cConnection, absolute + File.separator + fname); - - if (!oneSessionOnly) { - cConnection.close(); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - print("TestUtil init error: " + e.toString()); - } - } - - public static void testScript(Connection aConnection, String aPath) { - - /* - * This is a legacy wrapper method which purposefully inherits the sins - * of the original. - * No indication is given to the invoker of even RuntimeExceptions. - */ - File file = new File(aPath); - - try { - TestUtil.testScript(aConnection, file.getAbsolutePath(), - new FileReader(file)); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("test script file error: " + e.toString()); - } - } - - /** - * Runs a preformatted script.

    - * - * Where a result set is required, each line in the script will - * be interpreted as a seperate expected row in the ResultSet - * returned by the query. Within each row, fields should be delimited - * using either comma (the default), or a user defined delimiter - * which should be specified in the System property TestUtilFieldDelimiter - * @param aConnection Connection object for the database - * @param sourceName Identifies the script which failed - * @param inReader Source of commands to be tested - */ - public static void testScript(Connection aConnection, String sourceName, - Reader inReader) - throws SQLException, IOException { - - Statement statement = aConnection.createStatement(); - LineNumberReader reader = new LineNumberReader(inReader); - LineGroupReader sqlReader = new LineGroupReader(reader); - int startLine = 0; - - System.out.println("Opened test script file: " + sourceName); - - /* - * we read the lines from the start of one section of the script "/*" - * until the start of the next section, collecting the lines in the - * list. - * When a new section starts, we pass the list of lines - * to the test method to be processed. - */ - try { - while (true) { - HsqlArrayList section = sqlReader.getNextSection(); - - startLine = sqlReader.getStartLineNumber(); - - if (section.size() == 0) { - break; - } - - testSection(statement, section, sourceName, startLine); - } - - statement.close(); - - // The following catch blocks are just to report the source location - // of the failure. - } catch (SQLException se) { - System.out.println("Error encountered at command beginning at " - + sourceName + ':' + startLine); - - throw se; - } catch (RuntimeException re) { - System.out.println("Error encountered at command beginning at " - + sourceName + ':' + startLine); - - throw re; - } - - System.out.println("Processed " + reader.getLineNumber() - + " lines from " + sourceName); - } - - /** Legacy wrapper */ - static void test(Statement stat, String s, int line) { - TestUtil.test(stat, s, null, line); - } - - /** - * Performs a preformatted statement or group of statements and throws - * if the result does not match the expected one. - * @param line start line in the script file for this test - * @param stat Statement object used to access the database - * @param sourceName Identifies the script which failed - * @param s Contains the type, expected result and SQL for the test - */ - static void test(Statement stat, String s, String sourceName, int line) { - - //maintain the interface for this method - HsqlArrayList section = new HsqlArrayList(new String[8], 0); - - section.add(s); - testSection(stat, section, sourceName, line); - } - - /** - * Method to save typing ;-) - * This method does not distinguish between normal and error output. - * - * @param s String to be printed - */ - static void print(String s) { - System.out.println(s); - } - - /** - * Takes a discrete section of the test script, contained in the - * section vector, splits this into the expected result(s) and - * submits the statement to the database, comparing the results - * returned with the expected results. - * If the actual result differs from that expected, or an - * exception is thrown, then the appropriate message is printed. - * @param stat Statement object used to access the database - * @param section Vector of script lines containing a discrete - * section of script (i.e. test type, expected results, - * SQL for the statement). - * @param line line of the script file where this section started - */ - private static void testSection(Statement stat, HsqlArrayList section, - String scriptName, int line) { - - //create an appropriate instance of ParsedSection - ParsedSection pSection = parsedSectionFactory(section); - - if (pSection == null) { //it was not possible to sucessfully parse the section - System.out.println( - "The section starting at " + scriptName + ':' + line - + " could not be parsed, and so was not processed." + LS); - - return; - } - - if (pSection instanceof IgnoreParsedSection) { - System.out.println("At " + scriptName + ':' + line + ": " - + pSection.getResultString()); - - return; - } - - if (pSection instanceof DisplaySection - || pSection instanceof WaitSection - || pSection instanceof ProceedSection) { - String resultString = pSection.getResultString(); - - if (resultString != null) { - - // May or may not want to report line number for these sections? - System.out.println(resultString); - } - } - - if (pSection instanceof DisplaySection) { - return; // Do not run test method for DisplaySections. - } - - boolean testResult = pSection.test(stat); - - if (pSection instanceof ResultSetOutputParsedSection) { - if (!pSection.getActualResultString().isEmpty()) { - System.out.println("Section starting at " + scriptName + ':' - + line + " displayed a result: " - + pSection.getTestResultString()); - - return; - } - } - - if (!testResult) { - System.out.println("Section starting at " + scriptName + ':' - + line + " returned an unexpected result: " - + pSection.getTestResultString()); - - if (TestUtil.abortOnErr) { - throw new TestRuntimeException(scriptName + ": " + line - + "pSection"); - } - } - } - - /** - * Factory method to create appropriate parsed section class for the section - * @param sectionLines Vector containing the section of script - * @return a ParesedSection object - */ - private static ParsedSection parsedSectionFactory( - HsqlArrayList sectionLines) { - - //type of the section - char type = ' '; - - //read the first line of the Vector... - String topLine = (String) sectionLines.get(0); - - //...and check it for the type... - if (topLine.startsWith("/*")) { - type = topLine.charAt(2); - - //if the type code is UPPERCASE and system property IgnoreCodeCase - //has been set to true, make the type code lowercase - if ((Character.isUpperCase(type)) - && (Boolean.getBoolean("IgnoreCodeCase"))) { - type = Character.toLowerCase(type); - } - - //if the type code is invalid return null - if (!ParsedSection.isValidCode(type)) { - return null; - } - } - - //then pass this to the constructor for the ParsedSection class that - //corresponds to the value of type - switch (type) { - - case 'u' : { - ParsedSection section = new UpdateParsedSection(sectionLines); - - if (TestUtil.oneSessionOnly) { - if (section.getSql().toUpperCase().contains("SHUTDOWN")) { - section = new IgnoreParsedSection(sectionLines, type); - } - } - - return section; - } - case 's' : - return new SilentParsedSection(sectionLines); - - case 'w' : - return new WaitSection(sectionLines); - - case 'p' : - return new ProceedSection(sectionLines); - - case 'r' : - return new ResultSetParsedSection(sectionLines); - - case 'o' : - return new ResultSetOutputParsedSection(sectionLines); - - case 'c' : - return new CountParsedSection(sectionLines); - - case 'd' : - return new DisplaySection(sectionLines); - - case 'e' : - return new ExceptionParsedSection(sectionLines); - - case ' ' : { - ParsedSection section = new BlankParsedSection(sectionLines); - - if (TestUtil.oneSessionOnly) { - if (section.getSql().toUpperCase().contains("SHUTDOWN")) { - section = new IgnoreParsedSection(sectionLines, type); - } - } - - return section; - } - default : - - //if we arrive here, then we should have a valid code, - //since we validated it earlier, so return an - //IgnoreParsedSection object - return new IgnoreParsedSection(sectionLines, type); - } - } - - /** - * This method should certainly be an instance method. - * - * Can't do that until make this entire class OO. - */ - public static void setAbortOnErr(boolean aoe) { - abortOnErr = aoe; - } - - static class TestRuntimeException extends RuntimeException { - - public TestRuntimeException(String s) { - super(s); - } - - public TestRuntimeException(Throwable t) { - super(t); - } - - public TestRuntimeException(String s, Throwable t) { - super(s, t); - } - } -} - -/** - * Abstract inner class representing a parsed section of script. - * The specific ParsedSections for each type of test should inherit from this. - */ -abstract class ParsedSection { - - static final String LS = System.getProperty("line.separator", "\n"); - - /** - * Type of this test. - * @see #isValidCode(char) for allowed values - */ - protected char type = ' '; - - /** error message for this section */ - String message = null; - - /** contents of the section as an array of Strings, one for each line in the section. */ - protected String[] lines = null; - - /** number of the last row containing results in sectionLines */ - protected int resEndRow = 0; - - /** SQL query to be submitted to the database. */ - protected String sqlString = null; - - /** - * Constructor when the section's input lines do not need to be parsed - * into SQL. - */ - protected ParsedSection() {} - - /** - * Common constructor functions for this family. - * @param linesArray Array of the script lines containing the section of script. - * database - */ - protected ParsedSection(HsqlArrayList linesArray) { - - //read the lines array backwards to get out the SQL String - //using a StringBuilder for efficency until we've got the whole String - StringBuilder sqlBuff = new StringBuilder(); - int endIndex = 0; - int k; - String s = (String) linesArray.get(0); - - if (s.startsWith("/*")) { - - //if, after stripping out the declaration from topLine, the length of topLine - //is greater than 0, then keep the rest of the line, as the first row. - //Otherwise it will be discarded, and the offset (between the array and the vector) - //set to 1. - if (s.length() == 3) { - lines = new String[linesArray.size() - 1]; - - linesArray.toArraySlice(lines, 1, linesArray.size()); - } else { - lines = new String[linesArray.size()]; - - linesArray.toArray(lines); - - lines[0] = lines[0].substring(3); - } - - k = lines.length - 1; - - do { - - //check to see if the row contains the end of the result set - if ((endIndex = lines[k].indexOf("*/")) != -1) { - - //then this is the end of the result set - sqlBuff.insert(0, lines[k].substring(endIndex + 2)); - - lines[k] = lines[k].substring(0, endIndex); - - if (lines[k].length() == 0) { - resEndRow = k - 1; - } else { - resEndRow = k; - } - - break; - } else { - sqlBuff.insert(0, lines[k]); - } - - k--; - } while (k >= 0); - } else { - lines = new String[linesArray.size()]; - - linesArray.toArray(lines); - - for (k = 0; k < lines.length; k++) { - sqlBuff.append(lines[k]); - sqlBuff.append(LS); - } - } - - //set sqlString value - sqlString = sqlBuff.toString(); - } - - /** - * String representation of this ParsedSection - * @return String representation of this ParsedSection - */ - protected String getTestResultString() { - - StringBuilder b = new StringBuilder(); - - b.append(LS + "******" + LS); - b.append("Type: "); - b.append(getType()).append(LS); - b.append("SQL: ").append(getSql()).append(LS); - b.append("expected results:").append(LS); - b.append(getResultString()).append(LS); - - //check to see if the message field has been populated - if (getMessage() != null) { - b.append(LS + "message:").append(LS); - b.append(getMessage()).append(LS); - } - - b.append("actual results:").append(LS); - b.append(getActualResultString()); - b.append(LS + "******" + LS); - - return b.toString(); - } - - /** - * returns a String representation of the expected result for the test - * @return The expected result(s) for the test - */ - protected abstract String getResultString(); - - /** - * returns a String representation of the actual result for the test - * @return The expected result(s) for the test - */ - protected String getActualResultString() { - return ""; - } - - /** - * returns the error message for the section - * - * @return message - */ - protected String getMessage() { - return message; - } - - /** - * returns the type of this section - * @return type of this section - */ - protected char getType() { - return type; - } - - /** - * returns the SQL statement for this section - * @return SQL statement for this section - */ - protected String getSql() { - return sqlString; - } - - /** - * performs the test contained in the section against the database. - * @param aStatement Statement object - * @return true if the result(s) are as expected, otherwise false - */ - protected boolean test(Statement aStatement) { - - try { - String sql = getSql(); - - aStatement.execute(sql); - } catch (Exception x) { - message = x.toString(); - - return false; - } - - return true; - } - - /** - * Checks that the type code letter is valid - * @param aCode Lower-cased type code to validate. - * @return true if the type code is valid, otherwise false. - */ - protected static boolean isValidCode(char aCode) { - - /* Allowed values for test codes are: - * (note that UPPERCASE codes, while valid are only processed if the - * system property IgnoreCodeCase has been set to true) - * - * ' ' - not a test - * 'd' - display this line verbatim - * 'o' - dump result set - * 'e' - exception - * 's' - silent - * 'c' - count number of lines in result set - * 'r' - result set - * 'u' - update count - * 'w' - wait - * 'p' - proceed - */ - switch (aCode) { - - case ' ' : - case 'd' : - case 'o' : - case 'e' : - case 's' : - case 'c' : - case 'r' : - case 'u' : - case 'w' : - case 'p' : - return true; - } - - return false; - } - - String[] resultSetToArray(ResultSet results) throws SQLException { - - HsqlArrayList list = new HsqlArrayList(); - StringBuilder printVal = new StringBuilder(); - - while (results.next()) { - for (int j = 0; j < results.getMetaData().getColumnCount(); j++) { - if (j != 0) { - printVal.append(','); - } - - printVal.append(results.getString(j + 1)); - } - - printVal.append(LS); - list.add(printVal.toString()); - printVal.setLength(0); - } - - String[] array = new String[list.size()]; - - list.toArray(array); - - return array; - } -} - -/** Represents a ParsedSection for a ResultSet test */ -class ResultSetParsedSection extends ParsedSection { - - private String delim = System.getProperty("TestUtilFieldDelimiter", ","); - private String[] expectedRows = null; - private String[] actualRows = null; - - /** - * constructs a new instance of ResultSetParsedSection, interpreting - * the supplied results as one or more lines of delimited field values - */ - protected ResultSetParsedSection(HsqlArrayList linesArray) { - - super(linesArray); - - type = 'r'; - - //now we'll populate the expectedResults array - expectedRows = new String[(resEndRow + 1)]; - - for (int i = 0; i <= resEndRow; i++) { - int skip = StringUtil.skipSpaces(lines[i], 0); - - expectedRows[i] = lines[i].substring(skip); - } - } - - protected String getResultString() { - - StringBuilder printVal = new StringBuilder(); - - for (int i = 0; i < expectedRows.length; i++) { - printVal.append(expectedRows[i]).append(LS); - } - - return printVal.toString(); - } - - protected String getActualResultString() { - - StringBuilder printVal = new StringBuilder(); - - if (actualRows == null) { - return "no result"; - } - - for (int i = 0; i < actualRows.length; i++) { - printVal.append(actualRows[i]).append(LS); - } - - return printVal.toString(); - } - - protected boolean test(Statement aStatement) { - - ResultSet results = null; - - try { - try { - - //execute the SQL - aStatement.execute(getSql()); - } catch (SQLException s) { - throw new Exception("Expected a ResultSet, but got the error: " - + s.getMessage()); - } - - //check that update count != -1 - if (aStatement.getUpdateCount() != -1) { - throw new Exception( - "Expected a ResultSet, but got an update count of " - + aStatement.getUpdateCount()); - } - - //iterate over the ResultSet - HsqlArrayList list = new HsqlArrayList(new String[1][], 0); - results = aStatement.getResultSet(); - int colCount = results.getMetaData().getColumnCount(); - - while (results.next()) { - String[] row = new String[colCount]; - - for (int i = 0; i < colCount; i++) { - row[i] = results.getString(i + 1); - } - - list.add(row); - } - - actualRows = new String[list.size()]; - - for (int i = 0; i < list.size(); i++) { - String[] row = (String[]) list.get(i); - StringBuilder sb = new StringBuilder(); - - for (int j = 0; j < row.length; j++) { - if (j > 0) { - sb.append(','); - } - - sb.append(row[j]); - } - - actualRows[i] = sb.toString(); - } - - int count = 0; - - for (; count < list.size(); count++) { - if (count < expectedRows.length) { - String[] expectedFields = - StringUtil.split(expectedRows[count], delim); - - // handle ARRAY[val,val, val] commas - for (int i = 0; i < expectedFields.length; i++) { - if (expectedFields[i] == null) { - expectedFields = (String[]) ArrayUtil.resizeArray( - expectedFields, i); - - break; - } - - if (expectedFields[i].startsWith("ARRAY[")) { - if (expectedFields[i].endsWith("]")) { - continue; - } - - for (int j = i + 1; j < expectedFields.length; - j++) { - String part = expectedFields[j]; - - expectedFields[i] += delim + part; - - if (part.endsWith("]")) { - ArrayUtil.adjustArray( - ArrayUtil.CLASS_CODE_OBJECT, - expectedFields, expectedFields.length, - i + 1, i - j); - - break; - } - } - } - } - - //check that we have the number of columns expected... - if (colCount == expectedFields.length) { - - //...and if so, check that the column values are as expected... - int j = 0; - - for (int i = 0; i < expectedFields.length; i++) { - j = i + 1; - - String actual = ((String[]) list.get(count))[i]; - - //...including null values... - if (actual == null) { //..then we have a null - - //...check to see if we were expecting it... - if (!expectedFields[i].equalsIgnoreCase( - "NULL")) { - message = "Expected row " + (count + 1) - + " of the ResultSet to contain:" - + LS + expectedRows[count] + LS - + "but field " + j - + " contained NULL"; - - break; - } - } else if (!actual.equals(expectedFields[i])) { - String actualS = actual; - - if (results.getMetaData().getColumnClassName( - j).equals("java.lang.String")) { - actualS = - StringConverter.toQuotedString(actualS, - '\'', - true); - } - - //then the results are different - message = "Expected row " + (count + 1) - + " of the ResultSet to contain:" - + LS + expectedRows[count] + LS - + "but field " + j + " contained " - + actualS; - - break; - } - } - } else { - - //we have the wrong number of columns - message = "Expected the ResultSet to contain " - + expectedFields.length - + " fields, but it contained " + colCount - + " fields."; - } - } - - if (message != null) { - break; - } - } - - //check that we got as many rows as expected - if (count != expectedRows.length) { - if (message == null) { - - //we don't have the expected number of rows - message = "Expected the ResultSet to contain " - + expectedRows.length - + " rows, but it contained " + count + " rows."; - } - } - } catch (Exception x) { - message = x.toString(); - - return false; - } finally { - if (results != null) { - try { - results.close(); - } catch (SQLException e) {} - } - } - - return message == null; - } -} - -/** Represents a ParsedSection for a ResultSet dump */ -class ResultSetOutputParsedSection extends ParsedSection { - - private String delim = System.getProperty("TestUtilFieldDelimiter", ","); - private String[] actualRows = new String[]{}; - - /** - * constructs a new instance of ResultSetParsedSection, interpreting - * the supplied results as one or more lines of delimited field values - */ - protected ResultSetOutputParsedSection(HsqlArrayList linesArray) { - - super(linesArray); - - type = 'o'; - } - - protected String getResultString() { - return ""; - } - - protected String getActualResultString() { - - StringBuilder result = new StringBuilder(); - - for (int i = 0; i < actualRows.length; i++) { - result.append(actualRows[i]); - } - - return result.toString(); - } - - protected boolean test(Statement aStatement) { - - try { - try { - - //execute the SQL - aStatement.execute(getSql()); - } catch (SQLException s) { - throw new Exception("Expected a ResultSet, but got the error: " - + s.getMessage()); - } - - //check that update count != -1 - if (aStatement.getUpdateCount() != -1) { - throw new Exception( - "Expected a ResultSet, but got an update count of " - + aStatement.getUpdateCount()); - } - - //iterate over the ResultSet - ResultSet results = aStatement.getResultSet(); - - actualRows = this.resultSetToArray(results); - - return true; - } catch (Exception x) { - message = x.toString(); - - return false; - } - } - - protected String getTestResultString() { - - StringBuilder b = new StringBuilder(); - - b.append(LS + "******" + LS); - b.append("Type: "); - b.append(getType()).append(LS); - b.append("SQL: ").append(getSql()).append(LS); - - if (message != null) { - b.append("expected results:").append(LS); - b.append(getResultString()).append(LS); - - //check to see if the message field has been populated - if (getMessage() != null) { - b.append(LS + "message:").append(LS); - b.append(getMessage()).append(LS); - } - } - - b.append("actual results:").append(LS); - b.append(getActualResultString()); - b.append(LS + "******" + LS); - - return b.toString(); - } -} - -/** Represents a ParsedSection for an update test */ -class UpdateParsedSection extends ParsedSection { - - //expected update count - int countWeWant; - - protected UpdateParsedSection(HsqlArrayList linesArray) { - - super(linesArray); - - type = 'u'; - countWeWant = Integer.parseInt(lines[0]); - } - - protected String getResultString() { - return Integer.toString(getCountWeWant()); - } - - private int getCountWeWant() { - return countWeWant; - } - - protected boolean test(Statement aStatement) { - - try { - try { - - //execute the SQL - aStatement.execute(getSql()); - } catch (SQLException s) { - throw new Exception("Expected an update count of " - + getCountWeWant() - + ", but got the error: " - + s.getMessage()); - } - - if (aStatement.getUpdateCount() != getCountWeWant()) { - throw new Exception("Expected an update count of " - + getCountWeWant() - + ", but got an update count of " - + aStatement.getUpdateCount() + "."); - } - } catch (Exception x) { - message = x.toString(); - - return false; - } - - return true; - } -} - -class WaitSection extends ParsedSection { - - /* Would love to have a setting to say whether multi-thread mode, - * but the static design of TestUtil prevents that. - * a W command will cause a non-threaded execution to wait forever. - */ - static private String W_SYNTAX_MSG = - "Syntax of Wait commands:" + LS - + " /*w 123*/ To Wait 123 milliseconds" + LS - + " /*w false x*/ Wait until /*p*/ command in another script has executed" - + LS - + " /*w true x*/ Same, but the /*p*/ must not have executed yet"; - -/** Represents a ParsedSection for wait execution */ - long sleepTime = -1; - Waiter waiter = null; - boolean enforceSequence = false; - - protected WaitSection(HsqlArrayList linesArray) { - - /* Can't user the super constructor, since it does funny things when - * constructing the SQL Buffer, which we don't need. */ - lines = new String[linesArray.size()]; - - linesArray.toArray(lines); - - int closeCmd = lines[0].indexOf("*/"); - String cmd = lines[0].substring(0, closeCmd); - - lines[0] = lines[0].substring(closeCmd + 2).trim(); - - String trimmed = cmd.trim(); - - if (trimmed.indexOf('e') < 0 && trimmed.indexOf('E') < 0) { - - // Does not contain "true" or "false" - sleepTime = Long.parseLong(trimmed); - } else { - try { - - // Would like to use String.split(), but don't know if Java 4 - // is allowed here. - // Until we can use Java 4, prohibit tabs as white space. - int index = trimmed.indexOf(' '); - - if (index < 0) { - throw new IllegalArgumentException(); - } - - enforceSequence = Boolean.valueOf(trimmed.substring(0, - index)).booleanValue(); - waiter = Waiter.getWaiter(trimmed.substring(index).trim()); - } catch (IllegalArgumentException ie) { - throw new IllegalArgumentException(W_SYNTAX_MSG); - } - } - - type = 'w'; - } - - protected String getResultString() { - - StringBuilder sb = new StringBuilder(); - - if (lines.length == 1 && lines[0].trim().length() < 1) { - return null; - } - - for (int i = 0; i < lines.length; i++) { - if (i > 0) { - sb.append(LS); - } - - sb.append("+ " + lines[i]); - } - - TestUtil.expandStamps(sb); - - return sb.toString().trim(); - } - - protected boolean test(Statement aStatement) { - - if (waiter == null) { - try { - - //System.err.println("Sleeping for " + sleepTime + " ms."); - Thread.sleep(sleepTime); - } catch (InterruptedException ie) { - throw new RuntimeException("Test sleep interrupted", ie); - } - } else { - waiter.waitFor(enforceSequence); - } - - return true; - } -} - -class ProceedSection extends ParsedSection { - - /* See comment above for WaitSection */ - static private String P_SYNTAX_MSG = - "Syntax of Proceed commands:" + LS - + " /*p false x*/ /*p*/ command in another script may Proceed" + LS - + " /*p true x*/ Same, but the /*w*/ must be waiting when we execute /*p*/" - ; - -/** Represents a ParsedSection for wait execution */ - Waiter waiter = null; - boolean enforceSequence = false; - - protected ProceedSection(HsqlArrayList linesArray) { - - /* Can't use the super constructor, since it does funny things when - * constructing the SQL Buffer, which we don't need. */ - lines = new String[linesArray.size()]; - - linesArray.toArray(lines); - - int closeCmd = lines[0].indexOf("*/"); - String cmd = lines[0].substring(0, closeCmd); - - lines[0] = lines[0].substring(closeCmd + 2).trim(); - - String trimmed = cmd.trim(); - - try { - - // Would like to use String.split(), but don't know if Java 4 - // is allowed here. - // Until we can use Java 4, prohibit tabs as white space. - int index = trimmed.indexOf(' '); - - if (index < 0) { - throw new IllegalArgumentException(); - } - - enforceSequence = Boolean.valueOf(trimmed.substring(0, - index)).booleanValue(); - waiter = Waiter.getWaiter(trimmed.substring(index).trim()); - } catch (IllegalArgumentException ie) { - throw new IllegalArgumentException(P_SYNTAX_MSG); - } - - type = 'p'; - } - - protected String getResultString() { - - StringBuilder sb = new StringBuilder(); - - if (lines.length == 1 && lines[0].trim().length() < 1) { - return ""; - } - - for (int i = 0; i < lines.length; i++) { - if (i > 0) { - sb.append(LS); - } - - sb.append("+ " + lines[i]); - } - - TestUtil.expandStamps(sb); - - return sb.toString().trim(); - } - - protected boolean test(Statement aStatement) { - - waiter.resume(enforceSequence); - - return true; - } -} - -/** Represents a ParsedSection for silent execution */ -class SilentParsedSection extends ParsedSection { - - protected SilentParsedSection(HsqlArrayList linesArray) { - - super(linesArray); - - type = 's'; - } - - protected String getResultString() { - return ""; - } - - protected boolean test(Statement aStatement) { - - try { - aStatement.execute(getSql()); - } catch (Exception x) {} - - return true; - } -} - -/** Represents a ParsedSection for a count test */ -class CountParsedSection extends ParsedSection { - - //expected row count - private int countWeWant; - - protected CountParsedSection(HsqlArrayList linesArray) { - - super(linesArray); - - type = 'c'; - countWeWant = Integer.parseInt(lines[0]); - } - - protected String getResultString() { - return Integer.toString(getCountWeWant()); - } - - private int getCountWeWant() { - return countWeWant; - } - - protected boolean test(Statement aStatement) { - - try { - - //execute the SQL - try { - aStatement.execute(getSql()); - } catch (SQLException s) { - throw new Exception("Expected a ResultSet containing " - + getCountWeWant() - + " rows, but got the error: " - + s.getMessage()); - } - - //check that update count != -1 - if (aStatement.getUpdateCount() != -1) { - throw new Exception( - "Expected a ResultSet, but got an update count of " - + aStatement.getUpdateCount()); - } - - //iterate over the ResultSet - ResultSet results = aStatement.getResultSet(); - int count = 0; - - while (results.next()) { - count++; - } - - //check that we got as many rows as expected - if (count != getCountWeWant()) { - - //we don't have the expected number of rows - throw new Exception("Expected the ResultSet to contain " - + getCountWeWant() - + " rows, but it contained " + count - + " rows."); - } - } catch (Exception x) { - message = x.toString(); - - return false; - } - - return true; - } -} - -/** Represents a ParsedSection for an Exception test */ -class ExceptionParsedSection extends ParsedSection { - - private String expectedState = null; - private Throwable caught = null; - - protected ExceptionParsedSection(HsqlArrayList linesArray) { - - super(linesArray); - - expectedState = lines[0].trim(); - - if (expectedState.length() < 1) { - expectedState = null; - } - - type = 'e'; - } - - protected String getResultString() { - return (caught == null) ? "Nothing thrown" - : caught.toString(); - } - - protected boolean test(Statement aStatement) { - - try { - aStatement.execute(getSql()); - } catch (SQLException sqlX) { - caught = sqlX; - - if (expectedState == null - || expectedState.equalsIgnoreCase(sqlX.getSQLState())) { - return true; - } - - message = "SQLState '" + sqlX.getSQLState() + "' : " - + sqlX.toString() + " instead of '" + expectedState - + "'"; - } catch (Exception x) { - caught = x; - message = x.toString(); - } - - return false; - } -} - -/** Represents a ParsedSection for a section with blank type */ -class BlankParsedSection extends ParsedSection { - - protected BlankParsedSection(HsqlArrayList linesArray) { - - super(linesArray); - - type = ' '; - } - - protected String getResultString() { - return ""; - } -} - -/** Represents a ParsedSection that is to be ignored */ -class IgnoreParsedSection extends ParsedSection { - - protected IgnoreParsedSection(HsqlArrayList sectionLines, char aType) { - - /* Extremely ambiguous to use input parameter of same exact - * variable name as the superclass member "lines". - * Therefore, renaming to inLines. */ - - // Inefficient to parse this into SQL when we aren't going to use - // it as SQL. Should probably just be removed to use the - // super() constructor. - super(sectionLines); - - type = aType; - } - - protected String getResultString() { - return "This section, of type '" + getType() + "' was ignored"; - } -} - -/** Represents a Section to be Displayed, not executed */ -class DisplaySection extends ParsedSection { - - protected DisplaySection(HsqlArrayList sectionLines) { - - /* Can't user the super constructor, since it does funny things when - * constructing the SQL Buffer, which we don't need. */ - lines = new String[sectionLines.size()]; - - sectionLines.toArray(lines); - - int firstSlash = lines[0].indexOf('/'); - - lines[0] = lines[0].substring(firstSlash + 1).trim(); - } - - protected String getResultString() { - - StringBuilder sb = new StringBuilder(); - - if (lines.length == 1 && lines[0].trim().length() < 1) { - return null; - } - - for (int i = 0; i < lines.length; i++) { - if (i > 0) { - sb.append(LS); - } - - sb.append("+ " + lines[i]); - } - - TestUtil.expandStamps(sb); - - return sb.toString().trim(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TestViewAsterisks.java b/database/hsqldb/src/org/hsqldb/test/TestViewAsterisks.java deleted file mode 100644 index 589e5a57..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TestViewAsterisks.java +++ /dev/null @@ -1,591 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; - -import org.hsqldb.error.ErrorCode; - -import junit.framework.AssertionFailedError; - -/** - * is a test which verifies the functionality of replacing asterisks in VIEW statements with column - * lists. - * - * During investigating http://www.openoffice.org/issues/show_bug.cgi?id=78296 (an issue raised - * in OpenOffice.org, which integrates HSQLDB), it rose that views did not behave to the standard - * in that they don't always reflect the table column list at the time of creation of the view. - * - * This was changed so that when you CREATE a VIEW, then any asterisks in the constituting - * statement are replaced with their column lists. - * - * This test verifies this functionality in a number of different flavours. - * - * @author frank.schoenheit@sun.com - */ -public class TestViewAsterisks extends TestBase { - - java.sql.Statement m_statement; - java.sql.Connection m_connection; - - /** Creates a new instance of TestViewAsterisks */ - public TestViewAsterisks(String testName) { - super(testName); - } - - /** - * creates the database tables needed for the test - */ - private void setupDatabase() { - - try { - m_connection = newConnection(); - m_statement = m_connection.createStatement(); - - executeStatement("DROP TABLE ABC IF EXISTS CASCADE"); - executeStatement("DROP TABLE TABLE_A IF EXISTS CASCADE"); - executeStatement("DROP TABLE TABLE_B IF EXISTS CASCADE"); - executeStatement("DROP VIEW V1 IF EXISTS CASCADE"); // V1 is created by a previous test case - executeStatement( - "CREATE TABLE ABC (ID INTEGER NOT NULL PRIMARY KEY, A VARCHAR(50), B VARCHAR(50), C VARCHAR(50))"); - executeStatement("INSERT INTO ABC VALUES (1, 'a', 'b', 'c')"); - executeStatement("INSERT INTO ABC VALUES (2, 'd', 'e', 'f')"); - executeStatement( - "CREATE TABLE TABLE_A (ID_A INTEGER NOT NULL PRIMARY KEY, NAME_A VARCHAR(50))"); - executeStatement("INSERT INTO TABLE_A VALUES (1, 'first A')"); - executeStatement("INSERT INTO TABLE_A VALUES (2, 'second A')"); - executeStatement( - "CREATE TABLE TABLE_B (ID_B INTEGER NOT NULL PRIMARY KEY, NAME_B VARCHAR(50))"); - executeStatement("INSERT INTO TABLE_B VALUES (1, 'first B')"); - executeStatement("INSERT INTO TABLE_B VALUES (2, 'second B')"); - } catch (SQLException ex) { - fail(ex.toString()); - } - } - - public void setUp() throws Exception { - super.setUp(); - setupDatabase(); - } - - protected void tearDown() { - executeStatement("SHUTDOWN"); - super.tearDown(); - } - - /** - * executes a given m_statement - * - *

    Basically, this method calls m_statement.execute(sql), - * but wraps any SQLExceptions into a JUnit error. - */ - private void executeStatement(String sql) { - executeStatement(sql, 0); - } - - private void executeStatement(String sql, int expectedVendorCode) { - - try { - m_statement.execute(sql); - assertTrue( - "executing\n " + sql - + "\nwas expected to fail, but it didn't", expectedVendorCode - == 0); - } catch (SQLException ex) { - if (expectedVendorCode == 0) { - fail(ex.toString()); - } - - assertEquals( - "executing\n " + sql - + "\ndid not result in the expected error", expectedVendorCode, -ex - .getErrorCode()); - } - } - - /** - * creates a view with the given name, the given constituting statement, and an optional column list - * - * @param viewName - * specifies the name of the view to create - * @param columnList - * list of names of the columns of the view, will be specified in the CREATE VIEW statement. Might be null. - * @param viewStatement - * the statement of the view - */ - private void createView(String viewName, String[] columnList, - String viewStatement) throws SQLException { - - StringBuilder colList = new StringBuilder(); - - if (columnList != null) { - colList.append(" ("); - - for (int i = 0; i < columnList.length; ++i) { - colList.append('"').append(columnList[i]).append('"'); - - if (i < columnList.length - 1) { - colList.append(','); - } - } - - colList.append(")"); - } - - executeStatement("CREATE VIEW " + viewName + colList.toString() - + " AS " + viewStatement); - - if (columnList != null) { - ensureTableColumns(viewName, columnList); - } - } - - /** - * retrieves the statement which defines a given view - */ - private String getViewStatement(String viewName) throws SQLException { - - ResultSet res = m_statement.executeQuery( - "SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = '" - + viewName + "'"); - - res.next(); - - String statement = res.getString(1); - - return statement; - } - - /** - * ensures two tables (or views, that is) have the same content - */ - private void ensureEqualContent(String tableNameLHS, - String tableNameRHS) throws SQLException { - - ResultSet lhs = m_statement.executeQuery("SELECT * FROM \"" - + tableNameLHS + "\""); - ResultSet rhs = m_statement.executeQuery("SELECT * FROM \"" - + tableNameRHS + "\""); - ResultSetMetaData meta = lhs.getMetaData(); - - while (lhs.next() && rhs.next()) { - for (int col = 1; col <= meta.getColumnCount(); ++col) { - assertEquals("table content does not match: cp. " - + tableNameLHS + "-" + tableNameRHS + ", row " - + lhs.getRow() + ", col " - + col, lhs.getObject(col), rhs.getObject(col)); - } - } - - // lhs should be after last, rhs still on last - assertTrue("row count does not match: " + tableNameLHS + "-" - + tableNameRHS, lhs.isAfterLast() && rhs.isLast()); - } - - /** - * ensures the content of a given table matches a given object array's content - */ - private void ensureTableContent(String tableName, - Object[][] tableData) throws SQLException { - - ResultSet lhs = m_statement.executeQuery("SELECT * FROM \"" - + tableName + "\""); - ResultSetMetaData meta = lhs.getMetaData(); - int colCount = meta.getColumnCount(); - - while (lhs.next()) { - int row = lhs.getRow(); - - assertEquals(colCount, tableData[row - 1].length); - - for (int col = 1; col <= colCount; ++col) { - assertEquals( - "unexpected table content in " + tableName + " (row " - + row + ", col " + col + ")", tableData[row - 1][col - 1], - lhs.getObject(col)); - } - } - } - - /** - * creates a view with a given name and statement, ensures that it's statement is translated as expected, and ensures - * that the content of the view is as expected - * - * @param viewName - * the name of the to-be-created view - * @param columnList - * the names of the columns of the view, as to be specified in the CREATE VIEW statement. Might be null, - * in this case the view will be created without an explicit column list - * @param viewStatement - * the statement of the to-be-created view - * @param expectedTranslatedStatement - * the expected statement of the view, after it has been implicitly translated by HSQL. If the actual - * statement after creation does not match this expected statement, this is a failure condition which - * results in a AssertionFailedError being thrown. - * @param expectedContent - * the expected content of the view. If this is null, it is ignored. Else, if it is a - * string, it is interpreted as name of the table which must have the same content as a view. If - * it's no string either, it must be a two-dimensional Object array specifying the expected content. - */ - private void checkViewTranslationAndContent(String viewName, - String[] columnList, String viewStatement, - String expectedTranslatedStatement, - Object expectedContent) throws SQLException { - - createView(viewName, columnList, viewStatement); - - String actualTranslatedStatement = getViewStatement(viewName); - - if (!actualTranslatedStatement.equals(expectedTranslatedStatement)) { - StringBuilder message = new StringBuilder(); - - message.append(viewName).append( - "'s statement not translated as expected\n"); - message.append("original statement:\n ").append( - viewStatement).append('\n'); - message.append("expected translated statement:\n ").append( - expectedTranslatedStatement).append('\n'); - message.append("actual translated statement:\n ").append( - actualTranslatedStatement).append('\n'); - - throw new AssertionFailedError(message.toString()); - } - - if (expectedContent instanceof Object[][]) { - ensureTableContent(viewName, (Object[][]) expectedContent); - } - } - - /** - * ensures that a given table has columns with a given name - */ - private void ensureTableColumns(String tableName, - String[] columnNames) throws SQLException { - - ResultSet res = m_connection.getMetaData().getColumns(null, null, - tableName, "%"); - - while (res.next()) { - assertEquals( - "unexpected column name in table \"" + tableName - + "\" at position " - + (res.getRow() - 1), res.getString( - "COLUMN_NAME"), columnNames[res.getRow() - 1]); - } - - res.previous(); - assertEquals("not enough columns in table \"" + tableName + "\"", - columnNames.length, res.getRow()); - } - - /** - * checks views selecting an asterisk from a table, in different flavours - */ - private void checkSimpleViews() throws SQLException { - - // ................................................................ - // SELECT * - checkViewTranslationAndContent( - "S1", null, "SELECT * FROM ABC", - "SELECT PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC", - "ABC"); - - // adding a column to "ABC" should succeed, and still leave the view with the columns - // before the addition - executeStatement("ALTER TABLE ABC ADD COLUMN D VARCHAR(50)"); - ensureTableColumns("ABC", new String[] { - "ID", "A", "B", "C", "D" - }); - ensureTableColumns("S1", new String[] { - "ID", "A", "B", "C" - }); - - // dropping the column which is not part of the view should be possible - executeStatement("ALTER TABLE ABC DROP COLUMN D"); - - // dropping another column which *is* part of the view shouldn't - executeStatement("ALTER TABLE ABC DROP COLUMN C", ErrorCode.X_42536); - - // finally, dropping the column with CASCADE should work, and also drop the view - //executeStatement("ALTER TABLE ABC DROP COLUMN C CASCADE"); - // DROP COLUMN c CASCADE not implemented, yet - // ................................................................ - // same as S1, but this time add a LIMIT clause to the statement - checkViewTranslationAndContent( - "S2", null, "SELECT LIMIT 0 2 * FROM ABC ORDER BY ID", - "SELECT LIMIT 0 2 PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC ORDER BY ID", - "ABC"); - - // ................................................................ - // same as S1, but this time add a TOP clause to the statement - checkViewTranslationAndContent( - "S3", null, "SELECT TOP 2 * FROM ABC ORDER BY ID", - "SELECT TOP 2 PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC ORDER BY ID", - "ABC"); - - // ................................................................ - // same as S1, but this time add a DISTINCT clause to the statement - checkViewTranslationAndContent( - "S4", null, "SELECT DISTINCT * FROM ABC", - "SELECT DISTINCT PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC", - "ABC"); - - // ................................................................ - // same as S1, but this time qualifying the asterisk - checkViewTranslationAndContent( - "S5", null, "SELECT ABC.* FROM ABC", - "SELECT PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC", - "ABC"); - - // ................................................................ - // same as S5, but this time also giving the table an alias - checkViewTranslationAndContent( - "S6", null, "SELECT \"A\".* FROM ABC AS A", - "SELECT A.ID,A.A,A.B,A.C FROM PUBLIC.ABC AS A", - "ABC"); - - // ................................................................ - // same as S1, but bracket the SELECT definition - checkViewTranslationAndContent( - "S7", null, "( SELECT * FROM ABC )", - "(SELECT PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC)", - "ABC"); - } - - /** - * checks views selecting an asterisk plus existing columns - */ - private void checkAsterisksCombined() throws SQLException { - - // ................................................................ - checkViewTranslationAndContent( - "C1", null, "SELECT * FROM ABC", - "SELECT PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC", - new Object[][] { - new Object[] { - Integer.valueOf(1), "a", "b", "c" - }, new Object[] { - Integer.valueOf(2), "d", "e", "f" - } - }); - - // ................................................................ - checkViewTranslationAndContent( - "C2", null, "SELECT B AS \"b2\", ABC.* FROM ABC", - "SELECT B AS \"b2\", PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC", - new Object[][] { - new Object[] { - "b", Integer.valueOf(1), "a", "b", "c" - }, new Object[] { - "e", Integer.valueOf(2), "d", "e", "f" - } - }); - } - - /** - * checks views selecting asterisks from multiple tables - */ - private void checkMultipleTables() throws SQLException { - - // ................................................................ - checkViewTranslationAndContent( - "M1", null, "SELECT * FROM TABLE_A, TABLE_B", - "SELECT PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A,PUBLIC.TABLE_B.ID_B,PUBLIC.TABLE_B.NAME_B FROM PUBLIC.TABLE_A,PUBLIC.TABLE_B", - new Object[][] { - new Object[] { - Integer.valueOf(1), "first A", Integer.valueOf(1), "first B" - }, new Object[] { - Integer.valueOf(1), "first A", Integer.valueOf(2), "second B" - }, new Object[] { - Integer.valueOf(2), "second A", Integer.valueOf(1), "first B" - }, new Object[] { - Integer.valueOf(2), "second A", Integer.valueOf(2), "second B" - } - }); - - // ................................................................ - checkViewTranslationAndContent( - "M2", null, "SELECT TABLE_B.*, TABLE_A.* FROM TABLE_A, TABLE_B", - "SELECT PUBLIC.TABLE_B.ID_B,PUBLIC.TABLE_B.NAME_B , PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A FROM PUBLIC.TABLE_A,PUBLIC.TABLE_B", - new Object[][] { - new Object[] { - Integer.valueOf(1), "first B", Integer.valueOf(1), "first A" - }, new Object[] { - Integer.valueOf(2), "second B", Integer.valueOf(1), "first A" - }, new Object[] { - Integer.valueOf(1), "first B", Integer.valueOf(2), "second A" - }, new Object[] { - Integer.valueOf(2), "second B", Integer.valueOf(2), "second A" - } - }); - - // ................................................................ - checkViewTranslationAndContent( - "M3", null, "SELECT \"TABLE_A\".* FROM TABLE_A, TABLE_B", - "SELECT PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A FROM PUBLIC.TABLE_A,PUBLIC.TABLE_B", - new Object[][] { - new Object[] { - Integer.valueOf(1), "first A" - }, new Object[] { - Integer.valueOf(1), "first A" - }, new Object[] { - Integer.valueOf(2), "second A" - }, new Object[] { - Integer.valueOf(2), "second A" - } - }); - } - - /** - * checks views selecting from sub selects - */ - private void checkSubSelects() throws SQLException { - - // ................................................................ - checkViewTranslationAndContent( - "Q1", null, "SELECT * FROM ( SELECT * FROM ABC )", - "SELECT ID,A,B,C FROM(SELECT PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC)", - null); - - // ................................................................ - checkViewTranslationAndContent( - "Q2", null, - "SELECT * FROM ( SELECT * FROM TABLE_A ), ( SELECT * FROM TABLE_B )", - "SELECT ID_A,NAME_A,ID_B,NAME_B FROM(SELECT PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A FROM PUBLIC.TABLE_A),(SELECT PUBLIC.TABLE_B.ID_B,PUBLIC.TABLE_B.NAME_B FROM PUBLIC.TABLE_B)", - null); - - // ................................................................ - checkViewTranslationAndContent( - "Q3", null, "SELECT A.* FROM ( SELECT * FROM TABLE_A ) AS A", - "SELECT A.ID_A,A.NAME_A FROM(SELECT PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A FROM PUBLIC.TABLE_A)AS A", - null); - - // ................................................................ - checkViewTranslationAndContent( - "Q4", null, - "SELECT A.*, B.* FROM ( SELECT * FROM TABLE_A ) AS A, ( SELECT * FROM TABLE_B ) AS B", - "SELECT A.ID_A,A.NAME_A , B.ID_B,B.NAME_B FROM(SELECT PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A FROM PUBLIC.TABLE_A)AS A,(SELECT PUBLIC.TABLE_B.ID_B,PUBLIC.TABLE_B.NAME_B FROM PUBLIC.TABLE_B)AS B", - null); - } - - /** - * checks views which are defined using a column list - */ - private void checkColumnLists() throws SQLException { - - // just to ensure the column count handling is as expected, else below tests might be useless - executeStatement("CREATE VIEW IMPOSSIBLE (\"A\") AS SELECT * FROM ABC", - ErrorCode.X_42593); - - // ................................................................ - // not that it should make any difference to S1, but who knows - checkViewTranslationAndContent("L1", new String[] { - "C1", "C2", "C3", "C4" - }, "SELECT * FROM ABC", "SELECT PUBLIC.ABC.ID,PUBLIC.ABC.A,PUBLIC.ABC.B,PUBLIC.ABC.C FROM PUBLIC.ABC", - "ABC"); - } - - /** - * checks views based on other views - */ - private void checkViewsOnViews() throws SQLException { - - // ................................................................ - // not that it should make any difference whether we SELECT FROM a table or view, but who knows - checkViewTranslationAndContent( - "V1", null, "SELECT * FROM S1", - "SELECT PUBLIC.S1.ID,PUBLIC.S1.A,PUBLIC.S1.B,PUBLIC.S1.C FROM PUBLIC.S1", "L1"); - } - - /** - * checks views based on a UNION statement - */ - private void checkUnionViews() throws SQLException { - - checkViewTranslationAndContent( - "U1", null, "SELECT * FROM TABLE_A UNION SELECT * FROM TABLE_B", - "SELECT PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A FROM PUBLIC.TABLE_A UNION SELECT PUBLIC.TABLE_B.ID_B,PUBLIC.TABLE_B.NAME_B FROM PUBLIC.TABLE_B", - new Object[][] { - new Object[] { - Integer.valueOf(1), "first A" - }, new Object[] { - Integer.valueOf(1), "first B" - }, new Object[] { - Integer.valueOf(2), "second A" - }, new Object[] { - Integer.valueOf(2), "second B" - } - }); - checkViewTranslationAndContent( - "U2", null, - "SELECT * FROM ( SELECT * FROM TABLE_A UNION SELECT * FROM TABLE_B )", - "SELECT ID_A,NAME_A FROM(SELECT PUBLIC.TABLE_A.ID_A,PUBLIC.TABLE_A.NAME_A FROM PUBLIC.TABLE_A UNION SELECT PUBLIC.TABLE_B.ID_B,PUBLIC.TABLE_B.NAME_B FROM PUBLIC.TABLE_B)", - new Object[][] { - new Object[] { - Integer.valueOf(1), "first A" - }, new Object[] { - Integer.valueOf(1), "first B" - }, new Object[] { - Integer.valueOf(2), "second A" - }, new Object[] { - Integer.valueOf(2), "second B" - } - }); - } - - /** - * main test method of this class - */ - public void test() { - - try { - checkSimpleViews(); - checkAsterisksCombined(); - checkMultipleTables(); - checkSubSelects(); - checkColumnLists(); - checkViewsOnViews(); - checkUnionViews(); - } catch (SQLException ex) { - fail(ex.toString()); - } - } - - /** - * entry point to run the test directly - */ - public static void main(String[] argv) { - runWithResult(TestViewAsterisks.class, "test"); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/TriggerClass.java b/database/hsqldb/src/org/hsqldb/test/TriggerClass.java deleted file mode 100644 index 36bfac94..00000000 --- a/database/hsqldb/src/org/hsqldb/test/TriggerClass.java +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import org.hsqldb.jdbc.JDBCArrayBasic; -import org.hsqldb.trigger.Trigger; -import org.hsqldb.types.Type; - -public class TriggerClass implements Trigger { - - public static int callCount; - public static int[] callCounts = new int[12]; - - public void fire(int type, String trigName, String tabName, - Object[] oldRow, Object[] newRow) { - callCounts[type]++; - callCount++; - } - - public static java.sql.Array authenticateFalse(String database, String user, String password) { - throw new RuntimeException("bad user"); - } - - public static java.sql.Array authenticate( - String database, String user, String password) { - return new JDBCArrayBasic(new String[] { "DBA" }, Type.SQL_VARCHAR); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/Waiter.java b/database/hsqldb/src/org/hsqldb/test/Waiter.java deleted file mode 100644 index 4e549fd2..00000000 --- a/database/hsqldb/src/org/hsqldb/test/Waiter.java +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test; - -import java.util.Map; -import java.util.HashMap; - -/** - * Single-use synchronization object. - * - * Design would be more scalable if there were a separate collection class, - * instead of the static Waiter.map. The limitation is acceptable since - * there's no use case for running multiple Test Runners simultaneously - * from a single JVM (one Test runner can handle multiple test scripts - * simultaneously or synchronously). - * - * (It would be much work to make the collection non-static, because that - * would require a refactor of TestUtil with proper OOD). - */ -public class Waiter { - /* - static private HashMap map = - new HashMap(); - Java 5 */ - static private Map map = new HashMap(); - private String key; - private boolean notified = false; // resume() method has been called - private boolean waiting = false; // a client is waiting (in waitFor()). - private boolean abort = false; // Make fail if partner failed - - public boolean isNotified() { return notified; } - public boolean isWaiting() { return waiting; } - - private Waiter(String key) { - this.key = key; - map.put(key, this); - } - - /** - * @param enforceSequence Fail if waitFor() called before resume() - */ - public synchronized void waitFor(boolean enforceSequence) { - if (abort) - throw new RuntimeException("Notifier side failed previously"); - if (notified) { - if (enforceSequence) - throw new RuntimeException( - "Request to wait on '" + key - + "', but this object has already been notified"); - return; - } - waiting = true; - try { - wait(); - } catch (InterruptedException ie) { - throw new RuntimeException( - "Unexpected interrupted while waiting for '" - + key + "'", ie); - } finally { - waiting = false; - } - map.remove(this); - if (!notified) - throw new RuntimeException( - "Exiting waitFor() on '" + key - + "' even though not 'notified'"); - } - - /** - * @param enforceSequence Fail if waitFor() called before resume() - */ - public synchronized void resume(boolean enforceSequence) { - if (enforceSequence && !waiting) { - abort = true; - throw new RuntimeException("Requested to resume on '" - + key + " ', but nothing is waiting for it"); - } - notified = true; - notify(); - } - - /** - * It doesn't matter if the waiter or the waitee runs getWaiter() - * first. Whoever requests it first will instantiate it. - * - * @return A Waiter instance. Never returns nul. - */ - public synchronized static Waiter getWaiter(String key) { - Waiter waiter = (Waiter) map.get(key); - if (waiter == null) waiter = new Waiter(key); - return waiter; - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcBase.java b/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcBase.java deleted file mode 100644 index dc8e862d..00000000 --- a/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcBase.java +++ /dev/null @@ -1,251 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test.odbc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; - -import org.hsqldb.persist.HsqlProperties; -import org.hsqldb.server.Server; -import org.hsqldb.server.ServerConstants; - -import junit.framework.JUnit4TestAdapter; -import junit.framework.TestSuite; - -/** - * Base test class for ODBC testing. - * - * Provides utility testrunner method, plus sets up and runs a HyperSQL - * listener. - *

    - * You MUST have a native (non-Java) ODBC DSN configured with the PostgreSQL - * ODBC driver, DSN name "PostgreSQL30", DSN database "test", port "9001", - * server "localhost". - * The user name and password are "SA" and "PW". - * We use the word query how it is used in the JDBC API, to mean a - * SELECT statement, not in the more general way as used in the ODBC API. - *

    - * The DSN name and port may be changed from these defaults by setting Java - * system properties "test.hsqlodbc.dsnname" and/or "test.hsqlodbc.port". - *

    - * This class has been converted to JUnit 4.10. - * Test runs are faster than the JUnit 3.x original with one-time-per-class - * setUp and tearDown (fredt@users). - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @since 1.9.0 - */ -public abstract class TestOdbcBase { - - Connection netConn = null; - static Server server = null; - static String portString = "9001"; - static String dsnName = "PostgreSQL30"; - static String password = "PW"; - static String inMemURL = "jdbc:hsqldb:mem:test"; - static String serverURL = "jdbc:hsqldb:hsql://localhost/test"; - static boolean inProcessServer = true; - - public TestOdbcBase() {} - - static { - try { - Class.forName("org.hsqldb.jdbc.JDBCDriver"); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException( - " failed. JDBC Driver class not in CLASSPATH"); - } - - String portProp = System.getProperty("test.hsqlodbc.port"); - - if (portProp != null) { - portString = portProp; - } - - String dsnProp = System.getProperty("test.hsqlodbc.dsnname"); - - if (dsnProp != null) { - dsnName = dsnProp; - } - } - - /** - * JUnit convention for cleanup. - * - * Called after each test*() method. - */ - static void tearDownServer() throws SQLException { - - if (inProcessServer) { - server.shutdown(); - - if (server.getState() != ServerConstants.SERVER_STATE_SHUTDOWN) { - throw new RuntimeException("Server failed to shut down"); - } - } - } - - /** - * Specifically, this opens a mem-only DB, populates it, starts a - * HyperSQL Server to server it, and opens network JDBC Connection - * "netConn" to it, - * - * Invoked before each test*() invocation by JUnit. - */ - void setUp() throws Exception { - - try { - Connection setupConn; - - if (inProcessServer) { - setupConn = DriverManager.getConnection(inMemURL, "SA", - password); - } else { - setupConn = DriverManager.getConnection(serverURL, "SA", - password); - } - - setupConn.setAutoCommit(false); - - Statement st = setupConn.createStatement(); - - st.execute("drop schema public cascade"); - populate(st); - st.close(); - setupConn.commit(); - setupConn.close(); - } catch (SQLException se) { - throw new RuntimeException("Failed to set up in-memory database", - se); - } - - try { - netConn = DriverManager.getConnection("jdbc:odbc:" + dsnName, - "SA", password); - - //netConn.setAutoCommit(false); - } catch (SQLException se) { - if (se.getMessage().indexOf("No suitable driver") > -1) { - throw new RuntimeException( - "You must install the native library for Sun's jdbc:odbc " - + "JDBC driver"); - } - - if (se.getMessage().indexOf("Data source name not found") > -1) { - throw new RuntimeException( - "You must configure ODBC DSN '" + dsnName - + "' (you may change the name and/or port by setting Java " - + "system properties 'test.hsqlodbc.port' or " - + "'test.hsqlodbc.dsnname'"); - } - - throw new RuntimeException( - "Failed to set up JDBC/ODBC network connection", se); - } - } - - static void setUpServer() { - - if (!inProcessServer) { - return; - } - - try { - server = new Server(); - - HsqlProperties properties = new HsqlProperties(); - - if (System.getProperty("VERBOSE") == null) { - server.setLogWriter(null); - server.setErrWriter(null); - } else { - properties.setProperty("server.silent", "false"); - properties.setProperty("server.trace", "false"); - } - - properties.setProperty("server.database.0", - "mem:test;user=SA;password=PW"); - properties.setProperty("server.dbname.0", "test"); - properties.setProperty("server.port", TestOdbcBase.portString); - server.setProperties(properties); - server.start(); - - try { - Thread.sleep(1000); - } catch (InterruptedException ie) {} - } catch (Exception e) { - throw new RuntimeException("Failed to set up in-memory database", - e); - } - - if (server.getState() != ServerConstants.SERVER_STATE_ONLINE) { - throw new RuntimeException("Server failed to start up"); - } - } - - protected void enableAutoCommit() { - - try { - netConn.setAutoCommit(false); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - /** - * This method allows to easily run this unit test independent of the other - * unit tests, and without dealing with Ant or unrelated test suites. - * - * Invoke like this:

    
    -     *  public static void main(String[] sa) {
    -     *      staticRunner(TestOdbcService.class, sa);
    -     *  }
    -     * 
    , but give your subclass name in place of - * TestOdbcService - */ - public static void staticRunner(Class c, String[] sa) { - - TestSuite suite = new TestSuite(); - - suite.addTest(new JUnit4TestAdapter(c)); - junit.textui.TestRunner.run(suite); - } - - abstract protected void populate(Statement st) throws SQLException; -} diff --git a/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcService.java b/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcService.java deleted file mode 100644 index 7974af16..00000000 --- a/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcService.java +++ /dev/null @@ -1,528 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test.odbc; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; - -/** - * See TestOdbcBase for more general ODBC test information. - * - * Standard test methods perform the named test, then perform a simple - * (non-prepared) query to verify the state of the server is healthy enough - * to successfully serve a query. - * (We may or many not add test(s) to verify behavior when no static query - * follows).

    - * - * This class has been converted to JUnit 4.10. - * Test runs are faster than the JUnit 3.x original with one-time-per-class - * setUp and tearDown (fredt@users). - *

    - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @since 1.9.0 - * @see TestOdbcBase - */ -public class TestOdbcService extends TestOdbcBase { - - public TestOdbcService() {} - - @BeforeClass - public static void setUpForTests() throws Exception { - setUpServer(); - } - - @AfterClass - public static void tearDownClass() throws SQLException { - tearDownServer(); - } - - @Before - public void setUp() throws Exception { - super.setUp(); - } - - @Test - public void testSanity() { - - try { - ResultSet rs = netConn.createStatement().executeQuery( - "SELECT count(*) FROM nullmix"); - - if (!rs.next()) { - throw new RuntimeException("The most basic query failed. " - + "No row count from 'nullmix'."); - } - - assertEquals("Sanity check failed. Rowcount of 'nullmix'", 6, - rs.getInt(1)); - rs.close(); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError( - "The most basic query failed"); - - ase.initCause(se); - - throw ase; - } - } - - /** - * Tests with input and output parameters, and rerunning query with - * modified input parameters. - */ - @Test - public void testSimpleQuery() { - - try { - ResultSet rs = netConn.createStatement().executeQuery( - "SELECT i, 3, vc, 'str' FROM nullmix WHERE i > 20 ORDER BY i"); - - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(21, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("twenty one", rs.getString(3)); - assertTrue("Not enough rows fetched", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - /** - * Tests with input and output parameters, and rerunning query with - * modified input parameters. - */ - @Test - public void testSimplePreparedQuery() { - - try { - ResultSet rs; - PreparedStatement ps = netConn.prepareStatement( - "SELECT i, 3, vc FROM nullmix WHERE i < ? OR i > ? " - + "ORDER BY i"); - - ps.setInt(1, 10); - ps.setInt(2, 30); - - rs = ps.executeQuery(); - - assertTrue("No rows fetched", rs.next()); - assertEquals(5, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("five", rs.getString(3)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(40, rs.getInt(1)); - assertEquals("forty", rs.getString(3)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - ps.setInt(1, 16); - ps.setInt(2, 100); - - rs = ps.executeQuery(); - - assertTrue("No rows fetched", rs.next()); - assertEquals(5, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("five", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals(10, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("ten", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals(15, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("fifteen", rs.getString(3)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - verifySimpleQueryOutput(); // Verify server state still good - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - /** - * Tests with input and output parameters, and rerunning query with - * modified input parameters. - */ - @Test - public void testFullyPreparedQuery() { - - try { - ResultSet rs; - PreparedStatement ps = netConn.prepareStatement( - "SELECT i, 3, vc, 'str' FROM nullmix WHERE i < ? OR i > ? " - + "ORDER BY i"); - - ps.setInt(1, 10); - ps.setInt(2, 30); - - rs = ps.executeQuery(); - - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(5, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("five", rs.getString(3)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(40, rs.getInt(1)); - assertEquals("forty", rs.getString(3)); - assertEquals("str", rs.getString(4)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - ps.setInt(1, 16); - ps.setInt(2, 100); - - rs = ps.executeQuery(); - - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(5, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("five", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(10, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("ten", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(15, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("fifteen", rs.getString(3)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - verifySimpleQueryOutput(); // Verify server state still good - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - @Test - public void testDetailedSimpleQueryOutput() { - - try { - verifySimpleQueryOutput(); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - /** - * Assumes none of the records above i=20 have been modified. - */ - public void verifySimpleQueryOutput() throws SQLException { - - ResultSet rs = netConn.createStatement().executeQuery( - "SELECT i, 3, vc, 'str' FROM nullmix WHERE i > 20 ORDER BY i"); - - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(21, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("twenty one", rs.getString(3)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(25, rs.getInt(1)); - assertNull(rs.getString(3)); - assertEquals("str", rs.getString(4)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(3, rs.getInt(2)); - assertEquals(40, rs.getInt(1)); - assertEquals("forty", rs.getString(3)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - } - - @Test - public void testPreparedNonRowStatement() { - - try { - PreparedStatement ps = netConn.prepareStatement( - "UPDATE nullmix set xtra = ? WHERE i < ?"); - - ps.setString(1, "first"); - ps.setInt(2, 25); - assertEquals("First update failed", 4, ps.executeUpdate()); - ps.setString(1, "second"); - ps.setInt(2, 15); - assertEquals("Second update failed", 2, ps.executeUpdate()); - ps.close(); - - Statement st = netConn.createStatement(); - - ResultSet rs = st.executeQuery( - "SELECT i, 3, vc, xtra FROM nullmix ORDER BY i"); - - assertTrue("No rows fetched", rs.next()); - assertEquals("second", rs.getString(4)); - assertEquals(5, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("five", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("second", rs.getString(4)); - assertEquals(10, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("ten", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("first", rs.getString(4)); - assertEquals(15, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("fifteen", rs.getString(3)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(21, rs.getInt(1)); - assertEquals("twenty one", rs.getString(3)); - assertEquals("first", rs.getString(4)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(25, rs.getInt(1)); - assertNull(rs.getString(3)); - assertNull(rs.getString(4)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(40, rs.getInt(1)); - assertEquals("forty", rs.getString(3)); - assertNull(rs.getString(4)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - @Test - public void testParamlessPreparedQuery() { - - try { - ResultSet rs; - PreparedStatement ps = netConn.prepareStatement( - "SELECT i, 3, vc, 'str' FROM nullmix WHERE i != 21 " - + "ORDER BY i"); - - rs = ps.executeQuery(); - - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(5, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("five", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(10, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("ten", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(15, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("fifteen", rs.getString(3)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(25, rs.getInt(1)); - assertNull(rs.getString(3)); - assertEquals("str", rs.getString(4)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(40, rs.getInt(1)); - assertEquals("forty", rs.getString(3)); - assertEquals("str", rs.getString(4)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - - rs = ps.executeQuery(); - - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(5, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("five", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(10, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("ten", rs.getString(3)); - assertTrue("No rows fetched", rs.next()); - assertEquals("str", rs.getString(4)); - assertEquals(15, rs.getInt(1)); - assertEquals(3, rs.getInt(2)); - assertEquals("fifteen", rs.getString(3)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(25, rs.getInt(1)); - assertNull(rs.getString(3)); - assertEquals("str", rs.getString(4)); - assertTrue("Not enough rows fetched", rs.next()); - assertEquals(3, rs.getInt(2)); - assertEquals(40, rs.getInt(1)); - assertEquals("forty", rs.getString(3)); - assertEquals("str", rs.getString(4)); - assertFalse("Too many rows fetched", rs.next()); - rs.close(); - verifySimpleQueryOutput(); // Verify server state still good - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - @Test - public void testSimpleUpdate() { - - try { - Statement st = netConn.createStatement(); - - assertEquals( - 2, st.executeUpdate( - "UPDATE nullmix SET xtra = 'updated' WHERE i < 12")); - - ResultSet rs = netConn.createStatement().executeQuery( - "SELECT * FROM nullmix WHERE xtra = 'updated'"); - - assertTrue("No rows updated", rs.next()); - assertTrue("Only one row updated", rs.next()); - assertFalse("Too many rows updated", rs.next()); - rs.close(); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } - } - - @Test - public void testTranSanity() { - enableAutoCommit(); - testSanity(); - } - - @Test - public void testTranFullyPreparedQuery() { - enableAutoCommit(); - testFullyPreparedQuery(); - } - - @Test - public void testTranDetailedSimpleQueryOutput() { - enableAutoCommit(); - testDetailedSimpleQueryOutput(); - } - - @Test - public void testTranPreparedNonRowStatement() { - enableAutoCommit(); - testPreparedNonRowStatement(); - } - - @Test - public void testTranParamlessPreparedQuery() { - enableAutoCommit(); - testParamlessPreparedQuery(); - } - - @Test - public void testTranSimpleUpdate() { - enableAutoCommit(); - testSimpleUpdate(); - } - - protected void populate(Statement st) throws SQLException { - - st.executeUpdate("DROP TABLE nullmix IF EXISTS"); - st.executeUpdate( - "CREATE TABLE nullmix " - + "(i INT NOT NULL, vc VARCHAR(20), xtra VARCHAR(20))"); - - // Would be more elegant and efficient to use a prepared statement - // here, but our we want this setup to be as simple as possible, and - // leave feature testing for the actual unit tests. - st.executeUpdate("INSERT INTO nullmix (i, vc) values(10, 'ten')"); - st.executeUpdate("INSERT INTO nullmix (i, vc) values(5, 'five')"); - st.executeUpdate("INSERT INTO nullmix (i, vc) values(15, 'fifteen')"); - st.executeUpdate( - "INSERT INTO nullmix (i, vc) values(21, 'twenty one')"); - st.executeUpdate("INSERT INTO nullmix (i, vc) values(40, 'forty')"); - st.executeUpdate("INSERT INTO nullmix (i) values(25)"); - } - - public static void main(String[] sa) { - staticRunner(TestOdbcService.class, sa); - } -} diff --git a/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcTypes.java b/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcTypes.java deleted file mode 100644 index 8eeb9c19..00000000 --- a/database/hsqldb/src/org/hsqldb/test/odbc/TestOdbcTypes.java +++ /dev/null @@ -1,2049 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.test.odbc; - -import java.math.BigDecimal; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; - -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; - - -/** - * See TestOdbcBase for more general ODBC test information. - * - * This class has been converted to JUnit 4.10. - * Test runs are faster than the JUnit 3.x original with one-time-per-class - * setUp and tearDown (fredt@users). - *

    - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @since 1.9.0 - * @see TestOdbcBase - */ -public class TestOdbcTypes extends TestOdbcBase { - - /* HyperSQL types to be tested: - * - * Exact Numeric - * TINYINT - * SMALLINT - * INTEGER - * BIGINT - * NUMERIC(p?,s?) = DECIMAL() (default for decimal literals) - * Approximate Numeric - * FLOAT(p?) - * DOUBLE = REAL (default for literals with exponent) - * BOOLEAN - * Character Strings - * CHARACTER(1l)* = CHAR() - * CHARACTER VARYING(1l) = VARCHAR() = LONGVARCHAR() - * CLOB(1l) = CHARACTER LARGE OBJECT(1) - * Binary Strings - * BINARY(1l)* - * BINARY VARYING(1l) = VARBINARY() - * BLOB(1l) = BINARY LARGE OBJECT() - * Bits - * BIT(1l) - * BIT VARYING(1l) - * OTHER (for holding serialized Java objects) - * Date/Times - * DATE - * TIME(p?,p?) - * TIMESTAMP(p?,p?) - * INTERVAL...(p2,p0) - */ - public TestOdbcTypes() {} - - @BeforeClass - public static void setUpForTests() { - setUpServer(); - } - - @AfterClass - public static void tearDownClass() throws SQLException { - tearDownServer(); - } - - @Before - public void setUp() throws Exception { - super.setUp(); - } - - protected void populate(Statement st) throws SQLException { - - st.executeUpdate("DROP TABLE alltypes IF EXISTS"); - st.executeUpdate("CREATE TABLE alltypes (\n" + " id INTEGER,\n" - + " ti TINYINT,\n" + " si SMALLINT,\n" - + " i INTEGER,\n" + " bi BIGINT,\n" - + " n NUMERIC(5,2),\n" + " f FLOAT(5),\n" - + " r DOUBLE,\n" + " b BOOLEAN,\n" - + " c CHARACTER(3),\n" - + " cv CHARACTER VARYING(3),\n" - + " bt BIT(9),\n" + " btv BIT VARYING(3),\n" - + " d DATE,\n" + " t TIME(2),\n" - + " tw TIME(2) WITH TIME ZONE,\n" - + " ts TIMESTAMP(2),\n" - + " tsw TIMESTAMP(2) WITH TIME ZONE,\n" - + " bin BINARY(4),\n" + " vb VARBINARY(4),\n" - + " dsival INTERVAL DAY(5) TO SECOND(6),\n" - + " sival INTERVAL SECOND(6,4)\n" + ')'); - - // Would be more elegant and efficient to use a prepared statement - // here, but our we want this setup to be as simple as possible, and - // leave feature testing for the actual unit tests. - st.executeUpdate( - "INSERT INTO alltypes VALUES (\n" - + " 1, 3, 4, 5, 6, 7.8, 8.9, 9.7, true, 'ab', 'cd',\n" - + " b'10', b'10', current_date, '13:14:00',\n" - + " '15:16:00', '2009-02-09 16:17:18', '2009-02-09 17:18:19',\n" - + " x'A103', x'A103', " - + "INTERVAL '145 23:12:19.345' DAY TO SECOND,\n" - + " INTERVAL '1000.345' SECOND\n" + ')'); - st.executeUpdate( - "INSERT INTO alltypes VALUES (\n" - + " 2, 3, 4, 5, 6, 7.8, 8.9, 9.7, true, 'ab', 'cd',\n" - + " b'10', b'10', current_date, '13:14:00',\n" - + " '15:16:00', '2009-02-09 16:17:18', '2009-02-09 17:18:19',\n" - + " x'A103', x'A103', " - + " INTERVAL '145 23:12:19.345' DAY TO SECOND,\n" - + " INTERVAL '1000.345' SECOND\n" + ')'); - } - - @Test - public void testIntegerSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(Integer.class, rs.getObject("i").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals(5, rs.getInt("i")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testTinyIntSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - Object o = rs.getObject("ti"); // todo - returns string - // assertEquals(Integer.class, rs.getObject("ti").getClass()); - - // Nb. HyperSQL purposefully returns an Integer for this type - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals((byte) 3, rs.getByte("ti")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testSmallIntSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(Integer.class, rs.getObject("si").getClass()); - - // Nb. HyperSQL purposefully returns an Integer for this type - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals((short) 4, rs.getShort("si")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testBigIntSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(Long.class, rs.getObject("bi").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals(6, rs.getLong("bi")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testNumericSimpleRead() { - // This is failing. - // Looks like we inherited a real bug with numerics from psqlodbc, - // because the problem exists with Postresql-supplied psqlodbc - // connecting to a Postgresql server. - ResultSet rs = null; - Statement st = null; - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - assertTrue("Got no rows with id in (1, 2)", rs.next()); - Object o = rs.getObject("n"); - assertEquals(BigDecimal.class, o.getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - o = rs.getBigDecimal("n"); // todo - wrong result - BigDecimal expected = new BigDecimal("7.80"); - assertEquals(expected, o); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase - = new junit.framework.AssertionFailedError(se.getMessage()); - ase.initCause(se); - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - if (st != null) { - st.close(); - } - } catch(Exception ignored) { - } - } - } - - @Test - public void testFloatSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(Double.class, rs.getObject("f").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals(8.9D, rs.getDouble("f"), 0D); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testDoubleSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(Double.class, rs.getObject("r").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals(9.7D, rs.getDouble("r"), 0D); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - // todo - @Test - public void testBooleanSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - Object o = rs.getObject("b"); // todo - returns string - // assertEquals(Boolean.class, o.getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertTrue(rs.getBoolean("b")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testCharSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(String.class, rs.getObject("c").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals("ab ", rs.getString("c")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testVarCharSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(String.class, rs.getObject("cv").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals("cd", rs.getString("cv")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testFixedStringSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT i, 'fixed str' fs, cv\n" - + "FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(String.class, rs.getObject("fs").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals("fixed str", rs.getString("fs")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testDerivedStringSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT i, cv || 'appendage' app, 4\n" - + "FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(String.class, rs.getObject("app").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals("cdappendage", rs.getString("app")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testDateSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(java.sql.Date.class, rs.getObject("d").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals( - new java.sql.Date(new java.util.Date().getTime()).toString(), - rs.getDate("d").toString()); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testTimeSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(java.sql.Time.class, rs.getObject("t").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals(Time.valueOf("13:14:00"), rs.getTime("t")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testTimeWSimpleRead() { - // This test is failing because the JDBC Driver is returning a - // String instead of a Time oject for rs.getTime(). - ResultSet rs = null; - Statement st = null; - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - assertTrue("Got no rows with id in (1, 2)", rs.next()); - Object o = rs.getObject("tw"); // todo - returns string 15:16:00.00+1:00 - // assertEquals(java.sql.Time.class, o.getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - o = rs.getTime("tw"); // todo - wrong result - returns 1 hour - // assertEquals(Time.valueOf("15:16:00"), o); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase - = new junit.framework.AssertionFailedError(se.getMessage()); - ase.initCause(se); - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - if (st != null) { - st.close(); - } - } catch(Exception ignored) { - } - } - } - - @Test - public void testTimestampSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(Timestamp.class, rs.getObject("ts").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals(Timestamp.valueOf("2009-02-09 16:17:18"), - rs.getTimestamp("ts")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testTimestampWSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals(Timestamp.class, rs.getObject("tsw").getClass()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals(Timestamp.valueOf("2009-02-09 17:18:19"), - rs.getTimestamp("tsw")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testBitSimpleRead() { - - // This test is failing because of a BIT padding bug in the engine. - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals("100000000", rs.getString("bt")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testBitVaryingSimpleRead() { - - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - assertEquals("10", rs.getString("btv")); - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testBinarySimpleRead() { - - ResultSet rs = null; - Statement st = null; - byte[] expectedBytes = new byte[] { - (byte) 0xa1, (byte) 0x03, (byte) 0, (byte) 0 - }; - byte[] ba; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals("A1030000", rs.getString("bin")); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - - ba = rs.getBytes("bin"); - - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - - assertEquals("Retrieved bye array length wrong", expectedBytes.length, - ba.length); - - for (int i = 0; i < ba.length; i++) { - assertEquals("Byte " + i + " wrong", expectedBytes[i], ba[i]); - } - } - - @Test - public void testVarBinarySimpleRead() { - - ResultSet rs = null; - Statement st = null; - byte[] expectedBytes = new byte[] { - (byte) 0xa1, (byte) 0x03 - }; - byte[] ba; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals("A103", rs.getString("vb")); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - - ba = rs.getBytes("vb"); - - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - - assertEquals("Retrieved bye array length wrong", expectedBytes.length, - ba.length); - - for (int i = 0; i < ba.length; i++) { - assertEquals("Byte " + i + " wrong", expectedBytes[i], ba[i]); - } - } - - @Test - public void testDaySecIntervalSimpleRead() { - - /* Since our client does not support the INTERVAL precision - * constraints, the returned value will always be toString()'d to - * precision of microseconds. */ - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals("145 23:12:19.345000", rs.getString("dsival")); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - - // Can't test the class, because jdbc:odbc or the driver returns - // a String for getObject() for interval values. - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testSecIntervalSimpleRead() { - - /* Since our client does not support the INTERVAL precision - * constraints, the returned value will always be toString()'d to - * precision of microseconds. */ - ResultSet rs = null; - Statement st = null; - - try { - st = netConn.createStatement(); - rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); - - assertTrue("Got no rows with id in (1, 2)", rs.next()); - assertEquals("1000.345000", rs.getString("sival")); - assertTrue("Got only one row with id in (1, 2)", rs.next()); - - // Can't test the class, because jdbc:odbc or the driver returns - // a String for getObject() for interval values. - assertFalse("Got too many rows with id in (1, 2)", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (st != null) { - st.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testIntegerComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, i) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setInt(2, 495); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE i = ?"); - - ps.setInt(1, 495); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with i = 495", rs.next()); - assertEquals(Integer.class, rs.getObject("i").getClass()); - assertTrue("Got only one row with i = 495", rs.next()); - assertEquals(495, rs.getInt("i")); - assertFalse("Got too many rows with i = 495", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testTinyIntComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, ti) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setByte(2, (byte) 200); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE ti = ?"); - - ps.setByte(1, (byte) 200); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with ti = 200", rs.next()); - Object o = rs.getObject("ti"); // todo - returns string - // assertEquals(Integer.class, o.getClass()); - assertTrue("Got only one row with ti = 200", rs.next()); - assertEquals((byte) 200, rs.getByte("ti")); - assertFalse("Got too many rows with ti = 200", rs.next()); - assertFalse(false); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testSmallIntComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, si) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setShort(2, (short) 395); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE si = ?"); - - ps.setShort(1, (short) 395); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with si = 395", rs.next()); - assertEquals(Integer.class, rs.getObject("si").getClass()); - - // Nb. HyperSQL purposefully returns an Integer for this type - assertTrue("Got only one row with si = 395", rs.next()); - assertEquals((short) 395, rs.getShort("si")); - assertFalse("Got too many rows with si = 395", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testBigIntComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, bi) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setLong(2, 295L); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE bi = ?"); - - ps.setLong(1, 295L); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with bi = 295L", rs.next()); - assertEquals(Long.class, rs.getObject("bi").getClass()); - assertTrue("Got only one row with bi = 295L", rs.next()); - assertEquals(295L, rs.getLong("bi")); - assertFalse("Got too many rows with bi = 295L", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - /* TODO: Implement this test after get testNumericSimpleRead() working. - * See that method above. - public void testNumericComplex() { - */ - @Test - public void testFloatComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, f) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setFloat(2, 98.765F); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE f = ?"); - - ps.setFloat(1, 98.765F); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with f = 98.765F", rs.next()); - assertEquals(Double.class, rs.getObject("f").getClass()); - assertTrue("Got only one row with f = 98.765F", rs.next()); - assertEquals(98.765D, rs.getDouble("f"), .01D); - assertFalse("Got too many rows with f = 98.765F", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testDoubleComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, r) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setDouble(2, 876.54D); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE r = ?"); - - ps.setDouble(1, 876.54D); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with r = 876.54D", rs.next()); - assertEquals(Double.class, rs.getObject("r").getClass()); - assertTrue("Got only one row with r = 876.54D", rs.next()); - assertEquals(876.54D, rs.getDouble("r"), 0D); - assertFalse("Got too many rows with r = 876.54D", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testBooleanComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, b) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setBoolean(2, false); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE b = ?"); - - ps.setBoolean(1, false); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with b = false", rs.next()); - Object o = rs.getObject("b"); // todo - returns string - // assertEquals(Boolean.class, rs.getObject("b").getClass()); - assertTrue("Got only one row with b = false", rs.next()); - assertEquals(false, rs.getBoolean("b")); - assertFalse("Got too many rows with b = false", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testCharComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, c) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setString(2, "xy"); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE c = ?"); - - ps.setString(1, "xy "); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with c = 'xy '", rs.next()); - assertEquals(String.class, rs.getObject("c").getClass()); - assertTrue("Got only one row with c = 'xy '", rs.next()); - assertEquals("xy ", rs.getString("c")); - assertFalse("Got too many rows with c = 'xy '", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testVarCharComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, cv) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setString(2, "xy"); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE cv = ?"); - - ps.setString(1, "xy"); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with cv = 'xy'", rs.next()); - assertEquals(String.class, rs.getObject("cv").getClass()); - assertTrue("Got only one row with cv = 'xy'", rs.next()); - assertEquals("xy", rs.getString("cv")); - assertFalse("Got too many rows with cv = 'xy'", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - /** - * TODO: Find out if there is a way to select based on an expression - * using a named derived pseudo-column. - */ - @Test - public void testDerivedComplex() { - PreparedStatement ps = null; - ResultSet rs = null; - try { - ps = netConn.prepareStatement( - "SELECT id, cv || 'app' appendage FROM alltypes\n" - + "WHERE (cv || 'app') = ?"); - ps.setString(1, "cvapp"); - rs = ps.executeQuery(); - assertTrue("Got no rows appendage = 'cvapp'", rs.next()); - assertEquals(String.class, rs.getObject("r").getClass()); - assertTrue("Got only one row with appendage = 'cvapp'", rs.next()); - assertEquals("cvapp", rs.getString("r")); - assertFalse("Got too many rows with appendage = 'cvapp'", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase - = new junit.framework.AssertionFailedError(se.getMessage()); - ase.initCause(se); - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - if (ps != null) { - ps.close(); - } - } catch(Exception ignored) { - } - } - } - - @Test - public void testDateComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - java.sql.Date tomorrow = - new java.sql.Date(new java.util.Date().getTime() - + 1000 * 60 * 60 * 24); - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, d) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setDate(2, tomorrow); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE d = ?"); - - ps.setDate(1, tomorrow); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with d = tomorrow", rs.next()); - assertEquals(java.sql.Date.class, rs.getObject("d").getClass()); - assertTrue("Got only one row with d = tomorrow", rs.next()); - assertEquals(tomorrow.toString(), rs.getDate("d").toString()); - - // Compare the Strings since "tomorrow" has resolution to - // millisecond, but getDate() is probably to the day. - assertFalse("Got too many rows with d = tomorrow", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testTimeComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - Time aTime = Time.valueOf("21:19:27"); - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, t) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setTime(2, aTime); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE t = ?"); - - ps.setTime(1, aTime); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with t = aTime", rs.next()); - assertEquals(Time.class, rs.getObject("t").getClass()); - assertTrue("Got only one row with t = aTime", rs.next()); - assertEquals(aTime, rs.getTime("t")); - assertFalse("Got too many rows with t = aTime", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - /* TODO: Implement this test after get testTimeWSimpleRead() working. - * See that method above. - public void testTimeWComplex() { - */ - @Test - public void testTimestampComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - Timestamp aTimestamp = Timestamp.valueOf("2009-03-27 17:18:19"); - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, ts) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setTimestamp(2, aTimestamp); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE ts = ?"); - - ps.setTimestamp(1, aTimestamp); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with ts = aTimestamp", rs.next()); - assertEquals(Timestamp.class, rs.getObject("ts").getClass()); - assertTrue("Got only one row with ts = aTimestamp", rs.next()); - assertEquals(aTimestamp, rs.getTimestamp("ts")); - assertFalse("Got too many rows with ts = aTimestamp", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - @Test - public void testTimestampWComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - Timestamp aTimestamp = Timestamp.valueOf("2009-03-27 17:18:19"); - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, tsw) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setTimestamp(2, aTimestamp); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE tsw = ?"); - - ps.setTimestamp(1, aTimestamp); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with tsw = aTimestamp", rs.next()); - assertEquals(Timestamp.class, rs.getObject("tsw").getClass()); - assertTrue("Got only one row with tsw = aTimestamp", rs.next()); - assertEquals(aTimestamp, rs.getTimestamp("tsw")); - assertFalse("Got too many rows with tsw = aTimestamp", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - } - - /* - * Driver needs to be modified to transfer bits in byte (binary) fashion, - * the same as is done for VARBINARY/bytea type. - */ - @Ignore - public void testBitComplex() { - PreparedStatement ps = null; - ResultSet rs = null; - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, bt) VALUES(?, ?)"); - ps.setInt(1, 3); - ps.setString(2, "101"); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE bt = ?"); - ps.setString(1, "101"); - rs = ps.executeQuery(); - assertTrue("Got no rows with bt = 101", rs.next()); - assertEquals(String.class, rs.getObject("bt").getClass()); - assertTrue("Got only one row with bt = 101", rs.next()); - assertEquals("101000000", rs.getString("bt")); - assertFalse("Got too many rows with bt = 101", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase - = new junit.framework.AssertionFailedError(se.getMessage()); - ase.initCause(se); - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - if (ps != null) { - ps.close(); - } - } catch(Exception ignored) { - } } - } - - @Ignore - public void testBitVaryingComplex() { - PreparedStatement ps = null; - ResultSet rs = null; - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, btv) VALUES(?, ?)"); - ps.setInt(1, 3); - ps.setString(2, "10101"); // toto - throws right truncation - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE btv = ?"); - ps.setString(1, "10101"); - rs = ps.executeQuery(); - assertTrue("Got no rows with btv = 10101", rs.next()); - Object o = rs.getObject("btv"); - assertEquals(String.class, rs.getObject("btv").getClass()); - assertTrue("Got only one row with btv = 10101", rs.next()); - assertEquals("10101", rs.getString("btv")); - assertFalse("Got too many rows with btv = 10101", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase - = new junit.framework.AssertionFailedError(se.getMessage()); - ase.initCause(se); - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - if (ps != null) { - ps.close(); - } - } catch(Exception ignored) { - } - } - } - - @Test - public void testBinaryComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - byte[] expectedBytes = new byte[] { - (byte) 0xaa, (byte) 0x99, (byte) 0, (byte) 0 - }; - byte[] ba1, ba2; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, bin) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setBytes(2, expectedBytes); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE bin = ?"); - - ps.setBytes(1, expectedBytes); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with bin = b'AA99'", rs.next()); - - ba1 = rs.getBytes("bin"); - - assertTrue("Got only one row with bin = b'AA99'", rs.next()); - - ba2 = rs.getBytes("bin"); - - assertFalse("Got too many rows with bin = b'AA99'", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - - assertEquals("Retrieved bye array length wrong (1)", - expectedBytes.length, ba1.length); - - for (int i = 0; i < ba1.length; i++) { - assertEquals("Byte " + i + " wrong (1)", expectedBytes[i], ba1[i]); - } - - assertEquals("Retrieved bye array length wrong (2)", - expectedBytes.length, ba2.length); - - for (int i = 0; i < ba2.length; i++) { - assertEquals("Byte " + i + " wrong (2)", expectedBytes[i], ba2[i]); - } - } - - @Test - public void testVarBinaryComplex() { - - PreparedStatement ps = null; - ResultSet rs = null; - byte[] expectedBytes = new byte[] { - (byte) 0xaa, (byte) 0x99 - }; - byte[] ba1, ba2; - - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, vb) VALUES(?, ?)"); - - ps.setInt(1, 3); - ps.setBytes(2, expectedBytes); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE vb = ?"); - - ps.setBytes(1, expectedBytes); - - rs = ps.executeQuery(); - - assertTrue("Got no rows with vb = b'AA99'", rs.next()); - - ba1 = rs.getBytes("vb"); - - assertTrue("Got only one row with vb = b'AA99'", rs.next()); - - ba2 = rs.getBytes("vb"); - - assertFalse("Got too many rows with vb = b'AA99'", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase = - new junit.framework.AssertionFailedError(se.getMessage()); - - ase.initCause(se); - - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception ignored) {} - } - - assertEquals("Retrieved bye array length wrong (1)", - expectedBytes.length, ba1.length); - - for (int i = 0; i < ba1.length; i++) { - assertEquals("Byte " + i + " wrong (1)", expectedBytes[i], ba1[i]); - } - - assertEquals("Retrieved bye array length wrong (2)", - expectedBytes.length, ba2.length); - - for (int i = 0; i < ba2.length; i++) { - assertEquals("Byte " + i + " wrong (2)", expectedBytes[i], ba2[i]); - } - } - - /* - * TODO: Learn how to set input params for INTERVAL types. - * I don't see how I could set the variant - * (HOUR, ...TO SECOND, etc.) with setString() or anything else. - */ - @Test - public void testDaySecIntervalComplex() { - PreparedStatement ps = null; - ResultSet rs = null; - try { - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, dsival) VALUES(?, ?)"); - ps.setInt(1, 3); - ps.setString(2, "45 23:12:19.345000"); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE dsival = ?"); - ps.setString(1, "45 23:12:19.345000"); - rs = ps.executeQuery(); - assertTrue("Got no rows with dsival = 45 23:12:19.345000", rs.next()); - assertEquals(String.class, rs.getObject("dsival").getClass()); - assertTrue("Got only one row with dsival = 45 23:12:19.345000", rs.next()); - assertEquals("45 23:12:19.345000", rs.getString("dsival")); - assertFalse("Got too many rows with dsival = 45 23:12:19.345000", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase - = new junit.framework.AssertionFailedError(se.getMessage()); - ase.initCause(se); - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - if (ps != null) { - ps.close(); - } - } catch(Exception e) { - } - } - } - - @Test - public void testSecIntervalComplex() { - PreparedStatement ps = null; - ResultSet rs = null; - try { - - ps = netConn.prepareStatement( - "INSERT INTO alltypes(id, sival) VALUES(?, ?)"); - ps.setInt(1, 3); - ps.setString(2, "876.54"); - assertEquals(1, ps.executeUpdate()); - ps.setInt(1, 4); - assertEquals(1, ps.executeUpdate()); - ps.close(); - netConn.commit(); - ps = netConn.prepareStatement( - "SELECT * FROM alltypes WHERE sival = ?"); - ps.setString(1, "876.54"); - rs = ps.executeQuery(); - assertTrue("Got no rows with sival = 876.54D", rs.next()); - assertEquals(String.class, rs.getObject("sival").getClass()); - assertTrue("Got only one row with sival = 876.54D", rs.next()); - assertTrue(rs.getString("sival").startsWith("876.54")); - assertFalse("Got too many rows with sival = 876.54D", rs.next()); - } catch (SQLException se) { - junit.framework.AssertionFailedError ase - = new junit.framework.AssertionFailedError(se.getMessage()); - ase.initCause(se); - throw ase; - } finally { - try { - if (rs != null) { - rs.close(); - } - if (ps != null) { - ps.close(); - } - } catch(Exception e) { - } - } - } - - public static void main(String[] sa) { - staticRunner(TestOdbcTypes.class, sa); - } - /* - static protected boolean closeEnough(Time t1, Time t2, int fudgeMin) { - long delta = t1.getTime() - t2.getTime(); - if (delta < 0) { - delta *= -1; - } - //System.err.println("Delta " + delta); - //System.err.println("exp " + (fudgeMin * 1000 * 60)); - return delta < fudgeMin * 1000 * 60; - } - */ -} diff --git a/database/hsqldb/src/org/hsqldb/test/package-info.java b/database/hsqldb/src/org/hsqldb/test/package-info.java deleted file mode 100644 index 91de24ce..00000000 --- a/database/hsqldb/src/org/hsqldb/test/package-info.java +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains test classes for various features. - */ -package org.hsqldb.test; diff --git a/database/hsqldb/src/org/hsqldb/trigger/Trigger.java b/database/hsqldb/src/org/hsqldb/trigger/Trigger.java deleted file mode 100644 index 79e50476..00000000 --- a/database/hsqldb/src/org/hsqldb/trigger/Trigger.java +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.trigger; - -import org.hsqldb.HsqlException; - -// fredt@users 20030727 - signature altered to support update triggers -// fredt@users 20190327 - moved to own package - -/** - * The interface a HyperSQL TRIGGER must implement. The user-supplied class that - * implements this must have a default constructor.

    - * - * Contents of oldRow[] and newRow[] in each type of trigger. - * - *

      - *
    • - * AFTER INSERT - * oldRow[] contains single String object = "Statement-level". - *
    • - *
    • - * AFTER UPDATE - * oldRow[] contains single String object = "Statement-level". - *
    • - *
    • - * AFTER DELETE - * oldRow[] contains single String object = "Statement-level". - *
    • - *
    • - * BEFORE INSERT FOR EACH ROW - * newRow[] contains data about to be inserted and this can - * be modified within the trigger such that modified data gets written to the - * database. - *
    • - *
    • - * AFTER INSERT FOR EACH ROW - * newRow[] contains data just inserted into the table. - *
    • - *
    • - * BEFORE UPDATE FOR EACH ROW - * oldRow1[] contains currently stored data and not the data that is about to be - * updated. - *
    • - *
    • - * newRow[] contains the data that is about to be updated. - *
    • - *
    • - * AFTER UPDATE FOR EACH ROW - * oldRow1[] contains old stored data. - * newRow[] contains the new data. - *
    • - *
    • - * BEFORE DELETE FOR EACH ROW - * oldRow1[] contains row data about to be deleted. - *
    • - *
    • - * AFTER DELETE FOR EACH ROW - * oldRow1[] contains row data that has been deleted. - *
    • - *
    - * (List compiled by Andrew Knight quozzbat@users) - * - * @author Peter Hudson (peterhudson@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.7.0 - */ -public interface Trigger { - - // type of trigger - int INSERT_AFTER = 0; - int DELETE_AFTER = 1; - int UPDATE_AFTER = 2; - int INSERT_AFTER_ROW = 3; - int DELETE_AFTER_ROW = 4; - int UPDATE_AFTER_ROW = 5; - int INSERT_BEFORE_ROW = 6; - int DELETE_BEFORE_ROW = 7; - int UPDATE_BEFORE_ROW = 8; - - /** - * The method invoked upon each triggered action. - * - *

    type contains the integer index id for trigger type, e.g. - * TriggerDef.INSERT_AFTER - * - *

    For all triggers defined as default FOR EACH STATEMENT both - * oldRow and newRow are null. - * - *

    For triggers defined as FOR EACH ROW, the following will apply: - * - *

    When UPDATE triggers are fired, oldRow contains the existing values - * of the table row and newRow contains the new values. - * - *

    For INSERT triggers, oldRow is null and newRow contains the table row - * to be inserted. For DELETE triggers, newRow is null and oldRow contains - * the table row to be deleted. - * - *

    For error conditions, users can construct an HsqlException using one - * of the static methods of org.hsqldb.error.Error with a predefined - * SQL State from org.hsqldb.error.ErrorCode. - * - * @param type the type as one of the int values defined in the interface - * @param trigName the name of the trigger - * @param tabName the name of the table upon which the triggered action is - * occurring - * @param oldRow the old row - * @param newRow the new row - * @throws HsqlException the preferred type of exception thrown by the method - */ - void fire(int type, String trigName, String tabName, Object[] oldRow, - Object[] newRow); -} diff --git a/database/hsqldb/src/org/hsqldb/trigger/package-info.java b/database/hsqldb/src/org/hsqldb/trigger/package-info.java deleted file mode 100644 index 52ab71df..00000000 --- a/database/hsqldb/src/org/hsqldb/trigger/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains the {@code Trigger} interface for Java language database triggers. - *

    - * - * The CREATE TRIGGER statement can specify a user-defined class that implements - * the {@code Trigger} interface. - */ -package org.hsqldb.trigger; diff --git a/database/hsqldb/src/org/hsqldb/types/ArrayType.java b/database/hsqldb/src/org/hsqldb/types/ArrayType.java deleted file mode 100644 index 38a2ffd4..00000000 --- a/database/hsqldb/src/org/hsqldb/types/ArrayType.java +++ /dev/null @@ -1,566 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.sql.Array; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.SortAndSlice; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.jdbc.JDBCArray; -import org.hsqldb.jdbc.JDBCArrayBasic; -import org.hsqldb.lib.ArraySort; - -/** - * Class for ARRAY type objects.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 2.0.0 - */ -public class ArrayType extends Type { - - public static final int defaultArrayCardinality = 1024 * 1024; - public static final int defaultLargeArrayCardinality = Integer.MAX_VALUE; - final Type dataType; - final int maxCardinality; - - public ArrayType(Type dataType, int cardinality) { - - super(Types.SQL_ARRAY, Types.SQL_ARRAY, 0, 0); - - if (dataType == null) { - dataType = Type.SQL_ALL_TYPES; - } - - this.dataType = dataType; - this.maxCardinality = cardinality; - } - - public int displaySize() { - return 7 + (dataType.displaySize() + 1) * maxCardinality; - } - - public int getJDBCTypeCode() { - return Types.ARRAY; - } - - public Class getJDBCClass() { - return java.sql.Array.class; - } - - public String getJDBCClassName() { - return "java.sql.Array"; - } - - public int getJDBCScale() { - return 0; - } - - public int getJDBCPrecision() { - return 0; - } - - public int getSQLGenericTypeCode() { - return 0; - } - - public String getNameString() { - - StringBuilder sb = new StringBuilder(); - - sb.append(dataType.getNameString()).append(' '); - sb.append(Tokens.T_ARRAY); - - if (maxCardinality != defaultArrayCardinality) { - sb.append('[').append(maxCardinality).append(']'); - } - - return sb.toString(); - } - - public String getFullNameString() { - - StringBuilder sb = new StringBuilder(); - - sb.append(dataType.getFullNameString()).append(' '); - sb.append(Tokens.T_ARRAY); - - if (maxCardinality != defaultArrayCardinality) { - sb.append('[').append(maxCardinality).append(']'); - } - - return sb.toString(); - } - - public String getDefinition() { - - StringBuilder sb = new StringBuilder(); - - sb.append(dataType.getDefinition()).append(' '); - sb.append(Tokens.T_ARRAY); - - if (maxCardinality != defaultArrayCardinality) { - sb.append('[').append(maxCardinality).append(']'); - } - - return sb.toString(); - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - Object[] arra = (Object[]) a; - Object[] arrb = (Object[]) b; - int length = arra.length; - - if (arrb.length < length) { - length = arrb.length; - } - - for (int i = 0; i < length; i++) { - int result = dataType.compare(session, arra[i], arrb[i]); - - if (result != 0) { - return result; - } - } - - if (arra.length > arrb.length) { - return 1; - } else if (arra.length < arrb.length) { - return -1; - } - - return 0; - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - Object[] arra = (Object[]) a; - - if (arra.length > maxCardinality) { - throw Error.error(ErrorCode.X_2202F); - } - - Object[] arrb = new Object[arra.length]; - - for (int i = 0; i < arra.length; i++) { - arrb[i] = dataType.convertToTypeLimits(session, arra[i]); - } - - return arrb; - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return null; - } - - if (otherType == null) { - return a; - } - - if (!otherType.isArrayType()) { - throw Error.error(ErrorCode.X_42562); - } - - Object[] arra = (Object[]) a; - - if (arra.length > maxCardinality) { - throw Error.error(ErrorCode.X_2202F); - } - - Type otherComponent = otherType.collectionBaseType(); - - if (dataType.equals(otherComponent)) { - return a; - } - - Object[] arrb = new Object[arra.length]; - - for (int i = 0; i < arra.length; i++) { - arrb[i] = dataType.convertToType(session, arra[i], otherComponent); - } - - return arrb; - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - - Object[] data; - boolean convert = false; - - if (a == null) { - return null; - } - - if (a instanceof Object[]) { - data = (Object[]) a; - convert = true; - } else if (a instanceof JDBCArray) { - data = ((JDBCArray) a).getArrayInternal(); - } else if (a instanceof JDBCArrayBasic) { - data = (Object[]) ((JDBCArrayBasic) a).getArray(); - convert = true; - } else if (a instanceof java.sql.Array) { - try { - data = (Object[]) ((Array) a).getArray(); - convert = true; - } catch (Exception e) { - throw Error.error(ErrorCode.X_42561); - } - } else { - throw Error.error(ErrorCode.X_42561); - } - - if (convert) { - Object[] array = new Object[data.length]; - - for (int i = 0; i < data.length; i++) { - Object o = dataType.convertJavaToSQL(session, data[i]); - - array[i] = dataType.convertToTypeLimits(session, o); - } - - return array; - } - - return data; - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - if (a instanceof Object[]) { - Object[] data = (Object[]) a; - - return new JDBCArray(data, this.collectionBaseType(), this, - session); - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertToDefaultType(SessionInterface sessionInterface, - Object o) { - return o; - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return convertToSQLString(a); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - Object[] arra = (Object[]) a; - StringBuilder sb = new StringBuilder(); - - sb.append(Tokens.T_ARRAY); - sb.append('['); - - for (int i = 0; i < arra.length; i++) { - if (i > 0) { - sb.append(','); - } - - sb.append(dataType.convertToSQLString(arra[i])); - } - - sb.append(']'); - - return sb.toString(); - } - - public void convertToJSON(Object a, StringBuilder sb) { - - Object[] arra = (Object[]) a; - - if (a == null) { - sb.append("null"); - - return; - } - - sb.append('['); - - for (int i = 0; i < arra.length; i++) { - if (i > 0) { - sb.append(','); - } - - dataType.convertToJSON(arra[i], sb); - } - - sb.append(']'); - } - - public void convertToJSONsimple(Object a, StringBuilder sb) { - - Object[] arra = (Object[]) a; - - if (a == null) { - sb.append("null"); - - return; - } - - sb.append('['); - - for (int i = 0; i < arra.length; i++) { - if (i > 0) { - sb.append(','); - } - - Object value = dataType.convertToString(arra[i]); - - sb.append(value); - } - - sb.append(']'); - } - - public boolean canConvertFrom(Type otherType) { - - if (otherType == null) { - return true; - } - - if (!otherType.isArrayType()) { - return false; - } - - Type otherComponent = otherType.collectionBaseType(); - - return dataType.canConvertFrom(otherComponent); - } - - public int canMoveFrom(Type otherType) { - - if (!otherType.isArrayType()) { - return Type.ReType.change; - } - - if (maxCardinality >= ((ArrayType) otherType).maxCardinality) { - return dataType.canMoveFrom(otherType); - } else if (dataType.canMoveFrom(otherType) == ReType.keep) { - return Type.ReType.check; - } else { - return Type.ReType.change; - } - } - - public boolean canBeAssignedFrom(Type otherType) { - - if (otherType == null) { - return true; - } - - Type otherComponent = otherType.collectionBaseType(); - - return otherComponent != null - && dataType.canBeAssignedFrom(otherComponent); - } - - public Type collectionBaseType() { - return dataType; - } - - public int arrayLimitCardinality() { - return maxCardinality; - } - - public boolean isArrayType() { - return true; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (this == other) { - return this; - } - - if (!other.isArrayType()) { - throw Error.error(ErrorCode.X_42562); - } - - Type otherComponent = other.collectionBaseType(); - - if (dataType.equals(otherComponent)) { - return ((ArrayType) other).maxCardinality > maxCardinality ? other - : this; - } - - Type newComponent = dataType.getAggregateType(otherComponent); - int cardinality = ((ArrayType) other).maxCardinality > maxCardinality - ? ((ArrayType) other).maxCardinality - : maxCardinality; - - return new ArrayType(newComponent, cardinality); - } - - public Type getCombinedType(Session session, Type other, int operation) { - - ArrayType type = (ArrayType) getAggregateType(other); - - if (other == null) { - return type; - } - - if (operation != OpTypes.CONCAT) { - return type; - } - - if (type.maxCardinality == ArrayType.defaultLargeArrayCardinality) { - return type; - } - - long card = (long) ((ArrayType) other).maxCardinality + maxCardinality; - - if (card > ArrayType.defaultLargeArrayCardinality) { - card = ArrayType.defaultLargeArrayCardinality; - } - - return new ArrayType(dataType, (int) card); - } - - public int cardinality(Session session, Object a) { - - if (a == null) { - return 0; - } - - return ((Object[]) a).length; - } - - public Object concat(Session session, Object a, Object b) { - - if (a == null || b == null) { - return null; - } - - int size = ((Object[]) a).length + ((Object[]) b).length; - Object[] array = new Object[size]; - - System.arraycopy(a, 0, array, 0, ((Object[]) a).length); - System.arraycopy(b, 0, array, ((Object[]) a).length, - ((Object[]) b).length); - - return array; - } - - public boolean equals(Object other) { - - if (other == this) { - return true; - } - - if (other instanceof ArrayType) { - return super.equals(other) - && maxCardinality == ((ArrayType) other).maxCardinality - && dataType.equals(((ArrayType) other).dataType); - } - - return false; - } - - public int hashCode(Object a) { - - if (a == null) { - return 0; - } - - int hash = 0; - Object[] array = (Object[]) a; - - for (int i = 0; i < array.length && i < 4; i++) { - hash += dataType.hashCode(array[i]); - } - - return hash; - } - - public void sort(Session session, Object[] array, SortAndSlice sort) { - - TypedComparator comparator = session.getComparator(); - - comparator.setType(dataType, sort); - ArraySort.sort(array, array.length, comparator); - } - - public int deDuplicate(Session session, Object a, SortAndSlice sort) { - - Object[] array = (Object[]) a; - TypedComparator comparator = session.getComparator(); - - comparator.setType(dataType, sort); - - return ArraySort.deDuplicate(array, array.length, comparator); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BinaryData.java b/database/hsqldb/src/org/hsqldb/types/BinaryData.java deleted file mode 100644 index fc8ef476..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BinaryData.java +++ /dev/null @@ -1,321 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.DataInput; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; - -import org.hsqldb.SessionInterface; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; - -/** - * Implementation of BlobData for memory binary data.

    - * A Binary object instance always wraps a non-null byte[] object. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.1 - * @since 1.7.2 - */ -public class BinaryData implements BlobData { - - public static final BinaryData singleBitZero = - new BinaryData(new byte[]{ 0 }, 1); - public static final BinaryData singleBitOne = - new BinaryData(new byte[]{ -0x80 }, 1); - public static final byte[] zeroLengthBytes = new byte[0]; - public static final BinaryData zeroLengthBinary = - new BinaryData(zeroLengthBytes, false); - long id; - protected byte[] data; - private boolean isBits; - private long bitLength; - private int hashCode = 0; - - public static BinaryData getBitData(byte[] data, long bitLength) { - - if (bitLength == 1) { - return data[0] == 0 ? singleBitZero - : singleBitOne; - } - - return new BinaryData(data, bitLength); - } - - /** - * This constructor is used inside the engine when an already serialized - * byte[] is read from a file (.log, .script, .data or text table source). - * In this case clone is false. - * - * When a byte[] is submitted as a parameter of PreparedStatement then - * clone is true. - */ - public BinaryData(byte[] data, boolean clone) { - - if (clone) { - data = Arrays.copyOf(data, data.length); - } - - this.data = data; - this.bitLength = data.length * 8L; - } - - public BinaryData(SessionInterface session, BlobData b1, BlobData b2) { - - long length = (b1.length(session) + b2.length(session)); - - if (length > Integer.MAX_VALUE - || b1.length(session) > Integer.MAX_VALUE - || b2.length(session) > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.X_22001); - } - - data = new byte[(int) length]; - - System.arraycopy(b1.getBytes(session, 0, (int) b1.length(session)), 0, - data, 0, (int) b1.length(session)); - System.arraycopy(b2.getBytes(session, 0, (int) b2.length(session)), 0, - data, (int) b1.length(session), - (int) b2.length(session)); - - this.bitLength = (int) length * 8L; - } - - public BinaryData(byte[] data, long bitLength) { - - this.data = data; - this.bitLength = bitLength; - this.isBits = true; - } - - public BinaryData(long length, DataInput stream) { - - data = new byte[(int) length]; - bitLength = data.length * 8L; - - try { - stream.readFully(data); - } catch (IOException e) { - throw Error.error(ErrorCode.GENERAL_IO_ERROR, e); - } - } - - public byte[] getBytes() { - return data; - } - - public long length(SessionInterface session) { - return data.length; - } - - public long bitLength(SessionInterface session) { - return bitLength; - } - - public boolean isBits() { - return isBits; - } - - public byte[] getBytes(SessionInterface session, long pos, int length) { - - if (!isInLimits(data.length, pos, length)) { - throw new IndexOutOfBoundsException(); - } - - byte[] bytes = new byte[length]; - - System.arraycopy(data, (int) pos, bytes, 0, length); - - return bytes; - } - - public BlobData getBlob(SessionInterface session, long pos, long length) { - throw Error.runtimeError(ErrorCode.U_S0500, "BinaryData"); - } - - public InputStream getBinaryStream(SessionInterface session) { - return new BlobInputStream(session, this, 0L, length(session)); - } - - public InputStream getBinaryStream(SessionInterface session, long pos, - long length) { - - if (!isInLimits(data.length, pos, length)) { - throw new IndexOutOfBoundsException(); - } - - return new BlobInputStream(session, this, pos, length(session)); - } - - public void setBytes(SessionInterface session, long pos, byte[] bytes, - int offset, int length) { - - if (!isInLimits(data.length, pos, 0)) { - throw new IndexOutOfBoundsException(); - } - - if (!isInLimits(data.length, pos, length)) { - data = (byte[]) ArrayUtil.resizeArray(data, (int) pos + length); - } - - System.arraycopy(bytes, offset, data, (int) pos, length); - - bitLength = data.length * 8L; - } - - public void setBytes(SessionInterface session, long pos, byte[] bytes) { - setBytes(session, pos, bytes, 0, bytes.length); - } - - public void setBytes(SessionInterface session, long pos, BlobData b, - long offset, long length) { - - if (length > Integer.MAX_VALUE) { - throw new IndexOutOfBoundsException(); - } - - byte[] bytes = b.getBytes(session, offset, (int) length); - - setBytes(session, pos, bytes, 0, bytes.length); - } - - public void setBinaryStream(SessionInterface session, long pos, - InputStream in) { - - // - } - - public void truncate(SessionInterface session, long len) { - - if (data.length > len) { - data = (byte[]) ArrayUtil.resizeArray(data, (int) len); - bitLength = data.length * 8L; - } - } - - public BlobData duplicate(SessionInterface session) { - return new BinaryData(data, true); - } - - public long position(SessionInterface session, byte[] pattern, - long start) { - - if (pattern.length > data.length) { - return -1; - } - - if (start >= data.length) { - return -1; - } - - return ArrayUtil.find(data, (int) start, data.length, pattern); - } - - public long position(SessionInterface session, BlobData pattern, - long start) { - - if (pattern.length(session) > data.length) { - return -1; - } - - byte[] bytes = pattern.getBytes(session, 0, - (int) pattern.length(session)); - - return position(session, bytes, start); - } - - public long nonZeroLength(SessionInterface session) { - - for (int i = data.length - 1; i > 0; i--) { - if (data[i] != 0) { - return i + 1; - } - } - - return data.length; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public int getStreamBlockSize() { - return 512 * 1024; - } - - public boolean isClosed() { - return false; - } - - public void free() {} - - public void setSession(SessionInterface session) {} - - static boolean isInLimits(long fullLength, long pos, long len) { - return pos >= 0 && len >= 0 && pos + len <= fullLength; - } - - public boolean isBinary() { - return true; - } - - public boolean equals(Object other) { - - if (other instanceof BinaryData) { - return Type.SQL_VARBINARY.compare(null, this, other) == 0; - } - - return false; - } - - public int hashCode() { - - if (hashCode == 0) { - int code = 0; - - for (int i = 0; i < data.length && i < 32; i++) { - code = code * 31 + (0xff & data[i]); - } - - hashCode = code; - } - - return hashCode; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BinaryType.java b/database/hsqldb/src/org/hsqldb/types/BinaryType.java deleted file mode 100644 index 1cfc0c59..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BinaryType.java +++ /dev/null @@ -1,806 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.StringConverter; - -/** - * Type implementation for BINARY, VARBINARY and (part) BLOB.

    - - * SQL:2008 Standard specifies silent truncation of zero bytes at the end of the - * binary strings used for assignment and concatenation.

    - * - * A binary string of type BINARY VARYING and BLOB when assigned to a column - * of similar type but shorter maximum length.

    - * - * The Second operand of a concatenation when the length of the result exceeds - * the maximum implementation-dependent length of BINARY VARYING and BLOB - * binary strings.

    - * - * The behaviour is similar to trimming of space characters from strings of - * CHARACTER VARYING and CLOB types.

    - * - * In most real-world use-cases, all the bytes of variable-length binary values - * stored in a database are significant and should not be discarded.

    - * - * HSQLDB follows the Standard completely, despite this inadequacy.

    - * - * Comparison of binary values follows the Standard. When two values are not - * the same length and all the bytes of the shorter value equal the initial - * sequence of bytes of the longer value, then the shorter value is the smaller. - * The Standard treats this determination as implementation dependent.

    - * - * BIT types, which were part of the SQL:1999, can be converted to and from - * BINARY. The BIT strings may be padded with zero bits for byte alignment.

    - * - * As an extension to the Standard, HSQLDB supports cast from CHARACTER types - * to BINARY. The length of the string must be even and all character - * must be hexadecimal characters. - * - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public class BinaryType extends Type { - - public static final long maxBinaryPrecision = Integer.MAX_VALUE; - - protected BinaryType(int type, long precision) { - super(Types.SQL_VARBINARY, type, precision, 0); - } - - public int displaySize() { - return precision > Integer.MAX_VALUE ? Integer.MAX_VALUE - : (int) precision; - } - - public int getJDBCTypeCode() { - return typeCode == Types.SQL_BINARY ? Types.BINARY - : Types.VARBINARY; - } - - public Class getJDBCClass() { - return byte[].class; - } - - public String getJDBCClassName() { - return "[B"; - } - - public String getNameString() { - return typeCode == Types.SQL_BINARY ? Tokens.T_BINARY - : Tokens.T_VARBINARY; - } - - public String getNameFullString() { - return typeCode == Types.SQL_BINARY ? Tokens.T_BINARY - : "BINARY VARYING"; - } - - public String getDefinition() { - - if (precision == 0) { - return getNameString(); - } - - StringBuilder sb = new StringBuilder(16); - - sb.append(getNameString()); - sb.append('('); - sb.append(precision); - sb.append(')'); - - return sb.toString(); - } - - public boolean isBinaryType() { - return true; - } - - public boolean acceptsPrecision() { - return true; - } - - public long getMaxPrecision() { - return maxBinaryPrecision; - } - - public boolean requiresPrecision() { - return typeCode == Types.SQL_VARBINARY; - } - - /** - * relaxes the SQL standard list to avoid problems with conversion of - * literals and java method parameter type issues - */ - public int precedenceDegree(Type other) { - - if (other.typeCode == typeCode) { - return 0; - } - - if (!other.isBinaryType()) { - return Integer.MIN_VALUE; - } - - switch (typeCode) { - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - return Integer.MIN_VALUE; - - case Types.SQL_BINARY : - return other.typeCode == Types.SQL_BLOB ? 4 - : 2; - - case Types.SQL_VARBINARY : - return other.typeCode == Types.SQL_BLOB ? 4 - : 2; - - case Types.SQL_BLOB : - return other.typeCode == Types.SQL_BINARY ? -4 - : -2; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "BinaryType"); - } - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (typeCode == other.typeCode) { - return precision >= other.precision ? this - : other; - } - - if (other.isCharacterType()) { - return other.getAggregateType(this); - } - - switch (other.typeCode) { - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : { - long bytePrecision = (other.precision + 7) / 8; - - return precision >= bytePrecision ? this - : getBinaryType( - this.typeCode, - bytePrecision); - } - case Types.SQL_BINARY : - return precision >= other.precision ? this - : getBinaryType(typeCode, - other.precision); - - case Types.SQL_VARBINARY : - if (typeCode == Types.SQL_BLOB) { - return precision >= other.precision ? this - : getBinaryType( - typeCode, - other.precision); - } else { - return other.precision >= precision ? other - : getBinaryType( - other.typeCode, - precision); - } - case Types.SQL_BLOB : - return other.precision >= precision ? other - : getBinaryType( - other.typeCode, precision); - - case Types.SQL_GUID : - return other; - - default : - throw Error.error(ErrorCode.X_42562); - } - } - - /** - * Returns type for concat - */ - public Type getCombinedType(Session session, Type other, int operation) { - - if (operation != OpTypes.CONCAT) { - return getAggregateType(other); - } - - Type newType; - long newPrecision = this.precision + other.precision; - - switch (other.typeCode) { - - case Types.SQL_ALL_TYPES : - return this; - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - newPrecision = this.precision + (other.precision + 7) / 8; - newType = this; - break; - - case Types.SQL_GUID : - case Types.SQL_BINARY : - newType = this; - break; - - case Types.SQL_VARBINARY : - newType = (typeCode == Types.SQL_BLOB) ? this - : other; - break; - - case Types.SQL_BLOB : - newType = other; - break; - - default : - throw Error.error(ErrorCode.X_42561); - } - - if (newPrecision > maxBinaryPrecision) { - if (typeCode == Types.SQL_BINARY) { - - // Standard disallows type length reduction - throw Error.error(ErrorCode.X_42570); - } else if (typeCode == Types.SQL_VARBINARY) { - newPrecision = maxBinaryPrecision; - } - } - - return getBinaryType(newType.typeCode, newPrecision); - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - if (a instanceof BinaryData && b instanceof BinaryData) { - byte[] data1 = ((BinaryData) a).getBytes(); - byte[] data2 = ((BinaryData) b).getBytes(); - int length = data1.length > data2.length ? data2.length - : data1.length; - - for (int i = 0; i < length; i++) { - if (data1[i] == data2[i]) { - continue; - } - - return (((int) data1[i]) & 0xff) > (((int) data2[i]) & 0xff) - ? 1 - : -1; - } - - if (data1.length == data2.length) { - return 0; - } - - if (typeCode == Types.SQL_BINARY) { - if (data1.length > data2.length) { - for (int i = data2.length; i < data1.length; i++) { - if (data1[i] != 0) { - return 1; - } - } - } else { - for (int i = data1.length; i < data2.length; i++) { - if (data2[i] != 0) { - return -1; - } - } - } - - return 0; - } - - return data1.length > data2.length ? 1 - : -1; - } - - throw Error.runtimeError(ErrorCode.U_S0500, "BinaryType"); - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - return castOrConvertToType(session, a, this, false); - } - - public Object castToType(SessionInterface session, Object a, - Type otherType) { - return castOrConvertToType(session, a, otherType, true); - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - return castOrConvertToType(session, a, otherType, false); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof byte[]) { - return new BinaryData((byte[]) a, true); - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - return ((BlobData) a).getBytes(); - } - - Object castOrConvertToType(SessionInterface session, Object a, - Type otherType, boolean cast) { - - BlobData b; - - if (a == null) { - return null; - } - - switch (otherType.typeCode) { - - // non-SQL feature, for compatibility with previous versions - // also used by HEXTORAW function - case Types.SQL_CLOB : - a = Type.SQL_VARCHAR.convertToType(session, a, otherType); - - // fall through - case Types.SQL_VARCHAR : - case Types.SQL_CHAR : { - b = session.getScanner().convertToBinary((String) a, false); - otherType = getBinaryType(Types.SQL_VARBINARY, - b.length(session)); - - break; - } - case Types.SQL_BIT : { - b = (BlobData) a; - otherType = getBinaryType(Types.SQL_VARBINARY, - b.length(session)); - - break; - } - case Types.SQL_GUID : - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_BLOB : - b = (BlobData) a; - break; - - default : - throw Error.error(ErrorCode.X_22501); - } - - if (precision == 0) { - return b; // never a blob - } - - if (otherType.typeCode == Types.SQL_BLOB) { - long blobLength = b.length(session); - - if (blobLength > precision) { - throw Error.error(ErrorCode.X_22001); - } - - byte[] bytes = b.getBytes(session, 0, (int) blobLength); - - b = new BinaryData(bytes, false); - } - - if (b.length(session) > precision) { - if (!cast && session instanceof Session) { - if (!((Session) session).database.sqlTruncateTrailing) { - throw Error.error(ErrorCode.X_22001); - } - } - - if (b.nonZeroLength(session) > precision) { - if (!cast) { - throw Error.error(ErrorCode.X_22001); - } - - session.addWarning(Error.error(ErrorCode.W_01004)); - } - } - - switch (typeCode) { - - case Types.SQL_BINARY : { - if (b.length(session) > precision) { - byte[] data = b.getBytes(session, 0, (int) precision); - - b = new BinaryData(data, false); - } else if (b.length(session) < precision) { - byte[] data = (byte[]) ArrayUtil.resizeArray(b.getBytes(), - (int) precision); - - b = new BinaryData(data, false); - } - - return b; - } - case Types.SQL_VARBINARY : { - if (b.length(session) > precision) { - byte[] data = b.getBytes(session, 0, (int) precision); - - b = new BinaryData(data, false); - } - - return b; - } - default : - } - - throw Error.error(ErrorCode.X_22501); - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return a; - } - - if (a instanceof byte[]) { - return new BinaryData((byte[]) a, false); - } else if (a instanceof BinaryData) { - return a; - } else if (a instanceof String) { - return castOrConvertToType(session, a, Type.SQL_VARCHAR, false); - } - - throw Error.error(ErrorCode.X_22501); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return StringConverter.byteArrayToHexString(((BlobData) a).getBytes()); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - return StringConverter.byteArrayToSQLHexString( - ((BinaryData) a).getBytes()); - } - - public void convertToJSON(Object a, StringBuilder sb) { - - if (a == null) { - sb.append("null"); - - return; - } - - sb.append('"'); - sb.append(convertToString(a)); - sb.append('"'); - } - - public boolean canConvertFrom(Type otherType) { - - return otherType.typeCode == Types.SQL_ALL_TYPES - || otherType.isBinaryType() || otherType.isBitType() - || otherType.isCharacterType(); - } - - public int canMoveFrom(Type otherType) { - - if (otherType.isBitType() || otherType.isCharacterType()) { - return ReType.change; - } - - switch (typeCode) { - - case Types.SQL_VARBINARY : { - if (otherType.typeCode == typeCode) { - return precision >= otherType.precision ? ReType.keep - : ReType.check; - } - - if (otherType.typeCode == Types.SQL_BINARY) { - return precision >= otherType.precision ? ReType.keep - : ReType.change; - } - - if (otherType.typeCode == Types.SQL_GUID) { - return precision >= otherType.precision ? ReType.keep - : ReType.change; - } - - break; - } - case Types.SQL_BINARY : { - if (otherType.typeCode == typeCode) { - return precision == otherType.precision ? ReType.keep - : ReType.change; - } - - if (otherType.typeCode == Types.SQL_GUID) { - return precision == otherType.precision ? ReType.keep - : ReType.change; - } - - break; - } - case Types.SQL_BLOB : { - if (otherType.typeCode == typeCode) { - return precision >= otherType.precision ? ReType.keep - : ReType.change; - } - - break; - } - default : - } - - return ReType.change; - } - - public long position(SessionInterface session, BlobData data, - BlobData otherData, Type otherType, long offset) { - - if (data == null || otherData == null) { - return -1L; - } - - long otherLength = data.length(session); - - if (offset + otherLength > data.length(session)) { - return -1; - } - - return data.position(session, otherData, offset); - } - - public BlobData substring(SessionInterface session, BlobData data, - long offset, long length, boolean hasLength) { - - if (length < 0) { - throw Error.error(ErrorCode.X_22011); - } - - long dataLength = data.length(session); - LongPair segment = CharacterType.substringParams(dataLength, offset, - length, hasLength); - - offset = segment.a; - length = segment.b; - - if (data instanceof BinaryData) { - byte[] bytes = data.getBytes(session, offset, (int) length); - - return new BinaryData(bytes, false); - } else if (data instanceof BlobData) { - BlobData blob = ((BlobData) data).getBlob(session, offset, length); - - return blob; - } else { - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - int getRightTrimSize(BlobData data) { - - byte[] bytes = data.getBytes(); - int endindex = bytes.length; - - for (--endindex; endindex >= 0 && bytes[endindex] == 0; endindex--) {} - - return ++endindex; - } - - public BlobData trim(Session session, BlobData data, int trim, - boolean leading, boolean trailing) { - - if (data == null) { - return null; - } - - long length = data.length(session); - - if (length > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.X_22027); - } - - byte[] bytes = data.getBytes(session, 0, (int) length); - int endindex = bytes.length; - - if (trailing) { - for (--endindex; endindex >= 0 && bytes[endindex] == trim; - endindex--) {} - - endindex++; - } - - int startindex = 0; - - if (leading) { - while (startindex < endindex && bytes[startindex] == trim) { - startindex++; - } - } - - byte[] newBytes = bytes; - - if (startindex != 0 || endindex != bytes.length) { - newBytes = new byte[endindex - startindex]; - - System.arraycopy(bytes, startindex, newBytes, 0, - endindex - startindex); - } - - if (typeCode == Types.SQL_BLOB) { - BlobData blob = session.createBlob(newBytes.length); - - blob.setBytes(session, 0, newBytes); - - return blob; - } else { - return new BinaryData(newBytes, newBytes == bytes); - } - } - - public BlobData overlay(Session session, BlobData data, BlobData overlay, - long offset, long length, boolean hasLength) { - - if (data == null || overlay == null) { - return null; - } - - if (!hasLength) { - length = overlay.length(session); - } - - switch (typeCode) { - - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : { - BinaryData binary = - new BinaryData(session, - substring(session, data, 0, offset, true), - overlay); - - binary = new BinaryData(session, binary, - substring(session, data, - offset + length, 0, false)); - - return binary; - } - case Types.SQL_BLOB : { - byte[] bytes = substring(session, data, 0, offset, - false).getBytes(); - long blobLength = data.length(session) - + overlay.length(session) - length; - BlobData blob = session.createBlob(blobLength); - - blob.setBytes(session, 0, bytes); - blob.setBytes(session, blob.length(session), - overlay.getBytes()); - - bytes = substring(session, data, offset + length, 0, - false).getBytes(); - - blob.setBytes(session, blob.length(session), bytes); - - return blob; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "BinaryType"); - } - } - - public Object concat(Session session, Object a, Object b) { - - if (a == null || b == null) { - return null; - } - - long length = ((BlobData) a).length(session) - + ((BlobData) b).length(session); - - if (length > precision) { - throw Error.error(ErrorCode.X_22001); - } - - if (typeCode == Types.SQL_BLOB) { - BlobData blob = session.createBlob(length); - - blob.setBytes(session, 0, ((BlobData) a), 0, - ((BlobData) a).length(session)); - blob.setBytes(session, ((BlobData) a).length(session), - ((BlobData) b), 0, ((BlobData) b).length(session)); - - return blob; - } else { - return new BinaryData(session, (BlobData) a, (BlobData) b); - } - } - - /* @todo check and adjust max precision */ - public static BinaryType getBinaryType(int type, long precision) { - - switch (type) { - - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - return new BinaryType(type, precision); - - case Types.SQL_BLOB : - return new BlobType(precision); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "BinaryType"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BinaryUUIDType.java b/database/hsqldb/src/org/hsqldb/types/BinaryUUIDType.java deleted file mode 100644 index f32a9b05..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BinaryUUIDType.java +++ /dev/null @@ -1,536 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.util.UUID; - -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.StringConverter; - -/** - * Type implementation for BINARY UUID.

    - - * A binary UUID is exactly 16 bytes.

    - * - * Cast from CHARACTER types to BINARY converts a hexadecimal UUID string with - * or without the dashes.

    - * - * Cast to CHARACTER types converts to a hexadecimal UUID string. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 2.3.4 - */ -public class BinaryUUIDType extends BinaryType { - - public static final int binaryUUIDPrecision = 16; - - protected BinaryUUIDType() { - super(Types.SQL_GUID, binaryUUIDPrecision); - } - - public int displaySize() { - return 36; - } - - public int getJDBCTypeCode() { - return Types.BINARY; - } - - public Class getJDBCClass() { - return byte[].class; - } - - public String getJDBCClassName() { - return "[B"; - } - - public String getNameString() { - return Tokens.T_UUID; - } - - public String getNameFullString() { - return Tokens.T_UUID; - } - - public String getDefinition() { - return getNameString(); - } - - public boolean isBinaryType() { - return true; - } - - public boolean isUUIDType() { - return true; - } - - public boolean acceptsPrecision() { - return false; - } - - public long getMaxPrecision() { - return binaryUUIDPrecision; - } - - public boolean requiresPrecision() { - return false; - } - - /** - * relaxes the SQL standard list to avoid problems with conversion of - * literals and java method parameter type issues - */ - public int precedenceDegree(Type other) { - - if (other.typeCode == typeCode) { - return 0; - } - - if (!other.isBinaryType()) { - return Integer.MIN_VALUE; - } - - return other.typeCode == Types.SQL_BLOB ? 4 - : 2; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (typeCode == other.typeCode) { - return this; - } - - if (other.isCharacterType()) { - return this; - } - - switch (other.typeCode) { - - case Types.SQL_GUID : - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_BLOB : - return this; - - default : - throw Error.error(ErrorCode.X_42562); - } - } - - /** - * Returns type for concat - */ - public Type getCombinedType(Session session, Type other, int operation) { - return Type.SQL_VARBINARY_DEFAULT; - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - if (a instanceof BinaryData && b instanceof BinaryData) { - byte[] data1 = ((BinaryData) a).getBytes(); - byte[] data2 = ((BinaryData) b).getBytes(); - int length = data1.length > data2.length ? data2.length - : data1.length; - - for (int i = 0; i < length; i++) { - if (data1[i] == data2[i]) { - continue; - } - - return (((int) data1[i]) & 0xff) > (((int) data2[i]) & 0xff) - ? 1 - : -1; - } - - if (data1.length == data2.length) { - return 0; - } - - return data1.length > data2.length ? 1 - : -1; - } - - throw Error.runtimeError(ErrorCode.U_S0500, "BinaryUUIDType"); - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - return castOrConvertToType(session, a, this, false); - } - - public Object castToType(SessionInterface session, Object a, - Type otherType) { - return castOrConvertToType(session, a, otherType, true); - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - return castOrConvertToType(session, a, otherType, false); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof byte[]) { - return new BinaryData((byte[]) a, true); - } - - if (a instanceof UUID) { - return getBinary((UUID) a); - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - return getJavaUUID((BinaryData) a); - } - - Object castOrConvertToType(SessionInterface session, Object a, - Type otherType, boolean cast) { - - BlobData b; - - if (a == null) { - return null; - } - - switch (otherType.typeCode) { - - case Types.SQL_CLOB : - a = Type.SQL_VARCHAR.convertToType(session, a, otherType); - - // fall through - case Types.SQL_VARCHAR : - case Types.SQL_CHAR : { - b = session.getScanner().convertToBinary((String) a, true); - otherType = this; - - break; - } - case Types.SQL_GUID : - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_BLOB : - b = (BlobData) a; - break; - - default : - throw Error.error(ErrorCode.X_22501); - } - - if (otherType.typeCode == Types.SQL_BLOB) { - long blobLength = b.length(session); - - if (blobLength != precision) { - throw Error.error(ErrorCode.X_22001); - } - - byte[] bytes = b.getBytes(session, 0, (int) precision); - - b = new BinaryData(bytes, false); - - } else { - if (b.length(session) != precision) { - throw Error.error(ErrorCode.X_22001); - } - - } - return b; - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return a; - } - - if (a instanceof byte[]) { - BinaryData b = new BinaryData((byte[]) a, false); - - castOrConvertToType(session, b, Type.SQL_VARBINARY, false); - } else if (a instanceof BinaryData) { - return castOrConvertToType(session, a, Type.SQL_VARBINARY, false); - } else if (a instanceof String) { - return castOrConvertToType(session, a, Type.SQL_VARCHAR, false); - } - - throw Error.error(ErrorCode.X_22501); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return StringConverter.toStringUUID(((BlobData) a).getBytes()); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - return StringConverter.toStringUUID(((BlobData) a).getBytes()); - } - - public boolean canConvertFrom(Type otherType) { - return otherType.typeCode == Types.SQL_ALL_TYPES - || otherType.isBinaryType() || otherType.isCharacterType(); - } - - public int canMoveFrom(Type otherType) { - - if (otherType == this) { - return ReType.keep; - } - - switch (otherType.typeCode) { - - case Types.SQL_GUID : - return ReType.keep; - - case Types.SQL_VARBINARY : - case Types.SQL_BINARY : - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : - return ReType.change; - - default : - return ReType.change; - } - } - - public long position(SessionInterface session, BlobData data, - BlobData otherData, Type otherType, long offset) { - - if (data == null || otherData == null) { - return -1L; - } - - long otherLength = data.length(session); - - if (offset + otherLength > data.length(session)) { - return -1; - } - - return data.position(session, otherData, offset); - } - - public BlobData substring(SessionInterface session, BlobData data, - long offset, long length, boolean hasLength) { - - long end; - long dataLength = data.length(session); - - if (hasLength) { - end = offset + length; - } else { - end = dataLength > offset ? dataLength - : offset; - } - - if (offset > end) { - throw Error.error(ErrorCode.X_22011); - } - - if (end < 0) { - - // return zero length data - offset = 0; - end = 0; - } - - if (offset < 0) { - offset = 0; - } - - if (end > dataLength) { - end = dataLength; - } - - length = end - offset; - - // change method signature to take long - byte[] bytes = data.getBytes(session, offset, (int) length); - - return new BinaryData(bytes, false); - } - - int getRightTrimSize(BlobData data) { - - byte[] bytes = data.getBytes(); - int endindex = bytes.length; - - for (--endindex; endindex >= 0 && bytes[endindex] == 0; endindex--) {} - - return ++endindex; - } - - public BlobData trim(Session session, BlobData data, int trim, - boolean leading, boolean trailing) { - - if (data == null) { - return null; - } - - long length = data.length(session); - - if (length > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.X_22027); - } - - byte[] bytes = data.getBytes(session, 0, (int) length); - int endindex = bytes.length; - - if (trailing) { - for (--endindex; endindex >= 0 && bytes[endindex] == trim; - endindex--) {} - - endindex++; - } - - int startindex = 0; - - if (leading) { - while (startindex < endindex && bytes[startindex] == trim) { - startindex++; - } - } - - byte[] newBytes = bytes; - - if (startindex != 0 || endindex != bytes.length) { - newBytes = new byte[endindex - startindex]; - - System.arraycopy(bytes, startindex, newBytes, 0, - endindex - startindex); - } - - return new BinaryData(newBytes, newBytes == bytes); - } - - public BlobData overlay(Session session, BlobData data, BlobData overlay, - long offset, long length, boolean hasLength) { - - if (data == null || overlay == null) { - return null; - } - - if (!hasLength) { - length = overlay.length(session); - } - - BinaryData binary = - new BinaryData(session, substring(session, data, 0, offset, true), - overlay); - - binary = new BinaryData(session, binary, - substring(session, data, offset + length, 0, - false)); - - return binary; - } - - public Object concat(Session session, Object a, Object b) { - - if (a == null || b == null) { - return null; - } - - long length = ((BlobData) a).length(session) - + ((BlobData) b).length(session); - - if (length > precision) { - throw Error.error(ErrorCode.X_22001); - } - - return new BinaryData(session, (BlobData) a, (BlobData) b); - } - - public static BinaryData getBinary(long hi, long lo) { - return new BinaryData(ArrayUtil.toByteArray(hi, lo), false); - } - - public static BinaryData getBinary(UUID uuid) { - return getBinary(uuid.getMostSignificantBits(), - uuid.getLeastSignificantBits()); - } - - public static UUID getJavaUUID(BinaryData data) { - - if (data == null) { - return null; - } - - byte[] bytes = data.getBytes(); - long msb = ArrayUtil.byteSequenceToLong(bytes, 0); - long lsb = ArrayUtil.byteSequenceToLong(bytes, 8); - - return new UUID(msb, lsb); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BitType.java b/database/hsqldb/src/org/hsqldb/types/BitType.java deleted file mode 100644 index ce345bb7..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BitType.java +++ /dev/null @@ -1,653 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.util.BitSet; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.StringConverter; -import org.hsqldb.map.BitMap; - -/** - * - * Operations allowed on BIT strings are CONCAT, SUBSTRING, POSITION, - * BIT_LENGTH and OCTET_LENGTH.

    - * - * BIT values can be cast to BINARY and vice-versa. In casts, BIT values are - * converted to their counterpart BINARY values by treating each set of 8 bits - * or less as a single byte. The first bit of a BIT string is treated as the most - * significant bit of the resulting byte value. Binary values are converted by - * treating the bits in the sequence of bytes as sequence of bits in the BIT - * string

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public final class BitType extends BinaryType { - - static final long maxBitPrecision = 1024; - - public BitType(int type, long precision) { - super(type, precision); - } - - public int displaySize() { - return (int) precision; - } - - public int getJDBCTypeCode() { - return Types.BIT; - } - - public Class getJDBCClass() { - return byte[].class; - } - - public String getJDBCClassName() { - return "[B"; - } - - public int getSQLGenericTypeCode() { - return typeCode; - } - - public String getNameString() { - return typeCode == Types.SQL_BIT ? Tokens.T_BIT - : "BIT VARYING"; - } - - public String getDefinition() { - - if (precision == 0) { - return getNameString(); - } - - StringBuilder sb = new StringBuilder(16); - - sb.append(getNameString()); - sb.append('('); - sb.append(precision); - sb.append(')'); - - return sb.toString(); - } - - public boolean isBitType() { - return true; - } - - public long getMaxPrecision() { - return maxBitPrecision; - } - - public boolean requiresPrecision() { - return typeCode == Types.SQL_BIT_VARYING; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (typeCode == other.typeCode) { - return precision >= other.precision ? this - : other; - } - - switch (other.typeCode) { - - case Types.SQL_BIT : - return precision >= other.precision ? this - : getBitType(typeCode, - other.precision); - - case Types.SQL_BIT_VARYING : - return other.precision >= precision ? other - : getBitType( - other.typeCode, precision); - - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_BLOB : - return other; - - default : - throw Error.error(ErrorCode.X_42562); - } - } - - /** - * Returns type for concat - */ - public Type getCombinedType(Session session, Type other, int operation) { - - if (operation != OpTypes.CONCAT) { - return getAggregateType(other); - } - - Type newType; - long newPrecision = precision + other.precision; - - switch (other.typeCode) { - - case Types.SQL_ALL_TYPES : - return this; - - case Types.SQL_BIT : - newType = this; - break; - - case Types.SQL_BIT_VARYING : - newType = other; - break; - - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_BLOB : - return other.getCombinedType(session, this, operation); - - default : - throw Error.error(ErrorCode.X_42562); - } - - if (newPrecision > maxBitPrecision) { - if (typeCode == Types.SQL_BIT) { - - // Standard disallows type length reduction - throw Error.error(ErrorCode.X_42570); - } - - newPrecision = maxBitPrecision; - } - - return getBitType(newType.typeCode, newPrecision); - } - - public int compare(Session session, Object a, Object b) { - - int i = super.compare(session, a, b); - - if (i == 0 && a != null) { - if (((BinaryData) a).bitLength(null) - == ((BinaryData) b).bitLength(null)) { - return 0; - } - - return ((BinaryData) a).bitLength(null) - > ((BinaryData) b).bitLength(null) ? 1 - : -1; - } - - return i; - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - return castOrConvertToType(null, a, this, false); - } - - public Object castToType(SessionInterface session, Object a, - Type otherType) { - return castOrConvertToType(session, a, otherType, true); - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - return castOrConvertToType(session, a, otherType, false); - } - - Object castOrConvertToType(SessionInterface session, Object a, - Type otherType, boolean cast) { - - BlobData b; - - if (a == null) { - return null; - } - - switch (otherType.typeCode) { - - case Types.SQL_VARCHAR : - case Types.SQL_CHAR : { - b = session.getScanner().convertToBit((String) a); - otherType = getBitType(Types.SQL_BIT_VARYING, - b.length(session)); - - break; - } - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_BLOB : - b = (BlobData) a; - break; - - case Types.SQL_BOOLEAN : { - if (precision != 1) { - throw Error.error(ErrorCode.X_22501); - } - - if (((Boolean) a).booleanValue()) { - return BinaryData.singleBitOne; - } else { - return BinaryData.singleBitZero; - } - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - if (precision != 1) { - throw Error.error(ErrorCode.X_22501); - } - - if (((NumberType) otherType).compareToZero(a) == 0) { - return BinaryData.singleBitZero; - } else { - return BinaryData.singleBitOne; - } - } - default : - throw Error.error(ErrorCode.X_22501); - } - - // no special 0 bit consideration - if (b.bitLength(session) > precision) { - if (!cast) { - throw Error.error(ErrorCode.X_22001); - } - - session.addWarning(Error.error(ErrorCode.W_01004)); - } - - int bytePrecision = (int) ((precision + 7) / 8); - - if (otherType.typeCode == Types.SQL_BLOB) { - byte[] bytes = b.getBytes(session, 0, bytePrecision); - - b = new BinaryData(bytes, precision); - } - - switch (typeCode) { - - case Types.SQL_BIT : { - if (b.bitLength(session) == precision) { - return b; - } - - if (b.length(session) > bytePrecision) { - byte[] data = b.getBytes(session, 0, bytePrecision); - - b = new BinaryData(data, precision); - } else if (b.length(session) <= bytePrecision) { - byte[] data = (byte[]) ArrayUtil.resizeArray(b.getBytes(), - bytePrecision); - - b = new BinaryData(data, precision); - } - - break; - } - case Types.SQL_BIT_VARYING : { - if (b.bitLength(session) <= precision) { - return b; - } - - if (b.length(session) > bytePrecision) { - byte[] data = b.getBytes(session, 0, bytePrecision); - - b = new BinaryData(data, precision); - } - - break; - } - default : - throw Error.error(ErrorCode.X_22501); - } - - byte[] data = b.getBytes(); - - for (int i = (int) precision; i < b.length(session) * 8; i++) { - BitMap.unset(data, i); - } - - return b; - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return a; - } - - if (a instanceof byte[]) { - BinaryData data = new BinaryData((byte[]) a, ((byte[]) a).length); - - return convertToTypeLimits(session, data); - } else if (a instanceof BinaryData) { - return convertToTypeLimits(session, a); - } else if (a instanceof String) { - return convertToType(session, a, Type.SQL_VARCHAR); - } else if (a instanceof Boolean) { - return convertToType(session, a, Type.SQL_BOOLEAN); - } else if (a instanceof Integer) { - return convertToType(session, a, Type.SQL_INTEGER); - } else if (a instanceof Long) { - return convertToType(session, a, Type.SQL_BIGINT); - } else if (a instanceof BitSet) { - BitSet bs = (BitSet) a; - byte[] bytes = - new byte[((int) precision + Byte.SIZE - 1) / Byte.SIZE]; - - if (bs.length() > precision) { - throw Error.error(ErrorCode.X_22501); - } - - for (int i = 0; i < bs.length(); i++) { - boolean set = bs.get(i); - - if (set) { - BitMap.set(bytes, i); - } - } - - return new BinaryData(bytes, precision); - } - - throw Error.error(ErrorCode.X_22501); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - return convertToDefaultType(session, a); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return StringConverter.byteArrayToBitString( - ((BinaryData) a).getBytes(), - (int) ((BinaryData) a).bitLength(null)); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - return StringConverter.byteArrayToSQLBitString( - ((BinaryData) a).getBytes(), - (int) ((BinaryData) a).bitLength(null)); - } - - public void convertToJSON(Object a, StringBuilder sb) { - - if (a == null) { - sb.append("null"); - - return; - } - - sb.append('"'); - sb.append(convertToString(a)); - sb.append('"'); - } - - - public boolean canConvertFrom(Type otherType) { - - return otherType.typeCode == Types.SQL_ALL_TYPES - || otherType.isBinaryType() - || (precision == 1 - && (otherType.isIntegralType() || otherType - .isBooleanType()) || otherType.isCharacterType()); - } - - public int canMoveFrom(Type otherType) { - - switch (typeCode) { - - case Types.SQL_BIT : { - if (otherType.typeCode == typeCode) { - return precision == otherType.precision ? ReType.keep - : ReType.change; - } - - return ReType.change; - } - case Types.SQL_BIT_VARYING : { - return otherType.isBitType() - && precision >= otherType.precision ? ReType.keep - : ReType.change; - } - default : - return ReType.change; - } - } - - /* @todo - implement */ - public long position(SessionInterface session, BlobData data, - BlobData otherData, Type otherType, long offset) { - - if (data == null || otherData == null) { - return -1L; - } - - long otherLength = data.bitLength(session); - - if (offset + otherLength > data.bitLength(session)) { - return -1; - } - - throw Error.runtimeError(ErrorCode.U_S0500, "BitType"); - } - - public BlobData substring(SessionInterface session, BlobData data, - long offset, long length, boolean hasLength) { - - long end; - long dataLength = data.bitLength(session); - - if (hasLength) { - end = offset + length; - } else { - end = dataLength > offset ? dataLength - : offset; - } - - if (end < offset) { - throw Error.error(ErrorCode.X_22011); - } - - if (end < 0) { - - // return zero length data - offset = 0; - end = 0; - } - - if (offset < 0) { - offset = 0; - } - - if (end > dataLength) { - end = dataLength; - } - - length = end - offset; - - byte[] dataBytes = data.getBytes(); - byte[] bytes = new byte[(int) (length + 7) / 8]; - - for (int i = (int) offset; i < end; i++) { - if (BitMap.isSet(dataBytes, i)) { - BitMap.set(bytes, i - (int) offset); - } - } - - return new BinaryData(bytes, length); - } - - int getRightTrimSize(BinaryData data) { - - int i = (int) data.bitLength(null) - 1; - byte[] bytes = data.getBytes(); - - for (; i >= 0; i--) { - if (BitMap.isSet(bytes, i)) { - break; - } - } - - return i + 1; - } - - public BlobData overlay(Session session, BlobData value, BlobData overlay, - long offset, long length, boolean hasLength) { - - if (value == null || overlay == null) { - return null; - } - - if (!hasLength) { - length = overlay.bitLength(session); - } - - switch (typeCode) { - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : { - byte[] data = - (byte[]) ArrayUtil.duplicateArray(value.getBytes()); - byte[] overlaydata = overlay.getBytes(); - - for (int i = 0, pos = (int) offset; i < length; - pos += 8, i++) { - int count = 8; - - if (length - pos < 8) { - count = (int) length - pos; - } - - BitMap.overlay(data, pos, overlaydata[i], count); - } - - BinaryData binary = new BinaryData(data, - value.bitLength(session)); - - return binary; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "BitType"); - } - } - - public Object concat(Session session, Object a, Object b) { - - if (a == null || b == null) { - return null; - } - - long length = ((BlobData) a).bitLength(session) - + ((BlobData) b).bitLength(session); - - if (length > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.W_01000); - } - - byte[] aData = ((BlobData) a).getBytes(); - byte[] bData = ((BlobData) b).getBytes(); - int aLength = (int) ((BlobData) a).bitLength(session); - int bLength = (int) ((BlobData) b).bitLength(session); - byte[] bytes = new byte[(int) (length + 7) / 8]; - - System.arraycopy(aData, 0, bytes, 0, aData.length); - - for (int i = 0; i < bLength; i++) { - if (BitMap.isSet(bData, i)) { - BitMap.set(bytes, aLength + i); - } - } - - return new BinaryData(bytes, length); - } - - public static BinaryType getBitType(int type, long precision) { - - switch (type) { - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - return new BitType(type, precision); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "BitType"); - } - } - - public static BitSet getJavaBitSet(BinaryData data) { - - int bits = (int) data.bitLength(null); - BitSet bs = new BitSet(bits); - byte[] bytes = data.getBytes(); - - for (int i = 0; i < bits; i++) { - boolean set = BitMap.isSet(bytes, i); - - if (set) { - bs.set(i); - } - } - - return bs; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BlobData.java b/database/hsqldb/src/org/hsqldb/types/BlobData.java deleted file mode 100644 index 693bb509..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BlobData.java +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.InputStream; - -import org.hsqldb.SessionInterface; - -/** - * Interface for Binary Large Object implementations.

    - * - * All positions are 0 based - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.9.0 - */ -public interface BlobData extends LobData { - - byte[] getBytes(); - - byte[] getBytes(SessionInterface session, long pos, int length); - - BlobData getBlob(SessionInterface session, long pos, long length); - - InputStream getBinaryStream(SessionInterface session); - - InputStream getBinaryStream(SessionInterface session, long pos, - long length); - - long length(SessionInterface session); - - long bitLength(SessionInterface session); - - boolean isBits(); - - void setBytes(SessionInterface session, long pos, byte[] bytes, - int offset, int len); - - void setBytes(SessionInterface session, long pos, byte[] bytes); - - void setBytes(SessionInterface session, long pos, BlobData b, long offset, - long length); - - void setBinaryStream(SessionInterface session, long pos, InputStream in); - - void truncate(SessionInterface session, long len); - - BlobData duplicate(SessionInterface session); - - long position(SessionInterface session, byte[] pattern, long start); - - long position(SessionInterface session, BlobData pattern, long start); - - long nonZeroLength(SessionInterface session); - - long getId(); - - void setId(long id); - - void free(); - - boolean isClosed(); - - void setSession(SessionInterface session); - - int getStreamBlockSize(); -} diff --git a/database/hsqldb/src/org/hsqldb/types/BlobDataID.java b/database/hsqldb/src/org/hsqldb/types/BlobDataID.java deleted file mode 100644 index d9247c9c..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BlobDataID.java +++ /dev/null @@ -1,294 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.InputStream; - -import org.hsqldb.HsqlException; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.Error; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultLob; - -/** - * Locator for BLOB. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public class BlobDataID implements BlobData { - - long id; - long length = -1; - - public BlobDataID(long id) { - this.id = id; - } - - public BlobData duplicate(SessionInterface session) { - - ResultLob resultOut = ResultLob.newLobDuplicateRequest(id); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - HsqlException ex = resultIn.getException(); - - if (ex == null) { - ex = new HsqlException(resultIn); - } - - throw ex; - } - - long lobID = ((ResultLob) resultIn).getLobID(); - - return new BlobDataID(lobID); - } - - public void free() {} - - public InputStream getBinaryStream(SessionInterface session) { - - long length = length(session); - - return new BlobInputStream(session, this, 0, length); - } - - public InputStream getBinaryStream(SessionInterface session, long pos, - long length) { - return new BlobInputStream(session, this, pos, length); - } - - public byte[] getBytes() { - return null; - } - - public byte[] getBytes(SessionInterface session, long pos, int length) { - - long blobLength = length(session); - - if (pos >= blobLength) { - return new byte[0]; - } - - if (pos + length >= blobLength) { - length = (int) (blobLength - pos); - } - - ResultLob resultOut = ResultLob.newLobGetBytesRequest(id, pos, length); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw Error.error(resultIn); - } - - return ((ResultLob) resultIn).getByteArray(); - } - - public BlobData getBlob(SessionInterface session, long pos, long length) { - - ResultLob resultOut = ResultLob.newLobGetRequest(id, pos, length); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw Error.error(resultIn); - } - - long lobID = ((ResultLob) resultIn).getLobID(); - - return new BlobDataID(lobID); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public int getStreamBlockSize() { - return 0; - } - - public boolean isClosed() { - return false; - } - - public long length(SessionInterface session) { - - if (length > -1) { - return length; - } - - ResultLob resultOut = ResultLob.newLobGetLengthRequest(id); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - length = ((ResultLob) resultIn).getBlockLength(); - - return length; - } - - public long bitLength(SessionInterface session) { - return length(session) * 8; - } - - public boolean isBits() { - return false; - } - - public long position(SessionInterface session, BlobData pattern, - long start) { - - ResultLob resultOut = ResultLob.newLobGetCharPatternPositionRequest(id, - pattern.getId(), start); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - return ((ResultLob) resultIn).getOffset(); - } - - public long position(SessionInterface session, byte[] pattern, - long start) { - - ResultLob resultOut = ResultLob.newLobGetBytePatternPositionRequest(id, - pattern, start); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - return ((ResultLob) resultIn).getOffset(); - } - - /* @todo - implement the next method call in Session */ - public long nonZeroLength(SessionInterface session) { - - ResultLob resultOut = ResultLob.newLobGetTruncateLength(id); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - return ((ResultLob) resultIn).getBlockLength(); - } - - public void setBytes(SessionInterface session, long pos, byte[] bytes, - int offset, int len) { - - if (offset != 0 || len != bytes.length) { - if (!BinaryData.isInLimits(bytes.length, offset, len)) { - throw new IndexOutOfBoundsException(); - } - - byte[] newbytes = new byte[len]; - - System.arraycopy(bytes, offset, newbytes, 0, len); - - bytes = newbytes; - } - - ResultLob resultOut = ResultLob.newLobSetBytesRequest(id, pos, bytes); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - length = ((ResultLob) resultIn).getBlockLength(); - } - - public void setBytes(SessionInterface session, long pos, byte[] bytes) { - setBytes(session, pos, bytes, 0, bytes.length); - } - - public void setBytes(SessionInterface session, long pos, BlobData b, - long offset, long length) { - - if (length > Integer.MAX_VALUE) { - throw new IndexOutOfBoundsException(); - } - - byte[] bytes = b.getBytes(session, offset, (int) length); - - setBytes(session, pos, bytes, 0, bytes.length); - } - - public void setBinaryStream(SessionInterface session, long pos, - InputStream in) { - - // - } - - public void setSession(SessionInterface session) {} - - public void truncate(SessionInterface session, long len) { - - if (len >= length(session)) { - return; - } - - ResultLob resultOut = ResultLob.newLobTruncateRequest(id, len); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - } - - public boolean isBinary() { - return true; - } - - public boolean equals(Object other) { - - if (other instanceof BlobDataID) { - return id == ((BlobDataID) other).id; - } - - return false; - } - - public int hashCode() { - return (int) id; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BlobInputStream.java b/database/hsqldb/src/org/hsqldb/types/BlobInputStream.java deleted file mode 100644 index 03dfe875..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BlobInputStream.java +++ /dev/null @@ -1,156 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.IOException; -import java.io.InputStream; - -import org.hsqldb.SessionInterface; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.java.JavaSystem; - -/** - * This class is used as an InputStream to retrieve data from a Blob. - * mark() and reset() are not supported. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.0.1 - * @since 1.9.0 - */ -public class BlobInputStream extends InputStream { - - final BlobData blob; - final long availableLength; - long bufferOffset; - long currentPosition; - byte[] buffer; - boolean isClosed; - int streamBlockSize; - public final SessionInterface session; - - public BlobInputStream(SessionInterface session, BlobData blob, - long offset, long length) { - - final long blobLength = blob.length(session); - - this.session = session; - this.blob = blob; - this.availableLength = offset + Math.min(length, blobLength - offset); - this.currentPosition = offset; - this.streamBlockSize = session.getStreamBlockSize(); - } - - public int read() throws IOException { - - checkClosed(); - - if (currentPosition >= availableLength) { - return -1; - } - - if (buffer == null - || currentPosition >= bufferOffset + buffer.length) { - try { - checkClosed(); - readIntoBuffer(); - } catch (Exception e) { - throw JavaSystem.toIOException(e); - } - } - - int val = buffer[(int) (currentPosition - bufferOffset)] & 0xff; - - currentPosition++; - - return val; - } - - public long skip(long n) throws IOException { - - checkClosed(); - - if (n <= 0) { - return 0; - } - - if (currentPosition + n > availableLength) { - n = availableLength - currentPosition; - } - - currentPosition += n; - - return n; - } - - public int available() { - - long avail = availableLength - currentPosition; - - if (avail > Integer.MAX_VALUE) { - return Integer.MAX_VALUE; - } - - return (int) avail; - } - - public void close() { - isClosed = true; - } - - private void checkClosed() throws IOException { - - if (isClosed || blob.isClosed()) { - throw new IOException(Error.getMessage(ErrorCode.X_0F503)); - } - } - - private void readIntoBuffer() { - - long readLength = availableLength - currentPosition; - - if (readLength <= 0) { - return; - } - - if (readLength > streamBlockSize) { - readLength = streamBlockSize; - } - - buffer = blob.getBytes(session, currentPosition, (int) readLength); - bufferOffset = currentPosition; - } - - static boolean isInLimits(long fullLength, long pos, long len) { - return pos >= 0 && len >= 0 && pos + len <= fullLength; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BlobType.java b/database/hsqldb/src/org/hsqldb/types/BlobType.java deleted file mode 100644 index 9b9a4b8d..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BlobType.java +++ /dev/null @@ -1,319 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.jdbc.JDBCBlobClient; - -/** - * Type object for BLOB. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public final class BlobType extends BinaryType { - - public static final long maxBlobPrecision = 1024L * 1024 * 1024 * 1024; - public static final int defaultBlobSize = 1024 * 1024 * 1024; - public static final int defaultShortBlobSize = 16 * 1024 * 1024; - - public BlobType(long precision) { - super(Types.SQL_BLOB, precision); - } - - public int displaySize() { - return precision > Integer.MAX_VALUE ? Integer.MAX_VALUE - : (int) precision; - } - - public int getJDBCTypeCode() { - return Types.BLOB; - } - - public Class getJDBCClass() { - return java.sql.Blob.class; - } - - public String getJDBCClassName() { - return "java.sql.Blob"; - } - - public String getNameString() { - return Tokens.T_BLOB; - } - - public String getFullNameString() { - return "BINARY LARGE OBJECT"; - } - - public String getDefinition() { - - long factor = precision; - String multiplier = null; - - if (precision % (1024 * 1024 * 1024) == 0) { - factor = precision / (1024 * 1024 * 1024); - multiplier = Tokens.T_G_FACTOR; - } else if (precision % (1024 * 1024) == 0) { - factor = precision / (1024 * 1024); - multiplier = Tokens.T_M_FACTOR; - } else if (precision % (1024) == 0) { - factor = precision / (1024); - multiplier = Tokens.T_K_FACTOR; - } - - StringBuilder sb = new StringBuilder(16); - - sb.append(getNameString()); - sb.append('('); - sb.append(factor); - - if (multiplier != null) { - sb.append(multiplier); - } - - sb.append(')'); - - return sb.toString(); - } - - public boolean isBinaryType() { - return true; - } - - public boolean isLobType() { - return true; - } - - public boolean acceptsPrecision() { - return true; - } - - public long getMaxPrecision() { - return maxBlobPrecision; - } - - public boolean requiresPrecision() { - return false; - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - if (b instanceof BinaryData) { - long lobId = ((BlobData) a).getId(); - - return session.database.lobManager.compare(lobId, - ((BlobData) b).getBytes()); - } - - return session.database.lobManager.compare((BlobData) a, (BlobData) b); - } - - /* @todo - implement */ - public Object convertToTypeLimits(SessionInterface session, Object a) { - return a; - } - - public Object castToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return null; - } - - if (otherType.typeCode == Types.SQL_BLOB) { - BlobData b = (BlobData) a; - long blobLength = b.length(session); - - if (blobLength > precision) { - blobLength = precision; - - session.addWarning(Error.error(ErrorCode.W_01004)); - - b = b.getBlob(session, 0, blobLength); - - return b; - } - - return a; - } - - if (otherType.typeCode == Types.SQL_BINARY - || otherType.typeCode == Types.SQL_VARBINARY) { - BlobData b = (BlobData) a; - long blobLength = b.length(session); - - if (blobLength > precision) { - blobLength = precision; - - session.addWarning(Error.error(ErrorCode.W_01004)); - } - - BlobData blob = session.createBlob(b.length(session)); - - blob.setBytes(session, 0, b.getBytes(), 0, (int) blobLength); - - return blob; - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - BlobData b = null; - - if (a == null) { - return null; - } - - if (otherType.typeCode == Types.SQL_BLOB) { - b = (BlobData) a; - - long blobLength = b.length(session); - - if (blobLength > precision) { - throw Error.error(ErrorCode.X_22001); - } - - return a; - } - - if (otherType.typeCode == Types.SQL_CLOB) { - a = Type.SQL_VARCHAR.convertToType(session, a, otherType); - otherType = Type.SQL_VARCHAR; - } - - if (otherType.typeCode == Types.SQL_VARCHAR - || otherType.typeCode == Types.SQL_CHAR) { - a = session.getScanner().convertToBinary((String) a, false); - otherType = Type.SQL_VARBINARY; - } - - if (otherType.typeCode == Types.SQL_BINARY - || otherType.typeCode == Types.SQL_VARBINARY) { - b = (BlobData) a; - - long blobLength = b.length(session); - - if (blobLength > precision) { - throw Error.error(ErrorCode.X_22001); - } - - BlobData blob = session.createBlob(b.length(session)); - - blob.setBytes(session, 0, b.getBytes()); - - return blob; - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof JDBCBlobClient) { - return ((JDBCBlobClient) a).getBlob(); - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof BlobDataID) { - BlobDataID blob = (BlobDataID) a; - - return new JDBCBlobClient(session, blob); - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - // conversion to Blob via PreparedStatement.setObject(); - if (a instanceof byte[]) { - return new BinaryData((byte[]) a, false); - } - - throw Error.error(ErrorCode.X_42561); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return Long.toString(((BlobData) a).getId()); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - return convertToString(a); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/BooleanType.java b/database/hsqldb/src/org/hsqldb/types/BooleanType.java deleted file mode 100644 index db9b71a7..00000000 --- a/database/hsqldb/src/org/hsqldb/types/BooleanType.java +++ /dev/null @@ -1,315 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.map.BitMap; - -/** - * Type implementation for BOOLEAN.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public final class BooleanType extends Type { - - static final BooleanType booleanType = new BooleanType(); - - private BooleanType() { - super(Types.SQL_BOOLEAN, Types.SQL_BOOLEAN, 0, 0); - } - - public int displaySize() { - return 5; - } - - public int getJDBCTypeCode() { - return Types.BOOLEAN; - } - - public Class getJDBCClass() { - return Boolean.class; - } - - public String getJDBCClassName() { - return "java.lang.Boolean"; - } - - public String getNameString() { - return Tokens.T_BOOLEAN; - } - - public String getDefinition() { - return Tokens.T_BOOLEAN; - } - - public boolean isBooleanType() { - return true; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (typeCode == other.typeCode) { - return this; - } - - if (other.isCharacterType()) { - return other.getAggregateType(this); - } - - throw Error.error(ErrorCode.X_42562); - } - - public Type getCombinedType(Session session, Type other, int operation) { - - switch (operation) { - - case OpTypes.EQUAL : - if (other.isBooleanType()) { - return this; - } - } - - throw Error.error(ErrorCode.X_42562); - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - boolean boola = ((Boolean) a).booleanValue(); - boolean boolb = ((Boolean) b).booleanValue(); - - return (boola == boolb) ? 0 - : (boolb ? -1 - : 1); - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - return a; - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - switch (otherType.typeCode) { - - case Types.SQL_BOOLEAN : - return a; - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : { - BinaryData b = (BinaryData) a; - - if (b.bitLength(session) == 1) { - return BitMap.isSet(b.getBytes(), 0) ? Boolean.TRUE - : Boolean.FALSE; - } - - break; - } - case Types.SQL_CLOB : - a = Type.SQL_VARCHAR.convertToType(session, a, otherType); - - // fall through - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : { - a = ((CharacterType) otherType).trim(session, a, ' ', true, - true); - - if (((String) a).equalsIgnoreCase(Tokens.T_TRUE)) { - return Boolean.TRUE; - } else if (((String) a).equalsIgnoreCase(Tokens.T_FALSE)) { - return Boolean.FALSE; - } else if (((String) a).equalsIgnoreCase(Tokens.T_UNKNOWN)) { - return null; - } - - break; - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return NumberType.isZero(a) ? Boolean.FALSE - : Boolean.TRUE; - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : { - if (((Number) a).longValue() == 0) { - return Boolean.FALSE; - } else { - return Boolean.TRUE; - } - } - } - - throw Error.error(ErrorCode.X_22018); - } - - /** - * ResultSet getBoolean support - */ - public Object convertToTypeJDBC(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - switch (otherType.typeCode) { - - case Types.SQL_BOOLEAN : - return a; - - default : - if (otherType.isLobType()) { - throw Error.error(ErrorCode.X_42561); - } - - if (otherType.isCharacterType()) { - if ("0".equals(a)) { - return Boolean.FALSE; - } else if ("1".equals(a)) { - return Boolean.TRUE; - } else if ("N".equalsIgnoreCase((String) a)) { - return Boolean.FALSE; - } else if ("Y".equalsIgnoreCase((String) a)) { - return Boolean.TRUE; - } - } - - return convertToType(session, a, otherType); - } - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof Boolean) { - return a; - } else if (a instanceof String) { - return convertToType(session, a, Type.SQL_VARCHAR); - } else if (a instanceof Number) { - return NumberType.isZero(a) ? Boolean.FALSE - : Boolean.TRUE; - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - return convertToDefaultType(session, a); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return ((Boolean) a).booleanValue() ? Tokens.T_TRUE - : Tokens.T_FALSE; - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_UNKNOWN; - } - - return ((Boolean) a).booleanValue() ? Tokens.T_TRUE - : Tokens.T_FALSE; - } - - public void convertToJSON(Object a, StringBuilder sb) { - - if (a == null) { - sb.append("null"); - - return; - } - - String val = ((Boolean) a).toString(); - - sb.append(val); - } - - - public boolean canConvertFrom(Type otherType) { - - return otherType.typeCode == Types.SQL_ALL_TYPES - || otherType.isBooleanType() || otherType.isCharacterType() - || otherType.isIntegralType() - || (otherType.isBitType() && otherType.precision == 1); - } - - public int canMoveFrom(Type otherType) { - return otherType.isBooleanType() ? ReType.keep - : ReType.change; - } - - public static BooleanType getBooleanType() { - return booleanType; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/CharacterType.java b/database/hsqldb/src/org/hsqldb/types/CharacterType.java deleted file mode 100644 index ea3499ad..00000000 --- a/database/hsqldb/src/org/hsqldb/types/CharacterType.java +++ /dev/null @@ -1,1194 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.math.BigDecimal; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.StringConverter; -import org.hsqldb.lib.StringUtil; - -/** - * Type subclass for CHARACTER, VARCHAR, etc.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since 1.9.0 - */ -public class CharacterType extends Type { - - static final int defaultCharPrecision = 256; - static final int defaultVarcharPrecision = 32 * 1024; - public static final long maxCharPrecision = Integer.MAX_VALUE; - final Collation collation; - final Charset charset; - final String nameString; - - public CharacterType(Collation collation, int type, long precision) { - - super(Types.SQL_VARCHAR, type, precision, 0); - - if (collation == null) { - collation = Collation.getDefaultInstance(); - } - - this.collation = collation; - this.charset = Charset.getDefaultInstance(); - this.nameString = getNameStringPrivate(); - } - - /** - * Always ASCII collation - */ - public CharacterType(int type, long precision) { - - super(Types.SQL_VARCHAR, type, precision, 0); - - this.collation = Collation.getDefaultInstance(); - this.charset = Charset.getDefaultInstance(); - this.nameString = getNameStringPrivate(); - } - - public CharacterType(String name, long precision) { - - super(Types.SQL_VARCHAR, Types.SQL_VARCHAR, precision, 0); - - this.collation = Collation.getDefaultInstance(); - this.charset = Charset.getDefaultInstance(); - this.nameString = name; - } - - public int displaySize() { - return precision > Integer.MAX_VALUE ? Integer.MAX_VALUE - : (int) precision; - } - - public int getJDBCTypeCode() { - - switch (typeCode) { - - case Types.SQL_CHAR : - return Types.CHAR; - - case Types.SQL_VARCHAR : - return Types.VARCHAR; - - case Types.SQL_CLOB : - return Types.CLOB; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - public Class getJDBCClass() { - return String.class; - } - - public String getJDBCClassName() { - return "java.lang.String"; - } - - public int getSQLGenericTypeCode() { - return typeCode == Types.SQL_CHAR ? typeCode - : Types.SQL_VARCHAR; - } - - public String getNameString() { - return nameString; - } - - private String getNameStringPrivate() { - - switch (typeCode) { - - case Types.SQL_CHAR : - return Tokens.T_CHARACTER; - - case Types.SQL_VARCHAR : - return Tokens.T_VARCHAR; - - case Types.SQL_CLOB : - return Tokens.T_CLOB; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - public String getFullNameString() { - - switch (typeCode) { - - case Types.SQL_CHAR : - return Tokens.T_CHARACTER; - - case Types.SQL_VARCHAR : - return "CHARACTER VARYING"; - - case Types.SQL_CLOB : - return "CHARACTER LARGE OBJECT"; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - public String getDefinition() { - - if (precision == 0) { - return getNameString(); - } - - StringBuilder sb = new StringBuilder(16); - - sb.append(getNameString()); - sb.append('('); - sb.append(precision); - sb.append(')'); - - return sb.toString(); - } - - public boolean isCharacterType() { - return true; - } - - public long getMaxPrecision() { - return maxCharPrecision; - } - - public boolean acceptsPrecision() { - return true; - } - - public boolean requiresPrecision() { - return typeCode == Types.SQL_VARCHAR; - } - - public int precedenceDegree(Type other) { - - if (other.typeCode == typeCode) { - return 0; - } - - if (!other.isCharacterType()) { - return Integer.MIN_VALUE; - } - - switch (typeCode) { - - case Types.SQL_CHAR : - return other.typeCode == Types.SQL_CLOB ? 4 - : 2; - - case Types.SQL_VARCHAR : - return other.typeCode == Types.SQL_CLOB ? 4 - : 2; - - case Types.SQL_CLOB : - return other.typeCode == Types.SQL_CHAR ? -4 - : -2; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (typeCode == other.typeCode) { - return precision >= other.precision ? this - : other; - } - - switch (other.typeCode) { - - case Types.SQL_CHAR : - return precision >= other.precision ? this - : getCharacterType( - typeCode, other.precision, - other.getCollation()); - - case Types.SQL_VARCHAR : - if (typeCode == Types.SQL_CLOB) { - return precision >= other.precision ? this - : getCharacterType( - typeCode, - other.precision, - other.getCollation()); - } else { - return other.precision >= precision ? other - : getCharacterType( - other.typeCode, - precision, - other.getCollation()); - } - case Types.SQL_CLOB : - return other.precision >= precision ? other - : getCharacterType( - other.typeCode, precision, - other.getCollation()); - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - case Types.SQL_BLOB : - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.OTHER : - throw Error.error(ErrorCode.X_42562); - default : - /* - * @todo - this seems to be allowed in SQL-92 (is in NIST) - * but is disallowed in SQL:2003 - * need to make dependent on a database property - */ -/* - int length = other.displaySize(); - - return getCharacterType(Types.SQL_VARCHAR, - length).getAggregateType(this); -*/ - throw Error.error(ErrorCode.X_42562); - } - } - - /** - * For concatenation - */ - public Type getCombinedType(Session session, Type other, int operation) { - - if (operation != OpTypes.CONCAT) { - return getAggregateType(other); - } - - Type newType; - long newPrecision = this.precision + other.precision; - - switch (other.typeCode) { - - case Types.SQL_ALL_TYPES : - return this; - - case Types.SQL_CHAR : - newType = this; - break; - - case Types.SQL_VARCHAR : - newType = (typeCode == Types.SQL_CLOB) ? this - : other; - break; - - case Types.SQL_CLOB : - newType = other; - break; - - default : - throw Error.error(ErrorCode.X_42562); - } - - if (newPrecision > maxCharPrecision) { - if (typeCode == Types.SQL_BINARY) { - - // Standard disallows type length reduction - // throw Error.error(ErrorCode.X_42570); - newPrecision = maxCharPrecision; - } else if (typeCode == Types.SQL_CHAR) { - newPrecision = maxCharPrecision; - } else if (typeCode == Types.SQL_VARCHAR) { - newPrecision = maxCharPrecision; - } - } - - return getCharacterType(newType.typeCode, newPrecision, collation); - } - - public int compare(Session session, Object a, Object b) { - return compare(session, a, b, OpTypes.EQUAL); - } - - public int compare(Session session, Object a, Object b, int opType) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - if (b instanceof ClobData) { - long lobId = ((ClobData) a).getId(); - - return -session.database.lobManager.compare(collation, lobId, - (String) a); - } - - String as = (String) a; - String bs = (String) b; - int la = as.length(); - int lb = bs.length(); - - if (la == lb) { - - // - } else if (la > lb) { - if (collation.isPadSpace() - && opType != OpTypes.GREATER_EQUAL_PRE) { - bs = padString(bs, la); - } - } else { - if (collation.isPadSpace() - && opType != OpTypes.GREATER_EQUAL_PRE) { - as = padString(as, lb); - } - } - - return collation.compare(as, bs); - } - - public static String padString(String s, int length) { - - char[] buffer = new char[length]; - - s.getChars(0, s.length(), buffer, 0); - ArrayUtil.fillArray(buffer, s.length(), ' '); - - return String.valueOf(buffer); - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - - if (a == null) { - return a; - } - - if (precision == 0) { - return a; - } - - switch (typeCode) { - - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : { - int slen = ((String) a).length(); - - if (slen > precision) { - if (session instanceof Session) { - if (!((Session) session).database - .sqlTruncateTrailing) { - throw Error.error(ErrorCode.X_22001); - } - } - - if (getRightTrimSize((String) a, ' ') <= precision) { - return ((String) a).substring(0, (int) precision); - } else { - throw Error.error(ErrorCode.X_22001); - } - } - - if (typeCode == Types.SQL_VARCHAR) { - return a; - } - - if (slen == precision) { - return a; - } - - char[] b = new char[(int) precision]; - - ((String) a).getChars(0, slen, b, 0); - - for (int i = slen; i < precision; i++) { - b[i] = ' '; - } - - return new String(b); - } - case Types.SQL_CLOB : { - ClobData clob = (ClobData) a; - - if (clob.length(session) > precision) { - throw Error.error(ErrorCode.X_22001); - } - - return a; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - public Object castToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - return castOrConvertToType(session, a, otherType, true); - } - - public Object castOrConvertToType(SessionInterface session, Object a, - Type otherType, boolean cast) { - - switch (otherType.typeCode) { - - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : { - int length = ((String) a).length(); - - if (precision != 0 && length > precision) { - if (StringUtil.rightTrimSize((String) a) > precision) { - if (!cast) { - throw Error.error(ErrorCode.X_22001); - } - - session.addWarning(Error.error(ErrorCode.W_01004)); - } - - a = ((String) a).substring(0, (int) precision); - } - - switch (typeCode) { - - case Types.SQL_CHAR : - return convertToTypeLimits(session, a); - - case Types.SQL_VARCHAR : - return a; - - case Types.SQL_CLOB : { - ClobData clob = - session.createClob(((String) a).length()); - - clob.setString(session, 0, (String) a); - - return clob; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, - "CharacterType"); - } - } - case Types.SQL_CLOB : { - long length = ((ClobData) a).length(session); - - if (precision != 0 && length > precision) { - - // todo nonSpaceLength() not yet implemented for CLOB - if (!cast) { - throw Error.error(ErrorCode.X_22001); - } - - session.addWarning(Error.error(ErrorCode.W_01004)); - } - - switch (typeCode) { - - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : { - if (length > maxCharPrecision) { - if (!cast) { - throw Error.error(ErrorCode.X_22001); - } - - length = maxCharPrecision; - } - - a = ((ClobData) a).getSubString(session, 0, - (int) length); - - return convertToTypeLimits(session, a); - } - case Types.SQL_CLOB : { - if (precision != 0 && length > precision) { - return ((ClobData) a).getClob(session, 0, - precision); - } - - return a; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, - "CharacterType"); - } - } - case Types.OTHER : - throw Error.error(ErrorCode.X_42561); - case Types.SQL_BLOB : - long blobLength = ((BlobData) a).length(session); - - if (precision != 0 && blobLength * 2 > precision) { - throw Error.error(ErrorCode.X_22001); - } - - byte[] bytes = ((BlobData) a).getBytes(session, 0, - (int) blobLength); - - a = StringConverter.byteArrayToHexString(bytes); - - return convertToTypeLimits(session, a); - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - default : - String s = otherType.convertToString(a); - - if (precision != 0 && s.length() > precision) { - throw Error.error(ErrorCode.X_22001); - } - - a = s; - - return convertToTypeLimits(session, a); - } - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - return castOrConvertToType(session, a, otherType, false); - } - - public Object convertToTypeJDBC(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - if (otherType.typeCode == Types.SQL_BLOB) { - throw Error.error(ErrorCode.X_42561); - } - - return convertToType(session, a, otherType); - } - - /** - * Relaxes SQL parameter type enforcement, allowing long strings. - */ - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return a; - } - - String s; - - if (a instanceof Boolean) { - s = a.toString(); - } else if (a instanceof BigDecimal) { - s = ((BigDecimal) a).toPlainString(); - } else if (a instanceof Number) { - s = a.toString(); // use shortcut - } else if (a instanceof String) { - s = (String) a; - } else if (a instanceof java.sql.Date) { - s = a.toString(); - } else if (a instanceof java.sql.Time) { - s = a.toString(); - } else if (a instanceof java.sql.Timestamp) { - s = a.toString(); - } else if (a instanceof java.util.Date) { - a = new java.sql.Timestamp(((java.util.Date) a).getTime()); - s = a.toString(); - } else if (a instanceof java.util.UUID) { - s = a.toString(); - } else { - s = DateTimeType.convertJavaDateTimeObjectToString(a); - - if (s == null) { - throw Error.error(ErrorCode.X_42561); - } - } - - return s; - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - return convertToDefaultType(session, a); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_CHAR : { - int slen = ((String) a).length(); - - if (precision == 0 || slen == precision) { - return (String) a; - } - - char[] b = new char[(int) precision]; - - ((String) a).getChars(0, slen, b, 0); - - for (int i = slen; i < precision; i++) { - b[i] = ' '; - } - - return new String(b); - } - case Types.SQL_VARCHAR : { - return (String) a; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - String s = convertToString(a); - - return StringConverter.toQuotedString(s, '\'', true); - } - - public void convertToJSON(Object a, StringBuilder sb) { - - if (a == null) { - sb.append("null"); - - return; - } - - StringConverter.toJSONString((String) a, sb); - } - - public boolean canConvertFrom(Type otherType) { - return !otherType.isObjectType(); - } - - public int canMoveFrom(Type otherType) { - - if (otherType == this) { - return 0; - } - - switch (typeCode) { - - case Types.SQL_VARCHAR : { - if (otherType.typeCode == typeCode) { - return precision >= otherType.precision ? ReType.keep - : ReType.check; - } - - if (otherType.typeCode == Types.SQL_CHAR) { - return precision >= otherType.precision ? ReType.keep - : ReType.change; - } - - return -1; - } - case Types.SQL_CLOB : { - if (otherType.typeCode == Types.SQL_CLOB) { - return precision >= otherType.precision ? ReType.keep - : ReType.check; - } - - return -1; - } - case Types.SQL_CHAR : { - return otherType.typeCode == Types.SQL_CHAR - && precision == otherType.precision ? ReType.keep - : ReType.change; - } - default : - return ReType.change; - } - } - - public Collation getCollation() { - return collation; - } - - public Charset getCharacterSet() { - return charset; - } - - /** - * can add collation and charset equality - */ - public boolean equals(Object other) { - - if (other == this) { - return true; - } - - if (other instanceof CharacterType) { - return super.equals(other) - && ((CharacterType) other).getCollation().equals( - getCollation()); - } - - return false; - } - - public long position(SessionInterface session, Object data, - Object otherData, Type otherType, long offset) { - - if (data == null || otherData == null) { - return -1L; - } - - if (otherType.typeCode == Types.SQL_CLOB) { - long otherLength = ((ClobData) otherData).length(session); - - if (offset + otherLength > ((String) data).length()) { - return -1; - } - - if (otherLength > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.X_22026); - } - - String otherString = ((ClobData) otherData).getSubString(session, - 0, (int) otherLength); - - return ((String) data).indexOf(otherString, (int) offset); - } else if (otherType.isCharacterType()) { - long otherLength = ((String) otherData).length(); - - if (offset + otherLength > ((String) data).length()) { - return -1; - } - - return ((String) data).indexOf((String) otherData, (int) offset); - } else { - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - /** - * length must not be negative - */ - public static LongPair substringParams(long dataLength, long start, - long length, boolean hasLength) { - - long end; - - if (hasLength) { - end = start + length; - } else { - end = Math.max(dataLength, start); - } - - // trim - if (start >= dataLength || end < 0) { - start = 0; - length = 0; - } else { - start = Math.max(start, 0); - end = Math.min(end, dataLength); - length = end - start; - } - - return new LongPair(start, length); - } - - public Object substring(SessionInterface session, Object data, - long offset, long length, boolean hasLength, - boolean trailing) { - - if (length < 0) { - throw Error.error(ErrorCode.X_22011); - } - - long dataLength = typeCode == Types.SQL_CLOB - ? ((ClobData) data).length(session) - : ((String) data).length(); - - if (trailing) { - offset = dataLength - offset; - } - - LongPair segment = substringParams(dataLength, offset, length, - hasLength); - - offset = segment.a; - length = segment.b; - - if (data instanceof String) { - return ((String) data).substring((int) offset, - (int) (offset + length)); - } else if (data instanceof ClobData) { - - if (length > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.X_22001); - } - - /* @todo - change to support long strings */ - String result = ((ClobData) data).getSubString(session, offset, - (int) length); - - ClobData clob = session.createClob(length); - - clob.setString(session, 0, result); - - return clob; - } else { - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - /** - * Memory limits apply to Upper and Lower implementations with Clob data - */ - public Object upper(Session session, Object data) { - - if (data == null) { - return null; - } - - if (typeCode == Types.SQL_CLOB) { - String result = ((ClobData) data).getSubString(session, 0, - (int) ((ClobData) data).length(session)); - - result = collation.toUpperCase(result); - - ClobData clob = session.createClob(result.length()); - - clob.setString(session, 0, result); - - return clob; - } - - return collation.toUpperCase((String) data); - } - - public Object lower(Session session, Object data) { - - if (data == null) { - return null; - } - - if (typeCode == Types.SQL_CLOB) { - String result = ((ClobData) data).getSubString(session, 0, - (int) ((ClobData) data).length(session)); - - result = collation.toLowerCase(result); - - ClobData clob = session.createClob(result.length()); - - clob.setString(session, 0, result); - - return clob; - } - - return collation.toLowerCase((String) data); - } - - public Object trim(SessionInterface session, Object data, char trim, - boolean leading, boolean trailing) { - - if (data == null) { - return null; - } - - String s; - - if (typeCode == Types.SQL_CLOB) { - long length = ((ClobData) data).length(session); - - if (length > Integer.MAX_VALUE) { - throw Error.error(ErrorCode.X_22026); - } - - s = ((ClobData) data).getSubString(session, 0, (int) length); - } else { - s = (String) data; - } - - int endindex = s.length(); - - if (trailing) { - for (--endindex; endindex >= 0 && s.charAt(endindex) == trim; - endindex--) {} - - endindex++; - } - - int startindex = 0; - - if (leading) { - while (startindex < endindex && s.charAt(startindex) == trim) { - startindex++; - } - } - - /* @todo - change to support long strings */ - if (startindex == 0 && endindex == s.length()) {} - else { - s = s.substring(startindex, endindex); - } - - if (typeCode == Types.SQL_CLOB) { - ClobData clob = session.createClob(s.length()); - - clob.setString(session, 0, s); - - return clob; - } else { - return s; - } - } - - public Object overlay(SessionInterface session, Object data, - Object overlay, long offset, long length, - boolean hasLength) { - - if (data == null || overlay == null) { - return null; - } - - if (!hasLength) { - length = typeCode == Types.SQL_CLOB - ? ((ClobData) overlay).length(session) - : ((String) overlay).length(); - } - - Object temp = concat(null, - substring(session, data, 0, offset, true, false), - overlay); - - return concat(null, temp, - substring(session, data, offset + length, 0, false, - false)); - } - - public Object concat(Session session, Object a, Object b) { - - if (a == null || b == null) { - return null; - } - - String left; - String right; - - if (a instanceof ClobData) { - left = ((ClobData) a).getSubString( - session, 0, (int) ((ClobData) a).length(session)); - } else { - left = (String) a; - } - - if (b instanceof ClobData) { - right = ((ClobData) b).getSubString( - session, 0, (int) ((ClobData) b).length(session)); - } else { - right = (String) b; - } - - if (typeCode == Types.SQL_CLOB) { - ClobData clob = session.createClob(left.length() + right.length()); - - clob.setString(session, 0, left); - clob.setString(session, left.length(), right); - - return clob; - } else { - return left + right; - } - } - - public long size(SessionInterface session, Object data) { - - if (typeCode == Types.SQL_CLOB) { - return ((ClobData) data).length(session); - } - - return ((String) data).length(); - } - - /** - * Matches the string against array containing part strings. Null element - * in array indicates skip one character. Empty string in array indicates - * skip any number of characters. - */ - public Boolean match(Session session, String string, String[] array) { - - if (string == null || array == null) { - return null; - } - - String s = null; - int offset = 0; - boolean match = true; - - for (int i = 0; i < array.length; i++) { - if (array[i] == null) { - - // single char skip - offset++; - - match = true; - } else if (array[i].length() == 0) { - - // string skip - match = false; - } - - if (match) { - if (offset + array[i].length() > string.length()) { - return Boolean.FALSE; - } - - s = string.substring(offset, offset + array[i].length()); - - if (collation.compare(s, array[i]) != 0) { - return Boolean.FALSE; - } - - offset += array[i].length(); - } else { - int index = string.indexOf(array[i], offset); - - if (index < 0) { - return Boolean.FALSE; - } - - offset = index + array[i].length(); - match = true; - } - } - - return Boolean.TRUE; - } - - public Type getCharacterType(long length) { - - if (length == precision) { - return this; - } - - return getCharacterType(this.typeCode, length, this.collation); - } - - public static int getRightTrimSize(String s, char trim) { - - int endindex = s.length(); - - for (--endindex; endindex >= 0 && s.charAt(endindex) == trim; - endindex--) {} - - endindex++; - - return endindex; - } - - private static final int fixedTypesLength = 32; - static CharacterType[] charArray = new CharacterType[fixedTypesLength]; - - static { - for (int i = 0; i < charArray.length; i++) { - charArray[i] = new CharacterType(Types.SQL_CHAR, i); - } - } - - public static CharacterType getCharacterType(int type, long length) { - - switch (type) { - - case Types.SQL_CHAR : - if (length < fixedTypesLength) { - return charArray[(int) length]; - } - - return new CharacterType(type, (int) length); - - case Types.SQL_VARCHAR : - return new CharacterType(type, (int) length); - - case Types.SQL_CLOB : - return new ClobType(length); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } - - public static CharacterType getCharacterType(int type, long length, - Collation collation) { - - if (collation == null) { - collation = Collation.getDefaultInstance(); - } - - switch (type) { - - case Types.SQL_VARCHAR : - case Types.SQL_CHAR : - return new CharacterType(collation, type, (int) length); - - case Types.SQL_CLOB : - return new ClobType(collation, length); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "CharacterType"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/Charset.java b/database/hsqldb/src/org/hsqldb/types/Charset.java deleted file mode 100644 index 3182ef81..00000000 --- a/database/hsqldb/src/org/hsqldb/types/Charset.java +++ /dev/null @@ -1,287 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.HsqlNameManager; -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.SchemaObject; -import org.hsqldb.Session; -import org.hsqldb.SqlInvariants; -import org.hsqldb.Tokens; -import org.hsqldb.lib.OrderedHashSet; -import org.hsqldb.rights.Grantee; - -/** - * Implementation of CHARACTER SET objects.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public class Charset implements SchemaObject { - - public static final int[][] uppercaseLetters = new int[][] { - { - 'A', 'Z' - } - }; - public static final int[][] unquotedIdentifier = new int[][] { - { - '0', '9' - }, { - 'A', 'Z' - }, { - '_', '_' - } - }; - public static final int[][] basicIdentifier = new int[][] { - { - '0', '9' - }, { - 'A', 'Z' - }, { - '_', '_' - }, { - 'a', 'z' - } - }; - public static final Charset SQL_TEXT; - public static final Charset SQL_IDENTIFIER_CHARSET; - public static final Charset SQL_CHARACTER; - public static final Charset ASCII_GRAPHIC; // == GRAPHIC_IRV - public static final Charset GRAPHIC_IRV; - public static final Charset ASCII_FULL; // == ISO8BIT - public static final Charset ISO8BIT; - public static final Charset LATIN1; - public static final Charset UTF32; - public static final Charset UTF16; - public static final Charset UTF8; - - static { - HsqlName name; - - name = HsqlNameManager.newInfoSchemaObjectName("SQL_TEXT", false, - SchemaObject.CHARSET); - SQL_TEXT = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("SQL_IDENTIFIER", - false, SchemaObject.CHARSET); - SQL_IDENTIFIER_CHARSET = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("SQL_CHARACTER", false, - SchemaObject.CHARSET); - SQL_CHARACTER = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("LATIN1", false, - SchemaObject.CHARSET); - LATIN1 = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("ASCII_GRAPHIC", false, - SchemaObject.CHARSET); - ASCII_GRAPHIC = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("GRAPHIC_IRV", false, - SchemaObject.CHARSET); - GRAPHIC_IRV = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("ASCII_FULL", false, - SchemaObject.CHARSET); - ASCII_FULL = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("ISO8BIT", false, - SchemaObject.CHARSET); - ISO8BIT = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("UTF32", false, - SchemaObject.CHARSET); - UTF32 = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("UTF16", false, - SchemaObject.CHARSET); - UTF16 = new Charset(name); - - // - name = HsqlNameManager.newInfoSchemaObjectName("UTF8", false, - SchemaObject.CHARSET); - UTF8 = new Charset(name); - /* - * Foundation 4.2.1 - * Character sets defined by standards or by SQL-implementations reside - * in the Information Schema (named INFORMATION_SCHEMA) in each catalog, - * as do collations defined by standards and collations, - * transliterations, and transcodings defined by SQL implementations. - */ - } - - final HsqlName name; - final public HsqlName base; - - // - int[][] ranges; - - private Charset(HsqlName name) { - this.name = name; - this.base = null; - } - - public Charset(HsqlName name, HsqlName baseName) { - this.name = name; - this.base = baseName; - } - - public int getType() { - return SchemaObject.CHARSET; - } - - public HsqlName getName() { - return name; - } - - public HsqlName getSchemaName() { - return name.schema; - } - - public HsqlName getCatalogName() { - return name.schema.schema; - } - - public Grantee getOwner() { - return name.schema.owner; - } - - public OrderedHashSet getReferences() { - - OrderedHashSet set = new OrderedHashSet(); - - if (base != null) { - set.add(base); - } - - return set; - } - - public OrderedHashSet getComponents() { - return null; - } - - public void compile(Session session, SchemaObject parentObject) {} - - public String getSQL() { - - StringBuilder sb = new StringBuilder(); - - sb.append(Tokens.T_CREATE).append(' ').append( - Tokens.T_CHARACTER).append(' ').append(Tokens.T_SET).append(' '); - - if (SqlInvariants.INFORMATION_SCHEMA.equals(name.schema.name)) { - sb.append(name.getStatementName()); - } else { - sb.append(name.getSchemaQualifiedStatementName()); - } - - if (base != null) { - sb.append(' ').append(Tokens.T_AS).append(' ').append( - Tokens.T_GET); - sb.append(' '); - - if (SqlInvariants.INFORMATION_SCHEMA.equals(base.schema.name)) { - sb.append(base.getStatementName()); - } else { - sb.append(base.getSchemaQualifiedStatementName()); - } - } - - return sb.toString(); - } - - public long getChangeTimestamp() { - return 0; - } - - public static boolean isInSet(String value, int[][] ranges) { - - int length = value.length(); - - mainLoop: - for (int index = 0; index < length; index++) { - int ch = value.charAt(index); - - for (int i = 0; i < ranges.length; i++) { - if (ch > ranges[i][1]) { - continue; - } - - if (ch < ranges[i][0]) { - return false; - } - - continue mainLoop; - } - - return false; - } - - return true; - } - - public static boolean startsWith(String value, int[][] ranges) { - - int ch = value.charAt(0); - - for (int i = 0; i < ranges.length; i++) { - if (ch > ranges[i][1]) { - continue; - } - - if (ch < ranges[i][0]) { - return false; - } - - return true; - } - - return false; - } - - public static Charset getDefaultInstance() { - return SQL_TEXT; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/ClobData.java b/database/hsqldb/src/org/hsqldb/types/ClobData.java deleted file mode 100644 index 39104bf5..00000000 --- a/database/hsqldb/src/org/hsqldb/types/ClobData.java +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.Reader; - -import org.hsqldb.SessionInterface; - -/** - * Interface for Character Large Object implementations.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.9.0 - */ -public interface ClobData extends LobData { - - char[] getChars(SessionInterface session, final long position, int length); - - long length(SessionInterface session); - - String getSubString(SessionInterface session, final long pos, - final int length); - - ClobData getClob(SessionInterface session, final long pos, - final long length); - - ClobData duplicate(SessionInterface session); - - void truncate(SessionInterface session, long len); - - Reader getCharacterStream(SessionInterface session); - - void setString(SessionInterface session, long pos, String str); - - void setClob(SessionInterface session, long pos, ClobData clob, - long offset, long len); - - void setChars(SessionInterface session, long pos, char[] chars, - int offset, int len); - - void setCharacterStream(SessionInterface session, long pos, Reader in); - - long position(SessionInterface session, String searchstr, long start); - - long position(SessionInterface session, ClobData searchstr, long start); - - long nonSpaceLength(SessionInterface session); - - Reader getCharacterStream(SessionInterface session, long pos, long length); - - long getId(); - - void setId(long id); -} diff --git a/database/hsqldb/src/org/hsqldb/types/ClobDataID.java b/database/hsqldb/src/org/hsqldb/types/ClobDataID.java deleted file mode 100644 index dd2b77ce..00000000 --- a/database/hsqldb/src/org/hsqldb/types/ClobDataID.java +++ /dev/null @@ -1,289 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.Reader; - -import org.hsqldb.HsqlException; -import org.hsqldb.SessionInterface; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.result.Result; -import org.hsqldb.result.ResultLob; - -/** - * Locator for CLOB.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.1 - * @since 1.9.0 - */ -public class ClobDataID implements ClobData { - - long id; - long length = -1; - - public ClobDataID(long id) { - this.id = id; - } - - public char[] getChars(SessionInterface session, long position, - int length) { - - ResultLob resultOut = ResultLob.newLobGetCharsRequest(id, position, - length); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - return ((ResultLob) resultIn).getCharArray(); - } - - public long length(SessionInterface session) { - - if (length > -1) { - return length; - } - - ResultLob resultOut = ResultLob.newLobGetLengthRequest(id); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - length = ((ResultLob) resultIn).getBlockLength(); - - return length; - } - - public String getSubString(SessionInterface session, long pos, - int length) { - - long clobLength = length(session); - - if (pos >= clobLength) { - return ""; - } - - if (pos + length >= clobLength) { - length = (int) (clobLength - pos); - } - - char[] chars = getChars(session, pos, length); - - return new String(chars); - } - - public ClobData duplicate(SessionInterface session) { - - ResultLob resultOut = ResultLob.newLobDuplicateRequest(id); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - HsqlException ex = resultIn.getException(); - - if (ex == null) { - ex = new HsqlException(resultIn); - } - - throw ex; - } - - long lobID = ((ResultLob) resultIn).getLobID(); - - return new ClobDataID(lobID); - } - - public ClobData getClob(SessionInterface session, long position, - long length) { - - ResultLob resultOut = ResultLob.newLobGetRequest(id, position, length); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - long lobID = ((ResultLob) resultIn).getLobID(); - - return new ClobDataID(lobID); - } - - public void truncate(SessionInterface session, long len) { - - if (len >= length(session)) { - return; - } - - ResultLob resultOut = ResultLob.newLobTruncateRequest(id, len); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - this.length = ((ResultLob) resultIn).getBlockLength(); - } - - public Reader getCharacterStream(SessionInterface session) { - - long length = length(session); - - return new ClobInputStream(session, this, 0, length); - } - - public void setCharacterStream(SessionInterface session, long pos, - Reader in) {} - - public void setString(SessionInterface session, long pos, String str) { - - ResultLob resultOut = ResultLob.newLobSetCharsRequest(id, pos, - str.toCharArray()); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - this.length = ((ResultLob) resultIn).getBlockLength(); - } - - public void setClob(SessionInterface session, long pos, ClobData clob, - long offset, long len) {} - - public void setChars(SessionInterface session, long pos, char[] chars, - int offset, int len) { - - if (offset != 0 || len != chars.length) { - if (!isInLimits(chars.length, offset, len)) { - throw Error.error(ErrorCode.X_22001); - } - - if (offset != 0 || len != chars.length) { - char[] newChars = new char[len]; - - System.arraycopy(chars, offset, newChars, 0, len); - - chars = newChars; - } - } - - ResultLob resultOut = ResultLob.newLobSetCharsRequest(id, pos, chars); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - this.length = ((ResultLob) resultIn).getBlockLength(); - } - - public long position(SessionInterface session, String searchstr, - long start) { - - ResultLob resultOut = ResultLob.newLobGetCharPatternPositionRequest(id, - searchstr.toCharArray(), start); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - return ((ResultLob) resultIn).getOffset(); - } - - public long position(SessionInterface session, ClobData searchstr, - long start) { - - ResultLob resultOut = ResultLob.newLobGetCharPatternPositionRequest(id, - searchstr.getId(), start); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - return ((ResultLob) resultIn).getOffset(); - } - - /* @todo - implement the next method call in Session */ - public long nonSpaceLength(SessionInterface session) { - - ResultLob resultOut = ResultLob.newLobGetTruncateLength(id); - Result resultIn = session.execute(resultOut); - - if (resultIn.isError()) { - throw resultIn.getException(); - } - - return ((ResultLob) resultIn).getBlockLength(); - } - - public Reader getCharacterStream(SessionInterface session, long pos, - long length) { - return new ClobInputStream(session, this, pos, length); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - static boolean isInLimits(long fullLength, long pos, long len) { - return pos >= 0 && len >= 0 && pos + len <= fullLength; - } - - public void setSession(SessionInterface session) {} - - public boolean isBinary() { - return false; - } - - public boolean equals(Object other) { - - if (other instanceof ClobDataID) { - return id == ((ClobDataID) other).id; - } - - return false; - } - - public int hashCode() { - return (int) id; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/ClobInputStream.java b/database/hsqldb/src/org/hsqldb/types/ClobInputStream.java deleted file mode 100644 index 7da8e261..00000000 --- a/database/hsqldb/src/org/hsqldb/types/ClobInputStream.java +++ /dev/null @@ -1,175 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.IOException; -import java.io.Reader; - -import org.hsqldb.SessionInterface; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.java.JavaSystem; - -/** - * This class is used as an InputStream to retrieve data from a Clob. - * mark() and reset() are not supported. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 1.9.0 - */ -public final class ClobInputStream extends Reader { - - final ClobData clob; - final long availableLength; - long bufferOffset; - long currentPosition; - char[] buffer; - boolean isClosed; - int streamBlockSize; - public final SessionInterface session; - - public ClobInputStream(SessionInterface session, ClobData clob, - long offset, long length) { - - final long clobLength = clob.length(session); - - this.session = session; - this.clob = clob; - this.availableLength = offset + Math.min(length, clobLength - offset); - this.currentPosition = offset; - this.streamBlockSize = session.getStreamBlockSize(); - } - - public int read() throws IOException { - - checkClosed(); - - if (currentPosition >= availableLength) { - return -1; - } - - if (buffer == null - || currentPosition >= bufferOffset + buffer.length) { - try { - checkClosed(); - readIntoBuffer(); - } catch (Exception e) { - throw JavaSystem.toIOException(e); - } - } - - int val = buffer[(int) (currentPosition - bufferOffset)]; - - currentPosition++; - - return val; - } - - public int read(char[] cbuf, int off, int len) throws IOException { - - checkClosed(); - - if (currentPosition >= availableLength) { - return -1; - } - - if (currentPosition + len > availableLength) { - len = (int) (availableLength - currentPosition); - } - - for (int i = off; i < off + len && i < cbuf.length; i++) { - cbuf[i] = (char) read(); - } - - return len; - } - - public long skip(long n) throws IOException { - - checkClosed(); - - if (n <= 0) { - return 0; - } - - if (currentPosition + n > availableLength) { - n = availableLength - currentPosition; - } - - currentPosition += n; - - return n; - } - - public int available() { - - long avail = availableLength - currentPosition; - - if (avail > Integer.MAX_VALUE) { - return Integer.MAX_VALUE; - } - - return (int) avail; - } - - public void close() { - isClosed = true; - } - - private void checkClosed() throws IOException { - - if (isClosed) { - throw new IOException(Error.getMessage(ErrorCode.X_0F503)); - } - } - - private void readIntoBuffer() { - - long readLength = availableLength - currentPosition; - - if (readLength <= 0) { - return; - } - - if (readLength > streamBlockSize) { - readLength = streamBlockSize; - } - - buffer = clob.getChars(session, currentPosition, (int) readLength); - bufferOffset = currentPosition; - } - - static boolean isInLimits(long fullLength, long pos, long len) { - return pos >= 0 && len >= 0 && pos + len <= fullLength; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/ClobType.java b/database/hsqldb/src/org/hsqldb/types/ClobType.java deleted file mode 100644 index fbca0d86..00000000 --- a/database/hsqldb/src/org/hsqldb/types/ClobType.java +++ /dev/null @@ -1,235 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.jdbc.JDBCClobClient; - -/** - * Type object for CLOB.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public final class ClobType extends CharacterType { - - public static final long maxClobPrecision = 1024L * 1024 * 1024 * 1024; - public static final int defaultClobSize = 1024 * 1024 * 1024; - public static final int defaultShortClobSize = 16 * 1024 * 1024; - - public ClobType(long precision) { - super(Types.SQL_CLOB, precision); - } - - public ClobType(Collation collation, long precision) { - super(collation, Types.SQL_CLOB, precision); - } - - public int displaySize() { - return precision > Integer.MAX_VALUE ? Integer.MAX_VALUE - : (int) precision; - } - - public int getJDBCTypeCode() { - return Types.CLOB; - } - - public Class getJDBCClass() { - return java.sql.Clob.class; - } - - public String getJDBCClassName() { - return "java.sql.Clob"; - } - - public int getSQLGenericTypeCode() { - return typeCode; - } - - public String getDefinition() { - - long factor = precision; - String multiplier = null; - - if (precision % (1024) == 0) { - if (precision % (1024 * 1024 * 1024) == 0) { - factor = precision / (1024 * 1024 * 1024); - multiplier = Tokens.T_G_FACTOR; - } else if (precision % (1024 * 1024) == 0) { - factor = precision / (1024 * 1024); - multiplier = Tokens.T_M_FACTOR; - } else { - factor = precision / (1024); - multiplier = Tokens.T_K_FACTOR; - } - } - - StringBuilder sb = new StringBuilder(16); - - sb.append(getNameString()); - sb.append('('); - sb.append(factor); - - if (multiplier != null) { - sb.append(multiplier); - } - - sb.append(')'); - - return sb.toString(); - } - - public long getMaxPrecision() { - return maxClobPrecision; - } - - public boolean isLobType() { - return true; - } - - /* @todo - collation comparison */ - public int compare(Session session, Object a, Object b) { - return compare(session, a, b, OpTypes.EQUAL); - } - - public int compare(Session session, Object a, Object b, int opType) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - if (b instanceof String) { - long lobId = ((ClobData) a).getId(); - - return session.database.lobManager.compare(collation, lobId, - (String) b); - } - - return session.database.lobManager.compare(collation, (ClobData) a, - (ClobData) b); - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof ClobData) { - return a; - } - - if (a instanceof String) { - ClobData clob = session.createClob(((String) a).length()); - - clob.setString(session, 0, (String) a); - - return clob; - } - - throw Error.error(ErrorCode.X_42561); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return Long.toString(((ClobData) a).getId()); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - return convertToString(a); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof JDBCClobClient) { - return ((JDBCClobClient) a).getClob(); - } - - throw Error.error(ErrorCode.X_42561); - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof ClobDataID) { - ClobDataID clob = (ClobDataID) a; - - return new JDBCClobClient(session, clob); - } - - throw Error.error(ErrorCode.X_42561); - } - - public long position(SessionInterface session, Object data, - Object otherData, Type otherType, long start) { - - if (otherType.typeCode == Types.SQL_CLOB) { - return ((ClobData) data).position(session, (ClobData) otherData, - start); - } else if (otherType.isCharacterType()) { - return ((ClobData) data).position(session, (String) otherData, - start); - } else { - throw Error.runtimeError(ErrorCode.U_S0500, "ClobType"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/Collation.java b/database/hsqldb/src/org/hsqldb/types/Collation.java deleted file mode 100644 index f8acf6a9..00000000 --- a/database/hsqldb/src/org/hsqldb/types/Collation.java +++ /dev/null @@ -1,581 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.text.Collator; -import java.util.Locale; - -import org.hsqldb.HsqlException; -import org.hsqldb.HsqlNameManager; -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.SchemaObject; -import org.hsqldb.Session; -import org.hsqldb.SqlInvariants; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.HashMap; -import org.hsqldb.lib.Iterator; -import org.hsqldb.lib.OrderedHashSet; -import org.hsqldb.lib.StringUtil; -import org.hsqldb.rights.Grantee; - -/** - * Implementation of collation support for CHAR and VARCHAR data. - * - * @author Frand Schoenheit (frank.schoenheit@sun dot com) - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.0 - */ -public class Collation implements SchemaObject { - - public static String defaultCollationName = "SQL_TEXT"; - static String defaultIgnoreCaseCollationName = "SQL_TEXT_UCC"; - public static final HashMap nameToJavaName = new HashMap(101); - public static final HashMap dbNameToJavaName = new HashMap(101); - public static final HashMap dbNameToCollation = new HashMap(11); - - static { - nameToJavaName.put("Afrikaans", "af-ZA"); - nameToJavaName.put("Amharic", "am-ET"); - nameToJavaName.put("Arabic", "ar"); - nameToJavaName.put("Assamese", "as-IN"); - nameToJavaName.put("Azerbaijani_Latin", "az-AZ"); - nameToJavaName.put("Azerbaijani_Cyrillic", "az-cyrillic"); - nameToJavaName.put("Belarusian", "be-BY"); - nameToJavaName.put("Bulgarian", "bg-BG"); - nameToJavaName.put("Bengali", "bn-IN"); - nameToJavaName.put("Tibetan", "bo-CN"); - nameToJavaName.put("Bosnian", "bs-BA"); - nameToJavaName.put("Catalan", "ca-ES"); - nameToJavaName.put("Czech", "cs-CZ"); - nameToJavaName.put("Welsh", "cy-GB"); - nameToJavaName.put("Danish", "da-DK"); - nameToJavaName.put("German", "de-DE"); - nameToJavaName.put("Greek", "el-GR"); - nameToJavaName.put("Latin1_General", "en-US"); - nameToJavaName.put("English", "en-US"); - nameToJavaName.put("Spanish", "es-ES"); - nameToJavaName.put("Estonian", "et-EE"); - nameToJavaName.put("Basque", "eu"); - nameToJavaName.put("Finnish", "fi-FI"); - nameToJavaName.put("French", "fr-FR"); - nameToJavaName.put("Guarani", "gn-PY"); - nameToJavaName.put("Gujarati", "gu-IN"); - nameToJavaName.put("Hausa", "ha-NG"); - nameToJavaName.put("Hebrew", "he-IL"); - nameToJavaName.put("Hindi", "hi-IN"); - nameToJavaName.put("Croatian", "hr-HR"); - nameToJavaName.put("Hungarian", "hu-HU"); - nameToJavaName.put("Armenian", "hy-AM"); - nameToJavaName.put("Indonesian", "id-ID"); - nameToJavaName.put("Igbo", "ig-NG"); - nameToJavaName.put("Icelandic", "is-IS"); - nameToJavaName.put("Italian", "it-IT"); - nameToJavaName.put("Inuktitut", "iu-CA"); - nameToJavaName.put("Japanese", "ja-JP"); - nameToJavaName.put("Georgian", "ka-GE"); - nameToJavaName.put("Kazakh", "kk-KZ"); - nameToJavaName.put("Khmer", "km-KH"); - nameToJavaName.put("Kannada", "kn-IN"); - nameToJavaName.put("Korean", "ko-KR"); - nameToJavaName.put("Konkani", "kok-IN"); - nameToJavaName.put("Kashmiri", "ks"); - nameToJavaName.put("Kirghiz", "ky-KG"); - nameToJavaName.put("Lao", "lo-LA"); - nameToJavaName.put("Lithuanian", "lt-LT"); - nameToJavaName.put("Latvian", "lv-LV"); - nameToJavaName.put("Maori", "mi-NZ"); - nameToJavaName.put("Macedonian", "mk-MK"); - nameToJavaName.put("Malayalam", "ml-IN"); - nameToJavaName.put("Mongolian", "mn-MN"); - nameToJavaName.put("Manipuri", "mni-IN"); - nameToJavaName.put("Marathi", "mr-IN"); - nameToJavaName.put("Malay", "ms-MY"); - nameToJavaName.put("Maltese", "mt-MT"); - nameToJavaName.put("Burmese", "my-MM"); - nameToJavaName.put("Danish_Norwegian", "nb-NO"); - nameToJavaName.put("Nepali", "ne-NP"); - nameToJavaName.put("Dutch", "nl-NL"); - nameToJavaName.put("Norwegian", "nn-NO"); - nameToJavaName.put("Oriya", "or-IN"); - nameToJavaName.put("Punjabi", "pa-IN"); - nameToJavaName.put("Polish", "pl-PL"); - nameToJavaName.put("Pashto", "ps-AF"); - nameToJavaName.put("Portuguese", "pt-PT"); - nameToJavaName.put("Romanian", "ro-RO"); - nameToJavaName.put("Russian", "ru-RU"); - nameToJavaName.put("Sanskrit", "sa-IN"); - nameToJavaName.put("Sindhi", "sd-IN"); - nameToJavaName.put("Slovak", "sk-SK"); - nameToJavaName.put("Slovenian", "sl-SI"); - nameToJavaName.put("Somali", "so-SO"); - nameToJavaName.put("Albanian", "sq-AL"); - nameToJavaName.put("Serbian_Cyrillic", "sr-YU"); - nameToJavaName.put("Serbian_Latin", "sh-BA"); - nameToJavaName.put("Swedish", "sv-SE"); - nameToJavaName.put("Swahili", "sw-KE"); - nameToJavaName.put("Tamil", "ta-IN"); - nameToJavaName.put("Telugu", "te-IN"); - nameToJavaName.put("Tajik", "tg-TJ"); - nameToJavaName.put("Thai", "th-TH"); - nameToJavaName.put("Turkmen", "tk-TM"); - nameToJavaName.put("Tswana", "tn-BW"); - nameToJavaName.put("Turkish", "tr-TR"); - nameToJavaName.put("Tatar", "tt-RU"); - nameToJavaName.put("Ukrainian", "uk-UA"); - nameToJavaName.put("Urdu", "ur-PK"); - nameToJavaName.put("Uzbek_Latin", "uz-UZ"); - nameToJavaName.put("Venda", "ven-ZA"); - nameToJavaName.put("Vietnamese", "vi-VN"); - nameToJavaName.put("Yoruba", "yo-NG"); - nameToJavaName.put("Chinese", "zh-CN"); - nameToJavaName.put("Zulu", "zu-ZA"); - - // - Iterator it = nameToJavaName.values().iterator(); - - while (it.hasNext()) { - String javaName = (String) it.next(); - String dbName = javaName.replace('-', - '_').toUpperCase(Locale.ENGLISH); - - dbNameToJavaName.put(dbName, javaName); - } - } - - static final Collation defaultCollation = new Collation(true); - static final Collation defaultIgnoreCaseCollation = new Collation(false); - - static { - defaultCollation.charset = Charset.SQL_TEXT; - defaultIgnoreCaseCollation.charset = Charset.SQL_TEXT; - - dbNameToCollation.put(defaultCollationName, defaultCollation); - dbNameToCollation.put(defaultIgnoreCaseCollationName, - defaultIgnoreCaseCollation); - } - - final HsqlName name; - private Collator collator; - private Locale locale; - private boolean isUnicodeSimple; - private boolean isUpperCaseCompare; - private boolean isFinal; - private boolean padSpace = true; - - // - private Charset charset; - private HsqlName sourceName; - - private Collation(boolean simple) { - - String nameString = simple ? defaultCollationName - : defaultIgnoreCaseCollationName; - - locale = Locale.ENGLISH; - name = HsqlNameManager.newInfoSchemaObjectName(nameString, false, - SchemaObject.COLLATION); - isUnicodeSimple = simple; - isFinal = true; - } - - private Collation(String name, String language, String country, - int strength, int decomposition, boolean ucc) { - - locale = new Locale(language, country); - collator = Collator.getInstance(locale); - - if (strength >= 0) { - collator.setStrength(strength); - } - - if (decomposition >= 0) { - collator.setDecomposition(decomposition); - } - - strength = collator.getStrength(); - isUnicodeSimple = false; - this.name = HsqlNameManager.newInfoSchemaObjectName(name, true, - SchemaObject.COLLATION); - charset = Charset.SQL_TEXT; - isUpperCaseCompare = ucc; - isFinal = true; - } - - public Collation(HsqlName name, Collation source, Charset charset, - Boolean padSpace) { - - this.name = name; - this.locale = source.locale; - this.collator = source.collator; - this.isUnicodeSimple = source.isUnicodeSimple; - this.isFinal = true; - - // - this.charset = charset; - this.sourceName = source.name; - - if (padSpace != null) { - this.padSpace = padSpace.booleanValue(); - } - } - - public static Collation getDefaultInstance() { - return defaultCollation; - } - - public static Collation getDefaultIgnoreCaseInstance() { - return defaultIgnoreCaseCollation; - } - - public static Collation newDatabaseInstance() { - - Collation collation = new Collation(true); - - collation.isFinal = false; - - return collation; - } - - public static Iterator getCollationsIterator() { - return nameToJavaName.keySet().iterator(); - } - - public static Iterator getLocalesIterator() { - return nameToJavaName.values().iterator(); - } - - public synchronized static Collation getCollation(String name) { - - Collation collation = (Collation) dbNameToCollation.get(name); - - if (collation != null) { - return collation; - } - - collation = getNewCollation(name); - - dbNameToCollation.put(name, collation); - - return collation; - } - - public synchronized static Collation getUpperCaseCompareCollation( - Collation source) { - - if (defaultCollationName.equals(source.name.name) - || defaultIgnoreCaseCollationName.equals(source.name.name)) { - return defaultIgnoreCaseCollation; - } - - if (source.isUpperCaseCompare) { - return source; - } - - String name = source.getName().name; - - if (name.contains(" UCC")) { - return source; - } - - name = name + " UCC"; - - return getCollation(name); - } - - private static Collation getNewCollation(String name) { - - int strength = -1; - int decomposition = -1; - boolean ucc = false; - String[] parts = StringUtil.split(name, " "); - String dbName = parts[0]; - int index = 1; - int limit = parts.length; - - if (parts.length > index && "UCC".equals(parts[limit - 1])) { - ucc = true; - - limit--; - } - - if (index < limit) { - strength = Integer.parseInt(parts[index]); - - index++; - } - - if (index < limit) { - decomposition = Integer.parseInt(parts[index]); - - index++; - } - - if (index < limit) { - throw Error.error(ErrorCode.X_42501, name); - } - - String javaName = (String) dbNameToJavaName.get(dbName); - - if (javaName == null) { - javaName = (String) nameToJavaName.get(dbName); - - if (javaName == null) { - throw Error.error(ErrorCode.X_42501, dbName); - } - } - - parts = StringUtil.split(javaName, "-"); - - String language = parts[0]; - String country = parts.length == 2 ? parts[1] - : ""; - - return new Collation(name, language, country, strength, decomposition, - ucc); - } - - public void setPadding(boolean padSpace) { - - if (isFinal) { - throw Error.error(ErrorCode.X_42503); - } - - this.padSpace = padSpace; - } - - public void setCollationAsLocale() { - - Locale locale = Locale.getDefault(); - String language = locale.getDisplayLanguage(Locale.ENGLISH); - - try { - setCollation(language, false); - } catch (HsqlException e) {} - } - - public void setCollation(String newName, boolean padSpace) { - - if (isFinal) { - throw Error.error(ErrorCode.X_42503, newName); - } - - Collation newCollation = Collation.getCollation(newName); - - this.name.rename(newCollation.name.name, true); - - this.locale = newCollation.locale; - this.collator = newCollation.collator; - this.isUnicodeSimple = newCollation.isUnicodeSimple; - this.padSpace = padSpace; - } - - public boolean isPadSpace() { - return padSpace; - } - - public boolean isUnicodeSimple() { - return isUnicodeSimple; - } - - public boolean isUpperCaseCompare() { - return isUpperCaseCompare; - } - - public boolean isCaseSensitive() { - - // add support for case-sensitive language collations - if (collator == null) { - return isUnicodeSimple; - } else { - return !isUpperCaseCompare; - } - } - - /** - * returns -1, 0 or +1 - */ - public int compare(String a, String b) { - - int i; - - if (collator == null) { - if (isUnicodeSimple) { - i = a.compareTo(b); - } else { - i = a.compareToIgnoreCase(b); - } - } else { - if (isUpperCaseCompare) { - i = collator.compare(toUpperCase(a), toUpperCase(b)); - } else { - i = collator.compare(a, b); - } - } - - return (i == 0) ? 0 - : (i < 0 ? -1 - : 1); - } - - public String toUpperCase(String s) { - return s.toUpperCase(locale); - } - - public String toLowerCase(String s) { - return s.toLowerCase(locale); - } - - /** - * the SQL_TEXT collation - */ - public boolean isDefaultCollation() { - return collator == null && isUnicodeSimple && padSpace; - } - - /** - * collation for individual object - */ - public boolean isObjectCollation() { - return isFinal; - } - - public int getType() { - return SchemaObject.COLLATION; - } - - public HsqlName getName() { - return name; - } - - public HsqlName getSchemaName() { - return name.schema; - } - - public HsqlName getCatalogName() { - return name.schema.schema; - } - - public Grantee getOwner() { - return name.schema.owner; - } - - public OrderedHashSet getReferences() { - - if (charset == null) { - return new OrderedHashSet(); - } else { - return charset.getReferences(); - } - } - - public OrderedHashSet getComponents() { - return null; - } - - public void compile(Session session, SchemaObject parentObject) {} - - public String getSQL() { - - StringBuilder sb = new StringBuilder(); - - sb.append(Tokens.T_CREATE).append(' '); - sb.append(Tokens.T_COLLATION).append(' '); - - if (SqlInvariants.INFORMATION_SCHEMA.equals(name.schema.name)) { - sb.append(name.getStatementName()); - } else { - sb.append(name.getSchemaQualifiedStatementName()); - } - - sb.append(' ').append(Tokens.T_FOR).append(' '); - - if (SqlInvariants.INFORMATION_SCHEMA.equals( - charset.name.schema.name)) { - sb.append(charset.name.getStatementName()); - } else { - sb.append(charset.name.getSchemaQualifiedStatementName()); - } - - sb.append(' ').append(Tokens.T_FROM).append(' '); - sb.append(sourceName.statementName); - sb.append(' '); - - if (padSpace) { - sb.append(Tokens.T_PAD).append(' ').append(Tokens.T_SPACE); - } else { - sb.append(Tokens.T_NO).append(' ').append(Tokens.T_PAD); - } - - return sb.toString(); - } - - public long getChangeTimestamp() { - return 0; - } - - public String getCollateSQL() { - - StringBuilder sb = new StringBuilder(); - - sb.append(Tokens.T_COLLATE).append(' '); - - if (isObjectCollation()) { - sb.append(getName().getSchemaQualifiedStatementName()); - } else { - sb.append(getName().statementName); - } - - return sb.toString(); - } - - public String getDatabaseCollationSQL() { - - StringBuilder sb = new StringBuilder(); - - sb.append(Tokens.T_SET).append(' '); - sb.append(Tokens.T_DATABASE).append(' '); - sb.append(Tokens.T_COLLATION).append(' '); - sb.append(getName().statementName); - sb.append(' '); - - if (padSpace) { - sb.append(Tokens.T_PAD).append(' ').append(Tokens.T_SPACE); - } else { - sb.append(Tokens.T_NO).append(' ').append(Tokens.T_PAD); - } - - return sb.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/DTIType.java b/database/hsqldb/src/org/hsqldb/types/DTIType.java deleted file mode 100644 index f0997531..00000000 --- a/database/hsqldb/src/org/hsqldb/types/DTIType.java +++ /dev/null @@ -1,512 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.math.BigDecimal; - -import org.hsqldb.Session; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.IntKeyIntValueHashMap; - -/** - * Common elements for Type instances for DATETIME and INTERVAL.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public abstract class DTIType extends Type { - - public static final int secondsInDay = 60 * 60 * 24; - public static final long millisInSecond = 1000L; - public static final long nanosInMilli = 1000000L; - public static final long nanosInSecond = 1000000000L; - - public static final byte[] yearToSecondSeparators = { - '-', '-', ' ', ':', ':', '.' - }; - public static final int[] yearToSecondFactors = { - 12, 1, 24 * 60 * 60, 60 * 60, 60, 1, 0 - }; - public static final int[] yearToSecondLimits = { - 0, 12, 0, 24, 60, 60, 1000000000 - }; - public static final int INTERVAL_MONTH_INDEX = 1; - public static final int INTERVAL_SECOND_INDEX = 5; - public static final int INTERVAL_FRACTION_PART_INDEX = 6; - public static final long[] precisionLimits = { - 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, - 1000000000, 10000000000L, 100000000000L, 1000000000000L - }; - static final int[] precisionFactors = { - 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1 - }; - static final int[] nanoScaleFactors = { - 1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, - 1 - }; - public static final int timezoneSecondsLimit = 18 * 60 * 60; - static final int[] intervalParts = { - Types.SQL_INTERVAL_YEAR, Types.SQL_INTERVAL_MONTH, - Types.SQL_INTERVAL_DAY, Types.SQL_INTERVAL_HOUR, - Types.SQL_INTERVAL_MINUTE, Types.SQL_INTERVAL_SECOND - }; - static final int[][] intervalTypes = { - { - Types.SQL_INTERVAL_YEAR, Types.SQL_INTERVAL_YEAR_TO_MONTH, 0, 0, 0, - 0 - }, { - 0, Types.SQL_INTERVAL_MONTH, 0, 0, 0, 0 - }, { - 0, 0, Types.SQL_INTERVAL_DAY, Types.SQL_INTERVAL_DAY_TO_HOUR, - Types.SQL_INTERVAL_DAY_TO_MINUTE, Types.SQL_INTERVAL_DAY_TO_SECOND - }, { - 0, 0, 0, Types.SQL_INTERVAL_HOUR, - Types.SQL_INTERVAL_HOUR_TO_MINUTE, - Types.SQL_INTERVAL_HOUR_TO_SECOND - }, { - 0, 0, 0, 0, Types.SQL_INTERVAL_MINUTE, - Types.SQL_INTERVAL_MINUTE_TO_SECOND - }, { - 0, 0, 0, 0, 0, Types.SQL_INTERVAL_SECOND - }, - }; - static final IntKeyIntValueHashMap intervalIndexMap = - new IntKeyIntValueHashMap(); - - static { - intervalIndexMap.put(Types.SQL_INTERVAL_YEAR, 0); - intervalIndexMap.put(Types.SQL_INTERVAL_MONTH, 1); - intervalIndexMap.put(Types.SQL_INTERVAL_DAY, 2); - intervalIndexMap.put(Types.SQL_INTERVAL_HOUR, 3); - intervalIndexMap.put(Types.SQL_INTERVAL_MINUTE, 4); - intervalIndexMap.put(Types.SQL_INTERVAL_SECOND, 5); - } - - // - public final int startIntervalType; - public final int endIntervalType; - - // - public final int startPartIndex; - public final int endPartIndex; - - protected DTIType(int typeGroup, int type, long precision, int scale, - int startIntervalType, int endIntervalType) { - - super(typeGroup, type, precision, scale); - - this.startIntervalType = startIntervalType; - this.endIntervalType = endIntervalType; - startPartIndex = intervalIndexMap.get(startIntervalType); - endPartIndex = intervalIndexMap.get(endIntervalType); - } - - protected DTIType(int typeGroup, int type, long precision, int scale) { - - super(typeGroup, type, precision, scale); - - switch (type) { - - case Types.SQL_DATE : - startIntervalType = Types.SQL_INTERVAL_YEAR; - endIntervalType = Types.SQL_INTERVAL_DAY; - break; - - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - startIntervalType = Types.SQL_INTERVAL_HOUR; - endIntervalType = Types.SQL_INTERVAL_SECOND; - break; - - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - startIntervalType = Types.SQL_INTERVAL_YEAR; - endIntervalType = Types.SQL_INTERVAL_SECOND; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DTIType"); - } - - startPartIndex = intervalIndexMap.get(startIntervalType); - endPartIndex = intervalIndexMap.get(endIntervalType); - } - - String intervalSecondToString(long seconds, int nanos, boolean signed) { - - StringBuilder sb = new StringBuilder(64); - - if (seconds < 0) { - seconds = -seconds; - - sb.append('-'); - } else if (signed) { - sb.append('+'); - } - - for (int i = startPartIndex; i <= endPartIndex; i++) { - int factor = DTIType.yearToSecondFactors[i]; - long part = seconds / factor; - - if (i == startPartIndex) { - int startDigits = precision == 0 ? 2 - : (int) precision; - int zeros = startDigits - getPrecisionExponent(part); -/* - for (int j = 0; j < zeros; j++) { - buffer.append('0'); - } -*/ - } else if (part < 10) { - sb.append('0'); - } - - sb.append(part); - - seconds %= factor; - - if (i < endPartIndex) { - sb.append((char) DTIType.yearToSecondSeparators[i]); - } - } - - if (scale != 0) { - sb.append((char) DTIType - .yearToSecondSeparators[DTIType.INTERVAL_FRACTION_PART_INDEX - 1]); - } - - if (nanos < 0) { - nanos = -nanos; - } - - for (int i = 0; i < scale; i++) { - int digit = nanos / DTIType.precisionFactors[i]; - - nanos -= digit * DTIType.precisionFactors[i]; - - sb.append(digit); - } - - return sb.toString(); - } - - public int getStartIntervalType() { - return startIntervalType; - } - - public int getEndIntervalType() { - return endIntervalType; - } - - public Type getExtractType(int part) { - - switch (part) { - - case Types.DTI_DAY_NAME : - case Types.DTI_MONTH_NAME : - case Types.DTI_QUARTER : - case Types.DTI_DAY_OF_MONTH : - case Types.DTI_DAY_OF_YEAR : - case Types.DTI_DAY_OF_WEEK : - case Types.DTI_WEEK_OF_YEAR : - case Types.DTI_ISO_WEEK_OF_YEAR : - if (!isDateTimeType()) { - throw Error.error(ErrorCode.X_42561); - } - - if (part == Types.DTI_DAY_NAME - || part == Types.DTI_MONTH_NAME) { - return Type.SQL_VARCHAR; - } else { - return Type.SQL_INTEGER; - } - case Types.SQL_INTERVAL_SECOND : - if (part == startIntervalType || part == endIntervalType) { - - // type is INTERVAL SECOND - // or TIMESTAMP or INTERVAL x TO SECOND - if (scale == 0) { - return Type.SQL_BIGINT; - } - - return new NumberType(Types.SQL_DECIMAL, - maxIntervalSecondPrecision + scale, - scale); - } - - throw Error.error(ErrorCode.X_42561); - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_MONTH : - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_MINUTE : - if (part < startIntervalType || part > endIntervalType) { - throw Error.error(ErrorCode.X_42561); - } - - return Type.SQL_INTEGER; - - // used for DATEPART function - case Types.DTI_MILLISECOND : - case Types.DTI_MICROSECOND : - case Types.DTI_NANOSECOND : - return Type.SQL_BIGINT; - - case Types.DTI_SECONDS_MIDNIGHT : - if (!isDateTimeType() - || endIntervalType < Types.SQL_INTERVAL_SECOND) { - throw Error.error(ErrorCode.X_42561); - } - - return Type.SQL_INTEGER; - - case Types.DTI_TIMEZONE : - case Types.DTI_TIMEZONE_HOUR : - case Types.DTI_TIMEZONE_MINUTE : - if (typeCode != Types.SQL_TIMESTAMP_WITH_TIME_ZONE - && typeCode != Types.SQL_TIME_WITH_TIME_ZONE) { - throw Error.error(ErrorCode.X_42561); - } - - return Type.SQL_INTEGER; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DTIType"); - } - } - - public static int normaliseFraction(int fraction, int precision) { - return (fraction / nanoScaleFactors[precision]) - * nanoScaleFactors[precision]; - } - - public static int normaliseFraction(int fraction, int digits, - int precision) { - - fraction *= DTIType.nanoScaleFactors[digits]; - - return (fraction / nanoScaleFactors[precision]) - * nanoScaleFactors[precision]; - } - - static int getPrecisionExponent(long value) { - - int i = 1; - - for (; i < precisionLimits.length; i++) { - if (value < precisionLimits[i]) { - break; - } - } - - return i; - } - - public static int getFieldNameTypeForToken(int token) { - - switch (token) { - - case Tokens.YEAR : - return Types.SQL_INTERVAL_YEAR; - - case Tokens.MONTH : - return Types.SQL_INTERVAL_MONTH; - - case Tokens.DAY : - return Types.SQL_INTERVAL_DAY; - - case Tokens.HOUR : - return Types.SQL_INTERVAL_HOUR; - - case Tokens.MINUTE : - return Types.SQL_INTERVAL_MINUTE; - - case Tokens.SECOND : - return Types.SQL_INTERVAL_SECOND; - - case Tokens.MILLISECOND : - return Types.DTI_MILLISECOND; - - case Tokens.MICROSECOND : - return Types.DTI_MICROSECOND; - - case Tokens.NANOSECOND : - return Types.DTI_NANOSECOND; - - case Tokens.TIMEZONE_HOUR : - return Types.DTI_TIMEZONE_HOUR; - - case Tokens.TIMEZONE_MINUTE : - return Types.DTI_TIMEZONE_MINUTE; - - case Tokens.TIMEZONE : - return Types.DTI_TIMEZONE; - - case Tokens.DAY_NAME : - return Types.DTI_DAY_NAME; - - case Tokens.MONTH_NAME : - return Types.DTI_MONTH_NAME; - - case Tokens.QUARTER : - return Types.DTI_QUARTER; - - case Tokens.DAY_OF_MONTH : - return Types.DTI_DAY_OF_MONTH; - - case Tokens.DAY_OF_WEEK : - return Types.DTI_DAY_OF_WEEK; - - case Tokens.DAY_OF_YEAR : - return Types.DTI_DAY_OF_YEAR; - - case Tokens.WEEK_OF_YEAR : - return Types.DTI_WEEK_OF_YEAR; - - case Tokens.ISO_WEEK_OF_YEAR : - return Types.DTI_ISO_WEEK_OF_YEAR; - - case Tokens.SECONDS_MIDNIGHT : - return Types.DTI_SECONDS_MIDNIGHT; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DTIType"); - } - } - - public static String getFieldNameTokenForType(int type) { - - switch (type) { - - case Types.SQL_INTERVAL_YEAR : - return Tokens.T_YEAR; - - case Types.SQL_INTERVAL_MONTH : - return Tokens.T_MONTH; - - case Types.SQL_INTERVAL_DAY : - return Tokens.T_DAY; - - case Types.SQL_INTERVAL_HOUR : - return Tokens.T_HOUR; - - case Types.SQL_INTERVAL_MINUTE : - return Tokens.T_MINUTE; - - case Types.SQL_INTERVAL_SECOND : - return Tokens.T_SECOND; - - case Types.DTI_TIMEZONE_HOUR : - return Tokens.T_TIMEZONE_HOUR; - - case Types.DTI_TIMEZONE_MINUTE : - return Tokens.T_TIMEZONE_MINUTE; - - case Types.DTI_DAY_NAME : - return Tokens.T_DAY_NAME; - - case Types.DTI_MONTH_NAME : - return Tokens.T_MONTH_NAME; - - case Types.DTI_QUARTER : - return Tokens.T_QUARTER; - - case Types.DTI_DAY_OF_MONTH : - return Tokens.T_DAY_OF_MONTH; - - case Types.DTI_DAY_OF_WEEK : - return Tokens.T_DAY_OF_WEEK; - - case Types.DTI_DAY_OF_YEAR : - return Tokens.T_DAY_OF_YEAR; - - case Types.DTI_WEEK_OF_YEAR : - return Tokens.T_WEEK_OF_YEAR; - - case Types.DTI_ISO_WEEK_OF_YEAR : - return Tokens.T_ISO_WEEK_OF_YEAR; - - case Types.DTI_SECONDS_MIDNIGHT : - return Tokens.T_SECONDS_MIDNIGHT; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DTIType"); - } - } - - public static boolean isValidDatetimeRange(Type a, Type b) { - - if (!a.isDateTimeType()) { - return false; - } - - if (b.isDateTimeType()) { - if ((a.typeCode == Types.SQL_TIME && b.typeCode == Types.SQL_DATE) - || (a.typeCode == Types.SQL_DATE - && b.typeCode == Types.SQL_TIME)) { - return false; - } - - return true; - } - - if (b.isIntervalType()) { - return ((DateTimeType) a).canAdd((IntervalType) b); - } - - return false; - } - - public static final int defaultTimeFractionPrecision = 0; - public static final int defaultTimestampFractionPrecision = 6; - public static final int defaultIntervalPrecision = 2; - public static final int defaultIntervalFractionPrecision = 6; - public static final int maxIntervalPrecision = 9; - public static final int maxIntervalSecondPrecision = 12; - public static final int maxFractionPrecision = 9; - public static final int limitNanoseconds = 1000000000; - - public abstract int getPart(Session session, Object dateTime, int part); - - public abstract BigDecimal getSecondPart(Session session, Object dateTime); - - BigDecimal getSecondPart(long seconds, long nanos) { - - seconds *= DTIType.precisionLimits[scale]; - seconds += nanos / DTIType.nanoScaleFactors[scale]; - - return BigDecimal.valueOf(seconds, scale); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/DateTimeType.java b/database/hsqldb/src/org/hsqldb/types/DateTimeType.java deleted file mode 100644 index 97d6dc9a..00000000 --- a/database/hsqldb/src/org/hsqldb/types/DateTimeType.java +++ /dev/null @@ -1,2915 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.math.BigDecimal; -import java.text.SimpleDateFormat; - -//#ifdef JAVA8 -import java.time.Instant; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.OffsetDateTime; -import java.time.OffsetTime; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.temporal.ChronoField; - -//#endif JAVA8 -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - -import org.hsqldb.HsqlDateTime; -import org.hsqldb.HsqlException; -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.HashSet; -import org.hsqldb.lib.StringConverter; - -/** - * Type subclass for DATE, TIME and TIMESTAMP.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since 1.9.0 - */ -public final class DateTimeType extends DTIType { - - public static final long epochSeconds = - HsqlDateTime.getDateSeconds("1-01-01"); - public static final TimestampData epochTimestamp = - new TimestampData(epochSeconds); - public static final long epochLimitSeconds = - HsqlDateTime.getDateSeconds("10000-01-01"); - public static final TimestampData epochLimitTimestamp = - new TimestampData(epochLimitSeconds); - - // this is used for the lifetime of the JVM - it should not be altered - public final static TimeZone systemTimeZone = TimeZone.getDefault(); - public final static HashSet zoneIDs = - new HashSet(TimeZone.getAvailableIDs()); - public final boolean withTimeZone; - private final String nameString; - - public DateTimeType(int typeGroup, int type, int scale) { - - super(typeGroup, type, 0, scale); - - withTimeZone = type == Types.SQL_TIME_WITH_TIME_ZONE - || type == Types.SQL_TIMESTAMP_WITH_TIME_ZONE; - nameString = getNameStringPrivate(); - } - - public int displaySize() { - - switch (typeCode) { - - case Types.SQL_DATE : - return 10; - - case Types.SQL_TIME : - return 8 + (scale == 0 ? 0 - : scale + 1); - - case Types.SQL_TIME_WITH_TIME_ZONE : - return 8 + (scale == 0 ? 0 - : scale + 1) + 6; - - case Types.SQL_TIMESTAMP : - return 19 + (scale == 0 ? 0 - : scale + 1); - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return 19 + (scale == 0 ? 0 - : scale + 1) + 6; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public int getJDBCTypeCode() { - - switch (typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - return Types.TIME_WITH_TIMEZONE; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return Types.TIMESTAMP_WITH_TIMEZONE; - - default : - - // JDBC numbers happen to be the same as SQL - return typeCode; - } - } - - public Class getJDBCClass() { - - switch (typeCode) { - - case Types.SQL_DATE : - return java.sql.Date.class; - - case Types.SQL_TIME : - return java.sql.Time.class; - - case Types.SQL_TIMESTAMP : - return java.sql.Timestamp.class; - -//#ifdef JAVA8 - case Types.SQL_TIME_WITH_TIME_ZONE : - return OffsetTime.class; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return OffsetDateTime.class; - -//#else -/* - case Types.SQL_TIME_WITH_TIME_ZONE : - return java.sql.Time.class; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return java.sql.Timestamp.class; -*/ - -//#endif JAVA8 - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public String getJDBCClassName() { - - switch (typeCode) { - - case Types.SQL_DATE : - return "java.sql.Date"; - - case Types.SQL_TIME : - return "java.sql.Time"; - - case Types.SQL_TIMESTAMP : - return "java.sql.Timestamp"; - -//#ifdef JAVA8 - case Types.SQL_TIME_WITH_TIME_ZONE : - return "java.time.OffsetTime"; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return "java.time.OffsetDateTime"; - -//#else -/* - case Types.SQL_TIME_WITH_TIME_ZONE : - return "java.sql.Time"; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return "java.sql.Timestamp"; -*/ - -//#endif JAVA8 - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public int getJDBCPrecision() { - return this.displaySize(); - } - - public int getSQLGenericTypeCode() { - return Types.SQL_DATETIME; - } - - public String getNameString() { - return nameString; - } - - public boolean canCompareDirect(Type otherType) { - return typeCode == otherType.typeCode; - } - - private String getNameStringPrivate() { - - switch (typeCode) { - - case Types.SQL_DATE : - return Tokens.T_DATE; - - case Types.SQL_TIME : - return Tokens.T_TIME; - - case Types.SQL_TIME_WITH_TIME_ZONE : - return Tokens.T_TIME + ' ' + Tokens.T_WITH + ' ' - + Tokens.T_TIME + ' ' + Tokens.T_ZONE; - - case Types.SQL_TIMESTAMP : - return Tokens.T_TIMESTAMP; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return Tokens.T_TIMESTAMP + ' ' + Tokens.T_WITH + ' ' - + Tokens.T_TIME + ' ' + Tokens.T_ZONE; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public String getDefinition() { - - String token; - - switch (typeCode) { - - case Types.SQL_DATE : - return Tokens.T_DATE; - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : - if (scale == DTIType.defaultTimeFractionPrecision) { - return getNameString(); - } - - token = Tokens.T_TIME; - break; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : - if (scale == DTIType.defaultTimestampFractionPrecision) { - return getNameString(); - } - - token = Tokens.T_TIMESTAMP; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - - StringBuilder sb = new StringBuilder(16); - - sb.append(token); - sb.append('('); - sb.append(scale); - sb.append(')'); - - if (withTimeZone) { - sb.append(' ' + Tokens.T_WITH + ' ' + Tokens.T_TIME + ' ' - + Tokens.T_ZONE); - } - - return sb.toString(); - } - - public boolean isDateTimeType() { - return true; - } - - public boolean isDateOrTimestampType() { - - switch (typeCode) { - - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return true; - - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - return false; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public boolean isTimestampType() { - - switch (typeCode) { - - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return true; - - case Types.SQL_DATE : - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - return false; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public boolean isTimeType() { - - switch (typeCode) { - - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_DATE : - return false; - - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - return true; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public boolean isDateTimeTypeWithZone() { - return withTimeZone; - } - - public boolean acceptsFractionalPrecision() { - return typeCode != Types.SQL_DATE; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - // DATE with DATE returned here - if (typeCode == other.typeCode) { - return scale >= other.scale ? this - : other; - } - - if (other.typeCode == Types.SQL_ALL_TYPES) { - return this; - } - - if (other.isCharacterType()) { - return other.getAggregateType(this); - } - - if (!other.isDateTimeType()) { - throw Error.error(ErrorCode.X_42562); - } - - DateTimeType otherType = (DateTimeType) other; - - // DATE with TIME caught here - if (otherType.startIntervalType > endIntervalType - || startIntervalType > otherType.endIntervalType) { - throw Error.error(ErrorCode.X_42562); - } - - int newType = typeCode; - int scale = this.scale > otherType.scale ? this.scale - : otherType.scale; - boolean zone = withTimeZone || otherType.withTimeZone; - int startType = otherType.startIntervalType > startIntervalType - ? startIntervalType - : otherType.startIntervalType; - - if (startType == Types.SQL_INTERVAL_HOUR) { - newType = zone ? Types.SQL_TIME_WITH_TIME_ZONE - : Types.SQL_TIME; - } else { - newType = zone ? Types.SQL_TIMESTAMP_WITH_TIME_ZONE - : Types.SQL_TIMESTAMP; - } - - return getDateTimeType(newType, scale); - } - - public Type getCombinedType(Session session, Type other, int operation) { - - switch (operation) { - - case OpTypes.EQUAL : - case OpTypes.GREATER : - case OpTypes.GREATER_EQUAL : - case OpTypes.SMALLER_EQUAL : - case OpTypes.SMALLER : - case OpTypes.NOT_EQUAL : { - if (typeCode == other.typeCode) { - return this; - } - - if (other.typeCode == Types.SQL_ALL_TYPES) { - return this; - } - - if (!other.isDateTimeType()) { - throw Error.error(ErrorCode.X_42562); - } - - DateTimeType otherType = (DateTimeType) other; - - // DATE with TIME caught here - if (otherType.startIntervalType > endIntervalType - || startIntervalType > otherType.endIntervalType) { - throw Error.error(ErrorCode.X_42562); - } - - int newType = typeCode; - int scale = this.scale > otherType.scale ? this.scale - : otherType - .scale; - boolean zone = withTimeZone || otherType.withTimeZone; - int startType = otherType.startIntervalType - > startIntervalType ? startIntervalType - : otherType - .startIntervalType; - - if (startType == Types.SQL_INTERVAL_HOUR) { - newType = zone ? Types.SQL_TIME_WITH_TIME_ZONE - : Types.SQL_TIME; - } else { - newType = zone ? Types.SQL_TIMESTAMP_WITH_TIME_ZONE - : Types.SQL_TIMESTAMP; - } - - return getDateTimeType(newType, scale); - } - case OpTypes.ADD : - case OpTypes.SUBTRACT : - if (other.isIntervalType()) { - if (typeCode != Types.SQL_DATE && other.scale > scale) { - return getDateTimeType(typeCode, other.scale); - } - - return this; - } else if (other.isDateTimeType()) { - if (operation == OpTypes.SUBTRACT) { - if (other.typeComparisonGroup == typeComparisonGroup) { - if (typeCode == Types.SQL_DATE) { - return Type.SQL_INTERVAL_DAY_MAX_PRECISION; - } else { - return Type - .SQL_INTERVAL_DAY_TO_SECOND_MAX_PRECISION; - } - } - } - } else if (other.isNumberType()) { - return this; - } - break; - - default : - } - - throw Error.error(ErrorCode.X_42562); - } - - public int compare(Session session, Object a, Object b) { - - long diff; - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - switch (typeCode) { - - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : { - diff = ((TimeData) a).seconds - ((TimeData) b).seconds; - - if (diff == 0) { - diff = ((TimeData) a).nanos - ((TimeData) b).nanos; - } - - return diff == 0 ? 0 - : diff > 0 ? 1 - : -1; - } - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - diff = ((TimestampData) a).seconds - - ((TimestampData) b).seconds; - - if (diff == 0) { - diff = ((TimestampData) a).nanos - - ((TimestampData) b).nanos; - } - - return diff == 0 ? 0 - : diff > 0 ? 1 - : -1; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_DATE : - return a; - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : { - TimeData ti = (TimeData) a; - int nanos = ti.nanos; - int newNanos = scaleNanos(nanos); - - if (newNanos == nanos) { - return ti; - } - - return new TimeData(ti.seconds, newNanos, ti.zone); - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : { - TimestampData ts = (TimestampData) a; - int nanos = ts.nanos; - int newNanos = scaleNanos(nanos); - - if (ts.seconds > epochLimitSeconds) { - throw Error.error(ErrorCode.X_22008); - } - - if (newNanos == nanos) { - return ts; - } - - return new TimestampData(ts.seconds, newNanos, ts.zone); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - int scaleNanos(int nanos) { - - int divisor = nanoScaleFactors[scale]; - - return (nanos / divisor) * divisor; - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - switch (otherType.typeCode) { - - case Types.SQL_CLOB : - a = Type.SQL_VARCHAR.convertToType(session, a, otherType); - - //fall through - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : - switch (this.typeCode) { - - case Types.SQL_DATE : - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : { - try { - return session.getScanner() - .convertToDatetimeInterval(session, - (String) a, this); - } catch (HsqlException e) { - return convertToDatetimeSpecial(session, - (String) a, this); - } - } - } - break; - - case Types.SQL_DATE : - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - break; - - default : - throw Error.error(ErrorCode.X_42561); - } - - switch (this.typeCode) { - - case Types.SQL_DATE : - switch (otherType.typeCode) { - - case Types.SQL_DATE : - return a; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - long seconds = ((TimestampData) a).seconds - + ((TimestampData) a).zone; - - seconds = toDateSeconds(seconds); - - return new TimestampData(seconds); - } - case Types.SQL_TIMESTAMP : { - long seconds = ((TimestampData) a).seconds; - - seconds = DateTimeType.toDateSeconds(seconds); - - return new TimestampData(seconds); - } - default : - throw Error.error(ErrorCode.X_42561); - } - case Types.SQL_TIME_WITH_TIME_ZONE : - switch (otherType.typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - return convertToTypeLimits(session, a); - - case Types.SQL_TIME : { - TimeData ti = (TimeData) a; - int zoneSeconds = session.getZoneSeconds(); - - return new TimeData(ti.seconds - zoneSeconds, - scaleNanos(ti.nanos), zoneSeconds); - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - TimestampData ts = (TimestampData) a; - int seconds = toTimeSeconds(ts.seconds); - - return new TimeData(seconds, scaleNanos(ts.nanos), - ts.zone); - } - case Types.SQL_TIMESTAMP : { - TimestampData ts = (TimestampData) a; - int zoneSeconds = session.getZoneSeconds(); - int seconds = toTimeSeconds(ts.seconds - zoneSeconds); - - return new TimeData(seconds, scaleNanos(ts.nanos), - zoneSeconds); - } - default : - throw Error.error(ErrorCode.X_42561); - } - case Types.SQL_TIME : - switch (otherType.typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : { - TimeData ti = (TimeData) a; - int seconds = toTimeSeconds(ti.seconds + ti.zone); - - return new TimeData(seconds, scaleNanos(ti.nanos)); - } - case Types.SQL_TIME : - return convertToTypeLimits(session, a); - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - TimestampData ts = (TimestampData) a; - int seconds = toTimeSeconds(ts.seconds + ts.zone); - - return new TimeData(seconds, scaleNanos(ts.nanos)); - } - case Types.SQL_TIMESTAMP : { - TimestampData ts = (TimestampData) a; - int seconds = toTimeSeconds(ts.seconds); - - return new TimeData(seconds, scaleNanos(ts.nanos)); - } - default : - throw Error.error(ErrorCode.X_42561); - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - switch (otherType.typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : { - TimeData ti = (TimeData) a; - - return convertTimeToTimestamp(session.getCalendar(), - ti.seconds + ti.zone, - scaleNanos(ti.nanos)); - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return convertToTypeLimits(session, a); - - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP : { - if (!(a instanceof TimestampData)) { - throw Error.error(ErrorCode.X_42561); - } - - TimestampData ts = (TimestampData) a; - Calendar calendar = session.getCalendar(); - long seconds = HsqlDateTime.convertSecondsFromCalendar( - session.getCalendarGMT(), calendar, ts.seconds); - int zoneSeconds = - getZoneSeconds(seconds, calendar.getTimeZone()); - - return new TimestampData(seconds, - scaleNanos(ts.nanos), - zoneSeconds); - } - default : - throw Error.error(ErrorCode.X_42561); - } - case Types.SQL_TIMESTAMP : - switch (otherType.typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : { - TimeData ti = (TimeData) a; - - return convertTimeToTimestamp(session.getCalendar(), - ti.seconds + ti.zone, - scaleNanos(ti.nanos)); - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - TimestampData ts = (TimestampData) a; - long seconds = ts.seconds + ts.zone; - - return new TimestampData(seconds, - scaleNanos(ts.nanos)); - } - case Types.SQL_TIMESTAMP : - return convertToTypeLimits(session, a); - - case Types.SQL_DATE : - return a; - - default : - throw Error.error(ErrorCode.X_42561); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - Type otherType = a instanceof TimeData ? Type.SQL_TIME - : Type.SQL_TIMESTAMP; - - return convertToType(session, a, otherType); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - return convertJavaToSQL(session, a, null); - } - - public Object convertJavaToSQL(SessionInterface session, Object a, - Calendar calendar) { - - if (a == null) { - return null; - } - - if (calendar == null) { - calendar = session.getCalendar(); - } - - long seconds = 0; - int nanos = 0; - int zoneSeconds = 0; - boolean hasZone = false; - boolean isTimeObject = false; - boolean isDateObject = false; - - if (a instanceof java.util.Date) { - long millis = ((java.util.Date) a).getTime(); - - if (a instanceof java.sql.Time) { - isTimeObject = true; - nanos = (int) (millis % millisInSecond * nanosInMilli); - } else if (a instanceof java.sql.Date) { - isDateObject = true; - } else if (a instanceof java.sql.Timestamp) { - nanos = ((java.sql.Timestamp) a).getNanos(); - millis -= (nanos / nanosInMilli); - } else { - nanos = (int) (millis % millisInSecond * nanosInMilli); - } - - seconds = millis / millisInSecond; - zoneSeconds = getZoneSeconds(seconds, calendar.getTimeZone()); - -//#ifdef JAVA8 - } else if (a instanceof java.time.LocalDate) { - LocalDate ld = (LocalDate) a; - - setDateComponents(calendar, ld); - - seconds = calendar.getTimeInMillis() / millisInSecond; - zoneSeconds = getZoneSeconds(seconds, calendar.getTimeZone()); - nanos = 0; - isDateObject = true; - } else if (a instanceof OffsetDateTime) { - OffsetDateTime odt = (OffsetDateTime) a; - - seconds = odt.toEpochSecond(); - zoneSeconds = odt.get(ChronoField.OFFSET_SECONDS); - nanos = odt.getNano(); - hasZone = true; - } else if (a instanceof ZonedDateTime) { - ZonedDateTime zdt = (ZonedDateTime) a; - - seconds = zdt.toEpochSecond(); - zoneSeconds = zdt.get(ChronoField.OFFSET_SECONDS); - nanos = zdt.getNano(); - hasZone = true; - } else if (a instanceof java.time.LocalDateTime) { - LocalDateTime ldt = (LocalDateTime) a; - - setDateTimeComponents(calendar, ldt); - - seconds = calendar.getTimeInMillis() / millisInSecond; - zoneSeconds = getZoneSeconds(seconds, calendar.getTimeZone()); - nanos = ldt.getNano(); - } else if (a instanceof java.time.Instant) { - Instant ins = (Instant) a; - - seconds = ins.getEpochSecond(); - zoneSeconds = getZoneSeconds(seconds, calendar.getTimeZone()); - nanos = ins.getNano(); - } else if (a instanceof java.time.OffsetTime) { - OffsetTime ot = (OffsetTime) a; - - seconds = ot.toLocalTime().toSecondOfDay(); - zoneSeconds = ot.get(ChronoField.OFFSET_SECONDS); - seconds = seconds - zoneSeconds; - nanos = ot.getNano(); - isTimeObject = true; - hasZone = true; - } else if (a instanceof java.time.LocalTime) { - LocalTime lt = (LocalTime) a; - - seconds = lt.toSecondOfDay(); - zoneSeconds = getZoneSeconds(seconds, calendar.getTimeZone()); - nanos = lt.getNano(); - isTimeObject = true; - -//#endif JAVA8 - } else { - throw Error.error(ErrorCode.X_42561); - } - - if (!withTimeZone) { - seconds += zoneSeconds; - zoneSeconds = 0; - } - - switch (typeCode) { - - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : { - if (isDateObject) { - throw Error.error(ErrorCode.X_42561); - } - - nanos = DateTimeType.normaliseFraction(nanos, scale); - - return new TimeData((int) seconds, nanos, zoneSeconds); - } - case Types.SQL_DATE : { - if (isTimeObject) { - throw Error.error(ErrorCode.X_42561); - } - - seconds = toDateSeconds(seconds); - - return new TimestampData(seconds); - } - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - if (isTimeObject) { - return convertTimeToTimestamp(calendar, - seconds + zoneSeconds, - nanos); - } - - nanos = DateTimeType.normaliseFraction(nanos, scale); - - return new TimestampData(seconds, nanos, zoneSeconds); - } - default : - throw Error.error(ErrorCode.X_42561); - } - } - - public Object convertSQLToJavaGMT(SessionInterface session, Object a) { - - long millis; - - switch (typeCode) { - - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - millis = ((TimeData) a).seconds * millisInSecond; - millis += ((TimeData) a).nanos / nanosInMilli; - - return new java.sql.Time(millis); - - case Types.SQL_DATE : - millis = ((TimestampData) a).seconds * millisInSecond; - - return new java.sql.Date(millis); - - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - millis = ((TimestampData) a).seconds * millisInSecond; - - java.sql.Timestamp value = new java.sql.Timestamp(millis); - - value.setNanos(((TimestampData) a).nanos); - - return value; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - Calendar cal = session.getCalendar(); - - return convertSQLToJava(session, a, null); - } - - public Object convertSQLToJava(SessionInterface session, Object a, - Calendar cal) { - - if (a == null) { - return null; - } - - if (cal == null) { - cal = session.getCalendar(); - } - - switch (typeCode) { - - case Types.SQL_TIME : { - TimeData td = ((TimeData) a); - - setTimeComponents(cal, td.seconds); - - long millis = cal.getTimeInMillis() + td.nanos / nanosInMilli; - - return new java.sql.Time(millis); - } - case Types.SQL_TIME_WITH_TIME_ZONE : { - -//#ifdef JAVA8 - TimeData ts = (TimeData) a; - ZoneOffset zone = ZoneOffset.ofTotalSeconds(ts.zone); - int seconds = toTimeSeconds(ts.seconds + ts.zone); - long nanos = seconds * nanosInSecond; - LocalTime ldt = LocalTime.ofNanoOfDay(nanos + ts.nanos); - - return OffsetTime.of(ldt, zone); - -//#else -/* - long millis = ((TimeData) a).getMillis(); - - return new java.sql.Time(millis); -*/ - -//#endif JAVA8 - } - case Types.SQL_DATE : { - Calendar calGMT = session.getCalendarGMT(); - long millis = ((TimestampData) a).getMillis(); - - HsqlDateTime.convertMillisFromCalendar(calGMT, cal, millis); - HsqlDateTime.zeroFromPart(cal, Types.SQL_INTERVAL_DAY); - - millis = cal.getTimeInMillis(); - - return new java.sql.Date(millis); - } - case Types.SQL_TIMESTAMP : { - Calendar calGMT = session.getCalendarGMT(); - long millis = ((TimestampData) a).getMillis(); - - millis = HsqlDateTime.convertMillisFromCalendar(calGMT, cal, - millis); - - java.sql.Timestamp value = new java.sql.Timestamp(millis); - - value.setNanos(((TimestampData) a).nanos); - - return value; - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - -//#ifdef JAVA8 - TimestampData ts = (TimestampData) a; - ZoneOffset zone = ZoneOffset.ofTotalSeconds(ts.zone); - LocalDateTime ldt = LocalDateTime.ofEpochSecond(ts.seconds, - ts.nanos, zone); - - return OffsetDateTime.of(ldt, zone); - -//#else -/* - long millis = ((TimestampData) a).getMillis(); - java.sql.Timestamp value = new java.sql.Timestamp(millis); - - value.setNanos(((TimestampData) a).nanos); - - return value; -*/ - -//#endif JAVA8 - } - default : - throw Error.error(ErrorCode.X_42561); - } - } - - public String convertToString(Object a) { - - boolean zone = false; - String s; - StringBuilder sb; - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_DATE : - return HsqlDateTime.getDateString(((TimestampData) a).seconds); - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : { - TimeData t = (TimeData) a; - int seconds = toTimeSeconds(t.seconds + t.zone); - - s = intervalSecondToString(seconds, t.nanos, false); - - if (!withTimeZone) { - return s; - } - - s += Type.SQL_INTERVAL_HOUR_TO_MINUTE.intervalSecondToString( - t.zone, 0, true); - - return s; - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : { - TimestampData ts = (TimestampData) a; - String tss = HsqlDateTime.getTimestampString(ts.seconds - + ts.zone, ts.nanos, scale); - - if (withTimeZone) { - s = Type.SQL_INTERVAL_HOUR_TO_MINUTE - .intervalSecondToString(ts.zone, 0, true); - tss += s; - } - - return tss; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - StringBuilder sb = new StringBuilder(32); - - switch (typeCode) { - - case Types.SQL_DATE : - sb.append(Tokens.T_DATE); - break; - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : - sb.append(Tokens.T_TIME); - break; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : - sb.append(Tokens.T_TIMESTAMP); - break; - } - - sb.append(StringConverter.toQuotedString(convertToString(a), '\'', - false)); - - return sb.toString(); - } - - public void convertToJSON(Object a, StringBuilder sb) { - - if (a == null) { - sb.append("null"); - - return; - } - - sb.append('"'); - sb.append(convertToString(a)); - sb.append('"'); - } - - public boolean canConvertFrom(Type otherType) { - - if (otherType.typeCode == Types.SQL_ALL_TYPES) { - return true; - } - - if (otherType.isCharacterType()) { - return true; - } - - if (!otherType.isDateTimeType()) { - return false; - } - - if (otherType.typeCode == Types.SQL_DATE) { - return typeCode != Types.SQL_TIME; - } else if (otherType.typeCode == Types.SQL_TIME) { - return typeCode != Types.SQL_DATE; - } - - return true; - } - - public int canMoveFrom(Type otherType) { - - if (otherType == this) { - return ReType.keep; - } - - if (typeCode == otherType.typeCode) { - return scale >= otherType.scale ? ReType.keep - : ReType.change; - } - - return -1; - } - - public Object add(Session session, Object a, Object b, Type otherType) { - - if (a == null || b == null) { - return null; - } - - if (otherType.isNumberType()) { - if (typeCode == Types.SQL_DATE) { - b = ((NumberType) otherType).floor(b); - } - - b = Type.SQL_INTERVAL_SECOND_MAX_PRECISION.multiply( - IntervalSecondData.oneDay, b); - } - - switch (typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : - if (b instanceof IntervalMonthData) { - throw Error.runtimeError(ErrorCode.U_S0500, - "DateTimeType"); - } else if (b instanceof IntervalSecondData) { - return addSeconds((TimeData) a, - ((IntervalSecondData) b).units, - ((IntervalSecondData) b).nanos); - } - break; - - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : - if (b instanceof IntervalMonthData) { - return addMonths(session, (TimestampData) a, - ((IntervalMonthData) b).units); - } else if (b instanceof IntervalSecondData) { - return addSeconds((TimestampData) a, - ((IntervalSecondData) b).units, - ((IntervalSecondData) b).nanos); - } - break; - - default : - } - - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - - public Object subtract(Session session, Object a, Object b, - Type otherType) { - - if (a == null || b == null) { - return null; - } - - if (otherType.isNumberType()) { - if (typeCode == Types.SQL_DATE) { - b = ((NumberType) otherType).floor(b); - } - - b = Type.SQL_INTERVAL_SECOND_MAX_PRECISION.multiply( - IntervalSecondData.oneDay, b); - } - - switch (typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : - if (b instanceof IntervalMonthData) { - throw Error.runtimeError(ErrorCode.U_S0500, - "DateTimeType"); - } else if (b instanceof IntervalSecondData) { - return addSeconds((TimeData) a, - -((IntervalSecondData) b).units, - -((IntervalSecondData) b).nanos); - } - break; - - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : - if (b instanceof IntervalMonthData) { - return addMonths(session, (TimestampData) a, - -((IntervalMonthData) b).units); - } else if (b instanceof IntervalSecondData) { - return addSeconds((TimestampData) a, - -((IntervalSecondData) b).units, - -((IntervalSecondData) b).nanos); - } - break; - - default : - } - - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - - public static double convertToDouble(Object a) { - - double seconds; - double fraction; - - if (a instanceof TimeData) { - seconds = ((TimeData) a).seconds; - fraction = ((TimeData) a).nanos / 1000000000d; - } else { - seconds = ((TimestampData) a).seconds; - fraction = ((TimestampData) a).nanos / 1000000000d; - } - - return seconds + fraction; - } - - public TimestampData convertFromDouble(Session session, double value) { - - long units = (long) value; - int nanos = (int) ((value - units) * nanosInSecond); - - return getDateTimeValue(session, units, nanos); - } - - public Object truncate(Session session, Object a, int part) { - - if (a == null) { - return null; - } - - long millis = getTotalMillis(a); - Calendar calendar = session.getCalendarGMT(); - - millis = HsqlDateTime.getTruncatedPart(calendar, millis, part); - millis -= getZoneMillis(a); - - switch (typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : { - millis = HsqlDateTime.getNormalisedTime(calendar, millis); - - return new TimeData((int) (millis / millisInSecond), 0, - ((TimeData) a).zone); - } - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : { - return new TimestampData(millis / millisInSecond, 0, - ((TimestampData) a).zone); - } - default : - } - - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - - public Object round(Session session, Object a, int part) { - - if (a == null) { - return null; - } - - long millis = getTotalMillis(a); - Calendar calendar = session.getCalendarGMT(); - - millis = HsqlDateTime.getRoundedPart(calendar, millis, part); - millis -= getZoneMillis(a); - - switch (typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIME : { - millis = HsqlDateTime.getNormalisedTime(millis); - - return new TimeData((int) (millis / millisInSecond), 0, - ((TimeData) a).zone); - } - case Types.SQL_DATE : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : { - return new TimestampData(millis / millisInSecond, 0, - ((TimestampData) a).zone); - } - default : - } - - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - - public boolean equals(Object other) { - - if (other == this) { - return true; - } - - if (other instanceof DateTimeType) { - return super.equals(other) - && ((DateTimeType) other).withTimeZone == withTimeZone; - } - - return false; - } - - public int getPart(Session session, Object dateTime, int part) { - - int calendarPart; - int increment = 0; - int divisor = 1; - - switch (part) { - - case Types.SQL_INTERVAL_YEAR : - calendarPart = Calendar.YEAR; - break; - - case Types.SQL_INTERVAL_MONTH : - increment = 1; - calendarPart = Calendar.MONTH; - break; - - case Types.SQL_INTERVAL_DAY : - case Types.DTI_DAY_OF_MONTH : - calendarPart = Calendar.DAY_OF_MONTH; - break; - - case Types.SQL_INTERVAL_HOUR : - calendarPart = Calendar.HOUR_OF_DAY; - break; - - case Types.SQL_INTERVAL_MINUTE : - calendarPart = Calendar.MINUTE; - break; - - case Types.SQL_INTERVAL_SECOND : - calendarPart = Calendar.SECOND; - break; - - case Types.DTI_DAY_OF_WEEK : - calendarPart = Calendar.DAY_OF_WEEK; - break; - - case Types.DTI_WEEK_OF_YEAR : - case Types.DTI_ISO_WEEK_OF_YEAR : - calendarPart = Calendar.WEEK_OF_YEAR; - break; - - case Types.DTI_SECONDS_MIDNIGHT : { - long seconds = getTotalSeconds(dateTime); - - return toTimeSeconds(seconds); - } - case Types.DTI_TIMEZONE_HOUR : - if (typeCode == Types.SQL_TIMESTAMP_WITH_TIME_ZONE) { - return ((TimestampData) dateTime).zone / 3600; - } else { - return ((TimeData) dateTime).zone / 3600; - } - case Types.DTI_TIMEZONE_MINUTE : - if (typeCode == Types.SQL_TIMESTAMP_WITH_TIME_ZONE) { - return ((TimestampData) dateTime).zone / 60 % 60; - } else { - return ((TimeData) dateTime).zone / 60 % 60; - } - case Types.DTI_TIMEZONE : - if (typeCode == Types.SQL_TIMESTAMP_WITH_TIME_ZONE) { - return ((TimestampData) dateTime).zone / 60; - } else { - return ((TimeData) dateTime).zone / 60; - } - case Types.DTI_QUARTER : - increment = 1; - divisor = 3; - calendarPart = Calendar.MONTH; - break; - - case Types.DTI_DAY_OF_YEAR : - calendarPart = Calendar.DAY_OF_YEAR; - break; - - case Types.DTI_MILLISECOND : - if (this.isDateOrTimestampType()) { - return ((TimestampData) dateTime).nanos - / (int) nanosInMilli; - } else { - return ((TimeData) dateTime).nanos / (int) nanosInMilli; - } - case Types.DTI_MICROSECOND : - if (this.isDateOrTimestampType()) { - return ((TimestampData) dateTime).nanos / 1000; - } else { - return ((TimeData) dateTime).nanos / 1000; - } - case Types.DTI_NANOSECOND : - if (this.isDateOrTimestampType()) { - return ((TimestampData) dateTime).nanos; - } else { - return ((TimeData) dateTime).nanos; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, - "DateTimeType - " + part); - } - - long millis = getTotalMillis(dateTime); - Calendar calendar = session.getCalendarGMT(); - - calendar.setTimeInMillis(millis); - - return calendar.get(calendarPart) / divisor + increment; - } - - /** - * Returns the indicated part of the given millisecond date object. - * @param m the millisecond time value from which to extract the indicated part - * @param part an integer code corresponding to the desired date part - * @return the indicated part of the given java.util.Date object - */ - public static int getDateTimePart(Calendar calendar, long m, int part) { - - synchronized (calendar) { - calendar.setTimeInMillis(m); - - return calendar.get(part); - } - } - - public Object addMonthsSpecial(Session session, Object dateTime, - int months) { - - TimestampData ts = (TimestampData) dateTime; - Calendar cal = session.getCalendarGMT(); - long millis = (ts.seconds + ts.zone) * millisInSecond; - boolean lastDay; - - HsqlDateTime.setTimeInMillis(cal, millis); - cal.set(Calendar.DAY_OF_MONTH, 1); - cal.add(Calendar.MONTH, 1); - cal.add(Calendar.DAY_OF_MONTH, -1); - - lastDay = millis == cal.getTimeInMillis(); - - HsqlDateTime.setTimeInMillis(cal, millis); - cal.add(Calendar.MONTH, months); - - if (lastDay) { - cal.set(Calendar.DAY_OF_MONTH, 1); - cal.add(Calendar.MONTH, 1); - cal.add(Calendar.DAY_OF_MONTH, -1); - } - - millis = cal.getTimeInMillis(); - - return new TimestampData(millis / millisInSecond, 0, 0); - } - - public Object getLastDayOfMonth(Session session, Object dateTime) { - - TimestampData ts = (TimestampData) dateTime; - Calendar cal = session.getCalendarGMT(); - long millis = (ts.seconds + ts.zone) * millisInSecond; - - HsqlDateTime.setTimeInMillis(cal, millis); - cal.set(Calendar.DAY_OF_MONTH, 1); - cal.add(Calendar.MONTH, 1); - cal.add(Calendar.DAY_OF_MONTH, -1); - - millis = cal.getTimeInMillis(); - - return new TimestampData(millis / millisInSecond, 0, 0); - } - - long getTotalMillis(Object dateTime) { - return getTotalSeconds(dateTime) * millisInSecond; - } - - long getTotalSeconds(Object dateTime) { - - if (typeCode == Types.SQL_TIME - || typeCode == Types.SQL_TIME_WITH_TIME_ZONE) { - TimeData td = ((TimeData) dateTime); - - return td.seconds + td.zone; - } else { - TimestampData ts = ((TimestampData) dateTime); - - return ts.seconds + ts.zone; - } - } - - long getZoneMillis(Object dateTime) { - - long millis; - - if (dateTime instanceof TimeData) { - millis = ((TimeData) dateTime).zone * millisInSecond; - } else { - millis = ((TimestampData) dateTime).zone * millisInSecond; - } - - return millis; - } - - public BigDecimal getSecondPart(Session session, Object dateTime) { - - long seconds = getPart(session, dateTime, Types.SQL_INTERVAL_SECOND); - int nanos = 0; - - if (typeCode == Types.SQL_TIMESTAMP - || typeCode == Types.SQL_TIMESTAMP_WITH_TIME_ZONE) { - nanos = ((TimestampData) dateTime).nanos; - } else if (typeCode == Types.SQL_TIME - || typeCode == Types.SQL_TIME_WITH_TIME_ZONE) { - nanos = ((TimeData) dateTime).nanos; - } - - return getSecondPart(seconds, nanos); - } - - public String getPartString(Session session, Object dateTime, int part) { - - String javaPattern = ""; - - switch (part) { - - case Types.DTI_DAY_NAME : - javaPattern = "EEEE"; - break; - - case Types.DTI_MONTH_NAME : - javaPattern = "MMMM"; - break; - } - - SimpleDateFormat format = session.getSimpleDateFormatGMT(); - - try { - format.applyPattern(javaPattern); - } catch (Exception e) {} - - Date date = (Date) convertSQLToJavaGMT(session, dateTime); - - return format.format(date); - } - - TimestampData convertTimeToTimestamp(Calendar calendar, long seconds, - int nanos) { - - calendar.setTimeInMillis(System.currentTimeMillis()); - setTimeComponentsOnly(calendar, (int) seconds); - - seconds = calendar.getTimeInMillis() / millisInSecond; - - int zoneSeconds = getZoneSeconds(seconds, calendar.getTimeZone()); - - if (!withTimeZone) { - seconds += zoneSeconds; - zoneSeconds = 0; - } - - return new TimestampData(seconds, zoneSeconds, nanos); - } - - /** - * Session derivatives of CURRENT_TIMESTAMP - */ - public static TimestampData toLocalTimestampValue( - TimestampData tsWithZone) { - return new TimestampData(tsWithZone.seconds + tsWithZone.zone, - tsWithZone.nanos); - } - - public static TimestampData toCurrentDateValue(TimestampData tsWithZone) { - - long seconds = toDateSeconds(tsWithZone.seconds + tsWithZone.zone); - - return new TimestampData(seconds); - } - - public static TimeData toCurrentTimeValue(TimestampData tsWithZone) { - - int seconds = toTimeSeconds(tsWithZone.seconds + tsWithZone.zone); - - return new TimeData(seconds, tsWithZone.nanos); - } - - public static TimeData toCurrentTimeWithZoneValue( - TimestampData tsWithZone) { - - int seconds = toTimeSeconds(tsWithZone.seconds); - - return new TimeData(seconds, tsWithZone.nanos, tsWithZone.zone); - } - - public TimestampData getDateTimeValue(SessionInterface session, - long seconds, int nanos) { - - nanos = DateTimeType.normaliseFraction(nanos, scale); - - switch (typeCode) { - - case Types.SQL_DATE : - seconds = toDateSeconds(seconds); - - return new TimestampData(seconds); - - case Types.SQL_TIMESTAMP : - return new TimestampData(seconds, nanos); - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return new TimestampData(seconds, nanos, - session.getZoneSeconds()); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public static DateTimeType getDateTimeType(int type, int scale) { - - if (scale > DTIType.maxFractionPrecision) { - throw Error.error(ErrorCode.X_42592); - } - - switch (type) { - - case Types.SQL_DATE : - return SQL_DATE; - - case Types.SQL_TIME : - if (scale == DTIType.defaultTimeFractionPrecision) { - return SQL_TIME; - } - - return new DateTimeType(Types.SQL_TIME, type, scale); - - case Types.SQL_TIME_WITH_TIME_ZONE : - if (scale == DTIType.defaultTimeFractionPrecision) { - return SQL_TIME_WITH_TIME_ZONE; - } - - return new DateTimeType(Types.SQL_TIME, type, scale); - - case Types.SQL_TIMESTAMP : - if (scale == DTIType.defaultTimestampFractionPrecision) { - return SQL_TIMESTAMP; - } - - if (scale == 0) { - return SQL_TIMESTAMP_NO_FRACTION; - } - - return new DateTimeType(Types.SQL_TIMESTAMP, type, scale); - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - if (scale == DTIType.defaultTimestampFractionPrecision) { - return SQL_TIMESTAMP_WITH_TIME_ZONE; - } - - return new DateTimeType(Types.SQL_TIMESTAMP, type, scale); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "DateTimeType"); - } - } - - public Object changeZoneToUTC(Object a) { - - if (a instanceof TimestampData) { - TimestampData ts = (TimestampData) a; - - if (ts.zone != 0) { - return new TimestampData(ts.seconds, ts.nanos); - } - } else { - TimeData ts = (TimeData) a; - - if (ts.zone != 0) { - return new TimeData(ts.seconds, ts.nanos); - } - } - - return a; - } - - public Object changeZone(Session session, Object a, String zoneString) { - - TimestampData value = (TimestampData) a; - long seconds = value.seconds + value.zone; - Calendar calendar = session.getCalendar(); - TimeZone zone = TimeZone.getTimeZone(zoneString); - TimeZone sessionZone = calendar.getTimeZone(); - - calendar.setTimeZone(zone); - - seconds = - HsqlDateTime.convertSecondsFromCalendar(session.getCalendarGMT(), - calendar, seconds); - - int offset = zone.getOffset(seconds * millisInSecond) - / (int) millisInSecond; - - calendar.setTimeZone(sessionZone); - - return new TimestampData(seconds, value.nanos, offset); - } - - public Object changeZone(Session session, Object a, Type otherType, - String zoneString) { - - TimestampData value = (TimestampData) a; - long seconds = value.seconds; - Calendar calendar = session.getCalendar(); - - if (!zoneIDs.contains(zoneString)) { - throw Error.error(ErrorCode.X_22009, zoneString); - } - - if (!otherType.isDateTimeTypeWithZone()) { - seconds = HsqlDateTime.convertSecondsFromCalendar( - session.getCalendarGMT(), calendar, seconds); - } - - TimeZone zone = TimeZone.getTimeZone(zoneString); - int offset = getZoneSeconds(seconds, zone); - - return new TimestampData(seconds, value.nanos, offset); - } - - public Object changeZone(Session session, Object a, Type otherType, - int zoneSeconds, boolean atLocal) { - - if (a == null) { - return null; - } - - if (zoneSeconds > DTIType.timezoneSecondsLimit - || -zoneSeconds > DTIType.timezoneSecondsLimit) { - throw Error.error(ErrorCode.X_22009); - } - - switch (typeCode) { - - case Types.SQL_TIME_WITH_TIME_ZONE : { - TimeData value = (TimeData) a; - - if (atLocal) { - zoneSeconds = session.getZoneSeconds(); - } - - if (otherType.isDateTimeTypeWithZone()) { - if (value.zone == zoneSeconds) { - return value; - } - - return new TimeData(value.seconds, value.nanos, - zoneSeconds); - } else { - int localZone = session.getZoneSeconds(); - int seconds = value.seconds - localZone; - - seconds = toTimeSeconds(seconds); - - return new TimeData(seconds, value.nanos, zoneSeconds); - } - } - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : { - TimestampData value = (TimestampData) a; - long seconds = value.seconds; - Calendar calendar = session.getCalendar(); - - if (!otherType.isDateTimeTypeWithZone()) { - seconds = HsqlDateTime.convertSecondsFromCalendar( - session.getCalendarGMT(), calendar, seconds); - } - - if (atLocal) { - zoneSeconds = getZoneSeconds(seconds, - calendar.getTimeZone()); - } - - if (value.seconds == seconds && value.zone == zoneSeconds) { - return value; - } - - return new TimestampData(seconds, value.nanos, zoneSeconds); - } - } - - return a; - } - - public boolean canAdd(IntervalType other) { - return other.startPartIndex >= startPartIndex - && other.endPartIndex <= endPartIndex; - } - - public int getSqlDateTimeSub() { - - switch (typeCode) { - - case Types.SQL_DATE : - return 1; - - case Types.SQL_TIME : - return 2; - - case Types.SQL_TIMESTAMP : - return 3; - - default : - return 0; - } - } - - /** - * For temporal predicate operations on periods, we need to make sure we - * compare data of the same types. - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return The common data type of the boundaries of the two limits. - * null if any of the two periods is null or if the first limit of - * any period is null. - * - * @since 2.3.4 - */ - public static Type normalizeInput(Session session, Object[] a, Type[] ta, - Object[] b, Type[] tb, - boolean pointOfTime) { - - if (a == null || b == null) { - return null; - } - - if (a[0] == null || b[0] == null) { - return null; - } - - if (a[1] == null) { - return null; - } - - if (!pointOfTime && b[1] == null) { - return null; - } - - if (!ta[0].isDateTimeType() || !tb[0].isDateTimeType()) { - throw Error.error(ErrorCode.X_42562); - } - - Type commonType = SQL_TIMESTAMP_WITH_TIME_ZONE; - - a[0] = commonType.castToType(session, a[0], ta[0]); - b[0] = commonType.castToType(session, b[0], tb[0]); - - if (ta[1].isIntervalType()) { - a[1] = commonType.add(session, a[0], a[1], ta[1]); - } else { - a[1] = commonType.castToType(session, a[1], ta[1]); - } - - if (tb[1].isIntervalType()) { - b[1] = commonType.add(session, b[0], b[1], tb[1]); - } else { - if (pointOfTime) { - b[1] = b[0]; - } else { - b[1] = commonType.castToType(session, b[1], tb[1]); - } - } - - if (commonType.compare(session, a[0], a[1]) >= 0) { - Object temp = a[0]; - - a[0] = a[1]; - a[1] = temp; - } - - if (!pointOfTime && commonType.compare(session, b[0], b[1]) >= 0) { - Object temp = b[0]; - - b[0] = b[1]; - b[1] = temp; - } - - return commonType; - } - - /** - * For temporal predicate operations on periods, we need to make sure we - * compare data of the same types. - * We also switch the period boundaries if the first entry is after the - * second one. - *

    - * Important: when this method returns, the boundaries of the periods may - * have been changed. - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return The common data type of the boundaries of the two limits. - * null if any of the two periods is null or if the first limit of - * any period is null. - * - * @since 2.3.4 - */ - public static Type normalizeInputRelaxed(Session session, Object[] a, - Type[] ta, Object[] b, Type[] tb) { - - if (a == null || b == null) { - return null; - } - - if (a[0] == null || b[0] == null) { - return null; - } - - if (a[1] == null) { - a[1] = a[0]; - } - - if (b[1] == null) { - b[1] = b[0]; - } - - Type commonType = ta[0].getCombinedType(session, tb[0], OpTypes.EQUAL); - - a[0] = commonType.castToType(session, a[0], ta[0]); - b[0] = commonType.castToType(session, b[0], tb[0]); - - if (ta[1].isIntervalType()) { - a[1] = commonType.add(session, a[0], a[1], ta[1]); - } else { - a[1] = commonType.castToType(session, a[1], ta[1]); - } - - if (tb[1].isIntervalType()) { - b[1] = commonType.add(session, b[0], b[1], tb[1]); - } else { - b[1] = commonType.castToType(session, b[1], tb[1]); - } - - if (commonType.compare(session, a[0], a[1]) > 0) { - Object temp = a[0]; - - a[0] = a[1]; - a[1] = temp; - } - - if (commonType.compare(session, b[0], b[1]) > 0) { - Object temp = b[0]; - - b[0] = b[1]; - b[1] = temp; - } - - return commonType; - } - - /** - * The predicate "a OVERLAPS b" applies when both a and b are either period - * names or period constructors. - * This predicate returns True if the two periods have at least one time - * point in common, i.e, if {@code a[0] < b[1] && a[1] > b[0]}. This predicate is commutative: "a OVERLAPS B" must return - * the same result of "b OVERLAPS a" - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if the two periods overlaps, - * else {@link Boolean#FALSE} - */ - public static Boolean overlaps(Session session, Object[] a, Type[] ta, - Object[] b, Type[] tb) { - - Type commonType = normalizeInput(session, a, ta, b, tb, false); - - if (commonType == null) { - return null; - } - - if (commonType.compare(session, a[0], b[0]) > 0) { - Object[] temp = a; - - a = b; - b = temp; - } - - if (commonType.compare(session, a[1], b[0]) > 0) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * The predicate "a OVERLAPS b" applies when both a and b are rows. - * This predicate returns True if the two periods have at least one time - * point in common, i.e, if {@code a[0] < b[1] && a[1] > b[0]}. This predicate is commutative: "a OVERLAPS B" must return - * the same result of "b OVERLAPS a" - *

    - * Important: when this method returns, the boundaries of the periods may - * have been changed. - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if the two periods overlaps, - * else {@link Boolean#FALSE} - */ - public static Boolean overlapsRelaxed(Session session, Object[] a, - Type[] ta, Object[] b, Type[] tb) { - - Type commonType = normalizeInputRelaxed(session, a, ta, b, tb); - - if (commonType == null) { - return null; - } - - if (commonType.compare(session, a[0], b[0]) > 0) { - Object[] temp = a; - - a = b; - b = temp; - } - - if (commonType.compare(session, a[1], b[0]) > 0) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * The predicate "a PRECEDES b" applies when both a and b are either period - * names or period constructors. - * In this case, the predicate returns True if the end value of a is less - * than or equal to the start value of b, i.e., if {@code ae <= as}. - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if period a precedes period b, - * else {@link Boolean#FALSE} - */ - public static Boolean precedes(Session session, Object[] a, Type[] ta, - Object[] b, Type[] tb) { - - Type commonType = normalizeInput(session, a, ta, b, tb, false); - - if (commonType == null) { - return null; - } - - if (commonType.compare(session, a[1], b[0]) <= 0) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * The predicate "x IMMEDIATELY PRECEDES y" applies when both x and y are either period names or - * period constructors. In this case, the predicate returns True if the end value of x is equal to the start value - * of y, i.e., if xe = ys. - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if period a immediately precedes period b, - * else {@link Boolean#FALSE} - */ - public static Boolean immediatelyPrecedes(Session session, Object[] a, - Type[] ta, Object[] b, Type[] tb) { - - Type commonType = normalizeInput(session, a, ta, b, tb, false); - - if (commonType == null) { - return null; - } - - if (commonType.compare(session, a[1], b[0]) == 0) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * The predicate "x IMMEDIATELY SUCCEEDS y" applies when both x and y are either period names or - * period constructors. In this case, the predicate returns True if the start value of x is equal to the end value - * of y, i.e., if xs = ye. - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if period a immediately succeeds period b, - * else {@link Boolean#FALSE} - */ - public static Boolean immediatelySucceeds(Session session, Object[] a, - Type[] ta, Object[] b, Type[] tb) { - - Type commonType = normalizeInput(session, a, ta, b, tb, false); - - if (commonType == null) { - return null; - } - - if (commonType.compare(session, a[0], b[1]) == 0) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * The predicate "x SUCCEEDS y" applies when both x and y are either period names or period constructors. - * In this case, the predicate returns True if the start value of x is greater than or equal to the end value of y, - * i.e., if {@code xs >= ye}. - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if period a succeeds period b, - * else {@link Boolean#FALSE} - */ - public static Boolean succeeds(Session session, Object[] a, Type[] ta, - Object[] b, Type[] tb) { - - Type commonType = normalizeInput(session, a, ta, b, tb, false); - - if (commonType == null) { - return null; - } - - if (commonType.compare(session, a[0], b[1]) >= 0) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * The predicate "x EQUALS y" applies when both x and y are either period names or period constructors. - * This predicate returns True if the two periods have every time point in common, i.e., if xs = ys and xe = ye. - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if period a equals period b, - * else {@link Boolean#FALSE} - */ - public static Boolean equals(Session session, Object[] a, Type[] ta, - Object[] b, Type[] tb) { - - Type commonType = normalizeInput(session, a, ta, b, tb, false); - - if (commonType == null) { - return null; - } - - if (commonType.compare(session, a[0], b[0]) == 0 - && commonType.compare(session, a[1], b[1]) == 0) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - /** - * The predicate "x CONTAINS y" applies when
    - * a) both x and y are either period names or period constructors. In this case, the predicate returns True if - * x contains every time point in y, i.e., if {@code xs <= ys && xe >= ye}.
    - * b) x is either a period name or a period constructor and y is a datetime value expression. In this case, the - * predicate returns True if x contains y, i.e., if {@code xs <= y && xe > y}. - *

    - * The b part of this definition is not supported yet. In order to get the same result, one have to specify - * a period with the same date time value for the period start and end. - *

    - * - * @param session The session - * @param a First period to compare - * @param ta Types of the first period - * @param b Second period to compare - * @param tb Type of the second period - * - * @return {@link Boolean#TRUE} if period a contains period b, - * else {@link Boolean#FALSE} - */ - public static Boolean contains(Session session, Object[] a, Type[] ta, - Object[] b, Type[] tb, - boolean pointOfTime) { - - Type commonType = normalizeInput(session, a, ta, b, tb, pointOfTime); - - if (commonType == null) { - return null; - } - - int compareStart = commonType.compare(session, a[0], b[0]); - int compareEnd = commonType.compare(session, a[1], b[1]); - - if (compareStart <= 0 && compareEnd >= 0) { - - // if the end of the two period are equals, period a does not - // contain period b if it is defined by a single point in time - if (pointOfTime) { - if (compareEnd == 0) { - return Boolean.FALSE; - } - } - - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - public static BigDecimal subtractMonthsSpecial(Session session, - TimestampData a, TimestampData b) { - - long s1 = (a.seconds + a.zone) * millisInSecond; - long s2 = (b.seconds + b.zone) * millisInSecond; - boolean minus = false; - - if (s1 < s2) { - minus = true; - - long temp = s1; - - s1 = s2; - s2 = temp; - } - - Calendar cal = session.getCalendarGMT(); - - s1 = HsqlDateTime.getNormalisedDate(cal, s1); - s2 = HsqlDateTime.getNormalisedDate(cal, s2); - - cal.setTimeInMillis(s1); - - int lastDay1; - int months1 = cal.get(Calendar.MONTH) + cal.get(Calendar.YEAR) * 12; - int day1 = cal.get(Calendar.DAY_OF_MONTH); - - cal.set(Calendar.DAY_OF_MONTH, 1); - cal.add(Calendar.MONTH, 1); - cal.add(Calendar.DAY_OF_MONTH, -1); - - lastDay1 = cal.get(Calendar.DAY_OF_MONTH); - - cal.setTimeInMillis(s2); - - int lastDay2; - int months2 = cal.get(Calendar.MONTH) + cal.get(Calendar.YEAR) * 12; - int day2 = cal.get(Calendar.DAY_OF_MONTH); - - cal.set(Calendar.DAY_OF_MONTH, 1); - cal.add(Calendar.MONTH, 1); - cal.add(Calendar.DAY_OF_MONTH, -1); - - lastDay2 = cal.get(Calendar.DAY_OF_MONTH); - - double months; - double days; - - if (day1 == day2 || (day1 == lastDay1 && day2 == lastDay2)) { - months = months1 - months2; - - if (minus) { - months = -months; - } - - return BigDecimal.valueOf(months); - } else if (day2 > day1) { - months = months1 - months2 - 1; - days = lastDay2 - day2 + day1; - months += days / 31; - - if (minus) { - months = -months; - } - - return BigDecimal.valueOf(months); - } else { - months = months1 - months2; - days = day1 - day2; - months += days / 31; - - if (minus) { - months = -months; - } - - return BigDecimal.valueOf(months); - } - } - - public static int subtractMonths(Session session, TimestampData a, - TimestampData b, boolean isYear) { - - Calendar calendar = session.getCalendarGMT(); - boolean negate = false; - - if (b.seconds > a.seconds) { - negate = true; - - TimestampData temp = a; - - a = b; - b = temp; - } - - calendar.setTimeInMillis(a.seconds * millisInSecond); - - int months = calendar.get(Calendar.MONTH); - int years = calendar.get(Calendar.YEAR); - - calendar.setTimeInMillis(b.seconds * millisInSecond); - - months -= calendar.get(Calendar.MONTH); - years -= calendar.get(Calendar.YEAR); - - if (isYear) { - months = years * 12; - } else { - if (months < 0) { - months += 12; - - years--; - } - - months += years * 12; - } - - if (negate) { - months = -months; - } - - return months; - } - - public static TimeData addSeconds(TimeData source, long seconds, - int nanos) { - - nanos += source.nanos; - seconds += nanos / limitNanoseconds; - nanos %= limitNanoseconds; - - if (nanos < 0) { - nanos += DTIType.limitNanoseconds; - - seconds--; - } - - seconds += source.seconds; - seconds %= (24 * 60 * 60); - - return new TimeData((int) seconds, nanos, source.zone); - } - - /* @todo - overflow */ - public static TimestampData addMonths(Session session, - TimestampData source, int months) { - - int n = source.nanos; - Calendar cal = session.getCalendarGMT(); - - HsqlDateTime.setTimeInMillis(cal, source.seconds * millisInSecond); - cal.add(Calendar.MONTH, months); - - return new TimestampData(cal.getTimeInMillis() / millisInSecond, n, - source.zone); - } - - public static TimestampData addSeconds(TimestampData source, long seconds, - int nanos) { - - nanos += source.nanos; - seconds += nanos / limitNanoseconds; - nanos %= limitNanoseconds; - - if (nanos < 0) { - nanos += limitNanoseconds; - - seconds--; - } - - long newSeconds = source.seconds + seconds; - - return new TimestampData(newSeconds, nanos, source.zone); - } - - public static TimestampData convertToDatetimeSpecial( - SessionInterface session, String s, DateTimeType type) { - - switch (type.typeCode) { - - case Types.SQL_TIMESTAMP : - if (session instanceof Session - && ((Session) session).database.sqlSyntaxOra) { - String pattern; - - switch (s.length()) { - - case 8 : - case 9 : { - pattern = "DD-MON-YY"; - - break; - } - case 10 : - case 11 : { - pattern = "DD-MON-YYYY"; - - break; - } - case 19 : - case 20 : { - pattern = "DD-MON-YYYY HH24:MI:SS"; - - break; - } - default : - - // if (s.length() > 20) - { - pattern = "DD-MON-YYYY HH24:MI:SS.FF"; - - break; - } - } - - SimpleDateFormat format = session.getSimpleDateFormatGMT(); - - return HsqlDateTime.toDate(s, pattern, format, true); - } - - // fall through - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - case Types.SQL_DATE : - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - default : - } - - throw Error.error(ErrorCode.X_22007); - } - - public static TimestampData nextDayOfWeek(Session session, - TimestampData d, int day) { - - Calendar cal = session.getCalendarGMT(); - - cal.setTimeInMillis(d.getMillis()); - - int start = cal.get(Calendar.DAY_OF_WEEK); - - if (start >= day) { - day += 7; - } - - int diff = day - start; - - cal.add(Calendar.DAY_OF_MONTH, diff); - - long millis = cal.getTimeInMillis(); - - millis = HsqlDateTime.getNormalisedDate(cal, millis); - - return new TimestampData(millis / millisInSecond); - } - - public static int getDayOfWeek(String name) { - - if (name.length() > 0) { - int c = Character.toUpperCase(name.charAt(0)); - - switch (c) { - - case 'M' : - return 2; - - case 'T' : - if (name.length() < 2) { - break; - } - - if (Character.toUpperCase(name.charAt(1)) == 'U') { - return 3; - } else if (Character.toUpperCase(name.charAt(1)) == 'H') { - return 5; - } - break; - - case 'W' : - return 4; - - case 'F' : - return 6; - - case 'S' : - if (name.length() < 2) { - break; - } - - if (Character.toUpperCase(name.charAt(1)) == 'A') { - return 7; - } else if (Character.toUpperCase(name.charAt(1)) == 'U') { - return 1; - } - break; - } - } - - throw Error.error(ErrorCode.X_22007, name); - } - - public static int toTimeSeconds(long seconds) { - - int timeSeconds = (int) (seconds % secondsInDay); - - if (timeSeconds < 0) { - timeSeconds += secondsInDay; - } - - return timeSeconds; - } - - static long toDateSeconds(long seconds) { - - long timeSeconds = seconds % secondsInDay; - - if (timeSeconds < 0) { - timeSeconds += secondsInDay; - } - - return seconds - timeSeconds; - } - - public static TimestampData newSysDateTimestamp() { - - long millis = System.currentTimeMillis(); - long seconds = millis / millisInSecond; - int offset = systemTimeZone.getOffset(millis) / (int) millisInSecond; - - return new TimestampData(seconds + offset); - } - - public static TimestampData newSystemTimestampWithZone() { - return newCurrentTimestamp(systemTimeZone); - } - - public static int getZoneSeconds(long utcSeconds, TimeZone zone) { - return zone.getOffset(utcSeconds * millisInSecond) - / (int) millisInSecond; - } - - static void setTimeComponents(Calendar calendar, int seconds) { - - seconds %= DTIType.secondsInDay; - - calendar.clear(); - calendar.set(Calendar.YEAR, 1970); - calendar.set(Calendar.MONTH, 0); - calendar.set(Calendar.DAY_OF_MONTH, 1); - setTimeComponentsOnly(calendar, seconds); - } - - static void setTimeComponentsOnly(Calendar calendar, int seconds) { - - seconds = toTimeSeconds(seconds); - - calendar.set(Calendar.HOUR_OF_DAY, seconds / 3600); - calendar.set(Calendar.MINUTE, (seconds % 3600) / 60); - calendar.set(Calendar.SECOND, seconds % 60); - } - -//#ifdef JAVA8 - public static TimestampData newCurrentTimestamp(TimeZone zone) { - - Instant instant = Instant.now(); - long seconds = instant.getEpochSecond(); - int nanos = (instant.getNano() / 1000) * 1000; - int zoneSeconds = zone.getOffset(seconds * millisInSecond) - / (int) millisInSecond; - - return new TimestampData(seconds, nanos, zoneSeconds); - } - - public static TimestampData newSystemTimestampUTC() { - - Instant instant = Instant.now(); - long seconds = instant.getEpochSecond(); - int nanos = (instant.getNano() / 1000) * 1000; - - return new TimestampData(seconds, nanos); - } - - public static void setDateTimeComponents(Calendar calendar, - LocalDateTime ldt) { - - calendar.clear(); - calendar.set(Calendar.YEAR, ldt.getYear()); - calendar.set(Calendar.MONTH, ldt.getMonthValue() - 1); - calendar.set(Calendar.DAY_OF_MONTH, ldt.getDayOfMonth()); - calendar.set(Calendar.HOUR_OF_DAY, ldt.getHour()); - calendar.set(Calendar.MINUTE, ldt.getMinute()); - calendar.set(Calendar.SECOND, ldt.getSecond()); - } - - public static void setDateComponents(Calendar calendar, LocalDate ldt) { - - calendar.clear(); - calendar.set(Calendar.YEAR, ldt.getYear()); - calendar.set(Calendar.MONTH, ldt.getMonthValue() - 1); - calendar.set(Calendar.DAY_OF_MONTH, ldt.getDayOfMonth()); - } - - public static void setTimeComponents(Calendar calendar, LocalTime ldt) { - - calendar.clear(); - calendar.set(Calendar.YEAR, 1970); - calendar.set(Calendar.MONTH, 0); - calendar.set(Calendar.DAY_OF_MONTH, 1); - calendar.set(Calendar.HOUR_OF_DAY, ldt.getHour()); - calendar.set(Calendar.MINUTE, ldt.getMinute()); - calendar.set(Calendar.SECOND, ldt.getSecond()); - } - - public Instant toInstant(SessionInterface session, TimestampData v) { - - long seconds; - - if (withTimeZone) { - seconds = v.seconds; - } else { - seconds = HsqlDateTime.convertSecondsFromCalendar( - session.getCalendarGMT(), session.getCalendar(), v.seconds); - } - - return Instant.ofEpochSecond(seconds, v.nanos); - } - - public LocalDate toLocalDate(SessionInterface session, TimestampData v) { - - long millis = (v.seconds + v.zone) * millisInSecond; - Calendar cal = session.getCalendarGMT(); - - cal.setTimeInMillis(millis); - - return LocalDate.of(cal.get(Calendar.YEAR), - cal.get(Calendar.MONTH) + 1, - cal.get(Calendar.DAY_OF_MONTH)); - } - - public LocalDateTime toLocalDateTime(SessionInterface session, - TimestampData v) { - - long millis = (v.seconds + v.zone) * millisInSecond; - int nanos = v.nanos; - Calendar cal = session.getCalendarGMT(); - - cal.setTimeInMillis(millis); - - return LocalDateTime.of(cal.get(Calendar.YEAR), - cal.get(Calendar.MONTH) + 1, - cal.get(Calendar.DAY_OF_MONTH), - cal.get(Calendar.HOUR_OF_DAY), - cal.get(Calendar.MINUTE), - cal.get(Calendar.SECOND), nanos); - } - - public LocalTime toLocalTime(SessionInterface session, TimeData v) { - - int seconds = toTimeSeconds(v.seconds + v.zone); - - return LocalTime.ofNanoOfDay(seconds * nanosInSecond + v.nanos); - } - - public LocalTime toLocalTime(SessionInterface session, TimestampData v) { - - int seconds = toTimeSeconds(v.getSeconds() + v.zone); - - return LocalTime.ofNanoOfDay(seconds * nanosInSecond + v.nanos); - } - - public OffsetTime toOffsetTime(SessionInterface session, TimeData v) { - - int zoneSeconds = withTimeZone ? v.zone - : session.getZoneSeconds(); - ZoneOffset zone = ZoneOffset.ofTotalSeconds(zoneSeconds); - LocalTime lt = toLocalTime(session, v); - - return OffsetTime.of(lt, zone); - } - - public OffsetTime toOffsetTime(SessionInterface session, TimestampData v) { - - int zoneSeconds = withTimeZone ? v.zone - : session.getZoneSeconds(); - ZoneOffset zone = ZoneOffset.ofTotalSeconds(zoneSeconds); - LocalTime lt = toLocalTime(session, v); - - return OffsetTime.of(lt, zone); - } - - public OffsetDateTime toOffsetDateTime(SessionInterface session, - TimestampData v) { - - int zoneSeconds; - - if (withTimeZone) { - zoneSeconds = v.zone; - } else { - long seconds = HsqlDateTime.convertSecondsFromCalendar( - session.getCalendarGMT(), session.getCalendar(), v.seconds); - - zoneSeconds = getZoneSeconds(seconds, - session.getCalendar().getTimeZone()); - } - - ZoneOffset zone = ZoneOffset.ofTotalSeconds(zoneSeconds); - LocalDateTime lt = toLocalDateTime(session, v); - - return OffsetDateTime.of(lt, zone); - } - - static String convertJavaDateTimeObjectToString(Object a) { - - switch(a.getClass().getName()){ - case "java.time.LocalDate": - case "java.time.LocalTime": - return a.toString(); - case "java.time.LocalDateTime": - case "java.time.OffsetDateTime": - case "java.time.OffsetTime": - return a.toString().replace('T', ' '); - } - - return null; - } - -//#else -/* - public static TimestampData newCurrentTimestamp(TimeZone zone) { - - long millis = System.currentTimeMillis(); - long seconds = millis / millisInSecond; - int nanos = (int) (millis % millisInSecond * nanosInMilli); - int zoneSeconds = zone.getOffset(millis) / (int) millisInSecond; - - return new TimestampData(seconds, nanos, zoneSeconds); - } - - public static TimestampData newSystemTimestampUTC() { - - long millis = System.currentTimeMillis(); - long seconds = millis / millisInSecond; - int nanos = (int) (millis % millisInSecond * nanosInMilli); - - return new TimestampData(seconds, nanos); - } - - static String convertJavaDateTimeObjectToString(Object a) { - return null; - } -*/ - -//#endif JAVA8 -} diff --git a/database/hsqldb/src/org/hsqldb/types/IntervalMonthData.java b/database/hsqldb/src/org/hsqldb/types/IntervalMonthData.java deleted file mode 100644 index 1811e5fd..00000000 --- a/database/hsqldb/src/org/hsqldb/types/IntervalMonthData.java +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * Implementation of data item for INTERVAL MONTH.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.9.0 - */ -public class IntervalMonthData { - - public final int units; - - public static IntervalMonthData newInterval(double value, int typeCode) { - - int index = DTIType.intervalIndexMap.get(typeCode); - - value *= DTIType.yearToSecondFactors[index]; - - return new IntervalMonthData((long) value); - } - - public static IntervalMonthData newIntervalYear(long years, - IntervalType type) { - return new IntervalMonthData(years * 12, type); - } - - public static IntervalMonthData newIntervalMonth(long months, - IntervalType type) { - return new IntervalMonthData(months, type); - } - - public IntervalMonthData(long months, IntervalType type) { - - if (months >= type.getIntervalValueLimit()) { - throw Error.error(ErrorCode.X_22006); - } - - if (type.typeCode == Types.SQL_INTERVAL_YEAR) { - months -= (months % 12); - } - - this.units = (int) months; - } - - public IntervalMonthData(long months) { - this.units = (int) months; - } - - public boolean equals(Object other) { - - if (other instanceof IntervalMonthData) { - return units == ((IntervalMonthData) other).units; - } - - return false; - } - - public int hashCode() { - return units; - } - - public int compareTo(IntervalMonthData b) { - - if (units > b.units) { - return 1; - } else if (units < b.units) { - return -1; - } else { - return 0; - } - } - - public int getMonths() { - return units; - } - - public String toString() { - return Type.SQL_INTERVAL_MONTH_MAX_PRECISION.convertToString(this); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/IntervalSecondData.java b/database/hsqldb/src/org/hsqldb/types/IntervalSecondData.java deleted file mode 100644 index ae934e30..00000000 --- a/database/hsqldb/src/org/hsqldb/types/IntervalSecondData.java +++ /dev/null @@ -1,185 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * Implementation of data item for INTERVAL SECOND.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.0 - * @since 1.9.0 - */ -public class IntervalSecondData { - - public static final IntervalSecondData oneDay = newIntervalDay(1, - Type.SQL_INTERVAL_DAY); - - // - final long units; - final int nanos; - - public static IntervalSecondData newInterval(double value, int typeCode) { - - int index = DTIType.intervalIndexMap.get(typeCode); - - value *= DTIType.yearToSecondFactors[index]; - - return new IntervalSecondData((long) value, 0); - } - - public static IntervalSecondData newIntervalDay(long days, - IntervalType type) { - return new IntervalSecondData(days * 24 * 60 * 60, 0, type); - } - - public static IntervalSecondData newIntervalHour(long hours, - IntervalType type) { - return new IntervalSecondData(hours * 60 * 60, 0, type); - } - - public static IntervalSecondData newIntervalMinute(long minutes, - IntervalType type) { - return new IntervalSecondData(minutes * 60, 0, type); - } - - public static IntervalSecondData newIntervalSeconds(long seconds, - IntervalType type) { - return new IntervalSecondData(seconds, 0, type); - } - - public IntervalSecondData(long seconds, int nanos, IntervalType type) { - - if (seconds >= type.getIntervalValueLimit()) { - throw Error.error(ErrorCode.X_22015); - } - - this.units = seconds; - this.nanos = nanos; - } - - public IntervalSecondData(long seconds, int nanos) { - this.units = seconds; - this.nanos = nanos; - } - - /** - * normalise is a marker, values are always normalised - */ - public IntervalSecondData(long seconds, long nanos, IntervalType type, - boolean normalise) { - - if (nanos >= DTIType.limitNanoseconds) { - long carry = nanos / DTIType.limitNanoseconds; - - nanos = nanos % DTIType.limitNanoseconds; - seconds += carry; - } else if (nanos <= -DTIType.limitNanoseconds) { - long carry = -nanos / DTIType.limitNanoseconds; - - nanos = -(-nanos % DTIType.limitNanoseconds); - seconds -= carry; - } - - int scaleFactor = DTIType.nanoScaleFactors[type.scale]; - - nanos /= scaleFactor; - nanos *= scaleFactor; - - if (seconds > 0 && nanos < 0) { - nanos += DTIType.limitNanoseconds; - - seconds--; - } else if (seconds < 0 && nanos > 0) { - nanos -= DTIType.limitNanoseconds; - - seconds++; - } - - scaleFactor = DTIType.yearToSecondFactors[type.endPartIndex]; - seconds /= scaleFactor; - seconds *= scaleFactor; - - if (seconds >= type.getIntervalValueLimit()) { - throw Error.error(ErrorCode.X_22015); - } - - this.units = seconds; - this.nanos = (int) nanos; - } - - public boolean equals(Object other) { - - if (other instanceof IntervalSecondData) { - return units == ((IntervalSecondData) other).units - && nanos == ((IntervalSecondData) other).nanos; - } - - return false; - } - - public int hashCode() { - return (int) units ^ nanos; - } - - public int compareTo(IntervalSecondData b) { - - if (units > b.units) { - return 1; - } else if (units < b.units) { - return -1; - } else { - if (nanos > b.nanos) { - return 1; - } else if (nanos < b.nanos) { - return -1; - } else { - return 0; - } - } - } - - public long getSeconds() { - return units; - } - - public int getNanos() { - return nanos; - } - - public String toString() { - return Type.SQL_INTERVAL_SECOND_MAX_FRACTION_MAX_PRECISION - .convertToString(this); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/IntervalType.java b/database/hsqldb/src/org/hsqldb/types/IntervalType.java deleted file mode 100644 index 6e57258e..00000000 --- a/database/hsqldb/src/org/hsqldb/types/IntervalType.java +++ /dev/null @@ -1,1812 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.math.BigDecimal; - -//#ifdef JAVA8 -import java.time.Duration; -import java.time.Period; - -//#endif JAVA8 -import org.hsqldb.HsqlDateTime; -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.ArrayUtil; - -/** - * Type subclass for various types of INTERVAL.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public final class IntervalType extends DTIType { - - public final boolean defaultPrecision; - public final boolean isYearMonth; - public static final NumberType factorType = - NumberType.getNumberType(Types.SQL_DECIMAL, 40, maxFractionPrecision); - - private IntervalType(int typeGroup, int type, long precision, int scale, - int startIntervalType, int endIntervalType, - boolean defaultPrecision) { - - super(typeGroup, type, precision, scale, startIntervalType, - endIntervalType); - - if (endIntervalType != Types.SQL_INTERVAL_SECOND && scale != 0) { - throw Error.error(ErrorCode.X_22006); - } - - switch (startIntervalType) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_MONTH : - isYearMonth = true; - break; - - default : - isYearMonth = false; - break; - } - - this.defaultPrecision = defaultPrecision; - } - - public int displaySize() { - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - return (int) precision + 1; - - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - return (int) precision + 4; - - case Types.SQL_INTERVAL_MONTH : - return (int) precision + 1; - - case Types.SQL_INTERVAL_DAY : - return (int) precision + 1; - - case Types.SQL_INTERVAL_DAY_TO_HOUR : - return (int) precision + 4; - - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - return (int) precision + 7; - - case Types.SQL_INTERVAL_DAY_TO_SECOND : - return (int) precision + 10 + (scale == 0 ? 0 - : scale + 1); - - case Types.SQL_INTERVAL_HOUR : - return (int) precision + 1; - - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - return (int) precision + 4; - - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - return (int) precision + 7 + (scale == 0 ? 0 - : scale + 1); - - case Types.SQL_INTERVAL_MINUTE : - return (int) precision + 1; - - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - return (int) precision + 4 + (scale == 0 ? 0 - : scale + 1); - - case Types.SQL_INTERVAL_SECOND : - return (int) precision + 1 + (scale == 0 ? 0 - : scale + 1); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public int getJDBCTypeCode() { - - // no JDBC number is available - return typeCode; - } - - public Class getJDBCClass() { - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - -//#ifdef JAVA8 - return java.time.Period.class; - -//#else -/* - return IntervalMonthData.class; -*/ - -//#endif JAVA8 - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - -//#ifdef JAVA8 - return java.time.Duration.class; - -//#else -/* - return IntervalSecondData.class; -*/ - -//#endif JAVA8 - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public String getJDBCClassName() { - return getJDBCClass().getName(); - } - - public int getJDBCPrecision() { - return this.displaySize(); - } - - public int getSQLGenericTypeCode() { - return Types.SQL_INTERVAL; - } - - public String getNameString() { - return "INTERVAL " + getQualifier(typeCode); - } - - public static String getQualifier(int type) { - - switch (type) { - - case Types.SQL_INTERVAL_YEAR : - return Tokens.T_YEAR; - - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - return "YEAR TO MONTH"; - - case Types.SQL_INTERVAL_MONTH : - return Tokens.T_MONTH; - - case Types.SQL_INTERVAL_DAY : - return Tokens.T_DAY; - - case Types.SQL_INTERVAL_DAY_TO_HOUR : - return "DAY TO HOUR"; - - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - return "DAY TO MINUTE"; - - case Types.SQL_INTERVAL_DAY_TO_SECOND : - return "DAY TO SECOND"; - - case Types.SQL_INTERVAL_HOUR : - return Tokens.T_HOUR; - - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - return "HOUR TO MINUTE"; - - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - return "HOUR TO SECOND"; - - case Types.SQL_INTERVAL_MINUTE : - return Tokens.T_MINUTE; - - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - return "MINUTE TO SECOND"; - - case Types.SQL_INTERVAL_SECOND : - return Tokens.T_SECOND; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public String getDefinition() { - - if (precision == defaultIntervalPrecision - && (endIntervalType != Types.SQL_INTERVAL_SECOND - || scale == defaultIntervalFractionPrecision)) { - return getNameString(); - } - - StringBuilder sb = new StringBuilder(32); - - sb.append(Tokens.T_INTERVAL).append(' '); - sb.append(getQualifier(startIntervalType)); - - if (typeCode == Types.SQL_INTERVAL_SECOND) { - sb.append('('); - sb.append(precision); - - if (scale != defaultIntervalFractionPrecision) { - sb.append(','); - sb.append(scale); - } - - sb.append(')'); - - return sb.toString(); - } - - if (precision != defaultIntervalPrecision) { - sb.append('('); - sb.append(precision); - sb.append(')'); - } - - if (startIntervalType != endIntervalType) { - sb.append(' '); - sb.append(Tokens.T_TO); - sb.append(' '); - sb.append(Tokens.SQL_INTERVAL_FIELD_NAMES[endPartIndex]); - - if (endIntervalType == Types.SQL_INTERVAL_SECOND - && scale != defaultIntervalFractionPrecision) { - sb.append('('); - sb.append(scale); - sb.append(')'); - } - } - - return sb.toString(); - } - - public boolean isIntervalType() { - return true; - } - - public boolean isIntervalYearMonthType() { - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - return true; - - default : - return false; - } - } - - public boolean isIntervalDaySecondType() { - - switch (typeCode) { - - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - return true; - - default : - return false; - } - } - - public boolean acceptsPrecision() { - return true; - } - - public boolean acceptsFractionalPrecision() { - return endIntervalType == Types.SQL_INTERVAL_SECOND; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (typeCode == other.typeCode) { - if (precision >= other.precision && scale >= other.scale) { - return this; - } else if (precision <= other.precision && scale <= other.scale) { - return other; - } - } - - if (other.isCharacterType()) { - return other.getAggregateType(this); - } - - if (!other.isIntervalType()) { - throw Error.error(ErrorCode.X_42562); - } - - int startType = ((IntervalType) other).startIntervalType - > startIntervalType ? startIntervalType - : ((IntervalType) other) - .startIntervalType; - int endType = ((IntervalType) other).endIntervalType > endIntervalType - ? ((IntervalType) other).endIntervalType - : endIntervalType; - int newType = getCombinedIntervalType(startType, endType); - long newPrecision = precision > other.precision ? precision - : other.precision; - int newScale = scale > other.scale ? scale - : other.scale; - - try { - return getIntervalType(newType, startType, endType, newPrecision, - newScale, false); - } catch (RuntimeException e) { - throw Error.error(ErrorCode.X_42562); - } - } - - public Type getCombinedType(Session session, Type other, int operation) { - - switch (operation) { - - case OpTypes.MULTIPLY : - if (other.isNumberType()) { - return getIntervalType(this, maxIntervalPrecision, scale); - } - break; - - case OpTypes.DIVIDE : - if (other.isNumberType()) { - return this; - } else if (other.isIntervalType()) { - IntervalType otherType = (IntervalType) other; - - if (isYearMonth == otherType.isYearMonth) { - return isYearMonth ? Type.SQL_BIGINT - : factorType; - } - } - break; - - case OpTypes.ADD : - if (other.isDateTimeType()) { - return other.getCombinedType(session, this, operation); - } else if (other.isIntervalType()) { - IntervalType newType = - (IntervalType) getAggregateType(other); - - return getIntervalType(newType, maxIntervalPrecision, 0); - } - break; - - case OpTypes.SUBTRACT : - default : - return getAggregateType(other); - } - - throw Error.error(ErrorCode.X_42562); - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - return ((IntervalMonthData) a).compareTo( - (IntervalMonthData) b); - - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - return ((IntervalSecondData) a).compareTo( - (IntervalSecondData) b); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof IntervalMonthData) { - IntervalMonthData im = (IntervalMonthData) a; - - if (im.units > getIntervalValueLimit()) { - throw Error.error(ErrorCode.X_22015); - } - } else if (a instanceof IntervalSecondData) { - IntervalSecondData is = (IntervalSecondData) a; - - if (is.units > getIntervalValueLimit()) { - throw Error.error(ErrorCode.X_22015); - } - } - - return a; - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return null; - } - - switch (otherType.typeCode) { - - case Types.SQL_CLOB : - a = Type.SQL_VARCHAR.convertToType(session, a, otherType); - - // fall through - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : { - return session.getScanner().convertToDatetimeInterval(session, - (String) a, this); - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - if (a instanceof BigDecimal) { - if (NumberType.compareToLongLimits((BigDecimal) a) != 0) { - throw Error.error(ErrorCode.X_22015); - } - } - - long value = ((Number) a).longValue(); - - switch (this.endIntervalType) { - - case Types.SQL_INTERVAL_YEAR : - return IntervalMonthData.newIntervalYear(value, this); - - case Types.SQL_INTERVAL_MONTH : - return IntervalMonthData.newIntervalMonth(value, this); - - case Types.SQL_INTERVAL_DAY : - return IntervalSecondData.newIntervalDay(value, this); - - case Types.SQL_INTERVAL_HOUR : - return IntervalSecondData.newIntervalHour(value, this); - - case Types.SQL_INTERVAL_MINUTE : - return IntervalSecondData.newIntervalMinute(value, - this); - - case Types.SQL_INTERVAL_SECOND : { - int nanos = 0; - - if (scale > 0) { - if (a instanceof BigDecimal) { - nanos = (int) NumberType.scaledDecimal( - a, DTIType.maxFractionPrecision); - } else if (a instanceof Double) { - double d = (Double) a; - - d -= (double) ((long) d); - nanos = (int) (d * 1000000000d); - } - } - - return new IntervalSecondData(value, nanos, this); - } - default : - throw Error.error(ErrorCode.X_42561); - } - } - case Types.SQL_INTERVAL_YEAR : { - long months = (((IntervalMonthData) a).units / 12) * 12L; - - return new IntervalMonthData(months, this); - } - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : { - long months = ((IntervalMonthData) a).units; - - return new IntervalMonthData(months, this); - } - case Types.SQL_INTERVAL_DAY : { - long seconds = ((IntervalSecondData) a).units; - - seconds = (seconds / DTIType.yearToSecondFactors[2]) - * DTIType.yearToSecondFactors[2]; - - return new IntervalSecondData(seconds, 0, this); - } - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_MINUTE : { - long seconds = ((IntervalSecondData) a).units; - - seconds = (seconds / DTIType.yearToSecondFactors[endPartIndex]) - * DTIType.yearToSecondFactors[endPartIndex]; - - return new IntervalSecondData(seconds, 0, this); - } - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : { - long seconds = ((IntervalSecondData) a).units; - int nanos = ((IntervalSecondData) a).nanos; - - if (scale == 0) { - nanos = 0; - } else { - nanos = (nanos / (DTIType.nanoScaleFactors[scale])) - * (DTIType.nanoScaleFactors[scale]); - } - - return new IntervalSecondData(seconds, nanos, this); - } - default : - throw Error.error(ErrorCode.X_42561); - } - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (a instanceof String) { - return convertToType(session, a, Type.SQL_VARCHAR); - } else if (a instanceof Integer) { - return convertToType(session, a, Type.SQL_INTEGER); - } else if (a instanceof Long) { - return convertToType(session, a, Type.SQL_BIGINT); - } else if (a instanceof BigDecimal) { - return convertToType(session, a, Type.SQL_DECIMAL); - } else { - throw Error.error(ErrorCode.X_42561); - } - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - - Object o = convertJavaTimeObject(session, a); - - if (o != null) { - return o; - } - - return convertToDefaultType(session, a); - } - -//#ifdef JAVA8 - Object convertJavaTimeObject(SessionInterface session, Object a) { - - if (this.isIntervalYearMonthType()) { - if (a instanceof java.time.Period) { - Period v = (Period) a; - long months = v.toTotalMonths(); - - return new IntervalMonthData(months, this); - } - } else { - if (a instanceof java.time.Duration) { - Duration v = (Duration) a; - long second = v.getSeconds(); - int nano = v.getNano(); - - return new IntervalSecondData(second, nano, this, true); - } - } - - return null; - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - if (isIntervalYearMonthType()) { - IntervalMonthData months = (IntervalMonthData) a; - Period v; - - if (typeCode == Types.SQL_INTERVAL_MONTH) { - v = Period.ofMonths(months.units); - } else { - v = Period.of(months.units / 12, months.units % 12, 0); - } - - return v; - } else { - IntervalSecondData seconds = (IntervalSecondData) a; - Duration d = Duration.ofSeconds(seconds.units, seconds.nanos); - - return d; - } - } - -//#else -/* - TimestampData convertJavaTimeObject(SessionInterface session, Object a) { - return null; - } -*/ - -//#endif JAVA8 - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - return intervalMonthToString(a); - - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - return intervalSecondToString(a); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - StringBuilder sb = new StringBuilder(32); - - sb.append(Tokens.T_INTERVAL).append(' '); - sb.append('\'').append(convertToString(a)).append('\'').append(' '); - sb.append(Tokens.SQL_INTERVAL_FIELD_NAMES[startPartIndex]); - - if (startPartIndex != endPartIndex) { - sb.append(' '); - sb.append(Tokens.T_TO); - sb.append(' '); - sb.append(Tokens.SQL_INTERVAL_FIELD_NAMES[endPartIndex]); - } - - return sb.toString(); - } - - public void convertToJSON(Object a, StringBuilder sb) { - - if (a == null) { - sb.append("null"); - - return; - } - - sb.append('"'); - sb.append(convertToString(a)); - sb.append('"'); - } - - public boolean canConvertFrom(Type otherType) { - - if (otherType.typeCode == Types.SQL_ALL_TYPES) { - return true; - } - - if (otherType.isCharacterType()) { - return true; - } - - if (otherType.isNumberType()) { - return true; - } - - if (!otherType.isIntervalType()) { - return false; - } - - return isIntervalYearMonthType() - == otherType.isIntervalYearMonthType(); - } - - public int canMoveFrom(Type otherType) { - - if (otherType == this) { - return ReType.keep; - } - - if (typeCode == otherType.typeCode) { - return scale >= otherType.scale ? ReType.keep - : ReType.change; - } - - if (!otherType.isIntervalType()) { - return ReType.change; - } - - if (isYearMonth == ((IntervalType) otherType).isYearMonth) { - if (scale < otherType.scale) { - return ReType.change; - } - - if (endPartIndex >= ((IntervalType) otherType).endPartIndex) { - if (precision >= otherType.precision) { - if (startPartIndex - <= ((IntervalType) otherType).startPartIndex) { - return ReType.keep; - } - } - - return ReType.check; - } - } - - return ReType.change; - } - - public int compareToTypeRange(Object o) { - - long max = precisionLimits[(int) precision]; - long units; - - if (o instanceof IntervalMonthData) { - units = ((IntervalMonthData) o).units; - } else if (o instanceof IntervalSecondData) { - units = ((IntervalSecondData) o).units; - } else { - return 0; - } - - if (units >= max) { - return 1; - } - - if (units < 0) { - if (-units >= max) { - return -1; - } - } - - return 0; - } - - public Object absolute(Object a) { - - if (a == null) { - return null; - } - - if (a instanceof IntervalMonthData) { - if (((IntervalMonthData) a).units < 0) { - return negate(a); - } - } else { - if (((IntervalSecondData) a).units < 0 - || ((IntervalSecondData) a).nanos < 0) { - return negate(a); - } - } - - return a; - } - - public Object negate(Object a) { - - if (a == null) { - return null; - } - - if (a instanceof IntervalMonthData) { - long units = ((IntervalMonthData) a).units; - - return new IntervalMonthData(-units, this); - } else { - long units = ((IntervalSecondData) a).units; - int nanos = ((IntervalSecondData) a).nanos; - - return new IntervalSecondData(-units, -nanos, this, true); - } - } - - public boolean isNegative(Object a) { - - if (a instanceof IntervalMonthData) { - return ((IntervalMonthData) a).units < 0; - } else { - long units = ((IntervalSecondData) a).units; - - if (units < 0) { - return true; - } else if (units == 0) { - return ((IntervalSecondData) a).nanos < 0; - } else { - return false; - } - } - } - - public Object add(Session session, Object a, Object b, Type otherType) { - - if (a == null || b == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - long months = ((IntervalMonthData) a).units - + ((IntervalMonthData) b).units; - - return new IntervalMonthData(months, this); - - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - long seconds = ((IntervalSecondData) a).units - + ((IntervalSecondData) b).units; - long nanos = ((IntervalSecondData) a).nanos - + ((IntervalSecondData) b).nanos; - - return new IntervalSecondData(seconds, nanos, this, true); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public Object subtract(Session session, Object a, Object b, - Type otherType) { - - if (a == null || b == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - if (a instanceof IntervalMonthData - && b instanceof IntervalMonthData) { - long months = ((IntervalMonthData) a).units - - ((IntervalMonthData) b).units; - - return new IntervalMonthData(months, this); - } else if (a instanceof TimestampData - && b instanceof TimestampData) { - boolean isYear = typeCode == Types.SQL_INTERVAL_YEAR; - long months = DateTimeType.subtractMonths(session, - (TimestampData) a, (TimestampData) b, isYear); - - return new IntervalMonthData(months, this); - } - - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - if (a instanceof IntervalSecondData - && b instanceof IntervalSecondData) { - long seconds = ((IntervalSecondData) a).units - - ((IntervalSecondData) b).units; - long nanos = ((IntervalSecondData) a).nanos - - ((IntervalSecondData) b).nanos; - - return new IntervalSecondData(seconds, nanos, this, true); - } else if (a instanceof TimeData && b instanceof TimeData) { - long aSeconds = ((TimeData) a).getSeconds(); - long bSeconds = ((TimeData) b).getSeconds(); - long nanos = ((TimeData) a).getNanos() - - ((TimeData) b).getNanos(); - - return subtract(session, aSeconds, bSeconds, nanos); - } else if (a instanceof TimestampData - && b instanceof TimestampData) { - long aSeconds = ((TimestampData) a).getSeconds(); - long bSeconds = ((TimestampData) b).getSeconds(); - long nanos = ((TimestampData) a).getNanos() - - ((TimestampData) b).getNanos(); - - return subtract(session, aSeconds, bSeconds, nanos); - } - - // fall through - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - private IntervalSecondData subtract(Session session, long aSeconds, - long bSeconds, long nanos) { - - if (endIntervalType != Types.SQL_INTERVAL_SECOND) { - aSeconds = - HsqlDateTime.getTruncatedPart( - session.getCalendarGMT(), aSeconds * 1000, - endIntervalType) / 1000; - bSeconds = - HsqlDateTime.getTruncatedPart( - session.getCalendarGMT(), bSeconds * 1000, - endIntervalType) / 1000; - nanos = 0; - } - - return new IntervalSecondData(aSeconds - bSeconds, nanos, this, true); - } - - public Object multiply(Object a, Object b) { - return multiplyOrDivide(a, b, false); - } - - public Object divide(Session session, Object a, Object b) { - return multiplyOrDivide(a, b, true); - } - - private Object multiplyOrDivide(Object a, Object b, boolean divide) { - - if (a == null || b == null) { - return null; - } - - if (a instanceof Number) { - Object temp = a; - - a = b; - b = temp; - } - - boolean isNumberDiv = b instanceof Number; - - if (divide) { - if (isNumberDiv) { - if (NumberType.isZero(b)) { - throw Error.error(ErrorCode.X_22012); - } - } else { - if (isYearMonth) { - if (((IntervalMonthData) b).units == 0) { - throw Error.error(ErrorCode.X_22012); - } - } else { - if (((IntervalSecondData) b).units == 0) { - throw Error.error(ErrorCode.X_22012); - } - } - } - } - - BigDecimal factor = (BigDecimal) factorType.convertToDefaultType(null, - b); - BigDecimal units; - - if (isYearMonth) { - units = BigDecimal.valueOf(((IntervalMonthData) a).units); - } else { - long value = - ((IntervalSecondData) a).units * DTIType.nanoScaleFactors[0] - + ((IntervalSecondData) a).nanos; - - units = BigDecimal.valueOf(value, 9); - } - - BigDecimal result = divide - ? (BigDecimal) factorType.divide(null, units, - factor) - : (BigDecimal) factorType.multiply(units, factor); - - if (NumberType.compareToLongLimits(result) != 0) { - throw Error.error(ErrorCode.X_22015); - } - - if (isNumberDiv) { - if (isYearMonth) { - return new IntervalMonthData(result.longValue(), this); - } - - int nanos = (int) NumberType.scaledDecimal(result, - DTIType.maxFractionPrecision); - - return new IntervalSecondData(result.longValue(), nanos, this, - true); - } else { - if (isYearMonth) { - return Long.valueOf(result.longValue()); - } else { - return result; - } - } - } - - String intervalMonthToString(Object a) { - - StringBuilder sb = new StringBuilder(8); - long months = ((IntervalMonthData) a).units; - - if (months < 0) { - months = -months; - - sb.append('-'); - } - - for (int i = startPartIndex; i <= endPartIndex; i++) { - int factor = DTIType.yearToSecondFactors[i]; - long part = months / factor; - - if (i == startPartIndex) { - int zeros = (int) precision - getPrecisionExponent(part); -/* - for (int j = 0; j < zeros; j++) { - buffer.append('0'); - } -*/ - } else if (part < 10) { - sb.append('0'); - } - - sb.append(part); - - months %= factor; - - if (i < endPartIndex) { - sb.append((char) DTIType.yearToSecondSeparators[i]); - } - } - - return sb.toString(); - } - - String intervalSecondToString(Object a) { - - long seconds = ((IntervalSecondData) a).units; - int nanos = ((IntervalSecondData) a).nanos; - - return intervalSecondToString(seconds, nanos, false); - } - - public int precedenceDegree(Type other) { - - if (other.isIntervalType()) { - int otherIndex = ((IntervalType) other).endPartIndex; - - return otherIndex - endPartIndex; - } - - return Integer.MIN_VALUE; - } - - public int getStartIntervalType() { - return startIntervalType; - } - - public int getEndIntervalType() { - return endIntervalType; - } - - public static IntervalType newIntervalType(int type, long precision, - int fractionPrecision) { - - int startType = getStartIntervalType(type); - int endType = getEndIntervalType(type); - int group = startType > Types.SQL_INTERVAL_MONTH - ? Types.SQL_INTERVAL_SECOND - : Types.SQL_INTERVAL_MONTH; - - return new IntervalType(group, type, precision, fractionPrecision, - startType, endType, false); - } - - public static IntervalType getIntervalType(IntervalType type, - long precision, int fractionalPrecision) { - - if (type.precision >= precision && type.scale >= fractionalPrecision) { - return type; - } - - return getIntervalType(type.typeCode, precision, fractionalPrecision); - } - - public static IntervalType getIntervalType(int type, long precision, - int fractionPrecision) { - - int startType = getStartIntervalType(type); - int endType = getEndIntervalType(type); - - return getIntervalType(type, startType, endType, precision, - fractionPrecision, false); - } - - public static IntervalType getIntervalType(int startIndex, int endIndex, - long precision, int fractionPrecision) { - - boolean defaultPrecision = precision == -1; - - if (startIndex == -1 || endIndex == -1) { - throw Error.error(ErrorCode.X_22006); - } - - if (startIndex > endIndex) { - throw Error.error(ErrorCode.X_22006); - } - - if (startIndex <= DTIType.INTERVAL_MONTH_INDEX - && endIndex > DTIType.INTERVAL_MONTH_INDEX) { - throw Error.error(ErrorCode.X_22006); - } - - int startType = DTIType.intervalParts[startIndex]; - int endType = DTIType.intervalParts[endIndex]; - int type = DTIType.intervalTypes[startIndex][endIndex]; - - if (precision == 0 - || fractionPrecision > DTIType.maxFractionPrecision) { - throw Error.error(ErrorCode.X_42592); - } - - if (startIndex == DTIType.INTERVAL_SECOND_INDEX) { - if (precision > DTIType.maxIntervalSecondPrecision) { - throw Error.error(ErrorCode.X_42592); - } - } else if (precision > DTIType.maxIntervalPrecision) { - throw Error.error(ErrorCode.X_42592); - } - - if (precision == -1) { - precision = DTIType.defaultIntervalPrecision; - } - - if (fractionPrecision == -1) { - fractionPrecision = endType == Types.SQL_INTERVAL_SECOND - ? DTIType.defaultIntervalFractionPrecision - : 0; - } - - return getIntervalType(type, startType, endType, precision, - fractionPrecision, defaultPrecision); - } - - public static IntervalType getIntervalType(int type, int startType, - int endType, long precision, int fractionPrecision, - boolean defaultPrecision) { - - int group = startType > Types.SQL_INTERVAL_MONTH - ? Types.SQL_INTERVAL_SECOND - : Types.SQL_INTERVAL_MONTH; - - if (defaultPrecision) { - return new IntervalType(group, type, precision, fractionPrecision, - startType, endType, defaultPrecision); - } - - switch (type) { - - case Types.SQL_INTERVAL_YEAR : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_YEAR; - } else if (precision == DTIType.maxIntervalPrecision) { - return SQL_INTERVAL_YEAR_MAX_PRECISION; - } - break; - - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_YEAR_TO_MONTH; - } else if (precision == DTIType.maxIntervalPrecision) { - return SQL_INTERVAL_YEAR_TO_MONTH_MAX_PRECISION; - } - break; - - case Types.SQL_INTERVAL_MONTH : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_MONTH; - } else if (precision == DTIType.maxIntervalPrecision) { - return SQL_INTERVAL_MONTH_MAX_PRECISION; - } - break; - - case Types.SQL_INTERVAL_DAY : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_DAY; - } else if (precision == DTIType.maxIntervalPrecision) { - return SQL_INTERVAL_DAY_MAX_PRECISION; - } - break; - - case Types.SQL_INTERVAL_DAY_TO_HOUR : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_DAY_TO_HOUR; - } - break; - - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_DAY_TO_MINUTE; - } - break; - - case Types.SQL_INTERVAL_DAY_TO_SECOND : - if (precision == DTIType.defaultIntervalPrecision - && fractionPrecision - == DTIType.defaultIntervalFractionPrecision) { - return SQL_INTERVAL_DAY_TO_SECOND; - } - break; - - case Types.SQL_INTERVAL_HOUR : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_HOUR; - } else if (precision == DTIType.maxIntervalPrecision) { - return SQL_INTERVAL_HOUR_MAX_PRECISION; - } - break; - - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_HOUR_TO_MINUTE; - } - break; - - case Types.SQL_INTERVAL_MINUTE : - if (precision == DTIType.defaultIntervalPrecision) { - return SQL_INTERVAL_MINUTE; - } else if (precision == DTIType.maxIntervalPrecision) { - return SQL_INTERVAL_MINUTE_MAX_PRECISION; - } - break; - - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - if (precision == DTIType.defaultIntervalPrecision - && fractionPrecision - == DTIType.defaultIntervalFractionPrecision) { - return SQL_INTERVAL_HOUR_TO_SECOND; - } - break; - - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - if (precision == DTIType.defaultIntervalPrecision - && fractionPrecision - == DTIType.defaultIntervalFractionPrecision) { - return SQL_INTERVAL_MINUTE_TO_SECOND; - } - break; - - case Types.SQL_INTERVAL_SECOND : - if (precision == DTIType.defaultIntervalPrecision - && fractionPrecision - == DTIType.defaultIntervalFractionPrecision) { - return SQL_INTERVAL_SECOND; - } - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - - return new IntervalType(group, type, precision, fractionPrecision, - startType, endType, defaultPrecision); - } - - public static int getStartIntervalType(int type) { - - int startType; - - switch (type) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - startType = Types.SQL_INTERVAL_YEAR; - break; - - case Types.SQL_INTERVAL_MONTH : - startType = Types.SQL_INTERVAL_MONTH; - break; - - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - startType = Types.SQL_INTERVAL_DAY; - break; - - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - startType = Types.SQL_INTERVAL_HOUR; - break; - - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - startType = Types.SQL_INTERVAL_MINUTE; - break; - - case Types.SQL_INTERVAL_SECOND : - startType = Types.SQL_INTERVAL_SECOND; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - - return startType; - } - - public static int getEndIntervalType(int type) { - - int endType; - - switch (type) { - - case Types.SQL_INTERVAL_YEAR : - endType = Types.SQL_INTERVAL_YEAR; - break; - - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - endType = Types.SQL_INTERVAL_MONTH; - break; - - case Types.SQL_INTERVAL_MONTH : - endType = Types.SQL_INTERVAL_MONTH; - break; - - case Types.SQL_INTERVAL_DAY : - endType = Types.SQL_INTERVAL_DAY; - break; - - case Types.SQL_INTERVAL_DAY_TO_HOUR : - endType = Types.SQL_INTERVAL_HOUR; - break; - - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - endType = Types.SQL_INTERVAL_MINUTE; - break; - - case Types.SQL_INTERVAL_DAY_TO_SECOND : - endType = Types.SQL_INTERVAL_SECOND; - break; - - case Types.SQL_INTERVAL_HOUR : - endType = Types.SQL_INTERVAL_HOUR; - break; - - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - endType = Types.SQL_INTERVAL_MINUTE; - break; - - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - endType = Types.SQL_INTERVAL_SECOND; - break; - - case Types.SQL_INTERVAL_MINUTE : - endType = Types.SQL_INTERVAL_MINUTE; - break; - - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - endType = Types.SQL_INTERVAL_SECOND; - break; - - case Types.SQL_INTERVAL_SECOND : - endType = Types.SQL_INTERVAL_SECOND; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - - return endType; - } - - public static Type getCombinedIntervalType(IntervalType type1, - IntervalType type2) { - - int startType = type2.startIntervalType > type1.startIntervalType - ? type1.startIntervalType - : type2.startIntervalType; - int endType = type2.endIntervalType > type1.endIntervalType - ? type2.endIntervalType - : type1.endIntervalType; - int type = getCombinedIntervalType(startType, endType); - long precision = type1.precision > type2.precision ? type1.precision - : type2.precision; - int fractionPrecision = type1.scale > type2.scale ? type1.scale - : type2.scale; - - return getIntervalType(type, startType, endType, precision, - fractionPrecision, false); - } - - public static int getCombinedIntervalType(int startType, int endType) { - - if (startType == endType) { - return startType; - } - - switch (startType) { - - case Types.SQL_INTERVAL_YEAR : - if (endType == Types.SQL_INTERVAL_MONTH) { - return Types.SQL_INTERVAL_YEAR_TO_MONTH; - } - break; - - case Types.SQL_INTERVAL_DAY : - switch (endType) { - - case Types.SQL_INTERVAL_HOUR : - return Types.SQL_INTERVAL_DAY_TO_HOUR; - - case Types.SQL_INTERVAL_MINUTE : - return Types.SQL_INTERVAL_DAY_TO_MINUTE; - - case Types.SQL_INTERVAL_SECOND : - return Types.SQL_INTERVAL_DAY_TO_SECOND; - } - break; - - case Types.SQL_INTERVAL_HOUR : - switch (endType) { - - case Types.SQL_INTERVAL_MINUTE : - return Types.SQL_INTERVAL_HOUR_TO_MINUTE; - - case Types.SQL_INTERVAL_SECOND : - return Types.SQL_INTERVAL_HOUR_TO_SECOND; - } - break; - - case Types.SQL_INTERVAL_MINUTE : - if (endType == Types.SQL_INTERVAL_SECOND) { - return Types.SQL_INTERVAL_MINUTE_TO_SECOND; - } - break; - - default : - } - - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - - public static int getIntervalType(String part) { - - int index = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_NAMES, part); - - if (index < 0) { - throw Error.error(ErrorCode.X_42562); - } - - return intervalParts[index]; - } - - long getIntervalValueLimit() { - - long limit; - - switch (typeCode) { - - case Types.SQL_INTERVAL_YEAR : - limit = DTIType.precisionLimits[(int) precision] * 12; - break; - - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - limit = DTIType.precisionLimits[(int) precision] * 12; - limit += 12; - break; - - case Types.SQL_INTERVAL_MONTH : - limit = DTIType.precisionLimits[(int) precision]; - break; - - case Types.SQL_INTERVAL_DAY : - limit = DTIType.precisionLimits[(int) precision] * 24 * 60 - * 60; - break; - - case Types.SQL_INTERVAL_DAY_TO_HOUR : - limit = DTIType.precisionLimits[(int) precision] * 24 * 60 - * 60; - break; - - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - limit = DTIType.precisionLimits[(int) precision] * 24 * 60 - * 60; - break; - - case Types.SQL_INTERVAL_DAY_TO_SECOND : - limit = DTIType.precisionLimits[(int) precision] * 24 * 60 - * 60; - break; - - case Types.SQL_INTERVAL_HOUR : - limit = DTIType.precisionLimits[(int) precision] * 60 * 60; - break; - - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - limit = DTIType.precisionLimits[(int) precision] * 60 * 60; - break; - - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - limit = DTIType.precisionLimits[(int) precision] * 60 * 60; - break; - - case Types.SQL_INTERVAL_MINUTE : - limit = DTIType.precisionLimits[(int) precision] * 60; - break; - - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - limit = DTIType.precisionLimits[(int) precision] * 60; - break; - - case Types.SQL_INTERVAL_SECOND : - limit = DTIType.precisionLimits[(int) precision]; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - - return limit; - } - - public int getPart(Session session, Object interval, int part) { - - long units; - - switch (part) { - - case Types.SQL_INTERVAL_YEAR : - return ((IntervalMonthData) interval).units / 12; - - case Types.SQL_INTERVAL_MONTH : - units = ((IntervalMonthData) interval).units; - - return part == startIntervalType ? (int) units - : (int) (units % 12); - - case Types.SQL_INTERVAL_DAY : - return (int) (((IntervalSecondData) interval).units - / (24 * 60 * 60)); - - case Types.SQL_INTERVAL_HOUR : { - units = ((IntervalSecondData) interval).units / (60 * 60); - - return part == startIntervalType ? (int) units - : (int) (units % 24); - } - case Types.SQL_INTERVAL_MINUTE : { - units = ((IntervalSecondData) interval).units / 60; - - return part == startIntervalType ? (int) units - : (int) (units % 60); - } - case Types.SQL_INTERVAL_SECOND : { - units = ((IntervalSecondData) interval).units; - - return part == startIntervalType ? (int) units - : (int) (units % 60); - } - case Types.DTI_MILLISECOND : - return ((IntervalSecondData) interval).nanos / 1000000; - - case Types.DTI_MICROSECOND : - return ((IntervalSecondData) interval).nanos / 1000; - - case Types.DTI_NANOSECOND : - return ((IntervalSecondData) interval).nanos; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public long getSeconds(Object interval) { - return ((IntervalSecondData) interval).units; - } - - public BigDecimal getSecondPart(Session session, Object interval) { - - long seconds = ((IntervalSecondData) interval).units; - - if (typeCode != Types.SQL_INTERVAL_SECOND) { - seconds %= 60; - } - - int nanos = ((IntervalSecondData) interval).nanos; - - return getSecondPart(seconds, nanos); - } - - public long convertToLongEndUnits(Object interval) { - - switch (endIntervalType) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_MONTH : - long months = ((IntervalMonthData) interval).units; - - return (months / DTIType.yearToSecondFactors[endPartIndex]); - - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_SECOND : { - long seconds = ((IntervalSecondData) interval).units; - - return (seconds / DTIType.yearToSecondFactors[endPartIndex]); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public double convertToDoubleStartUnits(Object interval) { - - switch (startIntervalType) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_MONTH : - double months = ((IntervalMonthData) interval).units; - - return (months / DTIType.yearToSecondFactors[startPartIndex]); - - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_SECOND : { - double seconds = ((IntervalSecondData) interval).units; - - return (seconds / DTIType.yearToSecondFactors[startPartIndex]); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "IntervalType"); - } - } - - public static double convertToDouble(Object interval) { - - if (interval instanceof IntervalMonthData) { - double months = ((IntervalMonthData) interval).units; - - return months; - } else { - IntervalSecondData value = (IntervalSecondData) interval; - double seconds = value.units - + (double) value.nanos / nanoScaleFactors[0]; - - return seconds; - } - } - - public Object convertFromDouble(double value) { - - long units = (long) value; - - if (this.isIntervalYearMonthType()) { - return new IntervalMonthData(units); - } else { - int nanos = (int) ((value - units) * limitNanoseconds); - - return new IntervalSecondData(units, nanos); - } - } - - public CharacterType getCharacterType() { - - String name = getNameString(); - CharacterType type = new CharacterType(name, displaySize()); - - return type; - } - - public Object getValue(long units, int nanos) { - - if (this.isIntervalYearMonthType()) { - return new IntervalMonthData(units, this); - } else { - return new IntervalSecondData(units, nanos, this, true); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/JavaObjectData.java b/database/hsqldb/src/org/hsqldb/types/JavaObjectData.java deleted file mode 100644 index 3fef478e..00000000 --- a/database/hsqldb/src/org/hsqldb/types/JavaObjectData.java +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.Serializable; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.InOutUtil; - -/** - * Represents of an instance of an OTHER field value.

    - * - * Prior to 1.7.0 there were problems storing Objects of normal column types - * in columns of the type OTHER. In 1.7.0 changes were made to allow this, - * but as all the conversion took place inside the engine, it introduced a - * requirement for all classes for objects stored in OTHER columns to be - * available on the runtime class path of the engine.

    - * - * In 1.7.2, the introduction of real prepared statement support allows us - * revert to the pre 1.7.0 behaviour without the artificial limitations.

    - * - * The classes for stored objects need not be available to open and operate - * the database in general. The classes need to be available only if a - * conversion from one of these objects to another type is performed inside - * the engine while operating the database. - * - * The current limitation is that in SQL statements, values of type String - * (CHARACTER and related SQL types) cannot be stored in columns of type - * OTHER. This limitation does not exist for String values assigned to - * PreparedStatement variables. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 1.7.2 - */ -public class JavaObjectData { - - private byte[] data; - - JavaObjectData() {} - - /** - * Constructor used inside the engine when an already serialized - * Object is read from a file (.log, .script, .data or text table source). - */ - public JavaObjectData(byte[] data) { - this.data = data; - } - - /** - * Constructor used inside the engine to convert an Object into an - * object of type OTHER. - * Used also with JDBC setParameter(). - * If parameter serialize is true, the Object is serialized for storage. - */ - public JavaObjectData(Serializable o) { - - try { - data = InOutUtil.serialize(o); - } catch (Exception e) { - throw Error.error(ErrorCode.X_22521, e.toString()); - } - } - - public byte[] getBytes() { - return data; - } - - public int getBytesLength() { - return data.length; - } - - /** - * This method is called from classes implementing the JDBC - * interfaces. Inside the engine it is used for conversion from a value of - * type OTHER to another type. It will throw if the OTHER is an instance - * of a class that is not available. - */ - public Object getObject() { - - try { - return InOutUtil.deserialize(data); - } catch (Exception e) { - throw Error.error(ErrorCode.X_22521, e.toString()); - } - } - - /** - * Returns String representation of this object. - * - * @return a String representation of this object. - */ - public String toString() { - return super.toString(); - } - - public boolean equals(Object other) { - return other instanceof JavaObjectData; - } - - public int hashCode() { - return 1; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/JavaObjectDataInternal.java b/database/hsqldb/src/org/hsqldb/types/JavaObjectDataInternal.java deleted file mode 100644 index d1ce6cb8..00000000 --- a/database/hsqldb/src/org/hsqldb/types/JavaObjectDataInternal.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.Serializable; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.InOutUtil; - -/** - * Represents of an instance of an OTHER field value for direct storage.

    - * - * Objects need not implement Serializable to be stored in the mem: database. - * They are stored as-is and reflect any changes to the stored Objects by the - * application program. - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.4 - * @since 1.9.0 - */ -public class JavaObjectDataInternal extends JavaObjectData { - - Object object; - - /** - * Constructor used inside the engine when an already serialized - * Object is read from a file. - * - * If the Object is not serializable, this method throws an exception. - */ - public JavaObjectDataInternal(byte[] data) { - - try { - object = InOutUtil.deserialize(data); - } catch (Exception e) { - throw Error.error(ErrorCode.X_22521, e.toString()); - } - } - - /** - * Constructor used inside the engine. - */ - public JavaObjectDataInternal(Object o) { - object = o; - } - - public byte[] getBytes() { - - try { - if (object instanceof Serializable) { - return InOutUtil.serialize((Serializable) object); - } - } catch (Exception e) {} - - return new byte[]{}; - } - - public int getBytesLength() { - - try { - if (object instanceof Serializable) { - byte[] data = InOutUtil.serialize((Serializable) object); - - return data.length; - } - } catch (Exception e) {} - - return 0; - } - - /** - * This method is called from classes implementing the JDBC - * interfaces. Inside the engine it is used for conversion from a value of - * type OTHER to another type. It will throw if the OTHER is an instance - * of a class that is not available. - */ - public Object getObject() { - return object; - } - - /** - * Returns String representation of this object. - * - * @return a String representation of this object. - */ - public String toString() { - return super.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/LobData.java b/database/hsqldb/src/org/hsqldb/types/LobData.java deleted file mode 100644 index ff142850..00000000 --- a/database/hsqldb/src/org/hsqldb/types/LobData.java +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.SessionInterface; - -/** - * Interface for Large Object implementations.

    - * - * All positions are 0 based - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 1.9.0 - * @since 1.9.0 - */ -public interface LobData { - - long length(SessionInterface session); - - long getId(); - - void setId(long id); - - void setSession(SessionInterface session); - - boolean isBinary(); -} diff --git a/database/hsqldb/src/org/hsqldb/types/LongPair.java b/database/hsqldb/src/org/hsqldb/types/LongPair.java deleted file mode 100644 index de634895..00000000 --- a/database/hsqldb/src/org/hsqldb/types/LongPair.java +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -public final class LongPair { - - public long a; - public long b; - - public LongPair(long a, long b) { - this.a = a; - this.b = b; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/NullType.java b/database/hsqldb/src/org/hsqldb/types/NullType.java deleted file mode 100644 index 0b97c6ff..00000000 --- a/database/hsqldb/src/org/hsqldb/types/NullType.java +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * Type subclass for untyped NULL values.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.3.1 - * @since 1.9.0 - */ -public final class NullType extends Type { - - static final NullType nullType = new NullType(); - - private NullType() { - super(Types.SQL_ALL_TYPES, Types.SQL_ALL_TYPES, 0, 0); - } - - public int displaySize() { - return 4; - } - - public int getJDBCTypeCode() { - return typeCode; - } - - public Class getJDBCClass() { - return java.lang.Void.class; - } - - public String getJDBCClassName() { - return "java.lang.Void"; - } - - public String getNameString() { - return Tokens.T_NULL; - } - - public String getDefinition() { - return Tokens.T_NULL; - } - - public Type getAggregateType(Type other) { - return other; - } - - public Type getCombinedType(Session session, Type other, int operation) { - return other; - } - - public int compare(Session session, Object a, Object b) { - throw Error.runtimeError(ErrorCode.U_S0500, "NullType"); - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - return null; - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - return null; - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - return null; - } - - public String convertToString(Object a) { - return Tokens.T_NULL; - } - - public String convertToSQLString(Object a) { - return Tokens.T_NULL; - } - - public boolean canConvertFrom(Type otherType) { - return true; - } - - public static Type getNullType() { - return nullType; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/NumberType.java b/database/hsqldb/src/org/hsqldb/types/NumberType.java deleted file mode 100644 index b659dce7..00000000 --- a/database/hsqldb/src/org/hsqldb/types/NumberType.java +++ /dev/null @@ -1,2092 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.RoundingMode; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.map.ValuePool; - -/** - * Type subclass for all NUMBER types.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.9.0 - */ -public final class NumberType extends Type { - - static final int tinyintPrecision = 3; - static final int smallintPrecision = 5; - static final int integerPrecision = 10; - public static final int bigintPrecision = 19; - static final int doublePrecision = 0; - public static final int defaultNumericPrecision = 128; - public static final int defaultNumericScale = 32; - public static final int maxNumericPrecision = Integer.MAX_VALUE; - static final int bigintSquareNumericPrecision = 40; - static final int decimalLiteralPrecision = 24; - - // - public static final int BIT_WIDTH = 1; - public static final int TINYINT_WIDTH = 8; - public static final int SMALLINT_WIDTH = 16; - public static final int INTEGER_WIDTH = 32; - public static final int BIGINT_WIDTH = 64; - public static final int DOUBLE_WIDTH = 128; // nominal width - public static final int DECIMAL_WIDTH = 256; // nominal width - - // - public static final Type SQL_NUMERIC_DEFAULT_INT = - new NumberType(Types.NUMERIC, defaultNumericPrecision, 0); - - // - public static final BigDecimal MAX_DOUBLE = - BigDecimal.valueOf(Double.MAX_VALUE); - public static final BigDecimal MAX_LONG = - BigDecimal.valueOf(Long.MAX_VALUE); - public static final BigDecimal MIN_LONG = - BigDecimal.valueOf(Long.MIN_VALUE); - public static final BigDecimal MAX_INT = - BigDecimal.valueOf(Integer.MAX_VALUE); - public static final BigDecimal MIN_INT = - BigDecimal.valueOf(Integer.MIN_VALUE); - - // - public static final BigInteger MIN_LONG_BI = MIN_LONG.toBigInteger(); - public static final BigInteger MAX_LONG_BI = MAX_LONG.toBigInteger(); - - // - final int typeWidth; - - public NumberType(int type, long precision, int scale) { - - super(Types.SQL_NUMERIC, type, precision, scale); - - switch (type) { - - case Types.TINYINT : - typeWidth = TINYINT_WIDTH; - break; - - case Types.SQL_SMALLINT : - typeWidth = SMALLINT_WIDTH; - break; - - case Types.SQL_INTEGER : - typeWidth = INTEGER_WIDTH; - break; - - case Types.SQL_BIGINT : - typeWidth = BIGINT_WIDTH; - break; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - typeWidth = DOUBLE_WIDTH; - break; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - typeWidth = DECIMAL_WIDTH; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - /** - * Returns decimal precision for NUMERIC/DECIMAL. Returns binary precision - * for other parts. - */ - public int getPrecision() { - - switch (typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - return typeWidth; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return 64; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return (int) precision; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - /** - * Returns decimal precision. - */ - public int getDecimalPrecision() { - - switch (typeCode) { - - case Types.TINYINT : - return tinyintPrecision; - - case Types.SQL_SMALLINT : - return smallintPrecision; - - case Types.SQL_INTEGER : - return integerPrecision; - - case Types.SQL_BIGINT : - return bigintPrecision; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return displaySize() - 1; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return (int) precision; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public int displaySize() { - - switch (typeCode) { - - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : - if (scale == 0) { - if (precision == 0) { - return 646456995; // precision + "-.".length()} - } - - return (int) precision + 1; - } - - if (precision == scale) { - return (int) precision + 3; - } - - return (int) precision + 2; - - case Types.SQL_FLOAT : - case Types.SQL_REAL : - case Types.SQL_DOUBLE : - return 23; // String.valueOf(-Double.MAX_VALUE).length(); - - case Types.SQL_BIGINT : - return 20; // decimal precision + "-".length(); - - case Types.SQL_INTEGER : - return 11; // decimal precision + "-".length(); - - case Types.SQL_SMALLINT : - return 6; // decimal precision + "-".length(); - - case Types.TINYINT : - return 4; // decimal precision + "-".length(); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public int getJDBCTypeCode() { - return typeCode == Types.SQL_BIGINT ? Types.BIGINT - : typeCode; - } - - public Class getJDBCClass() { - - switch (typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - return java.lang.Integer.class; - - case Types.SQL_BIGINT : - return java.lang.Long.class; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return java.lang.Double.class; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return java.math.BigDecimal.class; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public String getJDBCClassName() { - - switch (typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - return "java.lang.Integer"; - - case Types.SQL_BIGINT : - return "java.lang.Long"; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return "java.lang.Double"; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return "java.math.BigDecimal"; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public int getJDBCPrecision() { - return getPrecision(); - } - - public String getNameString() { - - switch (typeCode) { - - case Types.TINYINT : - return Tokens.T_TINYINT; - - case Types.SQL_SMALLINT : - return Tokens.T_SMALLINT; - - case Types.SQL_INTEGER : - return Tokens.T_INTEGER; - - case Types.SQL_BIGINT : - return Tokens.T_BIGINT; - - case Types.SQL_REAL : - return Tokens.T_REAL; - - case Types.SQL_FLOAT : - return Tokens.T_FLOAT; - - case Types.SQL_DOUBLE : - return Tokens.T_DOUBLE; - - case Types.SQL_NUMERIC : - return Tokens.T_NUMERIC; - - case Types.SQL_DECIMAL : - return Tokens.T_DECIMAL; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public String getFullNameString() { - - switch (typeCode) { - - case Types.SQL_DOUBLE : - return "DOUBLE PRECISION"; - - default : - return getNameString(); - } - } - - public String getDefinition() { - - switch (typeCode) { - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - StringBuilder sb = new StringBuilder(16); - - sb.append(getNameString()); - sb.append('('); - sb.append(precision); - - if (scale != 0) { - sb.append(','); - sb.append(scale); - } - - sb.append(')'); - - return sb.toString(); - - default : - return getNameString(); - } - } - - public long getMaxPrecision() { - - switch (typeCode) { - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return maxNumericPrecision; - - default : - return getNumericPrecisionInRadix(); - } - } - - public int getMaxScale() { - - switch (typeCode) { - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return Short.MAX_VALUE; - - default : - return 0; - } - } - - public boolean acceptsPrecision() { - - switch (typeCode) { - - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : - case Types.SQL_FLOAT : - return true; - - default : - return false; - } - } - - public boolean acceptsScale() { - - switch (typeCode) { - - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : - return true; - - default : - return false; - } - } - - public int getPrecisionRadix() { - - if (typeCode == Types.SQL_DECIMAL || typeCode == Types.SQL_NUMERIC) { - return 10; - } - - return 2; - } - - public boolean isNumberType() { - return true; - } - - public boolean isIntegralType() { - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return false; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return scale == 0; - - default : - return true; - } - } - - public boolean isExactNumberType() { - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return false; - - default : - return true; - } - } - - public boolean isDecimalType() { - - switch (typeCode) { - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return true; - - default : - return false; - } - } - - public int getNominalWidth() { - return typeWidth; - } - - public int precedenceDegree(Type other) { - - if (other.isNumberType()) { - int otherWidth = ((NumberType) other).typeWidth; - - return otherWidth - typeWidth; - } - - return Integer.MIN_VALUE; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (this == other) { - return this; - } - - if (other.isCharacterType()) { - return other.getAggregateType(this); - } - - switch (other.typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - break; - - default : - throw Error.error(ErrorCode.X_42562); - } - - if (typeWidth == DOUBLE_WIDTH) { - return this; - } - - if (((NumberType) other).typeWidth == DOUBLE_WIDTH) { - return other; - } - - if (typeWidth <= BIGINT_WIDTH - && ((NumberType) other).typeWidth <= BIGINT_WIDTH) { - return (typeWidth > ((NumberType) other).typeWidth) ? this - : other; - } - - int newScale = scale > other.scale ? scale - : other.scale; - long newDigits = precision - scale > other.precision - other.scale - ? precision - scale - : other.precision - other.scale; - - return getNumberType(Types.SQL_DECIMAL, newDigits + newScale, - newScale); - } - - /** - * Returns a SQL type "wide" enough to represent the result of the - * expression.
    - * A type is "wider" than the other if it can represent all its - * numeric values.
    - * Arithmetic operation terms are promoted to a type that can - * represent the resulting values and avoid incorrect results.

    - * FLOAT/REAL/DOUBLE used in an operation results in the same type, - * regardless of the type of the other operand. - * When the result or the expression is converted to the - * type of the target column for storage, an exception is thrown if the - * resulting value cannot be stored in the column

    - * Types narrower than INTEGER (int) are promoted to - * INTEGER. The order of promotion is as follows

    - * - * INTEGER, BIGINT, NUMERIC/DECIMAL

    - * - * TINYINT and SMALLINT in any combination return INTEGER
    - * TINYINT/SMALLINT/INTEGER and INTEGER return BIGINT
    - * TINYINT/SMALLINT/INTEGER and BIGINT return NUMERIC/DECIMAL
    - * BIGINT and BIGINT return NUMERIC/DECIMAL
    - * REAL/FLOAT/DOUBLE and any type return REAL/FLOAT/DOUBLE
    - * NUMERIC/DECIMAL any type other than REAL/FLOAT/DOUBLE returns NUMERIC/DECIMAL
    - * In the case of NUMERIC/DECIMAL returned, the result precision is always - * large enough to express any value result, while the scale depends on the - * operation:
    - * For ADD/SUBTRACT/DIVIDE, the scale is the larger of the two
    - * For MULTIPLY, the scale is the sum of the two scales
    - */ - public Type getCombinedType(Session session, Type other, int operation) { - - if (other.typeCode == Types.SQL_ALL_TYPES) { - other = this; - } - - switch (operation) { - - case OpTypes.ADD : - case OpTypes.DIVIDE : - break; - - case OpTypes.MULTIPLY : - if (other.isIntervalType()) { - return other.getCombinedType(session, this, - OpTypes.MULTIPLY); - } - break; - - case OpTypes.SUBTRACT : - default : - - // all derivatives of equality ops or comparison ops - return getAggregateType(other); - } - - if (!other.isNumberType()) { - throw Error.error(ErrorCode.X_42562); - } - - if (typeWidth == DOUBLE_WIDTH - || ((NumberType) other).typeWidth == DOUBLE_WIDTH) { - return Type.SQL_DOUBLE; - } - - // resolution for INTEGER types - if (operation != OpTypes.DIVIDE || session.database.sqlAvgScale == 0) { - int sum; - - if (operation == OpTypes.DIVIDE) { - sum = typeWidth; - } else { - sum = typeWidth + ((NumberType) other).typeWidth; - } - - if (sum <= INTEGER_WIDTH) { - return Type.SQL_INTEGER; - } - - if (sum <= BIGINT_WIDTH) { - return Type.SQL_BIGINT; - } - } - - int newScale; - long newDigits; - - switch (operation) { - - case OpTypes.ADD : - newScale = scale > other.scale ? scale - : other.scale; - newDigits = getDecimalPrecision() - scale - > ((NumberType) other).getDecimalPrecision() - - other.scale ? getDecimalPrecision() - scale - : ((NumberType) other).getDecimalPrecision() - - other.scale; - - newDigits++; - break; - - case OpTypes.DIVIDE : - newDigits = getDecimalPrecision() - scale + other.scale; - newScale = scale > other.scale ? scale - : other.scale; - - if (session.database.sqlAvgScale > newScale) { - newScale = session.database.sqlAvgScale; - } - break; - - case OpTypes.MULTIPLY : - newDigits = getDecimalPrecision() - scale - + ((NumberType) other).getDecimalPrecision() - - other.scale; - newScale = scale + other.scale; - break; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - - return getNumberType(Types.SQL_DECIMAL, newScale + newDigits, - newScale); - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - switch (typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : { - if (b instanceof Integer) { - int ai = ((Number) a).intValue(); - int bi = ((Number) b).intValue(); - - return (ai > bi) ? 1 - : (bi > ai ? -1 - : 0); - } else if (b instanceof Double) { - double ai = ((Number) a).doubleValue(); - double bi = ((Number) b).doubleValue(); - - return (ai > bi) ? 1 - : (bi > ai ? -1 - : 0); - } else if (b instanceof BigDecimal) { - BigDecimal ad = convertToDecimal(a); - - return ad.compareTo((BigDecimal) b); - } - } - - // fall through - case Types.SQL_BIGINT : { - if (b instanceof Long) { - long longa = ((Number) a).longValue(); - long longb = ((Number) b).longValue(); - - return (longa > longb) ? 1 - : (longb > longa ? -1 - : 0); - } else if (b instanceof Double) { - BigDecimal ad = - BigDecimal.valueOf(((Number) a).longValue()); - BigDecimal bd = - BigDecimal.valueOf(((Double) b).doubleValue()); - - return ad.compareTo(bd); - } else if (b instanceof BigDecimal) { - BigDecimal ad = convertToDecimal(a); - - return ad.compareTo((BigDecimal) b); - } - } - - // fall through - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - - /* @todo big-decimal etc */ - double ad = ((Number) a).doubleValue(); - double bd = ((Number) b).doubleValue(); - - return compareDouble(ad, bd); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - BigDecimal bd = convertToDecimal(b); - - return ((BigDecimal) a).compareTo(bd); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - /* @todo - review usage to see if range enforcement / java type conversion is necessary */ - public Object convertToTypeLimits(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - return a; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return a; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - BigDecimal dec = (BigDecimal) a; - - if (scale != dec.scale()) { - dec = dec.setScale(scale, RoundingMode.HALF_DOWN); - } - - int p = precision(dec); - - if (p > precision) { - throw Error.error(ErrorCode.X_22003); - } - - return dec; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - if (otherType.typeCode == typeCode) { - switch (typeCode) { - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - BigDecimal dec = (BigDecimal) a; - - if (scale != dec.scale()) { - dec = dec.setScale(scale, RoundingMode.HALF_DOWN); - } - - if (precision(dec) > precision) { - throw Error.error(ErrorCode.X_22003); - } - - return dec; - } - default : - return a; - } - } - - if (otherType.isIntervalType()) { - int startType = ((IntervalType) otherType).startIntervalType; - - switch (startType) { - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_MONTH : - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_SECOND : { - double value = - ((IntervalType) otherType).convertToDoubleStartUnits( - a); - - return convertToType(session, Double.valueOf(value), - Type.SQL_DOUBLE); - } - } - } - - switch (otherType.typeCode) { - - case Types.SQL_CLOB : - a = ((ClobData) a).getSubString( - session, 0L, (int) ((ClobData) a).length(session)); - - // fall through - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : { - a = session.getScanner().convertToNumber((String) a, this); - a = convertToDefaultType(session, a); - - return convertToTypeLimits(session, a); - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - break; - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - if (otherType.precision == 1) { - if (((BinaryData) a).getBytes()[0] == 0) { - a = ValuePool.INTEGER_0; - } else { - a = ValuePool.INTEGER_1; - } - - break; - } - - throw Error.error(ErrorCode.X_42561); - default : - throw Error.error(ErrorCode.X_42561); - } - - switch (this.typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - return convertToInt(session, a, this.typeCode); - - case Types.SQL_BIGINT : - return convertToLong(session, a); - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return convertToDouble(a); - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - BigDecimal value = null; - - if (scale == 0 && a instanceof Double) { - double d = ((Number) a).doubleValue(); - - if (session instanceof Session) { - if (!((Session) session).database.sqlConvertTruncate) { - d = java.lang.Math.rint(d); - } - } - - if (Double.isInfinite(d) || Double.isNaN(d)) { - throw Error.error(ErrorCode.X_22003); - } - - value = BigDecimal.valueOf(d); - } - - if (value == null) { - value = convertToDecimal(a); - } - - return convertToTypeLimits(session, value); - - default : - throw Error.error(ErrorCode.X_42561); - } - } - - public Object convertToTypeJDBC(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return a; - } - - if (otherType.isLobType()) { - throw Error.error(ErrorCode.X_42561); - } - - switch (otherType.typeCode) { - - case Types.SQL_BOOLEAN : - a = ((Boolean) a).booleanValue() ? ValuePool.INTEGER_1 - : ValuePool.INTEGER_0; - otherType = Type.SQL_INTEGER; - } - - return convertToType(session, a, otherType); - } - - /** - * Relaxes SQL parameter type enforcement for DECIMAL, allowing long values. - */ - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a == null) { - return a; - } - - Type otherType; - - if (a instanceof Number) { - if (a instanceof BigInteger) { - a = new BigDecimal((BigInteger) a); - } else if (a instanceof Float) { - a = Double.valueOf(((Float) a).doubleValue()); - } else if (a instanceof Byte) { - a = ValuePool.getInt(((Byte) a).intValue()); - } else if (a instanceof Short) { - a = ValuePool.getInt(((Short) a).intValue()); - } - - if (a instanceof Integer) { - otherType = Type.SQL_INTEGER; - } else if (a instanceof Long) { - otherType = Type.SQL_BIGINT; - } else if (a instanceof Double) { - otherType = Type.SQL_DOUBLE; - } else if (a instanceof BigDecimal) { - otherType = Type.SQL_DECIMAL_DEFAULT; - } else { - throw Error.error(ErrorCode.X_42561); - } - - switch (typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - return convertToInt(session, a, Types.INTEGER); - - case Types.SQL_BIGINT : - return convertToLong(session, a); - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return convertToDouble(a); - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - a = convertToDecimal(a); - - BigDecimal dec = (BigDecimal) a; - - if (scale != dec.scale()) { - dec = dec.setScale(scale, RoundingMode.HALF_DOWN); - } - - return dec; - } - default : - throw Error.error(ErrorCode.X_42561); - } - } else if (a instanceof String) { - otherType = Type.SQL_VARCHAR; - } else { - throw Error.error(ErrorCode.X_42561); - } - - return convertToType(session, a, otherType); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - return convertToDefaultType(session, a); - } - - /* - * Type narrowing from DOUBLE/DECIMAL/NUMERIC to BIGINT / INT / SMALLINT / TINYINT - * following SQL rules. When conversion is from a non-integral type, - * digits to the right of the decimal point are lost. - */ - - /** - * Converter from a numeric object to Integer. Input is checked to be - * within range represented by the given number type. - */ - static Integer convertToInt(SessionInterface session, Object a, int type) { - - int value; - - if (a instanceof Integer) { - if (type == Types.SQL_INTEGER) { - return (Integer) a; - } - - value = ((Integer) a).intValue(); - } else if (a instanceof Long) { - long temp = ((Long) a).longValue(); - - if (Integer.MAX_VALUE < temp || temp < Integer.MIN_VALUE) { - throw Error.error(ErrorCode.X_22003); - } - - value = (int) temp; - } else if (a instanceof BigDecimal) { - BigDecimal bd = ((BigDecimal) a); - - if (bd.compareTo(MAX_INT) > 0 || bd.compareTo(MIN_INT) < 0) { - throw Error.error(ErrorCode.X_22003); - } - - value = bd.intValue(); - } else if (a instanceof Double || a instanceof Float) { - double d = ((Number) a).doubleValue(); - - if (session instanceof Session) { - if (!((Session) session).database.sqlConvertTruncate) { - d = java.lang.Math.rint(d); - } - } - - if (Double.isInfinite(d) || Double.isNaN(d) - || d >= (double) Integer.MAX_VALUE + 1 - || d <= (double) Integer.MIN_VALUE - 1) { - throw Error.error(ErrorCode.X_22003); - } - - value = (int) d; - } else { - throw Error.error(ErrorCode.X_42561); - } - - if (type == Types.TINYINT) { - if (Byte.MAX_VALUE < value || value < Byte.MIN_VALUE) { - throw Error.error(ErrorCode.X_22003); - } - } else if (type == Types.SQL_SMALLINT) { - if (Short.MAX_VALUE < value || value < Short.MIN_VALUE) { - throw Error.error(ErrorCode.X_22003); - } - } - - return Integer.valueOf(value); - } - - /** - * Converter from a numeric object to Long. Input is checked to be - * within range represented by Long. - */ - static Long convertToLong(SessionInterface session, Object a) { - - if (a instanceof Integer) { - return ValuePool.getLong(((Integer) a).intValue()); - } else if (a instanceof Long) { - return (Long) a; - } else if (a instanceof BigDecimal) { - BigDecimal bd = (BigDecimal) a; - - if (bd.compareTo(MAX_LONG) > 0 || bd.compareTo(MIN_LONG) < 0) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getLong(bd.longValue()); - } else if (a instanceof Double || a instanceof Float) { - double d = ((Number) a).doubleValue(); - - if (session instanceof Session) { - if (!((Session) session).database.sqlConvertTruncate) { - d = java.lang.Math.rint(d); - } - } - - if (Double.isInfinite(d) || Double.isNaN(d) - || d >= (double) Long.MAX_VALUE + 1 - || d <= (double) Long.MIN_VALUE - 1) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getLong((long) d); - } else { - throw Error.error(ErrorCode.X_42561); - } - } - - /** - * Converter from a numeric object to Double. Input is checked to be - * within range represented by Double - */ - private static Double convertToDouble(Object a) { - - if (a instanceof java.lang.Double) { - return (Double) a; - } - - double value = toDouble(a); - - return ValuePool.getDouble(Double.doubleToLongBits(value)); - } - - public static double toDouble(Object a) { - - double value; - - if (a instanceof Number) { - value = ((Number) a).doubleValue(); - } else { - throw Error.error(ErrorCode.X_22501); - } - - return value; - } - - private static BigDecimal convertToDecimal(Object a) { - - if (a instanceof BigDecimal) { - return (BigDecimal) a; - } else if (a instanceof Integer || a instanceof Long) { - return BigDecimal.valueOf(((Number) a).longValue()); - } else if (a instanceof Double) { - double value = ((Number) a).doubleValue(); - - if (Double.isInfinite(value) || Double.isNaN(value)) { - throw Error.error(ErrorCode.X_22003); - } - - return BigDecimal.valueOf(value); - } else { - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - switch (this.typeCode) { - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - return a.toString(); - - case Types.SQL_REAL : - case Types.SQL_DOUBLE : - double value = ((Double) a).doubleValue(); - - /* @todo - java 5 format change */ - if (value == Double.NEGATIVE_INFINITY) { - return "-1E0/0"; - } - - if (value == Double.POSITIVE_INFINITY) { - return "1E0/0"; - } - - if (Double.isNaN(value)) { - return "0E0/0E0"; - } - - String s = Double.toString(value); - - // ensure the engine treats the value as a DOUBLE, not DECIMAL - if (s.indexOf('E') < 0) { - s = s.concat("E0"); - } - - return s; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return ((BigDecimal) a).toPlainString(); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - return convertToString(a); - } - - public boolean canConvertFrom(Type otherType) { - - if (otherType.typeCode == Types.SQL_ALL_TYPES) { - return true; - } - - if (otherType.isNumberType()) { - return true; - } - - if (otherType.isIntervalType()) { - return true; - } - - if (otherType.isCharacterType()) { - return true; - } - - if (otherType.isBitType() && otherType.precision == 1) { - return true; - } - - return false; - } - - public int canMoveFrom(Type otherType) { - - if (otherType == this) { - return ReType.keep; - } - - switch (typeCode) { - - case Types.TINYINT : - if (otherType.typeCode == Types.SQL_SMALLINT) { - return ReType.check; - } - break; - - case Types.SQL_SMALLINT : - if (otherType.typeCode == typeCode - || otherType.typeCode == Types.TINYINT) { - return ReType.keep; - } - break; - - case Types.SQL_INTEGER : - case Types.SQL_BIGINT : - if (otherType.typeCode == typeCode) { - return ReType.keep; - } - break; - - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : - if (otherType.typeCode == Types.SQL_DECIMAL - || otherType.typeCode == Types.SQL_NUMERIC) { - if (scale == otherType.scale) { - if (precision >= otherType.precision) { - return ReType.keep; - } else { - return ReType.check; - } - } - } - break; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - if (otherType.typeCode == Types.SQL_REAL - || otherType.typeCode == Types.SQL_FLOAT - || otherType.typeCode == Types.SQL_DOUBLE) { - return ReType.keep; - } - } - - return ReType.change; - } - - public int compareToTypeRange(Object o) { - - if (o instanceof Integer || o instanceof Long - || o instanceof BigDecimal) { - long temp = ((Number) o).longValue(); - int min; - int max; - int result; - - switch (typeCode) { - - case Types.TINYINT : - result = compareBigDecimalToLongLimits(o); - - if (result != 0) { - return result; - } - - min = Byte.MIN_VALUE; - max = Byte.MAX_VALUE; - break; - - case Types.SQL_SMALLINT : - result = compareBigDecimalToLongLimits(o); - - if (result != 0) { - return result; - } - - min = Short.MIN_VALUE; - max = Short.MAX_VALUE; - break; - - case Types.SQL_INTEGER : - result = compareBigDecimalToLongLimits(o); - - if (result != 0) { - return result; - } - - min = Integer.MIN_VALUE; - max = Integer.MAX_VALUE; - break; - - case Types.SQL_BIGINT : - result = compareBigDecimalToLongLimits(o); - - return result; - - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : { - if (precision - scale >= NumberType.bigintPrecision - && o instanceof Long) { - return 0; - } - - if (precision - scale >= NumberType.integerPrecision - && o instanceof Integer) { - return 0; - } - - BigDecimal dec = convertToDecimal(o); - int s = dec.scale(); - int p = precision(dec); - - if (s < 0) { - p -= s; - s = 0; - } - - return (precision - scale >= p - s) ? 0 - : dec.signum(); - } - default : - return 0; - } - - if (max < temp) { - return 1; - } - - if (temp < min) { - return -1; - } - - return 0; - } - - return 0; - } - - public Object add(Session session, Object a, Object b, Type otherType) { - - if (a == null || b == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double ad = ((Number) a).doubleValue(); - double bd = ((Number) b).doubleValue(); - - return ValuePool.getDouble(Double.doubleToLongBits(ad + bd)); - -// return Double.valueOf(ad + bd); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - a = convertToDefaultType(null, a); - b = convertToDefaultType(null, b); - - BigDecimal abd = (BigDecimal) a; - BigDecimal bbd = (BigDecimal) b; - - abd = abd.add(bbd); - - return convertToTypeLimits(null, abd); - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : { - int ai = ((Number) a).intValue(); - int bi = ((Number) b).intValue(); - - return ValuePool.getInt(ai + bi); - } - case Types.SQL_BIGINT : { - long longa = ((Number) a).longValue(); - long longb = ((Number) b).longValue(); - - return ValuePool.getLong(longa + longb); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public Object subtract(Session session, Object a, Object b, - Type otherType) { - - if (a == null || b == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double ad = ((Number) a).doubleValue(); - double bd = ((Number) b).doubleValue(); - - return ValuePool.getDouble(Double.doubleToLongBits(ad - bd)); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - a = convertToDefaultType(null, a); - b = convertToDefaultType(null, b); - - BigDecimal abd = (BigDecimal) a; - BigDecimal bbd = (BigDecimal) b; - - abd = abd.subtract(bbd); - - return convertToTypeLimits(null, abd); - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : { - int ai = ((Number) a).intValue(); - int bi = ((Number) b).intValue(); - - return ValuePool.getInt(ai - bi); - } - case Types.SQL_BIGINT : { - long longa = ((Number) a).longValue(); - long longb = ((Number) b).longValue(); - - return ValuePool.getLong(longa - longb); - } - default : - } - - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - - public Object multiply(Object a, Object b) { - - if (a == null || b == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double ad = ((Number) a).doubleValue(); - double bd = ((Number) b).doubleValue(); - - return ValuePool.getDouble(Double.doubleToLongBits(ad * bd)); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - if (!(a instanceof BigDecimal)) { - a = convertToDefaultType(null, a); - } - - if (!(b instanceof BigDecimal)) { - b = convertToDefaultType(null, b); - } - - BigDecimal abd = (BigDecimal) a; - BigDecimal bbd = (BigDecimal) b; - BigDecimal bd = abd.multiply(bbd); - - return convertToTypeLimits(null, bd); - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : { - int ai = ((Number) a).intValue(); - int bi = ((Number) b).intValue(); - - return ValuePool.getInt(ai * bi); - } - case Types.SQL_BIGINT : { - long longa = ((Number) a).longValue(); - long longb = ((Number) b).longValue(); - - return ValuePool.getLong(longa * longb); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public Object divide(Session session, Object a, Object b) { - - if (a == null || b == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double ad = ((Number) a).doubleValue(); - double bd = ((Number) b).doubleValue(); - - if (bd == 0 - && (session == null - || session.database.sqlDoubleNaN)) { - throw Error.error(ErrorCode.X_22012); - } - - return ValuePool.getDouble(Double.doubleToLongBits(ad / bd)); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - if (!(a instanceof BigDecimal)) { - a = convertToDefaultType(null, a); - } - - if (!(b instanceof BigDecimal)) { - b = convertToDefaultType(null, b); - } - - BigDecimal abd = (BigDecimal) a; - BigDecimal bbd = (BigDecimal) b; - - if (bbd.signum() == 0) { - throw Error.error(ErrorCode.X_22012); - } - - BigDecimal bd = abd.divide(bbd, scale, RoundingMode.DOWN); - - return convertToTypeLimits(null, bd); - } - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : { - int ai = ((Number) a).intValue(); - int bi = ((Number) b).intValue(); - - if (bi == 0) { - throw Error.error(ErrorCode.X_22012); - } - - return ValuePool.getInt(ai / bi); - } - case Types.SQL_BIGINT : { - long al = ((Number) a).longValue(); - long bl = ((Number) b).longValue(); - - if (bl == 0) { - throw Error.error(ErrorCode.X_22012); - } - - return ValuePool.getLong(al / bl); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public Object modulo(Session session, Object a, Object b, Type otherType) { - - if (!otherType.isNumberType()) { - throw Error.error(ErrorCode.X_42561); - } - - a = truncate(a, scale); - b = ((NumberType) otherType).truncate(b, otherType.scale); - - Object temp = divide(null, a, b); - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - temp = truncate(temp, 0); - } - - temp = multiply(temp, b); - temp = subtract(session, a, temp, this); - - return otherType.convertToType(null, temp, this); - } - - public Object absolute(Object a) { - return isNegative(a) ? negate(a) - : a; - } - - public Object negate(Object a) { - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double ad = -((Number) a).doubleValue(); - - return ValuePool.getDouble(Double.doubleToLongBits(ad)); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return ((BigDecimal) a).negate(); - - case Types.TINYINT : { - int value = ((Number) a).intValue(); - - if (value == Byte.MIN_VALUE) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getInt(-value); - } - case Types.SQL_SMALLINT : { - int value = ((Number) a).intValue(); - - if (value == Short.MIN_VALUE) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getInt(-value); - } - case Types.SQL_INTEGER : { - int value = ((Number) a).intValue(); - - if (value == Integer.MIN_VALUE) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getInt(-value); - } - case Types.SQL_BIGINT : { - long value = ((Number) a).longValue(); - - if (value == Long.MIN_VALUE) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getLong(-value); - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public int getNumericPrecisionInRadix() { - - switch (typeCode) { - - case Types.TINYINT : - return 8; - - case Types.SQL_SMALLINT : - return 16; - - case Types.SQL_INTEGER : - return 32; - - case Types.SQL_BIGINT : - return 64; - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return 64; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return (int) precision; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public Type getIntegralType() { - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : - return SQL_NUMERIC_DEFAULT_INT; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return scale == 0 ? this - : new NumberType(typeCode, precision, 0); - - default : - return this; - } - } - - public static boolean isZero(Object a) { - - if (a instanceof BigDecimal) { - return ((BigDecimal) a).signum() == 0; - } else if (a instanceof Double) { - return ((Double) a).doubleValue() == 0 || ((Double) a).isNaN(); - } else { - return ((Number) a).longValue() == 0; - } - } - - public boolean isNegative(Object a) { - return compareToZero(a) < 0; - } - - public int compareToZero(Object a) { - - if (a == null) { - return 0; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double ad = ((Number) a).doubleValue(); - - return ad == 0 ? 0 - : ad < 0 ? -1 - : 1; - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return ((BigDecimal) a).signum(); - - case Types.TINYINT : - case Types.SQL_SMALLINT : - case Types.SQL_INTEGER : { - int ai = ((Number) a).intValue(); - - return ai == 0 ? 0 - : ai < 0 ? -1 - : 1; - } - case Types.SQL_BIGINT : { - long al = ((Number) a).longValue(); - - return al == 0 ? 0 - : al < 0 ? -1 - : 1; - } - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } - - public static long scaledDecimal(Object a, int scale) { - - if (a == null) { - return 0; - } - - if (scale == 0) { - return 0; - } - - BigDecimal value = ((BigDecimal) a); - - if (value.scale() == 0) { - return 0; - } - - value = value.setScale(0, RoundingMode.FLOOR); - value = ((BigDecimal) a).subtract(value); - - return value.movePointRight(scale).longValue(); - } - - public static int compareBigDecimalToLongLimits(Object value) { - - if (value instanceof BigDecimal) { - int compare = compareToLongLimits((BigDecimal) value); - - return compare; - } - - return 0; - } - - public static int compareToLongLimits(BigDecimal value) { - - if (NumberType.MIN_LONG.compareTo(value) > 0) { - return -1; - } else if (NumberType.MAX_LONG.compareTo(value) < 0) { - return 1; - } - - return 0; - } - - public static int compareToLongLimits(BigInteger value) { - - if (NumberType.MIN_LONG_BI.compareTo(value) > 0) { - return -1; - } else if (NumberType.MAX_LONG_BI.compareTo(value) < 0) { - return 1; - } - - return 0; - } - - public Object ceiling(Object a) { - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double ad = Math.ceil(((Double) a).doubleValue()); - - if (Double.isInfinite(ad)) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getDouble(Double.doubleToLongBits(ad)); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - BigDecimal value = ((BigDecimal) a).setScale(0, - RoundingMode.CEILING); - - return value; - } - default : - return a; - } - } - - public Object floor(Object a) { - - if (a == null) { - return null; - } - - switch (typeCode) { - - case Types.SQL_REAL : - case Types.SQL_FLOAT : - case Types.SQL_DOUBLE : { - double value = Math.floor(((Double) a).doubleValue()); - - if (Double.isInfinite(value)) { - throw Error.error(ErrorCode.X_22003); - } - - return ValuePool.getDouble(Double.doubleToLongBits(value)); - } - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : { - BigDecimal value = ((BigDecimal) a).setScale(0, - RoundingMode.FLOOR); - - return value; - } - - // fall through - default : - return a; - } - } - - public Object truncate(Object a, int s) { - - if (a == null) { - return null; - } - - BigDecimal dec = convertToDecimal(a); - - dec = dec.setScale(s, RoundingMode.DOWN); - - if (typeCode == Types.SQL_DECIMAL || typeCode == Types.SQL_NUMERIC) { - dec = dec.setScale(scale, RoundingMode.DOWN); - } - - a = convertToDefaultType(null, dec); - - return convertToTypeLimits(null, a); - } - - public Object round(Object a, int s) { - - if (a == null) { - return null; - } - - BigDecimal dec = convertToDecimal(a); - - switch (typeCode) { - - case Types.SQL_DOUBLE : { - dec = dec.setScale(s, RoundingMode.HALF_EVEN); - - break; - } - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : - default : { - dec = dec.setScale(s, RoundingMode.HALF_UP); - dec = dec.setScale(scale, RoundingMode.DOWN); - - break; - } - } - - a = convertToDefaultType(null, dec); - - return convertToTypeLimits(null, a); - } - - public static int compareDouble(double value1, double value2) { - - if (Double.isNaN(value1)) { - return Double.isNaN(value2) ? 0 - : -1; - } - - if (Double.isNaN(value2)) { - return 1; - } - - return Double.compare(value1, value2); - } - - - static final BigDecimal BD_1 = BigDecimal.valueOf(1L); - static final BigDecimal MBD_1 = BigDecimal.valueOf(-1L); - - public static int precision(BigDecimal o) { - - if (o == null) { - return 0; - } - - int precision; - - if (o.compareTo(BD_1) < 0 && o.compareTo(MBD_1) > 0) { - precision = o.scale(); - } else { - precision = o.precision(); - } - - return precision; - } - - public static NumberType getNumberTypeForLiteral(BigDecimal value) { - - int precision = precision(value); - int scale = value.scale(); - - if (precision < decimalLiteralPrecision) { - precision = decimalLiteralPrecision; - } - - return new NumberType(Types.SQL_DECIMAL, precision, scale); - } - - public static NumberType getNumberType(int type, long precision, - int scale) { - - switch (type) { - - case Types.SQL_INTEGER : - return SQL_INTEGER; - - case Types.SQL_SMALLINT : - return SQL_SMALLINT; - - case Types.SQL_BIGINT : - return SQL_BIGINT; - - case Types.TINYINT : - return TINYINT; - - case Types.SQL_REAL : - case Types.SQL_DOUBLE : - return SQL_DOUBLE; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - return new NumberType(type, precision, scale); - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "NumberType"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/OtherType.java b/database/hsqldb/src/org/hsqldb/types/OtherType.java deleted file mode 100644 index a7b04cf7..00000000 --- a/database/hsqldb/src/org/hsqldb/types/OtherType.java +++ /dev/null @@ -1,197 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.io.Serializable; - -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.StringConverter; - -/** - * Type implementation for OTHER type.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.0.1 - * @since 1.9.0 - */ -public final class OtherType extends Type { - - static final OtherType otherType = new OtherType(); - - private OtherType() { - super(Types.OTHER, Types.OTHER, 0, 0); - } - - public int displaySize() { - return precision > Integer.MAX_VALUE ? Integer.MAX_VALUE - : (int) precision; - } - - public int getJDBCTypeCode() { - return typeCode; - } - - public Class getJDBCClass() { - return java.lang.Object.class; - } - - public String getJDBCClassName() { - return "java.lang.Object"; - } - - public int getSQLGenericTypeCode() { - - // return Types.SQL_UDT; - return typeCode; - } - - public int typeCode() { - - // return Types.SQL_UDT; - return typeCode; - } - - public String getNameString() { - return Tokens.T_OTHER; - } - - public String getDefinition() { - return Tokens.T_OTHER; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (typeCode == other.typeCode) { - return this; - } - - throw Error.error(ErrorCode.X_42562); - } - - public Type getCombinedType(Session session, Type other, int operation) { - return this; - } - - public int compare(Session session, Object a, Object b) { - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - return 0; - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - return a; - } - - // to review - if conversion is supported, then must be serializable and wrapped - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - return a; - } - - public Object convertToDefaultType(SessionInterface session, Object a) { - - if (a instanceof Serializable) { - return a; - } - - throw Error.error(ErrorCode.X_42561); - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return StringConverter.byteArrayToHexString( - ((JavaObjectData) a).getBytes()); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - return StringConverter.byteArrayToSQLHexString( - ((JavaObjectData) a).getBytes()); - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - return ((JavaObjectData) a).getObject(); - } - - public boolean canConvertFrom(Type otherType) { - - if (otherType.typeCode == typeCode) { - return true; - } - - if (otherType.typeCode == Types.SQL_ALL_TYPES) { - return true; - } - - return false; - } - - public boolean isObjectType() { - return true; - } - - public static OtherType getOtherType() { - return otherType; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/RowType.java b/database/hsqldb/src/org/hsqldb/types/RowType.java deleted file mode 100644 index f2a7c4ed..00000000 --- a/database/hsqldb/src/org/hsqldb/types/RowType.java +++ /dev/null @@ -1,530 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.OpTypes; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.SortAndSlice; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; - -/** - * Class for ROW type objects.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.0 - * @since 2.0.0 - */ -public class RowType extends Type { - - final Type[] dataTypes; - TypedComparator comparator; - - public RowType(Type[] dataTypes) { - - super(Types.SQL_ROW, Types.SQL_ROW, 0, 0); - - this.dataTypes = dataTypes; - } - - public int displaySize() { - return 0; - } - - public int getJDBCTypeCode() { - return Types.NULL; - } - - public Class getJDBCClass() { - return java.sql.ResultSet.class; - } - - public String getJDBCClassName() { - return "java.sql.ResultSet"; - } - - public int getJDBCScale() { - return 0; - } - - public int getJDBCPrecision() { - return 0; - } - - public int getSQLGenericTypeCode() { - return Types.SQL_ROW; - } - - public boolean isRowType() { - return true; - } - - public int getDegree() { - return dataTypes.length; - } - - public String getNameString() { - - StringBuilder sb = new StringBuilder(); - - sb.append(Tokens.T_ROW); - sb.append('('); - - for (int i = 0; i < dataTypes.length; i++) { - if (i > 0) { - sb.append(','); - } - - sb.append(dataTypes[i].getDefinition()); - } - - sb.append(')'); - - return sb.toString(); - } - - public String getDefinition() { - return getNameString(); - } - - public int compare(Session session, Object a, Object b) { - - if (a == b) { - return 0; - } - - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - Object[] arra = (Object[]) a; - Object[] arrb = (Object[]) b; - int length = arra.length; - - if (arrb.length < length) { - length = arrb.length; - } - - for (int i = 0; i < length; i++) { - int result = dataTypes[i].compare(session, arra[i], arrb[i]); - - if (result != 0) { - return result; - } - } - - if (arra.length > arrb.length) { - return 1; - } else if (arra.length < arrb.length) { - return -1; - } - - return 0; - } - - public Object convertToTypeLimits(SessionInterface session, Object a) { - - if (a == null) { - return null; - } - - Object[] arra = (Object[]) a; - Object[] arrb = new Object[arra.length]; - - for (int i = 0; i < arra.length; i++) { - arrb[i] = dataTypes[i].convertToTypeLimits(session, arra[i]); - } - - return arrb; - } - - public Object convertToType(SessionInterface session, Object a, - Type otherType) { - - if (a == null) { - return null; - } - - if (otherType == null) { - return a; - } - - if (!otherType.isRowType()) { - throw Error.error(ErrorCode.X_42562); - } - - Type[] otherTypes = ((RowType) otherType).getTypesArray(); - - if (dataTypes.length != otherTypes.length) { - throw Error.error(ErrorCode.X_42564); - } - - Object[] arra = (Object[]) a; - Object[] arrb = new Object[arra.length]; - - for (int i = 0; i < arra.length; i++) { - arrb[i] = dataTypes[i].convertToType(session, arra[i], - otherTypes[i]); - } - - return arrb; - } - - public Object convertToDefaultType(SessionInterface sessionInterface, - Object o) { - return o; - } - - public String convertToString(Object a) { - - if (a == null) { - return null; - } - - return convertToSQLString(a); - } - - public String convertToSQLString(Object a) { - - if (a == null) { - return Tokens.T_NULL; - } - - Object[] array = (Object[]) a; - StringBuilder sb = new StringBuilder(); - - sb.append(Tokens.T_ROW); - sb.append('('); - - for (int i = 0; i < array.length; i++) { - if (i > 0) { - sb.append(','); - } - - String string = dataTypes[i].convertToSQLString(array[i]); - - sb.append(string); - } - - sb.append(')'); - - return sb.toString(); - } - - public void convertToJSON(Object a, StringBuilder sb) { - - Object[] array = (Object[]) a; - - if (a == null) { - sb.append("null"); - - return; - } - - sb.append('{'); - - for (int i = 0; i < array.length; i++) { - if (i > 0) { - sb.append(','); - } - - dataTypes[i].convertToJSON(array[i], sb); - } - - sb.append('}'); - } - - public boolean canConvertFrom(Type otherType) { - - if (otherType == null) { - return true; - } - - if (!otherType.isRowType()) { - return false; - } - - Type[] otherTypes = ((RowType) otherType).getTypesArray(); - - if (dataTypes.length != otherTypes.length) { - return false; - } - - for (int i = 0; i < dataTypes.length; i++) { - if (!dataTypes[i].canConvertFrom(otherTypes[i])) { - return false; - } - } - - return true; - } - - public boolean canBeAssignedFrom(Type otherType) { - - if (otherType == null) { - return true; - } - - if (!otherType.isRowType()) { - return false; - } - - Type[] otherTypes = ((RowType) otherType).getTypesArray(); - - if (dataTypes.length != otherTypes.length) { - return false; - } - - for (int i = 0; i < dataTypes.length; i++) { - if (!dataTypes[i].canBeAssignedFrom(otherTypes[i])) { - return false; - } - } - - return true; - } - - public Type getAggregateType(Type other) { - - if (other == null) { - return this; - } - - if (other == SQL_ALL_TYPES) { - return this; - } - - if (other == this) { - return this; - } - - if (!other.isRowType()) { - throw Error.error(ErrorCode.X_42562); - } - - Type[] newTypes = new Type[dataTypes.length]; - Type[] otherTypes = ((RowType) other).getTypesArray(); - - if (dataTypes.length != otherTypes.length) { - throw Error.error(ErrorCode.X_42564); - } - - for (int i = 0; i < dataTypes.length; i++) { - newTypes[i] = dataTypes[i].getAggregateType(otherTypes[i]); - } - - return new RowType(newTypes); - } - - public Type getCombinedType(Session session, Type other, int operation) { - - if (operation != OpTypes.CONCAT) { - return getAggregateType(other); - } - - if (other == null) { - return this; - } - - if (!other.isRowType()) { - throw Error.error(ErrorCode.X_42562); - } - - Type[] newTypes = new Type[dataTypes.length]; - Type[] otherTypes = ((RowType) other).getTypesArray(); - - if (dataTypes.length != otherTypes.length) { - throw Error.error(ErrorCode.X_42564); - } - - for (int i = 0; i < dataTypes.length; i++) { - newTypes[i] = dataTypes[i].getAggregateType(otherTypes[i]); - } - - return new RowType(newTypes); - } - - public Type[] getTypesArray() { - return dataTypes; - } - - public int compare(Session session, Object a, Object b, - SortAndSlice sort) { - - if (a == b) { - return 0; - } - - // not related to sort - if (a == null) { - return -1; - } - - if (b == null) { - return 1; - } - - Object[] arra = (Object[]) a; - Object[] arrb = (Object[]) b; - int length = sort.columnCount; - - for (int i = 0; i < length; i++) { - int pos = sort.sortOrder[i]; - - a = arra[pos]; - b = arrb[pos]; - - if (a == b) { - continue; - } - - if (sort.sortNullsLast[i]) { - if (a == null) { - return 1; - } - - if (b == null) { - return -1; - } - } - - int result = dataTypes[pos].compare(session, a, b); - - if (result != 0) { - if (sort.sortDescending[i]) { - return -result; - } - - return result; - } - } - - return 0; - } - - public boolean equals(Object other) { - - if (other == this) { - return true; - } - - if (other instanceof RowType) { - if (super.equals(other)) { - Type[] otherTypes = ((RowType) other).dataTypes; - - if (otherTypes.length != dataTypes.length) { - return false; - } - - for (int i = 0; i < dataTypes.length; i++) { - if (!dataTypes[i].equals(otherTypes[i])) { - return false; - } - } - - return true; - } - } - - return false; - } - - public int hashCode(Object a) { - - if (a == null) { - return 0; - } - - int hash = 0; - Object[] array = (Object[]) a; - - for (int i = 0; i < dataTypes.length && i < 4; i++) { - hash += dataTypes[i].hashCode(array[i]); - } - - return hash; - } - - synchronized TypedComparator getComparator(Session session) { - - if (comparator == null) { - TypedComparator c = new TypedComparator(session); - SortAndSlice sort = new SortAndSlice(); - - sort.prepareMultiColumn(dataTypes.length); - c.setType(this, sort); - - comparator = c; - } - - return comparator; - } - - public static String convertToSQLString(Object[] array, Type[] types, - int maxUnitLength) { - - if (array == null) { - return Tokens.T_NULL; - } - - StringBuilder sb = new StringBuilder(); - - sb.append('('); - - for (int i = 0; i < array.length; i++) { - String value; - - if (i > 0) { - sb.append(','); - } - - String string = types[i].convertToSQLString(array[i]); - - if (maxUnitLength > 10 && string.length() > maxUnitLength) { - sb.append(string, 0, maxUnitLength - 4); - sb.append(" ..."); - } else { - sb.append(string); - } - } - - sb.append(')'); - - return sb.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/TimeData.java b/database/hsqldb/src/org/hsqldb/types/TimeData.java deleted file mode 100644 index 532f840d..00000000 --- a/database/hsqldb/src/org/hsqldb/types/TimeData.java +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -/** - * Implementation of data item for TIME.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 3.5.5 - * @since 1.9.0 - */ -public class TimeData { - - final int zone; - final int seconds; - final int nanos; - - public TimeData(int seconds, int nanos, int zoneSeconds) { - - while (seconds < 0) { - seconds += 24 * 60 * 60; - } - - if (seconds > 24 * 60 * 60) { - seconds %= 24 * 60 * 60; - } - - this.zone = zoneSeconds; - this.seconds = seconds; - this.nanos = nanos; - } - - public TimeData(int seconds, int nanos) { - this (seconds, nanos, 0); - } - - public int getSeconds() { - return seconds; - } - - public int getNanos() { - return nanos; - } - - public int getZone() { - return zone; - } - - public long getMillis() { - return seconds * 1000L; - } - - public boolean equals(Object other) { - - if (other instanceof TimeData) { - return seconds == ((TimeData) other).seconds - && nanos == ((TimeData) other).nanos - && zone == ((TimeData) other).zone ; - } - - return false; - } - - public int hashCode() { - return seconds ^ nanos; - } - - public int compareTo(TimeData b) { - - long diff = seconds - b.seconds; - - if (diff == 0) { - diff = nanos - b.nanos; - - if (diff == 0) { - return 0; - } - } - - return diff > 0 ? 1 - : -1; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/TimestampData.java b/database/hsqldb/src/org/hsqldb/types/TimestampData.java deleted file mode 100644 index 07e16c88..00000000 --- a/database/hsqldb/src/org/hsqldb/types/TimestampData.java +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -/** - * Implementation of data item for TIMESTAMP.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.9.0 - */ -public class TimestampData { - - final long seconds; - final int nanos; - final int zone; - - public TimestampData(long seconds) { - - this.seconds = seconds; - this.nanos = 0; - this.zone = 0; - } - - public TimestampData(long seconds, int nanos) { - - this.seconds = seconds; - this.nanos = nanos; - this.zone = 0; - } - - public TimestampData(long seconds, int nanos, int zoneSeconds) { - - this.seconds = seconds; - this.nanos = nanos; - this.zone = zoneSeconds; - } - - public static TimestampData fromMillisecondsGMT(long millis) { - - long sec = millis / 1000; - int nanos = (int) (millis % 1000) * 1000000; - - return new TimestampData(sec, nanos); - } - - public long getSeconds() { - return seconds; - } - - public int getNanos() { - return nanos; - } - - public int getZone() { - return zone; - } - - public long getMillis() { - return seconds * 1000; - } - - public boolean equals(Object other) { - - if (other instanceof TimestampData) { - return seconds == ((TimestampData) other).seconds - && nanos == ((TimestampData) other).nanos - && zone == ((TimestampData) other).zone; - } - - return false; - } - - public int hashCode() { - return (int) seconds ^ nanos; - } - - public int compareTo(TimestampData b) { - - long diff = seconds - b.seconds; - - if (diff == 0) { - diff = nanos - b.nanos; - - if (diff == 0) { - return 0; - } - } - - return diff > 0 ? 1 - : -1; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/Type.java b/database/hsqldb/src/org/hsqldb/types/Type.java deleted file mode 100644 index 80482700..00000000 --- a/database/hsqldb/src/org/hsqldb/types/Type.java +++ /dev/null @@ -1,1281 +0,0 @@ -/* Copyright (c) 2001-2023, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.SchemaObject; -import org.hsqldb.Session; -import org.hsqldb.SessionInterface; -import org.hsqldb.SortAndSlice; -import org.hsqldb.Tokens; -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.IntKeyHashMap; -import org.hsqldb.lib.IntValueHashMap; -import org.hsqldb.lib.OrderedHashSet; -import org.hsqldb.rights.Grantee; - -/** - * Base class for type objects.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.7.2 - * @since 1.9.0 - */ -public abstract class Type implements SchemaObject, Cloneable { - - public interface ReType { - - int keep = 0; // only metadata change is required - int check = 1; // range check is also required - int change = -1; // data conversion is required - } - - public static final Type[] emptyArray = new Type[]{}; - - // - public final int typeComparisonGroup; - public final int typeDataGroup; - public final int typeCode; - public final long precision; - public final int scale; - public UserTypeModifier userTypeModifier; - - // - Type(int typeGroup, int type, long precision, int scale) { - - this.typeComparisonGroup = typeGroup; - this.typeCode = type; - this.precision = precision; - this.scale = scale; - this.typeDataGroup = typeCode == Types.SQL_CHAR ? Types.SQL_VARCHAR - : typeCode; - } - - // interface specific methods - public final int getType() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getType(); - } - - public final HsqlName getName() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getName(); - } - - public final HsqlName getSchemaName() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getSchemaName(); - } - - public final HsqlName getCatalogName() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getSchemaName().schema; - } - - public final Grantee getOwner() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getOwner(); - } - - public final OrderedHashSet getReferences() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getReferences(); - } - - public final OrderedHashSet getComponents() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getComponents(); - } - - public final void compile(Session session, SchemaObject parentObject) { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - userTypeModifier.compile(session); - } - - /** - * Retrieves the SQL character sequence required to (re)create the - * type, as a String - * - * @return the SQL character sequence required to (re)create the type - */ - public String getSQL() { - - if (userTypeModifier == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - return userTypeModifier.getSQL(); - } - - public long getChangeTimestamp() { - return 0; - } - - public Type duplicate() { - - try { - return (Type) super.clone(); - } catch (CloneNotSupportedException e) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - } - - public abstract int displaySize(); - - /** - * Returns the JDBC type number of type, if it exists, - * otherwise the HSQLDB / SQL type. - */ - public abstract int getJDBCTypeCode(); - - /** - * Returns the JDBC class name of type, if it exists, - * otherwise the HSQLDB class name. - */ - public abstract String getJDBCClassName(); - - public abstract Class getJDBCClass(); - - public int getJDBCScale() { - return scale; - } - - public int getJDBCPrecision() { - return precision > Integer.MAX_VALUE ? Integer.MAX_VALUE - : (int) precision; - } - - /** - * Returns the generic SQL CLI type number of type, if it exists, - * otherwise the HSQLDB type. The generic type is returned for DATETIME - * and INTERVAL types. - */ - public int getSQLGenericTypeCode() { - return typeCode; - } - - /** - * Returns the name of the type - */ - public abstract String getNameString(); - - /** - * Returns the name of the type - */ - public String getFullNameString() { - return getNameString(); - } - - /** - * Returns the full definition of the type, including parameters - */ - public abstract String getDefinition(); - - public Collation getCollation() { - return null; - } - - public Charset getCharacterSet() { - return null; - } - - public final String getTypeDefinition() { - - if (userTypeModifier == null) { - return getDefinition(); - } - - return getName().getSchemaQualifiedStatementName(); - } - - public abstract int compare(Session session, Object a, Object b); - - public int compare(Session session, Object a, Object b, int opType) { - - if (a == b) { - return 0; - } - - return compare(session, a, b); - } - - public int compare(Session session, Object a, Object b, - SortAndSlice sort) { - - if (a == b) { - return 0; - } - - if (sort == null) { - return compare(session, a, b); - } - - if (a == null) { - return sort.sortNullsLast[0] ? 1 - : -1; - } - - if (b == null) { - return sort.sortNullsLast[0] ? -1 - : 1; - } - - int result = compare(session, a, b); - - return sort.sortDescending[0] ? -result - : result; - } - - public abstract Object convertToTypeLimits(SessionInterface session, - Object a); - - /** - * Explicit casts are handled by this method. - * SQL standard 6.12 rules for enforcement of size, precision and scale - * are implemented. For CHARACTER values, it performs truncation in all - * cases of long strings. - */ - public Object castToType(SessionInterface session, Object a, Type type) { - return convertToType(session, a, type); - } - - /** - * Same as castToType except for CHARACTER values. Perform string - * truncation of trailing spaces only. For other long strings, it raises - * an exception. - */ - public abstract Object convertToType(SessionInterface session, Object a, - Type type); - - /** - * Convert type for JDBC reads. Same as convertToType, but supports non-standard - * SQL conversions supported by JDBC - */ - public Object convertToTypeJDBC(SessionInterface session, Object a, - Type otherType) { - - if (otherType.isLobType()) { - throw Error.error(ErrorCode.X_42561); - } - - return convertToType(session, a, otherType); - } - - public Object convertJavaToSQL(SessionInterface session, Object a) { - return a; - } - - public Object convertSQLToJava(SessionInterface session, Object a) { - return a; - } - - /** - * Converts the object to the given type without limit checks. Used for JDBC writes. - */ - public abstract Object convertToDefaultType( - SessionInterface sessionInterface, Object o); - - public abstract String convertToString(Object a); - - public abstract String convertToSQLString(Object a); - - public void convertToJSON(Object a, StringBuilder sb) { - - if (a == null) { - sb.append("null"); - - return; - } - - String val = convertToString(a); - - sb.append(val); - } - - public abstract boolean canConvertFrom(Type otherType); - - /** - * When canConvertFrom() is true, can convert without changing the object - * @return 0 always, 1 only value range check required, -1 value conversion required - */ - public int canMoveFrom(Type otherType) { - - if (otherType == this) { - return ReType.keep; - } - - return ReType.change; - } - - public boolean canBeAssignedFrom(Type otherType) { - - if (otherType == null) { - return true; - } - - return otherType.typeCode == Types.SQL_ALL_TYPES - || typeComparisonGroup == otherType.typeComparisonGroup; - } - - public boolean canCompareDirect(Type otherType) { - return typeComparisonGroup == otherType.typeComparisonGroup; - } - - public int arrayLimitCardinality() { - return 0; - } - - public Type collectionBaseType() { - return null; - } - - public boolean isArrayType() { - return false; - } - - public boolean isMultisetType() { - return false; - } - - public boolean isRowType() { - return false; - } - - public boolean isStructuredType() { - return false; - } - - public boolean isCharacterType() { - return false; - } - - public boolean isNumberType() { - return false; - } - - public boolean isIntegralType() { - return false; - } - - public boolean isExactNumberType() { - return false; - } - - public boolean isDecimalType() { - return false; - } - - public boolean isDateTimeType() { - return false; - } - - public boolean isDateTimeTypeWithZone() { - return false; - } - - public boolean isDateOrTimestampType() { - return false; - } - - public boolean isTimestampType() { - return false; - } - - public boolean isTimeType() { - return false; - } - - public boolean isIntervalType() { - return false; - } - - public boolean isIntervalYearMonthType() { - return false; - } - - public boolean isIntervalDaySecondType() { - return false; - } - - public boolean isBinaryType() { - return false; - } - - public boolean isUUIDType() { - return false; - } - - public boolean isBooleanType() { - return false; - } - - public boolean isLobType() { - return false; - } - - public boolean isBitType() { - return false; - } - - public boolean isObjectType() { - return false; - } - - public boolean isDistinctType() { - - return userTypeModifier == null ? false - : userTypeModifier.schemaObjectType - == SchemaObject.TYPE; - } - - public boolean isDomainType() { - - return userTypeModifier == null ? false - : userTypeModifier.schemaObjectType - == SchemaObject.DOMAIN; - } - - public int getDegree() { - return 1; - } - - public boolean acceptsPrecision() { - return false; - } - - public boolean requiresPrecision() { - return false; - } - - public long getMaxPrecision() { - return 0; - } - - public int getMaxScale() { - return 0; - } - - public int getPrecisionRadix() { - return 0; - } - - public boolean acceptsFractionalPrecision() { - return false; - } - - public boolean acceptsScale() { - return false; - } - - public int precedenceDegree(Type other) { - - if (other.typeCode == typeCode) { - if (typeCode == Types.SQL_ARRAY) { - return collectionBaseType().precedenceDegree( - other.collectionBaseType()); - } - - return 0; - } - - return Integer.MIN_VALUE; - } - - /** - * Common type used in comparison operations. other must be comparable - * with this. - */ - public abstract Type getAggregateType(Type other); - - /** - * Result type of combining values of two types in different operations. - * other type is not always comparable with this, but a operation should - * be valid without any explicit CAST - */ - public abstract Type getCombinedType(Session session, Type other, - int operation); - - public int compareToTypeRange(Object o) { - return 0; - } - - /** - * All arithmetic ops are called on the pre-determined Type object of the result - */ - public Object absolute(Object a) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - public Object negate(Object a) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - public Object add(Session session, Object a, Object b, Type otherType) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - public Object subtract(Session session, Object a, Object b, - Type otherType) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - public Object multiply(Object a, Object b) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - public Object divide(Session session, Object a, Object b) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - public Object concat(Session session, Object a, Object b) { - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - - public int cardinality(Session session, Object a) { - return 0; - } - - public boolean isNegative(Object a) { - return false; - } - - public int hashCode(Object a) { - - if (a == null) { - return 0; - } - - return a.hashCode(); - } - - public boolean equals(Object other) { - - if (other == this) { - return true; - } - - if (other instanceof Type) { - if (getClass() != other.getClass()) { - return false; - } - - return ((Type) other).typeCode == typeCode - && ((Type) other).precision == precision - && ((Type) other).scale == scale - && ((Type) other).userTypeModifier == userTypeModifier; - } - - return false; - } - - public int hashCode() { - return typeCode + ((int) precision << 8) + (scale << 16); - } - - /* @todo 1.9.0 - review all - need max implementation defined lengths, used for parameters */ - - // null type - public static final Type SQL_ALL_TYPES = NullType.getNullType(); - - // character types - public static final CharacterType SQL_CHAR = - new CharacterType(Types.SQL_CHAR, 1); - public static final CharacterType SQL_CHAR_UUID = - new CharacterType(Types.SQL_CHAR, 36); - public static final CharacterType SQL_CHAR_DEFAULT = - new CharacterType(Types.SQL_CHAR, CharacterType.defaultCharPrecision); - public static final CharacterType SQL_VARCHAR = - new CharacterType(Types.SQL_VARCHAR, 0); - public static final CharacterType SQL_VARCHAR_DEFAULT = - new CharacterType(Types.SQL_VARCHAR, - CharacterType.defaultVarcharPrecision); - public static final CharacterType SQL_VARCHAR_LONG = - new CharacterType(Types.SQL_VARCHAR, ClobType.defaultShortClobSize); - public static final ClobType SQL_CLOB = - new ClobType(ClobType.defaultClobSize); - - // binary types - public static final BitType SQL_BIT = new BitType(Types.SQL_BIT, 1); - public static final BitType SQL_BIT_VARYING = - new BitType(Types.SQL_BIT_VARYING, 1); - public static final BitType SQL_BIT_VARYING_MAX_LENGTH = - new BitType(Types.SQL_BIT_VARYING, BitType.maxBitPrecision); - - // binary types - public static final BinaryType SQL_BINARY = - new BinaryType(Types.SQL_BINARY, 1); - public static final BinaryType SQL_BINARY_16 = - new BinaryType(Types.SQL_BINARY, 16); - public static final BinaryType SQL_BINARY_DEFAULT = - new BinaryType(Types.SQL_BINARY, 32 * 1024); - public static final BinaryType SQL_VARBINARY = - new BinaryType(Types.SQL_VARBINARY, 0); - public static final BinaryType SQL_VARBINARY_DEFAULT = - new BinaryType(Types.SQL_VARBINARY, 32 * 1024); - public static final BlobType SQL_BLOB = - new BlobType(BlobType.defaultBlobSize); - public static final BinaryUUIDType SQL_GUID = new BinaryUUIDType(); - - // other type - public static final OtherType OTHER = OtherType.getOtherType(); - - // boolean type - public static final BooleanType SQL_BOOLEAN = BooleanType.getBooleanType(); - - // number types - public static final NumberType SQL_NUMERIC = - new NumberType(Types.SQL_NUMERIC, NumberType.defaultNumericPrecision, - 0); - public static final NumberType SQL_DECIMAL = - new NumberType(Types.SQL_DECIMAL, NumberType.defaultNumericPrecision, - 0); - public static final NumberType SQL_DECIMAL_DEFAULT = - new NumberType(Types.SQL_DECIMAL, NumberType.defaultNumericPrecision, - NumberType.defaultNumericScale); - public static final NumberType SQL_DECIMAL_BIGINT_SQR = - new NumberType(Types.SQL_DECIMAL, - NumberType.bigintSquareNumericPrecision, 0); - public static final NumberType SQL_DOUBLE = - new NumberType(Types.SQL_DOUBLE, 0, 0); - - // - public static final NumberType TINYINT = new NumberType(Types.TINYINT, - NumberType.tinyintPrecision, 0); - public static final NumberType SQL_SMALLINT = - new NumberType(Types.SQL_SMALLINT, NumberType.smallintPrecision, 0); - public static final NumberType SQL_INTEGER = - new NumberType(Types.SQL_INTEGER, NumberType.integerPrecision, 0); - public static final NumberType SQL_BIGINT = - new NumberType(Types.SQL_BIGINT, NumberType.bigintPrecision, 0); - - // date time - public static final DateTimeType SQL_DATE = - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_DATE, 0); - public static final DateTimeType SQL_TIME = - new DateTimeType(Types.SQL_TIME, Types.SQL_TIME, - DTIType.defaultTimeFractionPrecision); - public static final DateTimeType SQL_TIME_MAX = - new DateTimeType(Types.SQL_TIME, Types.SQL_TIME, - DTIType.maxFractionPrecision); - public static final DateTimeType SQL_TIME_WITH_TIME_ZONE = - new DateTimeType(Types.SQL_TIME, Types.SQL_TIME_WITH_TIME_ZONE, - DTIType.defaultTimeFractionPrecision); - public static final DateTimeType SQL_TIME_WITH_TIME_ZONE_MAX = - new DateTimeType(Types.SQL_TIME, Types.SQL_TIME_WITH_TIME_ZONE, - DTIType.maxFractionPrecision); - public static final DateTimeType SQL_TIMESTAMP = - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, - DTIType.defaultTimestampFractionPrecision); - public static final DateTimeType SQL_TIMESTAMP_WITH_TIME_ZONE = - new DateTimeType(Types.SQL_TIMESTAMP, - Types.SQL_TIMESTAMP_WITH_TIME_ZONE, - DTIType.defaultTimestampFractionPrecision); - public static final DateTimeType SQL_TIMESTAMP_NO_FRACTION = - new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0); - public static final DateTimeType SQL_TIMESTAMP_WITH_TIME_ZONE_MAX = - new DateTimeType(Types.SQL_TIMESTAMP, - Types.SQL_TIMESTAMP_WITH_TIME_ZONE, - DTIType.maxFractionPrecision); - - // interval - public static final IntervalType SQL_INTERVAL_YEAR = - IntervalType.newIntervalType(Types.SQL_INTERVAL_YEAR, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_MONTH = - IntervalType.newIntervalType(Types.SQL_INTERVAL_MONTH, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_DAY = - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_HOUR = - IntervalType.newIntervalType(Types.SQL_INTERVAL_HOUR, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_MINUTE = - IntervalType.newIntervalType(Types.SQL_INTERVAL_MINUTE, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_SECOND = - IntervalType.newIntervalType(Types.SQL_INTERVAL_SECOND, - DTIType.defaultIntervalPrecision, - DTIType.defaultIntervalFractionPrecision); - public static final IntervalType SQL_INTERVAL_SECOND_MAX_FRACTION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_SECOND, - DTIType.defaultIntervalPrecision, - DTIType.maxFractionPrecision); - public static final IntervalType SQL_INTERVAL_YEAR_TO_MONTH = - IntervalType.newIntervalType(Types.SQL_INTERVAL_YEAR_TO_MONTH, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_DAY_TO_HOUR = - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY_TO_HOUR, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_DAY_TO_MINUTE = - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY_TO_MINUTE, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_DAY_TO_SECOND = - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY_TO_SECOND, - DTIType.defaultIntervalPrecision, - DTIType.defaultIntervalFractionPrecision); - public static final IntervalType SQL_INTERVAL_HOUR_TO_MINUTE = - IntervalType.newIntervalType(Types.SQL_INTERVAL_HOUR_TO_MINUTE, - DTIType.defaultIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_HOUR_TO_SECOND = - IntervalType.newIntervalType(Types.SQL_INTERVAL_HOUR_TO_SECOND, - DTIType.defaultIntervalPrecision, - DTIType.defaultIntervalFractionPrecision); - public static final IntervalType SQL_INTERVAL_MINUTE_TO_SECOND = - IntervalType.newIntervalType(Types.SQL_INTERVAL_MINUTE_TO_SECOND, - DTIType.defaultIntervalPrecision, - DTIType.defaultIntervalFractionPrecision); - - // - public static final IntervalType SQL_INTERVAL_YEAR_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_YEAR, - DTIType.maxIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_MONTH_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_MONTH, - DTIType.maxIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_DAY_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY, - DTIType.maxIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_HOUR_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_HOUR, - DTIType.maxIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_MINUTE_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_MINUTE, - DTIType.maxIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_SECOND_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_SECOND, - DTIType.maxIntervalSecondPrecision, - DTIType.defaultIntervalFractionPrecision); - public static final IntervalType SQL_INTERVAL_SECOND_MAX_FRACTION_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_SECOND, - DTIType.maxIntervalSecondPrecision, - DTIType.maxFractionPrecision); - - // - public static final IntervalType SQL_INTERVAL_YEAR_TO_MONTH_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_YEAR_TO_MONTH, - DTIType.maxIntervalPrecision, 0); - public static final IntervalType SQL_INTERVAL_DAY_TO_SECOND_MAX_PRECISION = - IntervalType.newIntervalType(Types.SQL_INTERVAL_DAY_TO_SECOND, - DTIType.maxIntervalPrecision, - DTIType.maxFractionPrecision); - - // - public static final ArrayType SQL_ARRAY_ALL_TYPES = - new ArrayType(SQL_ALL_TYPES, ArrayType.defaultArrayCardinality); - - public static ArrayType getDefaultArrayType(int type) { - return new ArrayType(getDefaultType(type), - ArrayType.defaultArrayCardinality); - } - - public static Type getDefaultType(int type) { - - try { - return getType(type, Type.SQL_VARCHAR.getCharacterSet(), - Type.SQL_VARCHAR.getCollation(), 0, 0); - } catch (Exception e) { - return null; - } - } - - public static Type getDefaultTypeWithSize(int type) { - - switch (type) { - - case Types.SQL_ALL_TYPES : - return SQL_ALL_TYPES; - - case Types.SQL_ARRAY : - return SQL_ARRAY_ALL_TYPES; - - case Types.SQL_CHAR : - return SQL_CHAR_DEFAULT; - - case Types.SQL_VARCHAR : - return SQL_VARCHAR_DEFAULT; - - case Types.SQL_CLOB : - return SQL_CLOB; - - case Types.SQL_INTEGER : - return SQL_INTEGER; - - case Types.SQL_SMALLINT : - return SQL_SMALLINT; - - case Types.SQL_BIGINT : - return SQL_BIGINT; - - case Types.TINYINT : - return TINYINT; - - case Types.SQL_FLOAT : - case Types.SQL_REAL : - case Types.SQL_DOUBLE : - return SQL_DOUBLE; - - case Types.SQL_NUMERIC : - return SQL_NUMERIC; - - case Types.SQL_DECIMAL : - return SQL_DECIMAL; - - case Types.SQL_BOOLEAN : - return SQL_BOOLEAN; - - case Types.SQL_BINARY : - return SQL_BINARY_DEFAULT; - - case Types.SQL_VARBINARY : - return SQL_VARBINARY_DEFAULT; - - case Types.SQL_GUID : - return SQL_GUID; - - case Types.SQL_BLOB : - return SQL_BLOB; - - case Types.SQL_BIT : - return SQL_BIT; - - case Types.SQL_BIT_VARYING : - return SQL_BIT_VARYING; - - case Types.SQL_DATE : - return SQL_DATE; - - case Types.SQL_TIME : - return SQL_TIME; - - case Types.SQL_TIME_WITH_TIME_ZONE : - return SQL_TIME_WITH_TIME_ZONE; - - case Types.SQL_TIMESTAMP : - return SQL_TIMESTAMP; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return SQL_TIMESTAMP_WITH_TIME_ZONE; - - case Types.SQL_INTERVAL_YEAR : - return SQL_INTERVAL_YEAR; - - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - return SQL_INTERVAL_YEAR_TO_MONTH; - - case Types.SQL_INTERVAL_MONTH : - return SQL_INTERVAL_MONTH; - - case Types.SQL_INTERVAL_DAY : - return SQL_INTERVAL_DAY; - - case Types.SQL_INTERVAL_DAY_TO_HOUR : - return SQL_INTERVAL_DAY_TO_HOUR; - - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - return SQL_INTERVAL_DAY_TO_MINUTE; - - case Types.SQL_INTERVAL_DAY_TO_SECOND : - return SQL_INTERVAL_DAY_TO_SECOND; - - case Types.SQL_INTERVAL_HOUR : - return SQL_INTERVAL_HOUR; - - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - return SQL_INTERVAL_HOUR_TO_MINUTE; - - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - return SQL_INTERVAL_HOUR_TO_SECOND; - - case Types.SQL_INTERVAL_MINUTE : - return SQL_INTERVAL_MINUTE; - - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - return SQL_INTERVAL_MINUTE_TO_SECOND; - - case Types.SQL_INTERVAL_SECOND : - return SQL_INTERVAL_SECOND; - - case Types.OTHER : - return OTHER; - - default : - return null; - } - } - - public static int getHSQLDBTypeCode(int jdbcTypeNumber) { - - switch (jdbcTypeNumber) { - - case Types.BIGINT : - return Types.SQL_BIGINT; - - case Types.LONGVARCHAR : - return Types.SQL_VARCHAR; - - case Types.CLOB : - return Types.SQL_CLOB; - - case Types.BINARY : - return Types.SQL_BINARY; - - case Types.BIT : - return Types.SQL_BIT_VARYING; - - case Types.VARBINARY : - case Types.LONGVARBINARY : - return Types.SQL_VARBINARY; - - case Types.BLOB : - return Types.SQL_BLOB; - - case Types.ARRAY : - return Types.SQL_ARRAY; - - case Types.TIME_WITH_TIMEZONE : - return Types.SQL_TIME_WITH_TIME_ZONE; - - case Types.TIMESTAMP_WITH_TIMEZONE : - return Types.SQL_TIMESTAMP_WITH_TIME_ZONE; - - default : - return jdbcTypeNumber; - } - } - - /** - * translate an internal type number to JDBC type number if a type is not - * supported internally, it is returned without translation - * - * @param type int - * @return int - */ - public static int getJDBCTypeCode(int type) { - - switch (type) { - - case Types.SQL_BLOB : - return Types.BLOB; - - case Types.SQL_CLOB : - return Types.CLOB; - - case Types.SQL_BIGINT : - return Types.BIGINT; - - case Types.SQL_BINARY : - return Types.BINARY; - - case Types.SQL_VARBINARY : - return Types.VARBINARY; - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - return Types.BIT; - - case Types.SQL_ARRAY : - return Types.ARRAY; - - case Types.SQL_TIME_WITH_TIME_ZONE : - return Types.TIME_WITH_TIMEZONE; - - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return Types.TIMESTAMP_WITH_TIMEZONE; - - default : - return type; - } - } - - public static Type getType(Type type, Collation collation) { - - if (type.getCollation() == collation) { - return type; - } - - if (type.isCharacterType()) { - type = new CharacterType(collation, type.typeCode, type.precision); - } - - return type; - } - - /** - * Enforces precision and scale limits on type - */ - public static Type getType(int type, Charset charset, Collation collation, - long precision, int scale) { - - switch (type) { - - case Types.SQL_ALL_TYPES : - return SQL_ALL_TYPES; - - case Types.SQL_CHAR : - case Types.SQL_VARCHAR : - case Types.SQL_CLOB : - return CharacterType.getCharacterType(type, precision, - collation); - - case Types.SQL_INTEGER : - return SQL_INTEGER; - - case Types.SQL_SMALLINT : - return SQL_SMALLINT; - - case Types.SQL_BIGINT : - return SQL_BIGINT; - - case Types.TINYINT : - return TINYINT; - - case Types.SQL_FLOAT : - if (precision > 53) { - throw Error.error(ErrorCode.X_42592, "" + precision); - } - - return SQL_DOUBLE; - - case Types.SQL_REAL : - case Types.SQL_DOUBLE : - return SQL_DOUBLE; - - case Types.SQL_NUMERIC : - case Types.SQL_DECIMAL : - if (precision == 0) { - precision = NumberType.defaultNumericPrecision; - } - - return NumberType.getNumberType(type, precision, scale); - - case Types.SQL_BOOLEAN : - return SQL_BOOLEAN; - - case Types.SQL_BINARY : - case Types.SQL_VARBINARY : - case Types.SQL_BLOB : - return BinaryType.getBinaryType(type, precision); - - case Types.SQL_GUID : - return SQL_GUID; - - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - return BitType.getBitType(type, precision); - - case Types.SQL_DATE : - case Types.SQL_TIME : - case Types.SQL_TIME_WITH_TIME_ZONE : - case Types.SQL_TIMESTAMP : - case Types.SQL_TIMESTAMP_WITH_TIME_ZONE : - return DateTimeType.getDateTimeType(type, scale); - - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - return IntervalType.getIntervalType(type, precision, scale); - - case Types.OTHER : - return OTHER; - - default : - throw Error.runtimeError(ErrorCode.U_S0500, "Type"); - } - } - - public static Type getAggregateType(Type add, Type existing) { - - if (existing == null || existing.typeCode == Types.SQL_ALL_TYPES) { - return add; - } - - if (add == null || add.typeCode == Types.SQL_ALL_TYPES) { - return existing; - } - - return existing.getAggregateType(add); - } - - public static final IntValueHashMap typeAliases; - public static final IntValueHashMap typeNames; - public static final IntKeyHashMap jdbcConvertTypes; - - static { - typeNames = new IntValueHashMap(); - - typeNames.put(Tokens.T_CHARACTER, Types.SQL_CHAR); - typeNames.put(Tokens.T_VARCHAR, Types.SQL_VARCHAR); - typeNames.put(Tokens.T_VARCHAR_IGNORECASE, Types.VARCHAR_IGNORECASE); - typeNames.put(Tokens.T_NVARCHAR, Types.SQL_VARCHAR); - typeNames.put(Tokens.T_DATE, Types.SQL_DATE); - typeNames.put(Tokens.T_TIME, Types.SQL_TIME); - typeNames.put(Tokens.T_TIMESTAMP, Types.SQL_TIMESTAMP); - typeNames.put(Tokens.T_INTERVAL, Types.SQL_INTERVAL); - typeNames.put(Tokens.T_TINYINT, Types.TINYINT); - typeNames.put(Tokens.T_SMALLINT, Types.SQL_SMALLINT); - typeNames.put(Tokens.T_INTEGER, Types.SQL_INTEGER); - typeNames.put(Tokens.T_BIGINT, Types.SQL_BIGINT); - typeNames.put(Tokens.T_REAL, Types.SQL_REAL); - typeNames.put(Tokens.T_FLOAT, Types.SQL_FLOAT); - typeNames.put(Tokens.T_DOUBLE, Types.SQL_DOUBLE); - typeNames.put(Tokens.T_NUMERIC, Types.SQL_NUMERIC); - typeNames.put(Tokens.T_DECIMAL, Types.SQL_DECIMAL); - typeNames.put(Tokens.T_BOOLEAN, Types.SQL_BOOLEAN); - typeNames.put(Tokens.T_BINARY, Types.SQL_BINARY); - typeNames.put(Tokens.T_VARBINARY, Types.SQL_VARBINARY); - typeNames.put(Tokens.T_CLOB, Types.SQL_CLOB); - typeNames.put(Tokens.T_BLOB, Types.SQL_BLOB); - typeNames.put(Tokens.T_BIT, Types.SQL_BIT); - typeNames.put(Tokens.T_OTHER, Types.OTHER); - typeNames.put(Tokens.T_UUID, Types.SQL_GUID); - typeNames.put("TIME WITH TIME ZONE", Types.SQL_TIME_WITH_TIME_ZONE); - typeNames.put("TIMESTAMP WITH TIME ZONE", Types.SQL_TIMESTAMP_WITH_TIME_ZONE); - - // - typeAliases = new IntValueHashMap(64); - - typeAliases.put(Tokens.T_CHAR, Types.SQL_CHAR); - typeAliases.put(Tokens.T_INT, Types.SQL_INTEGER); - typeAliases.put(Tokens.T_DEC, Types.SQL_DECIMAL); - typeAliases.put(Tokens.T_LONGVARCHAR, Types.LONGVARCHAR); - typeAliases.put(Tokens.T_DATETIME, Types.SQL_TIMESTAMP); - typeAliases.put(Tokens.T_LONGVARBINARY, Types.LONGVARBINARY); - typeAliases.put(Tokens.T_OBJECT, Types.OTHER); - - // - jdbcConvertTypes = new IntKeyHashMap(37); - - jdbcConvertTypes.put(Tokens.SQL_CHAR, Type.SQL_CHAR_DEFAULT); - jdbcConvertTypes.put(Tokens.SQL_VARCHAR, Type.SQL_VARCHAR_DEFAULT); - jdbcConvertTypes.put(Tokens.SQL_LONGVARCHAR, Type.SQL_VARCHAR_DEFAULT); - jdbcConvertTypes.put(Tokens.SQL_NVARCHAR, Type.SQL_VARCHAR_DEFAULT); - jdbcConvertTypes.put(Tokens.SQL_DATE, Type.SQL_DATE); - jdbcConvertTypes.put(Tokens.SQL_TIME, Type.SQL_TIME); - jdbcConvertTypes.put(Tokens.SQL_TIMESTAMP, Type.SQL_TIMESTAMP); - jdbcConvertTypes.put(Tokens.SQL_TINYINT, Type.TINYINT); - jdbcConvertTypes.put(Tokens.SQL_SMALLINT, Type.SQL_SMALLINT); - jdbcConvertTypes.put(Tokens.SQL_INTEGER, Type.SQL_INTEGER); - jdbcConvertTypes.put(Tokens.SQL_BIGINT, Type.SQL_BIGINT); - jdbcConvertTypes.put(Tokens.SQL_REAL, Type.SQL_DOUBLE); - jdbcConvertTypes.put(Tokens.SQL_FLOAT, Type.SQL_DOUBLE); - jdbcConvertTypes.put(Tokens.SQL_DOUBLE, Type.SQL_DOUBLE); - jdbcConvertTypes.put(Tokens.SQL_NUMERIC, Type.SQL_NUMERIC); - jdbcConvertTypes.put(Tokens.SQL_DECIMAL, Type.SQL_DECIMAL); - jdbcConvertTypes.put(Tokens.SQL_BOOLEAN, Type.SQL_BOOLEAN); - jdbcConvertTypes.put(Tokens.SQL_BINARY, Type.SQL_BINARY_DEFAULT); - jdbcConvertTypes.put(Tokens.SQL_VARBINARY, Type.SQL_VARBINARY_DEFAULT); - jdbcConvertTypes.put(Tokens.SQL_LONGVARBINARY, - Type.SQL_VARBINARY_DEFAULT); - jdbcConvertTypes.put(Tokens.SQL_CLOB, Type.SQL_CLOB); - jdbcConvertTypes.put(Tokens.SQL_BLOB, Type.SQL_BLOB); - jdbcConvertTypes.put(Tokens.SQL_BIT, Type.SQL_BIT); - } - - public static int getTypeNr(String name) { - - int i = typeNames.get(name, Integer.MIN_VALUE); - - if (i == Integer.MIN_VALUE) { - i = typeAliases.get(name, Integer.MIN_VALUE); - } - - return i; - } - - public static Type getTypeForJDBCConvertToken(int name) { - return (Type) jdbcConvertTypes.get(name); - } - - public static boolean isSupportedSQLType(int typeNumber) { - - if (getDefaultType(typeNumber) == null) { - return false; - } - - return true; - } - - public static boolean matches(Type[] one, Type[] other) { - - for (int i = 0; i < one.length; i++) { - if (one[i].typeCode != other[i].typeCode) { - return false; - } - } - - return true; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/TypedComparator.java b/database/hsqldb/src/org/hsqldb/types/TypedComparator.java deleted file mode 100644 index 8409f3db..00000000 --- a/database/hsqldb/src/org/hsqldb/types/TypedComparator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import java.util.Comparator; - -import org.hsqldb.Session; -import org.hsqldb.SortAndSlice; -import org.hsqldb.lib.ObjectComparator; - -/** - * Comparator with sort order and null order.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.6.0 - * @since 2.4.0 - */ -public class TypedComparator implements Comparator, ObjectComparator { - - final Session session; - Type type; - SortAndSlice sort; - - public TypedComparator(Session session) { - this.session = session; - } - - public int compare(Object a, Object b) { - - if (sort == null) { - return type.compare(session, a, b); - } else { - return type.compare(session, a, b, sort); - } - } - - public boolean equals(Object a, Object b) { - - if (a == b) { - return true; - } - - if (a == null || b == null) { - return false; - } - - return type.compare(session, a, b) == 0; - } - - public int hashCode(Object a) { - return type.hashCode(a); - } - - public long longKey(Object a) { - return 0; - } - - public void setType(Type type, SortAndSlice sort) { - this.type = type; - this.sort = sort; - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/Types.java b/database/hsqldb/src/org/hsqldb/types/Types.java deleted file mode 100644 index 284254b5..00000000 --- a/database/hsqldb/src/org/hsqldb/types/Types.java +++ /dev/null @@ -1,849 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.error.Error; -import org.hsqldb.error.ErrorCode; -import org.hsqldb.lib.HashSet; -import org.hsqldb.lib.IntValueHashMap; -import org.hsqldb.persist.HsqlDatabaseProperties; - -// campbell-burnet@users 20051207 - patch 1.8.x initial JDBC 4.0 support work -// fredt@users - 2.0.0 code changes - -/** - * Defines the constants that are used to identify SQL types for HSQLDB JDBC - * interface type reporting. The actual type constant values are equivalent - * to those defined in the latest java.sql.Types, where available, - * or those defined by ansi/iso SQL 2003 otherwise. A type sub-identifier - * has been added to differentiate HSQLDB-specific type specializations. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.6.0 - * @since 1.7.2 - */ -public class Types { - - /** - * Names of types returned by JDBC methods and accepted as - * library and user function arguments - */ - public static final String DecimalClassName = "java.math.BigDecimal"; - public static final String DateClassName = "java.sql.Date"; - public static final String TimeClassName = "java.sql.Time"; - public static final String TimestampClassName = "java.sql.Timestamp"; - public static final String BlobClassName = "java.sql.Blob"; - public static final String ClobClassName = "java.sql.Clob"; - /* - SQL specifies predefined data types named by the following s: - CHARACTER, CHARACTER VARYING, CHARACTER LARGE OBJECT, BINARY LARGE OBJECT, - NUMERIC, DECIMAL, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, DOUBLE PRECISION, - BOOLEAN, DATE, TIME, TIMESTAMP, and INTERVAL. Also BINARY and VARBINARY - in SQL post-2003 - SQL 2003 adds DATALINK in Part 9: Management of External Data (SQL/MED) - and adds XML in Part 14: XML-Related Specifications (SQL/XML) - */ - - // CLI type list from Table 37 - public static final int SQL_CHAR = 1; - public static final int SQL_NUMERIC = 2; - public static final int SQL_DECIMAL = 3; - public static final int SQL_INTEGER = 4; - public static final int SQL_SMALLINT = 5; - public static final int SQL_FLOAT = 6; - public static final int SQL_REAL = 7; - public static final int SQL_DOUBLE = 8; - public static final int SQL_VARCHAR = 12; - public static final int SQL_BOOLEAN = 16; - public static final int SQL_USER_DEFINED_TYPE = 17; - public static final int SQL_ROW = 19; - public static final int SQL_REF = 20; - public static final int SQL_BIGINT = 25; // different in JDBC - public static final int SQL_BLOB = 30; // different in JDBC - public static final int SQL_CLOB = 40; // different in JDBC - public static final int SQL_ARRAY = 50; // different in JDBC - not predefined - public static final int SQL_MULTISET = 55; // - public static final int SQL_BINARY = 60; // different in JDBC -in SQL post-2003 - public static final int SQL_VARBINARY = 61; // different in JDBC - in SQL post-2003 - public static final int SQL_DATE = 91; - public static final int SQL_TIME = 92; - public static final int SQL_TIMESTAMP = 93; // - public static final int SQL_TIME_WITH_TIME_ZONE = 94; - public static final int SQL_TIMESTAMP_WITH_TIME_ZONE = 95; // - public static final int SQL_INTERVAL_YEAR = 101; // - public static final int SQL_INTERVAL_MONTH = 102; - public static final int SQL_INTERVAL_DAY = 103; - public static final int SQL_INTERVAL_HOUR = 104; - public static final int SQL_INTERVAL_MINUTE = 105; - public static final int SQL_INTERVAL_SECOND = 106; - public static final int SQL_INTERVAL_YEAR_TO_MONTH = 107; - public static final int SQL_INTERVAL_DAY_TO_HOUR = 108; - public static final int SQL_INTERVAL_DAY_TO_MINUTE = 109; - public static final int SQL_INTERVAL_DAY_TO_SECOND = 110; - public static final int SQL_INTERVAL_HOUR_TO_MINUTE = 111; - public static final int SQL_INTERVAL_HOUR_TO_SECOND = 112; - public static final int SQL_INTERVAL_MINUTE_TO_SECOND = 113; - - // units or components not in SQL or JDBC lists, used with TRUNCATE, ROUND and other functions - public static final int DTI_TIMEZONE_HOUR = 121; - public static final int DTI_TIMEZONE_MINUTE = 122; - public static final int DTI_DAY_OF_WEEK = 123; - public static final int DTI_DAY_OF_MONTH = 124; - public static final int DTI_DAY_OF_YEAR = 125; - public static final int DTI_WEEK_OF_YEAR = 126; - public static final int DTI_QUARTER = 127; - public static final int DTI_DAY_NAME = 128; - public static final int DTI_MONTH_NAME = 129; - public static final int DTI_SECONDS_MIDNIGHT = 130; - public static final int DTI_ISO_YEAR = 131; - public static final int DTI_MILLISECOND = 132; - public static final int DTI_MICROSECOND = 133; - public static final int DTI_NANOSECOND = 134; - public static final int DTI_TIMEZONE = 135; - public static final int DTI_ISO_WEEK_OF_YEAR = 136; - - // used where local defines are used in the same range as SQL type numbers - public static final int SQL_TYPE_NUMBER_LIMIT = 256; - - // These values are not in table 37 of the SQL CLI 2003 FCD, but some - // are found in tables 6-9 and some are found in Annex A1: - // c Header File SQLCLI.H and/or addenda in other documents, - // such as: - // SQL 2003 Part 9: Management of External Data (SQL/MED) : DATALINK - // SQL 2003 Part 14: XML-Related Specifications (SQL/XML) : XML - public static final int SQL_BIT = 14; // is in SQL99 but removed from 2003 - public static final int SQL_BIT_VARYING = 15; // is in SQL99 but removed from 2003 - public static final int SQL_DATALINK = 70; - public static final int SQL_UDT = 17; - public static final int SQL_UDT_LOCATOR = 18; - public static final int SQL_BLOB_LOCATOR = 31; - public static final int SQL_CLOB_LOCATOR = 41; - public static final int SQL_ARRAY_LOCATOR = 51; - public static final int SQL_MULTISET_LOCATOR = 56; - public static final int SQL_ALL_TYPES = 0; - public static final int SQL_DATETIME = 9; // collective name - public static final int SQL_INTERVAL = 10; // collective name - public static final int SQL_XML = 137; - - // These values are taken from various SQL CLI header files - public static final int SQL_NCHAR = (-8); - public static final int SQL_WCHAR = (-8); - public static final int SQL_WVARCHAR = (-9); - public static final int SQL_NVARCHAR = (-9); - public static final int SQL_WLONGVARCHAR = (-10); - public static final int SQL_NTEXT = (-10); - public static final int SQL_LONGVARBINARY = (-4); - public static final int SQL_IMAGE = (-4); - public static final int SQL_GUID = (-11); - public static final int SQL_VARIANT = (-150); - - // SQL_UDT subcodes - public static final int SQL_SUB_DISTINCT = 1; - public static final int SQL_SUB_STRUCTURED = 2; - - // non-standard type not in JDBC or SQL CLI - public static final int VARCHAR_IGNORECASE = 100; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * ARRAY. - * - * @since JDK 1.2 - */ - public static final int ARRAY = 2003; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * BIGINT. - */ - public static final int BIGINT = -5; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * BINARY. - */ - public static final int BINARY = -2; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * BIT. - */ - public static final int BIT = -7; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * BLOB. - * - * @since JDK 1.2 - */ - public static final int BLOB = 2004; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * BOOLEAN. - * - * @since JDK 1.4 - */ - public static final int BOOLEAN = SQL_BOOLEAN; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * CHAR. - */ - public static final int CHAR = SQL_CHAR; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * CLOB - * - * @since JDK 1.2 - */ - public static final int CLOB = 2005; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type DATALINK. - * - * @since JDK 1.4 - */ - public static final int DATALINK = 70; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * DATE. - */ - public static final int DATE = SQL_DATE; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * DECIMAL. - */ - public static final int DECIMAL = SQL_DECIMAL; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * DISTINCT. - * - * @since JDK 1.2 - */ - public static final int DISTINCT = 2001; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * DOUBLE. - */ - public static final int DOUBLE = SQL_DOUBLE; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * FLOAT. - */ - public static final int FLOAT = SQL_FLOAT; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * INTEGER. - */ - public static final int INTEGER = SQL_INTEGER; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * JAVA_OBJECT. - * - * @since JDK 1.2 - */ - public static final int JAVA_OBJECT = 2000; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * LONGVARBINARY. - */ - public static final int LONGVARBINARY = -4; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * LONGVARCHAR. - */ - public static final int LONGVARCHAR = -1; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * MULTISET. - */ - public static final int MULTISET = 0; // no java.sql.Types definition - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * NULL. - */ - public static final int NULL = 0; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * NUMERIC. - */ - public static final int NUMERIC = SQL_NUMERIC; - - /** - * The constant in the Java programming language that indicates - * that the SQL type is database-specific and - * gets mapped to a Java object that can be accessed via - * the methods getObject and setObject. - */ - public static final int OTHER = 1111; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * REAL. - */ - public static final int REAL = SQL_REAL; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * REF. - * - * @since JDK 1.2 - */ - public static final int REF = 2006; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * REF_CURSOR. - * - * @since JDK 1.8 - */ - public static final int REF_CURSOR = 2012; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * SMALLINT. - */ - public static final int SMALLINT = SQL_SMALLINT; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * STRUCT. - * - * @since JDK 1.2 - */ - public static final int STRUCT = 2002; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TIME. - */ - public static final int TIME = SQL_TIME; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TIME_WITH_TIMEZONE . - * - * @since JDK 1.8 - */ - public static final int TIME_WITH_TIMEZONE = 2013; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TIMESTAMP. - */ - public static final int TIMESTAMP = SQL_TIMESTAMP; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TIMESTAMP_WITH_TIMEZONE . - * - * @since JDK 1.8 - */ - public static final int TIMESTAMP_WITH_TIMEZONE = 2014; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TINYINT. - */ - public static final int TINYINT = -6; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * VARBINARY. - */ - public static final int VARBINARY = -3; - - /** - *

    The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * VARCHAR. - */ - public static final int VARCHAR = SQL_VARCHAR; - -// /** -// *

    The constant in the Java programming language, sometimes referred -// * to as a type code, that identifies the recent SQL 2003 SQL type -// * XML. -// * -// * @since SQL 2003 -// * @deprecated -// * @see #SQLXML -// */ -// public static final int XML = 137; - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type ROWID - * - * @since JDK 1.6, HSQLDB 1.8.x - * - */ - public static final int ROWID = 2008; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type NCHAR - * - * @since JDK 1.6, HSQLDB 1.8.x - */ - public static final int NCHAR = -8; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type NVARCHAR. - * - * @since JDK 1.6, HSQLDB 1.8.x - */ - public static final int NVARCHAR = -9; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type LONGNVARCHAR. - * - * @since JDK 1.6, HSQLDB 1.8.x - */ - public static final int LONGNVARCHAR = -10; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type NCLOB. - * - * @since JDK 1.6, HSQLDB 1.8.x - */ - public static final int NCLOB = 2007; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type XML. - * - * @since JDK 1.6, HSQLDB 1.8.x - */ - public static final int SQLXML = 2009; - - //----------------------------- End JDBC 4.0 ------------------------------- - - /** - * The default HSQLODB type sub-identifier. This indicates that an - * HSQLDB type with this sub-type, if supported, is the very closest - * thing HSQLDB offers to the JDBC/SQL2003 type - */ - public static final int TYPE_SUB_DEFAULT = 1; - - /** - * Every (type,type-sub) combination known in the HSQLDB context. - * Not every combination need be supported as a table or procedure - * column type -- such determinations are handled in DITypeInfo. - */ - public static final int[][] ALL_TYPES = { - { - SQL_ARRAY, TYPE_SUB_DEFAULT - }, { - SQL_BIGINT, TYPE_SUB_DEFAULT - }, { - SQL_BINARY, TYPE_SUB_DEFAULT - }, { - SQL_VARBINARY, TYPE_SUB_DEFAULT - }, { - SQL_BLOB, TYPE_SUB_DEFAULT - }, { - SQL_BOOLEAN, TYPE_SUB_DEFAULT - }, { - SQL_CHAR, TYPE_SUB_DEFAULT - }, { - SQL_CLOB, TYPE_SUB_DEFAULT - }, { - DATALINK, TYPE_SUB_DEFAULT - }, { - SQL_DATE, TYPE_SUB_DEFAULT - }, { - SQL_DECIMAL, TYPE_SUB_DEFAULT - }, { - DISTINCT, TYPE_SUB_DEFAULT - }, { - SQL_DOUBLE, TYPE_SUB_DEFAULT - }, { - SQL_FLOAT, TYPE_SUB_DEFAULT - }, { - SQL_INTEGER, TYPE_SUB_DEFAULT - }, { - JAVA_OBJECT, TYPE_SUB_DEFAULT - }, { - SQL_NCHAR, TYPE_SUB_DEFAULT - }, { - NCLOB, TYPE_SUB_DEFAULT - }, { - SQL_ALL_TYPES, TYPE_SUB_DEFAULT - }, { - SQL_NUMERIC, TYPE_SUB_DEFAULT - }, { - SQL_NVARCHAR, TYPE_SUB_DEFAULT - }, { - OTHER, TYPE_SUB_DEFAULT - }, { - SQL_REAL, TYPE_SUB_DEFAULT - }, { - SQL_REF, TYPE_SUB_DEFAULT - }, { - ROWID, TYPE_SUB_DEFAULT - }, { - SQL_SMALLINT, TYPE_SUB_DEFAULT - }, { - STRUCT, TYPE_SUB_DEFAULT - }, { - SQL_TIME, TYPE_SUB_DEFAULT - }, { - SQL_TIMESTAMP, TYPE_SUB_DEFAULT - }, { - TINYINT, TYPE_SUB_DEFAULT - }, { - SQL_VARCHAR, TYPE_SUB_DEFAULT - }, { - SQL_XML, TYPE_SUB_DEFAULT - } - }; - -// lookup for types - static final IntValueHashMap javaTypeNumbers; - -// campbell-burnet@users - We can't handle method invocations in -// Function.java whose number class is -// narrower than the corresponding internal -// wrapper - private static final HashSet illegalParameterClasses; - - static { - javaTypeNumbers = new IntValueHashMap(32); - - javaTypeNumbers.put("int", Types.SQL_INTEGER); - javaTypeNumbers.put("java.lang.Integer", Types.SQL_INTEGER); - javaTypeNumbers.put("double", Types.SQL_DOUBLE); - javaTypeNumbers.put("java.lang.Double", Types.SQL_DOUBLE); - javaTypeNumbers.put("java.lang.String", Types.SQL_VARCHAR); - javaTypeNumbers.put("java.lang.CharSequence", Types.SQL_VARCHAR); - javaTypeNumbers.put(DateClassName, Types.SQL_DATE); - javaTypeNumbers.put(TimeClassName, Types.SQL_TIME); - javaTypeNumbers.put(TimestampClassName, Types.SQL_TIMESTAMP); - javaTypeNumbers.put(BlobClassName, Types.SQL_BLOB); - javaTypeNumbers.put(ClobClassName, Types.SQL_CLOB); - javaTypeNumbers.put("java.util.Date", Types.SQL_DATE); - javaTypeNumbers.put(DecimalClassName, Types.SQL_DECIMAL); - javaTypeNumbers.put("boolean", Types.SQL_BOOLEAN); - javaTypeNumbers.put("java.lang.Boolean", Types.SQL_BOOLEAN); - javaTypeNumbers.put("byte", Types.TINYINT); - javaTypeNumbers.put("java.lang.Byte", Types.TINYINT); - javaTypeNumbers.put("short", Types.SQL_SMALLINT); - javaTypeNumbers.put("java.lang.Short", Types.SQL_SMALLINT); - javaTypeNumbers.put("long", Types.SQL_BIGINT); - javaTypeNumbers.put("java.lang.Long", Types.SQL_BIGINT); - javaTypeNumbers.put("[B", Types.SQL_VARBINARY); - javaTypeNumbers.put("java.lang.Object", Types.OTHER); - javaTypeNumbers.put("java.lang.Void", Types.SQL_ALL_TYPES); - javaTypeNumbers.put("java.util.UUID", Types.SQL_GUID); - javaTypeNumbers.put("java.time.LocalDate", Types.SQL_DATE); - javaTypeNumbers.put("java.time.LocalTime", Types.SQL_TIME); - javaTypeNumbers.put("java.time.LocalDateTime", Types.SQL_TIMESTAMP); - javaTypeNumbers.put("java.time.OffsetDateTime", - Types.SQL_TIMESTAMP_WITH_TIME_ZONE); - javaTypeNumbers.put("java.time.OffsetTime", - Types.SQL_TIME_WITH_TIME_ZONE); - javaTypeNumbers.put("java.time.Duration", Types.SQL_INTERVAL_SECOND); - javaTypeNumbers.put("java.time.Period", Types.SQL_INTERVAL_MONTH); - - illegalParameterClasses = new HashSet(); - - illegalParameterClasses.add(Byte.TYPE); - illegalParameterClasses.add(Short.TYPE); - illegalParameterClasses.add(Float.TYPE); - illegalParameterClasses.add(Byte.class); - illegalParameterClasses.add(Short.class); - illegalParameterClasses.add(Float.class); - - // - } - - /** - * Retrieves the type object corresponding to the class - * of an IN, IN OUT or OUT parameter or a return type.

    - * - * - * @param c a Class instance - * @return java.sql.Types int value - */ - public static Type getParameterSQLType(Class c) { - - String name; - int typeCode; - - if (c == null) { - throw Error.runtimeError(ErrorCode.U_S0500, "Types"); - } - - if (Void.TYPE.equals(c)) { - return Type.SQL_ALL_TYPES; - } - - name = c.getName(); - typeCode = javaTypeNumbers.get(name, Integer.MIN_VALUE); - - if (typeCode != Integer.MIN_VALUE) { - return Type.getDefaultTypeWithSize(typeCode); - } - - if (c.isArray()) { - Class c1 = c.getComponentType(); - - name = c1.getName(); - typeCode = javaTypeNumbers.get(name, Integer.MIN_VALUE); - - if (typeCode == Types.SQL_ALL_TYPES) { - return null; - } - - if (typeCode != Integer.MIN_VALUE) { - return Type.getDefaultTypeWithSize(typeCode); - } - - return null; - } - - if (name.equals("java.sql.Array")) { - return Type.getDefaultArrayType(Types.SQL_ALL_TYPES); - } - - return null; - } - - public static boolean acceptsZeroPrecision(int type) { - - switch (type) { - - case Types.SQL_TIME : - case Types.SQL_TIMESTAMP : - return true; - - default : - return false; - } - } - - public static boolean requiresPrecision(int type) { - - switch (type) { - - case Types.SQL_BIT_VARYING : - case Types.SQL_VARBINARY : - case Types.SQL_VARCHAR : - case Types.SQL_NVARCHAR : - return true; - - default : - return false; - } - } - - /** - * Types that accept precision params in column definition or casts. - */ - public static boolean acceptsPrecision(int type) { - - switch (type) { - - case Types.LONGVARCHAR : - case Types.LONGVARBINARY : - case Types.SQL_ARRAY : - case Types.SQL_BINARY : - case Types.SQL_BIT : - case Types.SQL_BIT_VARYING : - case Types.SQL_BLOB : - case Types.SQL_CHAR : - case Types.SQL_NCHAR : - case Types.SQL_CLOB : - case Types.NCLOB : - case Types.SQL_VARBINARY : - case Types.SQL_VARCHAR : - case Types.SQL_NVARCHAR : - case Types.VARCHAR_IGNORECASE : - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : - case Types.SQL_FLOAT : - case Types.SQL_TIME : - case Types.SQL_TIMESTAMP : - case Types.SQL_INTERVAL_YEAR : - case Types.SQL_INTERVAL_YEAR_TO_MONTH : - case Types.SQL_INTERVAL_MONTH : - case Types.SQL_INTERVAL_DAY : - case Types.SQL_INTERVAL_DAY_TO_HOUR : - case Types.SQL_INTERVAL_DAY_TO_MINUTE : - case Types.SQL_INTERVAL_DAY_TO_SECOND : - case Types.SQL_INTERVAL_HOUR : - case Types.SQL_INTERVAL_HOUR_TO_MINUTE : - case Types.SQL_INTERVAL_HOUR_TO_SECOND : - case Types.SQL_INTERVAL_MINUTE : - case Types.SQL_INTERVAL_MINUTE_TO_SECOND : - case Types.SQL_INTERVAL_SECOND : - return true; - - default : - return false; - } - } - - public static boolean acceptsScaleCreateParam(int type) { - - switch (type) { - - case Types.SQL_INTERVAL_SECOND : - return true; - - case Types.SQL_DECIMAL : - case Types.SQL_NUMERIC : - return true; - - default : - return false; - } - } - - /** - * A reasonable/customizable number to avoid the shortcomings/defects - * associated with doing a dynamic scan of results to determine - * the value. In practice, it turns out that single query yielding - * widely varying values for display size of CHAR and VARCHAR columns - * on repeated execution results in patently poor usability, as some fairly - * high-profile, otherwise "enterprise-quality" RAD tools depend on - * on the first value returned to lay out forms and limit the size of - * single line edit controls, set corresponding local datastore storage - * sizes, etc. In practice, It also turns out that many tools (due to - * the original lack of PreparedStatement.getMetaData() in JDK 1.1) emulate - * a SQL_DESCRIBE by executing a query hopefully guaranteed to return no - * or very few rows for example: select ... from ... where 1=0. - * Using the dynamic scan of 1.7.2 RC5 and previous, therefore, the - * minimum display size value (1) was often being generated during - * a tool's describe phase. Upon subsequent "real" retrievals, some - * tools complain that CHAR and VARCHAR result values exceeded the - * originally reported display size and refused to fetch further values. - */ - public static final int MAX_CHAR_OR_VARCHAR_DISPLAY_SIZE = - MAX_CHAR_OR_VARCHAR_DISPLAY_SIZE(); - - // So that the variable can be both public static final and - // customizable through system properties if required. - // - // 32766 (0x7ffe) seems to be a magic number over which several - // rather high-profile RAD tools start to have problems - // regarding layout and allocation stress. It is gently - // recommended that LONGVARCHAR be used for larger values in RAD - // tool layout & presentation use cases until such time as we provide - // true BLOB support (at which point, LONGVARCHAR will most likely become - // an alias for CLOB). - // - // Most GUI tools seem to handle LONGVARCHAR gracefully by: - // - // 1.) refusing to directly display such columns in graphical query results - // 2.) providing other means to retrieve and display such values - private static int MAX_CHAR_OR_VARCHAR_DISPLAY_SIZE() { - - try { - return Integer.getInteger( - HsqlDatabaseProperties.system_max_char_or_varchar_display_size, - 32766).intValue(); - } catch (SecurityException e) { - return 32766; - } - } - - public static boolean isSearchable(int type) { - - switch (type) { - - case Types.SQL_BLOB : - case Types.SQL_CLOB : - case Types.NCLOB : - case Types.JAVA_OBJECT : - case Types.STRUCT : - case Types.OTHER : - case Types.ROWID : - return false; - - case Types.SQL_ARRAY : - default : - return true; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/types/UserTypeModifier.java b/database/hsqldb/src/org/hsqldb/types/UserTypeModifier.java deleted file mode 100644 index 8ee3127e..00000000 --- a/database/hsqldb/src/org/hsqldb/types/UserTypeModifier.java +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.types; - -import org.hsqldb.Constraint; -import org.hsqldb.Expression; -import org.hsqldb.HsqlNameManager.HsqlName; -import org.hsqldb.SchemaObject; -import org.hsqldb.Session; -import org.hsqldb.Tokens; -import org.hsqldb.lib.ArrayUtil; -import org.hsqldb.lib.OrderedHashSet; -import org.hsqldb.rights.Grantee; - -/** - * Class for DOMAIN and DISTINCT objects.

    - * - * @author Fred Toussi (fredt@users dot sourceforge.net) - * @version 2.5.0 - * @since 1.9.0 - */ -public class UserTypeModifier { - - final HsqlName name; - final int schemaObjectType; - final Type dataType; - Constraint[] constraints = Constraint.emptyArray; - Expression defaultExpression; - boolean isNullable = true; - - public UserTypeModifier(HsqlName name, int type, Type dataType) { - - this.name = name; - this.schemaObjectType = type; - this.dataType = dataType; - } - - public int schemaObjectType() { - return schemaObjectType; - } - - public void addConstraint(Constraint c) { - - int position = constraints.length; - - constraints = (Constraint[]) ArrayUtil.resizeArray(constraints, - position + 1); - constraints[position] = c; - - setNotNull(); - } - - public void removeConstraint(String name) { - - for (int i = 0; i < constraints.length; i++) { - if (constraints[i].getName().name.equals(name)) { - constraints = - (Constraint[]) ArrayUtil.toAdjustedArray(constraints, - null, i, -1); - - break; - } - } - - setNotNull(); - } - - public Constraint getConstraint(String name) { - - for (int i = 0; i < constraints.length; i++) { - if (constraints[i].getName().name.equals(name)) { - return constraints[i]; - } - } - - return null; - } - - public Constraint[] getConstraints() { - return constraints; - } - - public boolean isNullable() { - return isNullable; - } - - public Expression getDefaultClause() { - return defaultExpression; - } - - public void setDefaultClause(Expression defaultExpression) { - this.defaultExpression = defaultExpression; - } - - public void removeDefaultClause() { - defaultExpression = null; - } - - private void setNotNull() { - - isNullable = true; - - for (int i = 0; i < constraints.length; i++) { - if (constraints[i].isNotNull()) { - isNullable = false; - - break; - } - } - } - - // interface specific methods - public int getType() { - return schemaObjectType; - } - - public HsqlName getName() { - return name; - } - - public HsqlName getSchemaName() { - return name.schema; - } - - public Grantee getOwner() { - return name.schema.owner; - } - - public OrderedHashSet getReferences() { - - OrderedHashSet set = new OrderedHashSet(); - - for (int i = 0; i < constraints.length; i++) { - OrderedHashSet subSet = constraints[i].getReferences(); - - if (subSet != null) { - set.addAll(subSet); - } - } - - Collation collation = dataType.getCollation(); - - if (collation != null && collation.isObjectCollation()) { - set.add(collation.getName()); - } - - return set; - } - - public final OrderedHashSet getComponents() { - - if (constraints == null) { - return null; - } - - OrderedHashSet set = new OrderedHashSet(); - - set.addAll(constraints); - - return set; - } - - public void compile(Session session) { - - for (int i = 0; i < constraints.length; i++) { - constraints[i].compile(session, null); - } - } - - public String getSQL() { - - StringBuilder sb = new StringBuilder(); - - if (schemaObjectType == SchemaObject.TYPE) { - sb.append(Tokens.T_CREATE).append(' ').append( - Tokens.T_TYPE).append(' '); - sb.append(name.getSchemaQualifiedStatementName()); - sb.append(' ').append(Tokens.T_AS).append(' '); - sb.append(dataType.getDefinition()); - - if (dataType.isCharacterType()) { - Collation collation = dataType.getCollation(); - - if (collation.isObjectCollation()) { - sb.append(' ').append(collation.getCollateSQL()); - } - } - } else { - sb.append(Tokens.T_CREATE).append(' ').append( - Tokens.T_DOMAIN).append(' '); - sb.append(name.getSchemaQualifiedStatementName()); - sb.append(' ').append(Tokens.T_AS).append(' '); - sb.append(dataType.getDefinition()); - - if (dataType.isCharacterType()) { - Collation collation = dataType.getCollation(); - - if (collation.isObjectCollation()) { - sb.append(' ').append(collation.getCollateSQL()); - } - } - - if (defaultExpression != null) { - sb.append(' ').append(Tokens.T_DEFAULT).append(' '); - sb.append(defaultExpression.getSQL()); - } - - for (int i = 0; i < constraints.length; i++) { - sb.append(' ').append(Tokens.T_CONSTRAINT).append(' '); - sb.append(constraints[i].getName().statementName).append(' '); - sb.append(Tokens.T_CHECK).append('(').append( - constraints[i].getCheckSQL()).append(')'); - } - } - - return sb.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/Bold.gif b/database/hsqldb/src/org/hsqldb/util/Bold.gif deleted file mode 100644 index 8941022d..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/Bold.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/CSVWriter.java b/database/hsqldb/src/org/hsqldb/util/CSVWriter.java deleted file mode 100644 index 4ad87a59..00000000 --- a/database/hsqldb/src/org/hsqldb/util/CSVWriter.java +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; - -/** - * helper class to write table data to a csv-file (comma separated values). - * the first line in file is a list of fieldnames, all following lines - * are data lines. - * a descptiontion of file format can be found on: http://www.wotsit.org/ - * usage: create a object using the constructor. call writeHeader - * for writing the filename header then add data with writeData. - * at the end close() closes the file. - * - *@author jeberle@users - */ -class CSVWriter { - - private String newline = System.getProperty("line.separator"); - private OutputStreamWriter writer = null; - private int nbrRows = 0; - - /** - * constructor. - * creates a csv file for writing data to it - * @param file the file to write data to - * @param encoding encoding to use or null (=defualt) - */ - public CSVWriter(File file, String encoding) throws IOException { - - if (encoding == null) { - encoding = System.getProperty("file.encoding"); - } - - FileOutputStream fout = new FileOutputStream(file); - - writer = new OutputStreamWriter(fout, encoding); - } - - /** - * writes the csv header (fieldnames). should be called after - * construction one time. - * @param header String[] with fieldnames - */ - public void writeHeader(String[] header) throws IOException { - - int nbrCols = header.length; - - doWriteData(header); - } - - /** - * writes a data-record to the file. note that data[] must have - * same number of elements as the header had. - * - * @param data data to write to csv-file - */ - public void writeData(String[] data) throws IOException { - doWriteData(data); - } - - /** - * closes the csv file. - */ - public void close() throws IOException { - this.writer.close(); - } - - private void doWriteData(String[] values) throws IOException { - - for (int i = 0; i < values.length; i++) { - if (i > 0) { - this.writer.write(";"); - } - - if (values[i] != null) { - this.writer.write("\""); - this.writer.write(this.toCsvValue(values[i])); - this.writer.write("\""); - } - } - - this.writer.write(newline); - - this.nbrRows++; - } - - private String toCsvValue(String str) { - - StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - - sb.append(c); - - switch (c) { - - case '"' : - sb.append('"'); - break; - } - } - - return sb.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/Clear.png b/database/hsqldb/src/org/hsqldb/util/Clear.png deleted file mode 100644 index 69bc8af2..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/Clear.png and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/Close.png b/database/hsqldb/src/org/hsqldb/util/Close.png deleted file mode 100644 index 4eefebee..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/Close.png and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/CodeSwitcher.java b/database/hsqldb/src/org/hsqldb/util/CodeSwitcher.java deleted file mode 100644 index 4bfa4848..00000000 --- a/database/hsqldb/src/org/hsqldb/util/CodeSwitcher.java +++ /dev/null @@ -1,519 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.LineNumberReader; -import java.util.ArrayList; - -// fredt@users 20020315 - patch 1.7.0 - minor fixes -// changed line separator to System based value -// moved the Profile class to org.hsqldb.test package -// fredt@users 20021020 - patch 1.7.1 - formatting fix -// avoid moving blank lines which would be interpreted as code change by CVS -// fredt@users 20021118 - patch 1.7.2 - no-change, no-save fix -// if the file contents do not change, do not save a new version of file -// fredt@users 20040322 - removed unused profiling code -// fredt@users 20080315 - added ifndef switch -// fredt@users 20190515 - enhancements - -/** - * Modifies the source code to support different JDK or profile settings. - *

    - * Usage: java CodeSwitcher paths|{--pathlist=listfile} [{+|-}label...] [+][-]
    - * If no labels are specified then all used
    - * labels in the source code are shown.
    - * Use +MODE to switch on the things labeld MODE
    - * Use -MODE to switch off the things labeld MODE
    - * Path: Any number of path or files may be
    - * specified. Use . for the current directory
    - * (including sub-directories).
    - * Example: java CodeSwitcher +JAVA2 .
    - * This example switches on code labeled JAVA2
    - * in all *.java files in the current directory
    - * and all subdirectories.
    - * java CodeSwitcher + .
    - * Adds test code to the code.
    - * java CodeSwitcher - .
    - * Removes test code from the code
    - * 
    - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.5.0 - * @since Hypersonic SQL - */ -public class CodeSwitcher { - - private static final String ls = System.getProperty("line.separator", - "\n"); - private ArrayList vList; - private ArrayList vSwitchOn; - private ArrayList vSwitchOff; - private ArrayList vSwitches; - private static final int MAX_LINELENGTH = 82; - - public static void main(String[] a) { - - CodeSwitcher s = new CodeSwitcher(); - - if (a.length == 0) { - showUsage(); - - return; - } - - File listFile = null; - File baseDir = null; - - for (int i = 0; i < a.length; i++) { - String p = a[i]; - - if (p.startsWith("+")) { - s.vSwitchOn.add(p.substring(1)); - } else if (p.startsWith("--basedir=")) { - baseDir = new File(p.substring("--basedir=".length())); - } else if (p.startsWith("--pathlist=")) { - listFile = new File(p.substring("--pathlist=".length())); - } else if (p.startsWith("-")) { - s.vSwitchOff.add(p.substring(1)); - } else { - s.addDir(p); - } - } - - if (baseDir != null) { - if (listFile == null) { - System.err.println( - "--basedir= setting ignored, since only used for list files"); - } else { - if (!baseDir.isDirectory()) { - System.err.println("Skipping listfile since basedir '" - + baseDir.getAbsolutePath() - + "' is not a directory"); - - listFile = null; - } - } - } - - if (listFile != null) { - try { - BufferedReader br = - new BufferedReader(new FileReader(listFile)); - String st, p; - int hashIndex; - File f; - - while ((st = br.readLine()) != null) { - hashIndex = st.indexOf('#'); - p = ((hashIndex > -1) ? st.substring(0, hashIndex) - : st).trim(); - - if (p.length() < 1) { - continue; - } - - f = (baseDir == null) ? (new File(p)) - : (new File(baseDir, p)); - - if (f.isFile()) { - s.addDir(f); - } else { - System.err.println("Skipping non-file '" + p.trim() - + "'"); - } - } - } catch (Exception e) { - System.err.println("Failed to read pathlist file '" - + listFile.getAbsolutePath() + "'"); - } - } - - if (s.size() < 1) { - printError("No path specified, or no specified paths qualify"); - showUsage(); - } - - s.process(); - - if (s.vSwitchOff.size() == 0 && s.vSwitchOn.size() == 0) { - s.printSwitches(); - } - } - - public int size() { - return (vList == null) ? 0 - : vList.size(); - } - - /** - * Method declaration - * - */ - static void showUsage() { - - System.out.print( - "Usage: java CodeSwitcher paths|{--pathlist=listfile} " - + "[{+|-}label...] [+][-]\n" - + "If no labels are specified then all used\n" - + "labels in the source code are shown.\n" - + "Use +MODE to switch on the things labeld MODE\n" - + "Use -MODE to switch off the things labeld MODE\n" - + "Path: Any number of path or files may be\n" - + "specified. Use . for the current directory\n" - + "(including sub-directories).\n" - + "Example: java CodeSwitcher +JAVA2 .\n" - + "This example switches on code labeled JAVA2\n" - + "in all *.java files in the current directory\n" - + "and all subdirectories.\n"); - } - - /** - * Constructor declaration - * - */ - CodeSwitcher() { - - vList = new ArrayList(); - vSwitchOn = new ArrayList(); - vSwitchOff = new ArrayList(); - vSwitches = new ArrayList(); - } - - /** - * Method declaration - * - */ - void process() { - - int len = vList.size(); - - for (int i = 0; i < len; i++) { - System.out.print("."); - - String file = vList.get(i); - - if (!processFile(file)) { - System.out.println("in file " + file + " !"); - } - } - - System.out.println(); - } - - /** - * Method declaration - * - */ - void printSwitches() { - - System.out.println("Used labels:"); - - for (int i = 0; i < vSwitches.size(); i++) { - System.out.println(vSwitches.get(i)); - } - } - - void addDir(String path) { - addDir(new File(path)); - } - - void addDir(File f) { - - if (f.isFile() && f.getName().endsWith(".java")) { - vList.add(f.getPath()); - } else if (f.isDirectory()) { - File[] list = f.listFiles(); - - if (list == null) { - return; - } - - for (int i = 0; i < list.length; i++) { - addDir(list[i]); - } - } - } - - boolean processFile(String name) { - - File f = new File(name); - File fnew = new File(name + ".new"); - int state = 0; // 0=normal 1=inside_if 2=inside_else - boolean switchoff = false; - boolean working = false; - - try { - ArrayList v = getFileLines(f); - ArrayList v1 = new ArrayList(v.size()); - - for (int i = 0; i < v.size(); i++) { - v1.add(v.get(i)); - } - - for (int i = 0; i < v.size(); i++) { - String line = v.get(i); - - if (line == null) { - break; - } - - if (working) { - if (line.equals("/*") || line.equals("*/")) { - v.remove(i--); - - continue; - } - } - - if (line.startsWith("//#")) { - if (line.startsWith("//#ifdef ")) { - if (state != 0) { - printError("'#ifdef' not allowed inside '#ifdef' at line " + i); - - return false; - } - - state = 1; - - String s = line.substring(9); - - if (vSwitchOn.contains(s)) { - working = true; - switchoff = false; - } else if (vSwitchOff.contains(s)) { - working = true; - - v.add(++i, "/*"); - - switchoff = true; - } - - if (!vSwitches.contains(s)) { - vSwitches.add(s); - } - } else if (line.startsWith("//#ifndef ")) { - if (state != 0) { - printError( - "'#ifndef' not allowed inside '#ifdef'"); - - return false; - } - - state = 1; - - String s = line.substring(10); - - if (vSwitchOff.contains(s)) { - working = true; - switchoff = false; - } else if (vSwitchOn.contains(s)) { - working = true; - - v.add(++i, "/*"); - - switchoff = true; - } - - if (!vSwitches.contains(s)) { - vSwitches.add(s); - } - } else if (line.startsWith("//#else")) { - if (state != 1) { - printError("'#else' without '#ifdef'"); - - return false; - } - - state = 2; - - if (!working) {} - else if (switchoff) { - if (v.get(i - 1).equals("")) { - v.add(i - 1, "*/"); - - i++; - } else { - v.add(i++, "*/"); - } - - switchoff = false; - } else { - v.add(++i, "/*"); - - switchoff = true; - } - } else if (line.startsWith("//#endif")) { - if (state == 0) { - printError("'#endif' without '#ifdef'"); - - return false; - } - - state = 0; - - if (working && switchoff) { - if (v.get(i - 1).equals("")) { - v.add(i - 1, "*/"); - - i++; - } else { - v.add(i++, "*/"); - } - } - - working = false; - } else {} - } - } - - if (state != 0) { - printError("'#endif' missing"); - - return false; - } - - boolean filechanged = false; - - for (int i = 0; i < v.size(); i++) { - if (!v1.get(i).equals(v.get(i))) { - filechanged = true; - - break; - } - } - - if (!filechanged) { - return true; - } - - writeFileLines(v, fnew); - - File fbak = new File(name + ".bak"); - - fbak.delete(); - f.renameTo(fbak); - - File fcopy = new File(name); - - fnew.renameTo(fcopy); - fbak.delete(); - - return true; - } catch (Exception e) { - printError(e.toString()); - - return false; - } - } - - static ArrayList getFileLines(File f) throws IOException { - - LineNumberReader read = new LineNumberReader(new FileReader(f)); - ArrayList v = new ArrayList(); - - for (;;) { - String line = read.readLine(); - - if (line == null) { - break; - } - - v.add(line); - } - - read.close(); - - return v; - } - - static void writeFileLines(ArrayList v, File f) throws IOException { - - FileWriter write = new FileWriter(f); - - for (int i = 0; i < v.size(); i++) { - write.write((String) v.get(i)); - write.write(ls); - } - - write.flush(); - write.close(); - } - - static void printError(String error) { - System.out.println(); - System.out.println("ERROR: " + error); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/Colors.png b/database/hsqldb/src/org/hsqldb/util/Colors.png deleted file mode 100644 index 08ecfd16..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/Colors.png and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/CommonSwing.java b/database/hsqldb/src/org/hsqldb/util/CommonSwing.java deleted file mode 100644 index ee8f7391..00000000 --- a/database/hsqldb/src/org/hsqldb/util/CommonSwing.java +++ /dev/null @@ -1,240 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.awt.Dimension; -import java.awt.Image; -import java.awt.Toolkit; -import javax.swing.ImageIcon; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; - -// sqlbob@users 20020407 - patch 1.7.0 - reengineering -// weconsultants@users 20041109 - patch 1.8.0 - enhancements: -// Added Methods: setSwingLAF(), LookAndFeelInfo(), setFramePositon() -// errorMessage(String errorMessage), -// errorMessage(Exception exceptionMsg, -// Added: Ability to switch the current LAF while runing (Native,Java or Motif) - -/** - * Common code in the Swing versions of DatabaseManager and Tranfer - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @version 1.7.2 - * @since 1.7.0 - */ -final class CommonSwing { - - static final String messagerHeader = - "Database Manager Swing Error"; - static final String Native = "Native"; - static final String Java = "Java"; - static final String Motif = "Motif"; - static String plaf = "plaf"; - static String GTK = "GTK"; - - // (ulrivo): An actual Image. - static Image getIcon(String target) { - - if (target.equalsIgnoreCase("SystemCursor")) { - return (new ImageIcon( - CommonSwing.class.getResource("Hourglass.gif")).getImage()); - } else if (target.equalsIgnoreCase("Frame")) { - return (new ImageIcon( - CommonSwing.class.getResource("hsqldb.png")).getImage()); - } else if (target.equalsIgnoreCase("Execute")) { - return (new ImageIcon( - CommonSwing.class.getResource("run_exc.gif")).getImage()); - } else if (target.equalsIgnoreCase("StatusRunning")) { - return (new ImageIcon( - CommonSwing.class.getResource("RedCircle.gif")).getImage()); - } else if (target.equalsIgnoreCase("StatusReady")) { - return (new ImageIcon( - CommonSwing.class.getResource("GreenCircle.gif")).getImage()); - } else if (target.equalsIgnoreCase("Clear")) { - return (new ImageIcon( - CommonSwing.class.getResource("Clear.png")).getImage()); - } else if (target.equalsIgnoreCase("Problem")) { - return (new ImageIcon( - CommonSwing.class.getResource("problems.gif")).getImage()); - } else if (target.equalsIgnoreCase("BoldFont")) { - return (new ImageIcon( - CommonSwing.class.getResource("Bold.gif")).getImage()); - } else if (target.equalsIgnoreCase("ItalicFont")) { - return (new ImageIcon( - CommonSwing.class.getResource("Italic.gif")).getImage()); - } else if (target.equalsIgnoreCase("ColorSelection")) { - return (new ImageIcon( - CommonSwing.class.getResource("Colors.png")).getImage()); - } else if (target.equalsIgnoreCase("Close")) { - return (new ImageIcon( - CommonSwing.class.getResource("Close.png")).getImage()); - } else { - return (null); - } - } - - // (weconsultants@users: Callable errorMessage method - static void errorMessage(String errorMessage) { - - /* - * Display Jpanel Error messages any text Errors. Overloads - * errorMessage(Exception exceptionMsg) - */ - Object[] options = { "OK" }; - - JOptionPane.showOptionDialog(null, errorMessage, messagerHeader, - JOptionPane.DEFAULT_OPTION, - JOptionPane.WARNING_MESSAGE, null, - options, options[0]); - - // DatabaseManagerSwing.StatusMessage(READY_STATUS); - } - - public static void errorMessage(Exception exceptionMsg) { - errorMessage(exceptionMsg, false); - } - - // (weconsultants@users: Callable errorMessage method - public static void errorMessage(Exception exceptionMsg, boolean quiet) { - - /* - * Display Jpanel Error messages any SQL Errors. Overloads - * errorMessage(String e) - */ - Object[] options = { "OK", }; - - JOptionPane.showOptionDialog(null, exceptionMsg, messagerHeader, - JOptionPane.DEFAULT_OPTION, - JOptionPane.ERROR_MESSAGE, null, options, - options[0]); - - if (!quiet) { - exceptionMsg.printStackTrace(); - } - - // DatabaseManagerSwing.StatusMessage(READY_STATUS); - } - - // (weconsultants@users: Callable setFramePositon method - static void setFramePositon(JFrame inTargetFrame) { - - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension size = inTargetFrame.getSize(); - - // (ulrivo): full size on screen with less than 640 width - if (d.width >= 640) { - inTargetFrame.setLocation((d.width - size.width) / 2, - (d.height - size.height) / 2); - } else { - inTargetFrame.setLocation(0, 0); - inTargetFrame.setSize(d); - } - } - -// (weconsultants@users: Commented out, Not need now. Was not being called anyway.. Could delete? -// static void setDefaultColor() { -// -// Color hsqlBlue = new Color(102, 153, 204); -// Color hsqlGreen = new Color(153, 204, 204); -// UIDefaults d = UIManager.getLookAndFeelDefaults(); -// -// d.put("MenuBar.background", SystemColor.control); -// d.put("Menu.background", SystemColor.control); -// d.put("Menu.selectionBackground", hsqlBlue); -// d.put("MenuItem.background", SystemColor.menu); -// d.put("MenuItem.selectionBackground", hsqlBlue); -// d.put("Separator.foreground", SystemColor.controlDkShadow); -// d.put("Button.background", SystemColor.control); -// d.put("CheckBox.background", SystemColor.control); -// d.put("Label.background", SystemColor.control); -// d.put("Label.foreground", Color.black); -// d.put("Panel.background", SystemColor.control); -// d.put("PasswordField.selectionBackground", hsqlGreen); -// d.put("PasswordField.background", SystemColor.white); -// d.put("TextArea.selectionBackground", hsqlGreen); -// d.put("TextField.background", SystemColor.white); -// d.put("TextField.selectionBackground", hsqlGreen); -// d.put("TextField.background", SystemColor.white); -// d.put("ScrollBar.background", SystemColor.controlHighlight); -// d.put("ScrollBar.foreground", SystemColor.control); -// d.put("ScrollBar.track", SystemColor.controlHighlight); -// d.put("ScrollBar.trackHighlight", SystemColor.controlDkShadow); -// d.put("ScrollBar.thumb", SystemColor.control); -// d.put("ScrollBar.thumbHighlight", SystemColor.controlHighlight); -// d.put("ScrollBar.thumbDarkShadow", SystemColor.controlDkShadow); -// d.put("ScrollBar.thumbLightShadow", SystemColor.controlShadow); -// d.put("ComboBox.background", SystemColor.control); -// d.put("ComboBox.selectionBackground", hsqlBlue); -// d.put("Table.background", SystemColor.white); -// d.put("Table.selectionBackground", hsqlBlue); -// d.put("TableHeader.background", SystemColor.control); -// -// // This doesn't seem to work. -// d.put("SplitPane.background", SystemColor.control); -// d.put("Tree.selectionBackground", hsqlBlue); -// d.put("List.selectionBackground", hsqlBlue); -// } - // (weconsultants@users: Callable setSwingLAF method for changing LAF - static void setSwingLAF(java.awt.Component comp, String targetTheme) { - - try { - if (targetTheme.equalsIgnoreCase(Native)) { - UIManager.setLookAndFeel( - UIManager.getSystemLookAndFeelClassName()); - } else if (targetTheme.equalsIgnoreCase(Java)) { - UIManager.setLookAndFeel( - UIManager.getCrossPlatformLookAndFeelClassName()); - } else if (targetTheme.equalsIgnoreCase(Motif)) { - UIManager.setLookAndFeel( - "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); - } - -// if (targetTheme.equalsIgnoreCase(plaf)){ -// UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); -// } -// -// if (targetTheme.equalsIgnoreCase(GTK)){ -// UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); -// } - SwingUtilities.updateComponentTreeUI(comp); - - if (comp instanceof java.awt.Frame) { - ((java.awt.Frame) comp).pack(); - } - } catch (Exception e) { - errorMessage(e); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/ConnectionDialog.java b/database/hsqldb/src/org/hsqldb/util/ConnectionDialog.java deleted file mode 100644 index 8c98f7f5..00000000 --- a/database/hsqldb/src/org/hsqldb/util/ConnectionDialog.java +++ /dev/null @@ -1,342 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.util.Enumeration; -import java.util.Hashtable; - -import java.awt.BorderLayout; -import java.awt.Button; -import java.awt.Choice; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.GridLayout; -import java.awt.Label; -import java.awt.Panel; -import java.awt.SystemColor; -import java.awt.TextField; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -// sqlbob@users 20020325 - patch 1.7.0 - enhancements -// sqlbob@users 20020407 - patch 1.7.0 - reengineering -// fredt@users - 20040508 - modified patch by lonbinder@users for saving settings - -/** - * Opens a connection to a database - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.5.0 - * @since Hypersonic SQL - */ -class ConnectionDialog extends Dialog implements ActionListener, ItemListener { - - protected Connection mConnection; - protected TextField mName, mDriver, mURL, mUser, mPassword; - protected Label mError; - private String[][] connTypes; - private Hashtable settings; - private Choice types, recent; - - public static Connection createConnection(String driver, String url, - String user, String password) throws Exception { - - Class.forName(driver); - - return DriverManager.getConnection(url, user, password); - } - - ConnectionDialog(Frame owner, String title) { - super(owner, title, true); - } - - private void create() { - - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - - setLayout(new BorderLayout()); - - Panel p = new Panel(new BorderLayout()); - Panel pLabel; - Panel pText; - Panel pButton; - Panel pClearButton; - - // (ulrivo): full size on screen with less than 640 width - if (d.width >= 640) { - pLabel = new Panel(new GridLayout(8, 1, 10, 10)); - pText = new Panel(new GridLayout(8, 1, 10, 10)); - pButton = new Panel(new GridLayout(1, 2, 10, 10)); - pClearButton = new Panel(new GridLayout(8, 1, 10, 10)); - } else { - pLabel = new Panel(new GridLayout(8, 1)); - pText = new Panel(new GridLayout(8, 1)); - pButton = new Panel(new GridLayout(1, 2)); - pClearButton = new Panel(new GridLayout(8, 1)); - } - - p.add("West", pLabel); - p.add("Center", pText); - p.add("South", pButton); - p.add("North", createLabel("")); - p.add("East", pClearButton); - p.setBackground(SystemColor.control); - pText.setBackground(SystemColor.control); - pLabel.setBackground(SystemColor.control); - pButton.setBackground(SystemColor.control); - pLabel.add(createLabel("Recent:")); - - recent = new Choice(); - - try { - settings = ConnectionDialogCommon.loadRecentConnectionSettings(); - } catch (java.io.IOException ioe) { - ioe.printStackTrace(); - } - - recent.add(ConnectionDialogCommon.emptySettingName); - - Enumeration en = settings.elements(); - - while (en.hasMoreElements()) { - recent.add(((ConnectionSetting) en.nextElement()).getName()); - } - - recent.addItemListener(new ItemListener() { - - public void itemStateChanged(ItemEvent e) { - - String s = (String) e.getItem(); - ConnectionSetting setting = - (ConnectionSetting) settings.get(s); - - if (setting != null) { - mName.setText(setting.getName()); - mDriver.setText(setting.getDriver()); - mURL.setText(setting.getUrl()); - mUser.setText(setting.getUser()); - mPassword.setText(setting.getPassword()); - } - } - }); - pText.add(recent); - - Button b; - - b = new Button("Clr"); - - b.setActionCommand("Clear"); - b.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - - ConnectionDialogCommon.deleteRecentConnectionSettings(); - - settings = new Hashtable(); - - recent.removeAll(); - recent.add(ConnectionDialogCommon.emptySettingName); - mName.setText(null); - } - }); - pClearButton.add(b); - pLabel.add(createLabel("Setting Name:")); - - mName = new TextField(""); - - pText.add(mName); - pLabel.add(createLabel("Type:")); - - types = new Choice(); - connTypes = ConnectionDialogCommon.getTypes(); - - for (int i = 0; i < connTypes.length; i++) { - types.add(connTypes[i][0]); - } - - types.addItemListener(this); - pText.add(types); - pLabel.add(createLabel("Driver:")); - - mDriver = new TextField(connTypes[0][1]); - - pText.add(mDriver); - pLabel.add(createLabel("URL:")); - - mURL = new TextField(connTypes[0][2]); - - mURL.addActionListener(this); - pText.add(mURL); - pLabel.add(createLabel("User:")); - - mUser = new TextField("SA"); - - mUser.addActionListener(this); - pText.add(mUser); - pLabel.add(createLabel("Password:")); - - mPassword = new TextField(""); - - mPassword.addActionListener(this); - mPassword.setEchoChar('*'); - pText.add(mPassword); - - b = new Button("Ok"); - - b.setActionCommand("ConnectOk"); - b.addActionListener(this); - pButton.add(b); - - b = new Button("Cancel"); - - b.setActionCommand("ConnectCancel"); - b.addActionListener(this); - pButton.add(b); - add("East", createLabel("")); - add("West", createLabel("")); - - mError = new Label(""); - - Panel pMessage = createBorderPanel(mError); - - add("South", pMessage); - add("North", createLabel("")); - add("Center", p); - doLayout(); - pack(); - - Dimension size = getSize(); - - // (ulrivo): full size on screen with less than 640 width - if (d.width >= 640) { - setLocation((d.width - size.width) / 2, - (d.height - size.height) / 2); - } else { - setLocation(0, 0); - setSize(d); - } - - setVisible(true); - } - - public static Connection createConnection(Frame owner, String title) { - - ConnectionDialog dialog = new ConnectionDialog(owner, title); - - dialog.create(); - - return dialog.mConnection; - } - - protected static Label createLabel(String s) { - - Label l = new Label(s); - - l.setBackground(SystemColor.control); - - return l; - } - - protected static Panel createBorderPanel(Component center) { - - Panel p = new Panel(); - - p.setBackground(SystemColor.control); - p.setLayout(new BorderLayout()); - p.add("Center", center); - p.add("North", createLabel("")); - p.add("South", createLabel("")); - p.add("East", createLabel("")); - p.add("West", createLabel("")); - p.setBackground(SystemColor.control); - - return p; - } - - public void actionPerformed(ActionEvent ev) { - - String s = ev.getActionCommand(); - - if (s.equals("ConnectOk") || (ev.getSource() instanceof TextField)) { - try { - if (mURL.getText().indexOf('\u00AB') >= 0) { - throw new Exception("please specify db path"); - } - - mConnection = createConnection(mDriver.getText(), - mURL.getText(), - mUser.getText(), - mPassword.getText()); - - if (mName.getText() != null - && mName.getText().trim().length() != 0) { - ConnectionSetting newSetting = - new ConnectionSetting(mName.getText(), - mDriver.getText(), - mURL.getText(), mUser.getText(), - mPassword.getText()); - - ConnectionDialogCommon.addToRecentConnectionSettings( - settings, newSetting); - } - - dispose(); - } catch (java.io.IOException ioe) { - dispose(); - } catch (Exception e) { - e.printStackTrace(); - mError.setText(e.toString()); - } - } else if (s.equals("ConnectCancel")) { - dispose(); - } - } - - public void itemStateChanged(ItemEvent e) { - - String s = (String) e.getItem(); - - for (int i = 0; i < connTypes.length; i++) { - if (s.equals(connTypes[i][0])) { - mDriver.setText(connTypes[i][1]); - mURL.setText(connTypes[i][2]); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/ConnectionDialogCommon.java b/database/hsqldb/src/org/hsqldb/util/ConnectionDialogCommon.java deleted file mode 100644 index edcaad1f..00000000 --- a/database/hsqldb/src/org/hsqldb/util/ConnectionDialogCommon.java +++ /dev/null @@ -1,324 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.Enumeration; -import java.util.Hashtable; - -// sqlbob@users 20020407 - patch 1.7.0 - reengineering -// fredt@users - 20040508 - modified patch by lonbinder@users for saving settings -// weconsultants@users - 20041114 - patch 1.8.0 - Added MySQL Connector/J jbcDriver and granulated imports - -/** - * Common code in the Swing and AWT versions of ConnectionDialog - * - * New class based on Hypersonic original - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.7.0 - * @since 1.7.0 - */ -final class ConnectionDialogCommon { - - private static String[][] connTypes; - private static final String[][] sJDBCTypes = { - { - "HSQL Database Engine In-Memory", "org.hsqldb.jdbc.JDBCDriver", - "jdbc:hsqldb:mem:." - }, { - "HSQL Database Engine Standalone", "org.hsqldb.jdbc.JDBCDriver", - "jdbc:hsqldb:file:\u00ABdatabase/path?\u00BB" - }, { - "HSQL Database Engine Server", "org.hsqldb.jdbc.JDBCDriver", - "jdbc:hsqldb:hsql://localhost/" - }, { - "HSQL Database Engine WebServer", "org.hsqldb.jdbc.JDBCDriver", - "jdbc:hsqldb:http://\u00ABhostname/?\u00BB" - }, { - "JDBC-ODBC Bridge from Sun", "sun.jdbc.odbc.JdbcOdbcDriver", - "jdbc:odbc:\u00ABdatabase?\u00BB" - }, { - "Cloudscape RMI", "RmiJdbc.RJDriver", - "jdbc:rmi://\u00ABhost?\u00BB:1099/jdbc:cloudscape:" - + "\u00ABdatabase?\u00BB;create=true" - }, { - "IBM DB2", "COM.ibm.db2.jdbc.app.DB2Driver", - "jdbc:db2:\u00ABdatabase?\u00BB" - }, { - "IBM DB2 (thin)", "COM.ibm.db2.jdbc.net.DB2Driver", - "jdbc:db2://\u00ABhost?\u00BB:6789/\u00ABdatabase?\u00BB" - }, { - "Informix", "com.informix.jdbc.IfxDriver", - "jdbc:informix-sqli://\u00ABhost?\u00BB:1533/\u00ABdatabase?\u00BB:" - + "INFORMIXSERVER=\u00ABserver?\u00BB" - }, { - "InstantDb", "jdbc.idbDriver", "jdbc:idb:\u00ABdatabase?\u00BB.prp" - }, { - "MySQL Connector/J", "com.mysql.jdbc.Driver", - "jdbc:mysql://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB" - }, { - "MM.MySQL", "org.gjt.mm.mysql.Driver", - "jdbc:mysql://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB" - }, { - "Oracle", "oracle.jdbc.driver.OracleDriver", - "jdbc:oracle:oci8:@\u00ABdatabase?\u00BB" - }, { - "Oracle (thin)", "oracle.jdbc.driver.OracleDriver", - "jdbc:oracle:thin:@\u00ABhost?\u00BB:1521:\u00ABdatabase?\u00BB" - }, { - "PointBase", "com.pointbase.jdbc.jdbcUniversalDriver", - "jdbc:pointbase://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB" - }, { - "PostgreSQL", "org.postgresql.Driver", - "jdbc:postgresql://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB" - }, { - "PostgreSQL v6.5", "postgresql.Driver", - "jdbc:postgresql://\u00ABhost?\u00BB/\u00ABdatabase?\u00BB" - } - }; - - static String[][] getTypes() { - - return sJDBCTypes; -/* - - if (connTypes == null) { - - - // Pluggable connection types: - Vector plugTypes = new Vector(); - - try { - plugTypes = (Vector) Class.forName( - System.getProperty( - "org.hsqldb.util.ConnectionTypeClass")).newInstance(); - } catch (Exception e) { - ; - } - - connTypes = - new String[(plugTypes.size() / 3) + sJDBCTypes.length][3]; - - int i = 0; - - for (int j = 0; j < plugTypes.size(); i++) { - connTypes[i] = new String[3]; - connTypes[i][0] = plugTypes.elementAt(j++).toString(); - connTypes[i][1] = plugTypes.elementAt(j++).toString(); - connTypes[i][2] = plugTypes.elementAt(j++).toString(); - } - - for (int j = 0; j < sJDBCTypes.length; i++, j++) { - connTypes[i] = new String[3]; - connTypes[i][0] = sJDBCTypes[j][0]; - connTypes[i][1] = sJDBCTypes[j][1]; - connTypes[i][2] = sJDBCTypes[j][2]; - } - } - - return (connTypes); - */ - } - - private static final String fileName = "hsqlprefs.dat"; - private static File recentSettings = null; - - static synchronized Hashtable loadRecentConnectionSettings() - throws IOException { - - Hashtable list = new Hashtable(); - - try { - if (recentSettings == null) { - setHomeDir(); - - if (homedir == null) { - return list; - } - - recentSettings = new File(homedir, fileName); - - if (!recentSettings.exists()) { - recentSettings.createNewFile(); - - return list; - } - } - } catch (Throwable e) { - return list; - } - - FileInputStream in = null; - ObjectInputStream objStream = null; - - try { - in = new FileInputStream(recentSettings); - objStream = new ObjectInputStream(in); - - list.clear(); - - while (true) { - ConnectionSetting setting = - (ConnectionSetting) objStream.readObject(); - - if (!emptySettingName.equals(setting.getName())) { -/* - if (setting.getName().contains("reject")) - continue; -*/ - list.put(setting.getName(), setting); - } - } - } catch (EOFException eof) { - - // reached end of file -- this is not clean but it works - } catch (ClassNotFoundException cnfe) { - throw new IOException("Unrecognized class type " - + cnfe.getMessage(), cnfe); - } catch (ClassCastException cce) { - throw new IOException("Unrecognized class type " - + cce.getMessage(), cce); - } catch (Throwable t) {} - finally { - if (objStream != null) { - objStream.close(); - } - - if (in != null) { - in.close(); - } - } - - return list; - } - - static String emptySettingName = "Recent settings..."; - - /** - * Adds the new settings name if it does not nexist, or overwrites the old one. - */ - static void addToRecentConnectionSettings(Hashtable settings, - ConnectionSetting newSetting) { - settings.put(newSetting.getName(), newSetting); - ConnectionDialogCommon.storeRecentConnectionSettings(settings); - } - - /** - * Here's a non-secure method of storing recent connection settings. - * - * @param settings ConnectionSetting[] - */ - private static void storeRecentConnectionSettings(Hashtable settings) { - - try { - if (recentSettings == null) { - setHomeDir(); - - if (homedir == null) { - return; - } - - recentSettings = new File(homedir, fileName); - - recentSettings.renameTo(new File(homedir, fileName + ".old")); - - if (!recentSettings.exists()) { - -// recentSettings.createNewFile(); - } - } - - if (settings == null || settings.size() == 0) { - return; - } - - // setup a stream to a physical file on the filesystem - FileOutputStream out = new FileOutputStream(recentSettings); - ObjectOutputStream objStream = new ObjectOutputStream(out); - Enumeration en = settings.elements(); - - while (en.hasMoreElements()) { - objStream.writeObject(en.nextElement()); - } - - objStream.flush(); - objStream.close(); - out.close(); - } catch (Throwable t) {} - } - - /** - * Removes the recent connection settings file store. - */ - static void deleteRecentConnectionSettings() { - - try { - if (recentSettings == null) { - setHomeDir(); - - if (homedir == null) { - return; - } - - recentSettings = new File(homedir, fileName); - } - - if (!recentSettings.exists()) { - recentSettings = null; - - return; - } - - File backup = new File(homedir, fileName + ".backup"); - - recentSettings.renameTo(backup); - - recentSettings = null; - } catch (Throwable t) {} - } - - private static String homedir = null; - - public static void setHomeDir() { - - if (homedir == null) { - homedir = System.getProperty("user.home"); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/ConnectionDialogSwing.java b/database/hsqldb/src/org/hsqldb/util/ConnectionDialogSwing.java deleted file mode 100644 index 73ccd47e..00000000 --- a/database/hsqldb/src/org/hsqldb/util/ConnectionDialogSwing.java +++ /dev/null @@ -1,392 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Vector; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import javax.swing.Box; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JPasswordField; -import javax.swing.JTextField; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; - -// sqlbob@users 20020325 - patch 1.7.0 - enhancements -// sqlbob@users 20020407 - patch 1.7.0 - reengineering -// weconsultants@users 20041109 - patch 1.8.0 - enhancements: -// Added CommonSwing.errorMessage() to handle error messages -// for errors so eliminated the mError JLable field and Status HorizontalBox. -// Changed dispose on cancel to exit. If "Dup", "Restore" or Transer" needed ust -// Press Conform toprogramming standards -// Added spaces to "OK" button to make same size buttons -// Added ":" to all labels as in databaseManager.java -// Added: Added code from DatabaseManager to store connection settings -// fredt@users - version 2.50 - removed deprecated - -/** - * Opens a connection to a database - * - * @author dmarshall@users - * @version 2.5.0 - * @since 1.7.0 - */ -class ConnectionDialogSwing extends JDialog -implements ActionListener, ItemListener { - - /** - * Comment for serialVersionUID - */ - private static final long serialVersionUID = 1L; - private Connection mConnection; - private JTextField mName, mDriver, mURL, mUser; - private JPasswordField mPassword; - private String[][] connTypes; - private Hashtable settings; - private JComboBox mSettingName = - new JComboBox(loadRecentConnectionSettings()); - private static ConnectionSetting currentConnectionSetting = null; - - public static void setConnectionSetting( - ConnectionSetting connectionSetting) { - currentConnectionSetting = connectionSetting; - } - - public static Connection createConnection(String driver, String url, - String user, String password) throws Exception { - - Class.forName(driver); - - return DriverManager.getConnection(url, user, password); - } - - ConnectionDialogSwing(JFrame owner, String title) { - super(owner, title, true); - } - - private void create() { - - Box main = Box.createHorizontalBox(); - Box labels = Box.createVerticalBox(); - Box controls = Box.createVerticalBox(); - Box buttons = Box.createHorizontalBox(); - Box whole = Box.createVerticalBox(); - - // (weconsultants@users) New code - Box extra = Box.createHorizontalBox(); - - main.add(Box.createHorizontalStrut(10)); - main.add(Box.createHorizontalGlue()); - main.add(labels); - main.add(Box.createHorizontalStrut(10)); - main.add(Box.createHorizontalGlue()); - main.add(controls); - main.add(Box.createHorizontalStrut(10)); - main.add(Box.createVerticalGlue()); - main.add(extra); - main.add(Box.createVerticalGlue()); - whole.add(Box.createVerticalGlue()); - whole.add(Box.createVerticalStrut(10)); - whole.add(main); - whole.add(Box.createVerticalGlue()); - whole.add(Box.createVerticalStrut(10)); - whole.add(buttons); - whole.add(Box.createVerticalGlue()); - whole.add(Box.createVerticalStrut(10)); - whole.add(Box.createVerticalGlue()); - labels.add(createLabel("Recent Setting:")); - labels.add(Box.createVerticalGlue()); - labels.add(createLabel("Setting Name:")); - labels.add(Box.createVerticalGlue()); - labels.add(createLabel("Type:")); - labels.add(Box.createVerticalGlue()); - labels.add(createLabel("Driver:")); - labels.add(Box.createVerticalGlue()); - labels.add(createLabel("URL:")); - labels.add(Box.createVerticalGlue()); - labels.add(createLabel("User:")); - labels.add(Box.createVerticalGlue()); - labels.add(createLabel("Password:")); - labels.add(Box.createVerticalGlue()); - labels.add(Box.createVerticalStrut(10)); - controls.add(Box.createVerticalGlue()); - - // (weconsultants@users) New code - mSettingName.setActionCommand("Select Setting"); - mSettingName.addActionListener(this); - controls.add(mSettingName); - controls.add(Box.createHorizontalGlue()); - - // (weconsultants@users) New code - mName = new JTextField(); - - mName.addActionListener(this); - controls.add(mName); - - // (weconsultants@users) New code - JButton clear = new JButton("Clear Names"); - - clear.setActionCommand("Clear"); - clear.addActionListener(this); - buttons.add(clear); - buttons.add(Box.createHorizontalGlue()); - buttons.add(Box.createHorizontalStrut(10)); - - JComboBox types = new JComboBox(); - - connTypes = ConnectionDialogCommon.getTypes(); - - for (int i = 0; i < connTypes.length; i++) { - types.addItem(connTypes[i][0]); - } - - types.addItemListener(this); - controls.add(types); - controls.add(Box.createVerticalGlue()); - - mDriver = new JTextField(connTypes[0][1]); - - mDriver.addActionListener(this); - controls.add(mDriver); - - mURL = new JTextField(connTypes[0][2]); - - mURL.addActionListener(this); - controls.add(mURL); - controls.add(Box.createVerticalGlue()); - - mUser = new JTextField("SA"); - - mUser.addActionListener(this); - controls.add(mUser); - controls.add(Box.createVerticalGlue()); - - mPassword = new JPasswordField(""); - - mPassword.addActionListener(this); - controls.add(mPassword); - controls.add(Box.createVerticalGlue()); - controls.add(Box.createVerticalStrut(10)); - - // The button bar - buttons.add(Box.createHorizontalGlue()); - buttons.add(Box.createHorizontalStrut(10)); - - JButton okCancel = new JButton(" Ok "); - - okCancel.setActionCommand("ConnectOk"); - okCancel.addActionListener(this); - buttons.add(okCancel); - getRootPane().setDefaultButton(okCancel); - buttons.add(Box.createHorizontalGlue()); - buttons.add(Box.createHorizontalStrut(20)); - - okCancel = new JButton(" Cancel "); - - okCancel.setActionCommand("ConnectCancel"); - okCancel.addActionListener(this); - buttons.add(okCancel); - buttons.add(Box.createHorizontalGlue()); - buttons.add(Box.createHorizontalStrut(10)); - - JPanel jPanel = new JPanel(); - - jPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - jPanel.add("Center", whole); - getContentPane().add("Center", jPanel); - doLayout(); - pack(); - - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension size = getSize(); - - if (currentConnectionSetting != null) { - mName.setText(currentConnectionSetting.getName()); - mDriver.setText(currentConnectionSetting.getDriver()); - mURL.setText(currentConnectionSetting.getUrl()); - mUser.setText(currentConnectionSetting.getUser()); - mPassword.setText(currentConnectionSetting.getPassword()); - } - - // (ulrivo): full size on screen with less than 640 width - if (d.width >= 640) { - setLocation((d.width - size.width) / 2, - (d.height - size.height) / 2); - } else { - setLocation(0, 0); - setSize(d); - } - - setVisible(true); - } - - public static Connection createConnection(JFrame owner, String title) { - - ConnectionDialogSwing dialog = new ConnectionDialogSwing(owner, title); - -// Added: (weconsultants@users) Default LAF of Native - try { - -// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - SwingUtilities.updateComponentTreeUI(dialog); - } catch (Exception e) { - CommonSwing.errorMessage(e); - } - - dialog.create(); - - return dialog.mConnection; - } - - private static JLabel createLabel(String s) { - return new JLabel(s); - } - - // (weconsultants@users) New code - public Vector loadRecentConnectionSettings() { - - Vector passSettings = new Vector(); - - settings = new Hashtable(); - - try { - settings = ConnectionDialogCommon.loadRecentConnectionSettings(); - - Iterator it = settings.values().iterator(); - - passSettings.add(ConnectionDialogCommon.emptySettingName); - - while (it.hasNext()) { - passSettings.add(((ConnectionSetting) it.next()).getName()); - } - } catch (java.io.IOException ioe) { - CommonSwing.errorMessage(ioe); - } - - return passSettings; - } - - public void actionPerformed(ActionEvent ev) { - - String s = ev.getActionCommand(); - - if (s.equals("ConnectOk") || (ev.getSource() instanceof JTextField)) { - try { - if (mURL.getText().indexOf('\u00AB') >= 0) { - throw new Exception("please specify db path"); - } - - mConnection = - createConnection(mDriver.getText(), mURL.getText(), - mUser.getText(), - new String(mPassword.getPassword())); - - // (weconsultants@users) New code - if (mName.getText() != null - && mName.getText().trim().length() != 0) { - ConnectionSetting newSetting = new ConnectionSetting( - mName.getText(), mDriver.getText(), mURL.getText(), - mUser.getText(), new String(mPassword.getPassword())); - - ConnectionDialogCommon.addToRecentConnectionSettings( - settings, newSetting); - } - - dispose(); - } catch (SQLException e) { - mConnection = null; - - CommonSwing.errorMessage(e, true); - } catch (Exception e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - - // (weconsultants@users) New code - } else if (s.equals("Select Setting")) { - String s2 = (String) mSettingName.getSelectedItem(); - - if (s2 != null) { - ConnectionSetting setting = - (ConnectionSetting) settings.get(s2); - - if (setting != null) { - mName.setText(setting.getName()); - mDriver.setText(setting.getDriver()); - mURL.setText(setting.getUrl()); - mUser.setText(setting.getUser()); - mPassword.setText(setting.getPassword()); - } - } - } else if (s.equals("ConnectCancel")) { - dispose(); - - // (weconsultants@users) New code - } else if (s.equals("Clear")) { - ConnectionDialogCommon.deleteRecentConnectionSettings(); - - settings = new Hashtable(); - - mSettingName.removeAllItems(); - mSettingName.addItem(ConnectionDialogCommon.emptySettingName); - mName.setText(null); - } - } - - public void itemStateChanged(ItemEvent e) { - - String s = (String) e.getItem(); - - for (int i = 0; i < connTypes.length; i++) { - if (s.equals(connTypes[i][0])) { - mDriver.setText(connTypes[i][1]); - mURL.setText(connTypes[i][2]); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/ConnectionSetting.java b/database/hsqldb/src/org/hsqldb/util/ConnectionSetting.java deleted file mode 100644 index 884b4d04..00000000 --- a/database/hsqldb/src/org/hsqldb/util/ConnectionSetting.java +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -/** - * ConnectionSetting represents the various parameters of a data source - * connection. - * - * @author lonbinder@users - */ -public class ConnectionSetting implements java.io.Serializable { - - private String name, driver, url, user, pw; - - String getName() { - return name; - } - - String getDriver() { - return driver; - } - - String getUrl() { - return url; - } - - String getUser() { - return user; - } - - String getPassword() { - return pw; - } - - // Constructors - private ConnectionSetting() {} - - ConnectionSetting(String name, String driver, String url, String user, - String pw) { - - this.name = name; - this.driver = driver; - this.url = url; - this.user = user; - this.pw = pw; - } - - public boolean equals(Object obj) { - - if (!(obj instanceof ConnectionSetting)) { - return false; - } - - ConnectionSetting other = (ConnectionSetting) obj; - - if (getName() == other.getName()) { - return true; - } - - if (getName() == null) { - return false; - } - - return getName().trim().equals(other.getName().trim()); - } - - public int hashCode() { - return getName() == null ? 0 - : getName().trim().hashCode(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/DataAccessPoint.java b/database/hsqldb/src/org/hsqldb/util/DataAccessPoint.java deleted file mode 100644 index 156e7110..00000000 --- a/database/hsqldb/src/org/hsqldb/util/DataAccessPoint.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.io.Serializable; -import java.util.Vector; - -/** - * Database Transfer Tool - * @author Nicolas BAZIN, INGENICO - * @version 1.7.0 - */ -class DataAccessPoint implements Serializable { - - Traceable tracer; - TransferHelper helper; - String databaseToConvert; - - public DataAccessPoint() { - - tracer = null; - helper = HelperFactory.getHelper(""); - databaseToConvert = ""; - } - - public DataAccessPoint(Traceable t) { - - tracer = t; - helper = HelperFactory.getHelper(""); - - helper.set(null, t, "'"); - - databaseToConvert = ""; - } - - boolean isConnected() { - return false; - } - - boolean getAutoCommit() throws DataAccessPointException { - return false; - } - - void commit() throws DataAccessPointException {} - - void rollback() throws DataAccessPointException {} - - void setAutoCommit(boolean flag) throws DataAccessPointException {} - - boolean execute(String statement) throws DataAccessPointException { - return false; - } - - TransferResultSet getData(String statement) - throws DataAccessPointException { - return null; - } - - void putData(String statement, TransferResultSet r, - int iMaxRows) throws DataAccessPointException {} - - Vector getSchemas() throws DataAccessPointException { - return new Vector(); - } - - Vector getCatalog() throws DataAccessPointException { - return new Vector(); - } - - void setCatalog(String sCatalog) throws DataAccessPointException {} - - Vector getTables(String sCatalog, - String[] sSchemas) throws DataAccessPointException { - return new Vector(); - } - - void getTableStructure(TransferTable SQLCommands, - DataAccessPoint Dest) - throws DataAccessPointException { - throw new DataAccessPointException("Nothing to Parse"); - } - - void close() {} - - void beginDataTransfer() throws DataAccessPointException { - - try { - helper.beginDataTransfer(); - } catch (Exception e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - void endDataTransfer() throws DataAccessPointException { - - try { - helper.endDataTransfer(); - } catch (Exception e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - /** - * @return Returns the helper. - */ - public TransferHelper getHelper() { - return helper; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/DataAccessPointException.java b/database/hsqldb/src/org/hsqldb/util/DataAccessPointException.java deleted file mode 100644 index a25c90e2..00000000 --- a/database/hsqldb/src/org/hsqldb/util/DataAccessPointException.java +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -/** - * - * @author Nicolas BAZIN, INGENICO - * @version 1.7.0 - */ -class DataAccessPointException extends Exception { - - public DataAccessPointException() { - super(); - } - - public DataAccessPointException(String s) { - super(s); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/DatabaseManager.java b/database/hsqldb/src/org/hsqldb/util/DatabaseManager.java deleted file mode 100644 index 1adce8c6..00000000 --- a/database/hsqldb/src/org/hsqldb/util/DatabaseManager.java +++ /dev/null @@ -1,1408 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; - -import java.awt.BorderLayout; -import java.awt.Button; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FileDialog; -import java.awt.Font; -import java.awt.Frame; -import java.awt.Image; -import java.awt.Menu; -import java.awt.MenuBar; -import java.awt.MenuItem; -import java.awt.MenuShortcut; -import java.awt.Panel; -import java.awt.TextArea; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.awt.image.MemoryImageSource; - -// sqlbob@users 20020401 - patch 1.7.0 by sqlbob (RMP) - enhancements -// sqlbob@users 20020401 - patch 537501 by ulrivo - command line arguments -// sqlbob@users 20020407 - patch 1.7.0 - reengineering -// nickferguson@users 20021005 - patch 1.7.1 - enhancements -// fredt@users - version 2.50 - removed deprecated -/* - - * unsaved@users 20050426 - Switched default switch method from "-switch" to - * "--switch" because "-switch" usage is ambiguous as used here. Single - * switches should be reserved for single-letter switches which can be mixed - * like * "-u -r -l" = "-url". -blaine -*/ - -/** - * AWT Tool for manageing a JDBC database. - *
    - * {@code
    - *             Usage: java DatabaseManagerSwing [--options]
    - *             where options include:
    - *              --driver   jdbc driver class
    - *              --url           jdbc url
    - *              --user          username used for connection
    - *              --password  password for this user
    - *              --urlid        get connection info from RC file
    - *              --rcfile        use instead of default (with urlid)
    - *              --dir           default directory
    - *              --script        reads from script file
    - * }
    - *
    - * - * Originally in HypersonicSQL. Extended in various versions of HSQLDB. - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.5.1 - * @since Hypersonic SQL - */ -public class DatabaseManager extends Panel -implements ActionListener, WindowListener, KeyListener { - - static final String NL = System.getProperty("line.separator"); - static final int iMaxRecent = 24; - private static boolean TT_AVAILABLE = false; - - static { - try { - Class.forName(DatabaseManager.class.getPackage().getName() - + ".Transfer"); - - TT_AVAILABLE = true; - } catch (Throwable t) {} - } - - private static final String HELP_TEXT = - "See the forums, mailing lists, and HSQLDB User Guide\n" - + "at http://hsqldb.org.\n\n" - + "Please paste the following version identifier with any\n" - + "problem reports or help requests: $Revision: 6494 $" - + (TT_AVAILABLE ? "" - : ("\n\nTransferTool classes are not in CLASSPATH.\n" - + "To enable the Tools menu, add 'transfer.jar' to your class path.")); - - private static final String ABOUT_TEXT = - "$Revision: 6494 $ of DatabaseManager\n\n" - + "Copyright (c) 1995-2000, The Hypersonic SQL Group.\n" - + "Copyright (c) 2001-2021, The HSQL Development Group.\n" - + "http://hsqldb.org (User Guide available at this site).\n\n\n" - + "You may use and redistribute according to the HSQLDB\n" - + "license documented in the source code and at the web\n" - + "site above." // - + (TT_AVAILABLE ? "\n\nTransferTool options are available." - : ""); - Connection cConn; - DatabaseMetaData dMeta; - Statement sStatement; - Menu mRecent; - String[] sRecent; - int iRecent; - TextArea txtCommand; - Button butExecute; - Button butClear; - Tree tTree; - Panel pResult; - long lTime; - int iResult; // 0: grid; 1: text - Grid gResult; - TextArea txtResult; - boolean bHelp; - Frame fMain; - Image imgEmpty; - static boolean bMustExit; - String ifHuge = ""; - - // (ulrivo): variables set by arguments from the commandline - static String defDriver = "org.hsqldb.jdbc.JDBCDriver"; - static String defURL = "jdbc:hsqldb:mem:."; - static String defUser = "SA"; - static String defPassword = ""; - static String defScript; - static String defDirectory; - - public void connect(Connection c) { - - if (c == null) { - return; - } - - if (cConn != null) { - try { - cConn.close(); - } catch (SQLException e) {} - } - - cConn = c; - - try { - dMeta = cConn.getMetaData(); - sStatement = cConn.createStatement(); - - refreshTree(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - public void init() { - - DatabaseManager m = new DatabaseManager(); - - m.main(); - - try { - m.connect(ConnectionDialog.createConnection(defDriver, defURL, - defUser, defPassword)); - m.insertTestData(); - m.refreshTree(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void threadedDBM() { - - System.getProperties().put("sun.java2d.noddraw", "true"); - - String urlid = null; - String rcFile = null; - boolean autoConnect = false; - boolean urlidConnect = false; - - bMustExit = false; - - DatabaseManager m = new DatabaseManager(); - - m.main(); - - Connection c = null; - - try { - c = ConnectionDialog.createConnection(m.fMain, "Connect"); - } catch (Exception e) { - e.printStackTrace(); - } - - if (c == null) { - return; - } - - m.connect(c); - } - - /** - * Run with --help switch for usage instructions. - * - * @param arg arguments - * @throws IllegalArgumentException for the obvious reason - */ - public static void main(String[] arg) { - - System.getProperties().put("sun.java2d.noddraw", "true"); - - // (ulrivo): read all arguments from the command line - String currentArg; - String lowerArg; - String urlid = null; - String rcFile = null; - boolean autoConnect = false; - boolean urlidConnect = false; - - bMustExit = true; - - for (int i = 0; i < arg.length; i++) { - currentArg = arg[i]; - lowerArg = arg[i].toLowerCase(); - - if (lowerArg.startsWith("--")) { - lowerArg = lowerArg.substring(1); - } - - if (lowerArg.equals("-noexit") || lowerArg.equals("-help")) { - - // - } else if (i == arg.length - 1) { - throw new IllegalArgumentException("No value for argument " - + currentArg); - } - - i++; - - if (lowerArg.equals("-driver")) { - defDriver = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-url")) { - defURL = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-user")) { - defUser = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-password")) { - defPassword = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-urlid")) { - urlid = arg[i]; - urlidConnect = true; - } else if (lowerArg.equals("-rcfile")) { - rcFile = arg[i]; - urlidConnect = true; - } else if (lowerArg.equals("-dir")) { - defDirectory = arg[i]; - } else if (lowerArg.equals("-script")) { - defScript = arg[i]; - } else if (lowerArg.equals("-noexit")) { - bMustExit = false; - - i--; - } else if (lowerArg.equals("-help")) { - showUsage(); - - return; - } else { - /* Syntax ERRORS should either throw or exit with non-0 status. - * In our case, it may be unsafe to exit, so we throw. - * (I.e. should provide easy way for caller to programmatically - * determine that there was an invocation problem). - */ - throw new IllegalArgumentException( - "invalid argrument " + currentArg + " try: java... " - + DatabaseManager.class.getName() + " --help"); - - // No reason to localize, since the main syntax message is - // not localized. - } - } - - DatabaseManager m = new DatabaseManager(); - - m.main(); - - Connection c = null; - - try { - if (autoConnect && urlidConnect) { - throw new IllegalArgumentException( - "You may not specify both (urlid) AND (url/user/password)."); - } - - if (autoConnect) { - c = ConnectionDialog.createConnection(defDriver, defURL, - defUser, defPassword); - } else if (urlidConnect) { - if (urlid == null) { - throw new IllegalArgumentException( - "You must specify an 'urlid' to use an RC file"); - } - - autoConnect = true; - - if (rcFile == null) { - rcFile = System.getProperty("user.home") + "/dbmanager.rc"; - } - - c = new RCData(new File(rcFile), urlid).getConnection(null, - System.getProperty("javax.net.ssl.trustStore")); - } else { - c = ConnectionDialog.createConnection(m.fMain, "Connect"); - } - } catch (Exception e) { - e.printStackTrace(); - } - - if (c == null) { - return; - } - - m.connect(c); - } - - private static void showUsage() { - - System.out.println( - "Usage: java DatabaseManager [--options]\n" - + "where options include:\n" - + " --help show this message\n" - + " --driver jdbc driver class\n" - + " --url jdbc url\n" - + " --user username used for connection\n" - + " --password password for this user\n" - + " --urlid use url/user/password/driver in rc file\n" - + " --rcfile (defaults to 'dbmanager.rc' in home dir)\n" - + " --dir default directory\n" - + " --script reads from script file\n" - + " --noexit do not call system.exit()"); - } - - void insertTestData() { - - try { - DatabaseManagerCommon.createTestTables(sStatement); - refreshTree(); - txtCommand.setText( - DatabaseManagerCommon.createTestData(sStatement)); - refreshTree(); - - for (int i = 0; i < DatabaseManagerCommon.testDataSql.length; - i++) { - addToRecent(DatabaseManagerCommon.testDataSql[i]); - } - - execute(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - public void main() { - - fMain = new Frame("HSQL Database Manager"); - imgEmpty = createImage(new MemoryImageSource(2, 2, new int[4 * 4], 2, - 2)); - - fMain.setIconImage(imgEmpty); - fMain.addWindowListener(this); - - MenuBar bar = new MenuBar(); - - // used shortcuts: CERGTSIUDOLM - String[] fitems = { - "-Connect...", "--", "-Open Script...", "-Save Script...", - "-Save Result...", "-Save Result csv...", "--", "-Exit" - }; - - addMenu(bar, "File", fitems); - - String[] vitems = { - "RRefresh Tree", "--", "GResults in Grid", "TResults in Text", - "--", "1Shrink Tree", "2Enlarge Tree", "3Shrink Command", - "4Enlarge Command" - }; - - addMenu(bar, "View", vitems); - - String[] sitems = { - "SSELECT", "IINSERT", "UUPDATE", "DDELETE", "--", "-CREATE TABLE", - "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", "--", "-CHECKPOINT", - "-SCRIPT", "-SET", "-SHUTDOWN", "--", "-Test Script" - }; - - addMenu(bar, "Command", sitems); - - Menu recent = new Menu("Recent"); - - mRecent = new Menu("Recent"); - - bar.add(mRecent); - - String[] soptions = { - "-AutoCommit on", "-AutoCommit off", "OCommit", "LRollback", "--", - "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on", - "-Logging off", "--", "-Insert test data" - }; - - addMenu(bar, "Options", soptions); - - String[] stools = { - "-Dump", "-Restore", "-Transfer" - }; - - addMenu(bar, "Tools", stools); - - Menu hMenu = new Menu("Help"); - MenuItem aItem = new MenuItem("About"); - - aItem.setShortcut(new MenuShortcut('A')); - aItem.addActionListener(this); - hMenu.add(aItem); - - MenuItem hItem = new MenuItem("Help"); - - hItem.setShortcut(new MenuShortcut('H')); - hItem.addActionListener(this); - hMenu.add(hItem); - - //bar.add(hMenu); - // Command above disabled only until a help display bug is fixed. - fMain.setMenuBar(bar); - fMain.setSize(640, 480); - fMain.add("Center", this); - initGUI(); - - sRecent = new String[iMaxRecent]; - - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension size = fMain.getSize(); - - // (ulrivo): full size on screen with less than 640 width - if (d.width >= 640) { - fMain.setLocation((d.width - size.width) / 2, - (d.height - size.height) / 2); - } else { - fMain.setLocation(0, 0); - fMain.setSize(d); - } - - fMain.setVisible(true); - - // (ulrivo): load query from command line - if (defScript != null) { - if (defDirectory != null) { - defScript = defDirectory + File.separator + defScript; - } - - txtCommand.setText(DatabaseManagerCommon.readFile(defScript)); - } - - txtCommand.requestFocus(); - } - - void addMenu(MenuBar b, String name, String[] items) { - - /* It's a very poor design to encapsulate menu creation this way. - * Can't customize the menus this way (e.g. shortcut keys, - * mnemonics, disabling, etc. */ - Menu menu = new Menu(name); - - if (name.equals("Tools") && !TT_AVAILABLE) { - - // Terrible place to do this. Forced to due to method design. - menu.setEnabled(false); - } - - addMenuItems(menu, items); - b.add(menu); - } - - void addMenuItems(Menu f, String[] m) { - - for (int i = 0; i < m.length; i++) { - MenuItem item = new MenuItem(m[i].substring(1)); - char c = m[i].charAt(0); - - if (c != '-') { - item.setShortcut(new MenuShortcut(c)); - } - - item.addActionListener(this); - f.add(item); - } - } - - public void keyPressed(KeyEvent k) {} - - public void keyReleased(KeyEvent k) {} - - public void keyTyped(KeyEvent k) { - - if (k.getKeyChar() == '\n' && k.isControlDown()) { - k.consume(); - execute(); - } - } - - public void actionPerformed(ActionEvent ev) { - - String s = ev.getActionCommand(); - - if (s == null) { - if (ev.getSource() instanceof MenuItem) { - MenuItem i; - - s = ((MenuItem) ev.getSource()).getLabel(); - } - } - - if (s == null) {} - else if (s.equals("Execute")) { - execute(); - } else if (s.equals("Clear")) { - clear(); - } else if (s.equals("Exit")) { - windowClosing(null); - } else if (s.equals("Transfer")) { - Transfer.work(null); - } else if (s.equals("Dump")) { - Transfer.work(new String[]{ "-d" }); - } else if (s.equals("Restore")) { - Transfer.work(new String[]{ "-r" }); - refreshTree(); - } else if (s.equals("Logging on")) { - setLogToSystem(true); - } else if (s.equals("Logging off")) { - setLogToSystem(false); - } else if (s.equals("Help")) { - showHelp(new String[] { - "", HELP_TEXT - }); - } else if (s.equals("About")) { - showHelp(new String[] { - "", ABOUT_TEXT - }); - } else if (s.equals("Refresh Tree")) { - refreshTree(); - } else if (s.startsWith("#")) { - int i = Integer.parseInt(s.substring(1)); - - txtCommand.setText(sRecent[i]); - } else if (s.equals("Connect...")) { - connect(ConnectionDialog.createConnection(fMain, "Connect")); - refreshTree(); - } else if (s.equals("Results in Grid")) { - iResult = 0; - - pResult.removeAll(); - pResult.add("Center", gResult); - pResult.doLayout(); - } else if (s.equals("Open Script...")) { - FileDialog f = new FileDialog(fMain, "Open Script", - FileDialog.LOAD); - - // (ulrivo): set default directory if set from command line - if (defDirectory != null) { - f.setDirectory(defDirectory); - } - - f.setVisible(true); - - String file = f.getFile(); - - if (file != null) { - StringBuilder buf = new StringBuilder(); - - ifHuge = DatabaseManagerCommon.readFile(f.getDirectory() - + file); - - if (4096 <= ifHuge.length()) { - buf.append( - "This huge file cannot be edited.\n Please execute or clear\n"); - txtCommand.setText(buf.toString()); - } else { - txtCommand.setText(ifHuge); - } - } - } else if (s.equals("Save Script...")) { - FileDialog f = new FileDialog(fMain, "Save Script", - FileDialog.SAVE); - - // (ulrivo): set default directory if set from command line - if (defDirectory != null) { - f.setDirectory(defDirectory); - } - - f.setVisible(true); - - String file = f.getFile(); - - if (file != null) { - DatabaseManagerCommon.writeFile(f.getDirectory() + file, - txtCommand.getText()); - } - } else if (s.equals("Save Result csv...")) { - FileDialog f = new FileDialog(fMain, "Save Result CSV", - FileDialog.SAVE); - - // (ulrivo): set default directory if set from command line - if (defDirectory != null) { - f.setDirectory(defDirectory); - } - - f.setVisible(true); - - String dir = f.getDirectory(); - String file = f.getFile(); - - if (dir != null) { - file = dir + "/" + file; - } - - if (file != null) { - showResultInText(); - saveAsCsv(file); - } - } else if (s.equals("Save Result...")) { - FileDialog f = new FileDialog(fMain, "Save Result", - FileDialog.SAVE); - - // (ulrivo): set default directory if set from command line - if (defDirectory != null) { - f.setDirectory(defDirectory); - } - - f.setVisible(true); - - String file = f.getFile(); - - if (file != null) { - showResultInText(); - DatabaseManagerCommon.writeFile(f.getDirectory() + file, - txtResult.getText()); - } - } else if (s.equals("Results in Text")) { - iResult = 1; - - pResult.removeAll(); - pResult.add("Center", txtResult); - pResult.doLayout(); - showResultInText(); - } else if (s.equals("AutoCommit on")) { - try { - cConn.setAutoCommit(true); - } catch (SQLException e) {} - } else if (s.equals("AutoCommit off")) { - try { - cConn.setAutoCommit(false); - } catch (SQLException e) {} - } else if (s.equals("Enlarge Tree")) { - Dimension d = tTree.getMinimumSize(); - - d.width += 20; - - tTree.setMinimumSize(d); - fMain.pack(); - } else if (s.equals("Shrink Tree")) { - Dimension d = tTree.getMinimumSize(); - - d.width -= 20; - - if (d.width >= 0) { - tTree.setMinimumSize(d); - } - - fMain.pack(); - } else if (s.equals("Enlarge Command")) { - txtCommand.setRows(txtCommand.getRows() + 1); - fMain.pack(); - } else if (s.equals("Shrink Command")) { - int i = txtCommand.getRows() - 1; - - txtCommand.setRows(i < 1 ? 1 - : i); - fMain.pack(); - } else if (s.equals("Commit")) { - try { - cConn.commit(); - } catch (SQLException e) {} - } else if (s.equals("Insert test data")) { - insertTestData(); - } else if (s.equals("Rollback")) { - try { - cConn.rollback(); - } catch (SQLException e) {} - } else if (s.equals("Disable MaxRows")) { - try { - sStatement.setMaxRows(0); - } catch (SQLException e) {} - } else if (s.equals("Set MaxRows to 100")) { - try { - sStatement.setMaxRows(100); - } catch (SQLException e) {} - } else if (s.equals("SELECT")) { - showHelp(DatabaseManagerCommon.selectHelp); - } else if (s.equals("INSERT")) { - showHelp(DatabaseManagerCommon.insertHelp); - } else if (s.equals("UPDATE")) { - showHelp(DatabaseManagerCommon.updateHelp); - } else if (s.equals("DELETE")) { - showHelp(DatabaseManagerCommon.deleteHelp); - } else if (s.equals("CREATE TABLE")) { - showHelp(DatabaseManagerCommon.createTableHelp); - } else if (s.equals("DROP TABLE")) { - showHelp(DatabaseManagerCommon.dropTableHelp); - } else if (s.equals("CREATE INDEX")) { - showHelp(DatabaseManagerCommon.createIndexHelp); - } else if (s.equals("DROP INDEX")) { - showHelp(DatabaseManagerCommon.dropIndexHelp); - } else if (s.equals("CHECKPOINT")) { - showHelp(DatabaseManagerCommon.checkpointHelp); - } else if (s.equals("SCRIPT")) { - showHelp(DatabaseManagerCommon.scriptHelp); - } else if (s.equals("SHUTDOWN")) { - showHelp(DatabaseManagerCommon.shutdownHelp); - } else if (s.equals("SET")) { - showHelp(DatabaseManagerCommon.setHelp); - } else if (s.equals("Test Script")) { - showHelp(DatabaseManagerCommon.testHelp); - } - } - - void showHelp(String[] help) { - - txtCommand.setText(help[0]); - txtResult.setText(help[1]); - - bHelp = true; - - pResult.removeAll(); - pResult.add("Center", txtResult); - pResult.doLayout(); - txtCommand.requestFocus(); - txtCommand.setCaretPosition(help[0].length()); - } - - public void windowActivated(WindowEvent e) {} - - public void windowDeactivated(WindowEvent e) {} - - public void windowClosed(WindowEvent e) {} - - public void windowClosing(WindowEvent ev) { - - try { - if (cConn != null) { - cConn.close(); - } - } catch (Exception e) {} - - fMain.dispose(); - - if (bMustExit) { - System.exit(0); - } - } - - public void windowDeiconified(WindowEvent e) {} - - public void windowIconified(WindowEvent e) {} - - public void windowOpened(WindowEvent e) {} - - /** - * Clear SQL Statements. - */ - void clear() { - - ifHuge = ""; - - txtCommand.setText(ifHuge); - } - - /** - * Adjust this method for large strings...ie multi megabtypes. - */ - void execute() { - - String sCmd = null; - - if (4096 <= ifHuge.length()) { - sCmd = ifHuge; - } else { - sCmd = txtCommand.getText(); - } - - if (sCmd.startsWith("-->>>TEST<<<--")) { - testPerformance(); - - return; - } - - String[] g = new String[1]; - - lTime = System.nanoTime(); - - try { - if (sStatement == null) { - return; - } - - sStatement.execute(sCmd); - - lTime = System.nanoTime() - lTime; - - int r = sStatement.getUpdateCount(); - - if (r == -1) { - ResultSet rs = sStatement.getResultSet(); - - try { - formatResultSet(rs); - } catch (Throwable t) { - g[0] = "Error displaying the ResultSet"; - - gResult.setHead(g); - - String s = t.getMessage(); - - g[0] = s; - - gResult.addRow(g); - } - } else if (sStatement.getMoreResults()) { // repeated for if a procedure returns a result set - ResultSet rs = sStatement.getResultSet(); - - try { - formatResultSet(rs); - } catch (Throwable t) { - g[0] = "Error displaying the ResultSet"; - - gResult.setHead(g); - - String s = t.getMessage(); - - g[0] = s; - - gResult.addRow(g); - } - } else { - g[0] = "update count"; - - gResult.setHead(g); - - g[0] = String.valueOf(r); - - gResult.addRow(g); - } - - addToRecent(txtCommand.getText()); - } catch (SQLException e) { - lTime = System.nanoTime() - lTime; - g[0] = "SQL Error"; - - gResult.setHead(g); - - String s = e.getMessage(); - - s += " / Error Code: " + e.getErrorCode(); - s += " / State: " + e.getSQLState(); - g[0] = s; - - gResult.addRow(g); - } - - updateResult(); - } - - void updateResult() { - - if (iResult == 0) { - - // in case 'help' has removed the grid - if (bHelp) { - pResult.removeAll(); - pResult.add("Center", gResult); - pResult.doLayout(); - - bHelp = false; - } - - gResult.update(); - gResult.repaint(); - } else { - showResultInText(); - } - - txtCommand.selectAll(); - txtCommand.requestFocus(); - } - - void formatResultSet(ResultSet r) { - - if (r == null) { - String[] g = new String[1]; - - g[0] = "Result"; - - gResult.setHead(g); - - g[0] = "(empty)"; - - gResult.addRow(g); - - return; - } - - try { - ResultSetMetaData m = r.getMetaData(); - int col = m.getColumnCount(); - String[] h = new String[col]; - - // int[] p = new int[col]; - for (int i = 1; i <= col; i++) { - h[i - 1] = m.getColumnLabel(i); - - // p[i - 1] = m.getPrecision(i); - } - - gResult.setHead(h); - - while (r.next()) { - for (int i = 1; i <= col; i++) { - try { - h[i - 1] = r.getString(i); - - if (r.wasNull()) { - h[i - 1] = "(null)"; - } - } catch (SQLException e) { - h[i - 1] = "(binary data)"; - } - } - - gResult.addRow(h); - } - - r.close(); - } catch (SQLException e) {} - } - - void testPerformance() { - - String all = txtCommand.getText(); - StringBuilder b = new StringBuilder(); - long total = 0; - - lTime = 0; - - for (int i = 0; i < all.length(); i++) { - char c = all.charAt(i); - - if (c != '\n') { - b.append(c); - } - } - - all = b.toString(); - - String[] g = new String[4]; - - g[0] = "ms"; - g[1] = "count"; - g[2] = "sql"; - g[3] = "error"; - - gResult.setHead(g); - - int max = 1; - - lTime = System.nanoTime() - lTime; - - while (!all.equals("")) { - int i = all.indexOf(';'); - String sql; - - if (i != -1) { - sql = all.substring(0, i); - all = all.substring(i + 1); - } else { - sql = all; - all = ""; - } - - if (sql.startsWith("--#")) { - max = Integer.parseInt(sql.substring(3)); - - continue; - } else if (sql.startsWith("--")) { - continue; - } - - g[2] = sql; - - long l = 0; - - try { - l = DatabaseManagerCommon.testStatement(sStatement, sql, max); - total += l; - g[0] = String.valueOf(l); - g[1] = String.valueOf(max); - g[3] = ""; - } catch (SQLException e) { - g[0] = g[1] = "n/a"; - g[3] = e.toString(); - } - - gResult.addRow(g); - System.out.println(l + " ms : " + sql); - } - - g[0] = "" + total; - g[1] = "total"; - g[2] = ""; - - gResult.addRow(g); - - lTime = System.nanoTime() - lTime; - - updateResult(); - } - - void saveAsCsv(String filename) { - - try { - File file = new File(filename); - CSVWriter writer = new CSVWriter(file, null); - String[] col = gResult.getHead(); - int width = col.length; - ArrayList data = gResult.getData(); - String[] row; - int height = data.size(); - - writer.writeHeader(col); - - for (int i = 0; i < height; i++) { - row = data.get(i); - - String[] myRow = new String[row.length]; - - for (int j = 0; j < row.length; j++) { - String r = row[j]; - - if (r.equals("(null)")) { - - // null is formatted as (null) - r = ""; - } - - myRow[j] = r; - } - - writer.writeData(myRow); - } - - writer.close(); - } catch (IOException e) { - throw new RuntimeException("IOError: " + e.getMessage()); - } - } - - void showResultInText() { - - String[] col = gResult.getHead(); - int width = col.length; - int[] size = new int[width]; - ArrayList data = gResult.getData(); - String[] row; - int height = data.size(); - - for (int i = 0; i < width; i++) { - size[i] = col[i].length(); - } - - for (int i = 0; i < height; i++) { - row = data.get(i); - - for (int j = 0; j < width; j++) { - int l = row[j].length(); - - if (l > size[j]) { - size[j] = l; - } - } - } - - StringBuilder b = new StringBuilder(); - - for (int i = 0; i < width; i++) { - b.append(col[i]); - - for (int l = col[i].length(); l <= size[i]; l++) { - b.append(' '); - } - } - - b.append(NL); - - for (int i = 0; i < width; i++) { - for (int l = 0; l < size[i]; l++) { - b.append('-'); - } - - b.append(' '); - } - - b.append(NL); - - for (int i = 0; i < height; i++) { - row = data.get(i); - - for (int j = 0; j < width; j++) { - b.append(row[j]); - - for (int l = row[j].length(); l <= size[j]; l++) { - b.append(' '); - } - } - - b.append(NL); - } - - long millis = lTime / 1000000; - long fraction = (lTime % 1000000) / 100000; - - b.append(NL + height + " row(s) in " + millis + '.' + fraction - + " ms"); - txtResult.setText(b.toString()); - } - - private void addToRecent(String s) { - - for (int i = 0; i < iMaxRecent; i++) { - if (s.equals(sRecent[i])) { - return; - } - } - - if (sRecent[iRecent] != null) { - mRecent.remove(iRecent); - } - - sRecent[iRecent] = s; - - if (s.length() > 43) { - s = s.substring(0, 40) + "..."; - } - - MenuItem item = new MenuItem(s); - - item.setActionCommand("#" + iRecent); - item.addActionListener(this); - mRecent.insert(item, iRecent); - - iRecent = (iRecent + 1) % iMaxRecent; - } - - private void initGUI() { - - Panel pQuery = new Panel(); - Panel pCommand = new Panel(); - - pResult = new Panel(); - - pQuery.setLayout(new BorderLayout()); - pCommand.setLayout(new BorderLayout()); - pResult.setLayout(new BorderLayout()); - - Font fFont = new Font("Dialog", Font.PLAIN, 12); - - txtCommand = new TextArea(5, 40); - - txtCommand.addKeyListener(this); - - txtResult = new TextArea(20, 40); - - txtCommand.setFont(fFont); - txtResult.setFont(new Font("Courier", Font.PLAIN, 12)); - - butExecute = new Button("Execute"); - butClear = new Button("Clear"); - - butExecute.addActionListener(this); - butClear.addActionListener(this); - pCommand.add("East", butExecute); - pCommand.add("West", butClear); - pCommand.add("Center", txtCommand); - - gResult = new Grid(); - - setLayout(new BorderLayout()); - pResult.add("Center", gResult); - pQuery.add("North", pCommand); - pQuery.add("Center", pResult); - fMain.add("Center", pQuery); - - tTree = new Tree(); - - // (ulrivo): screen with less than 640 width - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - - if (d.width >= 640) { - tTree.setMinimumSize(new Dimension(200, 100)); - } else { - tTree.setMinimumSize(new Dimension(80, 100)); - } - - gResult.setMinimumSize(new Dimension(200, 300)); - fMain.add("West", tTree); - doLayout(); - fMain.pack(); - } - - protected void refreshTree() { - - boolean wasAutoCommit = false; - - tTree.removeAll(); - - try { - if (cConn == null) { - throw new SQLException("no connection"); - } - - wasAutoCommit = cConn.getAutoCommit(); - - cConn.setAutoCommit(false); - - int color_table = Color.yellow.getRGB(); - int color_column = Color.orange.getRGB(); - int color_index = Color.red.getRGB(); - - tTree.addRow("", dMeta.getURL(), "-", 0); - - String[] usertables = { - "TABLE", "GLOBAL TEMPORARY", "VIEW" - }; - - // fredt@users Schema support - ArrayList schemas = new ArrayList(); - ArrayList tables = new ArrayList(); - - // sqlbob@users Added remarks. - ArrayList remarks = new ArrayList(); - ResultSet result = dMeta.getTables(null, null, null, usertables); - - try { - while (result.next()) { - schemas.add(result.getString(2)); - tables.add(result.getString(3)); - remarks.add(result.getString(5)); - } - } finally { - result.close(); - } - - for (int i = 0; i < tables.size(); i++) { - String name = tables.get(i); - String schema = schemas.get(i); - String key = "tab-" + name + "-"; - - tTree.addRow(key, name, "+", color_table); - - // sqlbob@users Added remarks. - String remark = remarks.get(i); - - if ((schema != null) && !schema.trim().equals("")) { - tTree.addRow(key + "s", "schema: " + schema); - } - - if ((remark != null) && !remark.trim().equals("")) { - tTree.addRow(key + "r", " " + remark); - } - - ResultSet col = dMeta.getColumns(null, schema, name, null); - - try { - while (col.next()) { - String c = col.getString(4); - String k1 = key + "col-" + c + "-"; - - tTree.addRow(k1, c, "+", color_column); - - String type = col.getString(6); - - tTree.addRow(k1 + "t", "Type: " + type); - - boolean nullable = col.getInt(11) - != DatabaseMetaData.columnNoNulls; - - tTree.addRow(k1 + "n", "Nullable: " + nullable); - } - } finally { - col.close(); - } - - tTree.addRow(key + "ind", "Indices", "+", 0); - - ResultSet ind = dMeta.getIndexInfo(null, schema, name, false, - false); - String oldiname = null; - - try { - while (ind.next()) { - boolean nonunique = ind.getBoolean(4); - String iname = ind.getString(6); - String k2 = key + "ind-" + iname + "-"; - - if ((oldiname == null || !oldiname.equals(iname))) { - tTree.addRow(k2, iname, "+", color_index); - tTree.addRow(k2 + "u", "Unique: " + !nonunique); - - oldiname = iname; - } - - String c = ind.getString(9); - - tTree.addRow(k2 + "c-" + c + "-", c); - } - } finally { - ind.close(); - } - } - - tTree.addRow("p", "Properties", "+", 0); - tTree.addRow("pu", "User: " + dMeta.getUserName()); - tTree.addRow("pr", "ReadOnly: " + cConn.isReadOnly()); - tTree.addRow("pa", "AutoCommit: " + cConn.getAutoCommit()); - tTree.addRow("pd", "Driver: " + dMeta.getDriverName()); - tTree.addRow("pp", "Product: " + dMeta.getDatabaseProductName()); - tTree.addRow("pv", - "Version: " + dMeta.getDatabaseProductVersion()); - } catch (SQLException e) { - tTree.addRow("", "Error getting metadata:", "-", 0); - tTree.addRow("-", e.getMessage()); - tTree.addRow("-", e.getSQLState()); - } finally { - try { - if (cConn != null) { - cConn.setAutoCommit(wasAutoCommit); - } - } catch (SQLException e) {} - } - - tTree.update(); - } - - private static void setLogToSystem(boolean value) { - - try { - PrintWriter newPrintWriter = (value) ? new PrintWriter(System.out) - : null; - - DriverManager.setLogWriter(newPrintWriter); - } catch (Exception e) {} - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/DatabaseManagerCommon.java b/database/hsqldb/src/org/hsqldb/util/DatabaseManagerCommon.java deleted file mode 100644 index f5c93efe..00000000 --- a/database/hsqldb/src/org/hsqldb/util/DatabaseManagerCommon.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Random; - -// sqlbob@users 20020401 - patch 1.7.0 by sqlbob (RMP) - enhancements -// sqlbob@users 20020407 - patch 1.7.0 - reengineering -// nickferguson@users 20021005 - patch 1.7.1 - enhancements -// fredt@users 20021012 - patch 1.7.1 - changes to test database DDL -// weconsultants@users 20041116 - patch 1.8.0 - in 'TestHelp' added 'IF EXISTS for both DROPS. -// Now catching the execption that was never caught before. - -/** - * Common code in Swing and AWT versions of DatabaseManager - * - * New class based on Hypersonic original - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @version 1.8.0 - * @since 1.7.0 - */ -final class DatabaseManagerCommon { - - private static final Random rRandom = new Random(100); - static String[] selectHelp = { - "SELECT * FROM ", - - "SELECT [LIMIT n m] [DISTINCT] \n" - + "{ selectExpression | table.* | * } [, ... ] \n" - + "[INTO [CACHED|TEMP|TEXT] newTable] \n" + "FROM tableList \n" - + "[WHERE Expression] \n" - + "[ORDER BY selectExpression [{ASC | DESC}] [, ...] ] \n" - + "[GROUP BY Expression [, ...] ] \n" // - + "[UNION [ALL] selectStatement]" - }; - static String[] insertHelp = { - "INSERT INTO ", - "INSERT INTO table [ (column [,...] ) ] \n" - + "{ VALUES(Expression [,...]) [,...] | SelectStatement }" - }; - static String[] updateHelp = { - "UPDATE ", - "UPDATE table SET column = Expression [, ...] \n" - + "[WHERE Expression]" - }; - static String[] deleteHelp = { - "DELETE FROM ", "DELETE FROM table [WHERE Expression]" - }; - static String[] createTableHelp = { - "CREATE TABLE ", - "CREATE [TEMP] [CACHED|MEMORY|TEXT] TABLE name \n" - + "( columnDefinition [, ...] ) \n\n" + "columnDefinition: \n" - + "column DataType [ [NOT] NULL] [PRIMARY KEY] \n" + "DataType: \n" - + "{ INTEGER | DOUBLE | VARCHAR | DATE | TIME |... }" - }; - static String[] dropTableHelp = { - "DROP TABLE ", "DROP TABLE table" - }; - static String[] createIndexHelp = { - "CREATE INDEX ", - "CREATE [UNIQUE] INDEX index ON \n" + "table (column [, ...])" - }; - static String[] dropIndexHelp = { - "DROP INDEX ", "DROP INDEX table.index" - }; - static String[] checkpointHelp = { - "CHECKPOINT", "(HSQLDB SQL only)" - }; - static String[] scriptHelp = { - "SCRIPT", "SCRIPT ['file']\n\n" + "(HSQLDB SQL only)" - }; - static String[] shutdownHelp = { - "SHUTDOWN", - "SHUTDOWN [COMPACT|IMMEDIATELY|SCRIPT]\n\n" + "(HSQLDB SQL only)" - }; - static String[] setHelp = { - "SET ", - - "SET AUTOCOMMIT { TRUE | FALSE }\n" - + "SET DATABASE COLLATION \"\"\n" - + "SET FILES CHECKPOINT DEFRAG \n" - + "SET DATABASE INITIAL SCHEMA \n" // - + "SET FILES LOG SIZE \n" // - + "SET MAXROWS maxrows\n" // - + "SET PASSWORD \n" // - + "SET FILES READ { ONLY | WRITE }\n" + "SET SCHEMA \n" - + "SET TABLE READ { ONLY | WRITE }\n" - + "SET TABLE SOURCE { ON | OFF }\n" - + "SET TABLE SOURCE \"\" [DESC]\n" + "\n\n" // - + "(HSQLDB SQL only)" - }; - static String[] testHelp = { - "-->>>TEST<<<-- ;\n" + "--#1000;\n" + "DROP TABLE Test IF EXISTS;\n" - + "CREATE TABLE Test(\n" + " Id INTEGER PRIMARY KEY,\n" - + " FirstName VARCHAR(20),\n" + " Name VARCHAR(50),\n" - + " ZIP INTEGER) ;\n" + "INSERT INTO Test \n" - + " VALUES(#,'Julia','Peterson-Clancy',#) ;\n" - + "UPDATE Test SET Name='Hans' WHERE Id=# ;\n" - + "SELECT * FROM Test WHERE Id=# ;\n" - + "DELETE FROM Test WHERE Id=# ;\n" + "DROP TABLE Test IF EXISTS;", - "This test script is parsed by the DatabaseManager\n" - + "It may be changed manually. Rules:\n" - + "- it must start with -->>>TEST<<<--.\n" - + "- each line must end with ';' (no spaces after)\n" - + "- lines starting with -- are comments\n" - + "- lines starting with --# means set new count\n" - }; - static String[] testDataSql = { - "SELECT * FROM Product", // - "SELECT * FROM Invoice", // - "SELECT * FROM Item", - "SELECT * FROM Customer a INNER JOIN Invoice i ON a.ID=i.CustomerID", - "SELECT * FROM Customer a LEFT OUTER JOIN Invoice i ON a.ID=i.CustomerID", - "SELECT * FROM Invoice d INNER JOIN Item i ON d.ID=i.InvoiceID", - "SELECT * FROM Customer WHERE Street LIKE '1%' ORDER BY Lastname", - "SELECT a.id, a.firstname, a.lastname, count(i.Total) \"COUNT\", " - + "COALESCE(sum(i.Total), 0) \"TOTAL\", COALESCE(AVG(i.Total),0) \"AVG\" FROM Customer a " - + "LEFT OUTER JOIN Invoice i ON a.ID=i.CustomerID GROUP BY a.id, a.firstname, a.lastname" - }; - - static String random(String[] s) { - return s[random(s.length)]; - } - - static int random(int i) { - return rRandom.nextInt(i); - } - - static void createTestTables(Statement sStatement) { - - String[] demo = { - "DROP TABLE Item IF EXISTS;", "DROP TABLE Invoice IF EXISTS;", - "DROP TABLE Product IF EXISTS;", "DROP TABLE Customer IF EXISTS;", - "CREATE TABLE Customer(ID INTEGER PRIMARY KEY,FirstName VARCHAR(20)," - + "LastName VARCHAR(20),Street VARCHAR(20),City VARCHAR(20));", - "CREATE TABLE Product(ID INTEGER PRIMARY KEY,Name VARCHAR(20)," - + "Price DECIMAL(10,2));", - "CREATE TABLE Invoice(ID INTEGER PRIMARY KEY,CustomerID INTEGER," - + "Total DECIMAL(10,2), FOREIGN KEY (CustomerId) " - + "REFERENCES Customer(ID) ON DELETE CASCADE);", - "CREATE TABLE Item(InvoiceID INTEGER,Item INTEGER," - + "ProductID INTEGER,Quantity INTEGER,Cost DECIMAL(10,2)," - + "PRIMARY KEY(InvoiceID,Item), " - + "FOREIGN KEY (InvoiceId) REFERENCES " - + "Invoice (ID) ON DELETE CASCADE, FOREIGN KEY (ProductId) " - + "REFERENCES Product(ID) ON DELETE CASCADE);" - }; - - for (int i = 0; i < demo.length; i++) { - - // drop table may fail - try { - sStatement.execute(demo[i]); - } catch (SQLException e) {} - } - } - - static String createTestData(Statement sStatement) throws SQLException { - - String[] name = { - "White", "Karsen", "Smith", "Ringer", "May", "King", "Fuller", - "Miller", "Ott", "Sommer", "Schneider", "Steel", "Peterson", - "Heiniger", "Clancy" - }; - String[] firstname = { - "Mary", "James", "Anne", "George", "Sylvia", "Robert", "Janet", - "Michael", "Andrew", "Bill", "Susanne", "Laura", "Bob", "Julia", - "John" - }; - String[] street = { - "Upland Pl.", "College Av.", "- 20th Ave.", "Seventh Av." - }; - String[] city = { - "New York", "Dallas", "Boston", "Chicago", "Seattle", - "San Francisco", "Berne", "Oslo", "Paris", "Lyon", "Palo Alto", - "Olten" - }; - String[] product = { - "Iron", "Ice Tea", "Clock", "Chair", "Telephone", "Shoe" - }; - int max = 50; - - for (int i = 0; i < max; i++) { - sStatement.execute("INSERT INTO Customer VALUES(" + i + ",'" - + random(firstname) + "','" + random(name) - + "','" + random(554) + " " + random(street) - + "','" + random(city) + "')"); - sStatement.execute("INSERT INTO Product VALUES(" + i + ",'" - + random(product) + " " + random(product) - + "'," + (20 + 2 * random(120)) + ")"); - } - - for (int i = 0; i < max; i++) { - sStatement.execute("INSERT INTO Invoice VALUES(" + i + "," - + random(max) + ",0.0)"); - - for (int j = random(20) + 2; j >= 0; j--) { - sStatement.execute("INSERT INTO Item VALUES(" + i + "," + j - + "," + random(max) + "," - + (1 + random(24)) + ",1.5)"); - } - } - - sStatement.execute("UPDATE Product SET Price=ROUND(Price*.1,2)"); - sStatement.execute( - "UPDATE Item SET Cost=Cost*" - + "(SELECT Price FROM Product prod WHERE ProductID=prod.ID)"); - sStatement.execute( - "UPDATE Invoice SET Total=(SELECT SUM(Cost*" - + "Quantity) FROM Item WHERE InvoiceID=Invoice.ID)"); - - return ("SELECT * FROM Customer"); - } - - /** - * Redid this file to remove sizing requirements and to make it faster - * Speeded it up 10 fold. - * - * @param file file path - */ - static String readFile(String file) { - - try { - FileReader reader = new FileReader(file); - BufferedReader read = new BufferedReader(reader); - StringBuilder b = new StringBuilder(); - String s = null; - int count = 0; - - while ((s = read.readLine()) != null) { - count++; - - b.append(s); - b.append('\n'); - } - - read.close(); - reader.close(); - - return b.toString(); - } catch (IOException e) { - return e.toString(); - } - } - - static void writeFile(String file, String text) { - - try { - FileWriter write = new FileWriter(file); - - write.write(text.toCharArray()); - write.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - static long testStatement(Statement sStatement, String sql, - int max) throws SQLException { - - long start = System.currentTimeMillis(); - - if (sql.indexOf('#') == -1) { - max = 1; - } - - for (int i = 0; i < max; i++) { - String s = sql; - - while (true) { - int j = s.indexOf("#r#"); - - if (j == -1) { - break; - } - - s = s.substring(0, j) + ((int) (Math.random() * i)) - + s.substring(j + 3); - } - - while (true) { - int j = s.indexOf('#'); - - if (j == -1) { - break; - } - - s = s.substring(0, j) + i + s.substring(j + 1); - } - - sStatement.execute(s); - } - - return (System.currentTimeMillis() - start); - } - - private DatabaseManagerCommon() {} -} diff --git a/database/hsqldb/src/org/hsqldb/util/DatabaseManagerSwing.java b/database/hsqldb/src/org/hsqldb/util/DatabaseManagerSwing.java deleted file mode 100644 index b11582e5..00000000 --- a/database/hsqldb/src/org/hsqldb/util/DatabaseManagerSwing.java +++ /dev/null @@ -1,2922 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Locale; -import java.util.Properties; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Insets; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JRadioButtonMenuItem; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTable; -import javax.swing.JTextArea; -import javax.swing.JToolBar; -import javax.swing.JTree; -import javax.swing.KeyStroke; -import javax.swing.RootPaneContainer; -import javax.swing.SwingUtilities; -import javax.swing.table.TableModel; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; - -// dmarshall@users - 20020101 - original swing port of DatabaseManager -// sqlbob@users 20020401 - patch 537501 by ulrivo - commandline arguments -// sqlbob@users 20020407 - patch 1.7.0 - reengineering and enhancements -// nickferguson@users 20021005 - patch 1.7.1 - enhancements -// deccles@users 2004 - 2008 - bug fixes and enhancements -// weconsultants@users 20041109 - version 1.8.0 - reengineering and enhancements: -// Added: Goodies 'Look and Feel'. -// Added: a Font Changer(Font Type\Style). -// Added: a Color Changer (foreground\background). -// Added: RowCounts for each JTree table nodes. -// Added: OneTouchExpandable attribute to JSplitPanes. -// Moved: setFramePosition code to a CommonSwing.setFramePositon() Method. -// Added: call to new method to handle exception processing (CommonSwing.errorMessage()); -// Added: Added a new pane added at the bottom of the Frame. (Status Icon and StatusLine). -// Added: 2 Methods (setStatusMessage()), one overrides the other. One to change the running status -// another to allow a message to be posted without changing the Status Icon if needed. -// Added: Added a customCursor for the current wait cursor -// Added: Ability to switch the current LAF while running (Native,Java or Motif) -// unsaved@users 2005xxxx - improvements and bug fixes -// fredt@users - version 2.5.0 - removed deprecated -// fredt@users - version 2.5.1 - enhancements - -/** - * Swing Tool for managing a JDBC database. - *
    - * {@code
    - *             Usage: java DatabaseManagerSwing [--options]
    - *             where options include:
    - *              --driver   jdbc driver class
    - *              --url           jdbc url
    - *              --user          username used for connection
    - *              --password  password for this user
    - *              --dir           default directory
    - *              --script        reads from script file
    - *              --urlid        get connection info from RC file
    - *              --rcfile        use instead of default (with urlid)
    - *              --noexit              Don't exit JVM
    - * }
    - * 
    - * - * Note that the sys-table switch will not work for Oracle, because Oracle - * does not categorize their system tables correctly in the JDBC Metadata. - * - * @author dmarshall@users - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.7.0 - */ -public class DatabaseManagerSwing extends JFrame -implements ActionListener, WindowListener, KeyListener, MouseListener { - - /* - * This is down here because it is an implementation note, not a - * Javadoc comment! - * Tue Apr 26 16:38:54 EDT 2005 - * Switched default switch method from "-switch" to "--switch" because - * "-switch" usage is ambiguous as used here. Single switches should - * be reserved for single-letter switches which can be mixed like - * "-u -r -l" = "-url". -blaine - */ - private static String homedir; - private boolean isOracle = false; // Need some workarounds for Oracle - - static { - homedir = System.getProperty("user.home"); - } - - ArrayList localActionList = new ArrayList(); - private JFrame jframe; - private static final String DEFAULT_RCFILE = homedir + "/dbmanager.rc"; - private static boolean TT_AVAILABLE = false; - - static { - try { - Class.forName(DatabaseManagerSwing.class.getPackage().getName() - + ".Transfer"); - - TT_AVAILABLE = true; - } catch (Throwable t) { - - //System.err.println("Failed to get " - //+ DatabaseManagerSwing.class.getPackage().getName() - //+ ".Transfer: " + t); - // Enable this print statement for debugging class access problems. - } - } - - private static final String HELP_TEXT = - "See the HSQLDB Utilities Guide, forums and mailing lists \n" - + "at http://hsqldb.org.\n\n" - + "Please paste the following version identifier with any\n" - + "problem reports or help requests: $Revision: 6544 $" - + (TT_AVAILABLE ? "" - : ("\n\nTransferTool classes are not in CLASSPATH.\n" - + "To enable the Tools menu, add 'transfer.jar' " - + "to your class path.")); - private static final String ABOUT_TEXT = - "$Revision: 6544 $ of DatabaseManagerSwing\n\n" - + "Copyright (c) 2001-2022, The HSQL Development Group.\n" - + "http://hsqldb.org (Utilities Guide available at this site).\n\n\n" - + "You may use and redistribute according to the HSQLDB\n" - + "license documented in the source code and at the web\n" - + "site above." - + (TT_AVAILABLE ? "\n\nTransferTool options are available." - : ""); - static final String NL = System.getProperty("line.separator"); - static final String NULL_STR = "[null]"; - static int iMaxRecent = 24; - Connection cConn; - Connection rowConn; // holds the connection for getting table row counts - DatabaseMetaData dMeta; - Statement sStatement; - JMenu mRecent; - String[] sRecent; - int iRecent; - JTextArea txtCommand; - JScrollPane txtCommandScroll; - JTree tTree; - JScrollPane tScrollPane; - DefaultTreeModel treeModel; - TableModel tableModel; - DefaultMutableTreeNode rootNode; - JPanel pResult; - long lTime; - GridSwing gResult; - - /** - * I think this is used to store model info whether we're using Grid - * output or not (this object is queried for data to display for - * text output mode). - * If so, the presentation-independent model part should be moved - * to an appropriately-named class instead of storing pure data in - * a Swing-specific class. - */ - JTable gResultTable; - JScrollPane gScrollPane; - JTextArea txtResult; - JScrollPane txtResultScroll; - JSplitPane nsSplitPane; // Contains query over results - JSplitPane ewSplitPane; // Contains tree beside nsSplitPane - boolean bHelp; - RootPaneContainer fMain; - static boolean bMustExit; - - /** Value of this variable only retained if huge input script read in. */ - String sqlScriptBuffer = null; - private boolean showSchemas = true; - private boolean showTooltips = true; - private boolean autoRefresh = true; - private boolean gridFormat = true; - - boolean displayRowCounts = false; - boolean showSys = false; - boolean showIndexDetails = true; - String currentLAF = null; - JPanel pStatus; - static JButton iReadyStatus; - JRadioButtonMenuItem rbAllSchemas = new JRadioButtonMenuItem("*"); - JMenuItem mitemAbout = new JMenuItem("About", 'A'); - JMenuItem mitemHelp = new JMenuItem("Help", 'H'); - JMenuItem mitemUpdateSchemas = new JMenuItem("Update Schemas"); - JCheckBoxMenuItem boxAutoCommit = - new JCheckBoxMenuItem(AUTOCOMMIT_BOX_TEXT); - JCheckBoxMenuItem boxLogging = new JCheckBoxMenuItem(LOGGING_BOX_TEXT); - JCheckBoxMenuItem boxShowSchemas = - new JCheckBoxMenuItem(SHOWSCHEMAS_BOX_TEXT); - JCheckBoxMenuItem boxAutoRefresh = - new JCheckBoxMenuItem(AUTOREFRESH_BOX_TEXT); - JCheckBoxMenuItem boxTooltips = new JCheckBoxMenuItem(SHOWTIPS_BOX_TEXT); - JCheckBoxMenuItem boxRowCounts = new JCheckBoxMenuItem(ROWCOUNTS_BOX_TEXT); - JCheckBoxMenuItem boxShowGrid = new JCheckBoxMenuItem(GRID_BOX_TEXT); - JCheckBoxMenuItem boxShowSys = new JCheckBoxMenuItem(SHOWSYS_BOX_TEXT); - - // Consider adding GTK and Plaf L&Fs. - JRadioButtonMenuItem rbNativeLF = - new JRadioButtonMenuItem("Native Look & Feel"); - JRadioButtonMenuItem rbJavaLF = - new JRadioButtonMenuItem("Java Look & Feel"); - JRadioButtonMenuItem rbMotifLF = - new JRadioButtonMenuItem("Motif Look & Feel"); - JLabel jStatusLine; - static String READY_STATUS = "Ready"; - private static final String AUTOCOMMIT_BOX_TEXT = "Autocommit mode"; - private static final String LOGGING_BOX_TEXT = "Logging mode"; - private static final String SHOWSCHEMAS_BOX_TEXT = "Show schemas"; - private static final String AUTOREFRESH_BOX_TEXT = "Auto-refresh tree"; - private static final String SHOWTIPS_BOX_TEXT = "Show Tooltips"; - private static final String ROWCOUNTS_BOX_TEXT = "Show row counts"; - private static final String SHOWSYS_BOX_TEXT = "Show system tables"; - private static final String GRID_BOX_TEXT = - "Show results in Grid (a.o.t. Text)"; - - // variables to hold the default cursors for these top level swing objects - // so we can restore them when we exit our thread - Cursor fMainCursor; - Cursor txtCommandCursor; - Cursor txtResultCursor; - HashMap tipMap = new HashMap(); - private final JMenu mnuSchemas = new JMenu("Schemas"); - - /** - * Wait Cursor - */ - - // Changed: (weconsultants@users): commonted out the, out of the box, cursor to use a custom cursor - private final Cursor waitCursor = new Cursor(Cursor.WAIT_CURSOR); - - // (ulrivo): variables set by arguments from the commandline - - static String defDirectory; - private String schemaFilter = null; - - public DatabaseManagerSwing() { - jframe = new JFrame("HyperSQL Database Manager"); - fMain = jframe; - } - - public DatabaseManagerSwing(JFrame frameIn) { - jframe = frameIn; - fMain = jframe; - } - - /** - * Run with --help switch for usage instructions. - * - * @param arg arguments - * @throws IllegalArgumentException for the obvious reason - */ - public static void main(String[] arg) { - - System.getProperties().put("sun.java2d.noddraw", "true"); - - // (ulrivo): read all arguments from the command line - String currentArg; - String lowerArg; - String urlid = null; - String rcFile = null; - String defDriver = "org.hsqldb.jdbc.JDBCDriver"; - String defURL = "jdbc:hsqldb:mem:."; - String defUser = "SA"; - String defPassword = ""; - boolean autoConnect = false; - boolean urlidConnect = false; - - bMustExit = true; - - for (int i = 0; i < arg.length; i++) { - currentArg = arg[i]; - lowerArg = arg[i].toLowerCase(); - - if (lowerArg.startsWith("--")) { - lowerArg = lowerArg.substring(1); - } - - if (lowerArg.equals("-noexit") || lowerArg.equals("-help")) { - - // - } else if (i == arg.length - 1) { - throw new IllegalArgumentException("No value for argument " - + currentArg); - } - - i++; - - if (lowerArg.equals("-driver")) { - defDriver = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-url")) { - defURL = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-user")) { - defUser = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-password")) { - defPassword = arg[i]; - autoConnect = true; - } else if (lowerArg.equals("-urlid")) { - urlid = arg[i]; - urlidConnect = true; - } else if (lowerArg.equals("-rcfile")) { - rcFile = arg[i]; - urlidConnect = true; - } else if (lowerArg.equals("-dir")) { - defDirectory = arg[i]; - } else if (lowerArg.equals("-script")) { - // dropped script processing - } else if (lowerArg.equals("-noexit")) { - bMustExit = false; - - i--; - } else if (lowerArg.equals("-help")) { - showUsage(); - - return; - } else { - /* Syntax ERRORS should either throw or exit with non-0 status. - * In our case, it may be unsafe to exit, so we throw. - * (I.e. should provide easy way for caller to programmatically - * determine that there was an invocation problem). - */ - throw new IllegalArgumentException( - "invalid argument " + currentArg + " try: java... " - + DatabaseManagerSwing.class.getName() + " --help"); - - // No reason to localize, since the main syntax message is - // not localized. - } - } - - DatabaseManagerSwing m = new DatabaseManagerSwing(); - - - m.main(); - - Connection c = null; - - m.setWaiting("Initializing"); - - try { - if (autoConnect && urlidConnect) { - throw new IllegalArgumentException( - "You may not specify both (urlid) AND (url/user/password)."); - } - - if (autoConnect) { - c = ConnectionDialogSwing.createConnection(defDriver, defURL, - defUser, defPassword); - } else if (urlidConnect) { - if (urlid == null) { - throw new IllegalArgumentException( - "You must specify an 'urlid' to use an RC file"); - } - - String rcfilepath = (rcFile == null) ? DEFAULT_RCFILE - : rcFile; - RCData rcdata = new RCData(new File(rcfilepath), urlid); - - c = rcdata.getConnection( - null, System.getProperty("javax.net.ssl.trustStore")); - } else { - c = ConnectionDialogSwing.createConnection(m.jframe, "Connect"); - } - } catch (Exception e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } finally { - m.setWaiting(null); - } - - if (c != null) { - m.connect(c); - } - - m.start(); - } - - /** - * This stuff is all quick, except for the refreshTree(). This unit can be - * kicked off in main Gui thread. The refreshTree will be backgrounded and - * this method will return. - * - * @param c Connection - */ - public void connect(Connection c) { - - schemaFilter = null; - - if (c == null) { - return; - } - - if (cConn != null) { - try { - cConn.close(); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - } - - cConn = c; - - // Added: (weconsultants@users) Need to barrow to get the table rowcounts - rowConn = c; - - try { - dMeta = cConn.getMetaData(); - isOracle = (dMeta.getDatabaseProductName().contains("Oracle")); - sStatement = cConn.createStatement(); - - updateAutoCommitBox(); - - // Workaround for EXTREME SLOWNESS getting this info from O. - showIndexDetails = !isOracle; - - Driver driver = DriverManager.getDriver(dMeta.getURL()); - ConnectionSetting newSetting = new ConnectionSetting( - dMeta.getDatabaseProductName(), driver.getClass().getName(), - dMeta.getURL(), - dMeta.getUserName().replaceAll("@localhost", ""), ""); - Hashtable settings = - ConnectionDialogCommon.loadRecentConnectionSettings(); - - ConnectionDialogCommon.addToRecentConnectionSettings(settings, - newSetting); - ConnectionDialogSwing.setConnectionSetting(newSetting); - refreshTree(); - clearResultPanel(); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } catch (IOException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } catch (Exception e) { - CommonSwing.errorMessage(e); - } - } - - private static void showUsage() { - - System.out.println( - "Usage: java DatabaseManagerSwing [--options]\n" - + "where options include:\n" - + " --help show this message\n" - + " --driver jdbc driver class\n" - + " --url jdbc url\n" - + " --user username used for connection\n" - + " --password password for this user\n" - + " --urlid use url/user/password/driver in rc file\n" - + " --rcfile (defaults to 'dbmanager.rc' in home dir)\n" - + " --dir default directory\n" - + " --script reads from script file\n" - + " --noexit do not call system.exit()"); - } - - private void insertTestData() { - - try { - DatabaseManagerCommon.createTestTables(sStatement); - txtCommand.setText( - DatabaseManagerCommon.createTestData(sStatement)); - - for (int i = 0; i < DatabaseManagerCommon.testDataSql.length; - i++) { - addToRecent(DatabaseManagerCommon.testDataSql[i]); - } - - executeCurrentSQL(); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - } - - private DBMPrefs prefs = null; - - public void main() { - - JMenu jmenu; - JMenuItem mitem; - - try { - prefs = new DBMPrefs(false); - } catch (Exception e) { -/* - System.err.println( - "Failed to load preferences. Proceeding with defaults:\n"); -*/ - } - - if (prefs == null) { - setLF(CommonSwing.Native); - } else { - autoRefresh = prefs.autoRefresh; - displayRowCounts = prefs.showRowCounts; - showSys = prefs.showSysTables; - showSchemas = prefs.showSchemas; - gridFormat = prefs.resultGrid; - showTooltips = prefs.showTooltips; - - setLF(prefs.laf); - } - - // (ulrivo): An actual icon. N.b., this adds some tips to the tip map - fMain.getContentPane().add(createToolBar(), "North"); - - if (fMain instanceof java.awt.Frame) { - ((java.awt.Frame) fMain).setIconImage( - CommonSwing.getIcon("Frame")); - } - - if (fMain instanceof java.awt.Window) { - ((java.awt.Window) fMain).addWindowListener(this); - } - - JMenuBar bar = new JMenuBar(); - - // used shortcuts: CERGTSIUDOLM - String[] fitems = { - "-Connect...", "-Close Connection", "--", "OOpen Script...", "-Save Script...", - "-Save Result...", "--", "-Exit" - }; - - jmenu = addMenu(bar, "File", fitems); - - // All actions after Connect and the divider are local. - for (int i = 3; i < jmenu.getItemCount(); i++) { - mitem = jmenu.getItem(i); - - if (mitem != null) { - localActionList.add(mitem); - } - } - - Object[] vitems = { - "RRefresh Tree", boxAutoRefresh, "--", boxRowCounts, boxShowSys, - boxShowSchemas, boxShowGrid - }; - - addMenu(bar, "View", vitems); - - String[] sitems = { - "SSELECT", "IINSERT", "UUPDATE", "DDELETE", "EEXECUTE", "---", - "-CREATE TABLE", "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", - "--", "CCOMMIT*", "LROLLBACK*", "-CHECKPOINT*", "-SCRIPT", "-SET", - "-SHUTDOWN", "--", "-Test Script" - }; - - addMenu(bar, "Command", sitems); - - mRecent = new JMenu("Recent"); - - mRecent.setMnemonic(KeyEvent.VK_R); - bar.add(mRecent); - - ButtonGroup lfGroup = new ButtonGroup(); - - lfGroup.add(rbNativeLF); - lfGroup.add(rbJavaLF); - lfGroup.add(rbMotifLF); - boxShowSchemas.setSelected(showSchemas); - boxShowGrid.setSelected(gridFormat); - boxTooltips.setSelected(showTooltips); - boxShowGrid.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, - InputEvent.CTRL_DOWN_MASK)); - boxAutoRefresh.setSelected(autoRefresh); - boxRowCounts.setSelected(displayRowCounts); - boxShowSys.setSelected(showSys); - rbNativeLF.setActionCommand("LFMODE:" + CommonSwing.Native); - rbJavaLF.setActionCommand("LFMODE:" + CommonSwing.Java); - rbMotifLF.setActionCommand("LFMODE:" + CommonSwing.Motif); - tipMap.put(mitemUpdateSchemas, "Refresh the schema list in this menu"); - tipMap.put(rbAllSchemas, "Display items in all schemas"); - tipMap.put(mitemAbout, "Display product information"); - tipMap.put(mitemHelp, "Display advice for obtaining help"); - tipMap.put(boxAutoRefresh, - "Refresh tree (and schema list) automatically" - + "when YOU modify database objects"); - tipMap.put(boxShowSchemas, - "Display object names in tree-like schemaname.basename"); - tipMap.put(rbNativeLF, - "Set Look and Feel to Native for your platform"); - tipMap.put(rbJavaLF, "Set Look and Feel to Java"); - tipMap.put(rbMotifLF, "Set Look and Feel to Motif"); - boxTooltips.setToolTipText("Display tooltips (hover text), like this"); - tipMap.put(boxAutoCommit, - "Shows current Auto-commit mode. Click to change"); - tipMap.put( - boxLogging, - "Shows current JDBC DriverManager logging mode. Click to change"); - tipMap.put(boxShowSys, "Show system tables in table tree to the left"); - tipMap.put(boxShowGrid, "Show query results in grid (in text if off)"); - tipMap.put(boxRowCounts, "Show row counts with table names in tree"); - boxAutoRefresh.setMnemonic(KeyEvent.VK_C); - boxShowSchemas.setMnemonic(KeyEvent.VK_Y); - boxAutoCommit.setMnemonic(KeyEvent.VK_A); - boxShowSys.setMnemonic(KeyEvent.VK_Y); - boxShowGrid.setMnemonic(KeyEvent.VK_G); - boxRowCounts.setMnemonic(KeyEvent.VK_C); - boxLogging.setMnemonic(KeyEvent.VK_L); - rbAllSchemas.setMnemonic(KeyEvent.VK_ASTERISK); - rbNativeLF.setMnemonic(KeyEvent.VK_N); - rbJavaLF.setMnemonic(KeyEvent.VK_J); - rbMotifLF.setMnemonic(KeyEvent.VK_M); - mitemUpdateSchemas.setMnemonic(KeyEvent.VK_U); - - Object[] soptions = { - - // Added: (weconsultants@users) New menu options - rbNativeLF, rbJavaLF, rbMotifLF, "--", "-Set Fonts", "--", - boxAutoCommit, "--", "-Disable MaxRows", "-Set MaxRows to 100", - "--", boxLogging, "--", "-Insert test data" - }; - - addMenu(bar, "Options", soptions); - - String[] stools = { - "-Dump", "-Restore", "-Transfer" - }; - - jmenu = addMenu(bar, "Tools", stools); - - jmenu.setEnabled(TT_AVAILABLE); - localActionList.add(jmenu); - - for (int i = 0; i < jmenu.getItemCount(); i++) { - mitem = jmenu.getItem(i); - - if (mitem != null) { - localActionList.add(mitem); - } - } - - mnuSchemas.setMnemonic(KeyEvent.VK_S); - bar.add(mnuSchemas); - - JMenu mnuHelp = new JMenu("Help"); - - mnuHelp.setMnemonic(KeyEvent.VK_H); - mnuHelp.add(mitemAbout); - mnuHelp.add(mitemHelp); - mnuHelp.add(boxTooltips); - rbAllSchemas.addActionListener(schemaListListener); - - // May be illegal: - mitemUpdateSchemas.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent actionevent) { - updateSchemaList(); - } - }); - mitemHelp.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent actionevent) { - - JOptionPane.showMessageDialog(fMain.getContentPane(), - HELP_TEXT, "HELP", - JOptionPane.INFORMATION_MESSAGE); - } - }); - mitemAbout.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent actionevent) { - - JOptionPane.showMessageDialog(fMain.getContentPane(), - ABOUT_TEXT, "About", - JOptionPane.INFORMATION_MESSAGE); - } - }); - boxTooltips.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent actionevent) { - - showTooltips = boxTooltips.isSelected(); - - resetTooltips(); - } - }); - bar.add(mnuHelp); - - if (fMain instanceof JFrame) { - ((JFrame) fMain).setJMenuBar(bar); - } - - initGUI(); - - sRecent = new String[iMaxRecent]; - - // Modified: (weconsultants@users)Mode code to CommonSwing for general use - CommonSwing.setFramePositon((JFrame) fMain); - - // Modified: (weconsultants@users) Changed from deprecated show() - ((Component) fMain).setVisible(true); - - - // Added: (weconsultants@users): For preloadng FontDialogSwing - FontDialogSwing.creatFontDialog(this); - - // This must be done AFTER all tip texts are put into the map - resetTooltips(); - txtCommand.requestFocus(); - } - - private JMenu addMenu(JMenuBar b, String name, Object[] items) { - - JMenu menu = new JMenu(name); - - menu.setMnemonic(name.charAt(0)); - addMenuItems(menu, items); - b.add(menu); - - return menu; - } - - private void addMenuItems(JMenu f, Object[] m) { - - /* - * This method needs to be completely written or just - * obliterated and we'll use the Menu objects directly. - * Problem is, passing in Strings for menu elements makes it - * extremely difficult to use non-text menu items (an important - * part of a good Gui), hot-keys, mnemonic keys, tooltips. - * Note the "trick" required here to set hot-keys. - */ - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - - for (int i = 0; i < m.length; i++) { - if (m[i].equals("--")) { - f.addSeparator(); - } else if (m[i].equals("---")) { - - // (ulrivo): full size on screen with less than 640 width - if (d.width >= 640) { - f.addSeparator(); - } else { - return; - } - } else { - JMenuItem item; - - if (m[i] instanceof JMenuItem) { - item = (JMenuItem) m[i]; - } else if (m[i] instanceof String) { - item = new JMenuItem(((String) m[i]).substring(1)); - - char c = ((String) m[i]).charAt(0); - - if (c != '-') { - KeyStroke key = - KeyStroke.getKeyStroke(c, InputEvent.CTRL_DOWN_MASK); - - item.setAccelerator(key); - } - } else { - throw new RuntimeException( - "Unexpected element for menu item creation: " - + m[i].getClass().getName()); - } - - item.addActionListener(this); - f.add(item); - } - } - } - - public void keyPressed(KeyEvent k) {} - - public void keyReleased(KeyEvent k) {} - - public void keyTyped(KeyEvent k) { - - if (k.getKeyChar() == '\n' && k.isControlDown()) { - k.consume(); - executeCurrentSQL(); - } - } - - public void actionPerformed(ActionEvent ev) { - - String s = ev.getActionCommand(); - - if (s == null) { - if (ev.getSource() instanceof JMenuItem) { - s = ((JMenuItem) ev.getSource()).getText(); - } - } - - if (s == null) {} - else if (s.equals("Exit")) { - windowClosing(null); - } else if (s.equals("Transfer")) { - Transfer.work(null); - } else if (s.equals("Dump")) { - Transfer.work(new String[]{ "-d" }); - } else if (s.equals("Restore")) { - JOptionPane.showMessageDialog( - fMain.getContentPane(), - "Use Ctrl-R or the View menu to\n" - + "update nav. tree after Restoration", "Suggestion", - JOptionPane.INFORMATION_MESSAGE); - - // Regardless of whether autoRefresh is on, half of - // Restore runs asynchronously, so we could only - // update the tree from within the Transfer class. - Transfer.work(new String[]{ "-r" }); - - // Would be better to put the modal suggestion here, after the - // user selects the import file, but that messes up the z - // layering of the 3 windows already displayed. - } else if (s.equals(LOGGING_BOX_TEXT)) { - setLogToSystem(boxLogging.isSelected()); - } else if (s.equals(AUTOREFRESH_BOX_TEXT)) { - autoRefresh = boxAutoRefresh.isSelected(); - - refreshTree(); - } else if (s.equals("Refresh Tree")) { - refreshTree(); - } else if (s.startsWith("#")) { - int i = Integer.parseInt(s.substring(1)); - - txtCommand.setText(sRecent[i]); - } else if (s.equals("Connect...")) { - Connection newCon; - - try { - setWaiting("Connecting"); - - newCon = ConnectionDialogSwing.createConnection(jframe, - "Connect"); - } finally { - setWaiting(null); - } - - connect(newCon); - } else if (s.equals("Close Connection")) { - if (cConn != null) { - try { - cConn.close(); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - - cConn = null; - dMeta = null; - - rootNode.setUserObject("Connection"); - - directRefreshTree(); - } - } else if (s.equals(GRID_BOX_TEXT)) { - gridFormat = boxShowGrid.isSelected(); - - displayResults(); - } else if (s.equals("Open Script...")) { - JFileChooser f = new JFileChooser("."); - - f.setDialogTitle("Open Script..."); - - // (ulrivo): set default directory if set from command line - if (defDirectory != null) { - f.setCurrentDirectory(new File(defDirectory)); - } - - int option = f.showOpenDialog((Component) fMain); - - if (option == JFileChooser.APPROVE_OPTION) { - File file = f.getSelectedFile(); - - if (file != null) { - sqlScriptBuffer = - DatabaseManagerCommon.readFile(file.getAbsolutePath()); - - if (4096 <= sqlScriptBuffer.length()) { - int eoThirdLine = sqlScriptBuffer.indexOf('\n'); - - if (eoThirdLine > 0) { - eoThirdLine = sqlScriptBuffer.indexOf('\n', - eoThirdLine - + 1); - } - - if (eoThirdLine > 0) { - eoThirdLine = sqlScriptBuffer.indexOf('\n', - eoThirdLine - + 1); - } - - if (eoThirdLine < 1) { - eoThirdLine = 100; - } - - txtCommand.setText( - "............... Script File loaded: " + file - + " ..................... \n" - + "............... Click Execute or Clear " - + "...................\n" - + sqlScriptBuffer.substring(0, eoThirdLine + 1) - + "........................................." - + "................................\n" - + "..........................................." - + "..............................\n"); - txtCommand.setEnabled(false); - } else { - txtCommand.setText(sqlScriptBuffer); - - sqlScriptBuffer = null; - - txtCommand.setEnabled(true); - } - } - } - } else if (s.equals("Save Script...")) { - JFileChooser f = new JFileChooser("."); - - f.setDialogTitle("Save Script"); - - // (ulrivo): set default directory if set from command line - if (defDirectory != null) { - f.setCurrentDirectory(new File(defDirectory)); - } - - int option = f.showSaveDialog((Component) fMain); - - if (option == JFileChooser.APPROVE_OPTION) { - File file = f.getSelectedFile(); - - if (file != null) { - DatabaseManagerCommon.writeFile(file.getAbsolutePath(), - txtCommand.getText()); - } - } - } else if (s.equals("Save Result...")) { - JFileChooser f = new JFileChooser("."); - - f.setDialogTitle("Save Result..."); - - // (ulrivo): set default directory if set from command line - if (defDirectory != null) { - f.setCurrentDirectory(new File(defDirectory)); - } - - int option = f.showSaveDialog((Component) fMain); - - if (option == JFileChooser.APPROVE_OPTION) { - File file = f.getSelectedFile(); - - if (file != null) { - showResultInText(); - DatabaseManagerCommon.writeFile(file.getAbsolutePath(), - txtResult.getText()); - } - } - } else if (s.equals(SHOWSYS_BOX_TEXT)) { - showSys = boxShowSys.isSelected(); - - refreshTree(); - } else if (s.equals(ROWCOUNTS_BOX_TEXT)) { - displayRowCounts = boxRowCounts.isSelected(); - - refreshTree(); - } else if (s.startsWith("LFMODE:")) { - setLF(s.substring("LFMODE:".length())); - } else if (s.equals("Set Fonts")) { - - // Added: (weconsultants@users) - FontDialogSwing.creatFontDialog(this); - } else if (s.equals(AUTOCOMMIT_BOX_TEXT)) { - try { - cConn.setAutoCommit(boxAutoCommit.isSelected()); - } catch (SQLException e) { - boxAutoCommit.setSelected(!boxAutoCommit.isSelected()); - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - } else if (s.equals("COMMIT*")) { - try { - cConn.commit(); - showHelp(new String[] { - "", "COMMIT executed" - }); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - } else if (s.equals("Insert test data")) { - insertTestData(); - refreshTree(); - } else if (s.equals("ROLLBACK*")) { - try { - cConn.rollback(); - showHelp(new String[] { - "", "ROLLBACK executed" - }); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - } else if (s.equals("Disable MaxRows")) { - try { - sStatement.setMaxRows(0); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - } else if (s.equals("Set MaxRows to 100")) { - try { - sStatement.setMaxRows(100); - } catch (SQLException e) { - CommonSwing.errorMessage(e); - } - } else if (s.equals("SELECT")) { - showHelp(DatabaseManagerCommon.selectHelp); - } else if (s.equals("INSERT")) { - showHelp(DatabaseManagerCommon.insertHelp); - } else if (s.equals("UPDATE")) { - showHelp(DatabaseManagerCommon.updateHelp); - } else if (s.equals("DELETE")) { - showHelp(DatabaseManagerCommon.deleteHelp); - } else if (s.equals("EXECUTE")) { - executeCurrentSQL(); - } else if (s.equals("CREATE TABLE")) { - showHelp(DatabaseManagerCommon.createTableHelp); - } else if (s.equals("DROP TABLE")) { - showHelp(DatabaseManagerCommon.dropTableHelp); - } else if (s.equals("CREATE INDEX")) { - showHelp(DatabaseManagerCommon.createIndexHelp); - } else if (s.equals("DROP INDEX")) { - showHelp(DatabaseManagerCommon.dropIndexHelp); - } else if (s.equals("CHECKPOINT*")) { - try { - cConn.createStatement().executeUpdate("CHECKPOINT"); - showHelp(new String[] { - "", "CHECKPOINT executed" - }); - } catch (SQLException e) { - CommonSwing.errorMessage(e); - } - } else if (s.equals("SCRIPT")) { - showHelp(DatabaseManagerCommon.scriptHelp); - } else if (s.equals("SHUTDOWN")) { - showHelp(DatabaseManagerCommon.shutdownHelp); - } else if (s.equals("SET")) { - showHelp(DatabaseManagerCommon.setHelp); - } else if (s.equals("Test Script")) { - showHelp(DatabaseManagerCommon.testHelp); - } else if (s.equals(SHOWSCHEMAS_BOX_TEXT)) { - showSchemas = boxShowSchemas.isSelected(); - - refreshTree(); - } else { - throw new RuntimeException("Unexpected action triggered: " + s); - } - } - - private void displayResults() { - - if (gridFormat) { - setResultsInGrid(); - } else { - setResultsInText(); - } - } - - private void setResultsInGrid() { - - pResult.removeAll(); - pResult.add(gScrollPane, BorderLayout.CENTER); - pResult.doLayout(); - gResult.fireTableChanged(null); - pResult.repaint(); - } - - private void setResultsInText() { - - pResult.removeAll(); - pResult.add(txtResultScroll, BorderLayout.CENTER); - pResult.doLayout(); - showResultInText(); - pResult.repaint(); - } - - private void showHelp(String[] help) { - - txtCommand.setText(help[0]); - - bHelp = true; - - pResult.removeAll(); - pResult.add(txtResultScroll, BorderLayout.CENTER); - pResult.doLayout(); - txtResult.setText(help[1]); - pResult.repaint(); - txtCommand.requestFocus(); - txtCommand.setCaretPosition(help[0].length()); - } - - public void windowActivated(WindowEvent e) {} - - public void windowDeactivated(WindowEvent e) {} - - public void windowClosed(WindowEvent e) {} - - public void windowDeiconified(WindowEvent e) {} - - public void windowIconified(WindowEvent e) {} - - public void windowOpened(WindowEvent e) {} - - public void windowClosing(WindowEvent ev) { - - stop(); - - try { - if (cConn != null) { - cConn.close(); - } - - if (prefs != null) { - prefs.autoRefresh = autoRefresh; - prefs.showRowCounts = displayRowCounts; - prefs.showSysTables = showSys; - prefs.showSchemas = showSchemas; - prefs.resultGrid = gridFormat; - prefs.showTooltips = showTooltips; - prefs.laf = currentLAF; - - prefs.store(); - } - } catch (Exception e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - - if (fMain instanceof java.awt.Window) { - ((java.awt.Window) fMain).dispose(); - } - - if (bMustExit) { - System.exit(0); - } - } - - private void clear() { - - sqlScriptBuffer = null; - - txtCommand.setText(""); - txtCommand.setEnabled(true); - } - - private String busyText = null; - - private void backgroundIt(Runnable r, String description) { - - if (busyText != null) { - Toolkit.getDefaultToolkit().beep(); - - return; - } - - // set Waiting mode here. Inverse op must be called by final() - // in the Thread.run() of every background thread. - setWaiting(description); - SwingUtilities.invokeLater(r); - } - - private void clearResultPanel() { - - gResult.setHead(new Object[0]); - gResult.clear(); - - if (gridFormat) { - gResult.fireTableChanged(null); - } else { - showResultInText(); - } - } - - public void setWaiting(String description) { - - busyText = description; - - if (busyText == null) { - - // restore the cursors we saved - if (fMain instanceof java.awt.Frame) { - ((java.awt.Frame) fMain).setCursor(fMainCursor); - } else { - ((Component) fMain).setCursor(fMainCursor); - } - - txtCommand.setCursor(txtCommandCursor); - txtResult.setCursor(txtResultCursor); - - /* @todo: Enable actionButtons */ - } else { - - // save the old cursors - if (fMainCursor == null) { - fMainCursor = ((fMain instanceof java.awt.Frame) - ? (((java.awt.Frame) fMain).getCursor()) - : (((Component) fMain).getCursor())); - txtCommandCursor = txtCommand.getCursor(); - txtResultCursor = txtResult.getCursor(); - } - - // set the cursors to the wait cursor - if (fMain instanceof java.awt.Frame) { - ((java.awt.Frame) fMain).setCursor(waitCursor); - } else { - ((Component) fMain).setCursor(waitCursor); - } - - txtCommand.setCursor(waitCursor); - txtResult.setCursor(waitCursor); - - /* @todo: Disable actionButtons */ - } - - setStatusLine(busyText, ((busyText == null) ? gResult.getRowCount() - : 0)); - } - - private final Runnable enableButtonRunnable = new Runnable() { - - public void run() { - jbuttonClear.setEnabled(true); - jbuttonExecute.setEnabled(true); - } - }; - private final Runnable disableButtonRunnable = new Runnable() { - - public void run() { - jbuttonClear.setEnabled(false); - jbuttonExecute.setEnabled(false); - } - }; - private Thread buttonUpdaterThread = null; - private static final int BUTTON_CHECK_PERIOD = 500; - private final Runnable buttonUpdater = new Runnable() { - - public void run() { - - boolean havesql; - - while (true) { - try { - Thread.sleep(BUTTON_CHECK_PERIOD); - } catch (InterruptedException ie) {} - - if (buttonUpdaterThread == null) { // Pointer to me - return; - } - - havesql = (txtCommand.getText().length() > 0); - - if (jbuttonClear.isEnabled() != havesql) { - SwingUtilities.invokeLater(havesql ? enableButtonRunnable - : disableButtonRunnable); - } - } - } - }; - private JButton jbuttonClear; - private JButton jbuttonExecute; - - public void start() { - - if (buttonUpdaterThread == null) { - buttonUpdaterThread = new Thread(buttonUpdater); - } - - buttonUpdaterThread.start(); - } - - public void stop() { - - System.err.println("Stopping"); - - Thread t = buttonUpdaterThread; - - if (t != null) { - t.setContextClassLoader(null); - } - - buttonUpdaterThread = null; - } - - private final Runnable treeRefreshRunnable = new Runnable() { - - public void run() { - - try { - directRefreshTree(); - } catch (RuntimeException re) { - CommonSwing.errorMessage(re); - - throw re; - } finally { - setWaiting(null); - } - } - }; - - /** - * Schedules to run in a Gui-safe thread - */ - protected void executeCurrentSQL() { - - if (txtCommand.getText().length() < 1) { - CommonSwing.errorMessage("No SQL to execute"); - - return; - } - - backgroundIt(new StatementExecRunnable(), "Executing SQL"); - } - - protected class StatementExecRunnable implements Runnable { - - public void run() { - - gResult.clear(); - - try { - if (txtCommand.getText().startsWith("-->>>TEST<<<--")) { - testPerformance(); - } else { - executeSQL(); - } - - updateResult(); - displayResults(); - updateAutoCommitBox(); - - // System.gc(); - } catch (RuntimeException re) { - CommonSwing.errorMessage(re); - - throw re; - } finally { - setWaiting(null); - } - } - } - - private void executeSQL() { - - String[] g = new String[1]; - String sql; - - try { - lTime = System.nanoTime(); - sql = ((sqlScriptBuffer == null ? txtCommand.getText() - : sqlScriptBuffer)); - - if (sStatement == null) { - g[0] = "no connection"; - - gResult.setHead(g); - - return; - } - - sStatement.execute(sql); - - lTime = System.nanoTime() - lTime; - - int r = sStatement.getUpdateCount(); - - if (r == -1) { - ResultSet rs = sStatement.getResultSet(); - - try { - formatResultSet(rs); - } catch (Throwable t) { - g[0] = "Error displaying the ResultSet"; - - gResult.setHead(g); - - String s = t.getMessage(); - - g[0] = s; - - gResult.addRow(g); - } - } else if (sStatement.getMoreResults()) { // repeated for if a procedure returns a result set - ResultSet rs = sStatement.getResultSet(); - - try { - formatResultSet(rs); - } catch (Throwable t) { - g[0] = "Error displaying the ResultSet"; - - gResult.setHead(g); - - String s = t.getMessage(); - - g[0] = s; - - gResult.addRow(g); - } - } else { - g[0] = "update count"; - - gResult.setHead(g); - - g[0] = "" + r; - - gResult.addRow(g); - } - - if (sqlScriptBuffer == null) { - addToRecent(sql); - txtCommand.setEnabled(true); // clear() does this otherwise - } else { - clear(); - } - } catch (SQLException e) { - lTime = System.nanoTime() - lTime; - g[0] = "SQL Error"; - - gResult.setHead(g); - - String s = e.getMessage(); - - s += " / Error Code: " + e.getErrorCode(); - s += " / State: " + e.getSQLState(); - g[0] = s; - - gResult.addRow(g); - - // Added: (weconsultants@users) - // CommonSwing.errorMessage(e); - return; - } - - if (autoRefresh) { - - // We're already running in a "busy" thread. Just update the - // status text. - setStatusLine("Refreshing object tree", 0); - - String upper = sql.toUpperCase(Locale.ENGLISH); - - // This test can be very liberal. Too liberal will just do - // some extra refreshes. Too conservative will display - // obsolete info. - if (upper.contains("ALTER") || upper.contains("DROP") - || upper.contains("CREATE")) { - directRefreshTree(); - } - } - } - - /** - * Could somebody explain what the purpose of this method is? - * Contrary to the method name, it looks like it displays - * results only if gridFormat is off (seems like it does - * nothing otherwise, except for clearing help text and moving focus). - */ - private void updateResult() { - - if (gridFormat) { - - // in case 'help' has removed the grid - if (bHelp) { - pResult.removeAll(); - pResult.add(gScrollPane, BorderLayout.CENTER); - pResult.doLayout(); - gResult.fireTableChanged(null); - pResult.repaint(); - - bHelp = false; - } - } else { - showResultInText(); - } - - txtCommand.selectAll(); - txtCommand.requestFocus(); - } - - /** - * We let Swing handle displaying nulls (which it generally does by - * printing nothing for them), except for the case of database - * VARCHARs, because this is the only class where there is any - * ambiguity about whether there is a null stored or not. - */ - private void formatResultSet(ResultSet r) { - - if (r == null) { - String[] g = new String[1]; - - g[0] = "Result"; - - gResult.setHead(g); - - g[0] = "(empty)"; - - gResult.addRow(g); - - return; - } - - try { - ResultSetMetaData m = r.getMetaData(); - int col = m.getColumnCount(); - Object[] h = new Object[col]; - boolean[] nullLiteral = new boolean[col]; - - for (int i = 1; i <= col; i++) { - h[i - 1] = m.getColumnLabel(i); - switch(m.getColumnType(i)) { - case java.sql.Types.CHAR: - case java.sql.Types.VARCHAR: - case java.sql.Types.VARBINARY: - nullLiteral[i - 1] = true; - } - } - - gResult.setHead(h); - - while (r.next()) { - for (int i = 1; i <= col; i++) { - try { - h[i - 1] = r.getObject(i); - - if (r.wasNull()) { - h[i - 1] = (nullLiteral[i - 1] ? NULL_STR : null); - } else if (m.getColumnType(i) == java.sql.Types.VARBINARY || - m.getColumnType(i) == java.sql.Types.BINARY) { - h[i - 1] = r.getString(i); - } - } catch (SQLException e) {} - } - - gResult.addRow(h); - } - - r.close(); - } catch (SQLException e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - } - - private void testPerformance() { - - String all = txtCommand.getText(); - StringBuilder b = new StringBuilder(); - long total = 0; - - lTime = 0; - - for (int i = 0; i < all.length(); i++) { - char c = all.charAt(i); - - if (c != '\n') { - b.append(c); - } - } - - all = b.toString(); - - String[] g = new String[4]; - - g[0] = "ms"; - g[1] = "count"; - g[2] = "sql"; - g[3] = "error"; - - gResult.setHead(g); - - int max = 1; - - lTime = System.nanoTime() - lTime; - - while (!all.equals("")) { - int i = all.indexOf(';'); - String sql; - - if (i != -1) { - sql = all.substring(0, i); - all = all.substring(i + 1); - } else { - sql = all; - all = ""; - } - - if (sql.startsWith("--#")) { - max = Integer.parseInt(sql.substring(3)); - - continue; - } else if (sql.startsWith("--")) { - continue; - } - - g[2] = sql; - - long l = 0; - - try { - l = DatabaseManagerCommon.testStatement(sStatement, sql, max); - total += l; - g[0] = "" + l; - g[1] = "" + max; - g[3] = ""; - } catch (SQLException e) { - g[0] = g[1] = "n/a"; - g[3] = e.toString(); - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - - gResult.addRow(g); - System.out.println(l + " ms : " + sql); - } - - g[0] = "" + total; - g[1] = "total"; - g[2] = ""; - - gResult.addRow(g); - - lTime = System.nanoTime() - lTime; - } - - private void showResultInText() { - - Object[] col = gResult.getHead(); - int width = col.length; - int[] size = new int[width]; - ArrayList data = gResult.getData(); - Object[] row; - int height = data.size(); - - for (int i = 0; i < width; i++) { - size[i] = col[i].toString().length(); - } - - for (int i = 0; i < height; i++) { - row = data.get(i); - - for (int j = 0; j < width; j++) { - String item = ((row[j] == null) ? "" - : row[j].toString()); - int l = item.length(); - - if (l > size[j]) { - size[j] = l; - } - } - } - - StringBuilder b = new StringBuilder(); - - for (int i = 0; i < width; i++) { - b.append(col[i]); - - for (int l = col[i].toString().length(); l <= size[i]; l++) { - b.append(' '); - } - } - - b.append(NL); - - for (int i = 0; i < width; i++) { - for (int l = 0; l < size[i]; l++) { - b.append('-'); - } - - b.append(' '); - } - - b.append(NL); - - for (int i = 0; i < height; i++) { - row = data.get(i); - - for (int j = 0; j < width; j++) { - String item = ((row[j] == null) ? "" - : row[j].toString()); - - b.append(item); - - for (int l = item.length(); l <= size[j]; l++) { - b.append(' '); - } - } - - b.append(NL); - } - - // b.append(NL + height + " row(s) in " + lTime + " ms"); - // There is no reason why this report should be text-output-specific. - // Moving it to bottom of the setWaiting method (where the report - // gets written to the status line). - // I'm only doing the rowcount now. Add the time report there if - // you are so inclined. - txtResult.setText(b.toString()); - } - - private void addToRecent(String s) { - - for (int i = 0; i < iMaxRecent; i++) { - if (s.equals(sRecent[i])) { - return; - } - } - - if (sRecent[iRecent] != null) { - mRecent.remove(iRecent); - } - - sRecent[iRecent] = s; - - if (s.length() > 43) { - s = s.substring(0, 40) + "..."; - } - - JMenuItem item = new JMenuItem(s); - - item.setActionCommand("#" + iRecent); - item.addActionListener(this); - mRecent.insert(item, iRecent); - - iRecent = (iRecent + 1) % iMaxRecent; - } - - // empty implementations for mouse listener. We're only using - // mouseReleased - public final void mouseClicked(final MouseEvent mouseEvent) {} - - public final void mouseEntered(final MouseEvent mouseEvent) {} - - public final void mouseExited(final MouseEvent mouseEvent) {} - - // Check for handlePopup in both mousePressed and mouseReleased. According to - // MouseEvent javadocs it's necessary for cross platform compatibility. - // We keep a record of the last alreadyHandled mouseEvent so we don't do it twice. - private MouseEvent alreadyHandled = null; - - // mousePressed calls handlePopup, which creates the context-sensitive - // helper menu. - public final void mousePressed(final MouseEvent e) { - - if (alreadyHandled == e) { - return; - } - - handlePopup(e); - - alreadyHandled = e; - } - - // mouseReleased calls handlePopup, which creates the context-sensitive - // helper menu. - public final void mouseReleased(final MouseEvent e) { - - if (alreadyHandled == e) { - return; - } - - handlePopup(e); - - alreadyHandled = e; - } - - // based on the table or column right-clicked on, create some helper - // actions for common sql statements - public final void handlePopup(MouseEvent e) { - - //System.out.println("Handle popup"); - // if this is not a mouse action for popups then do nothing and return - if (!e.isPopupTrigger()) { - return; - } - - // make sure the source of this mouse event was from the tree - Object source = e.getSource(); - - if (!(source instanceof JTree)) { - return; - } - - JTree tree = (JTree) source; - TreePath treePath = tree.getPathForLocation(e.getX(), e.getY()); - - // if we couldn't find a tree path that corresponds to the - // right-click, then return - if (treePath == null) { - return; - } - - // create the popup and menus - JPopupMenu popup = new JPopupMenu(); - JMenuItem menuItem; - String[] menus = new String[] { - "Select", "Delete", "Update", "Insert" - }; - - // loop throught the menus we want to create, making a PopupListener - // for each one - for (int i = 0; i < menus.length; i++) { - PopupListener popupListener = new PopupListener(menus[i], - treePath); - String title = popupListener.toString(); - - if (title == null) { - return; - } - - // Some of the menu names can be quite long (especially insert). - // If it's too long, abbreviate it - if (title.length() > 40) { - title = title.substring(0, 40) + "..."; - } - - menuItem = new JMenuItem(title); - - menuItem.addActionListener(popupListener); - popup.add(menuItem); - } - - popup.show(e.getComponent(), e.getX(), e.getY()); - } - - // handles the creation of the command when a popup is triggered - private class PopupListener implements ActionListener { - - // used to identify depth while right clicking in tree. - public static final int DEPTH_URL = 1; - public static final int DEPTH_TABLE = 2; - public static final int DEPTH_COLUMN = 3; - String command; - TreePath treePath; - TreePath tablePath; - TreePath columnPath; - String table = null; - String column = null; - - PopupListener(String command, TreePath treePath) { - - super(); - - this.command = command; - this.treePath = treePath; - } - - // when the popup is triggered, create a command string and set it in - // the txtCommand buffer - public void actionPerformed(ActionEvent ae) { - txtCommand.setText(getCommandString()); - } - - // text to display when added to a menu - public String toString() { - return getCommandString(); - } - - // - public String getCommandString() { - - int treeDepth = treePath.getPathCount(); - - // if we are at TABLE depth, set tablePath and table for use later - if (treeDepth == DEPTH_URL) { - return ""; - } - - if (treeDepth == DEPTH_TABLE) { - tablePath = treePath; - table = treePath.getPathComponent(DEPTH_TABLE - 1).toString(); - } - - // if we are at TABLE depth, set columnPath, column, tablePath and - // table for use later - if (treeDepth == DEPTH_COLUMN) { - tablePath = treePath.getParentPath(); - table = treePath.getPathComponent(DEPTH_TABLE - 1).toString(); - columnPath = treePath; - column = treePath.getPathComponent(DEPTH_COLUMN - - 1).toString(); - } - - // handle command "SELECT". Use table and column if set. - if (command.toUpperCase().equals("SELECT")) { - String result = "SELECT * FROM " + quoteTableName(table); - - if (column != null) { - DefaultMutableTreeNode childNode = - (DefaultMutableTreeNode) treePath - .getLastPathComponent(); - String childName; - boolean isChar; - - if (childNode.getChildCount() > 0) { - childName = childNode.getFirstChild().toString(); - isChar = childName.contains("CHAR"); - result += " WHERE " + quoteObjectName(column); - - if (isChar) { - result += " LIKE '%%'"; - } else { - result += " = "; - } - } - } - - return result; - } - - // handle command "UPDATE". Use table and column if set. - else if (command.toUpperCase().equals("UPDATE")) { - String result = "UPDATE " + quoteTableName(table) + " SET "; - - if (column != null) { - result += quoteObjectName(column) + " = "; - } - - return result; - } - - // handle command "DELETE". Use table and column if set. - else if (command.toUpperCase().equals("DELETE")) { - String result = "DELETE FROM " + quoteTableName(table); - - if (column != null) { - DefaultMutableTreeNode childNode = - (DefaultMutableTreeNode) treePath - .getLastPathComponent(); - String childName; - boolean isChar; - - if (childNode.getChildCount() > 0) { - childName = childNode.getFirstChild().toString(); - isChar = childName.contains("CHAR"); - result += " WHERE " + quoteObjectName(column); - - if (isChar) { - result += " LIKE '%%'"; - } else { - result += " = "; - } - } - } - - return result; - } - - // handle command "INSERT". Use table and column if set. - else if (command.toUpperCase().equals("INSERT")) { - TreeNode tableNode; - Enumeration enumer; - String columns = ""; - String values = " "; - String comma = ""; - String quote; - - // build a string that includes all the columns that need to - // be added, with a parenthesied list of commas, suitable for - // inserting values into. - if (tablePath == null) { - return null; - } - - tableNode = (TreeNode) tablePath.getLastPathComponent(); - enumer = tableNode.children(); - - while (enumer.hasMoreElements()) { - Object o = enumer.nextElement(); - - if (o.toString().equals("Indices")) { - continue; - } - - DefaultMutableTreeNode childNode = - (DefaultMutableTreeNode) o; - String childName; - - if (childNode.getChildCount() == 0) { - continue; - } else { - childName = childNode.getFirstChild().toString(); - } - - // If our first child (type) is some sort of char, use '' - // in the string. Makes is more obvious to the user when - // they need to use a string - if (childName.contains("CHAR")) { - quote = "''"; - } else { - quote = ""; - } - - columns += comma + quoteObjectName(o.toString()); - values += comma + quote; - comma = ", "; - } - - return "INSERT INTO " + quoteTableName(table) + "\n( " - + columns + " )\nVALUES (" + values + ")"; - } else { - return "Got here in error " + command - + ". Should never happen"; - } - } - } - - /** - * Perform a limited check (inconclusive) and quote object name if required. - * Gives wrong result if a quoted name contains a dot. - */ - private String quoteTableName(String name) { - - int dot = name.indexOf("."); - - if (dot < 0) { - int bracket = name.indexOf(" ("); - - if (bracket >= 0) { - name = name.substring(0, bracket); - } - - return quoteObjectName(name); - } - - String partOne = name.substring(0, dot); - String partTwo = name.substring(dot + 1); - int bracket = partTwo.indexOf(" ("); - - if (bracket >= 0) { - partTwo = partTwo.substring(0, bracket); - } - - return quoteObjectName(partOne) + '.' + quoteObjectName(partTwo); - } - - /** - * perform a limited check (inconclusive) and quote object name if required - */ - private String quoteObjectName(String name) { - -/* - if (name.toUpperCase().equals(name) && name.indexOf(' ') < 0) { - return name; - } -*/ - return "\"" + name + "\""; - } - - private void initGUI() { - - JPanel pCommand = new JPanel(); - - pResult = new JPanel(); - nsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pCommand, - pResult); - - // Added: (weconsultants@users) - nsSplitPane.setOneTouchExpandable(true); - pCommand.setLayout(new BorderLayout()); - pResult.setLayout(new BorderLayout()); - - Font fFont = new Font("Dialog", Font.PLAIN, 12); - - txtCommand = new JTextArea(7, 40); - - txtCommand.setMargin(new Insets(5, 5, 5, 5)); - txtCommand.addKeyListener(this); - - txtCommandScroll = new JScrollPane(txtCommand); - txtResult = new JTextArea(25, 40); - - txtResult.setMargin(new Insets(5, 5, 5, 5)); - - txtResultScroll = new JScrollPane(txtResult); - - txtCommand.setFont(fFont); - txtResult.setFont(new Font("Courier", Font.PLAIN, 12)); - pCommand.add(txtCommandScroll, BorderLayout.CENTER); - - gResult = new GridSwing(); - - TableSorter sorter = new TableSorter(gResult); - - tableModel = sorter; - gResultTable = new JTable(sorter); - - sorter.setTableHeader(gResultTable.getTableHeader()); - - gScrollPane = new JScrollPane(gResultTable); - - gResultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - gResult.setJTable(gResultTable); - - //getContentPane().setLayout(new BorderLayout()); - pResult.add(gScrollPane, BorderLayout.CENTER); - - // Set up the tree - rootNode = new DefaultMutableTreeNode("Connection"); - treeModel = new DefaultTreeModel(rootNode); - tTree = new JTree(treeModel); - tScrollPane = new JScrollPane(tTree); - - // System.out.println("Adding mouse listener"); - tTree.addMouseListener(this); - tScrollPane.setPreferredSize(new Dimension(200, 400)); - tScrollPane.setMinimumSize(new Dimension(70, 100)); - txtCommandScroll.setPreferredSize(new Dimension(560, 100)); - txtCommandScroll.setMinimumSize(new Dimension(180, 100)); - gScrollPane.setPreferredSize(new Dimension(460, 300)); - - ewSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tScrollPane, - nsSplitPane); - - // Added: (weconsultants@users) - ewSplitPane.setOneTouchExpandable(true); - fMain.getContentPane().add(ewSplitPane, BorderLayout.CENTER); - - // Added: (weconsultants@users) - jStatusLine = new JLabel(); - iReadyStatus = - new JButton(new ImageIcon(CommonSwing.getIcon("StatusReady"))); - - iReadyStatus.setSelectedIcon( - new ImageIcon(CommonSwing.getIcon("StatusRunning"))); - - pStatus = new JPanel(); - - pStatus.setLayout(new BorderLayout()); - pStatus.add(iReadyStatus, BorderLayout.WEST); - pStatus.add(jStatusLine, BorderLayout.CENTER); - fMain.getContentPane().add(pStatus, "South"); - doLayout(); - - if (fMain instanceof java.awt.Window) { - ((java.awt.Window) fMain).pack(); - } else { - ((Container) fMain).validate(); - } - } - - /* Simple tree node factory method - set's parent and user object. - */ - private DefaultMutableTreeNode makeNode(Object userObject, - MutableTreeNode parent) { - - DefaultMutableTreeNode node = new DefaultMutableTreeNode(userObject); - - if (parent != null) { - treeModel.insertNodeInto(node, parent, parent.getChildCount()); - } - - return node; - } - - private static final String[] usertables = { - "TABLE", "GLOBAL TEMPORARY", "VIEW", "SYSTEM TABLE" - }; - private static final String[] nonSystables = { - "TABLE", "GLOBAL TEMPORARY", "VIEW" - }; - private static final HashSet oracleSysUsers = new HashSet(); - private static final String[] oracleSysSchemas = { - "SYS", "SYSTEM", "OUTLN", "DBSNMP", "OUTLN", "MDSYS", "ORDSYS", - "ORDPLUGINS", "CTXSYS", "DSSYS", "PERFSTAT", "WKPROXY", "WKSYS", - "WMSYS", "XDB", "ANONYMOUS", "ODM", "ODM_MTR", "OLAPSYS", "TRACESVR", - "REPADMIN" - }; - - static { - Collections.addAll(oracleSysUsers, oracleSysSchemas); - } - - /** - * Schedules to run in a Gui-safe thread - */ - protected void refreshTree() { - backgroundIt(treeRefreshRunnable, "Refreshing object tree"); - } - - /** - * Clear all existing nodes from the tree model and rebuild from scratch. - * - * This method executes in current thread - */ - protected void directRefreshTree() { - - int[] rowCounts; - DefaultMutableTreeNode propertiesNode; - - // Added: (weconsultants@users) Moved tableNode here for visibiity nd new DECFM - DefaultMutableTreeNode tableNode; - DecimalFormat DECFMT = new DecimalFormat(" ( ####,###,####,##0 )"); - - // First clear the existing tree by simply enumerating - // over the root node's children and removing them one by one. - while (treeModel.getChildCount(rootNode) > 0) { - DefaultMutableTreeNode child = - (DefaultMutableTreeNode) treeModel.getChild(rootNode, 0); - - treeModel.removeNodeFromParent(child); - child.removeAllChildren(); - child.removeFromParent(); - } - - treeModel.nodeStructureChanged(rootNode); - treeModel.reload(); - tScrollPane.repaint(); - - if (dMeta == null) { - return; - } - - ResultSet result = null; - - // Now rebuild the tree below its root - try { - - // Start by naming the root node from its URL: - rootNode.setUserObject(dMeta.getURL()); - - // get metadata about user tables by building a vector of table names - result = dMeta.getTables(null, null, null, (showSys ? usertables - : nonSystables)); - - ArrayList tables = new ArrayList(); - ArrayList schemas = new ArrayList(); - - // sqlbob@users Added remarks. - ArrayList remarks = new ArrayList(); - String schema; - - while (result.next()) { - schema = result.getString(2); - - if ((!showSys) && isOracle - && oracleSysUsers.contains(schema)) { - continue; - } - - if (schemaFilter == null || schema.equals(schemaFilter)) { - schemas.add(schema); - tables.add(result.getString(3)); - remarks.add(result.getString(5)); - - continue; - } - } - - result.close(); - - result = null; - - // Added: (weconsultants@users) - // Sort not to go into production. Have to sync with 'remarks Vector' for DBMS that has it - // Collections.sort(tables); - // Added: (weconsultants@users) - Add rowCounts if needed. - rowCounts = new int[tables.size()]; - - try { - rowCounts = getRowCounts(tables, schemas); - } catch (Exception e) { - - // Added: (weconsultants@users) - CommonSwing.errorMessage(e); - } - - ResultSet col; - - // For each table, build a tree node with interesting info - for (int i = 0; i < tables.size(); i++) { - col = null; - - String name; - - try { - name = tables.get(i); - - if (isOracle && name.startsWith("BIN$")) { - continue; - - // Oracle Recyle Bin tables. - // Contains metacharacters which screw up metadata - // queries below. - } - - schema = schemas.get(i); - - String schemaname = ""; - - if (schema != null && showSchemas) { - schemaname = schema + '.'; - } - - String rowcount = displayRowCounts - ? (DECFMT.format(rowCounts[i])) - : ""; - String displayedName = schemaname + name + rowcount; - - // weconsul@ptd.net Add rowCounts if needed. - tableNode = makeNode(displayedName, rootNode); - col = dMeta.getColumns(null, schema, name, null); - - if ((schema != null) && !schema.trim().equals("")) { - makeNode(schema, tableNode); - } - - // sqlbob@users Added remarks. - String remark = remarks.get(i); - - if ((remark != null) && !remark.trim().equals("")) { - makeNode(remark, tableNode); - } - - // This block is very slow for some Oracle tables. - // With a child for each column containing pertinent attributes - while (col.next()) { - String c = col.getString(4); - DefaultMutableTreeNode columnNode = makeNode(c, - tableNode); - String type = col.getString(6); - - makeNode("Type: " + type, columnNode); - - boolean nullable = col.getInt(11) - != DatabaseMetaData.columnNoNulls; - - makeNode("Nullable: " + nullable, columnNode); - } - } finally { - if (col != null) { - try { - col.close(); - } catch (SQLException se) {} - } - } - - DefaultMutableTreeNode indexesNode = makeNode("Indices", - tableNode); - - if (showIndexDetails) { - ResultSet ind = null; - - try { - ind = dMeta.getIndexInfo(null, schema, name, false, - false); - - String oldiname = null; - DefaultMutableTreeNode indexNode = null; - - // A child node to contain each index - and its attributes - while (ind.next()) { - boolean nonunique = ind.getBoolean(4); - String iname = ind.getString(6); - - if ((oldiname == null - || !oldiname.equals(iname))) { - indexNode = makeNode(iname, indexesNode); - - makeNode("Unique: " + !nonunique, indexNode); - - oldiname = iname; - } - - // And the ordered column list for index components - makeNode(ind.getString(9), indexNode); - } - } catch (SQLException se) { - - // Workaround for Oracle - if (se.getMessage() == null || ((!se.getMessage() - .startsWith("ORA-25191:")) && (!se.getMessage() - .startsWith("ORA-01702:")) && !se.getMessage() - .startsWith("ORA-01031:"))) { - throw se; - } - } finally { - if (ind != null) { - ind.close(); - } - } - } - } - - // Finally - a little additional metadata on this connection - propertiesNode = makeNode("Properties", rootNode); - - makeNode("User: " + dMeta.getUserName(), propertiesNode); - makeNode("ReadOnly: " + cConn.isReadOnly(), propertiesNode); - makeNode("AutoCommit: " + cConn.getAutoCommit(), propertiesNode); - makeNode("Driver: " + dMeta.getDriverName(), propertiesNode); - makeNode("Product: " + dMeta.getDatabaseProductName(), - propertiesNode); - makeNode("Version: " + dMeta.getDatabaseProductVersion(), - propertiesNode); - } catch (SQLException se) { - propertiesNode = makeNode("Error getting metadata:", rootNode); - - makeNode(se.getMessage(), propertiesNode); - makeNode(se.getSQLState(), propertiesNode); - CommonSwing.errorMessage(se); - } finally { - if (result != null) { - try { - result.close(); - } catch (SQLException se) {} - } - } - - treeModel.nodeStructureChanged(rootNode); - treeModel.reload(); - tScrollPane.repaint(); - - // We want the Schema List to always be in sync with the displayed tree - updateSchemaList(); - } - - // Added: (weconsultants@users) Sets up\changes the running status icon - void setStatusLine(String busyBaseString, int rowCount) { - - iReadyStatus.setSelected(busyBaseString != null); - - if (busyBaseString == null) { - String additionalMsg = ""; - - if (schemaFilter != null) { - additionalMsg = " / Tree showing objects in schema '" - + schemaFilter + "'"; - } - - long millis = lTime / 1000000; - long fraction = (lTime % 1000000) / 100000; - - additionalMsg += " / " + rowCount + " rows retrieved in " - + millis + '.' + fraction + " ms"; - - jStatusLine.setText(" " + READY_STATUS + additionalMsg); - } else { - jStatusLine.setText(" " + busyBaseString + "..."); - } - } - - // Added: (weconsultants@users) Needed to aggregate counts per table in jTree - protected int[] getRowCounts(ArrayList inTable, - ArrayList inSchema) { - - if (!displayRowCounts) { - return (null); - } - - String rowCountSelect = "SELECT COUNT(*) FROM "; - int[] counts; - String name; - - counts = new int[inTable.size()]; - - try { - Statement select = rowConn.createStatement(); - - for (int i = 0; i < inTable.size(); i++) { - try { - String schemaPart = (String) inSchema.get(i); - - schemaPart = schemaPart == null ? "" - : ("\"" + schemaPart - + "\".\""); - name = schemaPart + inTable.get(i) + "\""; - - ResultSet resultSet = select.executeQuery(rowCountSelect - + name); - - while (resultSet.next()) { - counts[i] = resultSet.getInt(1); - } - } catch (Exception e) { - System.err.println("Unable to get row count for table " - + inSchema.get(i) + '.' - + inTable.get(i) - + ". Using value '0': " + e); - } - } - } catch (Exception e) { - CommonSwing.errorMessage(e); - } - - return (counts); - } - - protected JToolBar createToolBar() { - - // Build jtoolbar and jtoolbar Buttons - JToolBar jtoolbar = new JToolBar(); - - jtoolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); - - // I'm dropping "Statement" from "Execute SQL Statement", etc., - // because it may or may not be "one statement", but it is SQL. - // Build jbuttonClear Buttons - blaine - jbuttonClear = - new JButton("Clear SQL", - new ImageIcon(CommonSwing.getIcon("Clear"))); - - jbuttonClear.putClientProperty("is3DEnabled", Boolean.TRUE); - tipMap.put(jbuttonClear, "Clear SQL"); - jbuttonClear.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent actionevent) { - - if (sqlScriptBuffer == null - && txtCommand.getText().length() < 1) { - CommonSwing.errorMessage("No SQL to clear"); - - return; - } - - clear(); - } - }); - - jbuttonExecute = - new JButton("Execute SQL", - new ImageIcon(CommonSwing.getIcon("Execute"))); - - tipMap.put(jbuttonExecute, "Execute SQL"); - jbuttonExecute.putClientProperty("is3DEnabled", Boolean.TRUE); - jbuttonExecute.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent actionevent) { - executeCurrentSQL(); - } - }); - jtoolbar.addSeparator(); - jtoolbar.add(jbuttonClear); - jtoolbar.addSeparator(); - jtoolbar.add(jbuttonExecute); - jtoolbar.addSeparator(); - jbuttonClear.setAlignmentY(0.5F); - jbuttonClear.setAlignmentX(0.5F); - jbuttonExecute.setAlignmentY(0.5F); - jbuttonExecute.setAlignmentX(0.5F); - - return jtoolbar; - } - - void updateAutoCommitBox() { - - try { - if (cConn != null) { - boxAutoCommit.setSelected(cConn.getAutoCommit()); - } - } catch (SQLException se) { - CommonSwing.errorMessage(se); - } - } - - private void setLF(String newLAF) { - - if (currentLAF != null && currentLAF == newLAF) { // No change - return; - } - - if (pResult != null && gridFormat) { - pResult.removeAll(); - } - - CommonSwing.setSwingLAF((Component) fMain, newLAF); - - if (pResult != null && gridFormat) { - setResultsInGrid(); - } - - currentLAF = newLAF; - - if (currentLAF.equals(CommonSwing.Native)) { - rbNativeLF.setSelected(true); - } else if (currentLAF.equals(CommonSwing.Java)) { - rbJavaLF.setSelected(true); - } else if (currentLAF.equals(CommonSwing.Motif)) { - rbMotifLF.setSelected(true); - } - } - - void resetTooltips() { - - Iterator it = tipMap.keySet().iterator(); - JComponent component; - - while (it.hasNext()) { - component = it.next(); - - component.setToolTipText(showTooltips - ? tipMap.get(component) - : null); - } - } - - private void updateSchemaList() { - - ButtonGroup group = new ButtonGroup(); - ArrayList list = new ArrayList(); - ResultSet result = null; - - try { - result = dMeta.getSchemas(); - - if (result == null) { - throw new SQLException("Failed to get metadata from database"); - } - - while (result.next()) { - list.add(result.getString(1)); - } - } catch (SQLException se) { - CommonSwing.errorMessage(se); - } finally { - if (result != null) { - try { - result.close(); - } catch (SQLException se) {} - } - } - - mnuSchemas.removeAll(); - rbAllSchemas.setSelected(schemaFilter == null); - group.add(rbAllSchemas); - mnuSchemas.add(rbAllSchemas); - - String s; - JRadioButtonMenuItem radioButton; - - for (int i = 0; i < list.size(); i++) { - s = list.get(i); - radioButton = new JRadioButtonMenuItem(s); - - group.add(radioButton); - mnuSchemas.add(radioButton); - radioButton.setSelected(schemaFilter != null - && schemaFilter.equals(s)); - radioButton.addActionListener(schemaListListener); - radioButton.setEnabled(list.size() > 1); - } - - mnuSchemas.addSeparator(); - mnuSchemas.add(mitemUpdateSchemas); - } - - ActionListener schemaListListener = (new ActionListener() { - - public void actionPerformed(ActionEvent actionevent) { - - schemaFilter = actionevent.getActionCommand(); - - if (schemaFilter.equals("*")) { - schemaFilter = null; - } - - refreshTree(); - } - }); - - /** - * Persisted User Preferences for DatabaseManagerSwing. - * - * These are settings for items in the View and Options pulldown menus, - * plus Help/Show Tooltips. - */ - public static class DBMPrefs { - - public File prefsFile = null; - - /** - * The constructor guarantees that this will be null for Applet, - * non-null if using a local preferences file - */ - - // Set defaults from Data - boolean autoRefresh = true; - boolean showRowCounts = false; - boolean showSysTables = false; - boolean showSchemas = true; - boolean resultGrid = true; - String laf = CommonSwing.Native; - - // Somebody with more time can store the font settings. IMO, that - // menu item shouldn't even be there if the settings aren't persisted. - boolean showTooltips = true; - - public DBMPrefs(boolean isApplet) throws IOException { - - if (!isApplet) { - if (homedir == null) { - throw new IOException( - "Skipping preferences since do not know home dir"); - } - - prefsFile = new File(homedir, "dbmprefs.properties"); - } - - load(); - } - - public void load() throws IOException { - - String tmpString; - - if (prefsFile != null) { - - // LOAD PREFERENCES FROM LOCAL PREFERENCES FILE - if (!prefsFile.exists()) { - throw new IOException("No such file: " + prefsFile); - } - - Properties props = new Properties(); - - try { - FileInputStream fis = new FileInputStream(prefsFile); - - props.load(fis); - fis.close(); - } catch (IOException ioe) { - throw new IOException("Failed to read preferences file '" - + prefsFile + "': " - + ioe.getMessage(), ioe); - } - - tmpString = props.getProperty("autoRefresh"); - - if (tmpString != null) { - autoRefresh = Boolean.valueOf(tmpString).booleanValue(); - } - - tmpString = props.getProperty("showRowCounts"); - - if (tmpString != null) { - showRowCounts = Boolean.valueOf(tmpString).booleanValue(); - } - - tmpString = props.getProperty("showSysTables"); - - if (tmpString != null) { - showSysTables = Boolean.valueOf(tmpString).booleanValue(); - } - - tmpString = props.getProperty("showSchemas"); - - if (tmpString != null) { - showSchemas = Boolean.valueOf(tmpString).booleanValue(); - } - - tmpString = props.getProperty("resultGrid"); - - if (tmpString != null) { - resultGrid = Boolean.valueOf(tmpString).booleanValue(); - } - - tmpString = props.getProperty("laf"); - laf = ((tmpString == null) ? CommonSwing.Native - : tmpString); - tmpString = props.getProperty("showTooltips"); - - if (tmpString != null) { - showTooltips = Boolean.valueOf(tmpString).booleanValue(); - } - } - } - - public void store() { - - if (prefsFile == null) { - - // Can't persist Applet settings. - return; - } - - Properties props = new Properties(); - - // Boolean.toString(boolean) was new with Java 1.4, so don't use that. - props.setProperty("autoRefresh", (autoRefresh ? tString - : fString)); - props.setProperty("showRowCounts", (showRowCounts ? tString - : fString)); - props.setProperty("showSysTables", (showSysTables ? tString - : fString)); - props.setProperty("showSchemas", (showSchemas ? tString - : fString)); - props.setProperty("resultGrid", (resultGrid ? tString - : fString)); - props.setProperty("laf", laf); - props.setProperty("showTooltips", (showTooltips ? tString - : fString)); - - try { - FileOutputStream fos = new FileOutputStream(prefsFile); - - props.store(fos, "DatabaseManagerSwing user preferences"); - fos.flush(); - fos.close(); - } catch (IOException ioe) { - throw new RuntimeException( - "Failed to prepare preferences file '" + prefsFile - + "': " + ioe.getMessage()); - } - } - } - - private static void setLogToSystem(boolean value) { - - try { - PrintWriter newPrintWriter = (value) ? new PrintWriter(System.out) - : null; - - DriverManager.setLogWriter(newPrintWriter); - } catch (Exception e) {} - } - - private static final String tString = Boolean.TRUE.toString(); - private static final String fString = Boolean.FALSE.toString(); -} diff --git a/database/hsqldb/src/org/hsqldb/util/FontDialogSwing.java b/database/hsqldb/src/org/hsqldb/util/FontDialogSwing.java deleted file mode 100644 index 75c98ad7..00000000 --- a/database/hsqldb/src/org/hsqldb/util/FontDialogSwing.java +++ /dev/null @@ -1,323 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.awt.Color; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.GraphicsEnvironment; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JColorChooser; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; - -// weconsultants@users 20041109 - original swing port -// weconsultants@users 20050215 - version 1.8.0 - Update: Compatbilty fix for JDK 1.3 -// - Replaced: Objects JSpinner spinnerFontSizes and SpinnerNumberModel spinnerModelSizes -// for JComboBox fontSizesComboBox and String fontSizes[]; -class FontDialogSwing extends JDialog { - - private static boolean isRunning = false; - private static final String BACKGROUND = "Background"; - private static final String FOREGROUND = "Foreground"; - private static JButton bgColorButton; - private static JCheckBox ckbbold; - private static JButton fgColorButton; - private static JComboBox fontsComboBox; - - private static final String[] fontSizes = { - "8", "9", "10", "11", "12", "13", "14", "16", "18", "24", "36" - }; - - // weconsultants@users 20050215 - Commented out for Compatbilty fix for JDK 1.3 - // private static JSpinner spinnerFontSizes; - // private static SpinnerNumberModel spinnerModelSizes; - private static DatabaseManagerSwing fOwner; - private static final JFrame frame = - new JFrame("DataBaseManagerSwing Font Selection Dialog"); - private static JCheckBox ckbitalic; - - /** - * Create and display FontDialogSwing Dialog. - * - */ - public static void creatFontDialog(DatabaseManagerSwing owner) { - - if (isRunning) { - frame.setVisible(true); - } else { - CommonSwing.setSwingLAF(frame, CommonSwing.Native); - - fOwner = owner; - - frame.setIconImage(CommonSwing.getIcon("Frame")); - - isRunning = true; - - frame.setSize(600, 100); - CommonSwing.setFramePositon(frame); - - ckbitalic = new JCheckBox( - new ImageIcon(CommonSwing.getIcon("ItalicFont"))); - - ckbitalic.putClientProperty("is3DEnabled", Boolean.TRUE); - ckbitalic.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - setStyle(); - } - }); - - ckbbold = - new JCheckBox(new ImageIcon(CommonSwing.getIcon("BoldFont"))); - - ckbbold.putClientProperty("is3DEnabled", Boolean.TRUE); - ckbbold.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - setStyle(); - } - }); - - fgColorButton = new JButton( - "Foreground", - new ImageIcon(CommonSwing.getIcon("ColorSelection"))); - - fgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE); - fgColorButton.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - setColor(FOREGROUND); - } - }); - - bgColorButton = new JButton( - "Background", - new ImageIcon(CommonSwing.getIcon("ColorSelection"))); - - bgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE); - bgColorButton.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - setColor(BACKGROUND); - } - }); - - JButton closeButton = new JButton("Close", - new ImageIcon(CommonSwing.getIcon("Close"))); - - closeButton.putClientProperty("is3DEnabled", Boolean.TRUE); - closeButton.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - frame.setVisible(false); - } - }); - - GraphicsEnvironment ge = - GraphicsEnvironment.getLocalGraphicsEnvironment(); - String[] fontNames = ge.getAvailableFontFamilyNames(); - Dimension fontsComboBoxDimension = new Dimension(160, 25); - - fontsComboBox = new JComboBox(fontNames); - - fontsComboBox.putClientProperty("is3DEnabled", Boolean.TRUE); - fontsComboBox.setMaximumSize(fontsComboBoxDimension); - fontsComboBox.setPreferredSize(fontsComboBoxDimension); - fontsComboBox.setMaximumSize(fontsComboBoxDimension); - fontsComboBox.setEditable(false); - String defaultFont = "Dialog"; - fontsComboBox.setSelectedItem(defaultFont); - fontsComboBox.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - setFont(); - } - }); - - // weconsultants@users 20050215 - Added for Compatbilty fix for JDK 1.3 - // weconsultants@users 20050215 - Added for Compatbilty fix for JDK 1.3 - JComboBox fontSizesComboBox = new JComboBox(fontSizes); - - Dimension spinnerDimension = new Dimension(45, 25); - - fontSizesComboBox.putClientProperty("is3DEnabled", Boolean.TRUE); - fontSizesComboBox.setMinimumSize(spinnerDimension); - fontSizesComboBox.setPreferredSize(spinnerDimension); - fontSizesComboBox.setMaximumSize(spinnerDimension); - fontSizesComboBox.addItemListener(new ItemListener() { - - public void itemStateChanged(ItemEvent evt) { - - if (evt.getStateChange() == ItemEvent.SELECTED) { - setFontSize((String) evt.getItem()); - } - } - }); - - // weconsultants@users 20050215 - Commented out for Compatbilty fix for JDK 1.3 - // Dimension spinnerDimension = new Dimension(50, 25); - // spinnerFontSizes = new JSpinner(); - // spinnerFontSizes.putClientProperty("is3DEnabled", Boolean.TRUE); - // spinnerFontSizes.setMinimumSize(spinnerDimension); - // spinnerFontSizes.setPreferredSize(spinnerDimension); - // spinnerFontSizes.setMaximumSize(spinnerDimension); - // spinnerModelSizes = new SpinnerNumberModel(12, 8, 72, 1); - // spinnerFontSizes.setModel(spinnerModelSizes); - // spinnerFontSizes.addChangeListener(new ChangeListener() { - // public void stateChanged(ChangeEvent e) { - // setFontSize(); - // } - // }); - Container contentPane = frame.getContentPane(); - - contentPane.setLayout(new FlowLayout()); - contentPane.add(fontsComboBox); - - // weconsultants@users 20050215 - Commented out for Compatbilty fix for 1.3 - // contentPane.add(spinnerFontSizes); - // weconsultants@users 20050215 - Added for Compatbilty fix for 1.3 - contentPane.add(fontSizesComboBox); - contentPane.add(ckbbold); - contentPane.add(ckbitalic); - contentPane.add(fgColorButton); - contentPane.add(bgColorButton); - contentPane.add(closeButton); - frame.pack(); - frame.setVisible(false); - } - } - - public static void setFont() { - - Font txtResultFont = fOwner.txtResult.getFont(); - - fOwner.txtResult.setFont( - new Font( - fontsComboBox.getSelectedItem().toString(), - txtResultFont.getStyle(), txtResultFont.getSize())); - - Font txtCommandFont = fOwner.txtResult.getFont(); - - fOwner.txtCommand.setFont( - new Font( - fontsComboBox.getSelectedItem().toString(), - txtCommandFont.getStyle(), txtCommandFont.getSize())); - - Font txtTreeFont = fOwner.txtResult.getFont(); - - fOwner.tTree.setFont( - new Font( - fontsComboBox.getSelectedItem().toString(), - txtTreeFont.getStyle(), txtTreeFont.getSize())); - } - - /** - * Displays a color chooser and Sets the selected color. - */ - public static void setFontSize(String inFontSize) { - - // weconsultants@users 20050215 - Changed for Compatbilty fix for JDK 1.3 - // Convert Strng to float for deriveFont() call - Float stageFloat = Float.valueOf(inFontSize); - float fontSize = stageFloat.floatValue(); - Font fonttTree = fOwner.tTree.getFont().deriveFont(fontSize); - - fOwner.tTree.setFont(fonttTree); - - Font fontTxtCommand = - fOwner.txtCommand.getFont().deriveFont(fontSize); - - fOwner.txtCommand.setFont(fontTxtCommand); - - Font fontTxtResult = fOwner.txtResult.getFont().deriveFont(fontSize); - - fOwner.txtResult.setFont(fontTxtResult); - } - - /** - * Changes the style (Bold, Italic ) of the selected text by checking the - * style buttons - */ - public static void setStyle() { - - int style = Font.PLAIN; - - if (ckbbold.isSelected()) { - style |= Font.BOLD; - } - - if (ckbitalic.isSelected()) { - style |= Font.ITALIC; - } - - fOwner.tTree.setFont(fOwner.txtCommand.getFont().deriveFont(style)); - fOwner.txtCommand.setFont( - fOwner.txtCommand.getFont().deriveFont(style)); - fOwner.txtResult.setFont( - fOwner.txtResult.getFont().deriveFont(style)); - } - - public static void setColor(String inTarget) { - - if (inTarget.equals(BACKGROUND)) { - Color backgroundColor = JColorChooser.showDialog(null, - "DataBaseManagerSwing Choose Background Color", - fOwner.txtResult.getBackground()); - - if (backgroundColor != null) { - bgColorButton.setBackground(backgroundColor); - fOwner.txtCommand.setBackground(backgroundColor); - fOwner.txtResult.setBackground(backgroundColor); - } - } else { - Color foregroundColor = JColorChooser.showDialog(null, - "DataBaseManagerSwing Choose Foreground Color", - fOwner.txtResult.getForeground()); - - if (foregroundColor != null) { - fgColorButton.setBackground(foregroundColor); - fOwner.txtCommand.setForeground(foregroundColor); - fOwner.txtResult.setForeground(foregroundColor); - } - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/GreenCircle.gif b/database/hsqldb/src/org/hsqldb/util/GreenCircle.gif deleted file mode 100644 index d87a121c..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/GreenCircle.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/Grid.java b/database/hsqldb/src/org/hsqldb/util/Grid.java deleted file mode 100644 index fcf2512b..00000000 --- a/database/hsqldb/src/org/hsqldb/util/Grid.java +++ /dev/null @@ -1,494 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.util.ArrayList; - -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Event; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Panel; -import java.awt.Scrollbar; -import java.awt.SystemColor; - -// sqlbob@users 20020401 - patch 1.7.0 by sqlbob (RMP) - enhancements -// fredt@users - version 2.50 - removed deprecated - -/** - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.5.0 - * @since Hypersonic SQL - */ -class Grid extends Panel { - - // drawing - private Dimension dMinimum; - -// campbell-burnet@users changed access for databasemanager2 - protected Font fFont; - -// -------------------------------------------------- - private FontMetrics fMetrics; - private Graphics gImage; - private Image iImage; - - // height / width - private int iWidth, iHeight; - private int iRowHeight, iFirstRow; - private int iGridWidth, iGridHeight; - private int iX, iY; - - // data -// campbell-burnet@users changed access for databasemanager2 - protected String[] sColHead = new String[0]; - protected ArrayList vData = new ArrayList(); - -// -------------------------------------------------- - private int[] iColWidth; - private int iColCount; - -// campbell-burnet@users changed access for databasemanager2 - protected int iRowCount; - -// -------------------------------------------------- - // scrolling - private Scrollbar sbHoriz, sbVert; - private int iSbWidth, iSbHeight; - private boolean bDrag; - private int iXDrag, iColDrag; - - /** - * Constructor declaration - * - */ - public Grid() { - - super(); - - fFont = new Font("Dialog", Font.PLAIN, 12); - - setLayout(null); - - sbHoriz = new Scrollbar(Scrollbar.HORIZONTAL); - - add(sbHoriz); - - sbVert = new Scrollbar(Scrollbar.VERTICAL); - - add(sbVert); - } - - String[] getHead() { - return sColHead; - } - - ArrayList getData() { - return vData; - } - - public void setMinimumSize(Dimension d) { - dMinimum = d; - } - - public void setBounds(int x, int y, int w, int h) { - - // fredt@users 20011210 - patch 450412 by elise@users - super.setBounds(x, y, w, h); - - iSbHeight = sbHoriz.getPreferredSize().height; - iSbWidth = sbVert.getPreferredSize().width; - iHeight = h - iSbHeight; - iWidth = w - iSbWidth; - - sbHoriz.setBounds(0, iHeight, iWidth, iSbHeight); - sbVert.setBounds(iWidth, 0, iSbWidth, iHeight); - adjustScroll(); - - iImage = null; - - repaint(); - } - - public void setHead(String[] head) { - - iColCount = head.length; - sColHead = new String[iColCount]; - iColWidth = new int[iColCount]; - - for (int i = 0; i < iColCount; i++) { - sColHead[i] = head[i]; - iColWidth[i] = 100; - } - - iRowCount = 0; - iRowHeight = 0; - vData = new ArrayList(); - } - - public void addRow(String[] data) { - - if (data.length != iColCount) { - return; - } - - String[] row = new String[iColCount]; - - for (int i = 0; i < iColCount; i++) { - row[i] = data[i]; - - if (row[i] == null) { - row[i] = "(null)"; - } - } - - vData.add(row); - - iRowCount++; - } - - public void update() { - adjustScroll(); - repaint(); - } - - void adjustScroll() { - - if (iRowHeight == 0) { - return; - } - - int w = 0; - - for (int i = 0; i < iColCount; i++) { - w += iColWidth[i]; - } - - iGridWidth = w; - iGridHeight = iRowHeight * (iRowCount + 1); - - sbHoriz.setValues(iX, iWidth, 0, iGridWidth); - - int v = iY / iRowHeight, - h = iHeight / iRowHeight; - - sbVert.setValues(v, h, 0, iRowCount + 1); - - iX = sbHoriz.getValue(); - iY = iRowHeight * sbVert.getValue(); - } - - // fredt@users 20020130 - comment by fredt - // to remove this deprecated method we need to rewrite the Grid class as a - // ScrollPane component - // sqlbob: I believe that changing to the JDK1.1 event handler - // would require browsers to use the Java plugin. - public boolean handleEvent(Event e) { - - switch (e.id) { - - case Event.SCROLL_LINE_UP : - case Event.SCROLL_LINE_DOWN : - case Event.SCROLL_PAGE_UP : - case Event.SCROLL_PAGE_DOWN : - case Event.SCROLL_ABSOLUTE : - iX = sbHoriz.getValue(); - iY = iRowHeight * sbVert.getValue(); - - repaint(); - - return true; - } - - return super.handleEvent(e); - } - - public void paint(Graphics g) { - - if (g == null) { - return; - } - - if (sColHead.length == 0) { - super.paint(g); - - return; - } - - if (iWidth <= 0 || iHeight <= 0) { - return; - } - - g.setColor(SystemColor.control); - g.fillRect(iWidth, iHeight, iSbWidth, iSbHeight); - - if (iImage == null) { - iImage = createImage(iWidth, iHeight); - gImage = iImage.getGraphics(); - - gImage.setFont(fFont); - - if (fMetrics == null) { - fMetrics = gImage.getFontMetrics(); - } - } - - if (iRowHeight == 0) { - iRowHeight = getMaxHeight(fMetrics); - - for (int i = 0; i < iColCount; i++) { - calcAutoWidth(i); - } - - adjustScroll(); - } - - gImage.setColor(Color.white); - gImage.fillRect(0, 0, iWidth, iHeight); - gImage.setColor(Color.darkGray); - gImage.drawLine(0, iRowHeight, iWidth, iRowHeight); - - int x = -iX; - - for (int i = 0; i < iColCount; i++) { - int w = iColWidth[i]; - - gImage.setColor(SystemColor.control); - gImage.fillRect(x + 1, 0, w - 2, iRowHeight); - gImage.setColor(Color.black); - gImage.drawString(sColHead[i], x + 2, iRowHeight - 5); - gImage.setColor(Color.darkGray); - gImage.drawLine(x + w - 1, 0, x + w - 1, iRowHeight - 1); - gImage.setColor(Color.white); - gImage.drawLine(x + w, 0, x + w, iRowHeight - 1); - - x += w; - } - - gImage.setColor(SystemColor.control); - gImage.fillRect(0, 0, 1, iRowHeight); - gImage.fillRect(x + 1, 0, iWidth - x, iRowHeight); - gImage.drawLine(0, 0, 0, iRowHeight - 1); - - int y = iRowHeight + 1 - iY; - int j = 0; - - while (y < iRowHeight + 1) { - j++; - - y += iRowHeight; - } - - iFirstRow = j; - y = iRowHeight + 1; - - for (; y < iHeight && j < iRowCount; j++, y += iRowHeight) { - x = -iX; - - for (int i = 0; i < iColCount; i++) { - int w = iColWidth[i]; - Color b = Color.white, - t = Color.black; - - gImage.setColor(b); - gImage.fillRect(x, y, w - 1, iRowHeight - 1); - gImage.setColor(t); - gImage.drawString(getDisplay(i, j), x + 2, - y + iRowHeight - 5); - gImage.setColor(Color.lightGray); - gImage.drawLine(x + w - 1, y, x + w - 1, y + iRowHeight - 1); - gImage.drawLine(x, y + iRowHeight - 1, x + w - 1, - y + iRowHeight - 1); - - x += w; - } - - gImage.setColor(Color.white); - gImage.fillRect(x, y, iWidth - x, iRowHeight - 1); - } - - g.drawImage(iImage, 0, 0, this); - } - - public void update(Graphics g) { - paint(g); - } - - public boolean mouseMove(Event e, int x, int y) { - - if (y <= iRowHeight) { - int xb = x; - - x += iX - iGridWidth; - - int i = iColCount - 1; - - for (; i >= 0; i--) { - if (x > -7 && x < 7) { - break; - } - - x += iColWidth[i]; - } - - if (i >= 0) { - if (!bDrag) { - setCursor(new Cursor(Cursor.E_RESIZE_CURSOR)); - - bDrag = true; - iXDrag = xb - iColWidth[i]; - iColDrag = i; - } - - return true; - } - } - - return mouseExit(e, x, y); - } - - public boolean mouseDrag(Event e, int x, int y) { - - if (bDrag && x < iWidth) { - int w = x - iXDrag; - - if (w < 0) { - w = 0; - } - - iColWidth[iColDrag] = w; - - adjustScroll(); - repaint(); - } - - return true; - } - - public boolean mouseExit(Event e, int x, int y) { - - if (bDrag) { - setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - - bDrag = false; - } - - return true; - } - - public Dimension preferredSize() { - return dMinimum; - } - - public Dimension getPreferredSize() { - return dMinimum; - } - - public Dimension getMinimumSize() { - return dMinimum; - } - - public Dimension minimumSize() { - return dMinimum; - } - - private void calcAutoWidth(int i) { - - int w = 10; - - w = Math.max(w, fMetrics.stringWidth(sColHead[i])); - - for (int j = 0; j < iRowCount; j++) { - String[] s = vData.get(j); - - w = Math.max(w, fMetrics.stringWidth(s[i])); - } - - iColWidth[i] = w + 6; - } - - private String getDisplay(int x, int y) { - return vData.get(y)[x]; - } - - private String get(int x, int y) { - return vData.get(y)[x]; - } - - private static int getMaxHeight(FontMetrics f) { - return f.getHeight() + 4; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/GridSwing.java b/database/hsqldb/src/org/hsqldb/util/GridSwing.java deleted file mode 100644 index d286dbea..00000000 --- a/database/hsqldb/src/org/hsqldb/util/GridSwing.java +++ /dev/null @@ -1,226 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.util.ArrayList; - -import java.awt.Component; -import java.util.Arrays; -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import javax.swing.table.TableModel; - -// sqlbob@users 20020401 - patch 1.7.0 by sqlbob (RMP) - enhancements -// deccles@users 20040412 - patch 933671 - various bug fixes -// fredt@users - version 2.50 - removed deprecated - -/** Simple table model to represent a grid of tuples. - * - * @author dmarshall@users - * @version 2.5.0 - * @since 1.7.0 - */ -class GridSwing extends AbstractTableModel { - - JTable jtable = null; - Object[] headers; - ArrayList rows; - - /** - * Default constructor. - */ - public GridSwing() { - - super(); - - headers = new Object[0]; // initially empty - rows = new ArrayList(); // initially empty - } - - /** - * Get the name for the specified column. - */ - public String getColumnName(int i) { - return headers[i].toString(); - } - - public Class getColumnClass(int i) { - - if (rows.size() > 0) { - Object o = getValueAt(0, i); - - if (o != null) { - if ((o instanceof java.sql.Timestamp) - || (o instanceof java.sql.Time)) { - // This is a workaround for JTable's lack of a default - // renderer that displays times. - // Without this workaround, Timestamps (and similar - // classes) will be displayed as dates without times, - // since JTable will match these classes to their - // java.util.Date superclass. - return Object.class; // renderer will draw .toString(). - } - return o.getClass(); - } - } - - return super.getColumnClass(i); - } - - /** - * Get the number of columns. - */ - public int getColumnCount() { - return headers.length; - } - - /** - * Get the number of rows currently in the table. - */ - public int getRowCount() { - return rows.size(); - } - - /** - * Get the current column headings. - */ - public Object[] getHead() { - return headers; - } - - /** - * Get the current table data. - * Each row is represented as a String[] - * with a single non-null value in the 0-relative - * column position. - *

    The first row is at offset 0, the nth row at offset n etc. - */ - public ArrayList getData() { - return rows; - } - - /** - * Get the object at the specified cell location. - */ - public Object getValueAt(int row, int col) { - - if (row >= rows.size()) { - return null; - } - - Object[] colArray = rows.get(row); - - if (col >= colArray.length) { - return null; - } - - return colArray[col]; - } - - /** - * Set the name of the column headings. - */ - public void setHead(Object[] h) { - headers = Arrays.copyOf(h, h.length); - } - - /** - * Append a tuple to the end of the table. - */ - public void addRow(Object[] r) { - - Object[] row = new Object[r.length]; - - // System.arraycopy(r, 0, row, 0, r.length); - for (int i = 0; i < r.length; i++) { - row[i] = r[i]; - } - - rows.add(row); - } - - /** - * Remove data from all cells in the table (without - * affecting the current headings). - */ - public void clear() { - rows.clear(); - } - - public void setJTable(JTable table) { - jtable = table; - } - - public void fireTableChanged(TableModelEvent e) { - super.fireTableChanged(e); - autoSizeTableColumns(jtable); - } - - public static void autoSizeTableColumns(JTable table) { - - TableModel model = table.getModel(); - TableColumn column; - Component comp; - int headerWidth; - int maxCellWidth; - int cellWidth; - TableCellRenderer headerRenderer = - table.getTableHeader().getDefaultRenderer(); - - for (int i = 0; i < table.getColumnCount(); i++) { - column = table.getColumnModel().getColumn(i); - comp = headerRenderer.getTableCellRendererComponent(table, - column.getHeaderValue(), false, false, 0, 0); - headerWidth = comp.getPreferredSize().width + 10; - maxCellWidth = Integer.MIN_VALUE; - - for (int j = 0; j < Math.min(model.getRowCount(), 30); j++) { - TableCellRenderer r = table.getCellRenderer(j, i); - - comp = r.getTableCellRendererComponent(table, - model.getValueAt(j, i), - false, false, j, i); - cellWidth = comp.getPreferredSize().width; - - if (cellWidth >= maxCellWidth) { - maxCellWidth = cellWidth; - } - } - - column.setPreferredWidth(Math.max(headerWidth, maxCellWidth) - + 10); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/HelperFactory.java b/database/hsqldb/src/org/hsqldb/util/HelperFactory.java deleted file mode 100644 index a0cfff26..00000000 --- a/database/hsqldb/src/org/hsqldb/util/HelperFactory.java +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -/** - * @author Nicolas BAZIN, INGENICO - * @version 1.7.0 - */ - -// brian.porter@siteforce.de 20020703 - added reference to OracleTransferHelper -class HelperFactory { - - HelperFactory() {} - - // TransferHelper factory - static TransferHelper getHelper(String productLowerName) { - - TransferHelper f = null; - - if (productLowerName.contains("hsql database")) { - f = new HsqldbTransferHelper(); - } else if (productLowerName.contains("postgresql")) { - f = new PostgresTransferHelper(); - } else if (productLowerName.contains("mckoi")) { - f = new McKoiTransferHelper(); - } else if (productLowerName.contains("informix")) { - f = new InformixTransferHelper(); - } else if (productLowerName.contains("oracle")) { - System.out.println("using the Oracle helper"); - - f = new OracleTransferHelper(); - } else if (productLowerName.equals("access") - || (productLowerName.contains("microsoft"))) { - f = new SqlServerTransferHelper(); - } else { - f = new TransferHelper(); - } - - return (f); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/Hourglass.gif b/database/hsqldb/src/org/hsqldb/util/Hourglass.gif deleted file mode 100644 index e501ac6b..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/Hourglass.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/HsqldbTransferHelper.java b/database/hsqldb/src/org/hsqldb/util/HsqldbTransferHelper.java deleted file mode 100644 index 729521a0..00000000 --- a/database/hsqldb/src/org/hsqldb/util/HsqldbTransferHelper.java +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.Types; - -// sqlbob@users 20020325 - patch 1.7.0 - reengineering - -/** - * Conversions to / from Hsqldb - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @version 1.7.0 - */ -class HsqldbTransferHelper extends TransferHelper { - - public HsqldbTransferHelper() { - super(); - } - - public HsqldbTransferHelper(TransferDb database, Traceable t, String q) { - super(database, t, q); - } - - int convertFromType(int type) { - - if (type == 100) { - type = Types.VARCHAR; - - tracer.trace("Converted HSQLDB VARCHAR_IGNORECASE to VARCHAR"); - } - - return (type); - } - - String fixupColumnDefRead(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) { - - String CompareString = "INTEGER IDENTITY"; - - if (columnType.contains(CompareString)) { - - // We just found a increment - columnType = "SERIAL"; - } - - return (columnType); - } - - String fixupColumnDefWrite(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) { - - if (columnType.contains("SERIAL")) { - columnType = "INTEGER GENERATED BY DEFAULT AS IDENTITY"; - } - - return (columnType); - } - - String fixupColumnDefRead(String aTableName, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) { - return fixupColumnDefRead((TransferTable) null, meta, columnType, - columnDesc, columnIndex); - } - - String fixupColumnDefWrite(String aTableName, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) { - return fixupColumnDefWrite((TransferTable) null, meta, columnType, - columnDesc, columnIndex); - } - - String formatName(String t) { - return formatIdentifier(t); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/InformixTransferHelper.java b/database/hsqldb/src/org/hsqldb/util/InformixTransferHelper.java deleted file mode 100644 index ee6ddeb2..00000000 --- a/database/hsqldb/src/org/hsqldb/util/InformixTransferHelper.java +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.Types; - -// fredt@users 20020215 - patch 516309 by Nicolas Bazin - transfer Informix -// sqlbob@users 20020325 - patch 1.7.0 - reengineering - -/** - * Conversions from Informix databases - * - * @author Nichola Bazin - * @version 1.7.0 - */ -class InformixTransferHelper extends TransferHelper { - - public InformixTransferHelper() { - super(); - } - - public InformixTransferHelper(TransferDb database, Traceable t, - String q) { - super(database, t, q); - } - - void setSchema(String _Schema) { - sSchema = "\"" + _Schema + "\""; - } - - int convertFromType(int type) { - - //Correct a bug in Informix JDBC driver that maps: - // DATETIME YEAR TO FRACTION to TIME and - // DATETIME HOUR TO SECOND to TIMESTAMP - if (type == Types.TIMESTAMP) { - type = Types.TIME; - - tracer.trace("Converted INFORMIX TIMESTAMP to TIME"); - } else if (type == Types.TIME) { - type = Types.TIMESTAMP; - - tracer.trace("Converted INFORMIX TIME to TIMESTAMP"); - } - - return (type); - } - - int convertToType(int type) { - - //Correct a bug in Informix JDBC driver that maps: - // DATETIME YEAR TO FRACTION to TIME and - // DATETIME HOUR TO SECOND to TIMESTAMP - if (type == Types.TIMESTAMP) { - type = Types.TIME; - - tracer.trace("Converted TIMESTAMP to INFORMIX TIME"); - } else if (type == Types.TIME) { - type = Types.TIMESTAMP; - - tracer.trace("Converted TIME to INFORMIX TIMESTAMP"); - } - - return (type); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/Italic.gif b/database/hsqldb/src/org/hsqldb/util/Italic.gif deleted file mode 100644 index 9f74d9ff..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/Italic.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/JDBCTypes.java b/database/hsqldb/src/org/hsqldb/util/JDBCTypes.java deleted file mode 100644 index 31fbf05a..00000000 --- a/database/hsqldb/src/org/hsqldb/util/JDBCTypes.java +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.util.Hashtable; - -/** - * Base class for conversion from a different databases - * - * @author Nicolas BAZIN - * @version 1.7.0 - */ -class JDBCTypes { - - public static final int JAVA_OBJECT = 2000; - public static final int DISTINCT = 2001; - public static final int STRUCT = 2002; - public static final int ARRAY = 2003; - public static final int BLOB = 2004; - public static final int CLOB = 2005; - public static final int REF = 2006; - private Hashtable hStringJDBCtypes; - private Hashtable hIntJDBCtypes; - - JDBCTypes() { - - hStringJDBCtypes = new Hashtable(); - hIntJDBCtypes = new Hashtable(); - - hStringJDBCtypes.put(Integer.valueOf(ARRAY), "ARRAY"); - hStringJDBCtypes.put(Integer.valueOf(BLOB), "BLOB"); - hStringJDBCtypes.put(Integer.valueOf(CLOB), "CLOB"); - hStringJDBCtypes.put(Integer.valueOf(DISTINCT), "DISTINCT"); - hStringJDBCtypes.put(Integer.valueOf(JAVA_OBJECT), "JAVA_OBJECT"); - hStringJDBCtypes.put(Integer.valueOf(REF), "REF"); - hStringJDBCtypes.put(Integer.valueOf(STRUCT), "STRUCT"); - - // - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.BIGINT), "BIGINT"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.BINARY), "BINARY"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.BIT), "BIT"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.CHAR), "CHAR"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.DATE), "DATE"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.DECIMAL), "DECIMAL"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.DOUBLE), "DOUBLE"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.FLOAT), "FLOAT"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.INTEGER), "INTEGER"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.LONGVARBINARY), - "LONGVARBINARY"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.LONGVARCHAR), - "LONGVARCHAR"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.NULL), "NULL"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.NUMERIC), "NUMERIC"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.OTHER), "OTHER"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.REAL), "REAL"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.SMALLINT), - "SMALLINT"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.TIME), "TIME"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.TIMESTAMP), - "TIMESTAMP"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.TINYINT), "TINYINT"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.VARBINARY), - "VARBINARY"); - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.VARCHAR), "VARCHAR"); - - hStringJDBCtypes.put(Integer.valueOf(java.sql.Types.BOOLEAN), "BOOLEAN"); - // - hIntJDBCtypes.put("ARRAY", Integer.valueOf(ARRAY)); - hIntJDBCtypes.put("BLOB", Integer.valueOf(BLOB)); - hIntJDBCtypes.put("CLOB", Integer.valueOf(CLOB)); - hIntJDBCtypes.put("DISTINCT", Integer.valueOf(DISTINCT)); - hIntJDBCtypes.put("JAVA_OBJECT", Integer.valueOf(JAVA_OBJECT)); - hIntJDBCtypes.put("REF", Integer.valueOf(REF)); - hIntJDBCtypes.put("STRUCT", Integer.valueOf(STRUCT)); - - // - hIntJDBCtypes.put("BIGINT", Integer.valueOf(java.sql.Types.BIGINT)); - hIntJDBCtypes.put("BINARY", Integer.valueOf(java.sql.Types.BINARY)); - hIntJDBCtypes.put("BIT", Integer.valueOf(java.sql.Types.BIT)); - hIntJDBCtypes.put("CHAR", Integer.valueOf(java.sql.Types.CHAR)); - hIntJDBCtypes.put("DATE", Integer.valueOf(java.sql.Types.DATE)); - hIntJDBCtypes.put("DECIMAL", Integer.valueOf(java.sql.Types.DECIMAL)); - hIntJDBCtypes.put("DOUBLE", Integer.valueOf(java.sql.Types.DOUBLE)); - hIntJDBCtypes.put("FLOAT", Integer.valueOf(java.sql.Types.FLOAT)); - hIntJDBCtypes.put("INTEGER", Integer.valueOf(java.sql.Types.INTEGER)); - hIntJDBCtypes.put("LONGVARBINARY", - Integer.valueOf(java.sql.Types.LONGVARBINARY)); - hIntJDBCtypes.put("LONGVARCHAR", - Integer.valueOf(java.sql.Types.LONGVARCHAR)); - hIntJDBCtypes.put("NULL", Integer.valueOf(java.sql.Types.NULL)); - hIntJDBCtypes.put("NUMERIC", Integer.valueOf(java.sql.Types.NUMERIC)); - hIntJDBCtypes.put("OTHER", Integer.valueOf(java.sql.Types.OTHER)); - hIntJDBCtypes.put("REAL", Integer.valueOf(java.sql.Types.REAL)); - hIntJDBCtypes.put("SMALLINT", Integer.valueOf(java.sql.Types.SMALLINT)); - hIntJDBCtypes.put("TIME", Integer.valueOf(java.sql.Types.TIME)); - hIntJDBCtypes.put("TIMESTAMP", Integer.valueOf(java.sql.Types.TIMESTAMP)); - hIntJDBCtypes.put("TINYINT", Integer.valueOf(java.sql.Types.TINYINT)); - hIntJDBCtypes.put("VARBINARY", Integer.valueOf(java.sql.Types.VARBINARY)); - hIntJDBCtypes.put("VARCHAR", Integer.valueOf(java.sql.Types.VARCHAR)); - hIntJDBCtypes.put("BOOLEAN", Integer.valueOf(java.sql.Types.BOOLEAN)); - } - - public Hashtable getHashtable() { - return hStringJDBCtypes; - } - - public String toString(int type) { - return (String) hStringJDBCtypes.get(Integer.valueOf(type)); - } - - public int toInt(String type) { - - Integer tempInteger = (Integer) hIntJDBCtypes.get(type); - - return tempInteger.intValue(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/MainInvoker.java b/database/hsqldb/src/org/hsqldb/util/MainInvoker.java deleted file mode 100644 index 931a116a..00000000 --- a/database/hsqldb/src/org/hsqldb/util/MainInvoker.java +++ /dev/null @@ -1,155 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; - -/** - * Invokes the static main(String[]) method from each class specified. - * - * This class will System.exit() if any invocation fails. - * - * @author Blaine Simpson (blaine dot simpson at admc dot com) - * @since HSQLDB 1.8.0 - * @version $Revision: 6509 $, $Date: 2022-05-17 14:18:08 +0100 (Tue, 17 May 2022) $ - */ -public class MainInvoker { - - /* - * This class currently consists of just a static utility. - * It may or may not make sense to make this into a class with real - * instances that can keep track of status of stuff invoked by it. - */ - private static String[] emptyStringArray = new String[0]; - - private static void syntaxFailure() { - System.err.println(SYNTAX_MSG); - System.exit(2); - } - - /** - * Invokes the static main(String[]) method from each specified class. - * This method will System.exit() if any invocation fails. - * - * Note that multiple class invocations are delimited by empty-string - * parameters. How the user supplies these empty strings is determined - * entirely by the caller's environment. From Windows this can - * generally be accomplished with double-quotes like "". From all - * popular UNIX shells, this can be accomplished with single or - * double-quotes: '' or "". - * - * @param sa Run java org.hsqldb.util.MainInvoker --help for syntax help - */ - public static void main(String[] sa) { - - if (sa.length > 0 && sa[0].equals("--help")) { - System.err.println(SYNTAX_MSG); - System.exit(0); - } - - ArrayList outList = new ArrayList(); - int curInArg = -1; - - try { - while (++curInArg < sa.length) { - if (sa[curInArg].length() < 1) { - if (outList.size() < 1) { - syntaxFailure(); - } - - invoke((String) outList.remove(0), - (String[]) outList.toArray(emptyStringArray)); - outList.clear(); - } else { - outList.add(sa[curInArg]); - } - } - - if (outList.size() < 1) { - syntaxFailure(); - } - - invoke((String) outList.remove(0), - (String[]) outList.toArray(emptyStringArray)); - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - } - - public static final String LS = System.getProperty("line.separator"); - private static String SYNTAX_MSG = - " java org.hsqldb.util.MainInvoker " - + "[package1.Class1 [arg1a arg1b...] \"\"]... \\\n" - + " packageX.ClassX [argXa argXb...]\n" + "OR\n" - + " java org.hsqldb.util.MainInvoker --help\n\n" - + "Note that you can only invoke classes in 'named' (non-default) " - + "packages. Delimit multiple classes with empty strings."; - static { - if (!LS.equals("\n")) { - SYNTAX_MSG = SYNTAX_MSG.replaceAll("\n", LS); - } - } - - /** - * Invokes the static main(String[]) method from each specified class. - * - * @param className String - * @param args String[] - * @throws ClassNotFoundException if not found - * @throws NoSuchMethodException if not found - * @throws IllegalAccessException on no access - * @throws InvocationTargetException on invocation failure - */ - public static void invoke(String className, - String[] args) - throws ClassNotFoundException, - NoSuchMethodException, - IllegalAccessException, - InvocationTargetException { - - Class c; - Method method; - Class[] stringArrayCA = { emptyStringArray.getClass() }; - Object[] objectArray = { (args == null) ? emptyStringArray - : args }; - - c = Class.forName(className); - method = c.getMethod("main", stringArrayCA); - - method.invoke(null, objectArray); - - //System.err.println(c.getName() + ".main() invoked"); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/McKoiTransferHelper.java b/database/hsqldb/src/org/hsqldb/util/McKoiTransferHelper.java deleted file mode 100644 index cfd85071..00000000 --- a/database/hsqldb/src/org/hsqldb/util/McKoiTransferHelper.java +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; - -/** - * Helper class for conversion from a different databases - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @version 1.7.0 - */ -class McKoiTransferHelper extends TransferHelper { - - McKoiTransferHelper() { - super(); - } - - String fixupColumnDefRead(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) { - - String CompareString = "UNIQUEKEY('" + t.Stmts.sDestTable + "'"; - - if (columnType.indexOf(CompareString) > 0) { - - // We just found a increment - columnType = "SERIAL"; - } - - return (columnType); - } - - public McKoiTransferHelper(TransferDb database, Traceable t, String q) { - super(database, t, q); - } - - String fixupColumnDefWrite(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) { - - if (columnType.equals("SERIAL")) { - columnType = "INTEGER DEFAULT UNIQUEKEY ('" - + t.Stmts.sSourceTable + "')"; - } - - return (columnType); - } - - boolean needTransferTransaction() { - return (true); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/NoWay.gif b/database/hsqldb/src/org/hsqldb/util/NoWay.gif deleted file mode 100644 index c865ddf2..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/NoWay.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/OracleTransferHelper.java b/database/hsqldb/src/org/hsqldb/util/OracleTransferHelper.java deleted file mode 100644 index 71d4d369..00000000 --- a/database/hsqldb/src/org/hsqldb/util/OracleTransferHelper.java +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; - -// brian.porter@siteforce.de 20020703 - make sure date is loaded in the required format -// Stephan Frind 20040508 - improvements - -/** - * Conversions from Oracle databases - * - * @author Nichola Bazin - * @version 1.7.0 - */ -class OracleTransferHelper extends TransferHelper { - - private static final int ORACLE = 0; - private static final int HSQLDB = 1; - String[][] Funcs = { - { - "now()", "'now'" - } - }; - - OracleTransferHelper() { - - super(); - - System.out.println("simple init of OracleTransferHelper"); - } - - OracleTransferHelper(TransferDb database, Traceable t, String q) { - super(database, t, q); - } - - void set(TransferDb database, Traceable t, String q) { - - super.set(database, t, q); - - // set the Dateformat for our connection - String dateFormatStmnt = - "ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"; - - System.out.println("dateFormatStmnt: " + dateFormatStmnt); - - try { - tracer.trace("Executing " + dateFormatStmnt); - database.execute(dateFormatStmnt); - } catch (Exception e) { - tracer.trace("Ignoring error " + e.getMessage()); - System.out.println("Ignoring error " + e.getMessage()); - } - } - - String fixupColumnDefRead(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - return fixupColumnDefRead(t.Stmts.sDestTable, meta, columnType, - columnDesc, columnIndex); - } - - String fixupColumnDefWrite(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - - if (columnType.equals("SERIAL")) { - String SeqName = "_" + columnDesc.getString(4) + "_seq"; - int spaceleft = 31 - SeqName.length(); - - if (t.Stmts.sDestTable.length() > spaceleft) { - SeqName = t.Stmts.sDestTable.substring(0, spaceleft) - + SeqName; - } else { - SeqName = t.Stmts.sDestTable + SeqName; - } - - String DropSequence = "DROP SEQUENCE " + SeqName + ";"; - - t.Stmts.sDestDrop += DropSequence; - } - - for (int Idx = 0; Idx < Funcs.length; Idx++) { - String HSQLDB_func = Funcs[Idx][HSQLDB]; - int iStartPos = columnType.indexOf(HSQLDB_func); - - if (iStartPos >= 0) { - String NewColumnType = columnType.substring(0, iStartPos); - - NewColumnType += Funcs[Idx][ORACLE]; - NewColumnType += columnType.substring(iStartPos - + HSQLDB_func.length()); - columnType = NewColumnType; - } - } - - return (columnType); - } - - void beginDataTransfer() { - - try { - db.setAutoCommit(false); - } catch (Exception e) {} - } - - void endDataTransfer() { - - try { - db.commit(); - } catch (Exception e) {} - } - - String fixupColumnDefRead(String aTableName, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - - String SeqName = "_" + columnDesc.getString(4) + "_seq"; - int spaceleft = 31 - SeqName.length(); - - if (aTableName.length() > spaceleft) { - SeqName = aTableName.substring(0, spaceleft) + SeqName; - } else { - SeqName = aTableName + SeqName; - } - - String CompareString = "nextval('\"" + SeqName + "\"'"; - - if (columnType.contains(CompareString)) { - - // We just found a increment - columnType = "SERIAL"; - } - - for (int Idx = 0; Idx < Funcs.length; Idx++) { - String ORACLE_func = Funcs[Idx][ORACLE]; - int iStartPos = columnType.indexOf(ORACLE_func); - - if (iStartPos >= 0) { - String NewColumnType = columnType.substring(0, iStartPos); - - NewColumnType += Funcs[Idx][HSQLDB]; - NewColumnType += columnType.substring(iStartPos - + ORACLE_func.length()); - columnType = NewColumnType; - } - } - - return (columnType); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/PostgresTransferHelper.java b/database/hsqldb/src/org/hsqldb/util/PostgresTransferHelper.java deleted file mode 100644 index a34b71dd..00000000 --- a/database/hsqldb/src/org/hsqldb/util/PostgresTransferHelper.java +++ /dev/null @@ -1,167 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Types; - -// fredt@users 20020215 - patch 516309 by Nicolas Bazin - transfer PostgresSQL -// sqlbob@users 20020325 - patch 1.7.0 - reengineering - -/** - * Conversions from PostgresSQL databases - * - * @author Nichola Bazin - * @version 1.7.0 - */ -class PostgresTransferHelper extends TransferHelper { - - private static final int PostgreSQL = 0; - private static final int HSQLDB = 1; - String[][] Funcs = { - { - "now()", "'now'" - } - }; - - PostgresTransferHelper() { - super(); - } - - PostgresTransferHelper(TransferDb database, Traceable t, String q) { - super(database, t, q); - } - - int convertToType(int type) { - - if (type == Types.DECIMAL) { - type = Types.NUMERIC; - - tracer.trace("Converted DECIMAL to NUMERIC"); - } - - return (type); - } - - String fixupColumnDefRead(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - - String SeqName = "_" + columnDesc.getString(4) + "_seq"; - int spaceleft = 31 - SeqName.length(); - - if (t.Stmts.sDestTable.length() > spaceleft) { - SeqName = t.Stmts.sDestTable.substring(0, spaceleft) + SeqName; - } else { - SeqName = t.Stmts.sDestTable + SeqName; - } - - String CompareString = "nextval('\"" + SeqName + "\"'"; - - if (columnType.contains(CompareString)) { - - // We just found a increment - columnType = "SERIAL"; - } - - for (int Idx = 0; Idx < Funcs.length; Idx++) { - String PostgreSQL_func = Funcs[Idx][PostgreSQL]; - int iStartPos = columnType.indexOf(PostgreSQL_func); - - if (iStartPos >= 0) { - String NewColumnType = columnType.substring(0, iStartPos); - - NewColumnType += Funcs[Idx][HSQLDB]; - NewColumnType += - columnType.substring(iStartPos - + PostgreSQL_func.length()); - columnType = NewColumnType; - } - } - - return (columnType); - } - - String fixupColumnDefWrite(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - - if (columnType.equals("SERIAL")) { - String SeqName = "_" + columnDesc.getString(4) + "_seq"; - int spaceleft = 31 - SeqName.length(); - - if (t.Stmts.sDestTable.length() > spaceleft) { - SeqName = t.Stmts.sDestTable.substring(0, spaceleft) - + SeqName; - } else { - SeqName = t.Stmts.sDestTable + SeqName; - } - - String DropSequence = "DROP SEQUENCE " + SeqName + ";"; - - t.Stmts.sDestDrop += DropSequence; - } - - for (int Idx = 0; Idx < Funcs.length; Idx++) { - String HSQLDB_func = Funcs[Idx][HSQLDB]; - int iStartPos = columnType.indexOf(HSQLDB_func); - - if (iStartPos >= 0) { - String NewColumnType = columnType.substring(0, iStartPos); - - NewColumnType += Funcs[Idx][PostgreSQL]; - NewColumnType += columnType.substring(iStartPos - + HSQLDB_func.length()); - columnType = NewColumnType; - } - } - - return (columnType); - } - - void beginDataTransfer() { - - try { - db.setAutoCommit(false); - } catch (Exception e) {} - } - - void endDataTransfer() { - - try { - db.commit(); - db.execute("VACUUM ANALYZE"); - } catch (Exception e) {} - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/RCData.java b/database/hsqldb/src/org/hsqldb/util/RCData.java deleted file mode 100644 index 4093444d..00000000 --- a/database/hsqldb/src/org/hsqldb/util/RCData.java +++ /dev/null @@ -1,518 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.net.MalformedURLException; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.Properties; -import java.util.Set; -import java.util.HashSet; -import java.util.StringTokenizer; -import java.util.regex.Pattern; - -/* $Id: RCData.java 6555 2022-06-11 10:02:16Z fredt $ */ - -/** - * Manages all the details we need to connect up to JDBC database(s), - * in a declarative way. - *

    - * The file src/org/hsqldb/sample/SqlFileEmbedder.java - * in the HSQLDB distribution provides an example of how to use RCData for your - * own programs. - * - * @see - * The RC File section of the HyperSQL Utilities Guide - * @author Blaine Simpson (blaine dot simpson at admc dot com) - */ -public class RCData { - - public static final String DEFAULT_JDBC_DRIVER = "org.hsqldb.jdbc.JDBCDriver"; - private String defaultJdbcDriverName = DEFAULT_JDBC_DRIVER; - - public void setDefaultJdbcDriver(String defaultJdbcDriverName) { - this.defaultJdbcDriverName = defaultJdbcDriverName; - } - - public String getDefaultJdbcDriverName() { - return defaultJdbcDriverName; - } - - /** - * DISABLED DUE TO SECURITY CONCERNS. - * Just for testing and debugging. - * - * N.b. this echoes passwords! - public void report() { - System.err.println("urlid: " + id + ", url: " + url + ", username: " - + username + ", password: " + password); - } - * @return string representation - */ - - public String toString() { - return "id: " + angleBracketNull(id) - + ", url: " + angleBracketNull(url) - + ", username: " + angleBracketNull(username) - + ", password: <" + (password == null ? "NULL" : "PRESENT") + ">" - + ", ti: " + angleBracketNull(ti) - + ", driver: " + angleBracketNull(driver) - + ", truststore: " + angleBracketNull(truststore) - + ", libpath: " + angleBracketNull(libpath); - } - - private static String angleBracketNull(final String s) { - return s == null ? "" : s; - } - - - /** - * Creates a RCDataObject by looking up the given key in the - * given authentication file. - * - * @param file File containing the authentication information. - * @param dbKey Key to look up in the file. - * If null, then will echo all urlids in the file to stdout. - * (A rather ill-conceived design). - * @throws Exception any exception - */ - public RCData(File file, String dbKey) throws Exception { - // This set is so we can catch duplicates. - Set idPatterns = new HashSet(); - - if (file == null) { - throw new IllegalArgumentException("RC file name not specified"); - } - - if (!file.canRead()) { - throw new IOException("Please set up authentication file '" + file - + "'"); - } - - // System.err.println("Using RC file '" + file + "'"); - StringTokenizer tokenizer; - boolean loadingStanza = false; - String s; - String[] tokens; - String keyword, value; - int linenum = 0; - BufferedReader br = new BufferedReader(new FileReader(file)); - - try { - while ((s = br.readLine()) != null) { - ++linenum; - - s = s.trim(); - - if (s.isEmpty()) { - continue; - } - - if (s.charAt(0) == '#') { - continue; - } - - tokenizer = new StringTokenizer(s); - - if (tokenizer.countTokens() == 1) { - keyword = tokenizer.nextToken(); - value = ""; - } else if (tokenizer.countTokens() > 1) { - keyword = tokenizer.nextToken(); - value = tokenizer.nextToken("").trim(); - } else { - throw new Exception("Corrupt line " + linenum + " in '" + file - + "': " + s); - } - - if (keyword.equals("urlid")) { - tokens = value.split("\\s*,\\s*", -1); - for (int i = 0; i < tokens.length; i++) { - if (idPatterns.contains(tokens[i])) - throw new Exception("ID Pattern '" + tokens[i] - + "' repeated at line " + linenum + " in '" - + file + "'"); - idPatterns.add(tokens[i]); - if (dbKey == null) { - System.out.println(tokens[i]); - continue; - } - loadingStanza = - Pattern.compile(tokens[i]).matcher(dbKey).matches(); - if (id == null && loadingStanza) id = dbKey; - } - - continue; - } - if (dbKey == null) continue; - - if (loadingStanza) { - if (keyword.equals("url")) { - url = value; - } else if (keyword.equals("username")) { - username = value; - } else if (keyword.equals("driver")) { - driver = value; - } else if (keyword.equals("charset")) { - charset = value; - } else if (keyword.equals("truststore")) { - truststore = value; - } else if (keyword.equals("password")) { - password = value; - } else if (keyword.equals("transiso")) { - ti = value; - } else if (keyword.equals("libpath")) { - libpath = value; - } else { - throw new Exception("Bad line " + linenum + " in '" + file - + "': " + s); - } - } - } - } finally { - try { - br.close(); - } catch (IOException ioe) { - // Can only report on so many errors at one time - } - br = null; // Encourage GC - } - - - //System.err.println(idPatterns.size() + " patterns: " + idPatterns); - if (dbKey == null) { - return; - } - - if (libpath != null) { - throw new IllegalArgumentException( - "Sorry, 'libpath' not supported yet"); - } - - if (id == null) - throw new IllegalArgumentException( - "No match for '" + dbKey + "' in file '" + file + "'"); - } - - /** - * Convenience constructor for backward compatibility. - * - * @see #RCData(String,String,String,String,String,String,String,String) - */ - public RCData(String id, String url, String username, String password, - String driver, String charset, - String truststore) throws Exception { - this(id, url, username, password, driver, charset, truststore, null); - } - - /** - * Wrapper for unset Transaction Isolation. - */ - public RCData(String id, String url, String username, String password, - String driver, String charset, String truststore, - String libpath) throws Exception { - this(id, url, username, password, driver, charset, truststore, - libpath, null); - } - - /** - * Creates a new RCData object. - * - *

    - * The parameters driver, charset, truststore, and libpath are optional. - * Setting these parameters to NULL will set them to their - * default values. - * - * @param id The identifier for these connection settings - * @param url The URL of the database to connect to - * @param username The username to log in as - * @param password The password of the username - * @param driver The JDBC driver to use - * @param charset The character set to use - * @param truststore The trust store to use - * @param libpath The JDBC library to add to CLASSPATH - * @param ti The transaction level - * @throws Exception if the a non-optional parameter is set to NULL - */ - public RCData(String id, String url, String username, String password, - String driver, String charset, String truststore, - String libpath, String ti) throws Exception { - - this.id = id; - this.url = url; - this.username = username; - this.password = password; - this.ti = ti; - this.driver = driver; - this.charset = charset; - this.truststore = truststore; - this.libpath = libpath; - - if (libpath != null) { - throw new IllegalArgumentException( - "Sorry, 'libpath' not supported yet"); - } - - // We now require only id to be set by this constructor. - // This allows using programs to add settings to an RC object partially - // populated by RC file. - // Will not find out about missing 'url' until try to actually connect. - if (id == null) { - throw new Exception("id was not set"); - } - } - - /* Purposefully not using JavaBean paradigm so that these fields can - * be used as a traditional, public DO */ - public String id; - public String url; - public String username; - public String password; - public String ti; - public String driver; - public String charset; - public String truststore; - public String libpath; - - /** - * Gets a JDBC Connection using the data of this RCData object. - * - * @return New JDBC Connection - * @throws SQLException on database access error - * @throws MalformedURLException on malformed URL - */ - public Connection getConnection() - throws SQLException, MalformedURLException { - return getConnection(null, null); - } - - /** - * Gets a JDBC Connection using the data of this RCData object with - * specified override elements - * - * @param curDriverIn driver - * @param curTrustStoreIn trusted store - * @return New JDBC Connection - * @throws MalformedURLException on malformed URL - * @throws SQLException on database access error - */ - public Connection getConnection(String curDriverIn, String curTrustStoreIn) - throws MalformedURLException, - SQLException { - - // Local vars to satisfy compiler warnings - String curDriver = null; - String curTrustStore = null; - - Properties sysProps = System.getProperties(); - - if (curDriverIn == null) { - - // If explicit driver not specified - curDriver = ((driver == null) ? DEFAULT_JDBC_DRIVER - : driver); - } else { - curDriver = expandSysPropVars(curDriverIn); - } - - if (curTrustStoreIn == null) { - if (truststore != null) { - curTrustStore = expandSysPropVars(truststore); - } - } else { - curTrustStore = expandSysPropVars(curTrustStoreIn); - } - - if (curTrustStore == null) { - sysProps.remove("javax.net.ssl.trustStore"); - } else { - sysProps.put("javax.net.ssl.trustStore", curTrustStore); - } - - String urlString; - if (url == null) { - throw new MalformedURLException( - "url string is required to establish a connection, but is null" - ); - } - - try { - urlString = expandSysPropVars(url); - } catch (IllegalArgumentException iae) { - throw new MalformedURLException(iae.toString() + " for URL '" - + url + "'"); - } - - String userString = null; - - if (username != null) try { - userString = expandSysPropVars(username); - } catch (IllegalArgumentException iae) { - throw new MalformedURLException(iae.toString() - + " for user name '" + username - + "'"); - } - - String passwordString = null; - - if (password != null) try { - passwordString = expandSysPropVars(password); - } catch (IllegalArgumentException iae) { - throw new MalformedURLException(iae.toString() - + " for password"); - } - - // Every modern JDBC driver will register the driver as SP service - // or a module service, so this should never be needed: - //Class.forName(curDriver); - - Connection c = (userString == null) - ? DriverManager.getConnection(urlString) - : DriverManager.getConnection(urlString, userString, - passwordString); - if (ti != null) RCData.setTI(c, ti); - // Would like to verify the setting made by checking - // c.getTransactionIsolation(). Unfortunately, the spec allows for - // databases to substitute levels according to some rules, and it's - // impossible to know what to expect since custom levels are permitted. - // Debug: - // System.err.println("TI set to " + ti + "\nPOST: " - // + SqlTool.tiToString(c.getTransactionIsolation())); - - return c; - } - - /** - * Returns a copy of the given String with System property names in the - * format ${system.property} replaced by the corresponding Java - * System Properties. - * - * @param inString String - * @return formatted string - */ - public static String expandSysPropVars(String inString) { - - String outString = inString; - int varOffset, varEnd; - String varVal, varName; - - while (true) { - - // Recursive substitution for ${x} variables. - varOffset = outString.indexOf("${"); - - if (varOffset < 0) { - break; - } - - varEnd = outString.indexOf('}', varOffset + 2); - - if (varEnd < 0) { - break; - } - - varName = outString.substring(varOffset + 2, varEnd); - - if (varName.length() < 1) { - throw new IllegalArgumentException("Bad variable setting"); - } - - varVal = System.getProperty(varName); - - if (varVal == null) { - throw new IllegalArgumentException( - "No Java system property with name '" + varName + "'"); - } - - outString = outString.substring(0, varOffset) + varVal - + outString.substring(varEnd + 1); - } - - return outString; - } - - /** - * Set Transaction Isolation level on the specified JDBC Connection - */ - public static void setTI(Connection c, String tiString) - throws SQLException { - int i = -1; - if (tiString.equals("TRANSACTION_READ_UNCOMMITTED")) - i = Connection.TRANSACTION_READ_UNCOMMITTED; - if (tiString.equals("TRANSACTION_READ_COMMITTED")) - i = Connection.TRANSACTION_READ_COMMITTED; - if (tiString.equals("TRANSACTION_REPEATABLE_READ")) - i = Connection.TRANSACTION_REPEATABLE_READ; - if (tiString.equals("TRANSACTION_SERIALIZABLE")) - i = Connection.TRANSACTION_SERIALIZABLE; - if (tiString.equals("TRANSACTION_NONE")) - i = Connection.TRANSACTION_NONE; - if (i < 0) { - throw new SQLException( - "Trans. isol. value not supported by " - + RCData.class.getName() + ": " + tiString); - } - c.setTransactionIsolation(i); - } - - /** - * Return a String representation for the given numerical - * java.sql.Connection Transaction level. - *

    - * Database implementations are free to provide their own transaction - * isolation levels, so you can't depend upon this method to much. - * - * @param ti Transaction levle - * @return The string representation - */ - public static String tiToString(int ti) { - switch (ti) { - case Connection.TRANSACTION_READ_UNCOMMITTED: - return "TRANSACTION_READ_UNCOMMITTED"; - case Connection.TRANSACTION_READ_COMMITTED: - return "TRANSACTION_READ_COMMITTED"; - case Connection.TRANSACTION_REPEATABLE_READ: - return "TRANSACTION_REPEATABLE_READ"; - case Connection.TRANSACTION_SERIALIZABLE: - return "TRANSACTION_SERIALIZABLE"; - case Connection.TRANSACTION_NONE: - return "TRANSACTION_NONE"; - } - return "Custom Transaction Isolation numerical value: " + ti; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/RedCircle.gif b/database/hsqldb/src/org/hsqldb/util/RedCircle.gif deleted file mode 100644 index 35c2a752..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/RedCircle.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/SQLStatements.java b/database/hsqldb/src/org/hsqldb/util/SQLStatements.java deleted file mode 100644 index 8e3b4238..00000000 --- a/database/hsqldb/src/org/hsqldb/util/SQLStatements.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.io.Serializable; - -/** - * container for set of SQL statements - * - * New class based on Hypersonic SQL code. - * - * @version 1.7.1 - * @since 1.7.1 - */ -class SQLStatements implements Serializable { - - String sSchema, sType; - String sDatabaseToConvert; - String sSourceTable, sDestTable; - String sDestDrop, sDestCreate, sDestInsert, sDestDelete; - String sDestDropIndex, sDestCreateIndex, sDestAlter, sSourceSelect; - boolean bTransfer = true; - boolean bCreate = true; - boolean bDelete = true; - boolean bDrop = true; - boolean bCreateIndex = true; - boolean bDropIndex = true; - boolean bInsert = true; - boolean bAlter = true; - boolean bFKForced = false; - boolean bIdxForced = false; -} diff --git a/database/hsqldb/src/org/hsqldb/util/SqlServerTransferHelper.java b/database/hsqldb/src/org/hsqldb/util/SqlServerTransferHelper.java deleted file mode 100644 index c52b909e..00000000 --- a/database/hsqldb/src/org/hsqldb/util/SqlServerTransferHelper.java +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.Types; - -// sqlbob@users 20020325 - patch 1.7.0 - reengineering - -/** - * Conversions from SQLServer7 databases - * - * @version 1.7.0 - */ -class SqlServerTransferHelper extends TransferHelper { - - private boolean firstTinyintRow; - private boolean firstSmallintRow; - - SqlServerTransferHelper() { - super(); - } - - SqlServerTransferHelper(TransferDb database, Traceable t, String q) { - super(database, t, q); - } - - String formatTableName(String t) { - - if (t == null) { - return t; - } - - if (t.equals("")) { - return t; - } - - if (t.indexOf(' ') != -1) { - return ("[" + t + "]"); - } else { - return (formatIdentifier(t)); - } - } - - int convertFromType(int type) { - - // MS SQL 7 specific problems (Northwind database) - if (type == 11) { - tracer.trace("Converted DATETIME (type 11) to TIMESTAMP"); - - type = Types.TIMESTAMP; - } else if (type == -9) { - tracer.trace("Converted NVARCHAR (type -9) to VARCHAR"); - - type = Types.VARCHAR; - } else if (type == -8) { - tracer.trace("Converted NCHAR (type -8) to VARCHAR"); - - type = Types.VARCHAR; - } else if (type == -10) { - tracer.trace("Converted NTEXT (type -10) to VARCHAR"); - - type = Types.VARCHAR; - } else if (type == -1) { - tracer.trace("Converted LONGTEXT (type -1) to LONGVARCHAR"); - - type = Types.LONGVARCHAR; - } - - return (type); - } - - void beginTransfer() { - firstSmallintRow = true; - firstTinyintRow = true; - } - - Object convertColumnValue(Object value, int column, int type) { - - // solves a problem for MS SQL 7 - if ((type == Types.SMALLINT) && (value instanceof Integer)) { - if (firstSmallintRow) { - firstSmallintRow = false; - - tracer.trace("SMALLINT: Converted column " + column - + " Integer to Short"); - } - - value = Short.valueOf((short) ((Integer) value).intValue()); - } else if ((type == Types.TINYINT) && (value instanceof Integer)) { - if (firstTinyintRow) { - firstTinyintRow = false; - - tracer.trace("TINYINT: Converted column " + column - + " Integer to Byte"); - } - - value = Byte.valueOf((byte) ((Integer) value).intValue()); - } - - return (value); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/TableSorter.java b/database/hsqldb/src/org/hsqldb/util/TableSorter.java deleted file mode 100644 index e5a13eef..00000000 --- a/database/hsqldb/src/org/hsqldb/util/TableSorter.java +++ /dev/null @@ -1,620 +0,0 @@ -/* - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of Oracle or the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.hsqldb.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -import javax.swing.Icon; -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; - -/** - * TableSorter is a decorator for TableModels; adding sorting - * functionality to a supplied TableModel. TableSorter does - * not store or copy the data in its TableModel; instead it maintains - * a map from the row indexes of the view to the row indexes of the - * model. As requests are made of the sorter (like getValueAt(row, col)) - * they are passed to the underlying model after the row numbers - * have been translated via the internal mapping array. This way, - * the TableSorter appears to hold another copy of the table - * with the rows in a different order. - *

    - * TableSorter registers itself as a listener to the underlying model, - * just as the JTable itself would. Events recieved from the model - * are examined, sometimes manipulated (typically widened), and then - * passed on to the TableSorter's listeners (typically the JTable). - * If a change to the model has invalidated the order of TableSorter's - * rows, a note of this is made and the sorter will resort the - * rows the next time a value is requested. - *

    - * When the tableHeader property is set, either by using the - * setTableHeader() method or the two argument constructor, the - * table header may be used as a complete UI for TableSorter. - * The default renderer of the tableHeader is decorated with a renderer - * that indicates the sorting status of each column. In addition, - * a mouse listener is installed with the following behavior: - *

      - *
    • - * Mouse-click: Clears the sorting status of all other columns - * and advances the sorting status of that column through three - * values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to - * NOT_SORTED again). - *
    • - * SHIFT-mouse-click: Clears the sorting status of all other columns - * and cycles the sorting status of the column through the same - * three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}. - *
    • - * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except - * that the changes to the column do not cancel the statuses of columns - * that are already sorting - giving a way to initiate a compound - * sort. - *
    - *

    - * This is a long overdue rewrite of a class of the same name that - * first appeared in the swing table demos in 1997. - * - * @author Philip Milne - * @author Brendon McLean - * @author Dan van Enckevort - * @author Parwinder Sekhon - * @version 2.0 02/27/04 - */ -public class TableSorter extends AbstractTableModel { - - protected TableModel tableModel; - public static final int DESCENDING = -1; - public static final int NOT_SORTED = 0; - public static final int ASCENDING = 1; - private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED); - public static final Comparator COMPARABLE_COMPARATOR = new Comparator() { - - public int compare(Object o1, Object o2) { - - if (o1 == o2) { - return 0; - } - - if (o1 == null) { - if (o2 == null) { - return 0; - } - - return -1; - } - - if (o2 == null) { - return 1; - } - - return ((Comparable) o1).compareTo(o2); - } - }; - public static final Comparator LEXICAL_COMPARATOR = new Comparator() { - - public int compare(Object o1, Object o2) { - return o1.toString().compareTo(o2.toString()); - } - }; - private Row[] viewToModel; - private int[] modelToView; - private JTableHeader tableHeader; - private MouseListener mouseListener; - private TableModelListener tableModelListener; - private Map columnComparators = new HashMap(); - private List sortingColumns = new ArrayList(); - - public TableSorter() { - this.mouseListener = new MouseHandler(); - this.tableModelListener = new TableModelHandler(); - } - - public TableSorter(TableModel tableModel) { - - this(); - - setTableModel(tableModel); - } - - public TableSorter(TableModel tableModel, JTableHeader tableHeader) { - - this(); - - setTableHeader(tableHeader); - setTableModel(tableModel); - } - - private void clearSortingState() { - viewToModel = null; - modelToView = null; - } - - public TableModel getTableModel() { - return tableModel; - } - - public void setTableModel(TableModel tableModel) { - - if (this.tableModel != null) { - this.tableModel.removeTableModelListener(tableModelListener); - } - - this.tableModel = tableModel; - - if (this.tableModel != null) { - this.tableModel.addTableModelListener(tableModelListener); - } - - clearSortingState(); - fireTableStructureChanged(); - } - - public JTableHeader getTableHeader() { - return tableHeader; - } - - public void setTableHeader(JTableHeader tableHeader) { - - if (this.tableHeader != null) { - this.tableHeader.removeMouseListener(mouseListener); - - TableCellRenderer defaultRenderer = - this.tableHeader.getDefaultRenderer(); - - if (defaultRenderer instanceof SortableHeaderRenderer) { - this.tableHeader.setDefaultRenderer( - ((SortableHeaderRenderer) defaultRenderer) - .tableCellRenderer); - } - } - - this.tableHeader = tableHeader; - - if (this.tableHeader != null) { - this.tableHeader.addMouseListener(mouseListener); - this.tableHeader.setDefaultRenderer( - new SortableHeaderRenderer( - this.tableHeader.getDefaultRenderer())); - } - } - - public boolean isSorting() { - return sortingColumns.size() != 0; - } - - private Directive getDirective(int column) { - - for (int i = 0; i < sortingColumns.size(); i++) { - Directive directive = (Directive) sortingColumns.get(i); - - if (directive.column == column) { - return directive; - } - } - - return EMPTY_DIRECTIVE; - } - - public int getSortingStatus(int column) { - return getDirective(column).direction; - } - - private void sortingStatusChanged() { - - clearSortingState(); - fireTableDataChanged(); - - if (tableHeader != null) { - tableHeader.repaint(); - } - } - - public void setSortingStatus(int column, int status) { - - Directive directive = getDirective(column); - - if (directive != EMPTY_DIRECTIVE) { - sortingColumns.remove(directive); - } - - if (status != NOT_SORTED) { - sortingColumns.add(new Directive(column, status)); - } - - sortingStatusChanged(); - } - - protected Icon getHeaderRendererIcon(int column, int size) { - - Directive directive = getDirective(column); - - if (directive == EMPTY_DIRECTIVE) { - return null; - } - - return new Arrow(directive.direction == DESCENDING, size, - sortingColumns.indexOf(directive)); - } - - private void cancelSorting() { - sortingColumns.clear(); - sortingStatusChanged(); - } - - public void setColumnComparator(Class type, Comparator comparator) { - - if (comparator == null) { - columnComparators.remove(type); - } else { - columnComparators.put(type, comparator); - } - } - - protected Comparator getComparator(int column) { - - Class columnType = tableModel.getColumnClass(column); - Comparator comparator = - (Comparator) columnComparators.get(columnType); - - if (comparator != null) { - return comparator; - } - - if (Comparable.class.isAssignableFrom(columnType)) { - return COMPARABLE_COMPARATOR; - } - - return LEXICAL_COMPARATOR; - } - - private Row[] getViewToModel() { - - if (viewToModel == null) { - int tableModelRowCount = tableModel.getRowCount(); - - viewToModel = new Row[tableModelRowCount]; - - for (int row = 0; row < tableModelRowCount; row++) { - viewToModel[row] = new Row(row); - } - - if (isSorting()) { - Arrays.sort(viewToModel); - } - } - - return viewToModel; - } - - public int modelIndex(int viewIndex) { - return getViewToModel()[viewIndex].modelIndex; - } - - private int[] getModelToView() { - - if (modelToView == null) { - int n = getViewToModel().length; - - modelToView = new int[n]; - - for (int i = 0; i < n; i++) { - modelToView[modelIndex(i)] = i; - } - } - - return modelToView; - } - - // TableModel interface methods - public int getRowCount() { - return (tableModel == null) ? 0 - : tableModel.getRowCount(); - } - - public int getColumnCount() { - return (tableModel == null) ? 0 - : tableModel.getColumnCount(); - } - - public String getColumnName(int column) { - return tableModel.getColumnName(column); - } - - public Class getColumnClass(int column) { - return tableModel.getColumnClass(column); - } - - public boolean isCellEditable(int row, int column) { - return tableModel.isCellEditable(modelIndex(row), column); - } - - public Object getValueAt(int row, int column) { - return tableModel.getValueAt(modelIndex(row), column); - } - - public void setValueAt(Object aValue, int row, int column) { - tableModel.setValueAt(aValue, modelIndex(row), column); - } - - // Helper classes - private class Row implements Comparable { - - private int modelIndex; - - public Row(int index) { - this.modelIndex = index; - } - - public int compareTo(Object o) { - - int row1 = modelIndex; - int row2 = ((Row) o).modelIndex; - - for (Iterator it = sortingColumns.iterator(); it.hasNext(); ) { - Directive directive = (Directive) it.next(); - int column = directive.column; - Object o1 = tableModel.getValueAt(row1, column); - Object o2 = tableModel.getValueAt(row2, column); - int comparison = 0; - - // Define null less than everything, except null. - if (o1 == null && o2 == null) { - comparison = 0; - } else if (o1 == null) { - comparison = -1; - } else if (o2 == null) { - comparison = 1; - } else { - comparison = getComparator(column).compare(o1, o2); - } - - if (comparison != 0) { - return directive.direction == DESCENDING ? -comparison - : comparison; - } - } - - return 0; - } - } - - private class TableModelHandler implements TableModelListener { - - public void tableChanged(TableModelEvent e) { - - // If we're not sorting by anything, just pass the event along. - if (!isSorting()) { - clearSortingState(); - fireTableChanged(e); - - return; - } - - // If the table structure has changed, cancel the sorting; the - // sorting columns may have been either moved or deleted from - // the model. - if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) { - cancelSorting(); - fireTableChanged(e); - - return; - } - - // We can map a cell event through to the view without widening - // when the following conditions apply: - // - // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and, - // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and, - // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and, - // d) a reverse lookup will not trigger a sort (modelToView != null) - // - // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS. - // - // The last check, for (modelToView != null) is to see if modelToView - // is already allocated. If we don't do this check; sorting can become - // a performance bottleneck for applications where cells - // change rapidly in different parts of the table. If cells - // change alternately in the sorting column and then outside of - // it this class can end up re-sorting on alternate cell updates - - // which can be a performance problem for large tables. The last - // clause avoids this problem. - int column = e.getColumn(); - - if (e.getFirstRow() == e.getLastRow() - && column != TableModelEvent.ALL_COLUMNS - && getSortingStatus(column) == NOT_SORTED - && modelToView != null) { - int viewIndex = getModelToView()[e.getFirstRow()]; - - fireTableChanged(new TableModelEvent(TableSorter.this, - viewIndex, viewIndex, - column, e.getType())); - - return; - } - - // Something has happened to the data that may have invalidated the row order. - clearSortingState(); - fireTableDataChanged(); - } - } - - private class MouseHandler extends MouseAdapter { - - public void mouseClicked(MouseEvent e) { - - JTableHeader h = (JTableHeader) e.getSource(); - TableColumnModel columnModel = h.getColumnModel(); - int viewColumn = h.columnAtPoint(e.getPoint()); - int column = columnModel.getColumn(viewColumn).getModelIndex(); - - if (column != -1) { - int status = getSortingStatus(column); - - if (!e.isControlDown()) { - cancelSorting(); - } - - // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or - // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed. - status = status + (e.isShiftDown() ? -1 - : 1); - status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} - - setSortingStatus(column, status); - } - } - } - - private static class Arrow implements Icon { - - private boolean descending; - private int size; - private int priority; - - public Arrow(boolean descending, int size, int priority) { - - this.descending = descending; - this.size = size; - this.priority = priority; - } - - public void paintIcon(Component c, Graphics g, int x, int y) { - - Color color = c == null ? Color.GRAY - : c.getBackground(); - - // In a compound sort, make each succesive triangle 20% - // smaller than the previous one. - int dx = (int) ((double) size / 2 * Math.pow(0.8, priority)); - int dy = descending ? dx - : -dx; - - // Align icon (roughly) with font baseline. - y = y + 5 * size / 6 + (descending ? -dy - : 0); - - int shift = descending ? 1 - : -1; - - g.translate(x, y); - - // Right diagonal. - g.setColor(color.darker()); - g.drawLine(dx / 2, dy, 0, 0); - g.drawLine(dx / 2, dy + shift, 0, shift); - - // Left diagonal. - g.setColor(color.brighter()); - g.drawLine(dx / 2, dy, dx, 0); - g.drawLine(dx / 2, dy + shift, dx, shift); - - // Horizontal line. - if (descending) { - g.setColor(color.darker().darker()); - } else { - g.setColor(color.brighter().brighter()); - } - - g.drawLine(dx, 0, 0, 0); - g.setColor(color); - g.translate(-x, -y); - } - - public int getIconWidth() { - return size; - } - - public int getIconHeight() { - return size; - } - } - - private class SortableHeaderRenderer implements TableCellRenderer { - - private TableCellRenderer tableCellRenderer; - - public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) { - this.tableCellRenderer = tableCellRenderer; - } - - public Component getTableCellRendererComponent(JTable table, - Object value, boolean isSelected, boolean hasFocus, int row, - int column) { - - Component c = - tableCellRenderer.getTableCellRendererComponent(table, value, - isSelected, hasFocus, row, column); - - if (c instanceof JLabel) { - JLabel l = (JLabel) c; - - l.setHorizontalTextPosition(JLabel.LEFT); - - int modelColumn = table.convertColumnIndexToModel(column); - - l.setIcon(getHeaderRendererIcon(modelColumn, - l.getFont().getSize())); - } - - return c; - } - } - - private static class Directive { - - private int column; - private int direction; - - public Directive(int column, int direction) { - this.column = column; - this.direction = direction; - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/Traceable.java b/database/hsqldb/src/org/hsqldb/util/Traceable.java deleted file mode 100644 index df0fa6c3..00000000 --- a/database/hsqldb/src/org/hsqldb/util/Traceable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -// sqlbob@users 20020407 - patch 1.7.0 - reengineering - -/** - * - * @version 1.7.0 - */ -interface Traceable { - - boolean TRACE = Boolean.getBoolean("hsqldb.util.trace"); - - void trace(String s); -} diff --git a/database/hsqldb/src/org/hsqldb/util/Transfer.java b/database/hsqldb/src/org/hsqldb/util/Transfer.java deleted file mode 100644 index 6b0d4313..00000000 --- a/database/hsqldb/src/org/hsqldb/util/Transfer.java +++ /dev/null @@ -1,1178 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.util.Enumeration; -import java.util.Vector; - -import java.awt.BorderLayout; -import java.awt.Button; -import java.awt.Checkbox; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FileDialog; -import java.awt.Font; -import java.awt.Frame; -import java.awt.GridLayout; -import java.awt.Image; -import java.awt.ItemSelectable; -import java.awt.Label; -import java.awt.Menu; -import java.awt.MenuBar; -import java.awt.MenuItem; -import java.awt.Panel; -import java.awt.SystemColor; -import java.awt.TextField; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.awt.image.MemoryImageSource; - -// fredt@users 20011220 - patch 481239 by xponsard@users - enhancements -// enhancements to support saving and loading of transfer settings, -// transfer of blobs, and catalog and schema names in source db -// changes by fredt to allow saving and loading of transfer settings -// fredt@users 20020215 - patch 516309 by Nicolas Bazin - enhancements -// sqlbob@users 20020401 - patch 1.7.0 - reengineering -// nicolas BAZIN 20020430 - add Catalog selection, correct a bug preventing table -// edition, change double quotes to simple quotes for default values of CHAR type -// lonbinder@users 20030426 - correct bug in prefs load/save -// fredt@users 20040508 - patch 1.7.2 - bug fixes - -/** - * Utility program (or applet) for transferring tables between different - * databases via JDBC. Understands HSQLDB database particularly well. - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 2.5.0 - * @since Hypersonic SQL - */ -public class Transfer extends Panel -implements WindowListener, ActionListener, ItemListener, Traceable { - - Frame fMain; - Image imgEmpty; - DataAccessPoint sourceDb; - DataAccessPoint targetDb; - TransferTable tCurrent; - int iMaxRows; - int iSelectionStep; - Vector tTable; - java.awt.List lTable; - String[] sSourceSchemas; - String sSourceCatalog, sDestSchema, sDestCatalog; - TextField tSourceTable, tDestTable, tDestDropIndex, tDestCreateIndex; - TextField tDestDrop, tDestCreate, tDestDelete, tDestAlter; - TextField tSourceSelect, tDestInsert; - Checkbox cTransfer, cDrop, cCreate, cDelete, cInsert, cAlter; - Checkbox cCreateIndex, cDropIndex; - Checkbox cFKForced, cIdxForced; - Button bStart, bContinue; - TextField tMessage; - int iTransferMode; - static boolean bMustExit; - int CurrentTransfer, CurrentAlter; - static final int SELECT_SOURCE_CATALOG = 1; - static final int SELECT_SOURCE_SCHEMA = 2; - static final int SELECT_DEST_CATALOG = 3; - static final int SELECT_DEST_SCHEMA = 4; - static final int SELECT_SOURCE_TABLES = 5; - static final int TRFM_TRANSFER = 1; - static final int TRFM_DUMP = 2; - static final int TRFM_RESTORE = 3; - - public void trace(String s) { - - if ((s != null) &&!s.equals("")) { - tMessage.setText(s); - - if (TRACE) { - System.out.println(s); - } - } - } - - public void init() { - - Transfer m = new Transfer(); - - m._main(null); - } - - public static void work(String[] arg) { - - Transfer m = new Transfer(); - - m._main(arg); - } - - public static void main(String[] arg) { - - System.getProperties().put("sun.java2d.noddraw", "true"); - - bMustExit = true; - - try { - work(arg); - } catch (IllegalArgumentException iae) { - throw new IllegalArgumentException( - "Try: java "+ Transfer.class.getName() + " --help"); - } - } - - private boolean CatalogToSelect() { - - Vector result = null; - - try { - lTable.removeAll(); - - if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) { - result = sourceDb.getCatalog(); - } else if (iSelectionStep == Transfer.SELECT_DEST_CATALOG) { - result = targetDb.getCatalog(); - } else { - exit(); - } - - if (result.size() > 1) { - lTable.setMultipleMode(true); - - if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) { - bStart.setLabel("Select Catalog: Source"); - } else { - bStart.setLabel("Select Catalog: Destination"); - } - - bStart.invalidate(); - bStart.setEnabled(true); - - for (Enumeration e = - result.elements(); e.hasMoreElements(); ) { - lTable.add(e.nextElement().toString()); - } - - lTable.repaint(); - trace("Select correct Catalog"); - } else { - if (result.size() == 1) { - if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) { - sSourceCatalog = (String) result.firstElement(); - sSourceSchemas = null; - } else { - sDestCatalog = (String) result.firstElement(); - sDestSchema = null; - } - } else { - if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) { - sSourceCatalog = null; - sSourceSchemas = null; - } else { - sDestCatalog = null; - sDestSchema = null; - } - } - - if ((iSelectionStep == Transfer.SELECT_DEST_CATALOG) - && (sDestCatalog != null)) { - try { - targetDb.setCatalog(sDestCatalog); - } catch (Exception ex) { - trace("Catalog " + sSourceCatalog - + " could not be selected in the target database"); - - sSourceCatalog = null; - } - } - - iSelectionStep++; - - ProcessNextStep(); - - return false; - } - } catch (Exception exp) { - lTable.removeAll(); - trace("Exception reading catalog: " + exp); - exp.printStackTrace(); - } - - return (lTable.getItemCount() > 0); - } - - private boolean SchemaToSelect() { - - Vector result = null; - - try { - lTable.removeAll(); - - if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) { - result = sourceDb.getSchemas(); - } else if (iSelectionStep == Transfer.SELECT_DEST_SCHEMA) { - result = targetDb.getSchemas(); - } else { - exit(); - } - - if (result.size() > 1) { - lTable.setMultipleMode(true); - - if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) { - bStart.setLabel("Select Schema: Source"); - } else { - bStart.setLabel("Select Schema: Destination"); - } - - bStart.invalidate(); - bStart.setEnabled(true); - - for (Enumeration e = - result.elements(); e.hasMoreElements(); ) { - lTable.add(e.nextElement().toString()); - } - - lTable.repaint(); - trace("Select correct Schema or load Settings file"); - } else { - if (result.size() == 1) { - if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) { - sSourceSchemas = new String[1]; - sSourceSchemas[0] = (String) result.firstElement(); - } else { - sDestSchema = (String) result.firstElement(); - } - } else { - if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) { - sSourceSchemas = null; - } else { - sDestSchema = null; - } - } - - if (iTransferMode == TRFM_DUMP) { - iSelectionStep = Transfer.SELECT_SOURCE_TABLES; - } else { - iSelectionStep++; - } - - ProcessNextStep(); - - return false; - } - } catch (Exception exp) { - lTable.removeAll(); - trace("Exception reading schemas: " + exp); - exp.printStackTrace(); - } - - return (lTable.getItemCount() > 0); - } - - static private final String SYNTAX_MSG = - "java " + Transfer.class.getName() + " [--help|--dump|--restore]"; - - /** - * @throws IllegalArgumentException for the obvious reason - */ - void _main(String[] arg) { - - /* - ** What function is asked from the transfer tool? - */ - iTransferMode = TRFM_TRANSFER; - - if (arg != null) { - if (arg.length != 1) { - throw new IllegalArgumentException(); - } - if ((arg[0].toLowerCase().equals("-r")) - || (arg[0].toLowerCase().equals("--restore"))) { - iTransferMode = TRFM_RESTORE; } else if ((arg[0].toLowerCase().equals("-d")) - || (arg[0].toLowerCase().equals("--dump"))) { - iTransferMode = TRFM_DUMP; - } else if ((arg[0].toLowerCase().equals("-h")) - || (arg[0].toLowerCase().equals("--help"))) { - System.out.println(Transfer.SYNTAX_MSG); - return; - } else { - throw new IllegalArgumentException(); - } - } - - fMain = new Frame("HSQL Transfer Tool"); - imgEmpty = createImage(new MemoryImageSource(2, 2, new int[4 * 4], 2, - 2)); - - fMain.setIconImage(imgEmpty); - fMain.addWindowListener(this); - fMain.setSize(640, 480); - fMain.add("Center", this); - - MenuBar bar = new MenuBar(); - String[] extras = { - "Insert 10 rows only", "Insert 1000 rows only", "Insert all rows", - "-", "Load Settings...", "Save Settings...", "-", "Exit" - }; - Menu menu = new Menu("Options"); - - addMenuItems(menu, extras); - bar.add(menu); - fMain.setMenuBar(bar); - initGUI(); - - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension size = fMain.getSize(); - - // (ulrivo): full size on screen with less than 640 width - if (d.width >= 640) { - fMain.setLocation((d.width - size.width) / 2, - (d.height - size.height) / 2); - } else { - fMain.setLocation(0, 0); - fMain.setSize(d); - } - - fMain.setVisible(true); - - CurrentTransfer = CurrentAlter = 0; - - try { - if ((iTransferMode == TRFM_DUMP) - || (iTransferMode == TRFM_TRANSFER)) { - sourceDb = new TransferDb( - ConnectionDialog.createConnection( - fMain, "Source Database"), this); - - if (!sourceDb.isConnected()) { - exit(); - - return; - } - } else { - FileDialog f = new FileDialog(fMain, "Restore FileName", - FileDialog.LOAD); - - f.setVisible(true); - - String sFileName = f.getFile(); - String Path = f.getDirectory(); - - if ((sFileName == null) || (sFileName.equals(""))) { - exit(); - - return; - } else { - sourceDb = new TransferSQLText(Path + sFileName, this); - } - } - - if ((iTransferMode == TRFM_RESTORE) - || (iTransferMode == TRFM_TRANSFER)) { - targetDb = new TransferDb( - ConnectionDialog.createConnection( - fMain, "Target Database"), this); - - if (!targetDb.isConnected()) { - exit(); - - return; - } - } else { - FileDialog f = new FileDialog(fMain, "Dump FileName", - FileDialog.SAVE); - - f.setVisible(true); - - String sFileName = f.getFile(); - String Path = f.getDirectory(); - - if ((sFileName == null) || (sFileName.equals(""))) { - exit(); - - return; - } else { - targetDb = new TransferSQLText(Path + sFileName, this); - } - } - } catch (Exception e) { - exit(); - e.printStackTrace(); - - return; - } - - if ((iTransferMode == TRFM_DUMP) - || (iTransferMode == TRFM_TRANSFER)) { - iSelectionStep = SELECT_SOURCE_CATALOG; - sSourceCatalog = null; - } else { - iSelectionStep = SELECT_DEST_CATALOG; - sDestCatalog = null; - } - - ProcessNextStep(); - fMain.setVisible(true); - } - - private void RefreshMainDisplay() { - - lTable.removeAll(); - lTable.repaint(); - - try { - tTable = sourceDb.getTables(sSourceCatalog, sSourceSchemas); - - for (int i = 0; i < tTable.size(); i++) { - TransferTable t = (TransferTable) tTable.elementAt(i); - - t.setDest(sDestSchema, targetDb); - t.extractTableStructure(sourceDb, targetDb); - lTable.add(t.Stmts.sSourceTable); - lTable.select(i); - displayTable(t); - } - - bStart.setEnabled(true); - - if (iTransferMode == TRFM_TRANSFER) { - trace("Edit definitions and press [Start Transfer]"); - } else if (iTransferMode == TRFM_DUMP) { - trace("Edit definitions and press [Start Dump]"); - } - } catch (Exception e) { - trace("Exception reading source tables: " + e); - e.printStackTrace(); - } - - fMain.setVisible(true); - } - - private void addMenuItems(Menu f, String[] m) { - - for (int i = 0; i < m.length; i++) { - if (m[i].equals("-")) { - f.addSeparator(); - } else { - MenuItem item = new MenuItem(m[i]); - - item.addActionListener(this); - f.add(item); - } - } - } - - public void itemStateChanged(ItemEvent e) { - - ItemSelectable item = e.getItemSelectable(); - - if (item == lTable) { - if (iSelectionStep == SELECT_SOURCE_TABLES) { - String table = lTable.getSelectedItem(); - int selected = ((Integer) e.getItem()).intValue(); - - for (int i = 0; i < tTable.size(); i++) { - TransferTable t = (TransferTable) tTable.elementAt(i); - - if (t == null) { - continue; - } - - if (i == selected) { - saveTable(); - displayTable(t); - updateEnabled(true); - } - } - } - } else { - - // it must be a checkbox - saveTable(); - updateEnabled(true); - } - } - - /** - * Method declaration - * - */ - private void saveTable() { - - if (tCurrent == null) { - return; - } - - TransferTable t = tCurrent; - - t.Stmts.sSourceTable = tSourceTable.getText(); - t.Stmts.sDestTable = tDestTable.getText(); - t.Stmts.sDestDrop = tDestDrop.getText(); - t.Stmts.sDestCreateIndex = tDestCreateIndex.getText(); - t.Stmts.sDestDropIndex = tDestDropIndex.getText(); - t.Stmts.sDestCreate = tDestCreate.getText(); - t.Stmts.sDestDelete = tDestDelete.getText(); - t.Stmts.sSourceSelect = tSourceSelect.getText(); - t.Stmts.sDestInsert = tDestInsert.getText(); - t.Stmts.sDestAlter = tDestAlter.getText(); - - // - t.Stmts.bTransfer = cTransfer.getState(); - t.Stmts.bDrop = cDrop.getState(); - t.Stmts.bCreate = cCreate.getState(); - t.Stmts.bDelete = cDelete.getState(); - t.Stmts.bInsert = cInsert.getState(); - t.Stmts.bAlter = cAlter.getState(); - t.Stmts.bCreateIndex = cCreateIndex.getState(); - t.Stmts.bDropIndex = cDropIndex.getState(); - - if (!t.Stmts.bTransfer) { - t.Stmts.bInsert = false; - - cInsert.setState(false); - } - - boolean reparsetable = ((t.Stmts.bFKForced != cFKForced.getState()) - || (t.Stmts.bIdxForced - != cIdxForced.getState())); - - t.Stmts.bFKForced = cFKForced.getState(); - t.Stmts.bIdxForced = cIdxForced.getState(); - - if (reparsetable) { - try { - sourceDb.getTableStructure(t, targetDb); - } catch (Exception e) { - trace("Exception reading source tables: " + e); - e.printStackTrace(); - } - } - } - - private void displayTable(TransferTable t) { - - tCurrent = t; - - if (t == null) { - return; - } - - tSourceTable.setText(t.Stmts.sSourceTable); - tDestTable.setText(t.Stmts.sDestTable); - tDestDrop.setText(t.Stmts.sDestDrop); - tDestCreateIndex.setText(t.Stmts.sDestCreateIndex); - tDestDropIndex.setText(t.Stmts.sDestDropIndex); - tDestCreate.setText(t.Stmts.sDestCreate); - tDestDelete.setText(t.Stmts.sDestDelete); - tSourceSelect.setText(t.Stmts.sSourceSelect); - tDestInsert.setText(t.Stmts.sDestInsert); - tDestAlter.setText(t.Stmts.sDestAlter); - cTransfer.setState(t.Stmts.bTransfer); - cDrop.setState(t.Stmts.bDrop); - cCreate.setState(t.Stmts.bCreate); - cDropIndex.setState(t.Stmts.bDropIndex); - cCreateIndex.setState(t.Stmts.bCreateIndex); - cDelete.setState(t.Stmts.bDelete); - cInsert.setState(t.Stmts.bInsert); - cAlter.setState(t.Stmts.bAlter); - cFKForced.setState(t.Stmts.bFKForced); - cIdxForced.setState(t.Stmts.bIdxForced); - } - - private void updateEnabled(boolean and) { - - boolean b = cTransfer.getState(); - - tDestTable.setEnabled(and && b); - tDestDrop.setEnabled(and && b && cDrop.getState()); - tDestCreate.setEnabled(and && b && cCreate.getState()); - tDestDelete.setEnabled(and && b && cDelete.getState()); - tDestCreateIndex.setEnabled(and && b && cCreateIndex.getState()); - tDestDropIndex.setEnabled(and && b && cDropIndex.getState()); - tSourceSelect.setEnabled(and && b); - tDestInsert.setEnabled(and && b && cInsert.getState()); - tDestAlter.setEnabled(and && b && cAlter.getState()); - cDrop.setEnabled(and && b); - cCreate.setEnabled(and && b); - cDelete.setEnabled(and && b); - cCreateIndex.setEnabled(and && b); - cDropIndex.setEnabled(and && b); - cInsert.setEnabled(and && b); - cAlter.setEnabled(and && b); - cFKForced.setEnabled(cAlter.getState()); - cIdxForced.setEnabled(cCreateIndex.getState()); - bStart.setEnabled(and); - - if (iTransferMode == TRFM_TRANSFER) { - bContinue.setEnabled(and); - } - } - - private void ProcessNextStep() { - - switch (iSelectionStep) { - - case SELECT_SOURCE_CATALOG : - case SELECT_DEST_CATALOG : - if (CatalogToSelect()) { - fMain.setVisible(true); - - return; - } - break; - - case SELECT_DEST_SCHEMA : - case SELECT_SOURCE_SCHEMA : - if (SchemaToSelect()) { - fMain.setVisible(true); - - return; - } - break; - - case SELECT_SOURCE_TABLES : - if (iTransferMode == TRFM_TRANSFER) { - bStart.setLabel("Start Transfer"); - } else if (iTransferMode == TRFM_DUMP) { - bStart.setLabel("Start Dump"); - } else if (iTransferMode == TRFM_RESTORE) { - bStart.setLabel("Start Restore"); - } - - bStart.invalidate(); - bStart.setEnabled(false); - lTable.setMultipleMode(false); - RefreshMainDisplay(); - break; - - default : - break; - } - } - - public void actionPerformed(ActionEvent ev) { - - if (ev.getSource() instanceof TextField) { - saveTable(); - - return; - } - - String s = ev.getActionCommand(); - MenuItem i = new MenuItem(); - - if (s == null) { - if (ev.getSource() instanceof MenuItem) { - i = (MenuItem) ev.getSource(); - s = i.getLabel(); - } - } - - if (s == null) { - } else if (s.equals("Start Transfer") || s.equals("ReStart Transfer")) { - bStart.setLabel("ReStart Transfer"); - bStart.invalidate(); - - CurrentTransfer = 0; - CurrentAlter = 0; - - transfer(); - } else if (s.equals("Continue Transfer")) { - transfer(); - } else if (s.equals("Start Dump") || s.equals("Start Restore")) { - CurrentTransfer = 0; - CurrentAlter = 0; - - transfer(); - } else if (s.equals("Quit")) { - exit(); - } else if (s.contains("Select Schema")) { - String[] selection = lTable.getSelectedItems(); - - if ((selection == null) || (selection.length == 0)) { - return; - } - - if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) { - sSourceSchemas = selection; - } else { - sDestSchema = selection[0]; - } - - if (iTransferMode == TRFM_DUMP) { - iSelectionStep = Transfer.SELECT_SOURCE_TABLES; - } else { - iSelectionStep++; - } - - ProcessNextStep(); - } else if (s.contains("Select Catalog")) { - String selection = lTable.getSelectedItem(); - - if ((selection == null) || (selection.equals(""))) { - return; - } - - if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) { - sSourceCatalog = selection; - sSourceSchemas = null; - } else { - sDestCatalog = selection; - sDestSchema = null; - - try { - targetDb.setCatalog(sDestCatalog); - } catch (Exception ex) { - trace("Catalog " + sDestCatalog - + " could not be selected in the target database"); - - sDestCatalog = null; - } - } - - iSelectionStep++; - - ProcessNextStep(); - } else if (s.equals("Insert 10 rows only")) { - iMaxRows = 10; - } else if (s.equals("Insert 1000 rows only")) { - iMaxRows = 1000; - } else if (s.equals("Insert all rows")) { - iMaxRows = 0; - } else if (s.equals("Load Settings...")) { - FileDialog f = new FileDialog(fMain, "Load Settings", - FileDialog.LOAD); - - f.setVisible(true); - - String file = f.getDirectory() + f.getFile(); - - if (file != null) { - LoadPrefs(file); - displayTable(tCurrent); - } - } else if (s.equals("Save Settings...")) { - FileDialog f = new FileDialog(fMain, "Save Settings", - FileDialog.SAVE); - - f.setVisible(true); - - String file = f.getDirectory() + f.getFile(); - - if (file != null) { - SavePrefs(file); - } - } else if (s.equals("Exit")) { - windowClosing(null); - } - } - - public void windowActivated(WindowEvent e) {} - - public void windowDeactivated(WindowEvent e) {} - - public void windowClosed(WindowEvent e) {} - - private void cleanup() { - - try { - if (sourceDb != null) { - sourceDb.close(); - } - - if (targetDb != null) { - targetDb.close(); - } - } catch (Exception e) {} - } - - public void windowClosing(WindowEvent ev) { - - fMain.dispose(); - - if (bMustExit) { - System.exit(0); - } - } - - public void windowDeiconified(WindowEvent e) {} - - public void windowIconified(WindowEvent e) {} - - public void windowOpened(WindowEvent e) {} - - private void initGUI() { - - Font fFont = new Font("Dialog", Font.PLAIN, 12); - - setLayout(new BorderLayout()); - - Panel p = new Panel(); - - p.setBackground(SystemColor.control); - p.setLayout(new GridLayout(16, 1)); - - tSourceTable = new TextField(); - - tSourceTable.setEnabled(false); - - tDestTable = new TextField(); - - tDestTable.addActionListener(this); - - tDestDrop = new TextField(); - - tDestDrop.addActionListener(this); - - tDestCreate = new TextField(); - - tDestCreate.addActionListener(this); - - tDestDelete = new TextField(); - - tDestDelete.addActionListener(this); - - tDestCreateIndex = new TextField(); - - tDestCreateIndex.addActionListener(this); - - tDestDropIndex = new TextField(); - - tDestDropIndex.addActionListener(this); - - tSourceSelect = new TextField(); - - tSourceSelect.addActionListener(this); - - tDestInsert = new TextField(); - - tDestInsert.addActionListener(this); - - tDestAlter = new TextField(); - - tDestAlter.addActionListener(this); - - cTransfer = new Checkbox("Transfer to destination table", true); - - cTransfer.addItemListener(this); - - cDrop = new Checkbox("Drop destination table (ignore error)", true); - - cDrop.addItemListener(this); - - cCreate = new Checkbox("Create destination table", true); - - cCreate.addItemListener(this); - - cDropIndex = new Checkbox("Drop destination index (ignore error)", - true); - - cDropIndex.addItemListener(this); - - cIdxForced = new Checkbox("force Idx_ prefix for indexes names", - false); - - cIdxForced.addItemListener(this); - - cCreateIndex = new Checkbox("Create destination index", true); - - cCreateIndex.addItemListener(this); - - cDelete = new Checkbox("Delete rows in destination table", true); - - cDelete.addItemListener(this); - - cInsert = new Checkbox("Insert into destination", true); - - cInsert.addItemListener(this); - - cFKForced = new Checkbox("force FK_ prefix for foreign key names", - false); - - cFKForced.addItemListener(this); - - cAlter = new Checkbox("Alter destination table", true); - - cAlter.addItemListener(this); - p.add(createLabel("Source table")); - p.add(tSourceTable); - p.add(cTransfer); - p.add(tDestTable); - p.add(cDrop); - p.add(tDestDrop); - p.add(cCreate); - p.add(tDestCreate); - p.add(cDropIndex); - p.add(tDestDropIndex); - p.add(cCreateIndex); - p.add(tDestCreateIndex); - p.add(cDelete); - p.add(tDestDelete); - p.add(cAlter); - p.add(tDestAlter); - p.add(createLabel("Select source records")); - p.add(tSourceSelect); - p.add(cInsert); - p.add(tDestInsert); - p.add(createLabel("")); - p.add(createLabel("")); - p.add(cIdxForced); - p.add(cFKForced); - p.add(createLabel("")); - p.add(createLabel("")); - - if (iTransferMode == TRFM_TRANSFER) { - bStart = new Button("Start Transfer"); - bContinue = new Button("Continue Transfer"); - - bContinue.setEnabled(false); - } else if (iTransferMode == Transfer.TRFM_DUMP) { - bStart = new Button("Start Dump"); - } else if (iTransferMode == Transfer.TRFM_RESTORE) { - bStart = new Button("Start Restore"); - } - - bStart.addActionListener(this); - p.add(bStart); - - if (iTransferMode == TRFM_TRANSFER) { - bContinue.addActionListener(this); - p.add(bContinue); - } - - bStart.setEnabled(false); - fMain.add("Center", createBorderPanel(p)); - - lTable = new java.awt.List(10); - - lTable.addItemListener(this); - fMain.add("West", createBorderPanel(lTable)); - - tMessage = new TextField(); - - Panel pMessage = createBorderPanel(tMessage); - - fMain.add("South", pMessage); - } - - private Panel createBorderPanel(Component center) { - - Panel p = new Panel(); - - p.setBackground(SystemColor.control); - p.setLayout(new BorderLayout()); - p.add("Center", center); - p.add("South", createLabel("")); - p.add("East", createLabel("")); - p.add("West", createLabel("")); - p.setBackground(SystemColor.control); - - return p; - } - - private Label createLabel(String s) { - - Label l = new Label(s); - - l.setBackground(SystemColor.control); - - return l; - } - - private void SavePrefs(String f) { - saveTable(); - TransferCommon.savePrefs(f, sourceDb, targetDb, this, tTable); - } - - private void LoadPrefs(String f) { - - TransferTable t; - - trace("Parsing Settings file"); - bStart.setEnabled(false); - - if (iTransferMode == TRFM_TRANSFER) { - bContinue.setEnabled(false); - } - - tTable = TransferCommon.loadPrefs(f, sourceDb, targetDb, this); - iSelectionStep = SELECT_SOURCE_TABLES; - - lTable.removeAll(); - - for (int i = 0; i < tTable.size(); i++) { - t = (TransferTable) tTable.elementAt(i); - - lTable.add(t.Stmts.sSourceTable); - } - - t = (TransferTable) tTable.elementAt(0); - - displayTable(t); - lTable.select(0); - updateEnabled(true); - lTable.invalidate(); - - if (iTransferMode == TRFM_TRANSFER) { - bStart.setLabel("Start Transfer"); - trace("Edit definitions and press [Start Transfer]"); - } else if (iTransferMode == TRFM_DUMP) { - bStart.setLabel("Start Dump"); - trace("Edit definitions and press [Start Dump]"); - } else if (iTransferMode == TRFM_RESTORE) { - bStart.setLabel("Start Restore"); - trace("Edit definitions and press [Start Restore]"); - } - - bStart.invalidate(); - - if (iTransferMode == TRFM_TRANSFER) { - bContinue.setEnabled(false); - } - } - - private void transfer() { - - saveTable(); - updateEnabled(false); - trace("Start Transfer"); - - int TransferIndex = CurrentTransfer; - int AlterIndex = CurrentAlter; - TransferTable t = null; - long startTime, stopTime; - - startTime = System.currentTimeMillis(); - - try { - for (int i = TransferIndex; i < tTable.size(); i++) { - CurrentTransfer = i; - t = (TransferTable) tTable.elementAt(i); - - lTable.select(i); - displayTable(t); - t.transferStructure(); - t.transferData(iMaxRows); - } - - for (int i = AlterIndex; i < tTable.size(); i++) { - CurrentAlter = i; - t = (TransferTable) tTable.elementAt(i); - - lTable.select(i); - displayTable(t); - t.transferAlter(); - } - - stopTime = System.currentTimeMillis(); - - trace("Transfer finished successfully in: " - + (stopTime - startTime) / 1000.00 + " sec"); - - if (iTransferMode == TRFM_TRANSFER) { - bContinue.setLabel("Quit"); - bContinue.setEnabled(true); - bContinue.invalidate(); - } else { - bStart.setLabel("Quit"); - bStart.setEnabled(true); - bStart.invalidate(); - } - } catch (Exception e) { - String last = tMessage.getText(); - - trace("Transfer stopped - " + last + " / / Error: " - + e.toString()); - e.printStackTrace(); - } - - if (iTransferMode == TRFM_TRANSFER) { - bContinue.setEnabled((CurrentAlter < tTable.size())); - } - - updateEnabled(true); - System.gc(); - } - - protected void exit() { - - cleanup(); - fMain.dispose(); - - if (bMustExit) { - System.exit(0); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/TransferCommon.java b/database/hsqldb/src/org/hsqldb/util/TransferCommon.java deleted file mode 100644 index 49847559..00000000 --- a/database/hsqldb/src/org/hsqldb/util/TransferCommon.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.Vector; - -// sqlbob@users 20020407 - patch 1.7.0 - reengineering - -/** - * Common code in Swing and AWT versions of Tranfer - * New class based on Hypersonic code - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 1.7.2 - * @since Hypersonic SQL - */ -class TransferCommon { - - static void savePrefs(String f, DataAccessPoint sourceDb, - DataAccessPoint targetDb, Traceable tracer, - Vector tTable) { - - TransferTable t; - - try { - FileOutputStream fos = new FileOutputStream(f); - ObjectOutputStream oos = new ObjectOutputStream(fos); - - for (int i = 0; i < tTable.size(); i++) { - t = (TransferTable) tTable.elementAt(i); - t.sourceDb = null; - t.destDb = null; - t.tracer = null; - } - - oos.writeObject(tTable); - - for (int i = 0; i < tTable.size(); i++) { - t = (TransferTable) tTable.elementAt(i); - t.tracer = tracer; - t.sourceDb = (TransferDb) sourceDb; - t.destDb = targetDb; - } - } catch (IOException e) { - System.out.println("pb in SavePrefs : " + e.toString()); - e.printStackTrace(); - } - } - - static Vector loadPrefs(String f, DataAccessPoint sourceDb, - DataAccessPoint targetDb, Traceable tracer) { - - TransferTable t; - Vector tTable = null; - ObjectInputStream ois = null; - - try { - FileInputStream fis = new FileInputStream(f); - - ois = new ObjectInputStream(fis); - tTable = (Vector) ois.readObject(); - - for (int i = 0; i < tTable.size(); i++) { - t = (TransferTable) tTable.elementAt(i); - t.tracer = tracer; - t.sourceDb = (TransferDb) sourceDb; - t.destDb = targetDb; - } - } catch (ClassNotFoundException e) { - System.out.println("class not found pb in LoadPrefs : " - + e.toString()); - - tTable = new Vector(); - } catch (IOException e) { - System.out.println("IO pb in LoadPrefs : actionPerformed" - + e.toString()); - - tTable = new Vector(); - } finally { - if (ois != null) { - try { - ois.close(); - } catch (IOException ioe) {} - } - } - - return (tTable); - } - - private TransferCommon() {} -} diff --git a/database/hsqldb/src/org/hsqldb/util/TransferDb.java b/database/hsqldb/src/org/hsqldb/util/TransferDb.java deleted file mode 100644 index 53578976..00000000 --- a/database/hsqldb/src/org/hsqldb/util/TransferDb.java +++ /dev/null @@ -1,939 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; -import java.util.Vector; - -// fredt@users 20020215 - patch 516309 by Nicolas Bazin - enhancements -// sqlbob@users 20020401 - patch 1.7.0 - reengineering -// nicolas BAZIN 20020430 - add support of Catalog and mckoi db helper -// Stephan Frind 20040508 - speed improvements - -/** - * Conversions between different databases - * - * @version 1.7.0 - */ -class TransferDb extends DataAccessPoint { - - Connection conn; - DatabaseMetaData meta; - protected Statement srcStatement = null; - - TransferDb(Connection c, Traceable t) throws DataAccessPointException { - - super(t); - - conn = c; - - if (c != null) { - String productLowerName; - - try { - meta = c.getMetaData(); - databaseToConvert = c.getCatalog(); - productLowerName = meta.getDatabaseProductName(); - - if (productLowerName == null) { - productLowerName = ""; - } else { - productLowerName = productLowerName.toLowerCase(); - } - - helper = HelperFactory.getHelper(productLowerName); - - helper.set(this, t, meta.getIdentifierQuoteString()); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - } - } - - boolean isConnected() { - return (conn != null); - } - - boolean getAutoCommit() throws DataAccessPointException { - - boolean result = false; - - try { - result = conn.getAutoCommit(); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - - return result; - } - - void commit() throws DataAccessPointException { - - if (srcStatement != null) { - try { - srcStatement.close(); - } catch (SQLException e) {} - - srcStatement = null; - } - - try { - conn.commit(); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - } - - void rollback() throws DataAccessPointException { - - if (srcStatement != null) { - try { - srcStatement.close(); - } catch (SQLException e) {} - - srcStatement = null; - } - - try { - conn.rollback(); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - } - - void setAutoCommit(boolean flag) throws DataAccessPointException { - - try { - conn.setAutoCommit(flag); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - } - - boolean execute(String statement) throws DataAccessPointException { - - boolean result = false; - Statement stmt = null; - - try { - stmt = conn.createStatement(); - result = stmt.execute(statement); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } finally { - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) {} - } - } - - return result; - } - - TransferResultSet getData(String statement) - throws DataAccessPointException { - - ResultSet rsData = null; - - try { - if (srcStatement != null) { - srcStatement.close(); - } - - srcStatement = conn.createStatement(); - rsData = srcStatement.executeQuery(statement); - } catch (SQLException e) { - try { - srcStatement.close(); - } catch (Exception e1) {} - - srcStatement = null; - rsData = null; - - throw new DataAccessPointException(e.toString()); - } - - return new TransferResultSet(rsData); - } - - void putData(String statement, TransferResultSet r, - int iMaxRows) throws DataAccessPointException { - - if ((statement == null) || statement.equals("") || (r == null)) { - return; - } - - PreparedStatement destPrep = null; - - try { - destPrep = conn.prepareStatement(statement); - - int i = 0; - int tmpLength; - int len = r.getColumnCount(); - int[] tmpTypes = null; - - while (r.next()) { - if (tmpTypes == null) { - tmpTypes = new int[len + 1]; - - for (int j = 1; j <= len; j++) { - tmpTypes[j] = r.getColumnType(j); - } - } - - transferRow(r, destPrep, len, tmpTypes); - - if (iMaxRows != 0 && i == iMaxRows) { - break; - } - - i++; - - if (iMaxRows != 0 || i % 100 == 0) { - tracer.trace("Transfered " + i + " rows"); - } - } - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } finally { - if (destPrep != null) { - try { - destPrep.close(); - } catch (SQLException e) {} - } - } - } - -/* - private void transferRow(TransferResultSet r, - PreparedStatement p) - throws DataAccessPointException, SQLException { - // TODO - // what is this never used variable for? - // looks like missing debug flags because constructing these strings consumes a lot - // of time - String sLast = ""; - - if (p != null) { - p.clearParameters(); - } - - int len = r.getColumnCount(); - - for (int i = 0; i < len; i++) { - int t = r.getColumnType(i + 1); - - sLast = "column=" + r.getColumnName(i + 1) + " datatype=" - + (String) helper.getSupportedTypes().get(Integer.valueOf(t)); - - Object o = r.getObject(i + 1); - - if (o == null) { - if (p != null) { - p.setNull(i + 1, t); - } - - sLast += " value="; - } else { - o = helper.convertColumnValue(o, i + 1, t); - - p.setObject(i + 1, o); - - sLast += " value=\'" + o.toString() + "\'"; - } - } - - if (p != null) { - p.execute(); - } - - sLast = ""; - } -*/ - Vector getSchemas() throws DataAccessPointException { - - Vector ret = new Vector(); - ResultSet result = null; - - try { - result = meta.getSchemas(); - } catch (SQLException e) { - result = null; - } - - try { - if (result != null) { - while (result.next()) { - ret.addElement(result.getString(1)); - } - - result.close(); - } - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - - return (ret); - } - - Vector getCatalog() throws DataAccessPointException { - - Vector ret = new Vector(); - ResultSet result = null; - - if (databaseToConvert != null && databaseToConvert.length() > 0) { - ret.addElement(databaseToConvert); - - return (ret); - } - - try { - result = meta.getCatalogs(); - } catch (SQLException e) { - result = null; - } - - try { - if (result != null) { - while (result.next()) { - ret.addElement(result.getString(1)); - } - - result.close(); - } - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - - return (ret); - } - - void setCatalog(String sCatalog) throws DataAccessPointException { - - if (sCatalog != null && sCatalog.length() > 0) { - try { - conn.setCatalog(sCatalog); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - } - } - - Vector getTables(String sCatalog, - String[] sSchemas) throws DataAccessPointException { - - Vector tTable = new Vector(); - ResultSet result = null; - - tracer.trace("Reading source tables"); - - int nbloops = 1; - - if (sSchemas != null) { - nbloops = sSchemas.length; - } - - try { - -// variations return null or emtpy result sets with informix JDBC driver 2.2 - for (int SchemaIdx = 0; SchemaIdx < nbloops; SchemaIdx++) { - if (sSchemas != null && sSchemas[SchemaIdx] != null) { - result = meta.getTables(sCatalog, sSchemas[SchemaIdx], - null, null); - } else { - try { - result = meta.getTables(sCatalog, "", null, null); - } catch (SQLException e) { - result = meta.getTables(sCatalog, null, null, null); - } - } - - while (result.next()) { - String name = result.getString(3); - String type = result.getString(4); - String schema = ""; - - if (sSchemas != null && sSchemas[SchemaIdx] != null) { - schema = sSchemas[SchemaIdx]; - } - - /* - ** we ignore the following table types: - ** "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY" - ** "ALIAS", "SYNONYM" - */ - if ((type.compareTo("TABLE") == 0) - || (type.compareTo("VIEW") == 0)) { - TransferTable t = new TransferTable(this, name, - schema, type, - tracer); - - tTable.addElement(t); - } else { - tracer.trace("Found table of type :" + type - + " - this type is ignored"); - } - } - } - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } finally { - if (result != null) { - try { - result.close(); - } catch (SQLException e) {} - } - } - - return (tTable); - } - - void getTableStructure(TransferTable TTable, - DataAccessPoint Dest) - throws DataAccessPointException { - - String create = "CREATE " + TTable.Stmts.sType + " " - + Dest.helper.formatName(TTable.Stmts.sDestTable); - String insert = ""; - ResultSet ImportedKeys = null; - boolean importedkeys = false; - String alterCreate = ""; - String alterDrop = ""; - String ConstraintName = ""; - String RefTableName = ""; - String foreignKeyName = ""; - String columnName = ""; - - Dest.helper.setSchema(TTable.Stmts.sSchema); - - TTable.Stmts.sDestDrop = - "DROP " + TTable.Stmts.sType + " " - + Dest.helper.formatName(TTable.Stmts.sDestTable) + ";"; - - if (TTable.Stmts.sType.compareTo("TABLE") == 0) { - TTable.Stmts.sDestDelete = - "DELETE FROM " - + Dest.helper.formatName(TTable.Stmts.sDestTable) + ";"; - create += "("; - } else if (TTable.Stmts.sType.compareTo("VIEW") == 0) { - TTable.Stmts.bDelete = false; - TTable.Stmts.sDestDelete = ""; - create += " AS SELECT "; - } - - if (TTable.Stmts.sType.compareTo("TABLE") == 0) { - insert = "INSERT INTO " - + Dest.helper.formatName(TTable.Stmts.sDestTable) - + " VALUES("; - } else if (TTable.Stmts.sType.compareTo("VIEW") == 0) { - TTable.Stmts.bInsert = false; - insert = ""; - } - - if (TTable.Stmts.sType.compareTo("VIEW") == 0) { - /* - ** Don't know how to retrieve the underlying select so we leave here. - ** The user will have to edit the rest of the create statement. - */ - TTable.Stmts.bTransfer = false; - TTable.Stmts.bCreate = true; - TTable.Stmts.bDelete = false; - TTable.Stmts.bDrop = true; - TTable.Stmts.bCreateIndex = false; - TTable.Stmts.bDropIndex = false; - TTable.Stmts.bInsert = false; - TTable.Stmts.bAlter = false; - - return; - } - - ImportedKeys = null; - - try { - ImportedKeys = - meta.getImportedKeys(TTable.Stmts.sDatabaseToConvert, - TTable.Stmts.sSchema, - TTable.Stmts.sSourceTable); - } catch (SQLException e) { - ImportedKeys = null; - } - - try { - if (ImportedKeys != null) { - while (ImportedKeys.next()) { - importedkeys = true; - - if (!ImportedKeys.getString(12).equals(ConstraintName)) { - if (!ConstraintName.equals("")) { - alterCreate += - Dest.helper - .formatIdentifier(columnName - .substring(0, columnName - .length() - 1)) + ") REFERENCES " - + Dest.helper - .formatName(RefTableName); - - if (foreignKeyName.length() > 0) { - alterCreate += - " (" - + Dest.helper.formatIdentifier( - foreignKeyName.substring( - 0, foreignKeyName.length() - - 1)) + ")"; - } - - alterCreate += ";"; - alterDrop = - alterDrop.substring(0, alterDrop.length() - 1) - + ";"; - foreignKeyName = ""; - columnName = ""; - } - - RefTableName = ImportedKeys.getString(3); - ConstraintName = ImportedKeys.getString(12); - alterCreate += - "ALTER TABLE " - + Dest.helper.formatName(TTable.Stmts.sDestTable) - + " ADD CONSTRAINT "; - - if ((TTable.Stmts.bFKForced) - && (!ConstraintName.startsWith("FK_"))) { - alterCreate += - Dest.helper.formatIdentifier( - "FK_" + ConstraintName) + " "; - } else { - alterCreate += - Dest.helper.formatIdentifier(ConstraintName) - + " "; - } - - alterCreate += "FOREIGN KEY ("; - alterDrop += - "ALTER TABLE " - + Dest.helper.formatName(TTable.Stmts.sDestTable) - + " DROP CONSTRAINT "; - - if ((TTable.Stmts.bFKForced) - && (!ConstraintName.startsWith("FK_"))) { - alterDrop += - Dest.helper.formatIdentifier( - "FK_" + ConstraintName) + " "; - } else { - alterDrop += - Dest.helper.formatIdentifier(ConstraintName) - + " "; - } - } - - columnName += ImportedKeys.getString(8) + ","; - foreignKeyName += ImportedKeys.getString(4) + ","; - } - - ImportedKeys.close(); - } - - if (importedkeys) { - alterCreate += columnName.substring(0, columnName.length() - 1) - + ") REFERENCES " - + Dest.helper.formatName(RefTableName); - - if (foreignKeyName.length() > 0) { - alterCreate += - " (" - + Dest.helper.formatIdentifier( - foreignKeyName.substring( - 0, foreignKeyName.length() - 1)) + ")"; - } - - alterCreate += ";"; - alterDrop = alterDrop.substring(0, alterDrop.length() - 1) - + ";"; - TTable.Stmts.sDestDrop = alterDrop + TTable.Stmts.sDestDrop; - } - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - - boolean primarykeys = false; - String PrimaryKeysConstraint = ""; - ResultSet PrimaryKeys = null; - - try { - PrimaryKeys = meta.getPrimaryKeys(TTable.Stmts.sDatabaseToConvert, - TTable.Stmts.sSchema, - TTable.Stmts.sSourceTable); - } catch (SQLException e) { - PrimaryKeys = null; - } - - try { - if (PrimaryKeys != null) { - while (PrimaryKeys.next()) { - if (primarykeys) { - PrimaryKeysConstraint += ", "; - } else { - if (PrimaryKeys.getString(6) != null) { - PrimaryKeysConstraint = - " CONSTRAINT " - + Dest.helper.formatIdentifier( - PrimaryKeys.getString(6)); - } - - PrimaryKeysConstraint += " PRIMARY KEY ("; - } - - PrimaryKeysConstraint += - Dest.helper.formatIdentifier(PrimaryKeys.getString(4)); - primarykeys = true; - } - - PrimaryKeys.close(); - - if (primarykeys) { - PrimaryKeysConstraint += ") "; - } - } - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - - boolean indices = false; - ResultSet Indices = null; - String IndiceName = ""; - String CreateIndex = ""; - String DropIndex = ""; - - try { - Indices = meta.getIndexInfo(TTable.Stmts.sDatabaseToConvert, - TTable.Stmts.sSchema, - TTable.Stmts.sSourceTable, false, - false); - } catch (SQLException e) { - Indices = null; - } - - try { - if (Indices != null) { - while (Indices.next()) { - String tmpIndexName = null; - - try { - tmpIndexName = Indices.getString(6); - } catch (SQLException e) { - tmpIndexName = null; - } - - if (tmpIndexName == null) { - continue; - } - - if (!tmpIndexName.equals(IndiceName)) { - if (!IndiceName.equals("")) { - CreateIndex = - CreateIndex.substring( - 0, CreateIndex.length() - 1) + ");"; - DropIndex += ";"; - } - - IndiceName = tmpIndexName; - DropIndex += "DROP INDEX "; - - if ((TTable.Stmts.bIdxForced) - && (!IndiceName.startsWith("Idx_"))) { - DropIndex += Dest.helper.formatIdentifier("Idx_" - + IndiceName); - } else { - DropIndex += - Dest.helper.formatIdentifier(IndiceName); - } - - CreateIndex += "CREATE "; - - if (!Indices.getBoolean(4)) { - CreateIndex += "UNIQUE "; - } - - CreateIndex += "INDEX "; - - if ((TTable.Stmts.bIdxForced) - && (!IndiceName.startsWith("Idx_"))) { - CreateIndex += Dest.helper.formatIdentifier("Idx_" - + IndiceName); - } else { - CreateIndex += - Dest.helper.formatIdentifier(IndiceName); - } - - CreateIndex += - " ON " - + Dest.helper.formatName(TTable.Stmts.sDestTable) - + "("; - } - - CreateIndex += - Dest.helper.formatIdentifier(Indices.getString(9)) - + ","; - indices = true; - } - - Indices.close(); - - if (indices) { - CreateIndex = - CreateIndex.substring(0, CreateIndex.length() - 1) - + ");"; - DropIndex += ";"; - } - } - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - - Vector v = new Vector(); - - tracer.trace("Reading source columns for table " - + TTable.Stmts.sSourceTable); - - ResultSet col = null; - int colnum = 1; - Statement stmt = null; - ResultSet select_rs = null; - ResultSetMetaData select_rsmdata = null; - - try { - stmt = conn.createStatement(); - select_rs = stmt.executeQuery(TTable.Stmts.sSourceSelect - + " WHERE 1 = 2"); - select_rsmdata = select_rs.getMetaData(); - col = meta.getColumns(TTable.Stmts.sDatabaseToConvert, - TTable.Stmts.sSchema, - TTable.Stmts.sSourceTable, null); - } catch (SQLException eSchema) { - - // fredt - second try with null schema - if (TTable.Stmts.sSchema.equals("")) { - try { - col = meta.getColumns(TTable.Stmts.sDatabaseToConvert, - null, TTable.Stmts.sSourceTable, - null); - } catch (SQLException eSchema1) { - eSchema1.printStackTrace(); - } - } - } - - try { - while (col.next()) { - String name = Dest.helper.formatIdentifier(col.getString(4)); - int type = col.getShort(5); - String source = col.getString(6); - int column_size = col.getInt(7); - String DefaultVal = col.getString(13); - boolean rsmdata_NoNulls = - (select_rsmdata.isNullable(colnum) - == java.sql.DatabaseMetaData.columnNoNulls); - boolean rsmdata_isAutoIncrement = false; - - try { - rsmdata_isAutoIncrement = - select_rsmdata.isAutoIncrement(colnum); - } catch (SQLException e) { - rsmdata_isAutoIncrement = false; - } - - int rsmdata_precision = select_rsmdata.getPrecision(colnum); - int rsmdata_scale = select_rsmdata.getScale(colnum); - - type = helper.convertFromType(type); - type = Dest.helper.convertToType(type); - - Integer inttype = Integer.valueOf(type); - String datatype = (String) TTable.hTypes.get(inttype); - - if (datatype == null) { - datatype = source; - - tracer.trace("No mapping for type: " + name + " type: " - + type + " source: " + source); - } - - if (type == Types.NUMERIC || type == Types.DECIMAL) { - datatype += "(" + Integer.toString(rsmdata_precision); - - if (rsmdata_scale > 0) { - datatype += "," + Integer.toString(rsmdata_scale); - } - - datatype += ")"; - } else if (type == Types.CHAR || type == Types.VARCHAR - || type == Types.BINARY - || type == Types.VARBINARY) { - datatype += "(" + Integer.toString(column_size) + ")"; - } else if (rsmdata_isAutoIncrement) { - datatype = "SERIAL"; - } - - if (DefaultVal != null) { - if (type == Types.CHAR || type == Types.VARCHAR - || type == Types.LONGVARCHAR - || type == Types.BINARY || type == Types.DATE - || type == Types.TIME || type == Types.TIMESTAMP) { - if (!DefaultVal.startsWith("'")) { - -// DefaultVal = "\'" + DefaultVal + "\'"; - } - } - - datatype += " DEFAULT " + DefaultVal; - } - - if (rsmdata_NoNulls) { - datatype += " NOT NULL "; - } - - v.addElement(inttype); - - datatype = helper.fixupColumnDefRead(TTable, select_rsmdata, - datatype, col, colnum); - datatype = Dest.helper.fixupColumnDefWrite(TTable, - select_rsmdata, datatype, col, colnum); - create += name + " " + datatype + ","; - insert += "?,"; - - colnum++; - } - - select_rs.close(); - stmt.close(); - col.close(); - } catch (SQLException e) { - throw new DataAccessPointException(e.toString()); - } - - if (primarykeys) { - create += PrimaryKeysConstraint + ","; - } - - TTable.Stmts.sDestCreate = create.substring(0, create.length() - 1) - + ")"; - TTable.Stmts.sDestInsert = insert.substring(0, insert.length() - 1) - + ")"; - - if (importedkeys) { - TTable.Stmts.bAlter = true; - TTable.Stmts.sDestAlter = alterCreate; - } else { - TTable.Stmts.bAlter = false; - } - - if (indices) { - TTable.Stmts.bCreateIndex = true; - TTable.Stmts.bDropIndex = true; - TTable.Stmts.sDestCreateIndex = CreateIndex; - TTable.Stmts.sDestDropIndex = DropIndex; - } else { - TTable.Stmts.bCreateIndex = false; - TTable.Stmts.bDropIndex = false; - } - - //iColumnType = new int[v.size()]; - //for (int j = 0; j < v.size(); j++) { - // iColumnType[j] = ((Integer) v.elementAt(j)).intValue(); - //} - } - - void close() { - - if (srcStatement != null) { - try { - srcStatement.close(); - } catch (SQLException e) {} - - srcStatement = null; - } - - if (conn != null) { - try { - conn.close(); - } catch (SQLException e) {} - - conn = null; - } - } - - private void transferRow(TransferResultSet r, PreparedStatement p, - int len, int[] types) throws SQLException { - - for (int i = 1; i <= len; i++) { - int t = types[i]; - Object o = r.getObject(i); - - if (o == null) { - if (p != null) { - p.setNull(i, t); - } - } else { - o = helper.convertColumnValue(o, i, t); - - p.setObject(i, o); - } - } - - if (p != null) { - p.execute(); - } - } - - /** - * @return Returns the meta. - */ - public DatabaseMetaData getMeta() { - return meta; - } - - /** - * @return Returns the conn. - */ - public Connection getConn() { - return conn; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/TransferHelper.java b/database/hsqldb/src/org/hsqldb/util/TransferHelper.java deleted file mode 100644 index fbebe1a8..00000000 --- a/database/hsqldb/src/org/hsqldb/util/TransferHelper.java +++ /dev/null @@ -1,207 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.Blob; -import java.sql.Clob; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Hashtable; - -/** - * Base class for conversion from a different databases - * - * @author Bob Preston (sqlbob@users dot sourceforge.net) - * @version 1.7.0 - */ -class TransferHelper { - - protected TransferDb db; - protected Traceable tracer; - protected String sSchema; - protected JDBCTypes JDBCT; - private String quote; - - TransferHelper() { - - db = null; - tracer = null; - quote = "'"; - JDBCT = new JDBCTypes(); - } - - TransferHelper(TransferDb database, Traceable t, String q) { - - db = database; - tracer = t; - quote = q; - JDBCT = new JDBCTypes(); - } - - void set(TransferDb database, Traceable t, String q) { - - db = database; - tracer = t; - quote = q; - } - - String formatIdentifier(String id) { - - if (id == null) { - return id; - } - - if (id.equals("")) { - return id; - } - - if (!id.toUpperCase().equals(id)) { - return (quote + id + quote); - } - - if (!Character.isLetter(id.charAt(0)) || (id.indexOf(' ') != -1)) { - return (quote + id + quote); - } - - return id; - } - - void setSchema(String _Schema) { - sSchema = _Schema; - } - - String formatName(String t) { - - String Name = ""; - - if ((sSchema != null) && (sSchema.length() > 0)) { - Name = sSchema + "."; - } - - Name += formatIdentifier(t); - - return Name; - } - - int convertFromType(int type) { - return (type); - } - - int convertToType(int type) { - return (type); - } - - Hashtable getSupportedTypes() { - - Hashtable hTypes = new Hashtable(); - - if (db != null) { - try { - ResultSet result = db.meta.getTypeInfo(); - - while (result.next()) { - Integer intobj = Integer.valueOf(result.getShort(2)); - - if (hTypes.get(intobj) == null) { - try { - int typeNumber = result.getShort(2); - - hTypes.put(intobj, JDBCT.toString(typeNumber)); - } catch (Exception e) {} - } - } - - result.close(); - } catch (SQLException e) {} - } - - if (hTypes.isEmpty()) { - hTypes = JDBCT.getHashtable(); - } - - return hTypes; - } - - String fixupColumnDefRead(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - return (columnType); - } - - String fixupColumnDefWrite(TransferTable t, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - return (columnType); - } - - boolean needTransferTransaction() { - return (false); - } - - Object convertColumnValue(Object value, int column, int type) { - - if (value == null) { - return value; - } - - try { - if (value instanceof Clob) { - return ((Clob) value).getSubString( - 1, (int) ((Clob) value).length()); - } else if (value instanceof Blob) { - return ((Blob) value).getBytes( - 1, (int) ((Blob) value).length()); - } - } catch (SQLException e) { - return null; - } - - return (value); - } - - void beginDataTransfer() {} - - void endDataTransfer() {} - - String fixupColumnDefRead(String aTableName, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - return columnType; - } - - String fixupColumnDefWrite(String aTableName, ResultSetMetaData meta, - String columnType, ResultSet columnDesc, - int columnIndex) throws SQLException { - return columnType; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/TransferResultSet.java b/database/hsqldb/src/org/hsqldb/util/TransferResultSet.java deleted file mode 100644 index 5e518950..00000000 --- a/database/hsqldb/src/org/hsqldb/util/TransferResultSet.java +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Vector; - -/** - * Helper class for transferring a result set - * - * @author Nicolas BAZIN - * @version 1.7.0 - */ -class TransferResultSet { - - Vector vRows = null; - int iRowIdx; - int iMaxRowIdx; - int iColumnCount; - String[] sColumnNames = null; - int[] iColumnTypes = null; - - TransferResultSet(ResultSet r) { - - iRowIdx = 0; - iMaxRowIdx = 0; - iColumnCount = 0; - vRows = new Vector(); - - try { - while (r.next()) { - if (sColumnNames == null) { - iColumnCount = r.getMetaData().getColumnCount(); - sColumnNames = new String[iColumnCount + 1]; - iColumnTypes = new int[iColumnCount + 1]; - - for (int Idx = 0; Idx < iColumnCount; Idx++) { - sColumnNames[Idx + 1] = - r.getMetaData().getColumnName(Idx + 1); - iColumnTypes[Idx + 1] = - r.getMetaData().getColumnType(Idx + 1); - } - - vRows.addElement(null); - } - - iMaxRowIdx++; - - Object[] Values = new Object[iColumnCount + 1]; - - for (int Idx = 0; Idx < iColumnCount; Idx++) { - Values[Idx + 1] = r.getObject(Idx + 1); - } - - vRows.addElement(Values); - } - } catch (SQLException SQLE) { - iRowIdx = 0; - iMaxRowIdx = 0; - iColumnCount = 0; - vRows = new Vector(); - } - } - - TransferResultSet() { - - iRowIdx = 0; - iMaxRowIdx = 0; - iColumnCount = 0; - vRows = new Vector(); - } - - void addRow(String[] Name, int[] type, Object[] Values, - int nbColumns) throws Exception { - - if ((Name.length != type.length) || (Name.length != Values.length) - || (Name.length != (nbColumns + 1))) { - throw new Exception("Size of parameter incoherent"); - } - - if (sColumnNames == null) { - iColumnCount = nbColumns; - sColumnNames = Name; - iColumnTypes = type; - - vRows.addElement(null); - } - - if ((iMaxRowIdx > 0) && (this.getColumnCount() != nbColumns)) { - throw new Exception("Wrong number of columns: " - + this.getColumnCount() - + " column is expected"); - } - - iMaxRowIdx++; - - vRows.addElement(Values); - } - - boolean next() { - - iRowIdx++; - - return ((iRowIdx <= iMaxRowIdx) && (iMaxRowIdx > 0)); - } - - String getColumnName(int columnIdx) { - - if ((iMaxRowIdx <= 0) || (iMaxRowIdx < iRowIdx)) { - return null; - } - - return sColumnNames[columnIdx]; - } - - int getColumnCount() { - - if ((iMaxRowIdx <= 0) || (iMaxRowIdx < iRowIdx)) { - return 0; - } - - return iColumnCount; - } - - int getColumnType(int columnIdx) { - - if ((iMaxRowIdx <= 0) || (iMaxRowIdx < iRowIdx)) { - return 0; - } - - return iColumnTypes[columnIdx]; - } - - Object getObject(int columnIdx) { - - if ((iMaxRowIdx <= 0) || (iMaxRowIdx < iRowIdx)) { - return null; - } - - return ((Object[]) vRows.elementAt(iRowIdx))[columnIdx]; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/TransferSQLText.java b/database/hsqldb/src/org/hsqldb/util/TransferSQLText.java deleted file mode 100644 index 1fe6260e..00000000 --- a/database/hsqldb/src/org/hsqldb/util/TransferSQLText.java +++ /dev/null @@ -1,848 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.sql.SQLException; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.NoSuchElementException; -import java.util.StringTokenizer; -import java.util.Vector; - -/** - * @author Nicolas BAZIN, INGENICO - * @version 1.7.0 - */ -class TransferSQLText extends DataAccessPoint { - - String sFileName = null; - BufferedWriter WTextWrite = null; - BufferedReader WTextRead = null; - protected boolean StructureAlreadyParsed = false; - Hashtable DbStmts = null; - protected JDBCTypes JDBCT = null; - - TransferSQLText(String _FileName, - Traceable t) throws DataAccessPointException { - - super(t); - - sFileName = _FileName; - JDBCT = new JDBCTypes(); - - if (sFileName == null) { - throw new DataAccessPointException("File name not initialized"); - } - } - - boolean execute(String statement) throws DataAccessPointException { - - if (WTextWrite == null) { - try { - WTextWrite = new BufferedWriter(new FileWriter(sFileName)); - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - try { - WTextWrite.write(statement + "\n"); - WTextWrite.flush(); - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - - return true; - } - - void putData(String statement, TransferResultSet r, - int iMaxRows) throws DataAccessPointException { - - int i = 0; - - if (r == null) { - return; - } - - if (WTextWrite == null) { - try { - WTextWrite = new BufferedWriter(new FileWriter(sFileName)); - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - try { - while (r.next()) { - if (i == 0) { - WTextWrite.write(statement + "\n"); - WTextWrite.flush(); - } - - transferRow(r); - - if (iMaxRows != 0 && i == iMaxRows) { - break; - } - - i++; - - if (iMaxRows != 0 || i % 100 == 0) { - tracer.trace("Transfered " + i + " rows"); - } - } - } catch (Exception e) { - throw new DataAccessPointException(e.getMessage()); - } finally { - try { - if (i > 0) { - WTextWrite.write("\tNumber of Rows=" + i + "\n\n"); - WTextWrite.flush(); - } - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - } - } - - void close() { - - if (WTextWrite != null) { - try { - WTextWrite.flush(); - WTextWrite.close(); - } catch (IOException e) {} - } - } - - private void transferRow(TransferResultSet r) throws Exception { - - String sLast = ""; - int len = r.getColumnCount(); - - if (WTextWrite == null) { - try { - WTextWrite = new BufferedWriter(new FileWriter(sFileName)); - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - for (int i = 0; i < len; i++) { - int t = r.getColumnType(i + 1); - - sLast = "column=" + r.getColumnName(i + 1) + " datatype=" - + (String) helper.getSupportedTypes().get(Integer.valueOf(t)); - - Object o = r.getObject(i + 1); - - if (o == null) { - sLast += " value="; - } else { - o = helper.convertColumnValue(o, i + 1, t); - sLast += " value=\'" + o.toString() + "\'"; - } - - WTextWrite.write("\t" + sLast + "\n"); - WTextWrite.flush(); - } - - WTextWrite.write("\n"); - WTextWrite.flush(); - - sLast = ""; - } - - static class ColumnDef { - - String columnName; - String columnType; - String options; - int start; - int len; - - public ColumnDef() { - - columnName = ""; - columnType = ""; - options = ""; - start = 0; - len = 0; - } - } - - ColumnDef getColumnDef(String ColumnsDesc, int curPos) { - - int nextPos = 0; - ColumnDef columnDef = new TransferSQLText.ColumnDef(); - - columnDef.start = curPos; - - if ((ColumnsDesc == null) || (ColumnsDesc.length() == 0) - || (curPos >= ColumnsDesc.length())) { - return new TransferSQLText.ColumnDef(); - } - - String stbuff = ColumnsDesc.substring(curPos); - - try { - int i = 0; - - for (; i < stbuff.length(); i++) { - int c = stbuff.charAt(i); - - if (c == ',' || c == ' ' || c == ')' || c == ';') { - continue; - } else { - break; - } - } - - if (i == stbuff.length()) { - return new TransferSQLText.ColumnDef(); - } - - columnDef.len += i; - stbuff = stbuff.substring(i); - - while (stbuff.charAt(nextPos) != ' ') { - nextPos++; - } - - columnDef.columnName = stbuff.substring(0, nextPos); - stbuff = stbuff.substring(nextPos); - columnDef.len += nextPos; - nextPos = 0; - - if (!columnDef.columnName.toUpperCase().equals("CONSTRAINT")) { - i = 0; - - for (; i < stbuff.length() && stbuff.charAt(i) == ' '; i++) {} - - stbuff = stbuff.substring(i); - columnDef.len += i; - - while ((stbuff.charAt(nextPos) != '(') - && (stbuff.charAt(nextPos) != ',') - && (stbuff.charAt(nextPos) != ')') - && (stbuff.charAt(nextPos) != ';') - && (stbuff.charAt(nextPos) != ' ')) { - nextPos++; - } - - columnDef.columnType = stbuff.substring(0, - nextPos).toUpperCase(); - stbuff = stbuff.substring(nextPos); - columnDef.len += nextPos; - nextPos = 0; - } - - while ((stbuff.charAt(nextPos) != ',') - && (stbuff.charAt(nextPos) != ';') - && (nextPos < stbuff.length()) - && (stbuff.charAt(nextPos) != ')')) { - if (stbuff.charAt(nextPos) == '(') { - while (stbuff.charAt(nextPos) != ')') { - nextPos++; - } - } - - nextPos++; - } - - columnDef.options = stbuff.substring(0, nextPos); - columnDef.len += nextPos; - } catch (Exception e) { - columnDef = new TransferSQLText.ColumnDef(); - } - - return columnDef; - } - - String translateTypes(String CreateLine, TransferTable TTable, - DataAccessPoint Dest) { - - String translatedLine = ""; - JDBCTypes JDBCT = new JDBCTypes(); - int currentPos = 0; - String columnName = ""; - String columnType = ""; - int colnum = 0; - ColumnDef cDef; - - currentPos = CreateLine.indexOf('(') + 1; - translatedLine = CreateLine.substring(0, currentPos); - - do { - cDef = getColumnDef(CreateLine, currentPos); - - if (cDef.len == 0) { - break; - } - - columnName = cDef.columnName; - columnType = cDef.columnType; - - if (columnName.toUpperCase().contains("CONSTRAINT")) { - translatedLine += - CreateLine.substring(currentPos, currentPos + cDef.len) - + ","; - currentPos += cDef.len + 1; - - colnum++; - - continue; - } - - columnName = Dest.helper.formatIdentifier(columnName) + " "; - - try { - Integer inttype = Integer.valueOf( - Dest.helper.convertToType(JDBCT.toInt(columnType))); - - columnType = (String) TTable.hTypes.get(inttype); - } catch (Exception JDBCtypeEx) {} - - if (cDef.options != null) { - columnType += cDef.options; - } - - try { - columnType = Dest.helper.fixupColumnDefWrite(TTable, null, - columnType, null, colnum); - } catch (SQLException SQLe) { - return CreateLine; - } - - translatedLine += columnName + " " + columnType + ","; - currentPos += cDef.len + 1; - - colnum++; - } while (true); - - return translatedLine.substring(0, translatedLine.length() - 1) - + ");"; - } - - void parseFileForTables() throws DataAccessPointException { - - StringTokenizer Tokenizer; - - if (WTextRead == null) { - try { - WTextRead = new BufferedReader(new FileReader(sFileName)); - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - String currentLine = ""; - String Token = ""; - String name = ""; - TransferTable relatedTable = null; - - try { - while ((currentLine = WTextRead.readLine()) != null) { - currentLine = currentLine.trim() + ";"; - Tokenizer = new StringTokenizer(currentLine); - - try { - Token = Tokenizer.nextToken(); - } catch (NoSuchElementException NSE) { - continue; - } - - if (Token == null) { - continue; - } - - if (!Token.toUpperCase().equals("CREATE")) { - continue; - } - - Token = Tokenizer.nextToken().toUpperCase(); - - if (Token.equals("TABLE") || Token.equals("VIEW")) { - try { - name = Tokenizer.nextToken(" (;"); - relatedTable = new TransferTable(this, name, "", - Token, tracer); - relatedTable.Stmts.bCreate = false; - relatedTable.Stmts.bDelete = false; - relatedTable.Stmts.bDrop = false; - relatedTable.Stmts.bCreateIndex = false; - relatedTable.Stmts.bDropIndex = false; - relatedTable.Stmts.bInsert = false; - relatedTable.Stmts.bAlter = false; - - DbStmts.put(relatedTable.Stmts.sSourceTable, - relatedTable); - } catch (NoSuchElementException NSE) { - continue; - } - } - } - } catch (Exception IOe) { - throw new DataAccessPointException(IOe.getMessage()); - } - } - - void parseFileForTheRest(TransferTable TTable, - DataAccessPoint Dest) - throws DataAccessPointException { - - StringTokenizer Tokenizer; - - StructureAlreadyParsed = true; - - if (WTextRead == null) { - try { - WTextRead = new BufferedReader(new FileReader(sFileName)); - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - String currentLine = ""; - String Token = ""; - String name = ""; - TransferTable relatedTable = null; - - try { - while ((currentLine = WTextRead.readLine()) != null) { - currentLine = currentLine.trim() + ";"; - Tokenizer = new StringTokenizer(currentLine); - - try { - Token = Tokenizer.nextToken(); - } catch (NoSuchElementException NSE) { - continue; - } - - if (Token == null) { - continue; - } - - if (Token.toUpperCase().equals("INSERT")) { - try { - if (!Tokenizer.nextToken().toUpperCase().equals( - "INTO")) { - throw new DataAccessPointException( - "Error in INSERT statement: no INTO found"); - } - - Token = Tokenizer.nextToken(); - - if ((relatedTable = - (TransferTable) DbStmts.get(Token)) != null) { - relatedTable.Stmts.bDelete = true; - relatedTable.Stmts.bInsert = true; - relatedTable.Stmts.sDestInsert = currentLine; - relatedTable.Stmts.sDestDelete = - "DELETE FROM " - + relatedTable.Stmts.sSourceTable + ";"; - } - - continue; - } catch (NoSuchElementException NSE) { - continue; - } - } else if (Token.toUpperCase().equals("ALTER")) { - try { - if (!Tokenizer.nextToken().toUpperCase().equals( - "TABLE")) { - continue; - } - - name = Tokenizer.nextToken(); - Token = Tokenizer.nextToken().toUpperCase(); - - if (!Token.equals("ADD")) { - continue; - } - - do { - Token = Tokenizer.nextToken().toUpperCase(); - } while (!Token.equals("CONSTRAINT")); - - if ((relatedTable = (TransferTable) DbStmts.get(name)) - != null) { - if (relatedTable.Stmts.sDestAlter == null) { - relatedTable.Stmts.sDestAlter = ""; - } - - relatedTable.Stmts.bAlter = true; - relatedTable.Stmts.sDestAlter += currentLine; - } else { - throw new DataAccessPointException( - "table not found"); - } - - Token = Tokenizer.nextToken(); - - if (relatedTable.Stmts.sDestDrop == null) { - relatedTable.Stmts.sDestDrop = ""; - } - - relatedTable.Stmts.bDrop = true; - relatedTable.Stmts.sDestDrop = - "ALTER TABLE " + name + " DROP CONSTRAINT " - + Token + ";" + relatedTable.Stmts.sDestDrop; - - continue; - } catch (NoSuchElementException NSE) { - continue; - } - } else if (!Token.toUpperCase().equals("CREATE")) { - continue; - } - - Token = Tokenizer.nextToken().toUpperCase(); - - if (Token.equals("TABLE") || Token.equals("VIEW")) { - try { - name = Tokenizer.nextToken(" (;"); - - if (!DbStmts.containsKey(name)) { - throw new DataAccessPointException( - "error: index is created before the table"); - } - - relatedTable = (TransferTable) DbStmts.get(name); - relatedTable.Stmts.bCreate = true; - relatedTable.Stmts.bDrop = true; - -// relatedTable.Stmts.sDestCreate = currentLine; - relatedTable.Stmts.sDestCreate = - translateTypes(currentLine, TTable, Dest); - relatedTable.Stmts.sDestDrop = - "DROP " + relatedTable.Stmts.sType + " " + name - + ";"; - - DbStmts.put(relatedTable.Stmts.sSourceTable, - relatedTable); - } catch (NoSuchElementException NSE) { - continue; - } - } - - if (Token.equals("INDEX") || Token.equals("UNIQUE")) { - try { - while ((Token = - Tokenizer.nextToken()).toUpperCase().equals( - "INDEX")) {} - - String IndexdropCommand = "DROP INDEX " + Token - + " ;"; - - while ((Token = Tokenizer.nextToken( - " (")).toUpperCase().equals("ON")) {} - - name = Token; - - if (!DbStmts.containsKey(Token)) { - throw new DataAccessPointException( - "error: index is created before the table"); - } - - relatedTable = (TransferTable) DbStmts.get(Token); - - if (relatedTable.Stmts.sDestCreateIndex == null) { - relatedTable.Stmts.sDestCreateIndex = ""; - } - - if (relatedTable.Stmts.sDestDropIndex == null) { - relatedTable.Stmts.sDestDropIndex = ""; - } - - relatedTable.Stmts.bCreateIndex = true; - relatedTable.Stmts.bDropIndex = true; - relatedTable.Stmts.sDestCreateIndex += currentLine; - relatedTable.Stmts.sDestDropIndex += IndexdropCommand; - } catch (NoSuchElementException NSE) { - continue; - } - } - } - } catch (IOException IOe) { - throw new DataAccessPointException(IOe.getMessage()); - } - } - - Vector getTables(String sCatalog, - String[] sSchemas) throws DataAccessPointException { - - Vector AllTables = new Vector(); - - if (DbStmts == null) { - DbStmts = new Hashtable(); - } - - if (WTextRead != null) { - try { - WTextRead.close(); - - WTextRead = null; - } catch (IOException e) {} - } - - this.parseFileForTables(); - - StructureAlreadyParsed = false; - - Enumeration e = DbStmts.elements(); - - while (e.hasMoreElements()) { - AllTables.addElement(e.nextElement()); - } - - return AllTables; - } - - void getTableStructure(TransferTable TTable, - DataAccessPoint Dest) - throws DataAccessPointException { - - if (!StructureAlreadyParsed) { - if (WTextRead != null) { - try { - WTextRead.close(); - - WTextRead = null; - } catch (IOException e) {} - } - - this.parseFileForTheRest(TTable, Dest); - } - } - - TransferResultSet getData(String statement) - throws DataAccessPointException { - - StringTokenizer Tokenizer; - String tableName = ""; - - try { - Tokenizer = new StringTokenizer(statement); - - while (!Tokenizer.nextToken().toUpperCase().equals("FROM")) {} - - tableName = Tokenizer.nextToken(" ;"); - } catch (NoSuchElementException NSE) { - throw new DataAccessPointException( - "Table name not found in statement: " + statement); - } - - if (WTextRead != null) { - try { - WTextRead.close(); - - WTextRead = null; - } catch (IOException e) {} - } - - return (this.parseFileForData(tableName)); - } - - TransferResultSet parseFileForData(String tableName) - throws DataAccessPointException { - - TransferResultSet trsData = new TransferResultSet(); - StringTokenizer Tokenizer; - - if (WTextRead == null) { - try { - WTextRead = new BufferedReader(new FileReader(sFileName)); - } catch (IOException e) { - throw new DataAccessPointException(e.getMessage()); - } - } - - String currentLine = ""; - String Token; - - try { - while ((currentLine = WTextRead.readLine()) != null) { - currentLine = currentLine.trim() + ";"; - Tokenizer = new StringTokenizer(currentLine); - - try { - Token = Tokenizer.nextToken(); - } catch (NoSuchElementException NSE) { - continue; - } - - if (Token == null) { - continue; - } - - if (!Token.toUpperCase().equals("INSERT")) { - continue; - } - - try { - if (!Tokenizer.nextToken().toUpperCase().equals("INTO")) { - throw new DataAccessPointException( - "Error in INSERT statement: no INTO found"); - } - - Token = Tokenizer.nextToken(); - - if (!Token.equals(tableName)) { - continue; - } - - int iParsedRows = 0; - Vector vColumnNames = new Vector(); - Vector vColumnValues = new Vector(); - Vector vColumnTypes = new Vector(); - - while ((currentLine = WTextRead.readLine()) != null) { - currentLine = currentLine.trim(); - - boolean newLine = (currentLine.length() == 0); - - if (newLine) { - int iColumnNb = 0; - - iParsedRows++; - - iColumnNb = vColumnNames.size(); - - String[] Names = new String[iColumnNb + 1]; - int[] Types = new int[iColumnNb + 1]; - Object[] Values = new Object[iColumnNb + 1]; - - for (int Idx = 0; Idx < iColumnNb; Idx++) { - Names[Idx + 1] = - (String) vColumnNames.elementAt(Idx); - Types[Idx + 1] = - ((Integer) vColumnTypes.elementAt( - Idx)).intValue(); - Values[Idx + 1] = - vColumnValues.elementAt(Idx); - } - - try { - trsData.addRow(Names, Types, Values, - iColumnNb); - } catch (Exception e) { - throw new DataAccessPointException( - e.getMessage()); - } - - iColumnNb = 0; - - vColumnNames.removeAllElements(); - vColumnValues.removeAllElements(); - vColumnTypes.removeAllElements(); - - continue; - } - - Tokenizer = new StringTokenizer(currentLine); - Token = Tokenizer.nextToken("="); - - if (Token.equals("Number of Rows")) { - int iNbRows = - Integer.parseInt(Tokenizer.nextToken()); - - if (iNbRows != iParsedRows) { - throw new DataAccessPointException( - "Number of parsed rows (" + iParsedRows - + ") is different from the expected (" - + iNbRows + ")"); - } - - return trsData; - } - - if (Token.equals("column")) { - Token = Tokenizer.nextToken(" ="); - - vColumnNames.addElement(Token); - } - - Token = Tokenizer.nextToken(" ="); - - if (Token.equals("datatype")) { - int iType; - - Token = Tokenizer.nextToken(" ="); - - try { - iType = JDBCT.toInt(Token.toUpperCase()); - } catch (Exception e) { - throw new DataAccessPointException( - "Unknown type: " + Token); - } - - vColumnTypes.addElement(Integer.valueOf(iType)); - } - - Token = Tokenizer.nextToken(" ="); - - if (Token.equals("value")) { - int iStart = currentLine.indexOf("value=") + 6; - String sValue = - currentLine.substring(iStart).trim(); - - if (sValue.contains("")) { - vColumnValues.addElement(null); - } else { - int i = sValue.indexOf('\'') + 1; - String sbToken = sValue.substring(i); - - i = sbToken.lastIndexOf('\''); - sbToken = sbToken.substring(0, i); - Token = sbToken; - - vColumnValues.addElement(Token); - } - } - } - } catch (IndexOutOfBoundsException IOBe) { - continue; - } - } - } catch (IOException IOe) { - throw new DataAccessPointException(IOe.getMessage()); - } - - return trsData; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/TransferTable.java b/database/hsqldb/src/org/hsqldb/util/TransferTable.java deleted file mode 100644 index 615e6c31..00000000 --- a/database/hsqldb/src/org/hsqldb/util/TransferTable.java +++ /dev/null @@ -1,463 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.io.Serializable; -import java.util.Hashtable; - -// fredt@users 20011220 - patch 481239 by xponsard@users - enhancements -// enhancements to support saving and loading of transfer settings, -// transfer of blobs, and catalog and schema names in source db -// changes by fredt to allow saving and loading of transfer settings -// fredt@users 20020215 - patch 516309 by Nicolas Bazin - enhancements -// sqlbob@users 20020325 - patch 1.7.0 - reengineering -// fredt@users 20040508 - patch 1.7.2 - bug fixes - -/** - * Transfers data from one database to another - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 1.7.2 - * @since Hypersonic SQL - */ -class TransferTable implements Serializable { - - Hashtable hTypes; - DataAccessPoint sourceDb; - DataAccessPoint destDb; - SQLStatements Stmts = null; - Traceable tracer; - - TransferTable(DataAccessPoint src, String name, String schema, - String type, Traceable t) { - - Stmts = new SQLStatements(); - sourceDb = src; - Stmts.sSchema = ""; - - if (schema != null && schema.length() > 0) { - Stmts.sSchema = schema; - } - - Stmts.sType = type; - Stmts.sDatabaseToConvert = src.databaseToConvert; - Stmts.sSourceTable = Stmts.sDestTable = name; - tracer = t; - - if (Stmts.sType.compareTo("TABLE") == 0) { - Stmts.sSourceSelect = "SELECT * FROM " - + src.helper.formatName(Stmts.sSourceTable); - } else if (Stmts.sType.compareTo("VIEW") == 0) { - Stmts.sSourceSelect = ""; - } - } - - void setDest(String _Schema, DataAccessPoint dest) { - - destDb = dest; - - dest.helper.setSchema(_Schema); - } - - /** - * extractTableStructure - */ - void extractTableStructure(DataAccessPoint Source, - DataAccessPoint Destination) throws Exception { - initTypes(); - Source.getTableStructure(this, Destination); - } - - void transferStructure() throws Exception { - - String Statement = ""; - - if (destDb.helper.needTransferTransaction()) { - try { - destDb.setAutoCommit(false); - } catch (Exception e) {} - } - - if (!Stmts.bTransfer) { - tracer.trace("Table " + Stmts.sSourceTable + " not transfered"); - - return; - } - - tracer.trace("Table " + Stmts.sSourceTable + ": start transfer"); - - try { - if (Stmts.bDropIndex) { - if (Stmts.sDestDropIndex.charAt(Stmts.sDestDropIndex.length() - - 1) != ';') { - Stmts.sDestDropIndex += ";"; - } - - int lastsemicolon = 0; - int nextsemicolon = Stmts.sDestDropIndex.indexOf(';'); - - while (nextsemicolon > lastsemicolon) { - Statement = Stmts.sDestDropIndex.substring(lastsemicolon, - nextsemicolon); - - while (Statement.charAt(Statement.length() - 1) == ';') { - Statement = Statement.substring(0, Statement.length() - - 1); - } - - try { - tracer.trace("Executing " + Statement); - destDb.execute(Statement); - } catch (Exception e) { - tracer.trace("Ignoring error " + e.getMessage()); - } - - lastsemicolon = nextsemicolon + 1; - nextsemicolon = lastsemicolon - + Stmts.sDestDropIndex.substring( - lastsemicolon).indexOf(';'); - } - } - - if (Stmts.bDelete) { - if (Stmts.sDestDelete.charAt(Stmts.sDestDelete.length() - 1) - != ';') { - Stmts.sDestDelete += ";"; - } - - int lastsemicolon = 0; - int nextsemicolon = Stmts.sDestDelete.indexOf(';'); - - while (nextsemicolon > lastsemicolon) { - Statement = Stmts.sDestDelete.substring(lastsemicolon, - nextsemicolon); - - while (Statement.charAt(Statement.length() - 1) == ';') { - Statement = Statement.substring(0, Statement.length() - - 1); - } - - try { - tracer.trace("Executing " + Statement); - destDb.execute(Statement); - } catch (Exception e) { - tracer.trace("Ignoring error " + e.getMessage()); - } - - lastsemicolon = nextsemicolon + 1; - nextsemicolon = lastsemicolon - + Stmts.sDestDelete.substring( - lastsemicolon).indexOf(';'); - } - } - - if (Stmts.bDrop) { - if (Stmts.sDestDrop.charAt(Stmts.sDestDrop.length() - 1) - != ';') { - Stmts.sDestDrop += ";"; - } - - int lastsemicolon = 0; - int nextsemicolon = Stmts.sDestDrop.indexOf(';'); - - while (nextsemicolon > lastsemicolon) { - Statement = Stmts.sDestDrop.substring(lastsemicolon, - nextsemicolon); - - while (Statement.charAt(Statement.length() - 1) == ';') { - Statement = Statement.substring(0, Statement.length() - - 1); - } - - try { - tracer.trace("Executing " + Statement); - destDb.execute(Statement); - } catch (Exception e) { - tracer.trace("Ignoring error " + e.getMessage()); - } - - lastsemicolon = nextsemicolon + 1; - nextsemicolon = lastsemicolon - + Stmts.sDestDrop.substring( - lastsemicolon).indexOf(';'); - } - } - - if (Stmts.bCreate) { - if (Stmts.sDestCreate.charAt(Stmts.sDestCreate.length() - 1) - != ';') { - Stmts.sDestCreate += ";"; - } - - int lastsemicolon = 0; - int nextsemicolon = Stmts.sDestCreate.indexOf(';'); - - while (nextsemicolon > lastsemicolon) { - Statement = Stmts.sDestCreate.substring(lastsemicolon, - nextsemicolon); - - while (Statement.charAt(Statement.length() - 1) == ';') { - Statement = Statement.substring(0, Statement.length() - - 1); - } - - tracer.trace("Executing " + Statement); - destDb.execute(Statement); - - lastsemicolon = nextsemicolon + 1; - nextsemicolon = lastsemicolon - + Stmts.sDestCreate.substring( - lastsemicolon).indexOf(';'); - } - } - } catch (Exception e) { - try { - if (!destDb.getAutoCommit()) { - destDb.rollback(); - } - } catch (Exception e1) {} - - throw (e); - } - - if (!destDb.getAutoCommit()) { - destDb.commit(); - - try { - destDb.setAutoCommit(true); - } catch (Exception e) {} - } - } - - void transferData(int iMaxRows) throws Exception { - - if (destDb.helper.needTransferTransaction()) { - try { - destDb.setAutoCommit(false); - } catch (Exception e) {} - } - - try { - if (Stmts.bInsert) { - if (destDb.helper.needTransferTransaction()) { - try { - destDb.setAutoCommit(false); - } catch (Exception e) {} - } - - tracer.trace("Executing " + Stmts.sSourceSelect); - - TransferResultSet r = sourceDb.getData(Stmts.sSourceSelect); - - tracer.trace("Start transfering data..."); - destDb.beginDataTransfer(); - tracer.trace("Executing " + Stmts.sDestInsert); - destDb.putData(Stmts.sDestInsert, r, iMaxRows); - destDb.endDataTransfer(); - tracer.trace("Finished"); - - if (!destDb.getAutoCommit()) { - destDb.commit(); - - try { - destDb.setAutoCommit(true); - } catch (Exception e) {} - } - } - } catch (Exception e) { - try { - if (!destDb.getAutoCommit()) { - destDb.rollback(); - } - } catch (Exception e1) {} - - throw (e); - } - - if (!destDb.getAutoCommit()) { - destDb.commit(); - - try { - destDb.setAutoCommit(true); - } catch (Exception e) {} - } - } - - void transferAlter() throws Exception { - - String Statement = ""; - - if (destDb.helper.needTransferTransaction()) { - try { - destDb.setAutoCommit(false); - } catch (Exception e) {} - } - - if (!Stmts.bTransfer) { - tracer.trace("Table " + Stmts.sSourceTable + " not transfered"); - - return; - } - - tracer.trace("Table " + Stmts.sSourceTable + ": start alter"); - - try { - if (Stmts.bCreateIndex) { - if (Stmts.sDestCreateIndex.charAt( - Stmts.sDestCreateIndex.length() - 1) != ';') { - Stmts.sDestCreateIndex += ";"; - } - - int lastsemicolon = 0; - int nextsemicolon = Stmts.sDestCreateIndex.indexOf(';'); - - while (nextsemicolon > lastsemicolon) { - Statement = Stmts.sDestCreateIndex.substring(lastsemicolon, - nextsemicolon); - - while (Statement.charAt(Statement.length() - 1) == ';') { - Statement = Statement.substring(0, Statement.length() - - 1); - } - - try { - tracer.trace("Executing " + Stmts.sDestCreateIndex); - destDb.execute(Statement); - } catch (Exception e) { - tracer.trace("Ignoring error " + e.getMessage()); - } - - lastsemicolon = nextsemicolon + 1; - nextsemicolon = lastsemicolon - + Stmts.sDestCreateIndex.substring( - lastsemicolon).indexOf(';'); - } - } - - if (Stmts.bAlter) { - if (Stmts.sDestAlter.charAt(Stmts.sDestAlter.length() - 1) - != ';') { - Stmts.sDestAlter += ";"; - } - - int lastsemicolon = 0; - int nextsemicolon = Stmts.sDestAlter.indexOf(';'); - - while (nextsemicolon > lastsemicolon) { - Statement = Stmts.sDestAlter.substring(lastsemicolon, - nextsemicolon); - - while (Statement.charAt(Statement.length() - 1) == ';') { - Statement = Statement.substring(0, Statement.length() - - 1); - } - - try { - tracer.trace("Executing " + Statement); - destDb.execute(Statement); - } catch (Exception e) { - tracer.trace("Ignoring error " + e.getMessage()); - } - - lastsemicolon = nextsemicolon + 1; - nextsemicolon = lastsemicolon - + Stmts.sDestAlter.substring( - lastsemicolon).indexOf(';'); - } - } - } catch (Exception e) { - try { - if (!destDb.getAutoCommit()) { - destDb.rollback(); - } - } catch (Exception e1) {} - - throw (e); - } - - if (!destDb.getAutoCommit()) { - destDb.commit(); - - try { - destDb.setAutoCommit(true); - } catch (Exception e) {} - } - } - - private void initTypes() { - - if (hTypes != null) { - return; - } - - hTypes = destDb.helper.getSupportedTypes(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/Tree.java b/database/hsqldb/src/org/hsqldb/util/Tree.java deleted file mode 100644 index 3213a3ce..00000000 --- a/database/hsqldb/src/org/hsqldb/util/Tree.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * For work developed by the HSQL Development Group: - * - * Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * - * For work originally developed by the Hypersonic SQL Group: - * - * Copyright (c) 1995-2000, The Hypersonic SQL Group. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the Hypersonic SQL Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * on behalf of the Hypersonic SQL Group. - */ - - -package org.hsqldb.util; - -import java.util.Vector; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Event; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Panel; -import java.awt.Scrollbar; -import java.awt.SystemColor; -import java.awt.Toolkit; - -/** - * - * @author Thomas Mueller (Hypersonic SQL Group) - * @version 1.7.0 - * @since Hypersonic SQL - */ -class Tree extends Panel { - - // static - private static Font fFont; - private static FontMetrics fMetrics; - private static int iRowHeight; - private static int iIndentWidth; - private int iMaxTextLength; - - // drawing - private Dimension dMinimum; - private Graphics gImage; - private Image iImage; - - // height / width - private int iWidth, iHeight; - private int iFirstRow; - private int iX, iY; - - // data - private Vector vData; - private int iRowCount; - - // scrolling - private Scrollbar sbHoriz, sbVert; - private int iSbWidth, iSbHeight; - - static { - fFont = new Font("Dialog", Font.PLAIN, 12); - fMetrics = Toolkit.getDefaultToolkit().getFontMetrics(fFont); - iRowHeight = getMaxHeight(fMetrics); - iIndentWidth = 12; - } - - /** - * Constructor declaration - * - */ - Tree() { - - super(); - - vData = new Vector(); - - setLayout(null); - - sbHoriz = new Scrollbar(Scrollbar.HORIZONTAL); - - add(sbHoriz); - - sbVert = new Scrollbar(Scrollbar.VERTICAL); - - add(sbVert); - } - - public void setMinimumSize(Dimension d) { - dMinimum = d; - } - -// fredt@users 20011210 - patch 450412 by elise@users -// with additional replacement of deprecated methods - public void setBounds(int x, int y, int w, int h) { - - super.setBounds(x, y, w, h); - - iSbHeight = sbHoriz.getPreferredSize().height; - iSbWidth = sbVert.getPreferredSize().width; - iHeight = h - iSbHeight; - iWidth = w - iSbWidth; - - sbHoriz.setBounds(0, iHeight, iWidth, iSbHeight); - sbVert.setBounds(iWidth, 0, iSbWidth, iHeight); - adjustScroll(); - - iImage = null; - - repaint(); - } - - public void removeAll() { - - vData = new Vector(); - iRowCount = 0; - - adjustScroll(); - - iMaxTextLength = 10; - - repaint(); - } - - public void addRow(String key, String value, String state, int color) { - - String[] row = new String[4]; - - if (value == null) { - value = ""; - } - - row[0] = key; - row[1] = value; - row[2] = state; // null / "-" / "+" - row[3] = String.valueOf(color); - - vData.addElement(row); - - int len = fMetrics.stringWidth(value); - - if (len > iMaxTextLength) { - iMaxTextLength = len; - } - - iRowCount++; - } - - public void addRow(String key, String value) { - addRow(key, value, null, 0); - } - - public void update() { - adjustScroll(); - repaint(); - } - - void adjustScroll() { - - int iTreeHeight = iRowHeight * (iRowCount + 1); - - // correct would be iMaxTextLength + iMaxIndent*iIndentWidth - int iTreeWidth = iMaxTextLength * 2; - - sbHoriz.setValues(iX, iWidth, 0, iTreeWidth); - - int v = iY / iRowHeight, - h = iHeight / iRowHeight; - - sbVert.setValues(v, h, 0, iRowCount + 1); - - iX = sbHoriz.getValue(); - iY = iRowHeight * sbVert.getValue(); - } - -// fredt@users 20020130 - comment by fredt -// to remove this deprecated method we need to rewrite the Tree class as a -// ScrollPane component - public boolean handleEvent(Event e) { - - switch (e.id) { - - case Event.SCROLL_LINE_UP : - case Event.SCROLL_LINE_DOWN : - case Event.SCROLL_PAGE_UP : - case Event.SCROLL_PAGE_DOWN : - case Event.SCROLL_ABSOLUTE : - iX = sbHoriz.getValue(); - iY = iRowHeight * sbVert.getValue(); - - repaint(); - - return true; - } - - return super.handleEvent(e); - } - - public void paint(Graphics g) { - - if (g == null || iWidth <= 0 || iHeight <= 0) { - return; - } - - g.setColor(SystemColor.control); - g.fillRect(iWidth, iHeight, iSbWidth, iSbHeight); - - if (iImage == null) { - iImage = createImage(iWidth, iHeight); - gImage = iImage.getGraphics(); - - gImage.setFont(fFont); - } - - gImage.setColor(Color.white); - gImage.fillRect(0, 0, iWidth, iHeight); - - int[] lasty = new int[100]; - String[] root = new String[100]; - - root[0] = ""; - - int currentindent = 0; - int y = iRowHeight; - - y -= iY; - - boolean closed = false; - - for (int i = 0; i < iRowCount; i++) { - String[] s = (String[]) vData.elementAt(i); - String key = s[0]; - String data = s[1]; - String folder = s[2]; - int ci = currentindent; - - for (; ci > 0; ci--) { - if (key.startsWith(root[ci])) { - break; - } - } - - if (root[ci].length() < key.length()) { - ci++; - } - - if (closed && ci > currentindent) { - continue; - } - - closed = folder != null && folder.equals("+"); - root[ci] = key; - - int x = iIndentWidth * ci - iX; - - gImage.setColor(Color.lightGray); - gImage.drawLine(x, y, x + iIndentWidth, y); - gImage.drawLine(x, y, x, lasty[ci]); - - lasty[ci + 1] = y; - - int py = y + iRowHeight / 3; - int px = x + iIndentWidth * 2; - - if (folder != null) { - lasty[ci + 1] += 4; - - int rgb = Integer.parseInt(s[3]); - - gImage.setColor(rgb == 0 ? Color.white - : new Color(rgb)); - gImage.fillRect(x + iIndentWidth - 3, y - 3, 7, 7); - gImage.setColor(Color.black); - gImage.drawRect(x + iIndentWidth - 4, y - 4, 8, 8); - gImage.drawLine(x + iIndentWidth - 2, y, - x + iIndentWidth + 2, y); - - if (folder.equals("+")) { - gImage.drawLine(x + iIndentWidth, y - 2, - x + iIndentWidth, y + 2); - } - } else { - px -= iIndentWidth; - } - - gImage.setColor(Color.black); - gImage.drawString(data, px, py); - - currentindent = ci; - y += iRowHeight; - } - - g.drawImage(iImage, 0, 0, this); - } - - public void update(Graphics g) { - paint(g); - } - - public Dimension preferredSize() { - return dMinimum; - } - - public Dimension getPreferredSize() { - return dMinimum; - } - - public Dimension getMinimumSize() { - return dMinimum; - } - - public Dimension minimumSize() { - return dMinimum; - } - - public boolean mouseDown(Event e, int x, int y) { - - if (iRowHeight == 0 || x > iWidth || y > iHeight) { - return true; - } - - y += iRowHeight / 2; - - String[] root = new String[100]; - - root[0] = ""; - - int currentindent = 0; - int cy = iRowHeight; - boolean closed = false; - int i = 0; - - y += iY; - - for (; i < iRowCount; i++) { - String[] s = (String[]) vData.elementAt(i); - String key = s[0]; - String folder = s[2]; - int ci = currentindent; - - for (; ci > 0; ci--) { - if (key.startsWith(root[ci])) { - break; - } - } - - if (root[ci].length() < key.length()) { - ci++; - } - - if (closed && ci > currentindent) { - continue; - } - - if (cy <= y && cy + iRowHeight > y) { - break; - } - - root[ci] = key; - closed = folder != null && folder.equals("+"); - currentindent = ci; - cy += iRowHeight; - } - - if (i >= 0 && i < iRowCount) { - String[] s = (String[]) vData.elementAt(i); - String folder = s[2]; - - if (folder != null && folder.equals("+")) { - folder = "-"; - } else if (folder != null && folder.equals("-")) { - folder = "+"; - } - - s[2] = folder; - - vData.setElementAt(s, i); - repaint(); - } - - return true; - } - - private static int getMaxHeight(FontMetrics f) { - return f.getHeight() + 2; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/hsqldb.png b/database/hsqldb/src/org/hsqldb/util/hsqldb.png deleted file mode 100644 index f674354f..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/hsqldb.png and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/package-info.java b/database/hsqldb/src/org/hsqldb/util/package-info.java deleted file mode 100644 index 87817ca9..00000000 --- a/database/hsqldb/src/org/hsqldb/util/package-info.java +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2001-2021, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** - * Contains the HyperSQL utility classes.

    - * - * The {@code DatabaseManagerSwing} is a GUI application for accessing HyperSQL - * databases. - */ -package org.hsqldb.util; diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/BasicResolver.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/BasicResolver.java deleted file mode 100644 index f51298dc..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/BasicResolver.java +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -import java.io.File; -import java.io.IOException; - -/* - * $Id: BasicResolver.java 6480 2022-04-12 09:46:56Z fredt $ - */ -/** - * Resolves paths using a parent directory; does not resolve properties. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.1 - */ -@SuppressWarnings("ClassWithoutLogger") -public class BasicResolver implements IResolver { - - /** - * creates a new resolver rooted at the given path or its parent. - * - * @param path for resolving other abstract paths. - * @return a new instance. - * @throws IllegalArgumentException if the path is not a directory, cannot - * be created as a directory, does not have - * a parent and a parent cannot be created - * as a directory, of if the file exist and - * is not a file or a directory. - * - */ - public static IResolver forPath(final String path) { - if (path == null) { - return new BasicResolver(null); - } else if (path.isEmpty()) { - return new BasicResolver(new File("")); - } - final File file = new File(path); - if (!file.exists()) { - if (file.mkdirs()) { - return new BasicResolver(file); - } else { - throw new IllegalArgumentException("could not makedirs for: " - + file.getAbsolutePath()); - } - } else if (file.isDirectory()) { - return new BasicResolver(file); - } else if (file.isFile()) { - final File parentFile = file.getParentFile(); - if (parentFile == null) { - throw new IllegalArgumentException("path is not a directory" - + " and has no parent: " + file.getAbsolutePath()); - } else if (parentFile.isFile()) { - throw new IllegalArgumentException("parent path is a file: " - + parentFile.getAbsolutePath()); - } else if (parentFile.isDirectory()) { - return new BasicResolver(file); - } else if (parentFile.exists()) { - throw new IllegalArgumentException("parent path exists but" - + " is not a file or directory: " - + file.getAbsolutePath()); - } else if (parentFile.mkdirs()) { - return new BasicResolver(parentFile); - } else { - throw new IllegalArgumentException("could not makedirs for: " - + parentFile.getAbsolutePath()); - } - } else { - throw new IllegalArgumentException("path exists but is not a file" - + " or a directory: " + file.getAbsolutePath()); - } - } - - private final File parentDir; - - public BasicResolver() { - this(null); - } - - public BasicResolver(final File parentDir) { - this.parentDir = parentDir; - } - - @Override - public String resolveProperties(final String expression) { - return expression; - } - - @Override - public File resolveFile(final String path) { - final File dir = this.parentDir; - final String actualPath = path == null || path.isEmpty() ? "" : path; - File file = new File(actualPath); - if (dir != null && !file.isAbsolute()) { - try { - file = new File(dir.getCanonicalFile(), file.getPath()); - } catch (IOException ex) { - file = new File(dir.getAbsoluteFile(), file.getPath()); - } - } - - try { - return file.getCanonicalFile(); - } catch (IOException e) { - return file.getAbsoluteFile(); - } - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Defines.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Defines.java deleted file mode 100644 index 2e2cf9ef..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Defines.java +++ /dev/null @@ -1,250 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -import java.util.HashMap; -import java.util.Map; - -/* - * $Id: Defines.java 6550 2022-06-08 11:09:08Z fredt $ - */ -/** - * A simple Preprocessor symbol table. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.1 - */ -@SuppressWarnings("ClassWithoutLogger") -public class Defines { - - private final Map symbols; - - /** - * Constructs a new, empty instance. - */ - public Defines() { - this.symbols = new HashMap<>(16); - } - - /** - * Constructs a new instance initially defined using the comma-separated - * list of Preprocessor expressions. - * - * @param csvExpressions a comma-separated list of Preprocessor expressions; - * may be {@code null} or empty, in which case no - * symbols are added. - * @throws PreprocessorException if the given list contains an illegal - * expression. - * @see #defineCSV(String) - */ - public Defines(final String csvExpressions) throws PreprocessorException { - this(); - if (csvExpressions != null && !csvExpressions.isEmpty()) { - final Defines target = this; - target.defineCSV(csvExpressions); - } - } - - /** - * removes all defined symbols. - */ - public void clear() { - this.symbols.clear(); - } - - /** - * adds the given comma-separated list of Preprocessor expressions to the - * symbol table. - * - * @param csvExpressions a comma-separated list of Preprocessor expressions; - * may be {@code null} or empty, in which case no - * symbols are added. - * @throws PreprocessorException if the given list contains an illegal - * expression. - */ - public void defineCSV(final String csvExpressions) - throws PreprocessorException { - if (csvExpressions == null || csvExpressions.isEmpty()) { - return; - } - final String tce = csvExpressions.trim() + ','; - int start = 0; - int len = tce.length(); - while (start < len) { - final int end = tce.indexOf(',', start); - final String expr = tce.substring(start, end).trim(); - if (!expr.isEmpty()) { - defineSingle(expr); - } - start = end + 1; - } - } - - /** - * adds a single Preprocessor expression to the symbol table. - * - * @param expression to add; may be {@code null} or empty, in which case no - * action is taken. - * @throws PreprocessorException if the given expression is illegal or has - * trailing tokens. - */ - public void defineSingle(final String expression) throws PreprocessorException { - if (expression == null || expression.isEmpty()) { - return; - } - final Tokenizer tokenizer = new Tokenizer(expression); - tokenizer.next(); - if (!tokenizer.isToken(Token.IDENT)) { - throw new PreprocessorException("IDENT token required at position: " - + tokenizer.getStartIndex() - + " in [" - + expression - + "]"); // NOI18N - } - - final String ident = tokenizer.getIdent(); - - int tokenType = tokenizer.next(); - - switch (tokenType) { - case Token.EOI: { - this.symbols.put(ident, ident); - return; - } - case Token.ASSIGN: { - tokenType = tokenizer.next(); - break; - } - default: { - break; - } - } - - switch (tokenType) { - case Token.NUMBER: { - final Number number = tokenizer.getNumber(); - - this.symbols.put(ident, number); - - break; - } - case Token.STRING: { - final String string = tokenizer.getString(); - - this.symbols.put(ident, string); - - break; - } - case Token.IDENT: { - final String rhsIdent = tokenizer.getIdent(); - - if (!isDefined(rhsIdent)) { - throw new PreprocessorException("Right hand side" - + "IDENT token [" + rhsIdent + "] at position: " - + tokenizer.getStartIndex() - + " is undefined in [" - + expression - + "]"); // NOI18N - } - - final Object value = this.symbols.get(rhsIdent); - - symbols.put(ident, value); - break; - } - default: { - throw new PreprocessorException("Right hand side NUMBER," - + "STRING or IDENT token required at position: " - + +tokenizer.getStartIndex() - + " in [" - + expression - + "]"); // NOI18N - } - } - - tokenizer.next(); - - if (!tokenizer.isToken(Token.EOI)) { - throw new PreprocessorException("Illegal trailing " - + "characters at position: " - + tokenizer.getStartIndex() - + " in [" - + expression - + "]"); // NOI18N - } - } - - public void undefine(final String symbol) { - this.symbols.remove(symbol); - } - - public boolean isDefined(final String symbol) { - return symbol == null || symbol.isEmpty() - ? false - : this.symbols.containsKey(symbol); - } - - public Object getDefintion(final String symbol) { - return symbol == null || symbol.isEmpty() - ? null - : this.symbols.get(symbol); - } - - public boolean evaluate(final String expression) throws PreprocessorException { - if (expression == null || expression.isEmpty()) { - return false; - } - final Tokenizer tokenizer = new Tokenizer(expression); - - tokenizer.next(); - - final Parser parser = new Parser(this, tokenizer); - final boolean result = parser.parseExpression(); - - if (!tokenizer.isToken(Token.EOI)) { - throw new PreprocessorException("Illegal trailing " - + "characters at position: " - + tokenizer.getStartIndex() - + " in [" - + expression - + "]"); // NOI18N - } - - return result; - } - - @Override - public String toString() { - return super.toString() + this.symbols.toString(); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Document.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Document.java deleted file mode 100644 index 22ebfd21..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Document.java +++ /dev/null @@ -1,551 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - -/* - * $Id: Document.java 6550 2022-06-08 11:09:08Z fredt $ - */ -/** - * Simple line-oriented text document ADT. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.1 - */ -@SuppressWarnings("ClassWithoutLogger") -public class Document { - - /** - * for the given character set name. - * - * @param charsetName to test; {@code null} returns {@code false}. - * @return {@code true} if supported, else {@code false}. - */ - public static boolean isSupportedCharset(final String charsetName) { - return charsetName != null - && !charsetName.trim().isEmpty() - && Charset.isSupported(charsetName); - } - - private final List lines; - - /** - * constructs a new, empty instance. - */ - public Document() { - this.lines = new ArrayList<>(16); - } - - /** - * Constructs a new instance that is effectively a copy of {@code source}. - * - * @param source to copy; may be {@code null}, which is treated like an - * {@code empty} instance. - */ - public Document(final Document source) { - this(); - if (source != null) { - final Document target = this; - target.appendDocument(source); - } - } - - /** - * to this instance. - * - * @param line to add; must not be {@code null}. - * @return this instance. - * @throws IllegalArgumentException if {@code line} is {@code null}. - */ - public Document addSouceLine(final String line) { - if (line == null) { - throw new IllegalArgumentException("line: null"); - } - this.lines.add(line); - return this; - } - - /** - * to this instance. - * - * @param source to append; may be {@code null}, which is treated like an - * {@code empty} instance. - * @return this instance - */ - @SuppressWarnings("AccessingNonPublicFieldOfAnotherObject") - public Document appendDocument(final Document source) { - if (source != null && source.size() > 0) { - this.lines.addAll(source.lines); - } - return this; - } - - /** - * this instance, making it {@link #isEmpty() empty}. - * - * @return this instance. - */ - public Document clear() { - this.lines.clear(); - return this; - } - - /** - * if at least one line in this instance contains the given sequence. - *

    - * Note: each line is tested separately; no test is performed to see - * if the sequence spans more than one line. - *

    - * - * @param sequence to test. - * @return {@code true} if the condition holds, else {@code false}. - */ - public boolean contains(final CharSequence sequence) { - if (sequence == null) { - return false; - } - final String toFind = sequence.toString(); - final List list = this.lines; - final int size = list.size(); - for (int i = 0; i < size; i++) { - if (-1 < list.get(i).indexOf(toFind, 0)) { - return true; - } - } - return false; - } - - /** - * from this instance at the given index. - * - * @param index at which to remove a line. - * @return this instance. - * @throws IndexOutOfBoundsException if the index is out of range - * ({@code index < 0 || index >= size())} - */ - public Document deleteSourceLine(final int index) { - this.lines.remove(index); - return this; - } - - /** - * if the given document has effectively the same content as this instance. - * - * @param document to test; may be {@code null}, which is treated as - * {@link #isEmpty() empty}. - * @return {@code true} if the content of the given {@code document} is - * equal to the content of this instance, as per - * {@link List#equals(Object)}. - */ - @SuppressWarnings("AccessingNonPublicFieldOfAnotherObject") - public boolean contentEquals(final Document document) { - return (document == this) - ? true - : document == null - ? this.isEmpty() - : this.lines.equals(document.lines); - } - - /** - * at the given index. - * - * @param index at which to retrieve the line. - * @return the line at the given index. - * @throws IndexOutOfBoundsException if the index is out of range - * ({@code index < 0 || index >= size()}) - */ - public String getSourceLine(final int index) { - return this.lines.get(index); - } - - /** - * if this instance contains no lines. - * - * @return {@code true} if {@link #size()} {@code == 0}, else {@code false}. - */ - public boolean isEmpty() { - return this.lines.isEmpty(); - } - - /** - * at the specified index. - * - * @param index at which the specified line is to be inserted - * @param line to be inserted - * @return this instance - * @throws NullPointerException if the specified line is {@code null}. - * @throws IndexOutOfBoundsException if the index is out of range - * ({@code index < 0 || index >= size()}) - */ - public Document insertSourceLine(final int index, final String line) { - if (line == null) { - throw new IllegalArgumentException("line: null"); - } - this.lines.add(index, line); - return this; - } - - /** - * as if by invoking {@code this.clear().appendDocument(source)}. - * - * @param source content used to replace the existing content of this - * instance; may be {@code null}, which is treated as - * {@link #isEmpty() empty}. - * @return this instance. - */ - public Document replaceWith(final Document source) { - return this.clear().appendDocument(source); - } - - /** - * at the specified index in this instance. - * - * @param index index of the line to replace - * @param line to be stored at the specified index - * @return this instance. - * @throws NullPointerException if the specified line is {@code null}. - * @throws IndexOutOfBoundsException if the index is out of range - * ({@code index < 0 || index >= size()}) - */ - public Document setSourceLine(final int index, final String line) { - if (line == null) { - throw new IllegalArgumentException("null"); - } - this.lines.set(index, line); - return this; - } - - /** - * of this instance, as the number of lines. - * - * @return the number of lines in this instance. - */ - public int size() { - return this.lines.size(); - } - -// ------------------------ I/O convenience methods ---------------------------- - /** - * this instance from the given input stream using the given character - * encoding. - *

    - * Note: it is the responsibility of the caller to close the input - * stream. - *

    - * - * @param inputStream from which to load; must not be {@code null}. - * @param encoding {@code null} for the system default. - * @return this object. - * @throws IOException if an I/O error occurs. - * @throws IllegalArgumentException if the encoding is not supported. - * @throws NullPointerException if the inputStream is {@code null}. - */ - public Document load(final InputStream inputStream, final String encoding) throws IOException, - IllegalArgumentException, NullPointerException { - return load((Object) inputStream, encoding); - } - - /** - * this instance from the given reader. - *

    - * Note: it is the responsibility of the caller to close the reader. - *

    - * - * @param reader from which to load; must not be {@code null}. - * @return this object. - * @throws IOException in an I/O error occurs. - * @throws NullPointerException if the reader is {@code null}. - */ - public Document load(final Reader reader) throws IOException, - NullPointerException { - return load(reader, null); - } - - /** - * this instance from the given file using the given character encoding. - *

    - * Note: the underlying file input stream is closed automatically. - *

    - * - * @param file from which to load; {@code null} is treated the empty - * path. - * @param encoding {@code null} for the system default. - * @return this object. - * @throws IOException in an I/O error occurs. - * @throws IllegalArgumentException if the encoding is not supported. - */ - public Document load(final File file, final String encoding) throws IOException, - IllegalArgumentException { - return load((Object) (file == null ? new File("") : file), encoding); - } - - /** - * this instance from the given abstract file path using the given character - * encoding. - *

    - * Note: the underlying file input stream is closed automatically. - *

    - * - * @param path from which to load; {@code null} is treated the empty - * path. - * @param encoding {@code null} for the system default. - * @return this object. - * @throws IOException in an I/O error occurs. - * @throws IllegalArgumentException if the encoding is not supported. - */ - public Document load(final String path, final String encoding) throws IOException, - IllegalArgumentException { - return load((Object) (path == null ? "" : path), encoding); - } - - /** - * this instance from the given source. - *

    - * Note: if the source is an InputStream or Reader, it is the - * responsibility of the caller to close; otherwise, the underlying file - * input stream is closed automatically. - *

    - * - * @param source required; by default, must be an instance of an - * InputStream, Reader, File, or String denoting an - * abstract file path. - * @param encoding optional; ignored if source is a Writer. {@code null} is - * taken to be {@link Charset#defaultCharset()}. - * @return this instance. - * @throws IOException if an I/O error occurs. - * @throws NullPointerException if source is {@code null}. - * @throws IllegalArgumentException if the encoding is not supported. - */ - @SuppressWarnings("NestedAssignment") - protected Document load(final Object source, final String encoding) throws IOException, - NullPointerException, - IllegalArgumentException { - if (source == null) { - throw new NullPointerException("source must not be null."); - } - Charset charset = (source instanceof Reader || encoding == null) - ? Charset.defaultCharset() : null; - if (charset == null && isSupportedCharset(encoding)) { - charset = Charset.forName(encoding); - } else { - throw new IllegalArgumentException("encoding: " + encoding); - } - BufferedReader reader = null; - boolean close = false; - if (source instanceof InputStream) { - final InputStream is = (InputStream) source; - final InputStreamReader isr = new InputStreamReader(is, charset); - reader = new BufferedReader(isr); - } else if (source instanceof File) { - final InputStream fis = new FileInputStream((File) source); - final InputStreamReader isr = new InputStreamReader(fis, charset); - close = true; - reader = new BufferedReader(isr); - } else if (source instanceof String) { - final InputStream fis = new FileInputStream((String) source); - final InputStreamReader isr = new InputStreamReader(fis, charset); - close = true; - reader = new BufferedReader(isr); - } else if (source instanceof BufferedReader) { - reader = (BufferedReader) source; - } else if (source instanceof Reader) { - reader = new BufferedReader((Reader) source); - } else { - throw new IOException("unhandled load source: " + source); // NOI18N - } - clear(); - String line; - final List list = this.lines; - try { - while (null != (line = reader.readLine())) { - list.add(line); - } - } finally { - if (close) { - try { - reader.close(); - } catch (IOException ex) { - } - } - } - return this; - } - - /** - * to the given output stream using the given character encoding. - *

    - * Note: it is the responsibility of the caller to close the output - * stream. - *

    - * - * @param outputStream to which to save; must not be {@code null}. - * @param encoding {@code null} for the system default. - * @return this object. - * @throws IOException if an I/O error occurs. - * @throws IllegalArgumentException if the encoding is not supported. - * @throws NullPointerException if the output stream is {@code null}. - */ - public Document save(final OutputStream outputStream, final String encoding) throws IOException { - return save((Object) outputStream, encoding); - } - - /** - * to the given file using the given character encoding. - * - * @param file to which to save; {@code null} is treated as having an - * empty path - * @param encoding {@code null} for the system default. - * @return this object. - * @throws IOException if an I/O error occurs. - * @throws IllegalArgumentException if the encoding is not supported. - */ - public Document save(final File file, final String encoding) throws IOException, - IllegalArgumentException { - return save((Object) (file == null ? new File("") : file), encoding); - } - - /** - * to the given abstract file path using the given character encoding. - * - * @param path to which to save; {@code null} is treated as the empty - * path; - * @param encoding {@code null} for the system default. - * @return this object. - * @throws IOException if an I/O error occurs. - * @throws IllegalArgumentException if the encoding is not supported. - */ - public Document save(final String path, final String encoding) throws IOException, - IllegalArgumentException { - return save((Object) (path == null ? "" : path), encoding); - } - - /** - * to the given writer. - *

    - * Note: it is the responsibility of the caller to close the writer. - *

    - * - * @param writer to which to save; must not be {@code null}. - * @return this object. - * @throws IOException if an I/O error occurs. - * @throws NullPointerException if the writer is {@code null}. - */ - public Document save(final Writer writer) throws IOException { - return save(writer, null); - } - - /** - * this instance to the given target. - *

    - * Note: if the target is an OutputStream or Writer, it is the - * responsibility of the caller to close; otherwise, the underlying file - * output stream is closed automatically. - *

    - * - * @param target required; by default, must be an instance of an - * OutputStream, Writer, File, or String denoting an - * abstract file path. - * @param encoding optional; does not apply to Writer. {@code null} is taken - * to be {@link Charset#defaultCharset()}. - * @return this instance. - * @throws IOException if an I/O error occurs. - * @throws NullPointerException if target is {@code null}. - */ - protected Document save(final Object target, final String encoding) throws IOException { - if (target == null) { - throw new NullPointerException("target must not be null."); - } - Charset charset = (target instanceof Writer || encoding == null) - ? Charset.defaultCharset() : null; - if (charset == null && isSupportedCharset(encoding)) { - charset = Charset.forName(encoding); - } else { - throw new IllegalArgumentException("encoding: " + encoding); - } - BufferedWriter writer = null; - boolean close = false; - if (target instanceof OutputStream) { - final OutputStream os = (OutputStream) target; - final OutputStreamWriter osw = new OutputStreamWriter(os, charset); - writer = new BufferedWriter(osw); - } else if (target instanceof File) { - final OutputStream fos = new FileOutputStream((File) target); - final OutputStreamWriter osw = new OutputStreamWriter(fos, charset); - close = true; - writer = new BufferedWriter(osw); - } else if (target instanceof String) { - OutputStream fos = new FileOutputStream((String) target); - final OutputStreamWriter osw = new OutputStreamWriter(fos, charset); - close = true; - writer = new BufferedWriter(osw); - } else if (target instanceof BufferedWriter) { - writer = (BufferedWriter) target; - } else if (target instanceof Writer) { - writer = new BufferedWriter(writer); - } else { - throw new IOException("unhandled save target: " + target); - } - final List list = this.lines; - final int count = list.size(); - try { - for (int i = 0; i < count; i++) { - writer.write(list.get(i)); - writer.newLine(); - } - writer.flush(); - } finally { - if (close) { - try { - writer.close(); - } catch (IOException ignored) { - } - } - } - return this; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/IResolver.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/IResolver.java deleted file mode 100644 index 8c7fb2c4..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/IResolver.java +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2001-2007, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -import java.io.File; - -/* $Id: IResolver.java 5793 2018-01-06 13:12:38Z fredt $ */ - -/** - * Property and file path resolution contract.

    - * - * Implementations are free to ignore expansion directives and simply - * pass through expressions and paths unchanged.

    - * - * If an implementation does process expansion directives, recognized forms - * should at least include the ubiquitous ${...} shell expansion form. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.8.1 - * @since 1.8.1 - */ -public interface IResolver { - String resolveProperties(String expression); - File resolveFile(String path); -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Line.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Line.java deleted file mode 100644 index 74b3c4d9..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Line.java +++ /dev/null @@ -1,233 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -/* - * $Id: Line.java 6480 2022-04-12 09:46:56Z fredt $ - */ -/** - * Preprocessor view of a line in a text document. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.1 - */ -public class Line { - - /** - * Is {@code "//#"}. - */ - public static final String DIRECTIVE_PREFIX = "//#"; - /** - * Is {@code " \t"}. - */ - public static final String SPACE_CHARS = " \t"; - /** - * Is {@code 3}. - */ - public static final int DIRECTIVE_PREFIX_LENGTH = DIRECTIVE_PREFIX.length(); - /** - * Is {@code 4}. - */ - private static final int DIRECTIVE_PREFIX_LENGTH_PLUS_ONE - = DIRECTIVE_PREFIX_LENGTH + 1; - /** - * Id {@code ' '}. - */ - public static final String HIDE_DIRECTIVE = DIRECTIVE_PREFIX + ' '; - - /** - * in the given line. - * - * @param line to inspect - * @return the first index of any non-tab or non-space character. - * @throws NullPointerException if line is {@code null}. - */ - public static int indexOfNonTabOrSpace(final String line) { - int pos = 0; - int len = line.length(); - - while (pos < len) { - char ch = line.charAt(pos); - - if ((ch == ' ') || (ch == '\t')) { - pos++; - continue; - } - - break; - } - - return pos; - } - - /** - * in the given, generic string. - * - * @param string to inspect - * @param fromIndex at which to start the inspection; There is no - * restriction on the value . If it is negative, it has the - * same effect as if it were zero: the entire string may be - * searched. If it is greater than the length of the string, - * it has the same effect as if it were equal to the length - * of string: {@code -1} is returned. - * @return the first index of either a tab ort a space character; {@code -1} - * if no such characters are found. - * @throws NullPointerException if string is {@code null}. - */ - public static int indexOfTabOrSpace(final String string, final int fromIndex) { - final int spos = string.indexOf(' ', fromIndex); - final int tpos = string.indexOf('\t', fromIndex); - - return (((tpos != -1) && (tpos < spos)) || (spos == -1)) ? tpos : spos; - } - - private int type; - private String sourceText; - private String indent; - private String text; - private String arguments; - - /** - * Constructs a new instance from the given line. - * - * @param line in a Document being Preprocessed. - * @throws PreprocessorException - * @throws NullPointerException - */ - public Line(String line) throws PreprocessorException, NullPointerException { - final Line target = this; - target.setSourceText(line); - } - - public void setSourceText(String line) throws PreprocessorException, NullPointerException { - this.sourceText = line; - int pos = indexOfNonTabOrSpace(line); - this.indent = line.substring(0, pos); - final String subline = line.substring(pos); - - if (!subline.startsWith(DIRECTIVE_PREFIX)) { - this.text = subline; - this.arguments = null; - this.type = LineType.VISIBLE; - } else if (subline.length() == DIRECTIVE_PREFIX_LENGTH) { - this.text = ""; - this.arguments = null; - this.type = LineType.HIDDEN; - } else if (SPACE_CHARS.indexOf(subline.charAt(DIRECTIVE_PREFIX_LENGTH)) != -1) { - this.text = subline.substring(DIRECTIVE_PREFIX_LENGTH_PLUS_ONE); - this.arguments = null; - this.type = LineType.HIDDEN; - } else { - pos = indexOfTabOrSpace(subline, DIRECTIVE_PREFIX_LENGTH_PLUS_ONE); - if (pos == -1) { - this.text = subline; - this.arguments = null; - } else { - this.text = subline.substring(0, pos); - this.arguments = subline.substring(pos + 1).trim(); - } - final Integer typeId = LineType.id(text); - if (typeId == null) { - throw new PreprocessorException("Unknown directive [" - + text + "] in [" + subline + "]"); // NOI18N - } - this.type = typeId; - } - - } - - /** - * for this line, if they exist. - * - * @return the value. - * @throws PreprocessorException if the line has no arguments. - */ - public String getArguments() throws PreprocessorException { - if (arguments == null || arguments.isEmpty()) { - throw new PreprocessorException("[" + text - + "]: has no argument(s)"); // NOI18N - } - return arguments; - } - - /** - * which is the original, verbatim value with which this instance was - * constructed. - * - * @return the source text val - */ - public String getSourceText() { - return sourceText; - } - - /** - * prefix for this instance, which is any leading space or table characters. - * - * @return the leading space or table characters for this instance. - */ - public String getIndent() { - return indent; - } - - /** - * which is not the directive or directive arguments portion of the line. - *

    - * For visible lines, this is the portion following the indent, if any. - *

    - *

    - * For hidden lines, this is the text, if any, following the directive - * prefix used to hide the line. - *

    - * - * @return - */ - public String getText() { - return text; - } - - public int getType() { - return type; - } - - public boolean isType(int lineType) { - return (this.type == lineType); - } - - @Override - public String toString() { - return "" + LineType.label(this.type) + "(" + this.type + "): indent [" - + this.indent + "] text [" + this.text - + ((this.arguments == null) ? "]" : ("] args [" - + this.arguments + "]")); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/LineType.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/LineType.java deleted file mode 100644 index 0c9a19c8..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/LineType.java +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -/* - * $Id: LineType.java 6480 2022-04-12 09:46:56Z fredt $ - */ -/** - * Static methods and constants to decode Preprocessor line types. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.1 - */ -@SuppressWarnings("ClassWithoutLogger") -public class LineType { - - // - public static final int UNKNOWN = 0; - public static final int DEF = 1; - public static final int DEFINE = 1; - public static final int ELIF = 2; - public static final int ELIFDEF = 3; - public static final int ELIFNDEF = 4; - public static final int ELSE = 5; - public static final int ENDIF = 6; - public static final int ENDINCLUDE = 7; - public static final int HIDDEN = 8; - public static final int IF = 9; - public static final int IFDEF = 10; - public static final int IFNDEF = 11; - public static final int INCLUDE = 12; - public static final int UNDEF = 13; - public static final int UNDEFINE = 13; - public static final int VISIBLE = 14; - - // - private static Map directives; - private static Map labels; - - static { - init(); - } - - public static String label(final Integer key) { - return labels.get(key); - } - - public static Integer id(final String key) { - return directives.get(key); - } - - private static void init() { - - directives = new HashMap<>(23); - labels = new HashMap<>(23); - final Field[] fields = LineType.class.getDeclaredFields(); - for (int i = 0, j = 0; i < fields.length; i++) { - final Field field = fields[i]; - - if (field.getType().equals(Integer.TYPE)) { - final String label = field.getName(); - - try { - int value = field.getInt(null); - - labels.put(value, label); - - switch (value) { - case VISIBLE: - case HIDDEN: { - // ignore - break; - } - default: { - final String key = Line.DIRECTIVE_PREFIX - + label.toLowerCase(Locale.ENGLISH); - - directives.put(key, new Integer(value)); - - break; - } - } - - } catch (IllegalArgumentException | IllegalAccessException ignored) { - // ex.printStackTrace(); - } - } - } - } - - private LineType() { - throw new AssertionError("Pure Utiluity Class"); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Option.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Option.java deleted file mode 100644 index ce19f69f..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Option.java +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (c) 2001-2007, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -/* $Id: Option.java 6434 2022-03-06 09:02:19Z campbell-burnet $ */ - -/** - * Static methods and constants to decode preprocessor options. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.8.1 - * @since 1.8.1 - */ -public class Option { - - public static final int DEFAULT = 0; // No options set - public static final int BACKUP = 1<<0; // Backup source files? - public static final int FILTER = 1<<1; // Remove directive lines? - public static final int INDENT = 1<<2; // indent directive lines? - public static final int TEST_ONLY = 1<<3; // process only; don't save - public static final int VERBOSE = 1<<4; // log detailed info - - private Option(){/*Construction Disabled*/} - - public static boolean isDefault(int options) { - return options == DEFAULT; - } - - public static int setDefault(int options, boolean _default) { - return (_default) ? DEFAULT : options; - } - - public static boolean isBackup(int options) { - return ((options & BACKUP) != 0); - } - - public static int setBackup(int options, boolean backup) { - return (backup) ? (options | BACKUP) : (options & ~BACKUP); - } - - public static boolean isFilter(int options) { - return ((options & FILTER) != 0); - } - - public static int setFilter(int options, boolean filter) { - return (filter) ? (options | FILTER) : (options & ~FILTER); - } - - public static boolean isIndent(int options) { - return ((options & INDENT) != 0); - } - - public static int setIndent(int options, boolean indent) { - return (indent) ? (options | INDENT) : (options & ~INDENT); - } - - public static boolean isTestOnly(int options) { - return ((options & TEST_ONLY) != 0); - } - - public static int setTestOnly(int options, boolean testOnly) { - return (testOnly) ? (options | TEST_ONLY) : (options & ~TEST_ONLY); - } - - public static boolean isVerbose(int options) { - return ((options & VERBOSE) != 0); - } - - public static int setVerbose(int options, boolean verbose) { - return (verbose) ? (options | VERBOSE) : (options & ~VERBOSE); - } - - public static String toOptionsString(int options) { - Object[] values = { - isBackup(options), - isFilter(options), - isIndent(options), - isTestOnly(options), - isVerbose(options)}; - - return String.format("backup: %s, filter: %s, indent: %s, testOnly: %s, verbose: %s", values); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Parser.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Parser.java deleted file mode 100644 index e65c9934..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Parser.java +++ /dev/null @@ -1,277 +0,0 @@ -/* Copyright (c) 2001-2007, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -/* $Id: Parser.java 5793 2018-01-06 13:12:38Z fredt $ */ - -/** - * Simple preprocessor directive parser.

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.8.1 - * @since 1.8.1 - */ -class Parser { - - Defines defines; - Tokenizer tokenizer; - - Parser(Defines defines, Tokenizer tokenizer) { - this.defines = defines; - this.tokenizer = tokenizer; - } - - boolean parseExpression() throws PreprocessorException { - boolean result = parseTerm(); - - while (true) { - switch(this.tokenizer.getTokenType()) { - case Token.OR : { - this.tokenizer.next(); - - result = result | parseTerm(); - - break; - } - case Token.XOR : { - this.tokenizer.next(); - - result = result ^ parseTerm(); - - break; - } - - default : { - return result; - } - } - } - } - - boolean parseTerm() throws PreprocessorException { - boolean result = parseFactor(); - - while (this.tokenizer.isToken(Token.AND)) { - this.tokenizer.next(); - - result = result & parseFactor(); - } - - return result; - } - - boolean parseFactor() throws PreprocessorException { - boolean result; - - switch(this.tokenizer.getTokenType()) { - case Token.IDENT : { - String ident = this.tokenizer.getIdent(); - int type = this.tokenizer.next(); - - if ((type == Token.EOI) || (type == Token.RPAREN) || - Token.isLogicalOperator(type)) { - result = this.defines.isDefined(ident); - } else if (Token.isComparisonOperator(type)) { - result = parseComparison(ident, type); - } else { - throw new PreprocessorException("Logical or comparison " - + "operator token required at position " - + this.tokenizer.getStartIndex() - + " in [" - + this.tokenizer.getSource() - + "]"); // NOI18N - } - - break; - } - case Token.NOT :{ - this.tokenizer.next(); - - result = !parseFactor(); - - break; - } - case Token.LPAREN : { - this.tokenizer.next(); - - result = parseExpression(); - - if (!this.tokenizer.isToken(Token.RPAREN)) { - throw new PreprocessorException("RPAREN token required at " - + "position " - + this.tokenizer.getStartIndex() - + " in [" - + this.tokenizer.getSource() - + "]"); // NOI18N - } - - this.tokenizer.next(); - - break; - } - default : { - throw new PreprocessorException("IDENT, NOT or LPAREN " - + "token required at position " - + this.tokenizer.getStartIndex() - + " in [" - + this.tokenizer.getSource() - + "]"); // NOI18N - } - } - - return result; - } - - boolean parseComparison(String ident, int opType) - throws PreprocessorException { -// checkIsComparisonOperator(opType); - - boolean result; - Object lhs = this.defines.getDefintion(ident); - int pos = this.tokenizer.getStartIndex(); - Object rhs = parseValue(); - - if (lhs == null) { - throw new PreprocessorException("IDENT " + ident - + " is not defined at position" - + pos - + "in [" - + this.tokenizer.getSource() - + "]"); // NOI18N - } - - switch(opType) { - case Token.EQ :{ - result = (compare(lhs, rhs) == 0); - - break; - } - case Token.LT : { - result = (compare(lhs, rhs) < 0); - - break; - } - case Token.LTE : { - result = (compare(lhs, rhs) <= 0); - - break; - } - case Token.GT : { - result = (compare(lhs, rhs) > 0); - - break; - } - case Token.GTE : { - result = (compare(lhs, rhs) >= 0); - - break; - } - default : { - // Stupid compiler trick. - // Can't actually happen because this case will cause an - // exception to be thrown in method parseFactor (or in - // method checkIsComparisonOperator when uncommented) - throw new PreprocessorException("Internal error"); // NOI18N - } - } - - this.tokenizer.next(); - - return result; - } - -// void checkIsComparisonOperator(int opType) throws PreprocessorException { -// if (!Token.isComparisonOperator(opType)) { -// throw new PreprocessorException("Comparison " -// + "operator token required at position " -// + tokenizer.getBeginIndex() -// + " in [" -// + tokenizer.getSource() -// + "]"); // NOI18N -// } -// } - - static int compare(Object o1, Object o2) { - // nulls are basically 'illegal' so yes: - // we want to throw NPE here if o1 or o2 is null - if (o1 instanceof Comparable) { - return (o1.getClass().isAssignableFrom(o2.getClass())) - ? ((Comparable)o1).compareTo(o2) - : String.valueOf(o1).compareTo(String.valueOf(o2)); - } else { - return o1.toString().compareTo(o2.toString()); - } - } - - Object parseValue() throws PreprocessorException { - Object value; - - switch(this.tokenizer.next()) { - case Token.IDENT : { - String ident = this.tokenizer.getIdent(); - - value = this.defines.getDefintion(ident); - - if (value == null) { - throw new PreprocessorException("IDENT " + ident - + " is not defined at position" - + this.tokenizer.getStartIndex() - + "in [" - + this.tokenizer.getSource() - + "]"); // NOI18N - } - - break; - } - case Token.STRING : { - value = this.tokenizer.getString(); - - break; - } - case Token.NUMBER : { - value = this.tokenizer.getNumber(); - - break; - } - default :{ - throw new PreprocessorException("IDENT, STRING" - + "or NUMBER token required at position " - + this.tokenizer.getStartIndex() - + " in: [" - + this.tokenizer.getSource() - + "]"); // NOI18N - } - } - - return value; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Preprocessor.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Preprocessor.java deleted file mode 100644 index 72fb5efd..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Preprocessor.java +++ /dev/null @@ -1,780 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -import java.io.File; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.Stack; - -/* - * $Id: Preprocessor.java 6550 2022-06-08 11:09:08Z fredt $ - */ -/** - * Simple text document preprocessor. - *

    - * - * Aims specifically at transforming the HSQLDB codebase to one of a small - * number of specific build targets, while keeping complexity and external - * dependencies to a minimum, yet providing an environment that is - * sufficiently powerful to solve most easily imaginable preprocessing - * scenarios. - * - * Supports the following (case-sensitive) directives: - * - *

      - *
    • //#def[ine] IDENT (ASSIGN? (STRING | NUMBER | IDENT) )? - *
    • //#elif BOOLEXPR - *
    • //#elifdef IDENT - *
    • //#elifndef IDENT - *
    • //#else - *
    • //#endif - *
    • //#endinclude - *
    • //#if BOOLEXPR - *
    • //#ifdef IDENT - *
    • //#ifndef IDENT - *
    • //#include FILEPATH - *
    • //#undef[ine] IDENT - *
    - * - * where BOOLEXPR is: - * - *
    - * ( IDENT
    - * | IDENT ( EQ |  LT | LTE | GT | GTE ) VALUE
    - * | BOOLEXPR { OR | XOR | AND } BOOLEXPR
    - * | NOT BOOLEXPR
    - * | LPAREN BOOLEXPR RPAREN )
    - * 
    - * - * and VALUE is : - * - *
    - * ( STRING
    - * | NUMBER
    - * | IDENT )
    - * 
    - * - * and lexicographic elements are : - * - *
    - * ASSIGN     : '='
    - * EQ         : '=='
    - * LT         : {@code '<'}
    - * LTE        : {@code '<='}
    - * GT         : {@code '>'}
    - * GTE        : {@code '>='}
    - * OR         : ('|' | '||')
    - * XOR        : '^'
    - * AND        : {@code ('&' | '&&')}
    - * NOT        : '!'
    - * DQUOTE     : '"'
    - * LPAREN     : '('
    - * RPAREN     : ')'
    - * DOT        : '.'
    - * DIGIT      : ['0'..'9']
    - * EOL        : ('\n' | '\r' | '\n\r')
    - * SPACE      : (' ' | '\t')
    - * NON_DQUOTE : { ANY_UNICODE_CHARACTER_EXCEPT_DQUOTE_OR_EOL } -- see the unicode spec
    - * NON_SPACE  : { ANY_UNICODE_CHARACTER_EXCEPT_SPACE_OR_EOL }  -- see the unicode spec
    - * WS         : { JAVA_WS } -- see java.lang.Character
    - * NON_WS     : { ANY_UNICODE_CHARACTER_EXCEPT_WS_OR_EOL }
    - * STRING     : DQUOTE NON_DQUOTE* DQUOTE
    - * NUMBER     : DIGIT+ (DOT DIGIT*)?
    - * IDENT      : JAVA_IDENT_START JAVA_IDENT_PART*              -- see java.lang.Character
    - * FILEPATH   : NON_SPACE (ANY_UNICODE_CHARACTER* NON_WS)?     -- i.e. trailing SPACE elements are ignored
    - * 
    - * - * The lexicographic definitions above use the BNF conventions : - * - *
    - * '?' : zero or one
    - * '*' : zero or more
    - * '+' : one or more
    - * 
    - * - * Directives may be arbitrarily indented; there is an option (INDENT) to set - * or unset directive indentation on output. There is also an option (FILTER) - * to remove directive lines from output. See {@link Option Option} for other - * preprocessor options. - *

    - * - * '//#ifxxx' directives may be nested to arbitrary depth, - * may be chained with an arbitrary number of '//#elifxxx' directives, - * may be optionally followed by a single '//#else' directive, and - * must be terminated by a single '//#endif' directive. - *

    - * - * Each '//#include' directive must be terminated by an '//#endinclude' - * directive; lines between '//#include' and '//#endinclude' are replaced - * by the content retrieved from the specified FILEPATH. - *

    - * - * Included files are preprocessed in a nested scope that inherits the - * defined symbols of the including scope. Directive lines in included files - * are always excluded from output. - *

    - * - * Design Notes

    - * - * There are many better/more sophisticated preprocessors/templating - * engines out there. FreeMaker and Velocity come to mind immediately. - * Another--the NetBeans MIDP preprocessor--was the direct inspiration for - * this class. - *

    - * - * Other options were rejected because the work of creating this class appeared - * to be less than dealing with the complexity and dependency issues of hooking - * up to external libraries. - * - * The NetBeans preprocessor, in particular, was rejected because it was - * not immediately evident how to invoke it independently from the IDE, - * how to make it available to non-MIDP projects from within the IDE or how to - * isolate the correct OpenIDE jars to allow stand-alone operation. - *

    - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 2.7.0 - * @since 1.8.1 - */ -public class Preprocessor { - - // ========================================================================= - // ------------------------------- Public API ------------------------------ - // ========================================================================= - /** - * Preprocesses the specified list of files. - *

    - * - * @param sourceDir under which input files are located - * @param targetDir under which output files are to be written - * @param fileNames to be preprocessed - * @param altExt to use for output file names - * @param encoding with which to write output files - * @param options used to control preprocessing - * @param defines CSV list of symbol definition expressions - * @param resolver with which to perform property and path expansions - * @throws PreprocessorException if an error occurs while loading, - * preprocessing or saving the result of preprocessing one of the - * specified input files - */ - public static void preprocessBatch(File sourceDir, File targetDir, - String[] fileNames, String altExt, String encoding, int options, - String defines, IResolver resolver) throws PreprocessorException { - -// log("sourceDir: " + sourceDir); -// log("targetDir: " + targetDir); -// log("fileNames: " + Arrays.asList(fileNames)); -// log("altExt : " + altExt); -// log("encoding : " + encoding); -// log("options : " + Option.toOptionsString(options)); -// log("defines : " + defines); -// log("resolver : " + resolver); - for (int i = 0; i < fileNames.length; i++) { - String fileName = fileNames[i]; - - try { - preprocessFile(sourceDir, targetDir, fileName, altExt, encoding, - options, defines, resolver); - } catch (PreprocessorException ppe) { - - if (!Option.isVerbose(options)) { - log(fileName + " ... not modified, " + ppe.getMessage()); - } - - throw ppe; - } - } - } - - /** - * Preprocesses a single file. - *

    - * - * @param sourceDir under which the input file is located - * @param targetDir under which the output file is to be written - * @param fileName to be preprocessed - * @param altExt to use for output file name - * @param encoding with which to write output file - * @param options used to control preprocessing - * @param defines CSV list of symbol definition expressions - * @param resolver with which to perform property and path expansions - * @throws PreprocessorException if an error occurs while loading, - * preprocessing or saving the result of preprocessing the - * specified input file - */ - public static void preprocessFile(File sourceDir, File targetDir, - String fileName, String altExt, String encoding, int options, - String defines, IResolver resolver) throws PreprocessorException { - - String sourcePath = translatePath(sourceDir, fileName, null); - String targetPath = translatePath(targetDir, fileName, altExt); - File targetFile = new File(targetPath); - File backupFile = new File(targetPath + "~"); - boolean sameDir = sourceDir.equals(targetDir); - boolean sameExt = (altExt == null); - boolean verbose = Option.isVerbose(options); - boolean testOnly = Option.isTestOnly(options); - boolean backup = Option.isBackup(options); - Preprocessor preprocessor = new Preprocessor(sourcePath, - encoding, options, resolver, defines); - - if (verbose) { -// log("sourceDir : " + sourceDir); -// log("targetDir : " + targetDir); -// log("fileName : " + fileName); -// log("altExt : " + altExt); -// log("encoding : " + encoding); -// log("options : " + Option.toOptionsString(options)); -// log("defines : " + defines); -// log("resolver : " + resolver); - log("sourcePath: " + sourcePath); - log("targetPath: " + targetPath); - } - - preprocessor.loadDocument(); - - boolean modified = preprocessor.preprocess(); - boolean rewrite = modified || !sameDir || !sameExt; - - if (!rewrite) { - if (verbose) { - log(fileName + " ... not modified"); - } - - return; - } else if (verbose) { - log(fileName + " ... modified"); - } - - if (testOnly) { - return; - } - - try { - targetFile.getParentFile().mkdirs(); - } catch (Exception e) { - throw new PreprocessorException("mkdirs failed \"" + targetFile - + "\": " + e); // NOI18N - } - - backupFile.delete(); - - if (targetFile.exists() && !targetFile.renameTo(backupFile)) { - throw new PreprocessorException("Rename failed: \"" - + targetFile - + "\" => \"" - + backupFile - + "\""); // NOI18N - } - - if (verbose) { - log("Writing \"" + targetPath + "\""); - } - - preprocessor.saveDocument(targetPath); - - if (!backup) { - backupFile.delete(); - } - } - - // ========================================================================= - // ----------------------------- Implementation ---------------------------- - // ========================================================================= - // Fields - // static - static final int CONDITION_NONE = 0; - static final int CONDITION_ARMED = 1; - static final int CONDITION_IN_TRUE = 2; - static final int CONDITION_TRIGGERED = 3; - - // optimization - zero new object burn rate for statePush() - @SuppressWarnings("UnnecessaryBoxing") - static final Integer[] STATES = new Integer[]{ - new Integer(CONDITION_NONE), - new Integer(CONDITION_ARMED), - new Integer(CONDITION_IN_TRUE), - new Integer(CONDITION_TRIGGERED) - }; - - // instance - private final String documentPath; - private final String encoding; - private final int options; - private final IResolver resolver; - private final Document document; - private final Defines defines; - private final Stack stack; - private int state; - - // Constructors - private Preprocessor(String documentPath, - String encoding, int options, IResolver resolver, - String predefined) throws PreprocessorException { - - if (resolver == null) { - File parentDir = new File(documentPath).getParentFile(); - - this.resolver = new BasicResolver(parentDir); - } else { - this.resolver = resolver; - } - - if (predefined == null || predefined.trim().length() == 0) { - this.defines = new Defines(); - } else { - predefined = this.resolver.resolveProperties(predefined); - this.defines = new Defines(predefined); - } - - this.documentPath = documentPath; - this.encoding = encoding; - this.options = options; - this.document = new Document(); - this.stack = new Stack(); - this.state = CONDITION_NONE; - } - - private Preprocessor(Preprocessor other, Document include) { - this.document = include; - this.encoding = other.encoding; - this.stack = new Stack(); - this.state = CONDITION_NONE; - this.options = other.options; - this.documentPath = other.documentPath; - this.resolver = other.resolver; - this.defines = other.defines; - } - - // Main entry point - private boolean preprocess() throws PreprocessorException { - this.stack.clear(); - - this.state = CONDITION_NONE; - - // optimization - eliminates a full document copy and a full document - // equality test for files with no preprocessor - // directives - if (!this.document.contains(Line.DIRECTIVE_PREFIX)) { - return false; - } - - Document originalDocument = new Document(this.document); - - preprocessImpl(); - - if (this.state != CONDITION_NONE) { - throw new PreprocessorException("Missing final #endif"); // NOI18N - } - - if (Option.isFilter(options)) { - // Cleanup all directives. - - for (int i = this.document.size() - 1; i >= 0; i--) { - Line line = resolveLine(this.document.getSourceLine(i)); - - if (!line.isType(LineType.VISIBLE)) { - this.document.deleteSourceLine(i); - } - } - } - - return (!this.document.contentEquals(originalDocument)); - } - - private void preprocessImpl() throws PreprocessorException { - int includeCount = 0; - int lineCount = 0; - - while (lineCount < this.document.size()) { - - try { - Line line = resolveLine(this.document.getSourceLine(lineCount)); - - switch (line.getType()) { - case LineType.INCLUDE: { - lineCount = processInclude(lineCount, line); - - break; - } - case LineType.VISIBLE: - case LineType.HIDDEN: { - this.document.setSourceLine(lineCount, - toSourceLine(line)); - - if (Option.isVerbose(options)) { - log((isHidingLines() ? "Commented: " - : "Uncommented: ") + line); - } - - lineCount++; - - break; - } - default: { - processDirective(line); - - lineCount++; - } - } - } catch (PreprocessorException ex) { - throw new PreprocessorException(ex.getMessage() + " at line " - + (lineCount + 1) - + " in \"" - + this.documentPath - + "\""); // NOI18N - } - } - } - - // -------------------------- Line-level Handlers -------------------------- - private void processIf(boolean condition) { - statePush(); - - this.state = isHidingLines() ? CONDITION_TRIGGERED - : (condition) ? CONDITION_IN_TRUE - : CONDITION_ARMED; - } - - private void processElseIf(boolean condition) throws PreprocessorException { - switch (state) { - case CONDITION_NONE: { - throw new PreprocessorException("Unexpected #elif"); // NOI18N - } - case CONDITION_ARMED: { - if (condition) { - this.state = CONDITION_IN_TRUE; - } - - break; - } - case CONDITION_IN_TRUE: { - this.state = CONDITION_TRIGGERED; - - break; - } - } - } - - private void processElse() throws PreprocessorException { - switch (state) { - case CONDITION_NONE: { - throw new PreprocessorException("Unexpected #else"); // NOI18N - } - case CONDITION_ARMED: { - this.state = CONDITION_IN_TRUE; - - break; - } - case CONDITION_IN_TRUE: { - this.state = CONDITION_TRIGGERED; - - break; - } - } - } - - private void processEndIf() throws PreprocessorException { - if (state == CONDITION_NONE) { - throw new PreprocessorException("Unexpected #endif"); // NOI18N - } else { - statePop(); - } - } - - private void processDirective(Line line) throws PreprocessorException { - switch (line.getType()) { - case LineType.DEFINE: { - if (!isHidingLines()) { - this.defines.defineSingle(line.getArguments()); - } - - break; - } - case LineType.UNDEFINE: { - if (!isHidingLines()) { - this.defines.undefine(line.getArguments()); - } - - break; - } - case LineType.IF: { - processIf(this.defines.evaluate(line.getArguments())); - - break; - } - case LineType.IFDEF: { - processIf(this.defines.isDefined(line.getArguments())); - - break; - } - case LineType.IFNDEF: { - processIf(!this.defines.isDefined(line.getArguments())); - - break; - } - case LineType.ELIF: { - processElseIf(this.defines.evaluate(line.getArguments())); - - break; - } - case LineType.ELIFDEF: { - processElseIf(this.defines.isDefined(line.getArguments())); - - break; - } - case LineType.ELIFNDEF: { - processElseIf(!this.defines.isDefined(line.getArguments())); - - break; - } - case LineType.ELSE: { - processElse(); - - break; - } - case LineType.ENDIF: { - processEndIf(); - - break; - } - default: { - throw new PreprocessorException("Unhandled line type: " - + line); // NOI18N - } - } - } - - private int processInclude(int lineCount, Line line) - throws PreprocessorException { - String path = resolvePath(line.getArguments()); - boolean hidden = isHidingLines(); - - lineCount++; - - while (lineCount < this.document.size()) { - line = resolveLine(this.document.getSourceLine(lineCount)); - - if (line.isType(LineType.ENDINCLUDE)) { - break; - } - - this.document.deleteSourceLine(lineCount); - } - - if (!line.isType(LineType.ENDINCLUDE)) { - throw new PreprocessorException("Missing #endinclude"); // NOI18N - } - - if (!hidden) { - Document include = loadInclude(path); - Preprocessor preprocessor = new Preprocessor(this, include); - - preprocessor.preprocess(); - - int count = include.size(); - - for (int i = 0; i < count; i++) { - String sourceLine = include.getSourceLine(i); - - if (resolveLine(sourceLine).isType(LineType.VISIBLE)) { - this.document.insertSourceLine(lineCount++, sourceLine); - } - } - } - - lineCount++; - - return lineCount; - } - - // -------------------------- Preprocessor State --------------------------- - private boolean isHidingLines() { - switch (state) { - case CONDITION_ARMED: - case CONDITION_TRIGGERED: { - return true; - } - default: { - return false; - } - } - } - - @SuppressWarnings("unchecked") - private void statePush() { - this.stack.push(STATES[this.state]); - } - - @SuppressWarnings("UnnecessaryUnboxing") - private void statePop() { - this.state = ((Integer) stack.pop()).intValue(); - } - - // ------------------------------ Resolution ------------------------------- - private Line resolveLine(String line) throws PreprocessorException { - return new Line(this.resolver.resolveProperties(line)); - } - - private String resolvePath(String path) { - if (path == null) { - throw new IllegalArgumentException("path: null"); - } - - if (Option.isVerbose(options)) { - log("resolve path: " + path); - } - - if (path.contains("${")) { - path = this.resolver.resolveProperties(path); - - if (Option.isVerbose(options)) { - log("resolved properties: " + path); - } - } - - - - File file = this.toCanonicalOrAbsoluteFile(path); - - if (Option.isVerbose(options)) { - log("resolved file: " + file.getAbsolutePath()); - } - - try { - path = file.getCanonicalPath(); - } catch (IOException ex) { - path = file.getAbsolutePath(); - } - - if (Option.isVerbose(options)) { - log("resolved path: " + path); - } - - return path; - } - - // ------------------------------ Conversion ------------------------------- - private String toSourceLine(final Line line) { - final String indent = line.getIndent(); - final String text = line.getText(); - return (isHidingLines()) - ? Option.isIndent(this.options) - ? indent + Line.HIDE_DIRECTIVE + text - : Line.HIDE_DIRECTIVE + indent + text - : indent + text; - } - - private File toCanonicalOrAbsoluteFile(String path) { - File file = new File(path); - - if (!file.isAbsolute()) { - File parent = (new File(this.documentPath)).getParentFile(); - - file = new File(parent, path); - } - - try { - return file.getCanonicalFile(); - } catch (IOException e) { - return file.getAbsoluteFile(); - } - } - - // ------------------------------ Translation ------------------------------ - private static String translatePath(File dir, String fileName, String ext) { - return new StringBuffer(dir.getPath()).append(File.separatorChar). - append(translateFileExtension(fileName, ext)).toString(); - } - - private static String translateFileExtension(String fileName, String ext) { - if (ext != null) { - - int pos = fileName.lastIndexOf('.'); - - fileName = (pos < 0) ? fileName + ext - : fileName.substring(0, pos) + ext; - } - - return fileName; - } - - // ---------------------------------- I/O ---------------------------------- - private Document loadInclude(String path) throws PreprocessorException { - Document include = new Document(); - File file = toCanonicalOrAbsoluteFile(path); - - try { - return include.load(file, this.encoding); - } catch (UnsupportedEncodingException uee) { - throw new PreprocessorException("Unsupported encoding \"" - + this.encoding + "\" loading include \"" + file - + "\""); // NOI18N - } catch (IOException ioe) { - throw new PreprocessorException("Unable to load include \"" - + file + "\": " + ioe); // NOI18N - } - } - - private void loadDocument() throws PreprocessorException { - try { - this.document.load(this.documentPath, this.encoding); - } catch (UnsupportedEncodingException uee) { - throw new PreprocessorException("Unsupported encoding \"" - + this.encoding + "\" reading file \"" + this.documentPath - + "\""); // NOI18N - } catch (IOException ioe) { - throw new PreprocessorException("Unable to read file \"" - + this.documentPath + "\": " + ioe); // NOI18N - } - } - - private void saveDocument(Object target) throws PreprocessorException { - try { - if (this.document.size() > 0) { - this.document.save(target, this.encoding); - } - } catch (UnsupportedEncodingException uee) { - throw new PreprocessorException("Unsupported encoding \"" - + this.encoding + "\" writing \"" + target - + "\""); // NOI18N - } catch (IOException ioe) { - throw new PreprocessorException("Unable to write to \"" - + target + "\": " + ioe); // NOI18N - } - } - - private static void log(Object toLog) { - System.out.println(toLog); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/PreprocessorException.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/PreprocessorException.java deleted file mode 100644 index cc696456..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/PreprocessorException.java +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2001-2007, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -/* $Id: PreprocessorException.java 6434 2022-03-06 09:02:19Z campbell-burnet $ */ - -/** - * Thrown when preprocessing fails. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.8.1 - * @since 1.8.1 - */ -@SuppressWarnings("serial") -public class PreprocessorException extends Exception { - public PreprocessorException(String message) { - super(message); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Token.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Token.java deleted file mode 100644 index 9517c7a7..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Token.java +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (c) 2001-2007, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -/* $Id: Token.java 6434 2022-03-06 09:02:19Z campbell-burnet $ */ - -/** - * Static methods and constants to decode Preprocessor directive tokens. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.8.1 - * @since 1.8.1 - */ -public final class Token { - - public static final int EOI = -1; - public static final int UNKNOWN = 0; - public static final int IDENT = 1; - public static final int NUMBER = 2; - public static final int STRING = 3; - public static final int AND = '&'; - public static final int OR = '|'; - public static final int XOR = '^'; - public static final int NOT = '!'; - public static final int GT = '>'; - public static final int GTE = '>' + '='; - public static final int LT = '<'; - public static final int LTE = '<' + '='; - public static final int ASSIGN = '='; - public static final int EQ = '=' + '='; - public static final int LPAREN = '('; - public static final int RPAREN = ')'; - - public static boolean isAssignmentOperator(final int type) { - return (type == ASSIGN); - } - - public static boolean isComparisonOperator(final int type) { - switch(type) { - case EQ : - case LT : - case GT : - case LTE : - case GTE : { - return true; - } - default : { - return false; - } - } - } - - public static boolean isLogicalOperator(final int type) { - switch(type) { - case AND : - case OR : - case XOR : - case NOT : { - return true; - } - default : { - return false; - } - } - } - - public static boolean isValue(final int type) { - switch (type) { - case IDENT : - case STRING : - case NUMBER : { - return true; - } - default : { - return false; - } - } - } - - private Token() { - throw new AssertionError("Pure Utility Class"); - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/Tokenizer.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/Tokenizer.java deleted file mode 100644 index fd28b618..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/Tokenizer.java +++ /dev/null @@ -1,239 +0,0 @@ -/* Copyright (c) 2001-2022, The HSQL Development Group - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the HSQL Development Group nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -package org.hsqldb.util.preprocessor; - -/* $Id: Tokenizer.java 6480 2022-04-12 09:46:56Z fredt $ */ - -/** - * Simple Preprocessor directive tokenizer. - * - * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) - * @version 1.8.1 - * @since 2.7.0 - */ -@SuppressWarnings("ClassWithoutLogger") -public class Tokenizer { - private final String command; - private final int commandLength; - private int tokenType; - private int startIndex; - private int currentIndex; - - public Tokenizer(final String cmd) { - this.command = cmd == null || cmd.isEmpty() ? "" : cmd + " "; - this.commandLength = command.length(); - this.startIndex = 0; - this.currentIndex = 0; - this.tokenType = Token.UNKNOWN; - } - - void skipBlanks() { - final String cmd = this.command; - final int len = this.commandLength; - int pos = this.currentIndex; - while(pos < len && " \t".indexOf(cmd.charAt(pos)) != -1) { - pos++; - } - this.currentIndex = pos; - } - - public int next() throws PreprocessorException { - skipBlanks(); - - startIndex = currentIndex; - - final String cmd = this.command; - final int len = this.commandLength; - - if (currentIndex >= len) { - tokenType = Token.EOI; - - return tokenType; - } - - char ch = cmd.charAt(currentIndex); - - if (Character.isJavaIdentifierStart(ch)) { - tokenType = Token.IDENT; - - currentIndex++; - - while (currentIndex < len && - Character.isJavaIdentifierPart(cmd.charAt(currentIndex))) { - currentIndex++; - } - - return tokenType; - } else if (Character.isDigit(ch)) { - tokenType = Token.NUMBER; - - currentIndex++; - - while(currentIndex < len && - Character.isDigit(cmd.charAt(currentIndex))) { - currentIndex++; - } - - if (currentIndex < len && cmd.charAt(currentIndex) == '.') { - currentIndex++; - } - - while(currentIndex < len && - Character.isDigit(cmd.charAt(currentIndex))) { - currentIndex++; - } - - return tokenType; - } else if (ch == '"') { - tokenType = Token.STRING; - - currentIndex++; - - int pos = cmd.indexOf('"', currentIndex); - - if (pos == -1) { - throw new PreprocessorException("Unclosed string literal: " + - cmd.substring(startIndex)); //NOI18N - } - - currentIndex = pos + 1; - - return tokenType; - } - - - switch(ch) { - case Token.LPAREN : - case Token.RPAREN : - case Token.XOR : - case Token.NOT : { - currentIndex++; - tokenType = ch; - return ch; - } - case Token.ASSIGN : { - currentIndex++; - - if(currentIndex < len && - cmd.charAt(currentIndex) == Token.ASSIGN) { - currentIndex++; - - tokenType = Token.EQ; - } else { - tokenType = Token.ASSIGN; - } - - return tokenType; - } - case Token.LT : { - currentIndex++; - - if (currentIndex < len && - cmd.charAt(currentIndex) == Token.ASSIGN) { - currentIndex++; - - tokenType = Token.LTE; - } else { - tokenType = Token.LT; - } - - return tokenType; - } - case Token.GT : { - currentIndex++; - - if (currentIndex < len && - cmd.charAt(currentIndex) == Token.ASSIGN) { - currentIndex++; - - tokenType = Token.GTE; - } else { - tokenType = Token.GT; - } - - return tokenType; - } - case Token.AND : - case Token.OR : { - currentIndex++; - - if (currentIndex < len && cmd.charAt(currentIndex) == ch) { - currentIndex++; - } - - tokenType = ch; - - return ch; - } - default : { - throw new PreprocessorException("Syntax error: " + - cmd.substring(currentIndex)); //NOI18N - } - } - } - - public int getTokenType() { - return tokenType; - } - - public boolean isToken(final int type) { - return (this.tokenType == type); - } - - public String getIdent() { - return isToken(Token.EOI) ? null - : this.command.substring(startIndex, currentIndex); - } - - public Number getNumber() { - return (isToken(Token.EOI)) ? null - : new Double(Double.parseDouble(this.command. - substring(startIndex, currentIndex))); - } - - public String getString() { - return isToken(Token.EOI) ? null - : this.command.substring(startIndex + 1, currentIndex - 1); - } - - public int getStartIndex() { - return this.startIndex; - } - - public int currentIndex() { - return this.currentIndex; - } - - public String getSource() { - return this.command; - } -} diff --git a/database/hsqldb/src/org/hsqldb/util/preprocessor/package-info.java b/database/hsqldb/src/org/hsqldb/util/preprocessor/package-info.java deleted file mode 100644 index fe39f3e5..00000000 --- a/database/hsqldb/src/org/hsqldb/util/preprocessor/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Provides a simple text document preprocessor.

    - * - * Aims specifically at transforming the HSQLDB code base to one of a small - * number of specific build targets, while keeping complexity and external - * dependencies to a minimum, yet providing an environment that is - * sufficiently powerful to solve most easily imaginable preprocessing - * scenarios. - * - */ -package org.hsqldb.util.preprocessor; diff --git a/database/hsqldb/src/org/hsqldb/util/problems.gif b/database/hsqldb/src/org/hsqldb/util/problems.gif deleted file mode 100644 index c9376aa5..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/problems.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/run_exc.gif b/database/hsqldb/src/org/hsqldb/util/run_exc.gif deleted file mode 100644 index 68e72e55..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/run_exc.gif and /dev/null differ diff --git a/database/hsqldb/src/org/hsqldb/util/run_exc_running.gif b/database/hsqldb/src/org/hsqldb/util/run_exc_running.gif deleted file mode 100644 index 087dd571..00000000 Binary files a/database/hsqldb/src/org/hsqldb/util/run_exc_running.gif and /dev/null differ diff --git a/database/hsqldb/testrun/hsqldb/TestSelf.txt b/database/hsqldb/testrun/hsqldb/TestSelf.txt deleted file mode 100644 index d687216e..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelf.txt +++ /dev/null @@ -1,1282 +0,0 @@ --- --- TestSelf.txt --- - --- TestSelf.txt is used by TestSelf.java to test the database --- --- Comment lines must start with -- and are ignored --- Lines starting with spaces belongs to last line --- Checked lines start with comments containing where is: --- c ResultSet expects a result with rows --- r ResultSet expected with result in first row/column --- u Update count expected --- e Exception must occur --- see TestUtil code for more details on tags --- -set database transaction control locks - --- demonstration of codes used -/*d* Some demo lines -/*c1*/select * from information_schema.tables limit 1 -/*r - PUBLIC*/select table_catalog from information_schema.tables limit 1 -/*e*/select ''' -/*d* Next section dumps one line of result -/*o*/select * from information_schema.tables limit 1 -/*C1*/select * from information_schema.tables limit 1 - --- Miscelaneous tests by fredt --- bug #897591 -/*rgood*/CALL CASEWHEN(CURTIME() BETWEEN CAST('00:00:00' AS TIME) AND CAST('23:59:59' AS TIME), 'good', 'bad') - --- Referential integrity with cascading delete --- identity column -create table main(id int identity,name varchar(10)) -create table ref(id int identity,idMain int, - foreign key(idMain)references main(id) on delete cascade) -create table ref2(id int identity,idMain int, - foreign key(idMain)references ref(id) on delete cascade) -/*u1*/ insert into main values(null,'test') -/*e*/ insert into ref values(null,2) -/*u1*/ insert into ref values(null,0) -/*u1*/ insert into main values(10,1) --- next main.id value should be 11 -/*u1*/ insert into main values(null,1) -/*u1*/ insert into ref values(null,11) -/*e*/ insert into ref values(null,12) -/*u1*/ insert into ref2 values(null,1) -/*u3*/ delete from main -/*c0*/ select * from main -/*c0*/ select * from ref -/*c0*/ select * from ref2 -/*u1*/ insert into main values(1,'test') -/*u1*/ insert into main values(2,'test2') -/*u1*/ insert into ref values(2,2) -/*e*/ update main set id=2-id -/*e*/ drop table main; -drop table ref2; -drop table ref; -drop table main - --- Data Definition -drop table T1 if exists -drop table T2 if exists -create table T1(Nr integer) -create table T2(Nr integer primary Key) -create table T3(Nr integer,dbl double,vc varchar(10),cc char(1)) -create table T4(nr integer,lvc longVarChar(100),dt date,tm time) -create table T5(dec decimal(10) primary key,b binary(1) not null) -create table "T6"("x" tinyint,s smallint not null,b bigint) -create table t7("-x's'-" real,f float(2),n numeric,t timestamp) -create table t8(bin binary,vb varbinary(10),lvb longvarbinary(100)) -create table t9(nr integer not null,x smallint not null primary key) -create unique index it1 on t1(nr) -script -create index it2 on t2(nr) -create index it3 on t3(nr,dbl,vc,cc) -create unique index it4 on t4(nr,lvc,tm) -drop index it4 -create unique index it4 on t4(nr,tm) -drop index it4 -create index it4 on t4(tm,nr) --- a duplicate index -create index it4b on t4(tm,nr) -create unique index it4c on t4(tm,nr) -drop index it4b -create index it9 on t9(nr,x); -drop table t1; -drop table t2; -drop table "T3"; -DROP TABLE T4; -Drop Table T5; -drop table T6 -drop table t7; -drop table t8; -drop table t9 -create user "test" password "test-p" -GRANT CHANGE_AUTHORIZATION TO "test" -create table test (id integer) -revoke all on test from "test" restrict -select * from test order by test.id -grant all on test to "test" -grant select on test to "test" -revoke select,insert,update,delete on test from "test" restrict -connect user "test" password "test-p" -set password "test-p2" -connect user sa password "" -connect user "test" password "test-p2" -connect user sa password "" -set autocommit false -insert into test values (1) -update test set id = 3 -rollback -insert into test values (2) -delete from test -rollback -commit -script -drop table test -drop user "test" -script -set autocommit true -create memory table test (id integer) -drop table test --- still supporting noise word "null" after type definition -create cached table test (id integer null) -drop table test --- Data Manipulation without result -create table addresses(nr integer,name varchar(16),placezip smallint) -insert into addresses values(1,'Boss',3000) -insert into addresses (nr,name,placezip) values(2,'Walt',8000) -insert into addresses values(-3,'',0) -insert into addresses select * from addresses where nr>0 -update addresses set nr=4 where nr=-2 -insert into addresses values(3,'x',3000) -insert into addresses (name,nr,placezip) values('y',4,8000) -insert into addresses (name,nr,placezip) - select name,placezip,nr from addresses where name like 'x%' -delete from addresses where name like 'x%' -update addresses set name='Rene' where nr=4 -update addresses set nr=5, name='What' where nr=1 and name='Boss' -create table place(zip smallint,name longvarchar(100),country char(4)) -insert into place values(3000,'Langenthal\t1','CH') -insert into place values(0,'\\\\Heaven',null) -insert into place values(8000,'Zrich','CH') -insert into place values(-1,'NULL','null') -create table invoices(addressnr integer,total decimal) -insert into invoices values(4,1003834.05) -insert into invoices values(2,-4987770.01) -insert into invoices select * from invoices where not total>=0. -update invoices set total=10 where total < 0 -insert into invoices values(2,10) -set schema INFORMATION_SCHEMA -select * from system_tables -select * from SYSTEM_SESSIONINFO -set schema PUBLIC -create table t_double(id integer,d double,f double) -insert into t_double values(1,1.2,1.4) -insert into t_double values(2,1.4,1.0) -create table t_date (id integer,d date,t time,ts timestamp ) -insert into t_DATE values(0,{d '1999-08-21'},'18:53:00',null) -insert into t_date values(1,'1999-08-22','17:00:01','2000-02-29 10:00:00') -create table t_bit (b1 boolean,b2 boolean) -insert into t_bit values(false,false) -insert into t_bit select b2,b1 from t_bit -insert into t_bit values(true,false) -insert into t_bit values(true,true) -create table Problem(Nr bigint,ClassNr bigint,StateNr bigint,Name varchar(40)); -create table Class(Nr bigint, Name varchar(20), Node varchar(20)); -insert into Problem values(10, 1, 3, 'Problem 10; Class 1; State 3'); -insert into Problem values(20, 2, 2, 'Problem 20; Class 2; State 2'); -insert into Problem values(30, 3, 2, 'Problem 30; Class 3; State 2'); -insert into Class values(1, 'Class/State 1','Node A'); -insert into Class values(2, 'Class/State 2','Node B'); -insert into Class values(3, 'Class/State 3','Node C'); -CREATE CACHED TABLE HLO(NRO INTEGER,NIMI VARCHAR(10),PTMP INTEGER) -CREATE INDEX INRO ON HLO(NRO) -INSERT INTO HLO VALUES(1,'hlo 1',0) -INSERT INTO HLO VALUES(2,'hlo 2',0) -INSERT INTO HLO VALUES(3,'hlo 3',0) -INSERT INTO HLO VALUES(4,'hlo 4',0) -INSERT INTO HLO VALUES(5,'hlo 5',0) -insert into hlo values(10,'10',0); -delete from hlo where nro=10; -DROP TABLE HLO - --- Select with update count -/*c6*/ select * from addresses -/*c0*/ select * from addresses where nr in(-1) -/*c4*/ select * from place -/*c4*/ select * from invoices -/*c1*/ select nr from addresses where nr<0 -/*c0*/ select * from addresses where nr>=0 and nr<=0 -/*c1*/ select count(*) from addresses where nr=-99 -/*c0*/ select * from addresses where not name like '%' -/*c1*/ select * from addresses,place p where (nr=4) and p.zip=placezip -/*c1*/ select * from addresses,place p where (nr=4 or nr>3 and nr<2) and - p.zip=placezip or (p.zip>0 and p.zip<-1 or p.zip=-2) -/*c1*/select * from addresses a,place p,invoices i where - a.placezip=p.zip and a.nr=i.addressnr and i.addressnr=4 -/*c1*/ select p.zip,p.*,country from addresses a,place p,invoices i where - a.placezip=p.zip and a.nr=i.addressnr and i.addressnr=4 -/*c7*/ select * from addresses union all select * from addresses where nr=4 -/*c1*/ select max(place.zip) x from place -/*c0*/ select * from addresses where name like 'Wal_' escape 'l' -/*c2*/ select * from addresses where name like 'Wal_' escape '+' -/*c4*/ select total as x from invoices order by addressnr desc,total asc -/*c3*/ select place.* from place where not country = 'NULL' and - not name is null and not name is NULL and - not name = 'null' and not country = 'NULL' order by zip -/*c3*/ select * from addresses where nr in (1,5,99,5,4) -/*c1*/ select * from (select * from addresses) as addresses where nr=4 --- from 1.7.2, next result no longer returns null == null -/*c5*/ select p1.country from place p1,place p2 where p1.country=p2.country -/*c1*/ select * from t_double where id>-10 and d>1.3 and d>.3 -/*c2*/ select * from t_double where d>-20 or f<10.2 -/*c2*/ select d,t,d from t_date where d>'1900-08-21'; -/*e*/ select d,*,d from t_date where ts>'2000-01-01 00:00:00' -/*e*/ select t_date.*,* from t_date where t<='01:00:00' -/*c2*/ select * from t_bit where b1<=false or b2>true -/*c2*/ select * from t_bit where not(b1<=false or b2>true) -/*c2*/ select P.*, C.Name ClassName from Problem P,Class C - where P.Nr in(10,20) and P.ClassNr=C.Nr -/*c1*/ select P.*, S.Name StateName, S.Node StateNode, - C.Name ClassName, C.Node ClassNode from Problem P, Class S, Class C - where P.Nr = 10 and P.ClassNr = C.Nr and P.StateNr = S.Nr - --- ResultSet with value -/*u0*/ create table empty(c char); - -/*u0*/ create table test(nr integer,name char(5)); -/*r0*/ select count(*) from test; -/*u1*/ insert into test values(1,null); -/*r1*/ select nr from test group by nr; -update test set nr=2; -/*r2*/ select avg(nr) from test -update test set nr=1+1*2; -/*r3*/ select sum(nr) from test -update test set nr=-(select max(t2.nr) from test t2); -/*r-3*/ select nr from test -update test set nr=2*(1- -1); -/*r4*/ select nr from test -/*r4*/ select sum(nr) from test where nr in(select t2.nr from test t2) -/*e*/ update test set nr=1/0 -update test set nr=null; -/*rNULL*/ select nr from test -update test set nr=null; -/*rNULL*/ select nr from test -update test set nr=4/2; -/*r2*/ select "TEST"."NR" from test -update test set name='3' || '4'; -/*r34 */ select distinct name from test -/*rHo*/ select 'Ho' as hhoo from TEsT where name in ('34','y','z') -update test set name=null; -/*rNULL*/select name from "TEST" --- case sensitivity tests -create table "t6"("x" char(6),s smallint not null,b bigint, c binary); -/*r0*/ select count(*) from "t6" -/*u1*/ insert into "t6" values('CaseS',100, 1000000000000, null); -/*rCaseS */ select "x" from "t6" -/*u1*/ delete from "t6" -/*u1*/ insert into "t6" values(null,100, 1000000000000, null); -/*u1*/ delete from "t6" --- Finish -drop table addresses -drop table place -drop table invoices -drop table t_double; -drop table t_date -drop table t_bit -drop table problem; -drop table class - --- Other tests -CREATE TABLE Address(ID INTEGER PRIMARY KEY,organization VARCHAR(20), - address1 VARCHAR(20),address2 VARCHAR(20),address3 VARCHAR(20),city VARCHAR(20), - state VARCHAR(20),zipCode VARCHAR(20),countryID INTEGER,phone VARCHAR(20), - phoneExtension VARCHAR(20),fax VARCHAR(20),eMail VARCHAR(20)) -CREATE TABLE Country(ID INTEGER PRIMARY KEY,name VARCHAR(20)) -INSERT INTO COUNTRY(ID, name) VALUES(23, 'USA') -/*u1*/INSERT INTO ADDRESS(ID, countryID) VALUES(5, - (SELECT ID FROM Country WHERE name = 'USA')) -SELECT * FROM ADDRESS INNER JOIN COUNTRY ON CountryID = COUNTRY.ID -SELECT * FROM ADDRESS LEFT JOIN COUNTRY ON CountryID = COUNTRY.ID -INSERT INTO ADDRESS(ID) VALUES(6) -/*c1*/SELECT * FROM ADDRESS ad INNER JOIN COUNTRY ON ad.CountryID = COUNTRY.ID -/*c2*/SELECT * FROM ADDRESS LEFT JOIN COUNTRY ON CountryID = COUNTRY.ID -SELECT * FROM Address,Country - WHERE Address.countryID=Country.ID AND - EXISTS (SELECT C.Name FROM Country AS C WHERE C.ID=Country.ID) AND - EXISTS (SELECT * FROM Country AS C WHERE C.ID=Address.countryID) - - --- retain metadata -CREATE TABLE META_TEST( ID numeric(10), GEOX decimal(10,2), BLURB VARCHAR(50)); - - --- ignorecase tests -create table test_ic(name varchar_ignorecase(20)) -insert into test_ic values('Hello') -insert into test_ic values('World') -/*c0*/select * from test_ic where name like 'HALLO' -/*c1*/select * from test_ic where name like 'HELLO' -/*c1*/select * from test_ic where 'HELLO' like name -/*c1*/select * from test_ic where name = 'world' -drop table test_ic - --- test maxrows -create table test_maxrows(id int) -insert into test_maxrows values(0); -insert into test_maxrows select id+1 from test_maxrows; -insert into test_maxrows select id+2 from test_maxrows; -insert into test_maxrows select id+4 from test_maxrows; -/*r - 4 - 3 - 2 - 1 -*/select id from test_maxrows order by id desc limit 4 offset 3 -/*r - 4 - 3 - 2 - 1 -*/select id from test_maxrows order by id desc offset 3 fetch 4 rows only -/*r - 4 - 3 -*/select id from test_maxrows order by id desc limit 2 offset 3 -set maxrows 3 -/*c3*/select * from test_maxrows -set maxrows 3 -/*c3*/select id from test_maxrows order by id desc -set maxrows 3 -/*r - 7 - 6 - 5 -*/select id from test_maxrows order by id desc -set maxrows 3 -/*r - 4 - 3 - 2 -*/select id from test_maxrows order by id desc limit 4 offset 3 -set maxrows 3 -/*r - 4 - 3 -*/select id from test_maxrows order by id desc limit 2 offset 3 -set maxrows 3 -/*r8*/select count(*) from test_maxrows -set maxrows 3 -/*r7*/select max(id) from test_maxrows -set maxrows 3 -/*c0*/select id from test_maxrows except select id from test_maxrows -set maxrows 3 -/*c3*/select id from test_maxrows group by id -set maxrows 0 -/*c8*/select * from test_maxrows -drop table test_maxrows - --- test functions -CREATE TABLE Products(ID INTEGER PRIMARY KEY,Name VARCHAR(255),Cost DECIMAL(10,4)) -insert into products values (0,'Test',10.3444) -/*r10.34*/select round(cost,2) from products -/*r10.3444*/select cost from products -drop table products - --- IN (subquery) -create table A ( C1 VARCHAR(10)) -create table B ( C1 VARCHAR(10)) -insert into A (C1) values ('one') -insert into A (C1) values ('two') -insert into B (C1) values ('one') -/*c1*/ select * from B where C1 in (select C1 from A) -drop table A -drop table B - --- simple transactional tests -CREATE TABLE PRODUCTS(ID INTEGER PRIMARY KEY,NAME VARCHAR(20),COST DECIMAL(10,4)) -INSERT INTO PRODUCTS VALUES(0,'Iron',5.4) -INSERT INTO PRODUCTS VALUES(1,'Wood',24.8) -INSERT INTO PRODUCTS VALUES(2,'Fire',24.8) -SET AUTOCOMMIT FALSE -INSERT INTO PRODUCTS VALUES(3,'ERR1',0.0) -INSERT INTO PRODUCTS VALUES(4,'ERR1',0.0) -DELETE FROM PRODUCTS WHERE ID=2 -UPDATE PRODUCTS SET NAME='ERR2' WHERE NAME<>'ERR1' -/*c2*/ SELECT * FROM PRODUCTS WHERE NAME='ERR1' -/*c2*/ SELECT * FROM PRODUCTS WHERE NAME='ERR2' -/*c4*/ SELECT * FROM PRODUCTS -ROLLBACK -/*c0*/ SELECT * FROM PRODUCTS WHERE NAME='ERR1' -/*c0*/ SELECT * FROM PRODUCTS WHERE NAME='ERR2' -/*c3*/ SELECT * FROM PRODUCTS -SET AUTOCOMMIT TRUE -DROP TABLE PRODUCTS - - - - --- Exceptions -/*e*/ + -/*e*/ select nr from addresses union select nr,nr from addresses -/*e*/ create something -/*e*/ create index x on addresses (nr + -/*e*/ create table p2 (id integer primary key, id2 integer primary key) -/*e*/ create table p3 (id integer primary key + 2) -/*e*/ drop index x -/*e*/ drop all -/*e*/ create table test(nr integer); insert into test values (10 and) -/*e*/ select oh from test -/*e*/ create table test(nr integer) -/*e*/ create user 'test' password 'test';connect user 'test' password 'test'; - select * from test; -/*e*/ connect user 'sa' password ''; drop user 'test'; drop it now -/*e*/ insert into test values(1);insert into test rows -/*e*/ create unique index i1 on test(id);select * from (oh what) -/*e*/ insert into test values(2); update test set id=1; -/*e*/ select * from test where id in (1 (2) 3) -/*e*/ select o.* from test -/*e*/ select * from test where id like '0' escape 'maybe' -/*e*/ insert into test (nr and so on) values (1) -/*e*/ insert into test values (select * from test union select * from test) -/*e*/ update test set nr=1+(3+5 'x' -/*e*/ update test set nr=1.....3 -/*e*/ select *.* from test -/*e*/ select * from test where id>2 and (id>3; -/*e*/ select * from test order it -/*e*/ creat unique index 1 -/*e*/ select id from test where yes>2; -/*e*/ select id from test where id has 5 -/*e*/ grant access -/*e*/ connect user or maybe not -/*e*/ set parameter -/*e*/ set autocommit and -/*e*/ select column as column plus -/*e*/ select * from hm -/*e*/ grant all about it -/*e*/ create table wrong(id usertype) -/*e*/ select #strange# -/*e*/ create table mem(i int)drop table mem", - --- ResultSet with sizes -drop table test; -create table test(nr integer,name char(5), other varchar(10)); -/*r0*/ select count(*) from test; -insert into test values(1,null,null); -/*r1*/ select nr from test group by nr; -/*e*/ insert into test values(2,'1234567',''); -/*u1*/ insert into test values(2,'12345',''); -/*r12345*/ select name from test where nr=2; -insert into test values(3,'123',''); -/*r123 */ select name from test where nr=3; -insert into test values(4,'','12345'); -/*r12345*/ select other from test where nr=4; -insert into test values(5,'','123'); -/*r123*/ select other from test where nr=5; -drop table test; - -DROP TABLE ITEM IF EXISTS -DROP TABLE CUSTOMER IF EXISTS -DROP TABLE PRODUCT IF EXISTS -DROP TABLE ADDRESS IF EXISTS -CREATE TABLE CUSTOMER(ID INTEGER PRIMARY KEY,FIRSTNAME VARCHAR(255), - LASTNAME VARCHAR(255),STREET VARCHAR(255),CITY VARCHAR(255)) -CREATE TABLE PRODUCT(ID INTEGER PRIMARY KEY,NAME VARCHAR(255),COST DECIMAL) -CREATE TABLE INVOICE(ID INTEGER PRIMARY KEY, CUSTOMERID INTEGER,TOTAL DECIMAL) -CREATE TABLE ITEM(INVOICEID INTEGER,POS INTEGER,PRODUCTID INTEGER, - QUANTITY INTEGER,PRICE DECIMAL, - CONSTRAINT SYSTEM_PK PRIMARY KEY(INVOICEID,POS)) -INSERT INTO CUSTOMER VALUES(0,'Laura','Steel','429 Seventh Av.','Dallas') -INSERT INTO CUSTOMER VALUES(1,'Susanne','King','366 - 20th Ave.','Olten') -INSERT INTO CUSTOMER VALUES(2,'Anne','Miller','20 Upland Pl.','Lyon') -INSERT INTO CUSTOMER VALUES(3,'Michael','Clancy','542 Upland Pl.','San Francisco') -INSERT INTO CUSTOMER VALUES(4,'Sylvia','Ringer','365 College Av.','Dallas') -INSERT INTO CUSTOMER VALUES(5,'Laura','Miller','294 Seventh Av.','Paris') -INSERT INTO CUSTOMER VALUES(6,'Laura','White','506 Upland Pl.','Palo Alto') -INSERT INTO CUSTOMER VALUES(7,'James','Peterson','231 Upland Pl.','San Francisco') -INSERT INTO CUSTOMER VALUES(8,'Andrew','Miller','288 - 20th Ave.','Seattle') -INSERT INTO CUSTOMER VALUES(9,'James','Schneider','277 Seventh Av.','Berne') -INSERT INTO CUSTOMER VALUES(10,'Anne','Fuller','135 Upland Pl.','Dallas') -INSERT INTO CUSTOMER VALUES(11,'Julia','White','412 Upland Pl.','Chicago') -INSERT INTO CUSTOMER VALUES(12,'George','Ott','381 Upland Pl.','Palo Alto') -INSERT INTO CUSTOMER VALUES(13,'Laura','Ringer','38 College Av.','New York') -INSERT INTO CUSTOMER VALUES(14,'Bill','Karsen','53 College Av.','Oslo') -INSERT INTO CUSTOMER VALUES(15,'Bill','Clancy','319 Upland Pl.','Seattle') -INSERT INTO CUSTOMER VALUES(16,'John','Fuller','195 Seventh Av.','New York') -INSERT INTO CUSTOMER VALUES(17,'Laura','Ott','443 Seventh Av.','Lyon') -INSERT INTO CUSTOMER VALUES(18,'Sylvia','Fuller','158 - 20th Ave.','Paris') -INSERT INTO CUSTOMER VALUES(19,'Susanne','Heiniger','86 - 20th Ave.','Dallas') -INSERT INTO CUSTOMER VALUES(20,'Janet','Schneider','309 - 20th Ave.','Oslo') -INSERT INTO CUSTOMER VALUES(21,'Julia','Clancy','18 Seventh Av.','Seattle') -INSERT INTO CUSTOMER VALUES(22,'Bill','Ott','250 - 20th Ave.','Berne') -INSERT INTO CUSTOMER VALUES(23,'Julia','Heiniger','358 College Av.','Boston') -INSERT INTO CUSTOMER VALUES(24,'James','Sommer','333 Upland Pl.','Olten') -INSERT INTO CUSTOMER VALUES(25,'Sylvia','Steel','269 College Av.','Paris') -INSERT INTO CUSTOMER VALUES(26,'James','Clancy','195 Upland Pl.','Oslo') -INSERT INTO CUSTOMER VALUES(27,'Bob','Sommer','509 College Av.','Seattle') -INSERT INTO CUSTOMER VALUES(28,'Susanne','White','74 - 20th Ave.','Lyon') -INSERT INTO CUSTOMER VALUES(29,'Andrew','Smith','254 College Av.','New York') -INSERT INTO CUSTOMER VALUES(30,'Bill','Sommer','362 - 20th Ave.','Olten') -INSERT INTO CUSTOMER VALUES(31,'Bob','Ringer','371 College Av.','Olten') -INSERT INTO CUSTOMER VALUES(32,'Michael','Ott','339 College Av.','Boston') -INSERT INTO CUSTOMER VALUES(33,'Mary','King','491 College Av.','Oslo') -INSERT INTO CUSTOMER VALUES(34,'Julia','May','33 Upland Pl.','Seattle') -INSERT INTO CUSTOMER VALUES(35,'George','Karsen','412 College Av.','Chicago') -INSERT INTO CUSTOMER VALUES(36,'John','Steel','276 Upland Pl.','Dallas') -INSERT INTO CUSTOMER VALUES(37,'Michael','Clancy','19 Seventh Av.','Dallas') -INSERT INTO CUSTOMER VALUES(38,'Andrew','Heiniger','347 College Av.','Lyon') -INSERT INTO CUSTOMER VALUES(39,'Mary','Karsen','202 College Av.','Chicago') -INSERT INTO CUSTOMER VALUES(40,'Susanne','Miller','440 - 20th Ave.','Dallas') -INSERT INTO CUSTOMER VALUES(41,'Bill','King','546 College Av.','New York') -INSERT INTO CUSTOMER VALUES(42,'Robert','Ott','503 Seventh Av.','Oslo') -INSERT INTO CUSTOMER VALUES(43,'Susanne','Smith','2 Upland Pl.','Dallas') -INSERT INTO CUSTOMER VALUES(44,'Sylvia','Ott','361 College Av.','New York') -INSERT INTO CUSTOMER VALUES(45,'Janet','May','396 Seventh Av.','Oslo') -INSERT INTO CUSTOMER VALUES(46,'Andrew','May','172 Seventh Av.','New York') -INSERT INTO CUSTOMER VALUES(47,'Janet','Fuller','445 Upland Pl.','Dallas') -INSERT INTO CUSTOMER VALUES(48,'Robert','White','549 Seventh Av.','San Francisco') -INSERT INTO CUSTOMER VALUES(49,'George','Fuller','534 - 20th Ave.','Olten') -INSERT INTO PRODUCT VALUES(0,'Iron Iron',5.4) -INSERT INTO PRODUCT VALUES(1,'Chair Shoe',24.8) -INSERT INTO PRODUCT VALUES(2,'Telephone Clock',24.8) -INSERT INTO PRODUCT VALUES(3,'Chair Chair',25.4) -INSERT INTO PRODUCT VALUES(4,'Ice Tea Shoe',12.8) -INSERT INTO PRODUCT VALUES(5,'Clock Clock',23.6) -INSERT INTO PRODUCT VALUES(6,'Ice Tea Chair',9.8) -INSERT INTO PRODUCT VALUES(7,'Telephone Shoe',8.4) -INSERT INTO PRODUCT VALUES(8,'Ice Tea Clock',22.6) -INSERT INTO PRODUCT VALUES(9,'Clock Telephone',17.2) -INSERT INTO PRODUCT VALUES(10,'Telephone Ice Tea',20.4) -INSERT INTO PRODUCT VALUES(11,'Telephone Iron',8.8) -INSERT INTO PRODUCT VALUES(12,'Clock Ice Tea',16.8) -INSERT INTO PRODUCT VALUES(13,'Telephone Clock',18.0) -INSERT INTO PRODUCT VALUES(14,'Telephone Iron',12.4) -INSERT INTO PRODUCT VALUES(15,'Ice Tea Chair',9.4) -INSERT INTO PRODUCT VALUES(16,'Ice Tea Shoe',19.4) -INSERT INTO PRODUCT VALUES(17,'Clock Ice Tea',22.0) -INSERT INTO PRODUCT VALUES(18,'Chair Clock',17.2) -INSERT INTO PRODUCT VALUES(19,'Ice Tea Ice Tea',11.0) -INSERT INTO PRODUCT VALUES(20,'Ice Tea Telephone',20.0) -INSERT INTO PRODUCT VALUES(21,'Chair Chair',11.4) -INSERT INTO PRODUCT VALUES(22,'Iron Iron',6.6) -INSERT INTO PRODUCT VALUES(23,'Shoe Chair',7.6) -INSERT INTO PRODUCT VALUES(24,'Chair Shoe',7.2) -INSERT INTO PRODUCT VALUES(25,'Shoe Shoe',16.2) -INSERT INTO PRODUCT VALUES(26,'Shoe Shoe',25.2) -INSERT INTO PRODUCT VALUES(27,'Telephone Iron',23.0) -INSERT INTO PRODUCT VALUES(28,'Clock Iron',3.0) -INSERT INTO PRODUCT VALUES(29,'Chair Telephone',11.2) -INSERT INTO PRODUCT VALUES(30,'Shoe Iron',23.2) -INSERT INTO PRODUCT VALUES(31,'Ice Tea Telephone',4.8) -INSERT INTO PRODUCT VALUES(32,'Clock Iron',19.0) -INSERT INTO PRODUCT VALUES(33,'Iron Chair',18.2) -INSERT INTO PRODUCT VALUES(34,'Chair Iron',25.6) -INSERT INTO PRODUCT VALUES(35,'Telephone Shoe',7.6) -INSERT INTO PRODUCT VALUES(36,'Ice Tea Iron',3.2) -INSERT INTO PRODUCT VALUES(37,'Clock Shoe',9.4) -INSERT INTO PRODUCT VALUES(38,'Clock Ice Tea',21.6) -INSERT INTO PRODUCT VALUES(39,'Ice Tea Shoe',15.4) -INSERT INTO PRODUCT VALUES(40,'Shoe Clock',2.8) -INSERT INTO PRODUCT VALUES(41,'Clock Ice Tea',20.6) -INSERT INTO PRODUCT VALUES(42,'Iron Chair',19.8) -INSERT INTO PRODUCT VALUES(43,'Telephone Clock',9.4) -INSERT INTO PRODUCT VALUES(44,'Ice Tea Ice Tea',9.6) -INSERT INTO PRODUCT VALUES(45,'Iron Ice Tea',18.0) -INSERT INTO PRODUCT VALUES(46,'Ice Tea Clock',6.2) -INSERT INTO PRODUCT VALUES(47,'Ice Tea Iron',17.8) -INSERT INTO PRODUCT VALUES(48,'Clock Clock',21.0) -INSERT INTO PRODUCT VALUES(49,'Iron Iron',2.2) -INSERT INTO INVOICE VALUES(0,0,2607.60) -INSERT INTO INVOICE VALUES(1,33,1610.70) -INSERT INTO INVOICE VALUES(2,23,3789.00) -INSERT INTO INVOICE VALUES(3,21,5974.50) -INSERT INTO INVOICE VALUES(4,30,1953.00) -INSERT INTO INVOICE VALUES(5,34,4182.90) -INSERT INTO INVOICE VALUES(6,19,3340.20) -INSERT INTO INVOICE VALUES(7,26,5328.60) -INSERT INTO INVOICE VALUES(8,29,2675.10) -INSERT INTO INVOICE VALUES(9,38,6982.20) -INSERT INTO INVOICE VALUES(10,24,3274.50) -INSERT INTO INVOICE VALUES(11,24,2532.30) -INSERT INTO INVOICE VALUES(12,23,4578.30) -INSERT INTO INVOICE VALUES(13,39,7001.70) -INSERT INTO INVOICE VALUES(14,35,4940.40) -INSERT INTO INVOICE VALUES(15,39,1027.80) -INSERT INTO INVOICE VALUES(16,45,3657.30) -INSERT INTO INVOICE VALUES(17,46,3776.40) -INSERT INTO INVOICE VALUES(18,4,3772.80) -INSERT INTO INVOICE VALUES(19,9,804.30) -INSERT INTO INVOICE VALUES(20,19,3139.20) -INSERT INTO INVOICE VALUES(21,8,3740.10) -INSERT INTO INVOICE VALUES(22,40,2289.90) -INSERT INTO INVOICE VALUES(23,36,5166.60) -INSERT INTO INVOICE VALUES(24,15,4344.30) -INSERT INTO INVOICE VALUES(25,31,2054.10) -INSERT INTO INVOICE VALUES(26,27,4972.80) -INSERT INTO INVOICE VALUES(27,24,583.50) -INSERT INTO INVOICE VALUES(28,35,1664.40) -INSERT INTO INVOICE VALUES(29,46,2515.50) -INSERT INTO INVOICE VALUES(30,13,2117.40) -INSERT INTO INVOICE VALUES(31,22,2715.90) -INSERT INTO INVOICE VALUES(32,20,1098.60) -INSERT INTO INVOICE VALUES(33,40,4300.20) -INSERT INTO INVOICE VALUES(34,33,4290.60) -INSERT INTO INVOICE VALUES(35,4,3102.60) -INSERT INTO INVOICE VALUES(36,42,3200.10) -INSERT INTO INVOICE VALUES(37,39,7331.10) -INSERT INTO INVOICE VALUES(38,46,6373.80) -INSERT INTO INVOICE VALUES(39,5,1311.60) -INSERT INTO INVOICE VALUES(40,4,5288.40) -INSERT INTO INVOICE VALUES(41,19,5475.60) -INSERT INTO INVOICE VALUES(42,38,1436.40) -INSERT INTO INVOICE VALUES(43,13,4827.60) -INSERT INTO INVOICE VALUES(44,32,3388.20) -INSERT INTO INVOICE VALUES(45,42,4731.00) -INSERT INTO INVOICE VALUES(46,24,5827.20) -INSERT INTO INVOICE VALUES(47,45,2320.80) -INSERT INTO INVOICE VALUES(48,22,3494.70) -INSERT INTO INVOICE VALUES(49,32,4944.30) -INSERT INTO ITEM VALUES(0,0,7,12,12.60) -INSERT INTO ITEM VALUES(0,1,14,19,18.60) -INSERT INTO ITEM VALUES(0,2,47,3,26.70) -INSERT INTO ITEM VALUES(0,3,1,9,37.20) -INSERT INTO ITEM VALUES(0,4,47,1,26.70) -INSERT INTO ITEM VALUES(0,5,12,15,25.20) -INSERT INTO ITEM VALUES(0,6,16,9,29.10) -INSERT INTO ITEM VALUES(0,7,7,10,12.60) -INSERT INTO ITEM VALUES(0,8,0,23,8.10) -INSERT INTO ITEM VALUES(0,9,35,4,11.40) -INSERT INTO ITEM VALUES(0,10,4,8,19.20) -INSERT INTO ITEM VALUES(0,11,12,4,25.20) -INSERT INTO ITEM VALUES(0,12,1,11,37.20) -INSERT INTO ITEM VALUES(1,0,40,8,4.20) -INSERT INTO ITEM VALUES(1,1,0,9,8.10) -INSERT INTO ITEM VALUES(1,2,19,6,16.50) -INSERT INTO ITEM VALUES(1,3,38,8,32.40) -INSERT INTO ITEM VALUES(1,4,16,16,29.10) -INSERT INTO ITEM VALUES(1,5,25,9,24.30) -INSERT INTO ITEM VALUES(1,6,25,19,24.30) -INSERT INTO ITEM VALUES(2,0,4,18,19.20) -INSERT INTO ITEM VALUES(2,1,25,3,24.30) -INSERT INTO ITEM VALUES(2,2,11,9,13.20) -INSERT INTO ITEM VALUES(2,3,19,13,16.50) -INSERT INTO ITEM VALUES(2,4,38,18,32.40) -INSERT INTO ITEM VALUES(2,5,30,4,34.80) -INSERT INTO ITEM VALUES(2,6,43,8,14.10) -INSERT INTO ITEM VALUES(2,7,30,5,34.80) -INSERT INTO ITEM VALUES(2,8,39,2,23.10) -INSERT INTO ITEM VALUES(2,9,18,7,25.80) -INSERT INTO ITEM VALUES(2,10,49,11,3.30) -INSERT INTO ITEM VALUES(2,11,42,21,29.70) -INSERT INTO ITEM VALUES(2,12,21,15,17.10) -INSERT INTO ITEM VALUES(2,13,12,1,25.20) -INSERT INTO ITEM VALUES(2,14,48,19,31.50) -INSERT INTO ITEM VALUES(2,15,0,18,8.10) -INSERT INTO ITEM VALUES(2,16,36,24,4.80) -INSERT INTO ITEM VALUES(3,0,11,21,13.20) -INSERT INTO ITEM VALUES(3,1,1,20,37.20) -INSERT INTO ITEM VALUES(3,2,49,3,3.30) -INSERT INTO ITEM VALUES(3,3,0,22,8.10) -INSERT INTO ITEM VALUES(3,4,20,12,30.00) -INSERT INTO ITEM VALUES(3,5,30,10,34.80) -INSERT INTO ITEM VALUES(3,6,13,18,27.00) -INSERT INTO ITEM VALUES(3,7,26,4,37.80) -INSERT INTO ITEM VALUES(3,8,49,9,3.30) -INSERT INTO ITEM VALUES(3,9,29,17,16.80) -INSERT INTO ITEM VALUES(3,10,10,17,30.60) -INSERT INTO ITEM VALUES(3,11,7,11,12.60) -INSERT INTO ITEM VALUES(3,12,41,22,30.90) -INSERT INTO ITEM VALUES(3,13,41,2,30.90) -INSERT INTO ITEM VALUES(3,14,17,22,33.00) -INSERT INTO ITEM VALUES(3,15,23,18,11.40) -INSERT INTO ITEM VALUES(3,16,19,11,16.50) -INSERT INTO ITEM VALUES(3,17,30,17,34.80) -INSERT INTO ITEM VALUES(4,0,28,9,4.50) -INSERT INTO ITEM VALUES(4,1,35,15,11.40) -INSERT INTO ITEM VALUES(4,2,41,23,30.90) -INSERT INTO ITEM VALUES(4,3,23,20,11.40) -INSERT INTO ITEM VALUES(4,4,9,18,25.80) -INSERT INTO ITEM VALUES(4,5,37,24,14.10) -INSERT INTO ITEM VALUES(5,0,9,5,25.80) -INSERT INTO ITEM VALUES(5,1,9,23,25.80) -INSERT INTO ITEM VALUES(5,2,20,18,30.00) -INSERT INTO ITEM VALUES(5,3,24,12,10.80) -INSERT INTO ITEM VALUES(5,4,32,14,28.50) -INSERT INTO ITEM VALUES(5,5,46,15,9.30) -INSERT INTO ITEM VALUES(5,6,7,9,12.60) -INSERT INTO ITEM VALUES(5,7,2,4,37.20) -INSERT INTO ITEM VALUES(5,8,20,3,30.00) -INSERT INTO ITEM VALUES(5,9,37,9,14.10) -INSERT INTO ITEM VALUES(5,10,28,18,4.50) -INSERT INTO ITEM VALUES(5,11,38,23,32.40) -INSERT INTO ITEM VALUES(5,12,8,15,33.90) -INSERT INTO ITEM VALUES(5,13,18,17,25.80) -INSERT INTO ITEM VALUES(6,0,15,20,14.10) -INSERT INTO ITEM VALUES(6,1,38,21,32.40) -INSERT INTO ITEM VALUES(6,2,23,8,11.40) -INSERT INTO ITEM VALUES(6,3,30,2,34.80) -INSERT INTO ITEM VALUES(6,4,31,20,7.20) -INSERT INTO ITEM VALUES(6,5,14,20,18.60) -INSERT INTO ITEM VALUES(6,6,37,22,14.10) -INSERT INTO ITEM VALUES(6,7,26,10,37.80) -INSERT INTO ITEM VALUES(6,8,41,19,30.90) -INSERT INTO ITEM VALUES(6,9,19,2,16.50) -INSERT INTO ITEM VALUES(6,10,16,13,29.10) -INSERT INTO ITEM VALUES(6,11,44,1,14.40) -INSERT INTO ITEM VALUES(7,0,43,16,14.10) -INSERT INTO ITEM VALUES(7,1,23,12,11.40) -INSERT INTO ITEM VALUES(7,2,27,17,34.50) -INSERT INTO ITEM VALUES(7,3,30,2,34.80) -INSERT INTO ITEM VALUES(7,4,2,13,37.20) -INSERT INTO ITEM VALUES(7,5,24,10,10.80) -INSERT INTO ITEM VALUES(7,6,14,4,18.60) -INSERT INTO ITEM VALUES(7,7,2,22,37.20) -INSERT INTO ITEM VALUES(7,8,42,19,29.70) -INSERT INTO ITEM VALUES(7,9,9,21,25.80) -INSERT INTO ITEM VALUES(7,10,7,1,12.60) -INSERT INTO ITEM VALUES(7,11,19,13,16.50) -INSERT INTO ITEM VALUES(7,12,40,16,4.20) -INSERT INTO ITEM VALUES(7,13,32,23,28.50) -INSERT INTO ITEM VALUES(7,14,47,14,26.70) -INSERT INTO ITEM VALUES(7,15,24,17,10.80) -INSERT INTO ITEM VALUES(7,16,7,12,12.60) -INSERT INTO ITEM VALUES(7,17,40,1,4.20) -INSERT INTO ITEM VALUES(7,18,23,5,11.40) -INSERT INTO ITEM VALUES(8,0,34,15,38.40) -INSERT INTO ITEM VALUES(8,1,44,16,14.40) -INSERT INTO ITEM VALUES(8,2,11,8,13.20) -INSERT INTO ITEM VALUES(8,3,41,16,30.90) -INSERT INTO ITEM VALUES(8,4,15,8,14.10) -INSERT INTO ITEM VALUES(8,5,24,18,10.80) -INSERT INTO ITEM VALUES(8,6,15,19,14.10) -INSERT INTO ITEM VALUES(8,7,6,5,14.70) -INSERT INTO ITEM VALUES(8,8,38,7,32.40) -INSERT INTO ITEM VALUES(8,9,21,23,17.10) -INSERT INTO ITEM VALUES(9,0,45,8,27.00) -INSERT INTO ITEM VALUES(9,1,18,21,25.80) -INSERT INTO ITEM VALUES(9,2,29,12,16.80) -INSERT INTO ITEM VALUES(9,3,4,14,19.20) -INSERT INTO ITEM VALUES(9,4,36,16,4.80) -INSERT INTO ITEM VALUES(9,5,6,2,14.70) -INSERT INTO ITEM VALUES(9,6,18,10,25.80) -INSERT INTO ITEM VALUES(9,7,2,22,37.20) -INSERT INTO ITEM VALUES(9,8,24,11,10.80) -INSERT INTO ITEM VALUES(9,9,13,6,27.00) -INSERT INTO ITEM VALUES(9,10,38,11,32.40) -INSERT INTO ITEM VALUES(9,11,12,16,25.20) -INSERT INTO ITEM VALUES(9,12,25,23,24.30) -INSERT INTO ITEM VALUES(9,13,42,13,29.70) -INSERT INTO ITEM VALUES(9,14,15,8,14.10) -INSERT INTO ITEM VALUES(9,15,48,23,31.50) -INSERT INTO ITEM VALUES(9,16,24,10,10.80) -INSERT INTO ITEM VALUES(9,17,13,17,27.00) -INSERT INTO ITEM VALUES(9,18,3,12,38.10) -INSERT INTO ITEM VALUES(9,19,48,23,31.50) -INSERT INTO ITEM VALUES(10,0,20,1,30.00) -INSERT INTO ITEM VALUES(10,1,33,17,27.30) -INSERT INTO ITEM VALUES(10,2,7,9,12.60) -INSERT INTO ITEM VALUES(10,3,46,1,9.30) -INSERT INTO ITEM VALUES(10,4,10,24,30.60) -INSERT INTO ITEM VALUES(10,5,5,24,35.40) -INSERT INTO ITEM VALUES(10,6,18,14,25.80) -INSERT INTO ITEM VALUES(10,7,4,13,19.20) -INSERT INTO ITEM VALUES(10,8,22,11,9.90) -INSERT INTO ITEM VALUES(10,9,5,10,35.40) -INSERT INTO ITEM VALUES(11,0,45,10,27.00) -INSERT INTO ITEM VALUES(11,1,21,21,17.10) -INSERT INTO ITEM VALUES(11,2,0,3,8.10) -INSERT INTO ITEM VALUES(11,3,32,21,28.50) -INSERT INTO ITEM VALUES(11,4,47,16,26.70) -INSERT INTO ITEM VALUES(11,5,19,2,16.50) -INSERT INTO ITEM VALUES(11,6,0,12,8.10) -INSERT INTO ITEM VALUES(11,7,48,22,31.50) -INSERT INTO ITEM VALUES(11,8,20,1,30.00) -INSERT INTO ITEM VALUES(12,0,1,24,37.20) -INSERT INTO ITEM VALUES(12,1,41,19,30.90) -INSERT INTO ITEM VALUES(12,2,6,5,14.70) -INSERT INTO ITEM VALUES(12,3,0,18,8.10) -INSERT INTO ITEM VALUES(12,4,20,11,30.00) -INSERT INTO ITEM VALUES(12,5,37,17,14.10) -INSERT INTO ITEM VALUES(12,6,31,15,7.20) -INSERT INTO ITEM VALUES(12,7,48,7,31.50) -INSERT INTO ITEM VALUES(12,8,48,2,31.50) -INSERT INTO ITEM VALUES(12,9,25,22,24.30) -INSERT INTO ITEM VALUES(12,10,46,19,9.30) -INSERT INTO ITEM VALUES(12,11,28,16,4.50) -INSERT INTO ITEM VALUES(12,12,13,12,27.00) -INSERT INTO ITEM VALUES(12,13,36,21,4.80) -INSERT INTO ITEM VALUES(12,14,25,11,24.30) -INSERT INTO ITEM VALUES(12,15,22,16,9.90) -INSERT INTO ITEM VALUES(12,16,0,9,8.10) -INSERT INTO ITEM VALUES(12,17,31,15,7.20) -INSERT INTO ITEM VALUES(12,18,9,4,25.80) -INSERT INTO ITEM VALUES(13,0,16,10,29.10) -INSERT INTO ITEM VALUES(13,1,1,1,37.20) -INSERT INTO ITEM VALUES(13,2,13,20,27.00) -INSERT INTO ITEM VALUES(13,3,32,2,28.50) -INSERT INTO ITEM VALUES(13,4,26,21,37.80) -INSERT INTO ITEM VALUES(13,5,22,19,9.90) -INSERT INTO ITEM VALUES(13,6,19,8,16.50) -INSERT INTO ITEM VALUES(13,7,29,24,16.80) -INSERT INTO ITEM VALUES(13,8,48,11,31.50) -INSERT INTO ITEM VALUES(13,9,24,10,10.80) -INSERT INTO ITEM VALUES(13,10,45,24,27.00) -INSERT INTO ITEM VALUES(13,11,14,3,18.60) -INSERT INTO ITEM VALUES(13,12,17,3,33.00) -INSERT INTO ITEM VALUES(13,13,10,20,30.60) -INSERT INTO ITEM VALUES(13,14,1,12,37.20) -INSERT INTO ITEM VALUES(13,15,0,20,8.10) -INSERT INTO ITEM VALUES(13,16,22,23,9.90) -INSERT INTO ITEM VALUES(13,17,32,18,28.50) -INSERT INTO ITEM VALUES(13,18,0,16,8.10) -INSERT INTO ITEM VALUES(13,19,42,18,29.70) -INSERT INTO ITEM VALUES(13,20,5,19,35.40) -INSERT INTO ITEM VALUES(13,21,40,1,4.20) -INSERT INTO ITEM VALUES(14,0,42,18,29.70) -INSERT INTO ITEM VALUES(14,1,9,22,25.80) -INSERT INTO ITEM VALUES(14,2,15,18,14.10) -INSERT INTO ITEM VALUES(14,3,34,11,38.40) -INSERT INTO ITEM VALUES(14,4,41,17,30.90) -INSERT INTO ITEM VALUES(14,5,11,8,13.20) -INSERT INTO ITEM VALUES(14,6,26,18,37.80) -INSERT INTO ITEM VALUES(14,7,43,4,14.10) -INSERT INTO ITEM VALUES(14,8,23,7,11.40) -INSERT INTO ITEM VALUES(14,9,13,16,27.00) -INSERT INTO ITEM VALUES(14,10,44,16,14.40) -INSERT INTO ITEM VALUES(14,11,25,15,24.30) -INSERT INTO ITEM VALUES(14,12,4,20,19.20) -INSERT INTO ITEM VALUES(14,13,11,23,13.20) -INSERT INTO ITEM VALUES(15,0,17,12,33.00) -INSERT INTO ITEM VALUES(15,1,13,21,27.00) -INSERT INTO ITEM VALUES(15,2,24,6,10.80) -INSERT INTO ITEM VALUES(16,0,18,15,25.80) -INSERT INTO ITEM VALUES(16,1,36,20,4.80) -INSERT INTO ITEM VALUES(16,2,20,15,30.00) -INSERT INTO ITEM VALUES(16,3,0,3,8.10) -INSERT INTO ITEM VALUES(16,4,10,24,30.60) -INSERT INTO ITEM VALUES(16,5,11,15,13.20) -INSERT INTO ITEM VALUES(16,6,44,7,14.40) -INSERT INTO ITEM VALUES(16,7,8,17,33.90) -INSERT INTO ITEM VALUES(16,8,13,17,27.00) -INSERT INTO ITEM VALUES(16,9,11,10,13.20) -INSERT INTO ITEM VALUES(16,10,43,8,14.10) -INSERT INTO ITEM VALUES(16,11,24,7,10.80) -INSERT INTO ITEM VALUES(16,12,18,2,25.80) -INSERT INTO ITEM VALUES(16,13,20,1,30.00) -INSERT INTO ITEM VALUES(16,14,0,19,8.10) -INSERT INTO ITEM VALUES(16,15,12,3,25.20) -INSERT INTO ITEM VALUES(17,0,16,8,29.10) -INSERT INTO ITEM VALUES(17,1,19,19,16.50) -INSERT INTO ITEM VALUES(17,2,44,11,14.40) -INSERT INTO ITEM VALUES(17,3,24,4,10.80) -INSERT INTO ITEM VALUES(17,4,23,2,11.40) -INSERT INTO ITEM VALUES(17,5,44,1,14.40) -INSERT INTO ITEM VALUES(17,6,43,6,14.10) -INSERT INTO ITEM VALUES(17,7,6,15,14.70) -INSERT INTO ITEM VALUES(17,8,49,8,3.30) -INSERT INTO ITEM VALUES(17,9,8,15,33.90) -INSERT INTO ITEM VALUES(17,10,10,12,30.60) -INSERT INTO ITEM VALUES(17,11,45,10,27.00) -INSERT INTO ITEM VALUES(17,12,22,16,9.90) -INSERT INTO ITEM VALUES(17,13,41,5,30.90) -INSERT INTO ITEM VALUES(17,14,18,2,25.80) -INSERT INTO ITEM VALUES(17,15,35,10,11.40) -INSERT INTO ITEM VALUES(17,16,8,16,33.90) -INSERT INTO ITEM VALUES(17,17,7,5,12.60) -INSERT INTO ITEM VALUES(17,18,5,9,35.40) -INSERT INTO ITEM VALUES(17,19,46,12,9.30) -INSERT INTO ITEM VALUES(18,0,32,1,28.50) -INSERT INTO ITEM VALUES(18,1,33,12,27.30) -INSERT INTO ITEM VALUES(18,2,40,12,4.20) -INSERT INTO ITEM VALUES(18,3,19,8,16.50) -INSERT INTO ITEM VALUES(18,4,28,6,4.50) -INSERT INTO ITEM VALUES(18,5,15,6,14.10) -INSERT INTO ITEM VALUES(18,6,29,4,16.80) -INSERT INTO ITEM VALUES(18,7,15,14,14.10) -INSERT INTO ITEM VALUES(18,8,1,24,37.20) -INSERT INTO ITEM VALUES(18,9,2,2,37.20) -INSERT INTO ITEM VALUES(18,10,34,18,38.40) -INSERT INTO ITEM VALUES(18,11,30,8,34.80) -INSERT INTO ITEM VALUES(18,12,37,12,14.10) -INSERT INTO ITEM VALUES(18,13,14,12,18.60) -INSERT INTO ITEM VALUES(18,14,28,20,4.50) -INSERT INTO ITEM VALUES(18,15,44,20,14.40) -INSERT INTO ITEM VALUES(18,16,31,12,7.20) -INSERT INTO ITEM VALUES(18,17,8,1,33.90) -INSERT INTO ITEM VALUES(18,18,10,1,30.60) -INSERT INTO ITEM VALUES(19,0,12,7,25.20) -INSERT INTO ITEM VALUES(19,1,31,2,7.20) -INSERT INTO ITEM VALUES(19,2,4,22,19.20) -INSERT INTO ITEM VALUES(19,3,49,23,3.30) -INSERT INTO ITEM VALUES(19,4,36,24,4.80) -INSERT INTO ITEM VALUES(20,0,47,15,26.70) -INSERT INTO ITEM VALUES(20,1,29,6,16.80) -INSERT INTO ITEM VALUES(20,2,24,22,10.80) -INSERT INTO ITEM VALUES(20,3,25,14,24.30) -INSERT INTO ITEM VALUES(20,4,30,13,34.80) -INSERT INTO ITEM VALUES(20,5,8,14,33.90) -INSERT INTO ITEM VALUES(20,6,20,2,30.00) -INSERT INTO ITEM VALUES(20,7,9,9,25.80) -INSERT INTO ITEM VALUES(20,8,44,18,14.40) -INSERT INTO ITEM VALUES(20,9,12,8,25.20) -INSERT INTO ITEM VALUES(20,10,25,11,24.30) -INSERT INTO ITEM VALUES(20,11,15,8,14.10) -INSERT INTO ITEM VALUES(21,0,9,10,25.80) -INSERT INTO ITEM VALUES(21,1,38,19,32.40) -INSERT INTO ITEM VALUES(21,2,31,17,7.20) -INSERT INTO ITEM VALUES(21,3,30,13,34.80) -INSERT INTO ITEM VALUES(21,4,49,22,3.30) -INSERT INTO ITEM VALUES(21,5,27,18,34.50) -INSERT INTO ITEM VALUES(21,6,26,7,37.80) -INSERT INTO ITEM VALUES(21,7,8,9,33.90) -INSERT INTO ITEM VALUES(21,8,44,19,14.40) -INSERT INTO ITEM VALUES(21,9,35,17,11.40) -INSERT INTO ITEM VALUES(21,10,19,14,16.50) -INSERT INTO ITEM VALUES(21,11,20,11,30.00) -INSERT INTO ITEM VALUES(22,0,9,6,25.80) -INSERT INTO ITEM VALUES(22,1,30,11,34.80) -INSERT INTO ITEM VALUES(22,2,12,20,25.20) -INSERT INTO ITEM VALUES(22,3,22,5,9.90) -INSERT INTO ITEM VALUES(22,4,5,21,35.40) -INSERT INTO ITEM VALUES(22,5,24,5,10.80) -INSERT INTO ITEM VALUES(22,6,4,11,19.20) -INSERT INTO ITEM VALUES(22,7,21,6,17.10) -INSERT INTO ITEM VALUES(22,8,3,2,38.10) -INSERT INTO ITEM VALUES(22,9,23,1,11.40) -INSERT INTO ITEM VALUES(23,0,48,22,31.50) -INSERT INTO ITEM VALUES(23,1,26,8,37.80) -INSERT INTO ITEM VALUES(23,2,33,18,27.30) -INSERT INTO ITEM VALUES(23,3,40,19,4.20) -INSERT INTO ITEM VALUES(23,4,23,19,11.40) -INSERT INTO ITEM VALUES(23,5,32,14,28.50) -INSERT INTO ITEM VALUES(23,6,16,1,29.10) -INSERT INTO ITEM VALUES(23,7,39,3,23.10) -INSERT INTO ITEM VALUES(23,8,6,17,14.70) -INSERT INTO ITEM VALUES(23,9,20,18,30.00) -INSERT INTO ITEM VALUES(23,10,4,18,19.20) -INSERT INTO ITEM VALUES(23,11,41,8,30.90) -INSERT INTO ITEM VALUES(23,12,4,17,19.20) -INSERT INTO ITEM VALUES(23,13,14,17,18.60) -INSERT INTO ITEM VALUES(23,14,44,2,14.40) -INSERT INTO ITEM VALUES(23,15,13,17,27.00) -INSERT INTO ITEM VALUES(23,16,8,11,33.90) -INSERT INTO ITEM VALUES(24,0,43,14,14.10) -INSERT INTO ITEM VALUES(24,1,46,18,9.30) -INSERT INTO ITEM VALUES(24,2,38,10,32.40) -INSERT INTO ITEM VALUES(24,3,17,23,33.00) -INSERT INTO ITEM VALUES(24,4,15,17,14.10) -INSERT INTO ITEM VALUES(24,5,35,16,11.40) -INSERT INTO ITEM VALUES(24,6,40,3,4.20) -INSERT INTO ITEM VALUES(24,7,7,13,12.60) -INSERT INTO ITEM VALUES(24,8,5,18,35.40) -INSERT INTO ITEM VALUES(24,9,21,8,17.10) -INSERT INTO ITEM VALUES(24,10,27,4,34.50) -INSERT INTO ITEM VALUES(24,11,1,4,37.20) -INSERT INTO ITEM VALUES(24,12,0,8,8.10) -INSERT INTO ITEM VALUES(24,13,15,21,14.10) -INSERT INTO ITEM VALUES(24,14,1,13,37.20) -INSERT INTO ITEM VALUES(24,15,39,17,23.10) -INSERT INTO ITEM VALUES(25,0,5,15,35.40) -INSERT INTO ITEM VALUES(25,1,43,13,14.10) -INSERT INTO ITEM VALUES(25,2,13,8,27.00) -INSERT INTO ITEM VALUES(25,3,19,4,16.50) -INSERT INTO ITEM VALUES(25,4,47,10,26.70) -INSERT INTO ITEM VALUES(25,5,10,5,30.60) -INSERT INTO ITEM VALUES(25,6,21,18,17.10) -INSERT INTO ITEM VALUES(25,7,16,8,29.10) -INSERT INTO ITEM VALUES(25,8,38,3,32.40) -INSERT INTO ITEM VALUES(26,0,42,16,29.70) -INSERT INTO ITEM VALUES(26,1,43,21,14.10) -INSERT INTO ITEM VALUES(26,2,33,7,27.30) -INSERT INTO ITEM VALUES(26,3,16,3,29.10) -INSERT INTO ITEM VALUES(26,4,46,7,9.30) -INSERT INTO ITEM VALUES(26,5,38,4,32.40) -INSERT INTO ITEM VALUES(26,6,7,23,12.60) -INSERT INTO ITEM VALUES(26,7,4,16,19.20) -INSERT INTO ITEM VALUES(26,8,40,13,4.20) -INSERT INTO ITEM VALUES(26,9,1,23,37.20) -INSERT INTO ITEM VALUES(26,10,34,16,38.40) -INSERT INTO ITEM VALUES(26,11,18,3,25.80) -INSERT INTO ITEM VALUES(26,12,27,20,34.50) -INSERT INTO ITEM VALUES(26,13,13,10,27.00) -INSERT INTO ITEM VALUES(26,14,26,6,37.80) -INSERT INTO ITEM VALUES(26,15,8,6,33.90) -INSERT INTO ITEM VALUES(26,16,30,4,34.80) -INSERT INTO ITEM VALUES(27,0,24,15,10.80) -INSERT INTO ITEM VALUES(27,1,45,15,27.00) -INSERT INTO ITEM VALUES(27,2,19,1,16.50) -INSERT INTO ITEM VALUES(28,0,35,13,11.40) -INSERT INTO ITEM VALUES(28,1,15,13,14.10) -INSERT INTO ITEM VALUES(28,2,44,22,14.40) -INSERT INTO ITEM VALUES(28,3,6,3,14.70) -INSERT INTO ITEM VALUES(28,4,45,17,27.00) -INSERT INTO ITEM VALUES(28,5,49,4,3.30) -INSERT INTO ITEM VALUES(28,6,33,16,27.30) -INSERT INTO ITEM VALUES(28,7,28,8,4.50) -INSERT INTO ITEM VALUES(28,8,28,6,4.50) -INSERT INTO ITEM VALUES(29,0,33,17,27.30) -INSERT INTO ITEM VALUES(29,1,38,12,32.40) -INSERT INTO ITEM VALUES(29,2,17,23,33.00) -INSERT INTO ITEM VALUES(29,3,7,21,12.60) -INSERT INTO ITEM VALUES(29,4,4,7,19.20) -INSERT INTO ITEM VALUES(29,5,31,13,7.20) -INSERT INTO ITEM VALUES(29,6,4,16,19.20) -INSERT INTO ITEM VALUES(29,7,5,1,35.40) -INSERT INTO ITEM VALUES(29,8,35,6,11.40) -INSERT INTO ITEM VALUES(30,0,14,7,18.60) -INSERT INTO ITEM VALUES(30,1,16,19,29.10) -INSERT INTO ITEM VALUES(30,2,10,18,30.60) -INSERT INTO ITEM VALUES(30,3,33,2,27.30) -INSERT INTO ITEM VALUES(30,4,34,2,38.40) -INSERT INTO ITEM VALUES(30,5,43,23,14.10) -INSERT INTO ITEM VALUES(30,6,14,23,18.60) -INSERT INTO ITEM VALUES(31,0,33,10,27.30) -INSERT INTO ITEM VALUES(31,1,4,23,19.20) -INSERT INTO ITEM VALUES(31,2,4,3,19.20) -INSERT INTO ITEM VALUES(31,3,12,10,25.20) -INSERT INTO ITEM VALUES(31,4,8,14,33.90) -INSERT INTO ITEM VALUES(31,5,1,4,37.20) -INSERT INTO ITEM VALUES(31,6,26,16,37.80) -INSERT INTO ITEM VALUES(31,7,38,3,32.40) -INSERT INTO ITEM VALUES(31,8,7,5,12.60) -INSERT INTO ITEM VALUES(31,9,14,15,18.60) -INSERT INTO ITEM VALUES(31,10,0,3,8.10) -INSERT INTO ITEM VALUES(32,0,35,11,11.40) -INSERT INTO ITEM VALUES(32,1,30,13,34.80) -INSERT INTO ITEM VALUES(32,2,1,14,37.20) -INSERT INTO ITEM VALUES(33,0,36,5,4.80) -INSERT INTO ITEM VALUES(33,1,10,21,30.60) -INSERT INTO ITEM VALUES(33,2,36,16,4.80) -INSERT INTO ITEM VALUES(33,3,48,1,31.50) -INSERT INTO ITEM VALUES(33,4,24,1,10.80) -INSERT INTO ITEM VALUES(33,5,8,11,33.90) -INSERT INTO ITEM VALUES(33,6,17,16,33.00) -INSERT INTO ITEM VALUES(33,7,43,10,14.10) -INSERT INTO ITEM VALUES(33,8,3,15,38.10) -INSERT INTO ITEM VALUES(33,9,29,5,16.80) -INSERT INTO ITEM VALUES(33,10,24,9,10.80) -INSERT INTO ITEM VALUES(33,11,5,7,35.40) -INSERT INTO ITEM VALUES(33,12,16,23,29.10) -INSERT INTO ITEM VALUES(33,13,25,16,24.30) -INSERT INTO ITEM VALUES(33,14,44,13,14.40) -INSERT INTO ITEM VALUES(33,15,38,7,32.40) -INSERT INTO ITEM VALUES(34,0,10,22,30.60) -INSERT INTO ITEM VALUES(34,1,4,3,19.20) -INSERT INTO ITEM VALUES(34,2,28,22,4.50) -INSERT INTO ITEM VALUES(34,3,44,15,14.40) -INSERT INTO ITEM VALUES(34,4,27,1,34.50) -INSERT INTO ITEM VALUES(34,5,45,13,27.00) -INSERT INTO ITEM VALUES(34,6,32,7,28.50) -INSERT INTO ITEM VALUES(34,7,21,22,17.10) -INSERT INTO ITEM VALUES(34,8,3,1,38.10) -INSERT INTO ITEM VALUES(34,9,8,17,33.90) -INSERT INTO ITEM VALUES(34,10,41,16,30.90) -INSERT INTO ITEM VALUES(34,11,4,17,19.20) -INSERT INTO ITEM VALUES(34,12,43,21,14.10) -INSERT INTO ITEM VALUES(34,13,30,14,34.80) -INSERT INTO ITEM VALUES(34,14,46,7,9.30) -INSERT INTO ITEM VALUES(35,0,20,17,30.00) -INSERT INTO ITEM VALUES(35,1,3,9,38.10) -INSERT INTO ITEM VALUES(35,2,14,4,18.60) -INSERT INTO ITEM VALUES(35,3,27,10,34.50) -INSERT INTO ITEM VALUES(35,4,14,17,18.60) -INSERT INTO ITEM VALUES(35,5,33,5,27.30) -INSERT INTO ITEM VALUES(35,6,5,4,35.40) -INSERT INTO ITEM VALUES(35,7,22,15,9.90) -INSERT INTO ITEM VALUES(35,8,0,1,8.10) -INSERT INTO ITEM VALUES(35,9,19,1,16.50) -INSERT INTO ITEM VALUES(35,10,17,11,33.00) -INSERT INTO ITEM VALUES(35,11,44,9,14.40) -INSERT INTO ITEM VALUES(35,12,7,23,12.60) -INSERT INTO ITEM VALUES(35,13,19,17,16.50) -INSERT INTO ITEM VALUES(36,0,18,13,25.80) -INSERT INTO ITEM VALUES(36,1,15,23,14.10) -INSERT INTO ITEM VALUES(36,2,1,6,37.20) -INSERT INTO ITEM VALUES(36,3,10,8,30.60) -INSERT INTO ITEM VALUES(36,4,40,5,4.20) -INSERT INTO ITEM VALUES(36,5,25,8,24.30) -INSERT INTO ITEM VALUES(36,6,39,20,23.10) -INSERT INTO ITEM VALUES(36,7,39,19,23.10) -INSERT INTO ITEM VALUES(36,8,4,21,19.20) -INSERT INTO ITEM VALUES(36,9,31,18,7.20) -INSERT INTO ITEM VALUES(36,10,47,11,26.70) -INSERT INTO ITEM VALUES(36,11,44,9,14.40) -INSERT INTO ITEM VALUES(37,0,41,24,30.90) -INSERT INTO ITEM VALUES(37,1,15,20,14.10) -INSERT INTO ITEM VALUES(37,2,36,8,4.80) -INSERT INTO ITEM VALUES(37,3,26,7,37.80) -INSERT INTO ITEM VALUES(37,4,13,20,27.00) -INSERT INTO ITEM VALUES(37,5,1,14,37.20) -INSERT INTO ITEM VALUES(37,6,34,12,38.40) -INSERT INTO ITEM VALUES(37,7,24,19,10.80) -INSERT INTO ITEM VALUES(37,8,46,9,9.30) -INSERT INTO ITEM VALUES(37,9,47,16,26.70) -INSERT INTO ITEM VALUES(37,10,1,18,37.20) -INSERT INTO ITEM VALUES(37,11,30,5,34.80) -INSERT INTO ITEM VALUES(37,12,24,23,10.80) -INSERT INTO ITEM VALUES(37,13,32,3,28.50) -INSERT INTO ITEM VALUES(37,14,12,3,25.20) -INSERT INTO ITEM VALUES(37,15,32,12,28.50) -INSERT INTO ITEM VALUES(37,16,27,8,34.50) -INSERT INTO ITEM VALUES(37,17,38,18,32.40) -INSERT INTO ITEM VALUES(37,18,26,22,37.80) -INSERT INTO ITEM VALUES(37,19,19,20,16.50) -INSERT INTO ITEM VALUES(37,20,14,1,18.60) -INSERT INTO ITEM VALUES(37,21,6,9,14.70) -INSERT INTO ITEM VALUES(38,0,48,14,31.50) -INSERT INTO ITEM VALUES(38,1,45,13,27.00) -INSERT INTO ITEM VALUES(38,2,4,8,19.20) -INSERT INTO ITEM VALUES(38,3,27,19,34.50) -INSERT INTO ITEM VALUES(38,4,45,14,27.00) -INSERT INTO ITEM VALUES(38,5,48,17,31.50) -INSERT INTO ITEM VALUES(38,6,5,19,35.40) -INSERT INTO ITEM VALUES(38,7,15,1,14.10) -INSERT INTO ITEM VALUES(38,8,40,10,4.20) -INSERT INTO ITEM VALUES(38,9,27,20,34.50) -INSERT INTO ITEM VALUES(38,10,4,18,19.20) -INSERT INTO ITEM VALUES(38,11,19,18,16.50) -INSERT INTO ITEM VALUES(38,12,1,18,37.20) -INSERT INTO ITEM VALUES(38,13,8,7,33.90) -INSERT INTO ITEM VALUES(38,14,20,7,30.00) -INSERT INTO ITEM VALUES(38,15,47,10,26.70) -INSERT INTO ITEM VALUES(38,16,40,18,4.20) -INSERT INTO ITEM VALUES(38,17,32,4,28.50) -INSERT INTO ITEM VALUES(38,18,28,20,4.50) -INSERT INTO ITEM VALUES(38,19,4,7,19.20) -INSERT INTO ITEM VALUES(39,0,10,12,30.60) -INSERT INTO ITEM VALUES(39,1,24,6,10.80) -INSERT INTO ITEM VALUES(39,2,39,16,23.10) -INSERT INTO ITEM VALUES(39,3,20,17,30.00) -INSERT INTO ITEM VALUES(40,0,46,24,9.30) -INSERT INTO ITEM VALUES(40,1,45,24,27.00) -INSERT INTO ITEM VALUES(40,2,4,5,19.20) -INSERT INTO ITEM VALUES(40,3,26,10,37.80) -INSERT INTO ITEM VALUES(40,4,18,13,25.80) -INSERT INTO ITEM VALUES(40,5,32,18,28.50) -INSERT INTO ITEM VALUES(40,6,28,12,4.50) -INSERT INTO ITEM VALUES(40,7,31,1,7.20) -INSERT INTO ITEM VALUES(40,8,11,4,13.20) -INSERT INTO ITEM VALUES(40,9,40,17,4.20) -INSERT INTO ITEM VALUES(40,10,6,11,14.70) -INSERT INTO ITEM VALUES(40,11,27,2,34.50) -INSERT INTO ITEM VALUES(40,12,35,13,11.40) -INSERT INTO ITEM VALUES(40,13,6,8,14.70) -INSERT INTO ITEM VALUES(40,14,4,24,19.20) -INSERT INTO ITEM VALUES(40,15,22,12,9.90) -INSERT INTO ITEM VALUES(40,16,27,16,34.50) -INSERT INTO ITEM VALUES(40,17,4,20,19.20) -INSERT INTO ITEM VALUES(40,18,33,11,27.30) -INSERT INTO ITEM VALUES(40,19,7,23,12.60) -INSERT INTO ITEM VALUES(40,20,4,16,19.20) -INSERT INTO ITEM VALUES(41,0,5,24,35.40) -INSERT INTO ITEM VALUES(41,1,47,19,26.70) -INSERT INTO ITEM VALUES(41,2,36,2,4.80) -INSERT INTO ITEM VALUES(41,3,29,20,16.80) -INSERT INTO ITEM VALUES(41,4,16,22,29.10) -INSERT INTO ITEM VALUES(41,5,9,21,25.80) -INSERT INTO ITEM VALUES(41,6,17,11,33.00) -INSERT INTO ITEM VALUES(41,7,22,18,9.90) -INSERT INTO ITEM VALUES(41,8,9,22,25.80) -INSERT INTO ITEM VALUES(41,9,26,21,37.80) -INSERT INTO ITEM VALUES(41,10,24,20,10.80) -INSERT INTO ITEM VALUES(41,11,48,15,31.50) -INSERT INTO ITEM VALUES(42,0,48,9,31.50) -INSERT INTO ITEM VALUES(42,1,18,21,25.80) -INSERT INTO ITEM VALUES(42,2,40,19,4.20) -INSERT INTO ITEM VALUES(42,3,40,14,4.20) -INSERT INTO ITEM VALUES(42,4,48,15,31.50) -INSERT INTO ITEM VALUES(43,0,15,22,14.10) -INSERT INTO ITEM VALUES(43,1,18,19,25.80) -INSERT INTO ITEM VALUES(43,2,2,15,37.20) -INSERT INTO ITEM VALUES(43,3,6,18,14.70) -INSERT INTO ITEM VALUES(43,4,32,22,28.50) -INSERT INTO ITEM VALUES(43,5,33,6,27.30) -INSERT INTO ITEM VALUES(43,6,24,1,10.80) -INSERT INTO ITEM VALUES(43,7,11,15,13.20) -INSERT INTO ITEM VALUES(43,8,44,8,14.40) -INSERT INTO ITEM VALUES(43,9,7,23,12.60) -INSERT INTO ITEM VALUES(43,10,35,1,11.40) -INSERT INTO ITEM VALUES(43,11,49,23,3.30) -INSERT INTO ITEM VALUES(43,12,40,24,4.20) -INSERT INTO ITEM VALUES(43,13,44,22,14.40) -INSERT INTO ITEM VALUES(43,14,3,18,38.10) -INSERT INTO ITEM VALUES(43,15,48,7,31.50) -INSERT INTO ITEM VALUES(43,16,38,12,32.40) -INSERT INTO ITEM VALUES(44,0,33,20,27.30) -INSERT INTO ITEM VALUES(44,1,34,17,38.40) -INSERT INTO ITEM VALUES(44,2,17,14,33.00) -INSERT INTO ITEM VALUES(44,3,3,14,38.10) -INSERT INTO ITEM VALUES(44,4,12,3,25.20) -INSERT INTO ITEM VALUES(44,5,41,22,30.90) -INSERT INTO ITEM VALUES(44,6,14,15,18.60) -INSERT INTO ITEM VALUES(44,7,49,17,3.30) -INSERT INTO ITEM VALUES(44,8,28,23,4.50) -INSERT INTO ITEM VALUES(45,0,44,6,14.40) -INSERT INTO ITEM VALUES(45,1,11,6,13.20) -INSERT INTO ITEM VALUES(45,2,46,8,9.30) -INSERT INTO ITEM VALUES(45,3,14,11,18.60) -INSERT INTO ITEM VALUES(45,4,3,14,38.10) -INSERT INTO ITEM VALUES(45,5,45,17,27.00) -INSERT INTO ITEM VALUES(45,6,39,5,23.10) -INSERT INTO ITEM VALUES(45,7,6,24,14.70) -INSERT INTO ITEM VALUES(45,8,9,2,25.80) -INSERT INTO ITEM VALUES(45,9,26,18,37.80) -INSERT INTO ITEM VALUES(45,10,41,24,30.90) -INSERT INTO ITEM VALUES(45,11,31,22,7.20) -INSERT INTO ITEM VALUES(45,12,32,13,28.50) -INSERT INTO ITEM VALUES(45,13,47,8,26.70) -INSERT INTO ITEM VALUES(45,14,3,16,38.10) -INSERT INTO ITEM VALUES(46,0,5,21,35.40) -INSERT INTO ITEM VALUES(46,1,12,24,25.20) -INSERT INTO ITEM VALUES(46,2,30,14,34.80) -INSERT INTO ITEM VALUES(46,3,21,19,17.10) -INSERT INTO ITEM VALUES(46,4,17,5,33.00) -INSERT INTO ITEM VALUES(46,5,25,9,24.30) -INSERT INTO ITEM VALUES(46,6,41,18,30.90) -INSERT INTO ITEM VALUES(46,7,49,9,3.30) -INSERT INTO ITEM VALUES(46,8,8,22,33.90) -INSERT INTO ITEM VALUES(46,9,7,4,12.60) -INSERT INTO ITEM VALUES(46,10,11,24,13.20) -INSERT INTO ITEM VALUES(46,11,1,4,37.20) -INSERT INTO ITEM VALUES(46,12,21,24,17.10) -INSERT INTO ITEM VALUES(46,13,36,20,4.80) -INSERT INTO ITEM VALUES(46,14,24,10,10.80) -INSERT INTO ITEM VALUES(46,15,40,11,4.20) -INSERT INTO ITEM VALUES(46,16,46,21,9.30) -INSERT INTO ITEM VALUES(46,17,12,23,25.20) -INSERT INTO ITEM VALUES(47,0,23,15,11.40) -INSERT INTO ITEM VALUES(47,1,23,13,11.40) -INSERT INTO ITEM VALUES(47,2,17,6,33.00) -INSERT INTO ITEM VALUES(47,3,1,4,37.20) -INSERT INTO ITEM VALUES(47,4,15,1,14.10) -INSERT INTO ITEM VALUES(47,5,40,8,4.20) -INSERT INTO ITEM VALUES(47,6,8,10,33.90) -INSERT INTO ITEM VALUES(47,7,28,14,4.50) -INSERT INTO ITEM VALUES(47,8,16,2,29.10) -INSERT INTO ITEM VALUES(47,9,32,9,28.50) -INSERT INTO ITEM VALUES(47,10,45,2,27.00) -INSERT INTO ITEM VALUES(47,11,35,10,11.40) -INSERT INTO ITEM VALUES(47,12,12,20,25.20) -INSERT INTO ITEM VALUES(47,13,33,8,27.30) -INSERT INTO ITEM VALUES(48,0,6,23,14.70) -INSERT INTO ITEM VALUES(48,1,26,23,37.80) -INSERT INTO ITEM VALUES(48,2,23,10,11.40) -INSERT INTO ITEM VALUES(48,3,10,2,30.60) -INSERT INTO ITEM VALUES(48,4,48,4,31.50) -INSERT INTO ITEM VALUES(48,5,24,16,10.80) -INSERT INTO ITEM VALUES(48,6,11,17,13.20) -INSERT INTO ITEM VALUES(48,7,30,19,34.80) -INSERT INTO ITEM VALUES(48,8,5,12,35.40) -INSERT INTO ITEM VALUES(48,9,35,17,11.40) -INSERT INTO ITEM VALUES(48,10,41,10,30.90) -INSERT INTO ITEM VALUES(49,0,18,6,25.80) -INSERT INTO ITEM VALUES(49,1,22,16,9.90) -INSERT INTO ITEM VALUES(49,2,29,6,16.80) -INSERT INTO ITEM VALUES(49,3,17,19,33.00) -INSERT INTO ITEM VALUES(49,4,47,14,26.70) -INSERT INTO ITEM VALUES(49,5,16,1,29.10) -INSERT INTO ITEM VALUES(49,6,29,15,16.80) -INSERT INTO ITEM VALUES(49,7,6,21,14.70) -INSERT INTO ITEM VALUES(49,8,48,24,31.50) -INSERT INTO ITEM VALUES(49,9,7,24,12.60) -INSERT INTO ITEM VALUES(49,10,30,16,34.80) -INSERT INTO ITEM VALUES(49,11,40,15,4.20) -INSERT INTO ITEM VALUES(49,12,21,17,17.10) -INSERT INTO ITEM VALUES(49,13,6,22,14.70) -INSERT INTO ITEM VALUES(49,14,23,5,11.40) -INSERT INTO ITEM VALUES(49,15,19,24,16.50) -INSERT INTO ITEM VALUES(49,16,24,18,10.80) -CREATE VIEW DOC_ADDR AS SELECT D.ID,D.TOTAL,A.CITY FROM INVOICE D, CUSTOMER A - WHERE D.CUSTOMERID=A.ID AND A.ID < 10 -/*c88*/SELECT * FROM DOC_ADDR D, ITEM P WHERE P.INVOICEID = D.ID - --- correlated subquery together with group and aggregates -SELECT max(city), count(firstname) , max(lastname), - (SELECT count(*) from item where item.invoiceid = customer.id) - FROM Customer join invoice on invoice.customerid = customer.id - group by customer.id - - diff --git a/database/hsqldb/testrun/hsqldb/TestSelf3PartNames.txt b/database/hsqldb/testrun/hsqldb/TestSelf3PartNames.txt deleted file mode 100644 index 6ea8978c..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelf3PartNames.txt +++ /dev/null @@ -1,67 +0,0 @@ --- Test 3-part names like: schemaname.tablename.columname ---SET PROPERTY "hsqldb.default_table_type" 'cached' --- Setup -CREATE USER blaine PASSWORD "blaine"; -GRANT dba TO blaine; -CREATE SCHEMA b1 AUTHORIZATION blaine; -SET SCHEMA b1; -CREATE TABLE t(i int); - -/*u1*/INSERT INTO t VALUES(1); -/*c1*/SELECT t.i FROM t; -/*c1*/SELECT b1.t.i FROM t; -/*c1*/SELECT b1.t.i FROM b1.t; -/*e*/SELECT t.NOSUCH.i FROM t; -/*c1*/SELECT i FROM t WHERE t.i > 0; -/*c1*/SELECT i FROM t WHERE b1.t.i > 0; -/*e*/SELECT i FROM NOSUCH.t WHERE b1.t.i > 0; -/*e*/SELECT i FROM t WHERE NOSUCH.t.i > 0; -/*e*/SELECT i FROM t WHERE t.NOSUCH.i > 0; -SET SCHEMA public; -/*c1*/SELECT b1.t.i FROM b1.t; -/*e*/SELECT t.NOSUCH.i FROM b1.t; -/*c1*/SELECT i FROM b1.t WHERE b1.t.i > 0; -/*e*/SELECT i FROM t WHERE b1.NOSUCH.i > 0; --- Cleanup -DROP SCHEMA b1 CASCADE; -DROP USER blaine; - - --- Now build up to Joins with 3-part names --- Setup -create schema s1 authorization dba; -create schema s2 authorization dba; -create table s1.t(i int, j1 int); -insert into s1.t values(11, 4); -create table s2.t(i int, j2 int); -insert into s2.t values(22, 4); - --- sanity checks -/*r11,4*/SELECT * FROM s1.t; -/*r22,4*/SELECT * FROM s2.t; --- cross-schema 2-part name Join -/*r4*/SELECT j1 FROM s1.t, s2.t WHERE j1 = j2; --- cross-schema 3-part name Join -/*r22,4,11*/SELECT s2.t.i, j1, s1.t.i FROM s1.t, s2.t WHERE j1 = j2; -/*r22,4,11*/SELECT s2.t.i, j1, s1.t.i FROM s1.t, s2.t WHERE s1.t.j1 = s2.t.j2; -/*e*/SELECT s2.t.i, j1, s1.t.i FROM s1.t, s2.t WHERE s2.t.j1 = s2.t.j2; -/*e*/SELECT s2.t.i, j1, s1.t.i FROM s1.t, s2.t WHERE s1.t.j1 = s1.t.j2; --- schema qualifier in view defintion -CREATE VIEW s2.v2 AS SELECT * FROM s2.t; --- 3-part Names w/ views -/*r22,4,11*/SELECT s2.v2.i, j1, s1.t.i FROM s1.t, s2.v2 WHERE j1 = j2; -/*r22,4,11*/SELECT s2.v2.i, j1, s1.t.i FROM s1.t, s2.v2 WHERE s1.t.j1 = s2.v2.j2; --- 3-part name w/ * -/*r22,4*/SELECT s2.t.* FROM s2.t; -SET SCHEMA s2; -/*r22,4*/SELECT s2.t.* FROM t; - --- Illegal use of 3-part names -/*e*/SELECT * from bad.s1.t; -/*e*/SELECT * from s1.t.bad; -/*e*/SELECT * from s1.bad.t; - -SET SCHEMA public; --- Cleanup -DROP SCHEMA s1 CASCADE; -DROP SCHEMA s2 CASCADE; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfAlterColumn.txt b/database/hsqldb/testrun/hsqldb/TestSelfAlterColumn.txt deleted file mode 100644 index 00a311bb..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfAlterColumn.txt +++ /dev/null @@ -1,217 +0,0 @@ -drop table main if exists; -drop table ref if exists; -create table main (id int primary key, data varchar(20) default'' not null) -create table ref (id int primary key, data varchar(20) unique, ref int references main(id)) -insert into main values 10, 'data' -insert into ref values 1, 'data', 10 -alter table ref drop column ref cascade -alter table ref drop column data -drop table ref -create table ref (id int primary key, data varchar(20) unique, ref int references main(id)) -alter table main drop column id cascade - -drop table "testac" if exists; -drop table "testacc" if exists; --- tests for various column definition statements -create table "testac" ("a" integer, "b" integer); -insert into "testac" values(6,6); -insert into "testac" values(5,5); -/*r2*/select count(*) from "testac"; --- add column without COLUMN keyword -alter table "testac" add "c" varchar(10) -/*e*/alter table "testac" add "c" varchar(10) -alter table "testac" alter column "c" varchar(2) -/*e*/insert into "testac" values(5,5,'long string'); -insert into "testac" values(4,4,'ls'); -/*r - 6,6,NULL - 5,5,NULL - 4,4,ls -*/select * from "testac" order by "a" desc --- drop column without COLUMN keyword -alter table "testac" drop "c" -/*r - 6,6 - 5,5 - 4,4 -*/select * from "testac" order by "a" desc --- add column with COLUMN keyword -alter table "testac" add column "c" varchar(10) default 'XX' not null before "b" -/*e*/alter table "testac" add column "c" varchar(10) before "b" -/*r - 6,XX,6 - 5,XX,5 - 4,XX,4 -*/select * from "testac" order by "a" desc; --- drop column with COLUMN keyword -alter table "testac" drop column "c"; -/*r - 6,6 - 5,5 - 4,4 -*/select * from "testac" order by "a" desc; --- add column without COLUMN keyword - unquoted -alter table "testac" add c varchar(10); -/*r - 6,6,NULL - 5,5,NULL - 4,4,NULL -*/select * from "testac" order by "a" desc; --- drop column without COLUMN keyword - unquoted -alter table "testac" drop c; -/*r - 6,6 - 5,5 - 4,4 -*/select * from "testac" order by "a" desc; --- GENERATED -alter table "testac" alter column "a" generated always as identity (start with 7); -insert into "testac" values default, 8 -/*r - 7,8 - 6,6 - 5,5 - 4,4 -*/select * from "testac" order by "a" desc; --- -alter table "testac" alter column "a" drop generated; -insert into "testac" values 9, 9 - --- PK definition not allowed in alter column -/*e*/alter table "testac" alter column "a" integer primary key; -alter table "testac" add primary key("a"); -/*e*/insert into "testac" values (null,7); - -delete from "testac" where "a" > 6 --- Old style identity added and removed -alter table "testac" alter column "a" integer identity -insert into "testac" values (default,7); -alter table "testac" alter column "a" integer -/*e*/insert into "testac" values (default,8); -delete from "testac" where "a" > 6 or "a" < 4 - --- IDENTITY cannot be added with a data type change statement -/*e*/alter table "testac" alter column "a" set data type integer generated by default as identity (start with 7); -alter table "testac" alter column "a" generated by default as identity (start with 7); -insert into "testac" values (default,7); -insert into "testac" ("b") values (8); -/*r - 4,4 - 5,5 - 6,6 - 7,7 - 8,8 -*/select * from "testac" order by "a"; -create table "testacc" as (select * from "testac") with data; --- Old style identity can be dropped from PK column -alter table "testac" alter column "a" integer; -/*e*/insert into "testac" values (null,9); -alter table "testac" alter column "a" generated by default as identity (start with 9) -insert into "testac" values (null,9); -insert into "testac" values (default,9); -/*r - 4,4 - 5,5 - 6,6 - 7,7 - 8,8 - 9,9 - 10,9 -*/select * from "testac" order by 1; -alter table "testac" drop primary key; -alter table "testac" alter column "a" drop generated -/*r - 4,4 - 5,5 - 6,6 - 7,7 - 8,8 - 9,9 - 10,9 -*/select * from "testac" order by 1; -insert into "testac" values (null,12); -/*c8*/select * from "testac"; -/*e*/alter table "testac" alter column "a" not null; - -/*r - 4,4 - 5,5 - 6,6 - 7,7 - 8,8 - 9,9 - 10,9 - null,12 -*/select * from "testac" order by 1 nulls last; -delete from "testac" where "a" is null -delete from "testac" where "a" > 9 -/*c6*/select * from "testac"; -alter table "testac" alter column "a" set not null; -/*e*/insert into "testac" values (null,12); -alter table "testac" add primary key("a"); -/*c6*/select * from "testac"; -/*e*/insert into "testac" values (null,12); -alter table "testac" drop primary key; -/*e*/insert into "testac" values (null,12); -/*c6*/select * from "testac"; -alter table "testac" alter column "a" set null; -insert into "testac" values (null,12); -delete from "testac" where "a" is null -/*c6*/select * from "testac"; - -/*r - 4,4 - 5,5 - 6,6 - 7,7 - 8,8 - 9,9 -*/select * from "testac" order by 1; - --- column with a PK constraint can be added -alter table "testac" add column "c" integer generated by default as identity primary key --- no second IDENTITY or PK -/*e*/alter table "testac" add column "d" integer generated by default as identity primary key -/*e*/alter table "testac" add column "d" integer generated by default as identity -/*e*/alter table "testac" add column "d" integer primary key; --- column with a PK constraint can be dropped -alter table "testac" drop "c"; -alter table "testac" add unique("a"); -/*e*/insert into "testac" values(9,9); -alter table "testac" drop "a"; -/*r - 4 - 5 - 6 - 7 - 8 - 9 -*/select * from "testac" order by 1; --- tests for changing column size -alter table "testacc" add column "c" varchar(4) default 'aa' not null; -update "testacc" set "c" = "c" || cast("a" as varchar(5)); -/*r - 4,4,aa4 - 5,5,aa5 - 6,6,aa6 - 7,7,aa7 - 8,8,aa8 -*/select * from "testacc" order by 1; -alter table "testacc" add primary key ("c") -/*r - 4,4,aa4 - 5,5,aa5 - 6,6,aa6 - 7,7,aa7 - 8,8,aa8 -*/select * from "testacc" order by 1; -/*e*/insert into "testacc" values (9,9,'aa9000000'); -alter table "testacc" alter column "c" varchar(10); -insert into "testacc" values (9,9,'aa9000000'); -alter table "testacc" alter column "c" set not null -/*e*/insert into "testacc" values (10,10,null); -/*e*/alter table "testacc" alter column "c" set null; -alter table "testacc" drop primary key; -alter table "testacc" alter column "c" set null; -insert into "testacc" values (10,10,null); - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfArithmetic.txt b/database/hsqldb/testrun/hsqldb/TestSelfArithmetic.txt deleted file mode 100644 index 025f677f..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfArithmetic.txt +++ /dev/null @@ -1,28 +0,0 @@ -drop table arith if exists; -create table arith ( inta int, intb int, intc int ); -insert into arith ( inta, intb, intc ) values ( 1, 2, 3 ); -insert into arith ( inta, intb, intc ) values ( 3, 5, 7 ); -insert into arith ( inta, intb, intc ) values ( 7, 11, 13 ); -insert into arith ( inta, intb, intc ) values ( 13, 17, 19 ); - -select inta, intb from arith order by inta; -select inta, inta + intb from arith order by inta; -select inta, inta * intb from arith order by inta; -select inta, inta - intb from arith order by inta; -select inta, ( inta - intb ) * intc from arith order by inta; -select inta, ( inta + intb ) * intc from arith order by inta; -select inta, ( inta - intb ) + intc from arith order by inta; -select inta, ( inta + intb ) + intc from arith order by inta; -select inta, (inta-intb)*intc from arith order by inta; -select inta, (inta+intb)*intc from arith order by inta; -select inta, (inta-intb)+intc from arith order by inta; -select inta, (inta+intb)+intc from arith order by inta; -select inta, intc * ( inta - intb ) from arith order by inta; -select inta, intc * ( inta + intb ) from arith order by inta; -select inta, intc - ( inta + intb ) from arith order by inta; - -drop table arith; - -create table arith ( inta int, intb int, intc int ); -insert into arith ( inta, intb, intc ) values ( 1, 2, 3 ); -select inta, ( inta - intb ) * intc from arith order by inta; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfArrays.txt b/database/hsqldb/testrun/hsqldb/TestSelfArrays.txt deleted file mode 100644 index 3ff5f447..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfArrays.txt +++ /dev/null @@ -1,53 +0,0 @@ -create cached table tarray (id int primary key, description varchar(20) array); -insert into tarray values 1, array['light', 'red', 'hot'] -insert into tarray values 2, array['dark', 'grey', 'cold'] -select * from tarray -select t1.description || t2.description from tarray t1 join tarray t2 on t1.id = t2.id + 1 -select t1.description || t2.description[2] from tarray t1 join tarray t2 on t1.id = t2.id + 1 -select (t1.description || t2.description)[2] from tarray t1 join tarray t2 on t1.id = t2.id + 1 -select max(t1.description[1]) from tarray t1 -select max(t1.description[1]) || min(t1.description[1]) from tarray t1 -select cardinality(t1.description || t2.description) from tarray t1 join tarray t2 on t1.id = t2.id + 1 -update tarray t1 set t1.description[2] = 'cool' where id = 2 -select trim_array(t1.description, 1) from tarray t1 -select trim_array(t1.description, 1)[1] from tarray t1 -select trim_array(t1.description, 1)[1] from tarray t1 - -select * from tarray t1 where t1.id = 2 and t1.description[2] = 'cold' - -CREATE TABLE iarray (i BIGINT PRIMARY KEY, ar INTEGER ARRAY); - -INSERT INTO iarray VALUES (1, array [11, null, 13]); -INSERT INTO iarray VALUES (2, null); -INSERT INTO iarray VALUES 3, array ??(21, 22??); - -/*c3*/SELECT * FROM iarray; - -/*c1*/SELECT count(*) FROM iarray WHERE i = 1 AND ar[3] = 13; - --- using customer and invoice tables defined in TestSelf.txt -select firstname, lastname, a.c from customer, unnest(array[(select sum(total) from invoice where customerid = customer.id)]) a (c) -alter table customer add column arr varchar(40) array -update customer set arr = array[firstname, lastname, street, city] -SELECT id, w, y FROM customer, unnest (arr) with ordinality j(w,y) - -SELECT firstname, lastname, (SELECT SUM(total) FROM invoice WHERE customerid = customer.id) s FROM customer -SELECT firstname, lastname, a.c FROM customer, LATERAL(SELECT SUM(total) FROM invoice WHERE customerid = customer.id) a (c) - --- -/*e*/select * from customer, (select sum(invoice.total) from invoice where invoice.customerid = customer.id) -select * from customer, lateral(select sum(invoice.total) from invoice where invoice.customerid = customer.id) -explain plan for select * from customer where firstname in(unnest(?)) - -create table tour ( id int primary key, name varchar(20) ); -create table golfer ( id int primary key, name varchar(20), tour_id int); -create table stat ( id int primary key, round int, score int, golfer_id int); - -insert into tour values 1, 'PGA' -insert into golfer values 3, 'Woods', 1 -insert into stat values 1000, 1, 5, 3 -insert into stat values 1010, 3, 10, 3 - -/*c1*/select golfer.name, secondstat.score score1, firststat.score score2 from tour join golfer on (tour.id = tour_id and tour.name = 'PGA' ), - lateral(select * from stat where golfer_id = golfer.id order by round desc limit 1 offset 1) secondstat, - lateral(select * from stat where golfer_id = golfer.id order by round desc limit 1) firststat diff --git a/database/hsqldb/testrun/hsqldb/TestSelfCasewhen.txt b/database/hsqldb/testrun/hsqldb/TestSelfCasewhen.txt deleted file mode 100644 index db1d9038..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfCasewhen.txt +++ /dev/null @@ -1,86 +0,0 @@ --- TESTS FOR CASE AND SIMILAR OPERATIONS --- -drop table testcase if exists; -create table testcase(id integer, data varchar(10), filler varchar(10)); -insert into testcase values(100,'xxxx',null); -insert into testcase values(200,'yyyy',null); -insert into testcase values(300,null,null); -/*c2*/select id from testcase where data is not null; -/*r300*/select id from testcase where data is null; -/*rNULLVALUE*/select ifnull(data,'NULLVALUE') from testcase where data is null; -/*rNULLVALUE*/select case data when 'xxxx' then 'X' else 'NULLVALUE' end from testcase where data is null; -SELECT CASE data WHEN 'xxxx' THEN 'X' ELSE (CASE data WHEN 'yyyy' THEN 'Y' ELSE (CASE data WHEN 'zzzz' THEN 'Z' ELSE 'NOTFOUND' END) END) END FROM testcase -SELECT CASE data WHEN 'xxxx' THEN 'X' WHEN 'yyyy' THEN 'Y' WHEN 'zzzz' THEN 'Z' ELSE 'NOTFOUND' END FROM testcase; -/*rALLNULL*/SELECT COALESCE (filler, data, 'ALLNULL') FROM testcase WHERE id = 300; -/*r600.0E0*/select cast (sum(id) as double) from testcase; -/*r600*/select coalesce(sum(id), 0) from testcase; -/*r600*/select abs(coalesce(sum(id), 0)) from testcase; -/*r1*/select case when 1 <0 then sum(10) else 1 end as label from testcase; -/*r30*/select case when 1 < 0 then 1 else sum(10) end as label from testcase; -drop table testcase2 if exists; -create table testcase2(id integer, data varchar(10), filler varchar(10), datecol date); -/*rNULL*/select cast (sum(id) as double) from testcase2; -/*r0*/select coalesce(sum(id), 0) from testcase2; -/*r0*/select abs(coalesce(sum(id), 0)) from testcase2; --- should result in DATE type -/*r2005-10-25*/select coalesce(max(datecol), DATE'2005-10-25') from testcase2; --- error as date type is not comparable to character -/*e*/select coalesce(max(datecol), '2005-10-25') from testcase2; -drop table test if exists; -create table test (sel int, name1 varchar(3), name2 varchar(3)); -insert into test (sel, name1, name2) values (0, 'foo', 'bar') -insert into test (sel, name1, name2) values (1, 'baz', 'foo') -insert into test (sel, name1, name2) values (1, 'foo', 'qux') -select coalesce(a.name1, a.name2) as name,count(a.sel) as counter from test a - group by coalesce(a.name1, a.name2) -select case when a.sel=1 then a.name2 else a.name1 end as name, - count(a.name1) as counter from test a group by case when a.sel=1 - then a.name2 else a.name1 end - -- nested expressions -create table single (c char(1)); -insert into single values('X'); -/*r1*/select case c when 'X' then 1 else 2 end from single; -insert into single values(null); -/*r - X - Y -*/select ifnull(c,'Y') from single -/*r - X - Y -*/select coalesce(c,'Y') from single -/*e*/select coalesce() from single -/*e*/select coalesce(c) from single -/*e*/select ifnull() from single -/*e*/select ifnull(c) from single -insert into single values('Y') -insert into single values('Z') -drop table single; -create table single (c int); -/*rAVG*/select case avg(c) when max(c) then 'MAX' when min(c) then 'MIN' else 'AVG' end from single; -insert into single values(1); -/*r1*/select case avg(c) when max(c) then max(c) when min(c) then min(c) else avg(c) end from single; -insert into single values(2); -insert into single values(3); -/*r2*/select case avg(c) when max(c) then max(c) when min(c) then min(c) else avg(c) end from single; -/*r - 1 - 2 - 3 -*/select * from single order by 1 --- multi-element case when -/*r - one-or-two - one-or-two - three----- -*/select case c when in(0,1,2) then 'one-or-two' when in(0,3,30) then 'three-----' end from single order by 1 -/*r - NULL - NULL - :OK : -*/select ':' || case c when in(0,10,10) then 'WRONG' when in(0,3,34) - then 'OK' end || ':' from single order by 1 - -CREATE TABLE BAB (SALES DOUBLE, COST DOUBLE); -SELECT (SUM(BAB.SALES)-SUM(BAB.COST))/(CASE WHEN (ABS (SUM(BAB.SALES))) = 0 - THEN NULL ELSE (ABS (SUM(BAB.SALES))) END) AS PROFITMARGIN FROM BAB diff --git a/database/hsqldb/testrun/hsqldb/TestSelfCheckConstraints.txt b/database/hsqldb/testrun/hsqldb/TestSelfCheckConstraints.txt deleted file mode 100644 index 0ec2a4ea..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfCheckConstraints.txt +++ /dev/null @@ -1,68 +0,0 @@ -DROP TABLE "Tab" IF EXISTS; -DROP TABLE TC0 IF EXISTS; -DROP TABLE TC1 IF EXISTS; -DROP TABLE TC2 IF EXISTS; -DROP TABLE TC3 IF EXISTS; -DROP TABLE TC4 IF EXISTS; -DROP TABLE TC5 IF EXISTS; -CREATE TABLE "TAB"("a" INT, "b" INT, "c" INT, CONSTRAINT CC CHECK("a" > "b" AND "b">"c")); -/*e*/INSERT INTO TAB VALUES(null,2,3); -INSERT INTO TAB VALUES(2,1,null); -INSERT INTO TAB VALUES(NULL,2,NULL); -INSERT INTO TAB VALUES(NULL,NULL,NULL); -/*e*/ALTER TABLE TAB DROP COLUMN "b"; -ALTER TABLE TAB DROP CONSTRAINT CC; -ALTER TABLE TAB ADD CONSTRAINT CC CHECK ("b" > 0); -ALTER TABLE TAB DROP COLUMN "b" --- - -CREATE TABLE TC0(A INT, B INT, C INT, CHECK(A > B AND B>C)); -CREATE TABLE TC1(A CHAR(10), B CHAR(10), C CHAR(10), CHECK(TRIM(BOTH '*' FROM A) > TRIM(LEADING FROM B))); -CREATE TABLE TC2(A CHAR(10), B CHAR(10), C CHAR(10), CHECK(TRIM(TRAILING '*' FROM A) > UPPER(B))); -CREATE TABLE TC3(A CHAR(10), B CHAR(10), C CHAR(10), CHECK(A LIKE B ESCAPE ';' AND B LIKE 'test%')); -CREATE TABLE TC4(A CHAR(10), B CHAR(10), C CHAR(10), D INT, CHECK(SUBSTRING(A FROM D FOR 3) LIKE C ESCAPE ';')); -CREATE TABLE TC5(A CHAR(10), B CHAR(10), C CHAR(10), D INT, CHECK(A IN (B,C, 'Sunday', 'Monday'))); -INSERT INTO TC5(A,C) VALUES ('Sunday', null); -INSERT INTO TC5(A,C) VALUES ('Today', 'Today'); -INSERT INTO TC5(A,C) VALUES ('Tomorrow', 'Tomorrow'); -/*e*/INSERT INTO TC5(A,C) VALUES ('Yesterday', 'Tomorrow'); -INSERT INTO TC5(A,C) VALUES (null, null); -/*c4*/SELECT * FROM TC5; -ALTER TABLE TC5 DROP COLUMN D -/*c4*/SELECT * FROM TC5; -INSERT INTO TC5(A) VALUES ('Monday'); -UPDATE TC5 SET A='Monday' WHERE B IS NULL; -/*e*/INSERT INTO TC5(A,C) VALUES ('Yesterday', 'Tomorrow'); -/*e*/CREATE TABLE TC6(A CHAR, B CHAR, C CHAR, D INT, CHECK(A IN (SELECT A FROM TC5))); -CREATE TABLE TC6(A INT, CHECK(A IS NULL OR A > 1)); -INSERT INTO TC6(A) VALUES (2); -INSERT INTO TC6(A) VALUES (null); -/*e*/INSERT INTO TC6(A) VALUES (0); -CREATE TABLE TC7(A INT, B TIMESTAMP, CONSTRAINT CH1 CHECK(B < CURRENT_TIMESTAMP)); -INSERT INTO TC7 VALUES (10, '2009-01-01 12:00:00'); -/*e*/INSERT INTO TC7 VALUES (10, '2044-01-01 12:00:00'); -INSERT INTO TC7 VALUES (11, NULL); -SCRIPT --- some type conversion tests -ALTER TABLE TC7 ALTER COLUMN A DECIMAL(6,2); -/*e*/ALTER TABLE TC7 ALTER COLUMN B DATE; -/*r - 10.00,2009-01-01 12:00:00.000000 - 11.00,NULL -*/SELECT * FROM TC7 ORDER BY A; -ALTER TABLE TC7 DROP CONSTRAINT CH1; -ALTER TABLE TC7 ALTER COLUMN B DATE; -/*r - 10.00,2009-01-01 - 11.00,NULL -*/SELECT * FROM TC7 ORDER BY A; -CREATE TABLE TST(A VARCHAR(10),B VARCHAR(10),C VARCHAR(10)) -INSERT INTO TST VALUES ('A','B','C'); -INSERT INTO TST VALUES (NULL,NULL,NULL); -ALTER TABLE TST ADD CONSTRAINT K1 CHECK (CASE WHEN (A IS NULL) THEN - ((B IS NULL) AND (C IS NULL)) ELSE TRUE END ) -/*e*/INSERT INTO TST VALUES (NULL,'B','C'); -INSERT INTO TST VALUES (NULL,NULL,NULL); - - - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfColGrant.txt b/database/hsqldb/testrun/hsqldb/TestSelfColGrant.txt deleted file mode 100644 index 73391d97..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfColGrant.txt +++ /dev/null @@ -1,65 +0,0 @@ --- $Id: TestSelfColGrant.txt 3459 2010-02-12 19:46:33Z fredt $ --- Tests column-specific grants - --- These two users are for sanity tests -/*u0*/CREATE USER privd PASSWORD "privd"; -/*u0*/CREATE USER unprivd PASSWORD "unprivd"; - -/*u0*/CREATE USER u1 PASSWORD "u1"; -/*u0*/GRANT CHANGE_AUTHORIZATION TO u1; -/*u0*/GRANT CHANGE_AUTHORIZATION TO privd; -/*u0*/GRANT CHANGE_AUTHORIZATION TO unprivd; -/*u0*/CREATE TABLE multicol (openc int, closedc int, limitedc int); -/*u1*/INSERT INTO multicol values (1, 2, 3); -/*c1*/SELECT * from multicol; -/*u0*/GRANT ALL ON multicol TO privd; -/*u0*/GRANT SELECT(limitedc) ON multicol TO u1; -/*u0*/GRANT SELECT(openc) ON multicol TO public; -/*u0*/GRANT INSERT(openc) ON multicol TO public; -/*u0*/GRANT UPDATE(openc) ON multicol TO public; - - --- Test col-specific SELECTs -/*u0*/CONNECT USER u1 PASSWORD "u1"; -/*c1*/SELECT openc from multicol; -/*c1*/SELECT limitedc from multicol; -/*e*/SELECT closedc from multicol; -/*e*/UPDATE multicol set limitedc = 4 where openc = 1; - -/*u0*/CONNECT USER privd PASSWORD "privd"; -/*c1*/SELECT openc from multicol; -/*c1*/SELECT limitedc from multicol; -/*c1*/SELECT closedc from multicol; -/*u1*/UPDATE multicol set limitedc = 5 where openc = 1; -/*u0*/CONNECT USER unprivd PASSWORD "unprivd"; -/*e*/SELECT limitedc from multicol; -/*e*/SELECT closedc from multicol; -/*e*/UPDATE multicol set limitedc = 6 where openc = 1; - --- Test col-specific UPDATEs -/*u0*/CONNECT USER u1 PASSWORD "u1"; -/*c1*/SELECT openc from multicol; -/*e*/UPDATE multicol set limitedc = 7 where openc = 1; -/*u0*/CONNECT USER SA PASSWORD ""; -/*u0*/GRANT update(limitedc) ON multicol TO u1; -/*u0*/CONNECT USER u1 PASSWORD "u1"; -/*u1*/UPDATE multicol set limitedc = 7 where openc = 1; - --- Test col-specific INSERTs -/*u0*/CONNECT USER u1 PASSWORD "u1"; -/*e*/INSERT INTO multicol(limitedc) values(10); -/*u0*/CONNECT USER SA PASSWORD ""; -/*u0*/GRANT insert(limitedc) ON multicol TO u1; -/*u0*/CONNECT USER privd PASSWORD "privd"; -/*u1*/INSERT INTO multicol(limitedc) values(11); -/*u0*/CONNECT USER unprivd PASSWORD "unprivd"; -/*e*/INSERT INTO multicol(limitedc) values(12); -/*u0*/CONNECT USER u1 PASSWORD "u1"; -/*u1*/INSERT INTO multicol(limitedc) values(13); - -/*u0*/CONNECT USER SA PASSWORD ""; -/*u0*/DROP USER u1; -/*u0*/DROP USER privd; -/*u0*/DROP USER unprivd; -/*u0*/DROP TABLE multicol; -/*u0*/CHECKPOINT; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfConstraints.txt b/database/hsqldb/testrun/hsqldb/TestSelfConstraints.txt deleted file mode 100644 index 923e9e2f..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfConstraints.txt +++ /dev/null @@ -1,60 +0,0 @@ --- --- TestSelfConstraints.txt --- --- Tests for Constraints --- bug #733940 --- NOT NULL enforcement --- IDENTITY can be set to NULL to be regenerated but other NOT NULL columns can't -CREATE CACHED TABLE THEME (idTheme integer NOT NULL IDENTITY, - libelle VARCHAR(10) CONSTRAINT THEMECOSNT NOT NULL,description VARCHAR(10)); -insert into theme(libelle, description) values('ESSAI', 'ESSAI'); -/*e*/update theme set libelle = null where idtheme = 0; -/*u1*/update theme set idTheme = null where idtheme = 0; -/*u1*/update theme set idTheme = default where idtheme = 1; - --- bug #722442 -create table confignodetype (cnt_nodetypeid numeric(10) not null primary key, - cnt_parentid numeric(10) not null,cnt_name varchar(40) not null, - constraint fk_cnt_parentid foreign key (cnt_parentid) - references confignodetype(cnt_nodetypeid)); -/*u1*/INSERT INTO confignodetype VALUES (-1,-1,'prj'); - --- bug #1114899 -create table mytable(field1 int not null, field2 int); -alter table mytable add constraint pk primary key (field1); -/*e*/alter table mytable add constraint pk foreign key (field2) - references mytable(field1) ; -alter table mytable add constraint fk foreign key (field2) - references mytable(field1) ; -/*u1*/insert into mytable values (0,0); -/*u1*/insert into mytable values (1,1); -/*u1*/insert into mytable values (2,1); -/*u1*/delete from mytable where field1= 2; -/*u1*/delete from mytable where field1= 1; -/*u1*/delete from mytable where field1= 0; -/*r0*/select count(*) from mytable; - -alter table mytable drop constraint fk; -alter table mytable drop constraint pk; -drop table mytable; - --- - -CREATE TABLE "Table3" ("ID" INTEGER NOT NULL,"dd" INTEGER, PRIMARY KEY ("ID")); -ALTER TABLE "Table3" ALTER COLUMN "ID" GENERATED BY DEFAULT AS IDENTITY; -ALTER TABLE "Table3" ALTER COLUMN "ID" INTEGER; -ALTER TABLE "Table3" DROP PRIMARY KEY; -ALTER TABLE "Table3" ADD PRIMARY KEY("dd"); -ALTER TABLE "Table3" ALTER COLUMN "dd" DROP GENERATED; - ---- -create table a ( a_id varchar(32) primary key ); - -create table b ( b_id varchar(32) primary key, - a varchar(33) not null); - -insert into a values ('TESTA'); -insert into b values ('TESTB','TESTA'); - -alter table b add constraint b_fk_a foreign key (a) references a (a_id); -drop table a cascade diff --git a/database/hsqldb/testrun/hsqldb/TestSelfConversions.txt b/database/hsqldb/testrun/hsqldb/TestSelfConversions.txt deleted file mode 100644 index 897f64c8..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfConversions.txt +++ /dev/null @@ -1,18 +0,0 @@ -DROP TABLE T1 IF EXISTS; -CREATE TABLE T1(ID IDENTITY, DT DATE,TI TIME,TS TIMESTAMP); -INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP); -SELECT DAYOFMONTH(DT) FROM T1; -SELECT DAYOFMONTH(TS) FROM T1; -DELETE FROM T1; -INSERT INTO T1 (ID, DT, TI, TS) VALUES (NULL, DATE'2000-11-10', TIME'10:11:12',TIMESTAMP'2000-12-10 10:11:12'); -/*r2000*/SELECT YEAR(TS) FROM T1; -/*r12*/SELECT MONTH(TS) FROM T1; -/*r10*/SELECT DAYOFMONTH(DT) FROM T1; -/*r10*/SELECT DAYOFMONTH(TS) FROM T1; -/*r10-01*/SELECT (DATE'2010-12-20' - DT) YEAR TO MONTH FROM T1; -/*r121*/SELECT (DATE'2010-12-20' - DT) MONTH(4) FROM T1; -/*r9-11*/SELECT (DATE'2010-10-20' - DT) YEAR TO MONTH FROM T1; -/*r9-10*/SELECT (DATE'2010-10-20' - (MAX(DT) + INTERVAL '1' MONTH)) YEAR TO MONTH FROM T1; -/*r249616216198.000000*/SELECT (TIMESTAMP'9910-12-20 00:01:10' - TS) SECOND FROM T1; - -DROP TABLE T1 diff --git a/database/hsqldb/testrun/hsqldb/TestSelfCreate.txt b/database/hsqldb/testrun/hsqldb/TestSelfCreate.txt deleted file mode 100644 index 19f58c01..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfCreate.txt +++ /dev/null @@ -1,164 +0,0 @@ --- --- TestSelfCreate.txt --- - --- TestSelfCreate.txt is used by TestSelf.java to test the database --- --- This is part of a three part suite of scripts to test persistence in the same DB --- --- Comment lines must start with -- and are ignored --- Lines starting with spaces belongs to last line --- Checked lines start with comments containing where is: --- c ResultSet expects a with columns --- r ResultSet expected with result in first row/column --- u Update count expected --- e Exception must occur - --- Correct handling of index creation for foreign keys - -create cached table VEREIN - ( - VCODE CHAR(10) not null, - primary key (VCODE) - ); - --- a no-op -create unique index VEREIN_PK on VEREIN (VCODE); -create cached table BEWERB - ( - VCODE CHAR(10) not null, - ID SMALLINT not null , - primary key (ID) - ); - --- a no-op -create unique index BEWERB_FK2 on BEWERB(ID); --- a no-op -create unique index BEWERB_FK1 on BEWERB(VCODE); -alter table BEWERB add constraint bv foreign key (VCODE) references VEREIN(VCODE); - --- forward FK with index - -CREATE Cached TABLE t1( - ID INTEGER NOT NULL PRIMARY KEY, - t2ref INTEGER - ); - -CREATE Cached TABLE t2( - ID INTEGER NOT NULL PRIMARY KEY - ); -CREATE INDEX idx on t1(t2ref); -ALTER TABLE t1 ADD CONSTRAINT fk1 FOREIGN KEY (t2ref) REFERENCES t2(ID); - --- forward FK with no index - -CREATE Cached TABLE tt1( - ID INTEGER NOT NULL PRIMARY KEY, - tt2ref INTEGER - ); - -CREATE Cached TABLE tt2( - ID INTEGER NOT NULL PRIMARY KEY - ); -ALTER TABLE tt1 ADD CONSTRAINT fk2 FOREIGN KEY (tt2ref) REFERENCES tt2(ID); - --- column default values - scripting test - -CREATE TABLE TDEF1 ( - I1 IDENTITY, C1 CHAR DEFAULT '-', - C2 CHAR(10) DEFAULT 'hsqldb', - I3 INTEGER DEFAULT -1, - D4 DOUBLE DEFAULT -0.3e-5, - T5 TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - T6 TIME DEFAULT current_time, - D7 DATE DEFAULT current_date, - D8 VARCHAR(10) DEFAULT current_user - ); -CREATE TABLE TDEF2 ( - B1 BOOLEAN DEFAULT TRUE, - B2 BOOLEAN DEFAULT 'false', - T5 TIMESTAMP DEFAULT '1999-12-01 21:30:00', - T6 TIME DEFAULT '23:12:01', - T7 DATE DEFAULT '2002-02-15' - ); - - -INSERT INTO TDEF1 (I3) VALUES (0); -INSERT INTO TDEF1 (D4) VALUES (0); -INSERT INTO TDEF2 (B1) VALUES (FALSE); -INSERT INTO TDEF2 (T7) VALUES (NULL); - - ---bug #824031 ---scripting test for order of indexes -CREATE CACHED TABLE APP ( - VARIANT_ID SMALLINT NOT NULL, - APP_ID INTEGER NOT NULL, - APP_NAME VARCHAR (35) NOT NULL, - CONSTRAINT PK_APP PRIMARY KEY( VARIANT_ID)); -CREATE INDEX APP ON APP(APP_ID); -ALTER TABLE APP ADD CONSTRAINT APP_IX1 UNIQUE( APP_NAME); -INSERT INTO APP VALUES (51, 1, 'Shelly'); -INSERT INTO APP VALUES (52, 2, 'Eran'); -/*c1*/SELECT * FROM APP WHERE VARIANT_ID = 51; -/*c1*/SELECT * FROM APP WHERE APP_NAME = 'Shelly'; -/*c1*/SELECT * FROM APP WHERE APP_NAME = 'Eran'; - ---test identity increment -CREATE CACHED TABLE APP2 ( - ID BIGINT NOT NULL IDENTITY, - VALUE INTEGER NOT NULL) - -INSERT INTO APP2 (VALUE) VALUES(10); - ---test update with no primary key -DROP TABLE FILE IF EXISTS; -CREATE TABLE FILE(ID VARCHAR(10), NAME VARCHAR(10), - DESCRIPTION VARCHAR(10), FIELD1 INT, FIELD2 VARCHAR(10)); -/*c0*/select * from file; -insert into file(id, name) values('14', 'dir'); -/*c1*/select * from file; -update file set name = 'newdir' where id = '14'; -/*r - 14,newdir,NULL,NULL,NULL -*/select * from file; - ---test TEMP TABLE - -create TEMPORARY TABLE TTEMP(C CHAR) ON COMMIT PRESERVE ROWS; -create TEMPORARY TABLE TTEMP2(C CHAR) ON COMMIT DELETE ROWS; - ---test VIEW persistence with quoted column names - -create table "TView" ("First Column" int, "Second Column" bigint); - -create view "View" ("Id", "The Name", "The Description") - as select ID,NAME,DESCRIPTION FROM FILE; - -create view "View2" - as select ID,NAME "The Name",DESCRIPTION "The Description" FROM FILE; - -create view "View3" as select "First Column", "Second Column" from "TView"; - ---test inline column check constraints - -create table TCONST (COLA INT UNIQUE CHECK(COLA < 10), COLB INT UNIQUE CHECK(COLB > 10)) - ---test separate identity and primary key - -create table TIDENT (COLA INT PRIMARY KEY, - COLB INT GENERATED BY DEFAULT AS IDENTITY(INCREMENT BY 1 START WITH 0)) -insert into tident values (10, default); -insert into tident values (11, default); -insert into tident values (12, default); -/*e*/insert into tident values (10, default); -/*c3*/select * from tident -/*r - 10,0 - 11,1 - 12,2 -*/select * from tident order by cola --- SHUTDOWN is necessary for test1 - -SHUTDOWN IMMEDIATELY; - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfFKModes.txt b/database/hsqldb/testrun/hsqldb/TestSelfFKModes.txt deleted file mode 100644 index 4b3f29a8..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfFKModes.txt +++ /dev/null @@ -1,239 +0,0 @@ --- CIRCULAR SELF REFERENCING FK --- ON DELETE CASCADE -drop table testB if exists; -create cached table testB(id integer, parent integer, ref integer, - data varchar(200), unique(parent), primary key (id),foreign key (parent) - references testB(id) on delete cascade, foreign key (id) - references testB(parent) on delete cascade); -/*u1*/insert into testB values(100,100,1,'xxxx'); -/*u1*/insert into testB values(200,200,1,'xxxx'); -/*u1*/delete from testB where id=100; -/*r200,200,1,xxxx*/select * from testB --- NORMAL SELF REFERENCING FK --- ON DELETE CASCADE -drop table testB if exists; -create cached table testB(id integer, parent integer, ref integer, - data varchar(200), unique (id), foreign key (parent) - references testB(id) on delete cascade); -/*u1*/insert into testB values(100,100,1,'xxxx'); -/*u1*/insert into testB values(101,100,1,'xxxx'); -/*u1*/insert into testB values(102,100,1,'xxxx'); -/*u1*/insert into testB values(200,200,1,'xxxx'); -/*u1*/delete from testB where id=100; -/*r200,200,1,xxxx*/select * from testB -/*c1*/select * from testB --- ON DELETE SET NULL -drop table testB if exists; -create cached table testB(id integer, parent integer, ref integer, - data varchar(200), unique (id), foreign key (parent) - references testB(id) on delete set null); -/*u1*/insert into testB values(100,100,1,'xxxx'); -/*u1*/insert into testB values(101,100,1,'xxxx'); -/*u1*/insert into testB values(102,100,1,'xxxx'); -/*u1*/insert into testB values(200,200,1,'xxxx'); -/*u1*/delete from testB where id=100; -/*r - 101,NULL,1,xxxx - 102,NULL,1,xxxx - 200,200,1,xxxx -*/select * from testB order by id -/*c2*/select * from testB where parent is null --- ON DELETE SET DEFAULT - -delete from testB; -/*u4*/insert into testB values(100,100,1,'xxxx'), - (101,100,1,'xxxx'), - (102,100,1,'xxxx'), - (200,200,1,'xxxx') - -drop table testB if exists; -create cached table testB(id integer, parent integer default 20, ref integer, - data varchar(200), unique (id),foreign key (parent) - references testB(id) on delete set default); -/*u1*/insert into testB values(20,20,1,'xxxx'); -/*u1*/insert into testB values(100,100,1,'xxxx'); -/*u1*/insert into testB values(101,100,1,'xxxx'); -/*u1*/insert into testB values(200,200,1,'xxxx'); -/*u1*/delete from testB where id=100; -/*r - 20,20,1,xxxx - 101,20,1,xxxx - 200,200,1,xxxx -*/select * from testB order by id -/*c2*/select * from testB where parent=20 --- CHAINED SELF REFERENCING FK --- ON DELETE CASCADE -drop table testA if exists; -create cached table testA(a int primary key,b int, - foreign key(b) references testA(a) on update cascade on delete cascade); -insert into testA(a,b) values(1,1); -insert into testA(a,b) values(2,1); -insert into testA(a,b) values(3,1); -insert into testA(a,b) values(4,2); -insert into testA(a,b) values(5,2); -insert into testA(a,b) values(6,2); -insert into testA(a,b) values(7,3); -insert into testA(a,b) values(8,3); -insert into testA(a,b) values(9,3); -/*u9*/update testA set a = a+1; -/*r3*/select count(*) from testA where b=4; -/*u9*/update testA set a = a-1; -/*r0*/select count(*) from testA where b=4; -/*r3*/select count(*) from testA where b=3; -/*u1*/delete from testA where a=1; -/*r0*/select count(*) from testA; --- bug 870835 --- MIXED SELF AND FORWARD REFERENCE --- UPDATE ISSUE -CREATE CACHED TABLE GroupSubject ( - description VARCHAR(10), - parent BIGINT, - admin BIGINT NOT NULL, - id_ BIGINT, - UNIQUE ( id_ )); -CREATE CACHED TABLE UserSubject ( - subjectName VARCHAR(10) NOT NULL, - id_ BIGINT, - UNIQUE ( id_ ), - PRIMARY KEY ( subjectName )); -ALTER TABLE GroupSubject ADD CONSTRAINT - GroupSubject_REF_parent - FOREIGN KEY ( parent ) - REFERENCES GroupSubject ( id_ ); -ALTER TABLE GroupSubject ADD CONSTRAINT - GroupSubject_REF_admin - FOREIGN KEY ( admin ) - REFERENCES UserSubject ( id_ ); -insert into UserSubject values ('admin', 100); -insert into GroupSubject values (null, null, 100, 200); -/*u1*/update GroupSubject set description = null, - parent = null, admin = 100 where id_ = 200; -/*r - admin,100 -*/select * from UserSubject -/*r - NULL,NULL,100,200 -*/select * from GroupSubject - --- MULTIPLE FK ISSUE -drop table testA if exists; -drop table testB if exists; -drop table testC if exists; -create cached table testA(id integer primary key); -create cached table testB(id integer, foreign key (id) references testA(id) on delete cascade); -create cached table testC(id integer, foreign key (id) references testA(id)); -insert into testA values(1); -insert into testA values(2); -insert into testB values(1); -insert into testB values(2); -insert into testC values(1); -/*e*/delete from testA -/*c2*/select * from testB -/*c1*/select * from testC -/*u1*/delete from testA where id=2 -/*c1*/select * from testA -/*c1*/select * from testB -/*c1*/select * from testC - --- INVALID SET DEFAULT -/*e*/create cached table testE(id integer, foreign key (id) references testA(id) on delete set default); -/*e*/create cached table testE(id integer primary key, idref integer, foreign key (idref) references teste(id) on delete set default); -create cached table testE(id integer primary key, idref integer); -/*e*/alter table testE add foreign key(idref) references testE(id) on delete set default; -alter table testE alter column idref set default 10; -alter table testE add foreign key(idref) references testE(id) on delete set default; -/*e*/alter table testE alter column idref drop default; - --- -drop table testA if exists cascade; -drop table testB if exists; -drop table testC if exists; -create cached table testA(id integer primary key); -create cached table testB(id integer primary key, foreign key (id) references testA(id) on delete cascade); -create cached table testC(id integer primary key, foreign key (id) references testB(id) on delete cascade); -insert into testA values 10 -insert into testB values 10 -insert into testC values 10 -alter table testA add foreign key (id) references testC(id) on delete cascade; -delete from testA -drop table testA if exists cascade; -drop table testB if exists cascade; -drop table testC if exists cascade; --- -create cached table testA(id integer primary key, ref integer, foreign key (ref) references testA(id)); -insert into testA values 10, 10 -insert into testA values 11, 10 -insert into testA values 12, 10 -insert into testA values 13, 12 -delete from testA - -CREATE TABLE user( - USER_ID VARCHAR(15) NOT NULL - ,PASSWD_TX VARCHAR(15) NOT NULL - ,CONSTRAINT user_PK PRIMARY KEY (USER_ID) - ); - -CREATE TABLE role( - ROLE_NM VARCHAR(25) NOT NULL - ,DESC VARCHAR(100) NOT NULL - ,CONSTRAINT role_PK PRIMARY KEY (ROLE_NM) - ); - -CREATE TABLE user_roles( - USER_ID VARCHAR(15) NOT NULL - ,ROLE_NM VARCHAR(25) NOT NULL - ,CONSTRAINT user_roles_PK PRIMARY KEY (USER_ID,ROLE_NM) - ); - -ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_user_0 FOREIGN KEY (USER_ID) REFERENCES user; -ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_role_1 FOREIGN KEY (ROLE_NM) REFERENCES role; - -INSERT INTO user VALUES('JOE_USER', 'secret'); -INSERT INTO role VALUES('SUPERSTAR', 'The best role'); -INSERT INTO role VALUES('ACTUAL_TALENT', 'What there''s a difference?'); - -INSERT INTO user_roles VALUES('JOE_USER', 'SUPERSTAR'); - -UPDATE user SET USER_ID='JOE_USER', PASSWD_TX = 'eat@joes37' WHERE USER_ID = 'JOE_USER' - --- - -create table department (depid identity primary key,depname varchar(20),parentid int) -ALTER TABLE department ADD FOREIGN KEY (parentid) REFERENCES department(depid) -insert into department (depid,depname) values(1,'dep1') -insert into department values(2,'depchild',1) -delete from department - -create table tfk(c char, id int, v varchar(10), primary key(c, id)) -create table tfk2(c char, id int, v varchar(10), - foreign key(id, c) references tfk(id, c)) -insert into tfk values 'f' , 1, 'string 1' -insert into tfk values 'f' , 4, 'string 4' -insert into tfk2 values 'f' , 1, 'string 1' -insert into tfk2 values 'f' , 4, 'string 4' -insert into tfk2 values 'f' , 1, 'string 1' -/*e*/insert into tfk2 values 'e' , 4, 'string 4' - -CREATE CACHED TABLE article_a (id INT PRIMARY KEY, val VARCHAR(20)); -CREATE CACHED TABLE employee_a(id INT PRIMARY KEY, val VARCHAR(20)); -CREATE CACHED TABLE move_a ( - id INTEGER IDENTITY PRIMARY KEY, - employee_id INTEGER, - article_id INTEGER, - batch VARCHAR(10), - source_address VARCHAR(15), - dest_address VARCHAR(15), - quantity DECIMAL(10,2), - done DATETIME, - CONSTRAINT fk_move_article FOREIGN KEY (article_id) REFERENCES article_a (id) ON DELETE CASCADE, - CONSTRAINT fk_move_employee FOREIGN KEY (employee_id) REFERENCES employee_a (id) ON DELETE CASCADE - ); - -CREATE INDEX idx_move_employee ON move_a (employee_id); -CREATE INDEX idx_move_article ON move_a (article_id); -CREATE INDEX idx_move_batch ON move_a (batch); - -INSERT INTO article_a VALUES (10, 'TEN') -INSERT INTO employee_a VALUES (20, 'TWENTY') -INSERT INTO move_a VALUES default, 20, 10, 'test', 'test 1', 'test 2', 20.34, current_date -CREATE INDEX idx_move_done ON move_a (done); diff --git a/database/hsqldb/testrun/hsqldb/TestSelfFieldLimits.txt b/database/hsqldb/testrun/hsqldb/TestSelfFieldLimits.txt deleted file mode 100644 index b5ba5c89..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfFieldLimits.txt +++ /dev/null @@ -1,53 +0,0 @@ --- field limit tests --- works fully with sql.enforce_strict_size --- from 1.8.0.RC9 DECIMAL precision and scale is enforced --- when scale is specified, all input is rounded down to the relevant scale --- precision is then enforced on the result of rounding down -drop table flimit if exists; -create table flimit (charf1 character(4), vcharf1 varchar(4), decf1 decimal(10,2)); -insert into flimit values('one', 'two', 10.2); -/*r - one ,two,10.20 -*/select * from flimit; -/*u1*/delete from flimit; --- to check -/*e*/insert into flimit values('twenty', 'two', 10.2); -/*e*/insert into flimit values('one', 'twenty', 10.2); -insert into flimit values('one', 'two', 99999999.11111); -/*r - one ,two,99999999.11 -*/select * from flimit; -/*r - one ,two,99999999.11 -*/select * from flimit where charf1 in('one','two'); -/*r - one ,two,99999999.11 -*/select * from flimit where charf1 in('one ','two'); -/*r - 99999999 -*/select cast(decf1 as numeric(8)) from flimit; -/*r - 99999999.1100 -*/select cast(decf1 as numeric(12,4)) from flimit; -/*r - one tw,tw -*/select cast((charf1 || vcharf1) as varchar(6)), cast(vcharf1 as varchar(2)) from flimit; -/*e*/insert into flimit values('one', 'two', 999999999.11); -/*e*/insert into flimit values('one', 'two', cast(999999999.11111 as decimal(10,2))); -insert into flimit values('one', 'two', cast(99999999.11111 as decimal(10,2))); -drop table flimit; -create table flimit (a timestamp(0), b timestamp(6), c timestamp); -insert into flimit values('2005-05-21 10:10:10.123456','2005-05-21 10:10:10.123456','2005-05-21 10:10:10.123456'); -/*c0*/select * from flimit where a = b; -/*c0*/select * from flimit where a = c; -/*c1*/select * from flimit where b = c; --- -drop table flimit if exists; -create table flimit (bit1 bit , bit3 bit(3), bitvar bit varying(3)); -/*e*/insert into flimit values(B'1', B'1011', B'101'); -/*e*/insert into flimit values(B'1', B'101', B'1011'); -/*e*/insert into flimit values(B'10', B'101', B'1010'); -/*e*/insert into flimit values(B'1', B'10', B'1010'); -insert into flimit values(B'1', B'101', B'101'); -/*r1101*/select bit1 || bit3 from flimit -/*r101101*/select bit3 || bitvar from flimit diff --git a/database/hsqldb/testrun/hsqldb/TestSelfFunction.txt b/database/hsqldb/testrun/hsqldb/TestSelfFunction.txt deleted file mode 100644 index 3dfeb6b1..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfFunction.txt +++ /dev/null @@ -1,70 +0,0 @@ --- AUXILIAR TABLES + DECLARES -DROP TABLE tt1 IF EXISTS; -DROP TABLE tt2 IF EXISTS; -CREATE Cached TABLE tt1( - ID INTEGER NOT NULL PRIMARY KEY, - tt2ref INTEGER - ); - -CREATE Cached TABLE tt2( - ID INTEGER NOT NULL PRIMARY KEY - ); -ALTER TABLE tt1 ADD CONSTRAINT fk2 FOREIGN KEY (tt2ref) REFERENCES tt2(ID); - --- CREATE SIMPLE FUNCTIONS - INVALID - --- Exception no returns -/*e*/CREATE FUNCTION function_test() - --- Exception no body -/*e*/CREATE FUNCTION function_test() RETURNS INTEGER - BEGIN ATOMIC - END -/*e*/call function_test() -/*e*/DROP FUNCTION function_test - --- Exception - invalid in parameter -/*e*/CREATE FUNCTION function_test(IN value INTEGER) RETURNS INTEGER - RETURNS 10 - --- Exception - not supported OUT parameter -/*e*/CREATE FUNCTION function_test(OUT val INTEGER) RETURNS INTEGER - RETURNS 10 - --- CREATE SIMPLE FUNCTIONS - --- No body -CREATE FUNCTION function_test() RETURNS INTEGER - RETURN 10; -/*r10*/call function_test() -DROP FUNCTION function_test - --- Simple function - IN parameter -CREATE FUNCTION function_test(IN val INTEGER) RETURNS INTEGER - RETURN val + 10; -/*r20*/call function_test(10) -DROP FUNCTION function_test - --- Simple select -CREATE FUNCTION function_test() RETURNS INTEGER - READS SQL DATA - RETURN (SELECT id FROM tt2) -INSERT INTO tt2(ID) VALUES(1); -/*r1*/call function_test() -DROP FUNCTION function_test - -CREATE FUNCTION test( in x INT) - returns table(i INT, v VARCHAR(100)) - READS SQL DATA - begin atomic - declare y int; - set y= x; - return TABLE(select id, firstname from customer where id > y); - end - -call test(10) -/*c50*/select * from table(test(-1)) -create table testtt(i INT, v VARCHAR(100)) -insert into testtt select * from table(test(-1)) -/*c50*/select * from testtt - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfGrantees.txt b/database/hsqldb/testrun/hsqldb/TestSelfGrantees.txt deleted file mode 100644 index c3e54383..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfGrantees.txt +++ /dev/null @@ -1,200 +0,0 @@ -/*e*/CREATE USER public PASSWORD public ADMIN -/*e*/CREATE USER _SYSTEM PASSWORD system ADMIN -/*e*/CREATE USER public PASSWORD public -/*e*/CREATE USER _SYSTEM PASSWORD system -CREATE USER blaine PASSWORD blaine; -/*u0*/GRANT CHANGE_AUTHORIZATION TO blaine; -CREATE USER blaineadm PASSWORD blaineadm ADMIN; -CREATE USER debbie PASSWORD debbie; -DROP TABLE public.t1 IF EXISTS; -CREATE TABLE public.t1 (i int); -INSERT INTO public.t1 VALUES (1); -CREATE USER us3 PASSWORD us3; -/*u0*/GRANT CHANGE_AUTHORIZATION TO us3; - ------------------------------------------------------------------------ --- RESERVED USERS and ROLES --- Test public grants -DROP TABLE t2 IF EXISTS; -CREATE TABLE public.t2 (i int); -INSERT INTO public.t2 VALUES (1); -CONNECT USER us3 PASSWORD us3; -/*e*/SELECT * FROM t2; -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON t2 TO public; -CONNECT USER us3 PASSWORD us3; -/*c1*/SELECT * FROM t2; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON t2 FROM public RESTRICT; -CONNECT USER us3 PASSWORD us3; -/*e*/SELECT * FROM t2; -CONNECT USER sa PASSWORD ""; - --- Prohibit adding/dropping reserved Roles and Users --- _SYSTEM role? -/*e*/DROP ROLE dba; --- Spec says can't create a user or role called "public" -/*e*/DROP USER public password x; -/*e*/DROP USER _system password x; -/*e*/DROP USER dba password x; -/*e*/CREATE ROLE public; -/*e*/CREATE ROLE _system; -/*e*/CREATE ROLE dba; --- We prohibit change the built-in permissions for the DBA group, since --- the role is not persisted. - --- Prohibit grants/revokes for _SYSTEM, DBA -/*e*/GRANT ALL ON public.t1 TO dba; -/*e*/GRANT ALL ON public.t1 TO _system; -/*e*/REVOKE ALL ON public.t1 FROM dba RESTRICT; -/*e*/REVOKE ALL ON public.t1 FROM _system RESTRICT; ------------------------------------------------------------------------ - --- Roles and Users share a namespace -CREATE USER conflict1 PASSWORD conflict1; -/*e*/CREATE ROLE conflict1; -/*u0*/CREATE ROLE conflict2; -/*e*/CREATE USER conflict2 PASSWORD conflict2; --- Can grant a Role but not a user -/*e*/GRANT us3 TO conflict2; - --- Grant and revoke lists for users and roles -GRANT SELECT, UPDATE, DELETE, INSERT ON public.t2 TO conflict1; -GRANT SELECT, UPDATE, DELETE, INSERT ON public.t2 TO conflict2; -REVOKE SELECT, UPDATE, DELETE, INSERT ON public.t2 FROM conflict1 RESTRICT; -REVOKE SELECT, UPDATE, DELETE, INSERT ON public.t2 FROM conflict2 RESTRICT; - --- Wrong right names -/*e*/GRANT SELECT, TABLE, COLUMN ON public.t2 TO conflict1; -/*e*/REVOKE SELECT, TABLE, COLUMN ON public.t2 FROM conflict1 RESTRICT; - --- Roles are not schemas -/*e*/CREATE TABLE dba.x1 (i int); - --- Test global (non-object) permissions of DBA Role -GRANT ALL ON public.t1 TO blaine; -CONNECT USER blaineadm PASSWORD blaineadm; -/*u0*/SET TABLE public.t1 READONLY true; -CONNECT USER blaine PASSWORD blaine; -/*e*/INSERT INTO public.t1 VALUES(1); -/*e*/SET TABLE public.t1 READONLY true; -/*e*/CREATE USER user1 password user1; -/*e*/GRANT dba TO debbie; -CONNECT USER blaineadm PASSWORD blaineadm; -/*u0*/GRANT dba TO blaine; -CONNECT USER blaine PASSWORD blaine; -/*e*/INSERT INTO public.t1 VALUES(1); -/*u0*/SET TABLE public.t1 READONLY false; -/*u1*/INSERT INTO public.t1 VALUES(1); -/*u0*/CREATE USER user1 password user1; -/*u0*/GRANT dba TO debbie; ---CONNECT USER sa PASSWORD ""; -SET SESSION AUTHORIZATION 'SA' -/*u0*/REVOKE dba FROM blaine RESTRICT; -CONNECT USER blaine PASSWORD blaine; -/*e*/SET TABLE public.t1 READONLY true; -/*e*/CREATE USER user2 password user2; -/*e*/REVOKE dba FROM debbie RESTRICT; - --- Test using non-existent roles and re-creating existing roles. -CONNECT USER sa PASSWORD ""; -CREATE USER us1 PASSWORD us1; -/*u0*/GRANT CHANGE_AUTHORIZATION TO us1; -CREATE USER us2 PASSWORD us2; -/*e*/DROP ROLE r1; -/*u0*/CREATE ROLE r1; -/*u0*/GRANT r1 TO us1; -/*u0*/GRANT r1 TO us1; -/*u0*/REVOKE r1 FROM us1 RESTRICT; -/*e*/REVOKE r1 FROM us1 RESTRICT; -/*e*/REVOKE r2 FROM us1 RESTRICT; -/*u0*/DROP ROLE r1; - --- Basics -CONNECT USER blaineadm PASSWORD blaineadm; -/*e*/GRANT ALL ON t1 TO r1; -/*u0*/CREATE ROLE r1; -/*e*/GRANT r1 TO r1; --- us1: no privs -CONNECT USER us1 PASSWORD us1; -/*e*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -GRANT r1 TO us1; --- us1: no privs -CONNECT USER us1 PASSWORD us1; -/*e*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON t1 TO r1; --- us1: t1 rights via role r1 -CONNECT USER us1 PASSWORD us1; -/*c2*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -GRANT dba TO us1; --- us1: DBA + t1 rights via role r1 -CONNECT USER us1 PASSWORD us1; -/*c2*/SELECT * FROM public.t1; -/*u0*/CREATE TABLE us1t1 (i int); -/*u0*/DROP TABLE us1t1; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE dba FROM us1 RESTRICT; --- us1: t1 rights via role r1 -CONNECT USER us1 PASSWORD us1; -/*c2*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r1 FROM us1 RESTRICT; --- us1: no privs -CONNECT USER us1 PASSWORD us1; -/*e*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -/*u0*/GRANT r1 TO us1; --- us1: t1 rights via role r1 -CONNECT USER us1 PASSWORD us1; -/*c2*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE ALL ON t1 FROM r1 RESTRICT; --- us1: no privs -CONNECT USER us1 PASSWORD us1; -/*e*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -/*u0*/GRANT ALL ON t1 TO r1; --- us1: t1 rights via role r1 -CONNECT USER us1 PASSWORD us1; -/*c2*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -/*u0*/DROP ROLE r1; --- us1: no privs -CONNECT USER us1 PASSWORD us1; -/*e*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ''; -/*u0*/GRANT SELECT ON t1 TO us1; --- us1: t1 rights via role table right -CONNECT USER us1 PASSWORD us1; -/*c2*/SELECT * FROM public.t1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE ALL ON t1 FROM us1 RESTRICT; - --- Role nesting -CREATE ROLE r1; -CONNECT USER us1 PASSWORD us1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -GRANT r1 TO us1; -CONNECT USER us1 PASSWORD us1; -/*e*/CREATE TABLE us1t1 (i int); -CONNECT USER sa PASSWORD ""; -GRANT dba TO r1; -CONNECT USER us1 PASSWORD us1; -/*u0*/CREATE TABLE us1t1 (i int); -/*u0*/DROP TABLE us1t1; -CONNECT USER sa PASSWORD ""; -REVOKE dba FROM r1 RESTRICT; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfGroupBy.txt b/database/hsqldb/testrun/hsqldb/TestSelfGroupBy.txt deleted file mode 100644 index 1ae69bef..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfGroupBy.txt +++ /dev/null @@ -1,182 +0,0 @@ -drop table t0 if exists; -create table t0(c varchar(20), i integer, d date); -insert into t0 values ('first', 1, '2000-01-01'); -insert into t0 values ('second', 2, '2000-01-02'); -insert into t0 values ('third', 3, '2000-02-01'); -select year(d), month(d), day(d) from t0; -/*r - 2000,1,1 - 2000,1,2 - 2000,2,1 -*/select year(d) y, month(d) m, day(d) d from t0 group by year(d), month(d), day(d) order by 1, 2, 3; --- -drop table test if exists; -create table test (sel int, name1 varchar(3), name2 varchar(3)); -insert into test (sel, name1, name2) values (0, 'foo', 'bar') -insert into test (sel, name1, name2) values (1, 'baz', 'foo') -insert into test (sel, name1, name2) values (1, 'foo', 'qux') --- select expressions are all composed of columns of group by -/*r - baz,foo,1 - foo,bar,1 - foo,qux,1 -*/select a.name1, a.name2, - count(a.name1) as counter from test a group by sel, name1, name2 order by 1, 2, 3 -/*r - foo,1 - foo,1 - qux,1 -*/select case when a.sel=1 then a.name2 else a.name1 end as name, - count(a.name1) as counter from test a group by sel, name1, name2 - order by 1, 2 --- -/*r - foo,2 - qux,1 -*/select case when a.sel=1 then a.name2 else a.name1 end as name, - count(a.name1) as counter from test a group by case when a.sel=1 - then a.name2 else a.name1 end order by 1, 2 --- -/*r - qux,1 - foo,2 -*/select case when a.sel=1 then a.name2 else a.name1 end as name, - count(a.name1) as counter from test a group by case when a.sel=1 - then a.name2 else a.name1 end order by counter, name --- -select coalesce(a.name1, a.name2) as name,count(a.sel) as counter from test a - group by coalesce(a.name1, a.name2) - -select * from (select case when a.sel=1 then a.name2 else a.name1 end as name, - count(a.name1) as counter from test a group by sel, name1, name2) - - -drop table test; -drop table trades_a if exists; -create table trades_a(opened timestamp, userid int, points int); -CREATE VIEW trades_scores AS SELECT (EXTRACT(YEAR FROM - opened) || '-' || EXTRACT(MONTH FROM opened) || '-' || - EXTRACT(DAY FROM opened)) AS date, userid, SUM(points) - AS score FROM trades_a GROUP BY date, userid - -insert into trades_a values (now, 1, 10); -select * from trades_scores; -drop table trades_a cascade; - --- -drop table PROCESSDETAIL if exists; - -create table PROCESSDETAIL ( - ID bigint not null, - ALERTLEVEL integer not null, - VALUE varchar(255) not null, - TSTAMP timestamp not null, - ATTRIBUTEKEY integer not null, - PROCESSID bigint not null, - primary key (ID) - ); - - --- testdata (not needed to show this problem) -insert into PROCESSDETAIL (ALERTLEVEL, VALUE, TSTAMP, ATTRIBUTEKEY, PROCESSID, ID) - values (1, 66, '2007-01-01 08:00:00', 28, 9, 1); - -insert into PROCESSDETAIL (ALERTLEVEL, VALUE, TSTAMP, ATTRIBUTEKEY, PROCESSID, ID) - values (0, 67, '2007-01-01 07:59:40', 28, 9, 2); - -insert into PROCESSDETAIL (ALERTLEVEL, VALUE, TSTAMP, ATTRIBUTEKEY, PROCESSID, ID) - values (0, 67, '2007-01-01 06:59:40', 28, 9, 3); - -select * from PROCESSDETAIL t1 where - exists ( - select - t2.PROCESSID, - t2.ATTRIBUTEKEY - from - PROCESSDETAIL t2 - where - t2.PROCESSID=t1.PROCESSID - and t2.ATTRIBUTEKEY=t1.ATTRIBUTEKEY - and t2.PROCESSID=9 - and t2.TSTAMP<='2007-01-01 08:00:00' - group by - t2.PROCESSID , - t2.ATTRIBUTEKEY - having - max(t2.TSTAMP)=t1.TSTAMP); - -select case when 1<0 then 1 else sum(10) end as res from processdetail; - -DROP TABLE T1 IF EXISTS -DROP TABLE T2 IF EXISTS -CREATE TABLE T1 (COL1 INT, COL2 INT) -CREATE TABLE T2 (COLA INT, COL2 INT, COLC INT, COLD DATETIME) - -INSERT INTO T1 VALUES (101, 201) -INSERT INTO T1 VALUES (102, 201) -INSERT INTO T1 VALUES (103, 202) -INSERT INTO T1 VALUES (106, 202) -INSERT INTO T1 VALUES (104, 203) -INSERT INTO T1 VALUES (105, 203) - -INSERT INTO T2 VALUES (1001, 101, 101, '2007-08-10 10:00:00.0') -INSERT INTO T2 VALUES (1002, 102, 101, '2007-08-10 10:00:00.0') -INSERT INTO T2 VALUES (1003, 103, 101, '2007-08-10 10:00:00.0') -INSERT INTO T2 VALUES (1004, 104, 101, '2007-08-10 10:00:00.0') -INSERT INTO T2 VALUES (1004, 105, 101, '2007-08-10 10:00:00.0') - -SELECT T1A.COL1, T2A.COLA, MIN(T1A.COL2) AS COL2 FROM - T1 T1A INNER JOIN T2 T2A ON T1A.COL2 = T2A.COL2 - WHERE T2A.COLD = - (SELECT MIN(T2B.COLD) FROM - T1 T1B INNER JOIN T2 T2B ON T1B.COL2 = T2B.COL2 - WHERE T1A.COL1 = T1B.COL1 AND T2A.COLA = T2B.COLA AND T2A.COLC = T2B.COLC) - GROUP BY - T1A.COL1, T2A.COLA - -CREATE TABLE DATE_TEST (DATECOL DATE) - -INSERT INTO DATE_TEST VALUES ('2006-01-01') -INSERT INTO DATE_TEST VALUES ('2007-01-01') -INSERT INTO DATE_TEST VALUES ('2008-01-01') - -SELECT * FROM DATE_TEST -SELECT * FROM DATE_TEST WHERE DATECOL > '2007-01-01' -SELECT * FROM DATE_TEST GROUP BY DATECOL HAVING DATECOL > '2007-01-01' -SELECT MAX(DATECOL) FROM DATE_TEST HAVING MAX(DATECOL) > '2007-01-01' - -create table hist (mydate date, files int, space int); -insert into hist values (current_date, 1, 10); -select SUBSTR(CAST (MYDATE AS VARCHAR(20)),1,10), SUM(FILES), SUM(SPACE) - from hist - group by SUBSTR(CAST (MYDATE AS VARCHAR(20)),1,10) - ---- -CREATE TABLE group_by_bug - ( order_id INTEGER NOT NULL - , item_id INTEGER NOT NULL - , price FLOAT NOT NULL - , tax_rate FLOAT NOT NULL - , quantity INTEGER NOT NULL ); - -INSERT INTO group_by_bug ( order_id, item_id, price, tax_rate, quantity ) - VALUES ( 1000, 100, 10, 10, 5 ); -INSERT INTO group_by_bug ( order_id, item_id, price, tax_rate, quantity ) - VALUES ( 1001, 100, 10.45, 15, 3 ); - -/*r - 100,9.09E0,8 -*/SELECT item_id, ROUND(price / (1+(tax_rate/100)),2) AS price_net, - SUM(quantity) AS quantity - FROM group_by_bug - GROUP BY item_id, ROUND(price / (1+(tax_rate/100)),2) - -/*r - 100,9.09E0,8 -*/SELECT item_id, ROUND(price / (1+(tax_rate/100)),2) AS price, SUM(quantity) - AS quantity - FROM group_by_bug - GROUP BY item_id, ROUND(price / (1+(tax_rate/100)),2) - -SHUTDOWN COMPACT; - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfImmediateShutdown.txt b/database/hsqldb/testrun/hsqldb/TestSelfImmediateShutdown.txt deleted file mode 100644 index 70aad9b1..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfImmediateShutdown.txt +++ /dev/null @@ -1,30 +0,0 @@ -SET AUTOCOMMIT FALSE; -CREATE TABLE TABLE1(USER_ID INT NOT NULL PRIMARY KEY ); -INSERT INTO TABLE1 (USER_ID) VALUES (1); -INSERT INTO TABLE1 (USER_ID) VALUES (2); -INSERT INTO TABLE1 (USER_ID) VALUES (3); -INSERT INTO TABLE1 (USER_ID) VALUES (4); -CREATE TABLE TABLE2(USER_ID INT NOT NULL, COLUMN2 SMALLINT DEFAULT 0 NOT NULL, - COLUMN3 CHARACTER(10) DEFAULT 'TEST') ; -ALTER TABLE TABLE2 ADD CONSTRAINT USER_FK FOREIGN KEY (USER_ID) REFERENCES TABLE1(USER_ID); -CREATE INDEX USER_FK ON TABLE2(USER_ID); -INSERT INTO TABLE2 (USER_ID) VALUES ( 1 ) ; -INSERT INTO TABLE2 (USER_ID) VALUES ( 2 ) ; -INSERT INTO TABLE2 (USER_ID) VALUES ( 3 ) ; -INSERT INTO TABLE2 (USER_ID) VALUES ( 4 ) ; -UPDATE TABLE2 SET COLUMN2=15 WHERE USER_ID=3; -COMMIT; -/*c4*/SELECT * FROM TABLE1; -/*c4*/SELECT * FROM TABLE2; -/*c1*/SELECT * FROM TABLE2 WHERE COLUMN2=15; - --- bug #1110517 -DROP TABLE FILE2 IF EXISTS; -CREATE TABLE FILE2(ID VARCHAR(10) PRIMARY KEY,NAME - VARCHAR(10),DESCRIPTION VARCHAR(10), field1 INT, field2 - VARCHAR(10)); --- DESCRIPTION must be NULL -/*u1*/insert into file2(id, name) values('14', 'dir'); -/*u1*/update file2 set name = 'newdir' where id = '14'; -COMMIT; -SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfImmediateShutdownRecover.txt b/database/hsqldb/testrun/hsqldb/TestSelfImmediateShutdownRecover.txt deleted file mode 100644 index 499f51fd..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfImmediateShutdownRecover.txt +++ /dev/null @@ -1,6 +0,0 @@ -/*c4*/SELECT * FROM TABLE1; -/*c4*/SELECT * FROM TABLE2; -/*c1*/SELECT * FROM TABLE2 WHERE COLUMN2=15; --- bug #1110517 -/*rnewdir*/SELECT NAME FROM FILE2; -DROP TABLE FILE2; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfInPredicateReferencing.txt b/database/hsqldb/testrun/hsqldb/TestSelfInPredicateReferencing.txt deleted file mode 100644 index 077bead8..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfInPredicateReferencing.txt +++ /dev/null @@ -1,215 +0,0 @@ -DROP TABLE dups IF EXISTS; -CREATE TABLE dups(pk INTEGER NOT NULL PRIMARY KEY,val VARCHAR(10) NOT NULL); -INSERT INTO dups VALUES (1, 'first'); -INSERT INTO dups VALUES (2, 'second'); -INSERT INTO dups VALUES (3, 'third'); -INSERT INTO dups VALUES (4, 'first'); -INSERT INTO dups VALUES (5, 'first'); -INSERT INTO dups VALUES (6, 'second'); -SELECT a.pk, a.val FROM dups a WHERE a.pk in (SELECT sa.pk FROM dups sa, dups sb WHERE sa.val=sb.val AND sa.pk!=sb.pk); -SELECT sa.pk FROM dups sa, dups sb WHERE sa.val=sb.val AND sa.pk!=sb.pk; -/*c5*/SELECT a.pk, a.val FROM dups a WHERE a.pk IN (1, 2, 4, 5, 6); -/*c2*/SELECT a.pk, a.val FROM dups a WHERE (a.pk, a.val) IN ((1, 'first'), (5, 'first')); - --- IN with nulls -/*c0*/SELECT * FROM dups WHERE null IN (1, 2) -/*c0*/SELECT * FROM dups WHERE null IN (null, 2) -/*c0*/SELECT * FROM dups WHERE null IN (null, 2) -/*E*/SELECT * FROM dups WHERE null IN (null, null) -/*c0*/SELECT * FROM dups WHERE cast(null AS INT) IN (null, null) -/*c1*/SELECT * FROM dups WHERE pk IN (null, 1) -/*c0*/SELECT * FROM dups WHERE pk IN (null, null) - --- ALL -/*r - 1,first - 4,first - 5,first -*/SELECT a.pk, a.val FROM dups a WHERE a.val = - ALL(SELECT sa.val FROM dups sa WHERE sa.val = 'first') ORDER BY a.pk; -/*r - 1,first - 2,second - 3,third - 4,first - 5,first - 6,second -*/SELECT a.pk, a.val FROM dups a WHERE a.val >= ALL(SELECT sa.val FROM dups sa WHERE sa.val = 'first') ORDER BY a.pk; -/*r - 2,second - 3,third - 6,second -*/SELECT a.pk, a.val FROM dups a WHERE a.val > ALL(SELECT sa.val FROM dups sa WHERE sa.val = 'first') ORDER BY a.pk; -/*r - 1,first - 2,second - 4,first - 5,first - 6,second -*/SELECT a.pk, a.val FROM dups a WHERE a.val - <= ALL(SELECT sa.val FROM dups sa WHERE sa.val = 'second') ORDER BY a.pk; -/*r - 1,first - 2,second - 4,first - 5,first - 6,second -*/SELECT a.pk, a.val FROM dups a WHERE a.val - < ALL(SELECT sa.val FROM dups sa WHERE sa.val = 'third') ORDER BY a.pk; - -/*r - 1,first - 4,first - 5,first -*/SELECT a.pk, a.val FROM dups a WHERE a.val - <= ALL(SELECT sa.val FROM dups sa) ORDER BY a.pk; - --- ANY - -/*r - 1,first - 2,second - 4,first - 5,first - 6,second -*/SELECT a.pk, a.val FROM dups a WHERE a.val - < ANY(SELECT sa.val FROM dups sa) ORDER BY a.pk; - -/*r - 2,second - 3,third - 6,second -*/SELECT a.pk, a.val FROM dups a WHERE a.val - > ANY(SELECT sa.val FROM dups sa) ORDER BY a.pk; - -/*r - 1,first - 2,second - 3,third - 4,first - 5,first - 6,second -*/SELECT a.pk, a.val FROM dups a WHERE a.val - <= ANY(SELECT sa.val FROM dups sa) ORDER BY a.pk; - -/*c0*/SELECT a.pk, a.val FROM dups a WHERE a.val - <= ANY(SELECT CAST(NULL AS CHAR) FROM dups sa) ORDER BY a.pk; - -/*E*/SELECT a.pk, a.val FROM dups a WHERE a.val - <= ANY(SELECT NULL FROM dups sa) ORDER BY a.pk; - -/*c0*/SELECT a.pk, a.val FROM dups a WHERE a.val - <= ANY(SELECT CAST(NULL AS CHAR) FROM dups sa WHERE sa.val ='fourth') ORDER BY a.pk; - -/*E*/SELECT a.pk, a.val FROM dups a WHERE a.val - <= ANY(SELECT NULL FROM dups sa WHERE sa.val ='fourth') ORDER BY a.pk; - --- non-correlated single value -/*r - 1,first - 4,first - 5,first -*/SELECT a.pk, a.val FROM dups a WHERE a.val - = (SELECT sa.val FROM dups sa WHERE sa.pk = 4) ORDER BY a.pk; --- bug item #1100384 -drop table a if exists; -drop table b if exists; -drop table m if exists; -create table a(a_id integer); -create table b(b_id integer); -create table m(m_a_id integer, m_b_id integer); -insert into a(a_id) values(1); -insert into b(b_id) values(10); -insert into m(m_a_id, m_b_id) values(1, 5); -insert into m(m_a_id, m_b_id) values(1, 10); -insert into m(m_a_id, m_b_id) values(1, 20); -/*r1,10*/select a.a_id, b.b_id from a, b - where a.a_id in (select m.m_a_id from m where b.b_id = m.m_b_id); -/*r1,10*/select a.a_id, b.b_id from a join b on - a.a_id in (select m.m_a_id from m where b.b_id = m.m_b_id); -/*u1*/update m set m_a_id = 2 where m_b_id in (1, 10, 100); -/*r - 1,5 - 2,10 - 1,20 -*/select * from m order by m_b_id - --- -DROP TABLE T IF EXISTS; -CREATE TABLE T(C VARCHAR_IGNORECASE(10)); -INSERT INTO T VALUES ('felix'); -/*r - felix -*/SELECT * FROM T WHERE C IN ('Felix', 'Feline'); -/*c0*/SELECT * FROM T WHERE C IN ('Pink', 'Feline'); -DROP TABLE T; -CREATE TABLE T(C CHAR(10)); -INSERT INTO T VALUES ('felix'); -/*c1*/SELECT * FROM T WHERE C IN ('felix', 'pink'); -DROP TABLE T; - --- -create table t (c1 int, c2 int, primary key(c2, c1)) -insert into t values (10, 20), (11, 21), (21, 32) -/*r - 11,21 -*/select * from t where (c1, c2) in ((11, 21)) -/*r - 11,21 -*/select * from t where (c2, c1) in ((21, 11)) - -update t set c2 = 31 where (c2, c1) in ((21, 11)) --- -drop table if exists test_trips; -drop table if exists test_routes; -create table test_routes (agencyId varchar(50) not null, id varchar(255) - not null, primary key (agencyId, id)); -create table test_trips (agencyId varchar(50) not null, id varchar(255) not - null, route_agencyId varchar(50), route_id varchar(255), primary key - (agencyId, id)); -alter table test_trips add constraint test_trips_routes foreign key - (route_agencyId, route_id) references test_routes; -insert into test_routes (agencyId, id) values ('a','r1'),('a','r2'); -insert into test_trips (agencyId, id,route_agencyId,route_id) values - ('a','1','a','r1'),('a','2','a','r2'); -/*c1*/select * from test_trips where (route_agencyId, route_id) in (('a','r1')); -/*c2*/select * from test_trips where (route_agencyId, route_id) in (values('a','r1'), ('a','r2')); - -create table inv_txn (id bigint primary key, inv_account_target bigint); -create table inv_element (id bigint primary key, inv_txn bigint, product bigint, quantity bigint); - -insert into inv_txn values (1, 1); -insert into inv_txn values(2, 2); - -insert into inv_element values (1, 1, 1, 25); -insert into inv_element values (2, 1, 1, 10); -insert into inv_element values (3, 1, 2, 15); -insert into inv_element values (4, 1, 2, 5); -insert into inv_element values (5, 1, 3, 50); -insert into inv_element values (6, 1, 3, 30); -insert into inv_element values (7, 1, 4, 5); -insert into inv_element values (8, 1, 4, 15); -insert into inv_element values (9, 1, 5, 100); -insert into inv_element values (10, 1, 6, 75); -insert into inv_element values (11, 2, 1, 25); -insert into inv_element values (12, 2, 1, 10); -insert into inv_element values (13, 2, 2, 15); -insert into inv_element values (14, 2, 2, 5); -insert into inv_element values (15, 2, 3, 50); -insert into inv_element values (16, 2, 3, 30); -insert into inv_element values (17, 2, 4, 5); -insert into inv_element values (18, 2, 4, 15); -insert into inv_element values (19, 2, 5, 100); -insert into inv_element values (20, 2, 6, 75); --- query must show the same values in columns using equality or IN predicates -select - inv_element.product, - sum(casewhen(inv_txn.inv_account_target in (1), quantity, 0)) as badtarget1qty, - sum(casewhen(inv_txn.inv_account_target = 1, quantity, 0)) as goodtarget1qty, - sum(casewhen(inv_txn.inv_account_target in (2), quantity, 0)) as badtarget2qty, - sum(casewhen(inv_txn.inv_account_target = 2, quantity, 0)) as goodtarget2qty, - sum(casewhen(inv_txn.inv_account_target in (1, 2), quantity, 0)) as badtotalqty, - sum(casewhen(inv_txn.inv_account_target = 1 or inv_txn.inv_account_target = 2, quantity, 0)) as goodtotalqty - from inv_txn - inner join inv_element on inv_txn.id = inv_element.inv_txn - group by product; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfInsertDeleteQueries.txt b/database/hsqldb/testrun/hsqldb/TestSelfInsertDeleteQueries.txt deleted file mode 100644 index 3a4ee661..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfInsertDeleteQueries.txt +++ /dev/null @@ -1,75 +0,0 @@ --- --- TestSelfInsertDeleteQueries.txt --- --- Parser tests for insert and delete queries --- -drop table testtable if exists cascade - -create cached table testtable ( - aString varchar(256) not null, - firstNum integer not null, - aDate date not null, - secondNum integer not null, - thirdNum integer not null, - aName varchar(32) not null - ); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Current', 22, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Popular', 23, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('New', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Old', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('CCurrent', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('ELV', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('ELNA', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Older', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('RA', 20, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('RP', 2, '2003-11-10', 18, 3, 'my name goes here'); - -insert into TESTTABLE values ('VS', 3, '2003-11-10', 18, 3, 'my name goes here'); --- -/*c11*/select * from testtable where adate = '2003-11-10' and secondNum = 18; -/*c11*/select * from testtable where adate = '2003-11-10'; -/*c1*/select * from testtable where adate = '2003-11-10' and firstNum = 20; -/*c11*/select * from testtable where adate = '2003-11-10' and thirdNum = 3; - -delete from TESTTABLE; - -insert into testtable values - ('Current', 22, '2003-11-10', 18, 3, 'my name goes here'), - ('Popular', 23, '2003-11-10', 18, 3, 'my name goes here'), - ('New', 5, '2003-11-10', 18, 3, 'my name goes here'), - ('Old', 5, '2003-11-10', 18, 3, 'my name goes here') - -/*c4*/select * from testtable; - -update testtable set (astring, firstnum, adate, secondnum, thirdnum, aname) = - ('Older', 5, '2003-11-10', 18, 3, 'my name goes here') - where astring = 'Old' --- - -create table tt (col varchar(256)); -insert into tt (col) select aString from testtable; -insert into tt (col) select aString from testtable union select aName from testtable; -insert into tt (col) (select aString from testtable union select aName from testtable); -insert into tt (col) - ((select aString from testtable union select aName from testtable) - intersect select aString from testtable where firstNum = 20); - -insert into tt select aString from testtable; -insert into tt select aString from testtable union select aName from testtable; -insert into tt (select aString from testtable union select aName from testtable); -insert into tt - ((select aString from testtable union select aName from testtable) - intersect select aString from testtable where firstNum = 20); - -drop table tt; -drop table testtable; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfInsteadOfTriggers.txt b/database/hsqldb/testrun/hsqldb/TestSelfInsteadOfTriggers.txt deleted file mode 100644 index 07bd4a17..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfInsteadOfTriggers.txt +++ /dev/null @@ -1,62 +0,0 @@ -drop table testtrig12 if exists; -drop table testtrig13 if exists; -create cached table testtrig12(id integer, data2 varchar(20), updated date); -create cached table testtrig13(id integer, data3 varchar(20), op varchar(10)); -create view viewinst (vid, vdata2, vdata3) as select id, data2, data3 from testtrig12 natural join testtrig13 -create trigger trigger2 instead of insert on viewinst - referencing new row as newrow - for each row - begin atomic - insert into testtrig12 values(newrow.vid, newrow.vdata2, current_date); - insert into testtrig13 values (newrow.vid, newrow.vdata3, 'inserted'); - end - -create trigger trigger3 instead of delete on viewinst - referencing old row as oldrow - for each row - begin atomic - delete from testtrig12 where testtrig12.id = oldrow.vid; - delete from testtrig13 where testtrig13.id = oldrow.vid; - end - -create trigger trigger14 instead of update on viewinst - referencing old row as oldrow new row as newrow - for each row - begin atomic - update testtrig12 set data2 = newrow.vdata2, updated = current_date where testtrig12.id = oldrow.vid; - update testtrig13 set data3 = newrow.vdata3, op = 'updated' where testtrig13.id = oldrow.vid; - end - -insert into viewinst values (1, 'data2 value1', 'data3 value1') -insert into viewinst values (2, 'data2 value2', 'data3 value2') - -/*r - 1,data2 value1,data3 value1,inserted - 2,data2 value2,data3 value2,inserted -*/select id, data2, data3, op from testtrig12 natural join testtrig13 order by id - -/*r - 1,data3 value1,inserted - 2,data3 value2,inserted -*/select * from testtrig13 order by id - -update viewinst set vdata2='data2 updated1', vdata3='data3 updated1' where vid=1 - -/*r - 1,data2 updated1,data3 updated1,updated - 2,data2 value2,data3 value2,inserted -*/select id, data2, data3, op from testtrig12 natural join testtrig13 order by id - -delete from viewinst -/*c0*/select * from viewinst -/*c0*/select * from testtrig12 -/*c0*/select * from testtrig13 - -drop view V_TAB1 if exists; -drop table TAB1 if exists; -create table TAB1 (T1_ID bigint primary key, T1_NAME VARCHAR(10)); -create view V_TAB1 as select T.T1_ID as ID, T.T1_NAME as NAME from TAB1 T; -create trigger TR_INS_V_T1 INSTEAD OF INSERT ON V_TAB1 referencing new row as NEWROW for each row insert into TAB1 (T1_ID, T1_NAME) values (NEWROW.ID, NEWROW.NAME); -create trigger TR_UPD_V_T1 INSTEAD OF UPDATE ON V_TAB1 referencing new row as NEWROW for each row update TAB1 set T1_NAME = NEWROW.NAME where T1_ID = newrow.ID; -insert into V_TAB1 (ID, NAME) values (1, 'Name 1'); -update V_TAB1 set NAME = 'Name 11' where ID = 1; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfInternalFunctions.txt b/database/hsqldb/testrun/hsqldb/TestSelfInternalFunctions.txt deleted file mode 100644 index 0488a2c4..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfInternalFunctions.txt +++ /dev/null @@ -1,16 +0,0 @@ -/*rXXX*/call trim(' XXX '); -/*rXXX*/call trim(FROM ' XXX '); -/*rXXX*/call trim(BOTH FROM ' XXX '); -/*rXXX*/call trim(BOTH ' ' FROM ' XXX '); -/*e*/call trim(BOTH FROM); -/*rXXX*/call substring( ' XXX ' from 2 for 3); -/*rXXX*/call substring( ' XXX' from 2); -/*rXXXX*/call overlay( 'YYY' placing 'XXXX' from 1 for 3); -/*rYXXYY*/call overlay( 'YYYYYY' placing 'XX' from 2 for 3); -/*rXYY*/call overlay( 'YYY' placing 'X' from 1); -/*rYXY*/call overlay( 'YYY' placing 'X' from 2); -/*r0109090405*/call overlay( x'0102030405' placing x'0909' from 2); -call current_timestamp; -call current_timestamp(1); -call current_time; -call current_time(6); diff --git a/database/hsqldb/testrun/hsqldb/TestSelfInterval.txt b/database/hsqldb/testrun/hsqldb/TestSelfInterval.txt deleted file mode 100644 index 347915c3..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfInterval.txt +++ /dev/null @@ -1,57 +0,0 @@ --- TESTS FOR DATETIME AND INTERVAL -/*r - 1999-12-31 00:00:00.900000 -*/CALL TIMESTAMP '2000-01-01 02:02:03.000000' - INTERVAL '01 02:02:02.1' DAY TO SECOND; -/*r - 1999-12-31 00:00:00.000000 -*/CALL TIMESTAMP '2000-01-01 02:02:02.123456' - INTERVAL '01 02:02:02.123456' DAY TO SECOND(6); -/*e*//CALL TIMESTAMP(6) '2000-01-01 02:02:02.123456'; -/*r - 1999-12-31 00:00:00.023456 -*/CALL TIMESTAMP '2000-01-01 02:02:02.123456' - INTERVAL '01 02:02:02.10' DAY TO SECOND; -/*r - 1999-12-31 00:00:00.020 -*/CALL TIMESTAMP '2000-01-01 02:02:02.120' - INTERVAL '01 02:02:02.10' DAY TO SECOND; -/*r - -0 00:01:00.0 -*/CALL INTERVAL '01 02:02:02.1' DAY TO SECOND - INTERVAL '01 02:03:02.1' DAY TO SECOND; -/*r - 1 02:02:00.02000000 -*/CALL INTERVAL '01 02:02:02.12' DAY(3) TO SECOND(8) - INTERVAL '02.1' SECOND(2,3); -/*r - 1 02:02:00.0 -*/CALL INTERVAL '01 02:02:02.12345' DAY(2) TO SECOND(1) - INTERVAL '02.1' SECOND(2,1); -/*r - 1 00:00:00.000000 -*/CALL (TIMESTAMP '2000-01-02 02:02:03.000000' - TIMESTAMP '2000-01-01 02:02:03.000000') DAY TO SECOND; - -/*r - 1 00:00:00.180000 -*/CALL (TIMESTAMP '2000-01-02 02:02:03.2' - TIMESTAMP '2000-01-01 02:02:03.02') DAY TO SECOND; -/*r - 1 -*/CALL TIMESTAMPDIFF(SQL_TSI_YEAR, TIMESTAMP '2002-01-02 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 4 -*/CALL TIMESTAMPDIFF(SQL_TSI_QUARTER, TIMESTAMP '2002-01-02 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 12 -*/CALL TIMESTAMPDIFF(SQL_TSI_MONTH, TIMESTAMP '2002-01-02 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 52 -*/CALL TIMESTAMPDIFF(SQL_TSI_WEEK, TIMESTAMP '2002-01-02 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 364 -*/CALL TIMESTAMPDIFF(SQL_TSI_DAY, TIMESTAMP '2002-01-02 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 8760 -*/CALL TIMESTAMPDIFF(SQL_TSI_HOUR, TIMESTAMP '2002-01-01 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 525600 -*/CALL TIMESTAMPDIFF(SQL_TSI_MINUTE, TIMESTAMP '2002-01-01 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 31536000 -*/CALL TIMESTAMPDIFF(SQL_TSI_SECOND, TIMESTAMP '2002-01-01 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') -/*r - 31536000180000000 -*/CALL TIMESTAMPDIFF(SQL_TSI_FRAC_SECOND, TIMESTAMP '2002-01-01 02:02:03.02', TIMESTAMP '2003-01-01 02:02:03.2') diff --git a/database/hsqldb/testrun/hsqldb/TestSelfIssues.txt b/database/hsqldb/testrun/hsqldb/TestSelfIssues.txt deleted file mode 100644 index 4ad9c86c..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfIssues.txt +++ /dev/null @@ -1,134 +0,0 @@ --- --- TestSelfIssues.txt --- --- Tests demonstrating remaining issues --- --- bug #901313 - fixed - subselect results in error when it returns no rows --- corrected for 1.8.0 RC10 - scalar subquery should return null if no rows are returned -drop table table2 if exists; -drop table table1 if exists; -create table table1 (col1 integer not null, col2 integer not null); -create table table2 (col1 integer, col2 integer); -insert into table1 (col1, col2) values (1, 1) -insert into table1 (col1, col2) values (2, 2) -insert into table2 (col1, col2) values (1, 3) -insert into table2 (col1, col2) values (2, 4) -/*c2*/select t1.col1, t1.col2, t2.col2 from table1 t1, table2 t2 where t1.col1 = t2.col1 -/*u2*/update table2 set col2=(select table1.col2 from table1 where table1.col1 = table2.col1) -/*c2*/select t1.col1, t1.col2, t2.col2 from table1 t1, table2 t2 where t1.col1 = t2.col1 -/*u1*/insert into table2 (col1, col2) values (null, 5) -/*u3*/update table2 set col2=(select table1.col2 from table1 where table1.col1 = table2.col1) --- support for aliases in UPDATE has been added -/*u3*/update table2 b set col2 = (select a.col2 from table1 a where a.col1 = b.col1) -/*c2*/select t1.col1, t1.col2, t2.col2 from table1 t1, table2 t2 where t1.col1 = t2.col1 --- query returns only rows for which the correlated subquery returns a value -/*c3*/select table2.col2,(select table1.col2 from table1 where table1.col1 = table2.col1) from table2 --- add row so that subquery returns two rows -/*u1*/insert into table1 (col1, col2) values (1, 6) -/*e*/select table2.col2,(select table1.col2 from table1 where table1.col1 = table2.col1) from table2 - --- reported bug - fixed - first bigint in value list was ignored -DROP TABLE T IF EXISTS; -CREATE TABLE T(A BIGINT); -INSERT INTO T VALUES(7223955391172290801); -INSERT INTO T VALUES(8124225344737252039); -INSERT INTO T VALUES(8112873400132257948); -INSERT INTO T VALUES(100); -/*c4*/SELECT * FROM T WHERE A IN - (7223955391172290801,8124225344737252039,8112873400132257948,100); --- check with different types -/*c4*/SELECT * FROM T WHERE A IN - (7223955391172290801,8124225344737252039,8112873400132257948,100.00E0); - --- reported bug - fixed - TRUE and FALSE in conditions -/*c4*/SELECT * FROM T WHERE A IN - (7223955391172290801,8124225344737252039,8112873400132257948,100) AND TRUE; - -/*c0*/SELECT * FROM T WHERE A IN - (7223955391172290801,8124225344737252039,8112873400132257948,100) AND FALSE; - --- demonstration of contatenation from Blaine -CREATE TABLE tsttbl( - id IDENTITY, - FirstName VARCHAR(10), - MiddleName VARCHAR(10), - LastName VARCHAR(10), - CommonLink VARCHAR(20) - ); -INSERT INTO tsttbl(firstname, middlename, lastname, commonlink) - VALUES ('John', 'Paul', 'Jones', 'http://cnn.com'); -INSERT INTO tsttbl(firstname, middlename, lastname, commonlink) - VALUES ('Bridget', 'Paula', 'Murphy', 'http://cnn.com'); --- Raw SELECT using ||: -SELECT FirstName || MiddleName || LastName, CommonLink - FROM tsttbl; --- Creating View using ||: -CREATE VIEW tstview AS SELECT - FirstName || MiddleName || LastName, CommonLink FROM tsttbl; --- Executing View Query: -SELECT * FROM tstview; --- Raw SELECT using +: -SELECT FirstName + ' ' + MiddleName + ' ' + LastName, CommonLink - FROM tsttbl; - --- reported bug #1487591 -CREATE TABLE TESTTABLEZ(ID IDENTITY, MY_VALUE VARCHAR(10), MY_ROW_TYPE VARCHAR(10)); -INSERT INTO TESTTABLEZ (MY_VALUE,MY_ROW_TYPE) VALUES ('A', 'B'); -SELECT ID, MY_VALUE FROM TESTTABLEZ - AS TBL1 WHERE ID = (SELECT MAX(ID) AS ID FROM TESTTABLEZ - AS TBL2 WHERE TBL1.MY_VALUE=TBL2.MY_VALUE); - --- reported bug - -drop table PROCESSDETAIL if exists; - -create table PROCESSDETAIL ( - ID bigint not null, - ALERTLEVEL integer not null, - VALUE varchar(255) not null, - TSTAMP timestamp(0) not null, - ATTRIBUTEKEY integer not null, - PROCESSID bigint not null, - primary key (ID) ); - - -insert into - PROCESSDETAIL - (ALERTLEVEL, VALUE, TSTAMP, ATTRIBUTEKEY, - PROCESSID, ID) - values(1, 66, '2007-01-01 08:00:00', 28, 9, 1); - -insert into - PROCESSDETAIL - (ALERTLEVEL, VALUE, TSTAMP, ATTRIBUTEKEY, - PROCESSID, ID) - values(0, 67, '2007-01-01 07:59:40', 28, 9, 2); - -/*r - 1,1,66,2007-01-01 08:00:00,28,9 -*/select * from - PROCESSDETAIL t1 - where exists ( - select - t2.PROCESSID, - t2.ATTRIBUTEKEY - from - PROCESSDETAIL t2 - where - t2.PROCESSID=t1.PROCESSID - and t2.ATTRIBUTEKEY=t1.ATTRIBUTEKEY - and t2.PROCESSID=9 - and t2.TSTAMP<='2007-01-01 08:00:00' - group by - t2.PROCESSID , - t2.ATTRIBUTEKEY - having max(t2.TSTAMP)=t1.TSTAMP ); --- --- -create table element (deadline timestamp); -SELECT DISTINCT convert(element.deadline,Date) FROM element ORDER BY - convert(element.deadline,Date) ASC -SET DATABASE SQL SYNTAX MSS TRUE -SELECT DISTINCT convert(DATE, element.deadline) FROM element ORDER BY - convert(DATE, element.deadline) ASC -SET DATABASE SQL SYNTAX MSS FALSE diff --git a/database/hsqldb/testrun/hsqldb/TestSelfJoins.txt b/database/hsqldb/testrun/hsqldb/TestSelfJoins.txt deleted file mode 100644 index 0b85d39c..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfJoins.txt +++ /dev/null @@ -1,39 +0,0 @@ --- --- TestSelfJoins.txt --- -create table tsj1 (a integer primary key, b integer); -insert into tsj1 values(5,5); -insert into tsj1 values(6,6); -insert into tsj1 values(11,21); -insert into tsj1 values(12,22); -insert into tsj1 values(13,23); -insert into tsj1 values(14,24); -insert into tsj1 values(15,25); -insert into tsj1 values(16,26); -insert into tsj1 values(17,27); -/*r3*/select count(*) from tsj1 where a > 14 -/*r5*/select count(*) from tsj1 where cast(a as character(2)) > '14' -/*r81*/select count(*) from tsj1 a cross join tsj1 b - -/*e*/select count(*) from tsj1 a cross join tsj1 b on a.a = b.a -/*r9*/select count(*) from tsj1 a inner join tsj1 b on a.a = b.a - -drop table table1 if exists -create table table1(column1 int not null, column2 varchar(255) not null, - primary key(column1)) -insert into table1(column1,column2) values(100,'string1') -insert into table1(column1,column2) values(200,'string2') -insert into table1(column1,column2) values(300,'string3') -/*r3*/select count(1) rows from table1 -/*r0*/select count(1) rows from table1 where column1<300 and column1>=200 and column1<1 -/*r0*/select count(1) rows from table1 where column1<1 and column1<300 and column1>=200 - -drop table t1 if exists; -drop table t2 if exists; -drop table t3 if exists; -create table t1(id int primary key, c varchar(20)); -create table t2(id int primary key, rid int, c varchar(20)); -create table t3(id int primary key, rid int, c varchar(20)); -insert into t1 values(1, 'one'), (2, 'two'), (10, 'ten'), (11, 'eleven'); -insert into t2 values(1, 1, 'one'), (2, 2, 'two'), (3, 10, 'ten'), (4, 11, 'eleven'); -insert into t3 values(1, 1, 'one'), (2, 2, 'two'), (3, 10, 'ten'), (4, 11, 'eleven'); diff --git a/database/hsqldb/testrun/hsqldb/TestSelfLeftJoin.txt b/database/hsqldb/testrun/hsqldb/TestSelfLeftJoin.txt deleted file mode 100644 index 4b60f009..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfLeftJoin.txt +++ /dev/null @@ -1,526 +0,0 @@ --- SIMPLE OUTER - NO NULLS --- SET PROPERTY "hsqldb.default_table_type" 'cached' -drop table x if exists; -drop table y if exists; -create table x(a int, b int); -create table y(a int, b int); -insert into x values(2, 1); -insert into x values(5, 1); -insert into y values(1, 1); -insert into y values(2, 1); -insert into y values(3, 1); -insert into y values(4, 1); - -/*r1*/ select count(*) from x inner join y on (x.a = y.a); -/*r2*/ select count(*) from x left outer join y on (x.a = y.a); -/*r1*/ select count(*) from y inner join x on (x.a = y.a); -/*r4*/ select count(*) from y left outer join x on (x.a = y.a); - -create index idx1 on y(a); -create index idx2 on x(a); - -/*r1*/ select count(*) from x inner join y on (x.a = y.a); -/*r2*/ select count(*) from x left outer join y on (x.a = y.a); -/*r1*/ select count(*) from y inner join x on (x.a = y.a); -/*r4*/ select count(*) from y left outer join x on (x.a = y.a); - ---MULTIPLE OUTER -- GROUPED ---OWNERS are possible account owners ---ACCOUNTS are existing accounts, each with an owner id ---CREDITS are account transactions -drop table credits if exists; -drop table accounts if exists; -drop table owners if exists; - -create table owners( - id int not null primary key, - name varchar(100) - ); -create table accounts( - id int not null primary key, - accountname varchar(100), - accountnr int, - accounttype int, - ownerid int, - constraint fk_accounts foreign key (ownerid) references owners(id) - ); -create table credits( - id int, - accountid int, - amount float, - constraint fk_credits foreign key (accountid) references accounts(id) on update cascade - ); - - -insert into owners values(1,'John'); -insert into owners values(2,'Mary'); -insert into owners values(3,'Jane'); - -insert into accounts values(1,'Bank',5101,0,1); -insert into accounts values(2,'Cash',5202,0,1); -insert into accounts values(3,'Giro',5303,0,2); -insert into accounts values(4,'Invoice',7505,1,1); - -insert into credits values(1,1,1000); -insert into credits values(2,1,2000); -insert into credits values(3,2,100); -insert into credits values(4,2,200); - ---outer join -/*c7*/select own.*, ac.*, cred.* from owners own - left outer join accounts ac on own.id = ac.ownerid - left outer join credits cred on cred.accountid = ac.id - ---ACCOUNTS are outer joined with credits to show account balance -/*c4*/select ac.accountname,ac.accountnr,sum(cred.amount) from accounts ac - left outer join credits cred on cred.accountid=ac.id - group by ac.accountnr,ac.accountname - ---like above but filtered with only one account type -/*c3*/select ac.accountname,ac.accountnr,sum(cred.amount) from accounts ac - left outer join credits cred on cred.accountid=ac.id - where accounttype=0 - group by ac.accountnr,ac.accountname - ---join like above but condition changed to return only one not-null item from cred table -/*c4*/select ac.accountname,ac.accountnr, cred.amount from accounts ac - left outer join credits cred on cred.accountid=ac.id and amount=200 - ---OWNER and ACCOUNT are inner joined then outer joined with credits to show balance -/*c3*/select own.name, ac.accountname,ac.accountnr,sum(cred.amount) from owners own - inner join accounts ac on own.id = ac.ownerid - left outer join credits cred on cred.accountid = ac.id - where accounttype=0 - group by own.name,ac.accountnr,ac.accountname - ---OWNER and ACCOUNT are outer joined then outer joined with credits to show balance -/*c5*/select own.name, ac.accountname,ac.accountnr,sum(cred.amount) from owners own - left outer join accounts ac on own.id = ac.ownerid - left outer join credits cred on cred.accountid = ac.id - group by own.name,ac.accountnr,ac.accountname - ---ERROR when a condition column has not been defined in the join so far -/*e*/select own.*, ac.*, cred.* from owners own - left outer join accounts ac on own.id = ac.ownerid and cred.accountid = 1 - left outer join credits cred on cred.accountid = ac.id - ---from 1.8.1 functions and different conditions are accepted in outer joins -/*r - Bank,5101,NULL - Cash,5202,200.0E0 - Giro,5303,NULL - Invoice,7505,NULL -*/select ac.accountname,ac.accountnr, cred.amount from accounts ac - left outer join credits cred on cred.accountid=ac.id and abs(amount) = 200 - -/*r - Bank,5101,NULL - Cash,5202,100.0E0 - Cash,5202,200.0E0 - Giro,5303,NULL - Invoice,7505,NULL -*/select ac.accountname,ac.accountnr, cred.amount from accounts ac - left outer join credits cred on cred.accountid=ac.id and abs(amount) in( 200, 100) - - ---MULTIPLE OUTER ---STUDENTS contains id's for students ---TEACHERS contains id's for teachers ---STUDENT_TEACHER links a teacher to a student -DROP TABLE STUDENT IF EXISTS; -DROP TABLE TEACHER IF EXISTS; -DROP TABLE STUDENT_TEACHER IF EXISTS; -CREATE TABLE STUDENT(STUDENT_ID BIGINT NOT NULL PRIMARY KEY); -CREATE TABLE TEACHER(TEACHER_ID BIGINT NOT NULL PRIMARY KEY); -CREATE TABLE STUDENT_TEACHER(STUDENT_ID BIGINT NOT NULL, TEACHER_ID BIGINT NOT NULL); - -INSERT INTO STUDENT VALUES (1); -INSERT INTO STUDENT VALUES (2); -INSERT INTO TEACHER VALUES (100); -INSERT INTO STUDENT_TEACHER VALUES (1, 100); - ---show all students with their links to teachers, include students without a teacher -/*c2*/SELECT S.STUDENT_ID, T.TEACHER_ID FROM STUDENT S - LEFT JOIN STUDENT_TEACHER MAP ON S.STUDENT_ID=MAP.STUDENT_ID - LEFT JOIN TEACHER T ON MAP.TEACHER_ID=T.TEACHER_ID - ---filter the above to show students for teacher_id 100 -/*c1*/SELECT S.STUDENT_ID, T.TEACHER_ID FROM STUDENT S - LEFT JOIN STUDENT_TEACHER MAP ON S.STUDENT_ID=MAP.STUDENT_ID - LEFT JOIN TEACHER T ON MAP.TEACHER_ID=T.TEACHER_ID - WHERE T.TEACHER_ID = 100; - ---filter the first query to show only students with no teacher -/*c1*/SELECT S.STUDENT_ID, T.TEACHER_ID FROM STUDENT S - LEFT JOIN STUDENT_TEACHER MAP ON S.STUDENT_ID=MAP.STUDENT_ID - LEFT JOIN TEACHER T ON MAP.TEACHER_ID=T.TEACHER_ID - WHERE T.TEACHER_ID IS NULL; - ---show the result of nonsensical query ---returns one row per STUDENT_ID with TEACHER_ID set to null in each row -/*c2*/SELECT S.STUDENT_ID, T.TEACHER_ID FROM STUDENT S - LEFT JOIN STUDENT_TEACHER MAP ON S.STUDENT_ID=MAP.STUDENT_ID - LEFT JOIN TEACHER T ON MAP.TEACHER_ID=T.TEACHER_ID - AND T.TEACHER_ID IS NULL; - ---ANOTHER OUTER WITH AND -create table BASE (ID integer) -create table CHILD(ID integer, BASE_ID integer) -insert into BASE values (1) -insert into BASE values (2) -insert into CHILD values (1,1) -/*r - 1,1 - 2,NULL -*/select BASE.ID,CHILD.ID from BASE left join CHILD on CHILD.BASE_ID=BASE.ID -/*r - 1,NULL - 2,NULL -*/select BASE.ID,CHILD.ID from BASE left join CHILD on CHILD.BASE_ID=BASE.ID and CHILD.ID>1 -/*r - 1,NULL - 2,NULL -*/select BASE.ID,CHILD.ID from BASE left join CHILD on CHILD.BASE_ID=BASE.ID and CHILD.ID<>1 - ---bug #736327 -create table empl(company_id varchar(10),id varchar(20),supervisor_id varchar(20), primary key (company_id,id)); -insert into empl values ('01','1000',null); -insert into empl values ('01','1001','1000'); -/*c2*/select e.id,e.supervisor_id from empl e left join empl s on - e.company_id = s.company_id and e.supervisor_id = s.id; --- ---bug #676083 --- -DROP TABLE T_BOSS IF EXISTS; -DROP TABLE T_EMPLOYEE IF EXISTS; -CREATE TABLE T_BOSS (FIRST VARCHAR(10),LAST VARCHAR(10)); -CREATE TABLE T_EMPLOYEE (FIRST VARCHAR(10),LAST VARCHAR(10)); -INSERT INTO T_BOSS VALUES ('Ludovic','ANCIAUX'); -INSERT INTO T_EMPLOYEE VALUES ('Ludovic','ANCIAUX'); -INSERT INTO T_EMPLOYEE VALUES ('Bill','GATES'); -/*rBill,GATES,NULL,NULL*/SELECT * FROM T_EMPLOYEE LEFT JOIN T_BOSS - ON T_EMPLOYEE.FIRST = T_BOSS.FIRST WHERE T_BOSS.FIRST IS Null; --- ---bug #674025 --- -CREATE TABLE boss (id INTEGER PRIMARY KEY, name VARCHAR(10), UNIQUE(name)); -CREATE TABLE employee (id INTEGER PRIMARY KEY, name VARCHAR(10), bossid INTEGER, - FOREIGN KEY(bossid) REFERENCES boss (id), UNIQUE(name)); -INSERT INTO boss (id, name) VALUES (1, 'phb'); -INSERT INTO employee (id, name, bossid) VALUES (2,'dilbert', 1); -INSERT INTO employee (id, name, bossid) VALUES (3, 'wally', null); -/*c2*/SELECT * FROM employee e LEFT JOIN boss b ON (b.id=e.bossid); -/*c2*/SELECT * FROM employee e LEFT JOIN boss b ON (b.id=e.bossid AND e.name='dilbert'); -/*c2*/SELECT * FROM employee e LEFT JOIN boss b ON (b.id=e.bossid AND b.name='dilbert'); - ---bug #959678 - -CREATE CACHED TABLE propertyvalue ( - id INT, name CHAR(36), value VARCHAR(255)); -INSERT INTO propertyvalue VALUES (1, 'title', 'Foo'); -INSERT INTO propertyvalue VALUES (2, 'title', 'Bar'); -/*r - 2,2,Bar -*/ SELECT * FROM - (SELECT id FROM propertyvalue WHERE name = 'title') AS id - LEFT JOIN - (SELECT id, value FROM propertyvalue WHERE name = 'title') AS title - ON id.id = title.id - WHERE title.value != 'Foo' - ---bug #1018584 - -drop table a if exists; -drop table b if exists; -create table a (aid int, id int); -create table b (bid int, aid int); -insert into a (aid,id) values (1,1); -insert into a (aid,id) values (2,1); -insert into a (aid,id) values (3,2); -insert into a (aid,id) values (4,2); -insert into b (bid,aid) values (1,1); -insert into b (bid,aid) values (2,1); -/*c0*/select * from b left outer join a on b.aId = a.aId where Id =10; -create index idx_test on a (ID); -/*c0*/select * from b left outer join a on b.aId = a.aId where Id =10; -/*c2*/select * from b left outer join a on b.aId = a.aId and Id =10; - ---bug #1027143 - -drop table testc if exists; -drop table testb if exists; -drop table testa if exists; -create table testa (oid int, name varchar(20)); -create table testb (oid int, name varchar(20), a_oid int); - -insert into testa (oid, name) values(1, 'first'); -insert into testa (oid, name) values(2, 'second'); -insert into testa (oid, name) values(3, 'third'); -insert into testa (oid, name) values(4, 'fourth'); -insert into testb (oid, name, a_oid) values(21,'first', 1); -insert into testb (oid, name, a_oid) values(22,'second', null); -insert into testb (oid, name, a_oid) values(23,'third', 2); -insert into testb (oid, name, a_oid) values(24,'fourth', null); -insert into testb (oid, name, a_oid) values(25,'fifth', 3); -insert into testb (oid, name, a_oid) values(26,'sixth', null); - -/*r - 1,first,21,first,1 - 2,second,23,third,2 - 3,third,25,fifth,3 - 4,fourth,NULL,NULL,NULL -*/ select * from testa a LEFT OUTER JOIN testb b ON a.oid = b.a_oid - -create index idx3 on testb(a_oid) - -/*r - 1,first,21,first,1 - 2,second,23,third,2 - 3,third,25,fifth,3 - 4,fourth,NULL,NULL,NULL -*/ select * from testa a LEFT OUTER JOIN testb b ON a.oid = b.a_oid - --- tests with OR in LEFT outer join condition -drop table a if exists; -drop table b if exists; -create table a (a1 varchar(10), a2 integer); -create table b (b1 varchar(10), b2 integer); -insert into a values(null,12); -insert into a values('a',22); -insert into a values('b','32'); - -insert into b values(null,14); -insert into b values('a',14); -insert into b values('c',15); - --- should return 3 rows: -/*r - NULL,12,NULL,14 - a,22,a,14 - b,32,NULL,NULL -*/select * from a left outer join b on ((a.a1=b.b1) or (a.a1 - is null and b.b1 is null)) order by a1 --- should return 2 rows: -/*r - NULL,12,NULL,14 - a,22,a,14 -*/select * from a left outer join b on (1=1) where - ((a.a1=b.b1) or (a.a1 is null and b.b1 is null)) order by a1 --- should return 1 row: -/*r - a,22,a,14 -*/select * from a left outer join b on (1=1) where a.a1=b.b1 order by a1 --- should return 3 rows: -/*r - NULL,12,NULL,NULL - a,22,a,14 - b,32,NULL,NULL -*/select * from a left outer join b on a.a1=b.b1 where (1=1) order by a1 -/*r - NULL,12,NULL,NULL - a,22,a,14 - b,32,NULL,NULL -*/select * from a left outer join b on a.a1=b.b1 order by a1 --- add an index and retest -create index idxa on a(a2); -/*r - NULL,12,NULL,NULL - a,22,a,14 - b,32,NULL,NULL -*/select * from a left outer join b on a.a1=b.b1 order by a1 - --- tests with OR in RIGHT join condition -drop table a if exists; -drop table b if exists; -create table a (a1 varchar(10), a2 integer); -insert into a values(null,12); -insert into a values('a',22); -insert into a values('b','32'); - -create table b (b1 varchar(10), b2 integer); -insert into b values(null,13); -insert into b values('a',14); -insert into b values('c',15); - --- should return 3 rows: -/*r - NULL,NULL,c,15 - NULL,12,NULL,13 - a,22,a,14 -*/select * from a right outer join b on ((a.a1=b.b1) or (a.a1 - is null and b.b1 is null)) order by a1, a2 --- should return 2 rows: -/*r - NULL,12,NULL,13 - a,22,a,14 -*/select * from a right outer join b on (1=1) where - ((a.a1=b.b1) or (a.a1 is null and b.b1 is null)) order by a1 --- should return 1 row: -/*r - a,22,a,14 -*/select * from a right outer join b on (1=1) where a.a1=b.b1 order by a1 --- should return 3 rows: -/*r - NULL,NULL,NULL,13 - NULL,NULL,c,15 - a,22,a,14 -*/select * from a right outer join b on a.a1=b.b1 where (1=1) order by a1 -/*r - NULL,NULL,NULL,13 - NULL,NULL,c,15 - a,22,a,14 -*/select * from a right outer join b on a.a1=b.b1 order by a1 --- add an index and retest -create index idxa on a(a2); -/*r - NULL,NULL,NULL,13 - NULL,NULL,c,15 - a,22,a,14 -*/select * from a right outer join b on a.a1=b.b1 order by a1 -/*r - NULL,NULL - NULL,NULL - a,22 -*/select a.* from a right outer join b on a.a1=b.b1 order by a1 -/*r - NULL,13 - c,15 - a,14 -*/select b.* from a right outer join b on a.a1=b.b1 order by a1 - ---- -CREATE TABLE names (name VARCHAR(20) PRIMARY KEY); -CREATE TABLE params (name VARCHAR(20) PRIMARY KEY, value VARCHAR(20) NOT NULL); -INSERT INTO names VALUES ('name1'); -INSERT INTO names VALUES ('name2'); -INSERT INTO params (name, value) VALUES ('name1', 'value1'); -/*r - name1,NULL - name2,NULL -*/SELECT n.name, p.value FROM names n LEFT OUTER JOIN params p ON n.name = p.name AND p.value <> 'value1'; -/*r - name1,NULL - name2,NULL -*/SELECT n.name, p.value FROM names n LEFT JOIN params p ON n.name = p.name AND p.value = 'value3'; ---- -CREATE MEMORY TABLE SUPER(PK INTEGER PRIMARY KEY,ASS CHARACTER(3)) -CREATE MEMORY TABLE ASSOCIATED(PK CHARACTER(3),I INTEGER) -CREATE MEMORY TABLE SUB(PK INTEGER PRIMARY KEY,ASS CHARACTER(3)) - -insert into sub values(1, 'mee') -insert into super values(1, 'mee') -insert into associated values('mee', 10) -insert into associated values('you', 20) -/*r - 1,mee,mee - NULL,NULL,you -*/select sub.pk, sub.ass, a.pk - from Sub sub inner join Super super on sub.pk=super.pk - right outer join Associated a on super.ass=a.pk order by 3 -/*r - 1,mee,mee - NULL,NULL,you -*/select sub.pk, sub.ass, a.pk - from Sub sub inner join Super super on sub.pk=super.pk - full outer join Associated a on super.ass=a.pk order by 3 ---- -CREATE TABLE bremsen_dl_fzg - ( bremsen_dl_id integer not null - , lfd_nr integer not null - , bremse_dl_fzgtyp char(1) - , bremse_dl_art char(1) - , bremse_dl_verf char(1) - , bremse_dl_bauart varchar(4) - , bremse_dl_typ char(1) - , ort_bedienung varchar(4) - , loesigkeit char(1) - , beschreibung varchar(30) - , bremse_dl_gew_id integer - , uhrzeit_ende timestamp not null - ); -ALTER TABLE bremsen_dl_fzg add constraint pk_bremsen_dl_fzg primary key - ( bremsen_dl_id , lfd_nr ); -ALTER TABLE bremsen_dl_fzg add constraint chk_bremsen_dl_fzg check - ( - ( bremse_dl_fzgtyp is null or bremse_dl_fzgtyp in ( 'W', 'T', 't') ) - and - ( bremse_dl_art is null or bremse_dl_art in ( 'B', 'F') ) - and - ( bremse_dl_verf is null or bremse_dl_verf in ( 'D', 'H', 'M', 'W') ) - and - ( bremse_dl_bauart is null or bremse_dl_bauart in ( 'ALaH', 'ALaT', - 'H2Lw', 'H3Lw') ) - and - ( bremse_dl_typ is null or bremse_dl_typ in ( 'D', 'B', 'S', 'H', 'K', - 'F') ) - and - ( ort_bedienung is null or ort_bedienung in ( 'BO', 'ST', 'BOST') ) - and - ( loesigkeit is null or loesigkeit in ( 'e', 'm', 'M') ) - ); - -CREATE TABLE bremsen_dl_gewichte - ( bremse_dl_gew_id integer not null - , lfd_nr integer not null - , bremse_stellung varchar(2) - , gewicht_brutto float - , gewicht_bremse float - , uhrzeit_ende timestamp not null - ); - -ALTER TABLE bremsen_dl_gewichte add constraint pk_bremsen_dl_gewichte - primary key - ( bremse_dl_gew_id , lfd_nr ); - -ALTER TABLE bremsen_dl_gewichte add constraint chk_bremsen_dl_gewichte - check - ( - ( bremse_stellung is null or bremse_stellung in ( 'G', 'GE', 'P', 'PE', - 'R') ) - ); - -CREATE VIEW lok_bremse_lfdnr1_view - ( bremsen_dl_id, bremse_dl_gew_id, bremse_dl_art, bremse_dl_verf, bremse_dl_bauart, - bremse_dl_typ, ort_bedienung, loesigkeit, beschreibung, gewicht_bremse_g, - gewicht_bremse_p, gewicht_bremse_r) - as select br.bremsen_dl_id, br.bremse_dl_gew_id, br.bremse_dl_art, br.bremse_dl_verf, - br.bremse_dl_bauart, br.bremse_dl_typ, br.ort_bedienung, br.loesigkeit, - br.beschreibung, gew_g.gewicht_bremse, gew_p.gewicht_bremse, gew_r.gewicht_bremse - from bremsen_dl_fzg br - left join bremsen_dl_gewichte gew_g on - br.bremse_dl_gew_id = gew_g.bremse_dl_gew_id - and gew_g.bremse_stellung = 'G' - and gew_g.gewicht_bremse IS NOT NULL - left join bremsen_dl_gewichte gew_p on - br.bremse_dl_gew_id = gew_p.bremse_dl_gew_id - and gew_p.bremse_stellung = 'P' - and gew_p.gewicht_bremse IS NOT NULL - left join bremsen_dl_gewichte gew_r on - br.bremse_dl_gew_id = gew_r.bremse_dl_gew_id - and gew_r.bremse_stellung = 'R' - and gew_r.gewicht_bremse IS NOT NULL - where br.lfd_nr = 1 - AND br.bremse_dl_bauart IN( 'ALaH','H2Lw'); - --- check for use of index in execution plan -CREATE CACHED TABLE article ( - id INTEGER IDENTITY, - name VARCHAR(50)); - -CREATE CACHED TABLE salesorder_row ( - id INTEGER IDENTITY, - salesorder_id INTEGER, - article_id INTEGER, - needed DECIMAL(10,2), - CONSTRAINT fk_salesorder_row_article FOREIGN KEY (article_id) REFERENCES - article (id) ON DELETE CASCADE); - -CREATE INDEX idx_salesorder_row_article ON salesorder_row (article_id); -CREATE INDEX idx_salesorder_row_salesorder ON salesorder_row - (salesorder_id); - -EXPLAIN PLAN FOR - SELECT article.name, salesorder_row.needed - FROM salesorder_row - LEFT JOIN article ON salesorder_row.article_id = article.id - WHERE (salesorder_row.salesorder_id = 1234) diff --git a/database/hsqldb/testrun/hsqldb/TestSelfModify.txt b/database/hsqldb/testrun/hsqldb/TestSelfModify.txt deleted file mode 100644 index b838f59f..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfModify.txt +++ /dev/null @@ -1,76 +0,0 @@ --- --- TestSelfModify.txt --- - --- TestSelfModify.txt is used by TestSelf.java to test the database --- --- This is the second part of a three part suite of scripts to test persistence in the same DB --- --- Comment lines must start with -- and are ignored --- Lines starting with spaces belongs to last line --- Checked lines start with comments containing where is: --- c ResultSet expects a with columns --- r ResultSet expected with result in first row/column --- u Update count expected --- e Exception must occur --- ---bug #824031 continued ---scripting test for order of indexes -/*c1*/SELECT * FROM APP WHERE VARIANT_ID = 51; -/*c1*/SELECT * FROM APP WHERE APP_NAME = 'Eran'; -/*c1*/SELECT * FROM APP WHERE APP_NAME = 'Shelly'; -/*c2*/SELECT * FROM APP; --- --- TEST 1 --- Correct handling of index creation for foreign keys --- insert some values -/*u1*/insert into verein values ('abcdefg'); -/*u1*/insert into verein values ('hijklmn'); -/*u1*/insert into verein values ('opqrstu'); -/*u1*/insert into verein values ('vwxyz'); -/*u1*/insert into bewerb values ('abcdefg',1); -/*e*/insert into bewerb values ('abcdefg',2); -/*u1*/insert into bewerb values ('hijklmn',5); -/*e*/insert into bewerb values ('hijklmn',6); -/*u1*/insert into bewerb values ('opqrstu',8); -/*e*/insert into bewerb values ('opqrstu',9); -/*u1*/insert into bewerb values ('vwxyz',10); - ---CHECKPOINT DEFRAG - ---test identity increment -INSERT INTO APP2 (VALUE) VALUES(11); -INSERT INTO APP2 (VALUE) VALUES(12); - -/*r3,12*/ SELECT COUNT(ID), MAX(VALUE) FROM APP2 -/*r3,10*/ SELECT COUNT(ID), MIN(VALUE) FROM APP2 - ---test result of update before previous shutdown -/*r - 14,newdir,NULL,NULL,NULL -*/select * from file; - ---test insert into table - -CREATE TABLE NEWAPP AS (SELECT * FROM APP) WITH DATA; -/*c1*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Eran'; -/*c1*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Shelly'; -/*c2*/SELECT * FROM NEWAPP; - -INSERT INTO NEWAPP (SELECT * FROM APP) -/*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Eran'; -/*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Shelly'; -/*c4*/SELECT * FROM NEWAPP; - ---test separate identity and primary key - -/*e*/insert into tident values (10, default); -/*r - 10,0 - 11,1 - 12,2 -*/select * from tident -insert into tident values (9, default); --- SHUTDOWN is necessary for test1 -/*u0*/SHUTDOWN; - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfMultiGrants.txt b/database/hsqldb/testrun/hsqldb/TestSelfMultiGrants.txt deleted file mode 100644 index 2a0a2f2d..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfMultiGrants.txt +++ /dev/null @@ -1,100 +0,0 @@ -/*s*/DROP USER peon1; -/*s*/DROP USER peon2; -/*s*/DROP USER peon3; -/*s*/DROP ROLE r1; -/*s*/DROP ROLE r2; -/*s*/DROP ROLE r3; -/*s*/DROP ROLE r12; -DROP TABLE t1 IF exists; -DROP TABLE t2 IF exists; -DROP TABLE t3 IF exists; -DROP TABLE t4 IF exists; -CREATE TABLE t1(i int); -CREATE TABLE t2(i int); -CREATE TABLE t3(i int); -CREATE TABLE t4(i int); -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(2); -INSERT INTO t3 VALUES(3); -INSERT INTO t4 VALUES(4); -COMMIT; -CREATE USER peon1 PASSWORD password; -CREATE USER peon2 PASSWORD password; -CREATE USER peon3 PASSWORD password; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon1; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon2; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon3; - -/*u0*/CREATE ROLE r1; -/*u0*/CREATE ROLE r2; -/*u0*/CREATE ROLE r3; -/*u0*/CREATE ROLE r12; -/*u0*/GRANT ALL ON t1 TO r1; -/*u0*/GRANT ALL ON t1 TO r12; -/*u0*/GRANT ALL ON t2 TO r2; -/*u0*/GRANT ALL ON t2 TO r12; -/*u0*/GRANT ALL ON t3 TO r3; - --- Can't mix right-grants and role-grants -/*e*/GRANT r1, SELECT ON t1 TO peon1; -/*e*/GRANT SELECT ON t1, r1 TO peon1; - -/*u0*/GRANT SELECT, INSERT ON t1 TO peon1; -/*u0*/GRANT r2, r3 TO peon2; -/*u0*/GRANT r12 TO peon3; - -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*e*/SELECT * FROM t2; -/*e*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER peon2 PASSWORD password; -/*e*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*c1*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER peon3 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*e*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER sa PASSWORD ""; -/*u0*/GRANT r2 TO peon1; -/*u0*/GRANT r3 TO r12; -- r12 held by peon3. Nest r3 into it too. -/*u0*/GRANT SELECT ON t1 TO peon2; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*e*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER peon2 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*c1*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER peon3 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*c1*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; - --- Access to t3 has been granted only through r3, either directly or --- indirectly (the latter through nesting r3 in another role). -CONNECT USER sa PASSWORD ""; -DROP ROLE r3; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*e*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER peon2 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*e*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER peon3 PASSWORD password; -/*c1*/SELECT * FROM t1; -/*c1*/SELECT * FROM t2; -/*e*/SELECT * FROM t3; -/*e*/SELECT * FROM t4; -CONNECT USER SA PASSWORD '' diff --git a/database/hsqldb/testrun/hsqldb/TestSelfNameResolution.txt b/database/hsqldb/testrun/hsqldb/TestSelfNameResolution.txt deleted file mode 100644 index ce81ea62..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfNameResolution.txt +++ /dev/null @@ -1,107 +0,0 @@ -drop table t0 if exists; -create table t0(c varchar(20), i integer); -insert into t0 values ('first', 1); -insert into t0 values ('second', 2); -insert into t0 values ('third', 3); -select * from t0 order by c; -select t0.c, t0.i from t0 order by c, t0.i; -select c as cc from t0 order by cc; -select c as cc from t0 order by i; -select upper(c) as uc from t0 t order by uc; -select i, c from t0 order by upper(c); -/*c3*/select i, c as cc from t0 order by upper(cc); -/*e*/select distinct upper(c) as uc from t0 t order by i; -/*c3*/select c as ccol, sum(i) as sumi from t0 group by c; -/*c3*/select c as ccol, sum(i) as sumi from t0 group by c order by sumi; -select c as ccol, sum(i) as sumi from t0 group by ccol; -/*c1*/select c as ccol, sum(i) as sumi from t0 - group by c - having substring(upper(c) from 1 for 1) = 'S' -/*c1*/select c || ' time' as ccol, sum(i) as sumi from t0 - group by c - having c || ' time' = 'second time' -/*c2*/select c as ccol, sum(i) as sumi from t0 - group by c - having avg(i) < 3 -/*c1*/select c as ccol, sum(i) as sumi from t0 - group by c - having substring(upper(c) from 1 for 1) = 'S' - and avg(i) < 10 order by c desc -/*c1*/select c as ccol, sum(i) as sumi from t0 - group by c - having substring(upper(c) from 1 for 1) = 'S' - and avg(i) < 10 order by c desc, sumi --- bug item #1167704 -drop table test if exists; -create table test(id integer, cost numeric(3,1)); -insert into test values(1,10); -insert into test values(2,20); -insert into test values (3,1); -insert into test values (4,2); -/*r - 3,kr 1.0 - 4,kr 2.0 - 1,kr 10.0 - 2,kr 20.0 -*/SELECT ID, 'kr ' + Cost FROM Test ORDER BY Cost; -/*r - 3,kr 1.0 - 4,kr 2.0 - 1,kr 10.0 - 2,kr 20.0 -*/SELECT ID, 'kr ' || Cost FROM Test ORDER BY Cost; - -DROP TABLE "CD" IF EXISTS CASCADE; -CREATE CACHED TABLE "CD"("ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,"Title" VARCHAR(50)); -CREATE CACHED TABLE "Artist"("ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,"Name" VARCHAR(50)); -CREATE CACHED TABLE "Album"("ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,"Artist" INTEGER NOT NULL,"Name" VARCHAR(200),"Year" DATE,"CD" INTEGER NOT NULL,CONSTRAINT SYS_FK_42 FOREIGN KEY("CD") REFERENCES "CD"("ID"),CONSTRAINT SYS_FK_52 FOREIGN KEY("Artist") REFERENCES "Artist"("ID") ON DELETE CASCADE); -CREATE CACHED TABLE "Song"("ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,"Album" INTEGER NOT NULL,"Name" VARCHAR(300),"Track" INTEGER,"Duration" TIME,"Genre" VARCHAR(50),CONSTRAINT SYS_FK_55 FOREIGN KEY("Album") REFERENCES "Album"("ID") ON DELETE CASCADE); -INSERT INTO "CD" VALUES(21,'24'); -INSERT INTO "Artist" VALUES(123,'Annie Lennox'); -INSERT INTO "Album" VALUES(172,123,'Medusa',NULL,21); -INSERT INTO "Song" VALUES(2669,172,'waiting in vain',9,'00:05:39',NULL); - --- issue with aliases - bug 1344316 -create table test1 (idtest int,test varchar(100),primary key(idtest)); -create table test2 (idtest2 int,idtest int,test varchar(100),primary key(idtest2),foreign key (idtest) REFERENCES test1(idtest)); -INSERT INTO test1 (idtest, test) VALUES (1,'hello'); -INSERT INTO test2 (idtest2,idtest, test) VALUES(2,1,'world'); -/*r - hello,2 -*/select t1.test, t2.idtest2 as idtest from test1 t1 join test2 t2 on (t1.idtest=t2.idtest) -/*r - hello,hello -*/select t1.test, t1.test as idtest from test1 t1 JOIN test2 t2 on (t1.idtest=t2.idtest) - -insert into test2 values (3, 1,'ocean') -/*r - 1,2 - 1,3 -*/select idtest, idtest2 from test2 group by idtest, idtest2 order by idtest -/*r - 1 -*/select distinct idtest from test2 group by idtest2, idtest order by idtest ------ -drop table tablea if exists; -drop table tableb if exists; -create table tablea (cola int, colb int, colc int); -create table tableb (cola int, colb int, colc int); -SELECT T1.colA, T1.colB FROM tableA T1 WHERE T1.colC = ( - SELECT MAX(T2.colC) FROM tableA T2 WHERE T1.colB = T2.colB); -SELECT T1.colA, T1.colB FROM tableA T1 WHERE T1.colC IN ( - SELECT MAX(T2.colC) FROM tableA T2 WHERE T1.colB = T2.colB); ---- -DROP TABLE TABLEA IF EXISTS; -CREATE TABLE TABLEA (LIMIT VARCHAR(5), TOP INT); -INSERT INTO TABLEA(LIMIT, TOP) VALUES ('LIMIT', 2); -SELECT LIMIT FROM TABLEA; -SELECT TOP FROM TABLEA; -SELECT LIMIT TOP FROM TABLEA; -SELECT TOP LIMIT FROM TABLEA; -SELECT LIMIT, TOP FROM TABLEA; -SELECT TOP, LIMIT FROM TABLEA; -SELECT RIGHT(LIMIT,2) FROM TABLEA; -SELECT LEFT(LIMIT,2) FROM TABLEA; - - - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfNameResolutionSchemas.txt b/database/hsqldb/testrun/hsqldb/TestSelfNameResolutionSchemas.txt deleted file mode 100644 index a6944431..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfNameResolutionSchemas.txt +++ /dev/null @@ -1,572 +0,0 @@ --- Tests for phase 1 of Schema implementation. --- PHASE 1 = on schemas PUBLIC and INFORMATION_SCHEMA; No "SET SCHEMA" cmd; --- Can't create INFORMATION_SCHEMA objects from normal Sessions. --- (Alter commands tested separately after because there are so many --- alter permutations to test) --- ****************************** PHASE 1 Tables ---DROP TABLE nosuch; -DROP TABLE t1 IF exists; -DROP TABLE t2 IF exists; -DROP TABLE t3 IF exists; -DROP TABLE t4 IF exists; -DROP TABLE t5 IF exists; -DROP TABLE t101 IF exists; -DROP TABLE j1 IF exists; -DROP TABLE other.t1 IF exists; -DROP TABLE other.system_users IF exists; -DROP TABLE system_users IF exists; -/*u0*/CREATE TABLE t1 (i int); -/*u0*/CREATE TABLE public.t2 (i int); -/*u0*/CREATE TABLE t3 (i int); -/*u0*/CREATE TABLE j1 (i int, vc varchar(10)); -/*u0*/CREATE CACHED TABLE public.t5 (i int); -/*e*/CREATE TABLE information_schema.t101 (i int); -/*e*/CREATE TABLE t1 (i int); -- Create existing object -/*e*/CREATE TABLE public.t1 (i int); -- Create existing object -/*e*/CREATE TABLE information_schema.system_users (i int); -- Existing object -/*u1*/INSERT INTO t1 values(0); -/*u1*/INSERT INTO t1 values(1); -/*u1*/INSERT INTO j1 values(1, 'one'); -/*c2*/SELECT * FROM t1; -/*c1*/SELECT * FROM t1 WHERE i = 0; -/*c2*/SELECT * FROM t1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM t1 WHERE i < 1; -/*c1*/SELECT * FROM t1 WHERE t1.i = (SELECT i FROM j1); -/*c1*/SELECT * FROM t1 WHERE t1.i in (SELECT i FROM j1); -/*c0*/SELECT * FROM t1 WHERE t1.i = (SELECT i FROM j1 WHERE i = 0); -/*c1*/SELECT * FROM public.t1 WHERE t1.i = (SELECT i FROM j1); -/*c1*/SELECT * FROM public.t1 WHERE t1.i in (SELECT i FROM j1); -/*c1*/SELECT * FROM public.t1 WHERE t1.i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM t1 WHERE t1.i = (SELECT i FROM public.j1); -/*c1*/SELECT * FROM t1 WHERE t1.i in (SELECT i FROM public.j1); -/*c1*/SELECT * FROM t1 WHERE t1.i = (SELECT i FROM public.j1 WHERE i = 1); -/*c1*/SELECT * FROM t1 WHERE t1.i = (SELECT j1.i FROM public.j1); -/*c1*/SELECT * FROM t1 WHERE t1.i in (SELECT j1.i FROM j1); -/*c1*/SELECT * FROM t1 WHERE t1.i = (SELECT j1.i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM t1 WHERE t1.i = (SELECT i FROM public.j1 WHERE j1.i = 1); -/*c1*/SELECT * FROM t1 WHERE t1.i = (SELECT j1.i FROM j1 WHERE j1.i = 1); -/*c1*/SELECT * FROM t1 WHERE i = (SELECT i FROM j1); -/*c1*/SELECT * FROM t1 WHERE i in (SELECT i FROM j1); -/*c1*/SELECT * FROM t1 WHERE i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM public.t1 WHERE i = (SELECT i FROM j1); -/*c1*/SELECT * FROM public.t1 WHERE i in (SELECT i FROM j1); -/*c0*/SELECT * FROM public.t1 WHERE i = (SELECT i FROM j1 WHERE i = 0); -/*c1*/SELECT * FROM t1 WHERE i = (SELECT i FROM public.j1); -/*c1*/SELECT * FROM t1 WHERE i in (SELECT i FROM public.j1); -/*c0*/SELECT * FROM t1 WHERE i = (SELECT i FROM public.j1 WHERE i = 0); -/*c1*/SELECT * FROM t1 WHERE i = (SELECT j1.i FROM public.j1); -/*c1*/SELECT * FROM t1 WHERE i in (SELECT j1.i FROM j1); -/*c0*/SELECT * FROM t1 WHERE i = (SELECT j1.i FROM j1 WHERE i = 0); -/*c1*/SELECT * FROM t1 WHERE i = (SELECT i FROM public.j1 WHERE j1.i = 1); -/*c1*/SELECT * FROM t1 WHERE i = (SELECT j1.i FROM j1 WHERE j1.i = 1); -/*e*/SELECT * FROM system_users WHERE user_name = 'SA'; -/*e*/SELECT * FROM other.t1; -/*e*/SELECT * FROM other.system_users; -/*e*/SELECT * FROM information_schema.t1; -/*e*/SELECT * FROM public.system_users; -/*c2*/SELECT * FROM public.t1; -/*c1*/SELECT * FROM information_schema.system_users WHERE user_name = 'SA'; -/*c1*/SELECT * FROM public.t1 WHERE i = 0; -/*e*/SELECT * FROM other.t1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.t1 WHERE i = 0; -CREATE TABLE public.t4 AS (SELECT * FROM public.t1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM public.t4; -/*c1*/SELECT * FROM public.t1, public.j1 WHERE t1.i = j1.i; -/*c1*/SELECT * FROM t1, public.j1 WHERE t1.i = j1.i; -/*c1*/SELECT * FROM public.t1, j1 WHERE t1.i = j1.i; -/*c1*/SELECT * FROM t1, j1 WHERE t1.i = j1.i; -/*c1*/SELECT vc FROM public.t1, public.j1 WHERE t1.i = j1.i; -/*c1*/SELECT vc FROM t1, public.j1 WHERE t1.i = j1.i; -/*c1*/SELECT vc FROM public.t1, j1 WHERE t1.i = j1.i; -/*c1*/SELECT vc FROM t1, j1 WHERE t1.i = j1.i; -/*c1*/SELECT j1.vc FROM public.t1, public.j1 WHERE t1.i = j1.i; -/*c1*/SELECT j1.vc FROM t1, public.j1 WHERE t1.i = j1.i; -/*c1*/SELECT j1.vc FROM public.t1, j1 WHERE t1.i = j1.i; -/*c1*/SELECT j1.vc FROM t1, j1 WHERE t1.i = j1.i; -/*c1*/SELECT lbla.vc FROM t1, j1 lbla WHERE t1.i = lbla.i; -/*c1*/SELECT j1.vc FROM t1 lblb, j1 WHERE lblb.i = j1.i; -/*c1*/SELECT lbla.vc FROM t1 lblb, j1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM public.t1, j1 lbla WHERE t1.i = lbla.i; -/*c1*/SELECT j1.vc FROM public.t1 lblb, j1 WHERE lblb.i = j1.i; -/*c1*/SELECT lbla.vc FROM public.t1 lblb, j1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM t1, public.j1 lbla WHERE t1.i = lbla.i; -/*c1*/SELECT j1.vc FROM t1 lblb, public.j1 WHERE lblb.i = j1.i; -/*c1*/SELECT lbla.vc FROM t1 lblb, public.j1 lbla WHERE lblb.i = lbla.i; -/*u0*/SET TABLE t1 READONLY true; -/*u0*/SET TABLE public.t1 READONLY true; -/*e*/SET TABLE information_schema.t1 READONLY true; -/*e*/SET TABLE other.t1 READONLY true; -/*u0*/SET TABLE t1 READONLY false; -/*u0*/SET TABLE public.t1 READONLY false; -/*u1*/UPDATE t1 set i = 11 WHERE i = 1; -/*u1*/UPDATE t1 set t1.i = 12 WHERE i = 11; -/*u1*/UPDATE t1 set t1.i = 13 WHERE t1.i = 12; -/*u1*/UPDATE public.t1 set i = 14 WHERE i = 13; -/*u1*/UPDATE public.t1 set t1.i = 15 WHERE i = 14; -/*u1*/UPDATE public.t1 set t1.i = 16 WHERE t1.i = 15; -/*e*/UPDATE other.t1 set t1.i = 17 WHERE t1.i = 16; -/*e*/UPDATE information_schema.t1 set t1.i = 17 WHERE t1.i = 16; -/*u1*/UPDATE t1 ali set i = 17 WHERE i = 16; -/*u1*/UPDATE t1 ali set ali.i = 18 WHERE i = 17; -/*u1*/UPDATE t1 ali set ali.i = 19 WHERE ali.i = 18; -/*u1*/UPDATE t1 ali set i = 20 WHERE ali.i = 19; -/*u1*/UPDATE public.t1 ali set i = 21 WHERE i = 20; -/*u1*/UPDATE public.t1 ali set ali.i = 22 WHERE i = 21; -/*u1*/UPDATE public.t1 ali set ali.i = 23 WHERE ali.i = 22; -/*u1*/UPDATE public.t1 ali set i = 24 WHERE ali.i = 23; -/*e*/UPDATE other.t1 ali set i = 25 WHERE ali.i = 24; -/*e*/UPDATE other.t1 ali set i = 25 WHERE .i = 24; -/*e*/UPDATE other.t1 set i = 25 WHERE i = 24; -/*e*/DELETE FROM other.t1 ali WHERE ali.i = 24; -/*e*/DELETE FROM other.t1 ali; -/*e*/DELETE FROM other.t1 set WHERE i = 24; -CREATE USER otheruser PASSWORD otheruser; -/*u0*/GRANT ALL ON t1 TO otheruser; -/*u0*/GRANT ALL ON public.t2 TO otheruser; -/*e*/GRANT ALL ON other.t3 TO otheruser; -/*e*/GRANT ALL ON information_schema.t3 TO otheruser; -/*u0*/REVOKE ALL ON t1 FROM otheruser RESTRICT; -/*u0*/REVOKE ALL ON public.t2 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON other.t3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.t3 FROM otheruser RESTRICT; -DROP USER otheruser; -/*u1*/DELETE FROM t1 WHERE i = 0; -/*u1*/DELETE FROM public.t1 WHERE i = 24; -/*u1*/DELETE FROM public.j1 WHERE j1.i = 1; -/*u0*/DROP TABLE t1; -/*e*/DROP TABLE t1; -/*u0*/DROP TABLE t2; -/*e*/DROP TABLE other.t3; -/*u0*/DROP TABLE public.t3; -/*e*/DROP TABLE information_schema.t4; -/*u0*/DROP TABLE t4; -/*u0*/DROP TABLE t5; -/*u0*/DROP TABLE j1; -/*e*/DROP TABLE t101; -/*e*/DROP TABLE public.t101; --- ****************************** PHASE 1 Views -DROP VIEW v1 IF exists; -DROP VIEW v2 IF exists; -DROP VIEW v3 IF exists; -DROP VIEW v4 IF exists; -DROP VIEW v5 IF exists; -DROP VIEW v6 IF exists; -DROP VIEW v7 IF exists; -DROP VIEW v8 IF exists; -DROP VIEW v9 IF exists; -DROP VIEW v10 IF exists; -DROP VIEW v11 IF exists; -DROP VIEW v12 IF exists; -DROP VIEW v13 IF exists; -DROP VIEW v14 IF exists; -DROP VIEW v15 IF exists; -DROP VIEW v16 IF exists; -DROP VIEW v17 IF exists; -DROP VIEW v18 IF exists; -DROP VIEW v19 IF exists; -DROP VIEW v20 IF exists; -DROP VIEW v21 IF exists; -DROP VIEW v22 IF exists; -DROP VIEW v23 IF exists; -DROP VIEW v24 IF exists; -DROP VIEW v25 IF exists; -DROP VIEW v26 IF exists; -DROP VIEW v101 IF exists; -DROP TABLE t1 IF exists; -DROP TABLE t2 IF exists; -DROP TABLE j1 IF exists; -CREATE TABLE t1 (i int); -CREATE TABLE j1 (i int, vc varchar(10)); -INSERT INTO t1 values(0); -INSERT INTO t1 values(1); -INSERT INTO j1 values(1, 'one'); -/*e*/CREATE VIEW information_schema.v101 AS - SELECT * FROM information_schema.system_users; -/*e*/CREATE VIEW information_schema.v101 AS - SELECT * FROM t1; -/*e*/CREATE VIEW information_schema.v4 AS - SELECT * FROM public.t1; -/*e*/CREATE VIEW v101 AS SELECT * FROM other.t1; -/*e*/CREATE VIEW public.v101 AS SELECT * FROM other.t1; -/*e*/CREATE VIEW other.v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE user_name = vc; -/*e*/CREATE VIEW other.v101 AS SELECT * - FROM information_schema.system_users, public.j1 WHERE user_name = vc; -/*e*/CREATE VIEW other.v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE information_schema.user_name = vc; -/*e*/CREATE VIEW other.v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE information_schema.user_name = public.vc; -/*e*/CREATE VIEW information_schema.v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE user_name = vc; -/*e*/CREATE VIEW information_schema.v101 AS SELECT * - FROM information_schema.system_users, public.j1 WHERE user_name = vc; -/*e*/CREATE VIEW information_schema.v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE information_schema.user_name = vc; -/*e*/CREATE VIEW information_schema.v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE information_schema.user_name = public.vc; -/*e*/CREATE VIEW v101 AS SELECT * - FROM system_users, j1 - WHERE user_name = vc; -/*e*/CREATE VIEW v101 AS SELECT * - FROM information_schema.system_users, information_schema.j1 - WHERE user_name = vc; -/*e*/CREATE VIEW v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE other.user_name = vc; -/*e*/CREATE VIEW v101 AS SELECT * - FROM information_schema.system_users, j1 - WHERE public.user_name = public.vc; -/*u0*/CREATE VIEW v1 AS SELECT * FROM t1; -/*e*/CREATE VIEW public.v1 AS SELECT * FROM t1; -- Create existing object -/*e*/CREATE VIEW public.v1 AS SELECT * FROM public.t1; -- Existing object -/*u0*/CREATE VIEW public.v2 AS SELECT * FROM t1; -/*u0*/CREATE VIEW public.v3 AS SELECT * FROM public.t1; -/*u0*/CREATE VIEW public.v4 AS SELECT * FROM t1 WHERE i = 0; -/*u0*/CREATE VIEW public.v5 AS SELECT * FROM t1 WHERE i < 1; -/*u0*/CREATE VIEW public.v6 AS SELECT * FROM information_schema.system_users - WHERE user_name = 'SA'; -/*u0*/CREATE VIEW v7 AS SELECT * FROM information_schema.system_users; -/*u0*/CREATE VIEW v8 AS SELECT * FROM information_schema.system_users - WHERE user_name = 'SA'; -/*u0*/CREATE VIEW v9 AS SELECT * FROM information_schema.system_users, j1 - WHERE user_name = vc; -/*u0*/CREATE VIEW v10 AS SELECT * - FROM information_schema.system_users, public.j1 WHERE user_name = vc; -/*u0*/CREATE VIEW v11 AS SELECT * FROM information_schema.system_users, j1 - WHERE system_users.user_name = vc; -/*e*/CREATE VIEW v12 AS SELECT * FROM information_schema.system_users, j1 - WHERE system_users.user_name = public.vc; -/*u0*/CREATE VIEW public.v13 AS SELECT * - FROM information_schema.system_users, j1 - WHERE user_name = vc; -/*u0*/CREATE VIEW public.v14 AS SELECT * - FROM information_schema.system_users, public.j1 WHERE user_name = vc; -/*e*/CREATE VIEW public.v15 AS SELECT * - FROM information_schema.system_users, j1 - WHERE information_schema.user_name = vc; -/*e*/CREATE VIEW public.v16 AS SELECT * - FROM information_schema.system_users, j1 - WHERE information_schema.user_name = public.vc; -/*u0*/CREATE VIEW v17 AS SELECT * FROM information_schema.system_users, j1 - WHERE user_name = vc; -/*u0*/CREATE VIEW v18 AS SELECT * - FROM information_schema.system_users, public.j1 WHERE user_name = vc; -/*u0*/CREATE VIEW v19 (v1, v2, v3) AS SELECT * FROM t1, j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW v20 (v1, v2, v3) AS SELECT * FROM public.t1, public.j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW v21 (v1, v2, v3) AS SELECT * FROM public.t1, j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW v22 (v1, v2, v3) AS SELECT * FROM t1, public.j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW public.v23 (v1, v2, v3) AS - SELECT * FROM t1, j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW public.v24 (v1, v2, v3) AS - SELECT * FROM public.t1, public.j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW public.v25 (v1, v2, v3) AS SELECT * FROM public.t1, j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW public.v26 (v1, v2, v3) AS SELECT * FROM t1, public.j1 WHERE t1.i = j1.i; -/*u0*/CREATE VIEW v28 AS - SELECT * FROM t1 WHERE i in (0, 1, 11, 12); -/*u0*/CREATE VIEW public.v29 AS - SELECT * FROM t1 WHERE i < 1; -/*u0*/CREATE VIEW v30 AS - SELECT * FROM t1 WHERE t1.i = (SELECT i FROM j1); -/*u0*/CREATE VIEW v31 AS - SELECT * FROM t1 WHERE t1.i in (SELECT i FROM j1); -/*u0*/CREATE VIEW v32 AS - SELECT * FROM t1 WHERE t1.i = (SELECT i FROM j1 WHERE i = 0); -/*u0*/CREATE VIEW v33 AS - SELECT * FROM public.t1 WHERE t1.i = (SELECT i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v34 AS - SELECT * FROM public.t1 WHERE t1.i in (SELECT i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v35 AS - SELECT * FROM public.t1 WHERE t1.i = (SELECT i FROM j1 WHERE i = 0); -/*u0*/CREATE VIEW PUBLIC.v36 AS - SELECT * FROM t1 WHERE t1.i = (SELECT i FROM public.j1); -/*u0*/CREATE VIEW PUBLIC.v37 AS - SELECT * FROM t1 WHERE t1.i in (SELECT i FROM public.j1); -/*u0*/CREATE VIEW PUBLIC.v38 AS - SELECT * FROM t1 WHERE t1.i = (SELECT i FROM public.j1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.v39 AS - SELECT * FROM t1 WHERE t1.i = (SELECT j1.i FROM public.j1); -/*u0*/CREATE VIEW PUBLIC.v40 AS - SELECT * FROM t1 WHERE t1.i in (SELECT j1.i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v41 AS - SELECT * FROM t1 WHERE t1.i = (SELECT j1.i FROM j1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.v42 AS - SELECT * FROM t1 WHERE t1.i = (SELECT i FROM public.j1 WHERE j1.i = 1); -/*u0*/CREATE VIEW PUBLIC.v43 AS - SELECT * FROM t1 WHERE t1.i = (SELECT j1.i FROM j1 WHERE j1.i = 1); -/*u0*/CREATE VIEW PUBLIC.v44 AS - SELECT * FROM t1 WHERE i = (SELECT i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v45 AS - SELECT * FROM t1 WHERE i in (SELECT i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v46 AS - SELECT * FROM t1 WHERE i = (SELECT i FROM j1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.v47 AS - SELECT * FROM public.t1 WHERE i = (SELECT i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v48 AS - SELECT * FROM public.t1 WHERE i in (SELECT i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v49 AS - SELECT * FROM public.t1 WHERE i = (SELECT i FROM j1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.v50 AS - SELECT * FROM t1 WHERE i = (SELECT i FROM public.j1); -/*u0*/CREATE VIEW PUBLIC.v51 AS - SELECT * FROM t1 WHERE i in (SELECT i FROM public.j1); -/*u0*/CREATE VIEW PUBLIC.v52 AS - SELECT * FROM t1 WHERE i = (SELECT i FROM public.j1 WHERE i = 0); -/*u0*/CREATE VIEW PUBLIC.v53 AS - SELECT * FROM t1 WHERE i = (SELECT j1.i FROM public.j1); -/*u0*/CREATE VIEW PUBLIC.v54 AS - SELECT * FROM t1 WHERE i in (SELECT j1.i FROM j1); -/*u0*/CREATE VIEW PUBLIC.v55 AS - SELECT * FROM t1 WHERE i = (SELECT j1.i FROM j1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.v56 AS - SELECT * FROM t1 WHERE i = (SELECT i FROM public.j1 WHERE j1.i = 1); -/*u0*/CREATE VIEW PUBLIC.v57 AS - SELECT * FROM t1 WHERE i = (SELECT j1.i FROM j1 WHERE j1.i = 1); -/*c2*/SELECT * FROM v1; -/*c2*/SELECT * FROM public.v1; -/*c2*/SELECT * FROM v2; -/*c2*/SELECT * FROM v3; -/*c1*/SELECT * FROM v4; -/*c1*/SELECT * FROM v5; -/*c1*/SELECT * FROM v8; -/*c0*/SELECT * FROM v9; -/*c0*/SELECT * FROM v10; -/*c0*/SELECT * FROM v11; -/*e*/SELECT * FROM v12; -/*c0*/SELECT * FROM v13; -/*c0*/SELECT * FROM v14; -/*e*/SELECT * FROM v15; -/*e*/SELECT * FROM v16; -/*c0*/SELECT * FROM v17; -/*c0*/SELECT * FROM v18; -/*c1*/SELECT * FROM v19; -/*c1*/SELECT * FROM v20; -/*c1*/SELECT * FROM v21; -/*c1*/SELECT * FROM v22; -/*c1*/SELECT * FROM v23; -/*c1*/SELECT * FROM v24; -/*c1*/SELECT * FROM v25; -/*c1*/SELECT * FROM v26; -/*c2*/SELECT * FROM v28; -/*c1*/SELECT * FROM v29; -/*c1*/SELECT * FROM v30; -/*c1*/SELECT * FROM v31; -/*c0*/SELECT * FROM v32; -/*c1*/SELECT * FROM v33; -/*c1*/SELECT * FROM v34; -/*c0*/SELECT * FROM v35; -/*c1*/SELECT * FROM v36; -/*c1*/SELECT * FROM v37; -/*c1*/SELECT * FROM v38; -/*c1*/SELECT * FROM v39; -/*c1*/SELECT * FROM v40; -/*c1*/SELECT * FROM v41; -/*c1*/SELECT * FROM v42; -/*c1*/SELECT * FROM v43; -/*c1*/SELECT * FROM v44; -/*c1*/SELECT * FROM v45; -/*c1*/SELECT * FROM v46; -/*c1*/SELECT * FROM v47; -/*c1*/SELECT * FROM v48; -/*c1*/SELECT * FROM v49; -/*c1*/SELECT * FROM v50; -/*c1*/SELECT * FROM v51; -/*c0*/SELECT * FROM v52; -/*c1*/SELECT * FROM v53; -/*c1*/SELECT * FROM v54; -/*c1*/SELECT * FROM v55; -/*c1*/SELECT * FROM v56; -/*c1*/SELECT * FROM v57; -/*c1*/SELECT * FROM v1, j1 WHERE v1.i = j1.i; -/*c1*/SELECT * FROM public.v1, public.j1 WHERE v1.i = j1.i; -/*c2*/SELECT * FROM v1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM v1 WHERE i < 1; -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE v1.i in (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM public.v1 WHERE v1.i in (SELECT i FROM j1); -/*c1*/SELECT * FROM public.v1 WHERE v1.i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE v1.i in (SELECT i FROM public.j1); -/*c0*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM public.j1 WHERE i = 0); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT j1.i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE v1.i in (SELECT j1.i FROM j1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT j1.i FROM j1 WHERE i = 1); -/*c0*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM public.j1 WHERE j1.i = 0); -/*c0*/SELECT * FROM v1 WHERE v1.i = (SELECT j1.i FROM j1 WHERE j1.i = 0); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE i in (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM public.v1 WHERE i = (SELECT i FROM j1); -/*c1*/SELECT * FROM public.v1 WHERE i in (SELECT i FROM j1); -/*c1*/SELECT * FROM public.v1 WHERE i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE i in (SELECT i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM public.j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT j1.i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE i in (SELECT j1.i FROM j1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT j1.i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM public.j1 WHERE j1.i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT j1.i FROM j1 WHERE j1.i = 1); -/*c2*/SELECT * FROM v1; -/*c1*/SELECT * FROM v1 WHERE i = 0; -/*c2*/SELECT * FROM v1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM v1 WHERE i < 1; -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE v1.i in (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM public.v1 WHERE v1.i = (SELECT i FROM j1); -/*c1*/SELECT * FROM public.v1 WHERE v1.i in (SELECT i FROM j1); -/*c1*/SELECT * FROM public.v1 WHERE v1.i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE v1.i in (SELECT i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM public.j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT j1.i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE v1.i in (SELECT j1.i FROM j1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT j1.i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT i FROM public.j1 WHERE j1.i = 1); -/*c1*/SELECT * FROM v1 WHERE v1.i = (SELECT j1.i FROM j1 WHERE j1.i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE i in (SELECT i FROM j1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM public.v1 WHERE i = (SELECT i FROM j1); -/*c1*/SELECT * FROM public.v1 WHERE i in (SELECT i FROM j1); -/*c1*/SELECT * FROM public.v1 WHERE i = (SELECT i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE i in (SELECT i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM public.j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT j1.i FROM public.j1); -/*c1*/SELECT * FROM v1 WHERE i in (SELECT j1.i FROM j1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT j1.i FROM j1 WHERE i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT i FROM public.j1 WHERE j1.i = 1); -/*c1*/SELECT * FROM v1 WHERE i = (SELECT j1.i FROM j1 WHERE j1.i = 1); -/*e*/SELECT * FROM other.v1; -/*e*/SELECT * FROM information_schema.v1; -/*c2*/SELECT * FROM public.v1; -/*c1*/SELECT * FROM public.v1 WHERE i = 0; -/*e*/SELECT * FROM other.v1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.v1 WHERE i = 0; -CREATE TABLE public.t2 AS (SELECT * FROM public.V1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM public.t2; -/*c1*/SELECT * FROM public.v1, public.j1 WHERE v1.i = j1.i; -/*c1*/SELECT * FROM v1, public.j1 WHERE v1.i = j1.i; -/*c1*/SELECT * FROM public.v1, j1 WHERE v1.i = j1.i; -/*c1*/SELECT * FROM v1, j1 WHERE v1.i = j1.i; -/*c1*/SELECT vc FROM public.v1, public.j1 WHERE v1.i = j1.i; -/*c1*/SELECT vc FROM v1, public.j1 WHERE v1.i = j1.i; -/*c1*/SELECT vc FROM public.v1, j1 WHERE v1.i = j1.i; -/*c1*/SELECT vc FROM v1, j1 WHERE v1.i = j1.i; -/*c1*/SELECT j1.vc FROM public.v1, public.j1 WHERE v1.i = j1.i; -/*c1*/SELECT j1.vc FROM v1, public.j1 WHERE v1.i = j1.i; -/*c1*/SELECT j1.vc FROM public.v1, j1 WHERE v1.i = j1.i; -/*c1*/SELECT j1.vc FROM v1, j1 WHERE v1.i = j1.i; -/*c1*/SELECT lbla.vc FROM v1, j1 lbla WHERE v1.i = lbla.i; -/*c1*/SELECT j1.vc FROM v1 lblb, j1 WHERE lblb.i = j1.i; -/*c1*/SELECT lbla.vc FROM v1 lblb, j1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM public.v1, j1 lbla WHERE v1.i = lbla.i; -/*c1*/SELECT j1.vc FROM public.v1 lblb, j1 WHERE lblb.i = j1.i; -/*c1*/SELECT lbla.vc FROM public.v1 lblb, j1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM v1, public.j1 lbla WHERE v1.i = lbla.i; -/*c1*/SELECT j1.vc FROM v1 lblb, public.j1 WHERE lblb.i = j1.i; -/*c1*/SELECT lbla.vc FROM v1 lblb, public.j1 lbla WHERE lblb.i = lbla.i; -CREATE USER otheruser PASSWORD otheruser; -/*u0*/GRANT ALL ON v1 TO otheruser; -/*u0*/GRANT ALL ON public.v2 TO otheruser; -/*e*/GRANT ALL ON other.v3 TO otheruser; -/*e*/GRANT ALL ON information_schema.v3 TO otheruser; -/*u0*/REVOKE ALL ON v1 FROM otheruser RESTRICT; -/*u0*/REVOKE ALL ON public.v2 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON other.v3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.v3 FROM otheruser RESTRICT; -DROP USER otheruser; -/*e*/DROP VIEW other.v1; -/*u0*/DROP VIEW public.v1; -/*e*/DROP VIEW information_schema.v2; -/*u0*/DROP VIEW v2; -/*e*/DROP VIEW v2; -/*u0*/DROP VIEW v3; -/*u0*/DROP VIEW v4; -/*u0*/DROP VIEW v5; -/*u0*/DROP VIEW v6; -/*u0*/DROP VIEW v7; -/*u0*/DROP VIEW v8; -/*u0*/DROP VIEW v9; -/*u0*/DROP VIEW v10; -/*u0*/DROP VIEW v11; -/*u0*/DROP VIEW v13; -/*u0*/DROP VIEW v14; -/*u0*/DROP VIEW v17; -/*u0*/DROP VIEW v18; -/*u0*/DROP VIEW v19; -/*u0*/DROP VIEW v20; -/*u0*/DROP VIEW v21; -/*u0*/DROP VIEW v22; -/*u0*/DROP VIEW v23; -/*u0*/DROP VIEW v24; -/*u0*/DROP VIEW v25; -/*u0*/DROP VIEW v26; -/*u0*/DROP VIEW v28; -/*u0*/DROP VIEW v29; -/*u0*/DROP VIEW v30; -/*u0*/DROP VIEW v31; -/*u0*/DROP VIEW v32; -/*u0*/DROP VIEW v33; -/*u0*/DROP VIEW v34; -/*u0*/DROP VIEW v35; -/*u0*/DROP VIEW v36; -/*u0*/DROP VIEW v37; -/*u0*/DROP VIEW v38; -/*u0*/DROP VIEW v39; -/*u0*/DROP VIEW v40; -/*u0*/DROP VIEW v41; -/*u0*/DROP VIEW v42; -/*u0*/DROP VIEW v43; -/*u0*/DROP VIEW v44; -/*u0*/DROP VIEW v45; -/*u0*/DROP VIEW v46; -/*u0*/DROP VIEW v47; -/*u0*/DROP VIEW v48; -/*u0*/DROP VIEW v49; -/*u0*/DROP VIEW v50; -/*u0*/DROP VIEW v51; -/*u0*/DROP VIEW v52; -/*u0*/DROP VIEW v53; -/*u0*/DROP VIEW v54; -/*u0*/DROP VIEW v55; -/*u0*/DROP VIEW v56; -/*u0*/DROP VIEW v57; -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE j1; --- ****************************** PHASE 1 Indexes -drop view v1 if exists; -drop view v2 if exists; -drop table t1 if exists; -drop table t3 if exists; -drop table t4 if exists; -/*u0*/CREATE TABLE t1 (i int); -/*u0*/CREATE TABLE t3 (i int); -/*u0*/CREATE TABLE t4 (i int); -/*u0*/CREATE UNIQUE INDEX i1 ON t1(i); -/*u0*/CREATE UNIQUE INDEX public.i2 on t3(i); -/*e*/CREATE UNIQUE INDEX other.i3 on t4(i); -/*e*/CREATE UNIQUE INDEX information_schema.i3 on t4(i int); -/*e*/DROP INDEX other.i1; -/*u0*/DROP INDEX public.i1; -/*e*/DROP INDEX information_schema.i2; -/*u0*/DROP INDEX i2; - --- Objects created from Sessions are created as public.object for Phase 1 -/*e*/CREATE TABLE other.t2 (i int); SHOULD FAIL since no such schema --- Create the schema "other" --- /*u0*/CREATE TABLE other.t2 (i int); --- /*u1*/INSERT INTO t2 values(0); --- /*u1*/INSERT INTO t2 values(0); --- /*e*/SELECT * FROM wrong.t2; --- /*c1*/SELECT * FROM other.t2; --- /*c2*/SELECT * FROM other.t1; SHOULD FAIL since we created public.t1 diff --git a/database/hsqldb/testrun/hsqldb/TestSelfNoDmlBug1.txt b/database/hsqldb/testrun/hsqldb/TestSelfNoDmlBug1.txt deleted file mode 100644 index 99332c6e..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfNoDmlBug1.txt +++ /dev/null @@ -1,12 +0,0 @@ --- Tests a bug where with write_delay of 0, DML is not persisted until and --- if DML is committed or DB is "shutdown". If DB stops with no shutdown, --- all work is lost. - ---/*u0*/SET write_delay 0; -/*u0*/CREATE SCHEMA ghostSchema AUTHORIZATION dba; -/*u0*/SET SCHEMA ghostSchema; -/*u0*/CREATE TABLE t1(i int); -/*u0*/CREATE VIEW v1 AS SELECT * FROM t1; -/*c0*/SELECT * FROM v1; -/*c0*/SELECT * FROM t1; -/*u0*/COMMIT; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfNoDmlBug2.txt b/database/hsqldb/testrun/hsqldb/TestSelfNoDmlBug2.txt deleted file mode 100644 index ea055451..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfNoDmlBug2.txt +++ /dev/null @@ -1,12 +0,0 @@ --- Tests a bug where with write_delay of 0, DML is not persisted until and --- if DML is committed or DB is "shutdown". If DB stops with no shutdown, --- all work is lost. - -/*u0*/SET SCHEMA ghostSchema; - -/*s*/DROP SCHEMA ghostSchema CASCADE; - --- N.b. this test is unable to exhibit the problem because --- (a) It doesn't show when data is being written to the .log file; and --- (b) The test runner does a shutdown of some sort. To reproduce --- problem manually, just Ctrl-C out of the session. diff --git a/database/hsqldb/testrun/hsqldb/TestSelfNot.txt b/database/hsqldb/testrun/hsqldb/TestSelfNot.txt deleted file mode 100644 index 91494af5..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfNot.txt +++ /dev/null @@ -1,985 +0,0 @@ --- --- -------------------------------------------------------------------- --- Checking compliance of type INTEGER -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a INTEGER, b INTEGER) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between 1 and 2 --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between 1 and 2 --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in (1, 2) --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in (1, 2) --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 1) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 1) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between 1 and 2) or (b between 1 and 2) --- --- --- -------------------------------------------------------------------- --- Checking compliance of type SMALLINT -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a SMALLINT, b SMALLINT) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between 1 and 2 --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between 1 and 2 --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in (1, 2) --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in (1, 2) --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 1) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2, 1) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 1) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1, 2) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between 1 and 2) or (b between 1 and 2) --- --- --- -------------------------------------------------------------------- --- Checking compliance of type FLOAT -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a FLOAT, b FLOAT) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between 1.0 and 2.0 --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between 1.0 and 2.0 --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in (1.0, 2.0) --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in (1.0, 2.0) --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, 2.0) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2.0, 1.0) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, 2.0) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2.0, 1.0) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, 1.0) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, 2.0) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2.0, 1.0) -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, 2.0) -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (2.0, 1.0) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, 1.0) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values (1.0, 2.0) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between 1.0 and 2.0) or (b between 1.0 and 2.0) --- --- --- -------------------------------------------------------------------- --- Checking compliance of type DATE -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a DATE, b DATE) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between '2003-10-20' and '2005-05-06' --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between '2003-10-20' and '2005-05-06' --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in (DATE'2003-10-20', DATE'2005-05-06') --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in (DATE'2003-10-20', DATE'2005-05-06') --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', '2005-05-06') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06', '2003-10-20') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', '2005-05-06') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06', '2003-10-20') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', '2003-10-20') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', '2005-05-06') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06', '2003-10-20') -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', '2005-05-06') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06', '2003-10-20') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', '2003-10-20') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2003-10-20', '2005-05-06') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between '2003-10-20' and '2005-05-06') or (b between '2003-10-20' and '2005-05-06') --- --- --- -------------------------------------------------------------------- --- Checking compliance of type TIME -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a TIME, b TIME) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between '10:00:00' and '12:32:36' --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between '10:00:00' and '12:32:36' --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in (TIME'10:00:00', TIME'12:32:36') --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in (TIME'10:00:00', TIME'12:32:36') --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', '12:32:36') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('12:32:36', '10:00:00') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', '12:32:36') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('12:32:36', '10:00:00') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', '10:00:00') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', '12:32:36') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('12:32:36', '10:00:00') -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', '12:32:36') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('12:32:36', '10:00:00') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', '10:00:00') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('10:00:00', '12:32:36') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between '10:00:00' and '12:32:36') or (b between '10:00:00' and '12:32:36') --- --- --- -------------------------------------------------------------------- --- Checking compliance of type TIMESTAMP -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a TIMESTAMP, b TIMESTAMP) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between '2004-05-06 12:32:36.491' and '2005-05-06 12:32:36.491' --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between '2004-05-06 12:32:36.491' and '2005-05-06 12:32:36.491' --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in (TIMESTAMP'2004-05-06 12:32:36.491', TIMESTAMP'2005-05-06 12:32:36.491') --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in (TIMESTAMP'2004-05-06 12:32:36.491', TIMESTAMP'2005-05-06 12:32:36.491') --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', '2005-05-06 12:32:36.491') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06 12:32:36.491', '2004-05-06 12:32:36.491') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', '2005-05-06 12:32:36.491') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06 12:32:36.491', '2004-05-06 12:32:36.491') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', '2004-05-06 12:32:36.491') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', '2005-05-06 12:32:36.491') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06 12:32:36.491', '2004-05-06 12:32:36.491') -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', '2005-05-06 12:32:36.491') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2005-05-06 12:32:36.491', '2004-05-06 12:32:36.491') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', '2004-05-06 12:32:36.491') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('2004-05-06 12:32:36.491', '2005-05-06 12:32:36.491') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between '2004-05-06 12:32:36.491' and '2005-05-06 12:32:36.491') or (b between '2004-05-06 12:32:36.491' and '2005-05-06 12:32:36.491') --- --- --- -------------------------------------------------------------------- --- Checking compliance of type CHAR(1) -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a CHAR(1), b CHAR(1)) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between 'a' and 'b' --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between 'a' and 'b' --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in ('a', 'b') --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in ('a', 'b') --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'a') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'a') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between 'a' and 'b') or (b between 'a' and 'b') --- --- --- -------------------------------------------------------------------- --- Checking compliance of type VARCHAR(1) -drop table SQLUNKNOWNCOMPLIANCECHECK if exists -create table SQLUNKNOWNCOMPLIANCECHECK(a VARCHAR(1), b VARCHAR(1)) --- Checking v = NULL -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a = b --- --- Checking NOT v = NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a = b --- --- Checking v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <> b --- --- Checking NOT v <> NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <> b --- --- Checking v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b --- --- Checking NOT v < NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a < b --- --- Checking v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a <= b --- --- Checking NOT v <= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a <= b --- --- Checking v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a > b --- --- Checking NOT v > NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a > b --- --- Checking v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a >= b --- --- Checking NOT v >= NULL -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not a >= b --- --- Checking BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b between 'a' and 'b' --- --- Checking NOT BETWEEN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b between 'a' and 'b' --- --- Checking IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b in ('a', 'b') --- --- Checking NOT IN -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where not b in ('a', 'b') --- --- Checking T && T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 1 --- --- Checking T && F = F -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking T && U = U -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'a') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b and 1 = 0 --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 and a < b --- --- Checking F && F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a and a < b --- --- Checking T || T = T -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c2*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or a > b --- --- Checking T || F = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('b', 'a') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking T || U = T -/*u2*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 1 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'a') -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where a < b or 1 = 0 --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where 1 = 0 or a < b --- --- Checking F || F = F -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', NULL) -/*c0*/ select* from SQLUNKNOWNCOMPLIANCECHECK where b != a or a < b --- --- Checking BETWEEN: >= and <= -/*u1*/ delete from SQLUNKNOWNCOMPLIANCECHECK -/*u1*/ insert into SQLUNKNOWNCOMPLIANCECHECK values ('a', 'b') -/*c1*/ select* from SQLUNKNOWNCOMPLIANCECHECK where (a between 'a' and 'b') or (b between 'a' and 'b') --- - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemA.txt b/database/hsqldb/testrun/hsqldb/TestSelfPersSchemA.txt deleted file mode 100644 index 287a0dc0..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemA.txt +++ /dev/null @@ -1,21 +0,0 @@ -/*s*/DROP USER owner1; -/*s*/DROP ROLE r1; -/*s*/DROP SCHEMA schema_a; -/*s*/DROP SCHEMA schema_b; -/*s*/DROP SCHEMA schema_c; -/*s*/DROP SCHEMA schema_z; - --- Test basic ability to create schemas owned by individual DBAs, --- non-privileged users, and roles. -/*u0*/CREATE USER owner1 password "pwerd"; -/*u0*/CREATE USER adminowner1 password "pwerd"; -/*u0*/CREATE ROLE r1; -/*u0*/GRANT r1 TO owner1; -/*u0*/CREATE SCHEMA schema_a AUTHORIZATION owner1; -/*u0*/CREATE SCHEMA schema_b AUTHORIZATION r1; -/*u0*/CREATE SCHEMA schema_c AUTHORIZATION adminowner1; -/*e*/CREATE SCHEMA schema_z AUTHORIZATION nosuchowner; -/*u0*/DROP SCHEMA schema_c; -/*u0*/DROP USER adminowner1; - -/*u0*/ SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemB.txt b/database/hsqldb/testrun/hsqldb/TestSelfPersSchemB.txt deleted file mode 100644 index 443d1506..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemB.txt +++ /dev/null @@ -1,154 +0,0 @@ -/*s*/DROP USER blaine; -/*s*/DROP USER debbie; -/*s*/DROP SCHEMA bschema cascade; -/*s*/DROP SCHEMA dschema cascade; - --- Test persistence to .log file of personal schemas. -/*u0*/CREATE TABLE schema_a.t1(i int); -/*u0*/DROP SCHEMA schema_a CASCADE; -/*u0*/DROP SCHEMA schema_b; -/*e*/DROP SCHEMA schema_z; -/*u0*/DROP ROLE r1; -/*u0*/DROP USER owner1; - --- Schema authorization of individual User --- Test that non-DBA schema owners can CREATE/SELECT/INSERT objects in their --- own schema but not in somebody else's schema (assuming explicit object --- rights have not been granted, of course). -/*u0*/create table public.ptable(i int); -/*u1*/insert into public.ptable values(9); -/*u0*/CREATE INDEX public.pindex ON public.ptable(i); -/*u0*/CREATE SEQUENCE public.psequence; -/*u0*/create user blaine password "blaine"; -/*u0*/GRANT CHANGE_AUTHORIZATION TO blaine; -/*u0*/create schema bschema authorization blaine; -/*u0*/create table bschema.b1(i int); -/*c0*/select * from bschema.b1; -/*u0*/connect user blaine password "blaine"; -/*c0*/select * from bschema.b1; -/*u1*/insert into bschema.b1 values(3); -/*c1*/select * from bschema.b1; -/*u0*/connect user sa password ""; -/*u0*/create user debbie password debbie; -/*u0*/GRANT CHANGE_AUTHORIZATION TO debbie; -/*u0*/create schema dschema authorization debbie; -/*u0*/create table dschema.d1(i int); -/*u1*/insert into dschema.d1 values(5); -/*u0*/commit; -/*u0*/connect user debbie password debbie; -/*e*/select * from bschema.b1; -/*e*/create table bschema.b3(i int); -/*u0*/create table dschema.d2 (i int); -/*u0*/set schema dschema; -/*c1*/select * from d1; -/*c0*/select * from d2; -/*u0*/connect user blaine password "blaine"; -/*u0*/set schema bschema; -/*e*/create table dschema.d4(i int); -/*u0*/create table b2(i int); -/*c1*/select * from b1; -/*u1*/insert into b1 values(5); -/*u1*/insert into b2 values (55); -/*c2*/select * from b1; -/*c1*/select * from b2; - --- Test of same-named-objects in different schemas. As an Admin. -/*u0*/connect user sa password ""; -/*u0*/CREATE TABLE bschema.sametname(i int); -/*u0*/CREATE TABLE dschema.sametname(i int); -/*u0*/CREATE VIEW bschema.samevname AS SELECT * FROM bschema.sametname; -/*u0*/CREATE VIEW dschema.samevname AS SELECT * FROM dschema.sametname; -/*u0*/CREATE SEQUENCE bschema.samesname START WITH 10; -/*u0*/CREATE SEQUENCE dschema.samesname START WITH 20; -/*u1*/INSERT INTO bschema.sametname(i) VALUES(1); -/*u1*/INSERT INTO dschema.sametname(i) VALUES(2); -/*r1,10*/SELECT i, NEXT VALUE FOR bschema.samesname FROM bschema.sametname; -/*r2,20*/SELECT i, NEXT VALUE FOR dschema.samesname FROM dschema.sametname; -/*r1*/SELECT i FROM bschema.samevname; -/*r2*/SELECT i FROM dschema.samevname; --- Verify that same-named-objects does not make system tables choke -/*u0*/SET SCHEMA information_schema; -SELECT * FROM authorizations; -SELECT * FROM constraint_column_usage; -SELECT * FROM system_columns; -SELECT * FROM system_schemas; -SELECT * FROM schemata; -SELECT * FROM sequences; -SELECT * FROM system_sessioninfo; -SELECT * FROM system_sessions; -SELECT * FROM table_privileges; -SELECT * FROM system_tables; -SELECT * FROM usage_privileges; -SELECT * FROM system_users; - --- Basic user schema permission capability has been tested well above. --- Now LIGHTER TESTING FOR REMAINING COMMANDS AND SCHEMA OBJECT TYPES: --- (purpose to see if the non-Admin, non-right-granted user may do these --- things on his objects, but not to other objects). --- Commands to test: ALTER, DELETE, DROP, GRANT, REVOKE, UPDATE --- Object types to test: INDEX, SEQUENCE, VIEW -/*u0*/connect user blaine password "blaine"; -/*u0*/CREATE TABLE bschema.extra(i1 int); -/*u0*/CREATE TABLE bschema.todrop(i1 int); -/*u1*/insert into bschema.extra values(8); --- First Commands on TABLEs -/*e*/ALTER TABLE public.ptable ADD COLUMN i2 int; -/*u0*/ALTER TABLE bschema.extra ADD COLUMN i2 int; -/*c1*/SELECT * FROM bschema.extra; -/*e*/UPDATE public.ptable SET i = 11; -/*u1*/UPDATE bschema.extra SET i1 = 44; -/*e*/DELETE FROM public.ptable; -/*u1*/DELETE FROM bschema.extra; -/*e*/GRANT SELECT ON public.ptable TO debbie; -/*u0*/GRANT SELECT ON bschema.extra TO debbie; -/*e*/REVOKE SELECT ON public.ptable FROM debbie RESTRICT; -/*u0*/REVOKE SELECT ON bschema.extra FROM debbie RESTRICT; -/*e*/DROP TABLE public.ptable; -/*u0*/DROP TABLE bschema.todrop; --- Commands on INDEXes -/*e*/CREATE INDEX public.i1 ON public.ptable(i); -/*u0*/CREATE UNIQUE INDEX bschema.ui1 ON bschema.extra(i1); -/*c1*/SELECT count(*) FROM bschema.extra; -/*e*/ALTER INDEX public.pindex RENAME TO othername; -/*u0*/ALTER INDEX bschema.ui1 RENAME TO othername; -/*u1*/insert into bschema.extra(i1, i2) values(8,1); --- Following violates the UNIQUE index -/*e*/insert into bschema.extra(i1, i2) values(8,2); -/*e*/DROP INDEX public.pindex; -/*u0*/DROP index bschema.othername; --- Commands on SEQUENCEs -/*e*/CREATE SEQUENCE public.pseq; -/*u0*/CREATE SEQUENCE bschema.bseq; -/*e*/SELECT next value for public.psequence FROM bschema.extra; -/*c1*/SELECT next value for bschema.bseq FROM bschema.extra; -/*e*/ALTER SEQUENCE public.psequence RESTART WITH 10; -/*u0*/ALTER SEQUENCE bschema.bseq RESTART WITH 10; -/*e*/GRANT USAGE ON SEQUENCE public.psequence TO debbie; -/*u0*/GRANT USAGE ON SEQUENCE bschema.bseq TO debbie; -/*e*/REVOKE USAGE ON SEQUENCE public.psequence FROM debbie RESTRICT; -/*u0*/REVOKE USAGE ON SEQUENCE bschema.bseq FROM debbie RESTRICT; -/*e*/DROP SEQUENCE public.psequence; -/*u0*/DROP SEQUENCE bschema.bseq; --- Adding views now. Didn't want them to impact operations on underlying --- tables in tests above. -/*u0*/connect user sa password ""; -/*u0*/create VIEW public.pview AS SELECT * FROM public.ptable; -/*u0*/connect user blaine password "blaine"; -/*e*/create VIEW public.oview AS SELECT * FROM public.ptable; -/*u0*/create VIEW bschema.bview AS SELECT * FROM bschema.extra; -/*e*/SELECT * FROM public.pview; -/*c1*/SELECT * FROM bschema.bview; -/*e*/GRANT SELECT ON public.pview TO debbie; -/*u0*/GRANT SELECT ON bschema.bview TO debbie; -/*e*/REVOKE SELECT ON public.pview FROM debbie RESTRICT; -/*u0*/REVOKE SELECT ON bschema.bview FROM debbie RESTRICT; -/*e*/DROP VIEW public.pview; -/*u0*/DROP VIEW bschema.bview; -/*u0*/DROP TABLE bschema.extra; - -/*u0*/connect user sa password ""; -/*u0*/DROP VIEW public.pview; -/*u0*/DROP INDEX public.pindex; -/*u0*/DROP TABLE public.ptable; -/*u0*/DROP SEQUENCE public.psequence; -/*u0*/SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemC.txt b/database/hsqldb/testrun/hsqldb/TestSelfPersSchemC.txt deleted file mode 100644 index d0c3f594..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemC.txt +++ /dev/null @@ -1,204 +0,0 @@ --- Test persistence via .script file -/*u0*/create table bschema.b5(i int); -/*c0*/select * from bschema.b5; -/*u0*/connect user blaine password "blaine"; -/*c0*/select * from bschema.b5; -/*u1*/insert into bschema.b5 values(3); -/*c1*/select * from bschema.b5; -/*c2*/select * from bschema.b1; -/*u1*/insert into bschema.b1 values(3); -/*c3*/select * from bschema.b1; -/*e*/select * from dschema.d1; -/*u0*/connect user sa password ""; -/*u0*/create table dschema.d5(i int); -/*u1*/insert into dschema.d1 values(56); -/*u1*/insert into dschema.d5 values(5); -/*u0*/commit; -/*u0*/connect user debbie password debbie; -/*e*/select * from bschema.b1; -/*e*/create table bschema.b3(i int); -/*u0*/create table dschema.d6 (i int); -/*u0*/set schema dschema; -/*c2*/select * from d1; -/*c0*/select * from d2; -/*c1*/select * from d5; -/*c0*/select * from d6; - --- Test of same-named-objects in different schemas. As an Admin. --- Verify that same-named-objects does not make system tables choke -/*u0*/SET SCHEMA information_schema; -SELECT * FROM authorizations; -SELECT * FROM constraint_column_usage; -SELECT * FROM system_columns; -SELECT * FROM system_schemas; -SELECT * FROM schemata; -SELECT * FROM sequences; -SELECT * FROM system_sessioninfo; -SELECT * FROM system_sessions; -SELECT * FROM table_privileges; -SELECT * FROM system_tables; -SELECT * FROM usage_privileges; -SELECT * FROM system_users; -/*u0*/connect user sa password ""; -/*r1,11*/SELECT i, NEXT VALUE FOR bschema.samesname FROM bschema.sametname; -/*r2,21*/SELECT i, NEXT VALUE FOR dschema.samesname FROM dschema.sametname; -/*r1*/SELECT i FROM bschema.samevname; -/*r2*/SELECT i FROM dschema.samevname; - --- Cleanup to prepare for next set of tests -/*u0*/connect user sa password ""; -/*u0*/drop schema bschema cascade; -/*u0*/drop schema dschema cascade; -/*u0*/drop user blaine; -/*u0*/drop user debbie; - --- Schema authorization using a Role. --- Test that non-DBA schema owners can CREATE/SELECT/INSERT objects in their --- own schema but not in somebody else's schema (assuming explicit object --- rights have not been granted, of course). -/*u0*/connect user sa password ""; -/*u0*/create user blaine password blaine; -/*u0*/create user debbie password debbie; -/*u0*/GRANT CHANGE_AUTHORIZATION TO blaine; -/*u0*/GRANT CHANGE_AUTHORIZATION TO debbie; -/*u0*/create role r; -/*u0*/create role s; -/*u0*/grant s to r; -/*u0*/create schema aschema authorization s; -/*u0*/create schema bschema authorization s; -/*u0*/create table aschema.a1(i int); -/*u1*/insert into aschema.a1 values(11); -/*u0*/create table bschema.b1(i int); -/*u1*/insert into bschema.b1 values (22); -/*u0*/commit; - --- Test blaine, who will get his authorization via role s via role r. -/*u0*/connect user blaine password blaine; -/*u0*/set schema aschema; -/*e*/create table a2(i int); -/*u0*/set schema bschema; -/*e*/create table b2(i int); -/*e*/select * from aschema.a1; -/*e*/select * from bschema.b1; -/*u0*/connect user sa password ""; -/*u0*/grant r to blaine; -/*u0*/connect user blaine password blaine; -/*u0*/set schema aschema; -/*u0*/create table a2(i int); -/*u0*/set schema bschema; -/*u0*/create table b2(i int); -/*c1*/select * from aschema.a1; -/*c1*/select * from bschema.b1; -/*c0*/select * from aschema.a2; -/*c0*/select * from bschema.b2; - --- Test debbie, who will get her authorization via role r directly. -/*u0*/connect user debbie password debbie; -/*u0*/set schema aschema; -/*e*/create table a3(i int); -/*u0*/set schema bschema; -/*e*/create table b3(i int); -/*e*/select * from aschema.a1; -/*e*/select * from bschema.b1; -/*u0*/connect user sa password ""; -/*u0*/grant s to debbie; -/*u0*/connect user debbie password debbie; -/*u0*/set schema aschema; -/*u0*/create table a3(i int); -/*u0*/set schema bschema; -/*u0*/create table b3(i int); -/*c1*/select * from aschema.a1; -/*c1*/select * from bschema.b1; -/*c0*/select * from aschema.a2; -/*c0*/select * from bschema.b2; -/*c0*/select * from aschema.a3; -/*c0*/select * from bschema.b3; - --- Test of same-named-objects in different schemas. As an Admin. -/*u0*/connect user sa password ""; -/*u0*/CREATE TABLE bschema.sametname(i int); -/*u0*/CREATE TABLE aschema.sametname(i int); -/*u0*/CREATE VIEW bschema.samevname AS SELECT * FROM bschema.sametname; -/*u0*/CREATE VIEW aschema.samevname AS SELECT * FROM aschema.sametname; -/*u0*/CREATE SEQUENCE bschema.samesname START WITH 10; -/*u0*/CREATE SEQUENCE aschema.samesname START WITH 20; -/*u1*/INSERT INTO bschema.sametname(i) VALUES(1); -/*u1*/INSERT INTO aschema.sametname(i) VALUES(2); -/*r1,10*/SELECT i, NEXT VALUE FOR bschema.samesname FROM bschema.sametname; -/*r2,20*/SELECT i, NEXT VALUE FOR aschema.samesname FROM aschema.sametname; -/*r1*/SELECT i FROM bschema.samevname; -/*r2*/SELECT i FROM aschema.samevname; - -/*u0*/connect user sa password ""; -/*u0*/create table public.ptable(i int); -/*u1*/insert into public.ptable values(9); -/*u0*/CREATE INDEX public.pindex ON public.ptable(i); -/*u0*/CREATE SEQUENCE public.psequence; --- Basic user schema permission capability has been tested well above --- Now LIGHTER TESTING FOR REMAINING COMMANDS AND SCHEMA OBJECT TYPES: --- (for authorizations via roles). --- (purpose to see if the non-Admin, non-right-granted user may do these --- things on his objects, but not to other objects). --- Commands to test: ALTER, DELETE, DROP, GRANT, REVOKE, UPDATE --- Object types to test: INDEX, SEQUENCE, VIEW -/*u0*/connect user blaine password blaine; -/*u0*/CREATE TABLE bschema.extra(i1 int); -/*u0*/CREATE TABLE bschema.todrop(i1 int); -/*u1*/insert into bschema.extra values(8); --- First Commands on TABLEs -/*e*/ALTER TABLE public.ptable ADD COLUMN i2 int; -/*u0*/ALTER TABLE bschema.extra ADD COLUMN i2 int; -/*c1*/SELECT * FROM bschema.extra; -/*e*/UPDATE public.ptable SET i = 11; -/*u1*/UPDATE bschema.extra SET i1 = 44; -/*e*/DELETE FROM public.ptable; -/*u1*/DELETE FROM bschema.extra; -/*e*/GRANT SELECT ON public.ptable TO debbie; -/*u0*/GRANT SELECT ON bschema.extra TO debbie; -/*e*/REVOKE SELECT ON public.ptable FROM debbie RESTRICT; -/*u0*/REVOKE SELECT ON bschema.extra FROM debbie RESTRICT; -/*e*/DROP TABLE public.ptable; -/*u0*/DROP TABLE bschema.todrop; --- Commands on INDEXes -/*e*/CREATE INDEX public.i1 ON public.ptable(i); -/*u0*/CREATE UNIQUE INDEX bschema.ui1 ON bschema.extra(i1); -/*c1*/SELECT count(*) FROM bschema.extra; -/*e*/ALTER INDEX public.pindex RENAME TO othername; -/*u0*/ALTER INDEX bschema.ui1 RENAME TO othername; -/*u1*/insert into bschema.extra(i1, i2) values(8,1); --- Following violates the UNIQUE index -/*e*/insert into bschema.extra(i1, i2) values(8,2); -/*e*/DROP INDEX public.pindex; -/*u0*/DROP index bschema.othername; --- Commands on SEQUENCEs -/*e*/CREATE SEQUENCE public.pseq; -/*u0*/CREATE SEQUENCE bschema.bseq; -/*e*/SELECT next value for public.psequence FROM bschema.extra; -/*c1*/SELECT next value for bschema.bseq FROM bschema.extra; -/*e*/ALTER SEQUENCE public.psequence RESTART WITH 10; -/*u0*/ALTER SEQUENCE bschema.bseq RESTART WITH 10; -/*e*/GRANT USAGE ON SEQUENCE public.psequence TO debbie; -/*u0*/GRANT USAGE ON SEQUENCE bschema.bseq TO debbie; -/*e*/REVOKE USAGE ON SEQUENCE public.psequence FROM debbie RESTRICT; -/*u0*/REVOKE USAGE ON SEQUENCE bschema.bseq FROM debbie RESTRICT; -/*e*/DROP SEQUENCE public.psequence; -/*u0*/DROP SEQUENCE bschema.bseq; --- Adding views now. Didn't want them to impact operations on underlying --- tables in tests above. -/*u0*/connect user sa password ""; -/*u0*/create VIEW public.pview AS SELECT * FROM public.ptable; -/*u0*/connect user blaine password blaine; -/*e*/create VIEW public.oview AS SELECT * FROM public.ptable; -/*u0*/create VIEW bschema.bview AS SELECT * FROM bschema.extra; -/*e*/SELECT * FROM public.pview; -/*c1*/SELECT * FROM bschema.bview; -/*e*/GRANT SELECT ON public.pview TO debbie; -/*u0*/GRANT SELECT ON bschema.bview TO debbie; -/*e*/REVOKE SELECT ON public.pview FROM debbie RESTRICT; -/*u0*/REVOKE SELECT ON bschema.bview FROM debbie RESTRICT; -/*e*/DROP VIEW public.pview; -/*u0*/DROP VIEW bschema.bview; -/*u0*/DROP TABLE bschema.extra; - -/*u0*/connect user sa password ""; -/*u0*/shutdown; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemD.txt b/database/hsqldb/testrun/hsqldb/TestSelfPersSchemD.txt deleted file mode 100644 index e22bf44b..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfPersSchemD.txt +++ /dev/null @@ -1,143 +0,0 @@ --- Test persistence via .script file --- Same blaine role tests as in test C, but after persistence. -/*u0*/connect user blaine password blaine; -/*u0*/set schema aschema; -/*u0*/create table a4(i int); -/*u0*/set schema bschema; -/*u0*/create table b4(i int); -/*c1*/select * from aschema.a1; -/*c1*/select * from bschema.b1; -/*c0*/select * from aschema.a2; -/*c0*/select * from bschema.b2; -/*c0*/select * from aschema.a4; -/*c0*/select * from bschema.b4; -/*u0*/connect user debbie password debbie; -/*u0*/set schema aschema; -/*u0*/create table a5(i int); -/*u0*/set schema bschema; -/*u0*/create table b5(i int); -/*c1*/select * from aschema.a1; -/*c1*/select * from bschema.b1; -/*c0*/select * from aschema.a2; -/*c0*/select * from bschema.b2; -/*c0*/select * from aschema.a3; -/*c0*/select * from bschema.b4; -/*c0*/select * from aschema.a4; -/*c0*/select * from bschema.b5; -/*c0*/select * from aschema.a5; -/*c0*/select * from bschema.b3; - -/*u0*/connect user sa password ""; --- FRED: Please tell me if I remember this correctly: --- Next line has no effect, since Role nestings are not preserved in the Roles --- but are resolved statically at grant time. I.e., since r had s when --- r was granted, it doesn't matter what roles are added/removed to/from --- s after that. --- Role nestings ARE preserved in the Roles -/*u0*/revoke s from r restrict; -/*u0*/revoke r from blaine restrict; --- Following not necessary although blaine had both r and s implicitly. -/*e*/revoke s from blaine restrict; -- role s was not directly granted to blaine -/*u0*/revoke s from debbie restrict; - --- Negative tests (after privilege revocation via role revocation) -/*u0*/connect user blaine password blaine; -/*u0*/set schema aschema; -/*e*/create table a6(i int); -/*u0*/set schema bschema; -/*e*/create table b6(i int); -/*e*/select * from aschema.a1; -/*e*/select * from bschema.b1; -/*e*/select * from aschema.a2; -/*e*/select * from bschema.b2; -/*e*/select * from aschema.a4; -/*e*/select * from bschema.b4; -/*u0*/connect user debbie password debbie; -/*u0*/set schema aschema; -/*e*/create table a6(i int); -/*u0*/set schema bschema; -/*e*/create table b6(i int); -/*e*/select * from aschema.a1; -/*e*/select * from bschema.b1; -/*e*/select * from aschema.a2; -/*e*/select * from bschema.b2; -/*e*/select * from aschema.a3; -/*e*/select * from bschema.b4; -/*e*/select * from aschema.a4; -/*e*/select * from bschema.b5; -/*e*/select * from aschema.a5; -/*e*/select * from bschema.b3; - --- USER INITIAL SCHEMA settings tests. Here, we can't test whether the --- settings actually "work", because TestSelf always connects up as "sa". --- But we can test if the SET commands work, and if they get saved properly. -/*u0*/connect user debbie password debbie; --- Need DBA privilege for ALTER USER usage. -/*e*/ALTER USER debbie SET INITIAL SCHEMA public; --- Invalid schema name -/*e*/SET INITIAL SCHEMA bad; -/*rnull*/SELECT initial_schema FROM information_schema.system_users - WHERE USER_NAME = 'DEBBIE'; -/*u0*/SET INITIAL SCHEMA public; -/*rPUBLIC*/SELECT initial_schema FROM information_schema.system_users - WHERE USER_NAME = 'DEBBIE'; -/*u0*/SET INITIAL SCHEMA aschema; -/*rASCHEMA*/SELECT initial_schema FROM information_schema.system_users - WHERE USER_NAME = 'DEBBIE'; --- Special DEFAULT keyword to set to the system default schema. -/*u0*/SET INITIAL SCHEMA DEFAULT; -/*rnull*/SELECT initial_schema FROM information_schema.system_users - WHERE USER_NAME = 'DEBBIE'; -/*u0*/connect user sa password ""; -GRANT dba TO debbie; -/*u0*/connect user debbie password debbie; --- Now that have DBA priv, can run ALTER USER. -/*u0*/ALTER USER debbie SET INITIAL SCHEMA public; --- ... even for other users -/*rnull*/SELECT initial_schema FROM information_schema.system_users - WHERE USER_NAME = 'BLAINE'; -/*u0*/ALTER USER blaine SET INITIAL SCHEMA aschema; -/*rASCHEMA*/SELECT initial_schema FROM information_schema.system_users - WHERE USER_NAME = 'BLAINE'; -/*u0*/ALTER USER blaine SET INITIAL SCHEMA default; -/*rnull*/SELECT initial_schema FROM information_schema.system_users - WHERE USER_NAME = 'BLAINE'; --- Test prohibited schemas -/*e*/ALTER USER debbie SET INITIAL SCHEMA nosuch; -/*e*/SET INITIAL SCHEMA nosuch; --- Test prohibited target Users -/*e*/ALTER USER nosuch SET INITIAL SCHEMA default; -/*e*/ALTER USER nosuch SET INITIAL SCHEMA aschema; -/*e*/ALTER USER _system SET INITIAL SCHEMA default; -/*e*/ALTER USER _system SET INITIAL SCHEMA aschema; -/*e*/ALTER USER public SET INITIAL SCHEMA default; -/*e*/ALTER USER public SET INITIAL SCHEMA aschema; - --- Test user-schema dependencies -/*u0*/connect user sa password ""; -/*u0*/CREATE user depu password "depu"; -/*u0*/CREATE schema deps authorization depu; --- Will fail because a schema is authorized directly by depu -/*e*/DROP USER depu; -/*u0*/DROP SCHEMA deps; -/*u0*/DROP USER depu; -/*u0*/CREATE user depu password "depu"; -/*u0*/CREATE schema deps authorization depu; -/*e*/DROP USER depu; -/*u0*/DROP USER depu CASCADE; --- Roles authorizations are independent of any user. -/*u0*/CREATE user depu password "depu"; -/*u0*/CREATE ROLE depr; -/*u0*/GRANT depr TO depu; -/*u0*/CREATE schema deps authorization depr; -/*u0*/DROP user depu; - --- Test of same-named-objects in different schemas. As an Admin. -/*u0*/connect user sa password ""; -/*r1,11*/SELECT i, NEXT VALUE FOR bschema.samesname FROM bschema.sametname; -/*r2,21*/SELECT i, NEXT VALUE FOR aschema.samesname FROM aschema.sametname; -/*r1*/SELECT i FROM bschema.samevname; -/*r2*/SELECT i FROM aschema.samevname; - -/*u0*/connect user sa password ""; -/*u0*/REVOKE dba FROM debbie RESTRICT; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfPrimaryKeys.txt b/database/hsqldb/testrun/hsqldb/TestSelfPrimaryKeys.txt deleted file mode 100644 index d30cdeb6..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfPrimaryKeys.txt +++ /dev/null @@ -1,37 +0,0 @@ --- --- TestSelfPrimaryKeys.txt --- --- Tests for add / drop primary key constraints --- -drop table testtable if exists cascade; -create cached table testtable ( - aString varchar(256) not null, - firstNum integer not null, - aDate date not null, - secondNum integer not null, - thirdNum integer not null, - aName varchar(32) not null - ); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Current', 22, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Popular', 23, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('New', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Old', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('CCurrent', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('ELV', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('ELNA', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Older', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('RA', 20, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('RP', 2, '2003-11-10', 18, 3, 'my name goes here'); - -alter table testtable add constraint pk_testtable primary key (aString); -alter table testtable drop constraint pk_testtable diff --git a/database/hsqldb/testrun/hsqldb/TestSelfQueries.txt b/database/hsqldb/testrun/hsqldb/TestSelfQueries.txt deleted file mode 100644 index 3b158122..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfQueries.txt +++ /dev/null @@ -1,120 +0,0 @@ --- --- TestSelfQueries.txt --- --- Tests for Query results, especially the neutrality of constraints and indexes --- -drop table TESTTABLE if exists cascade; - -create cached table TESTTABLE ( - aString varchar(256) not null, - firstNum integer not null, - aDate date not null, - secondNum integer not null, - thirdNum integer not null, - aName varchar(32) not null - ); -create index IDX_TESTTABLE_aString on TESTTABLE (aString); -create index IDX_TESTTABLE_aDate_secondNum on TESTTABLE (aDate,secondNum); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Current', 22, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Popular', 23, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('New', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Old', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('CCurrent', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('ELV', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('ELNA', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('Older', 5, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('RA', 20, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('RP', 2, '2003-11-10', 18, 3, 'my name goes here'); -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values ('VS', 3, '2003-11-10', 18, 3, 'my name goes here'); --- -/*c11*/select * from testtable where adate = '2003-11-10' and secondNum = 18; -/*c11*/select * from testtable where (adate, secondNum) = (DATE'2003-11-10', 18); -/*c11*/select * from testtable where adate = '2003-11-10'; -/*c1*/select * from testtable where adate = '2003-11-10' and firstNum = 20; -/*c1*/select * from testtable where (adate, firstNum) = (DATE'2003-11-10', 20); -/*c11*/select * from testtable where adate = '2003-11-10' and thirdNum = 3; -/*c11*/select * from testtable where (adate, thirdNum) = (DATE'2003-11-10', 3); - -drop index IDX_TESTTABLE_aString; -drop index IDX_TESTTABLE_aDate_secondNum; -alter table TESTTABLE add constraint tt_pk primary key (astring); -/*c11*/select * from testtable where adate = '2003-11-10' and secondNum = 18; -/*c11*/select * from testtable where (adate, secondNum) = (DATE'2003-11-10', 18); -/*c11*/select * from testtable where adate = '2003-11-10'; -/*c1*/select * from testtable where adate = '2003-11-10' and firstNum = 20; -/*c11*/select * from testtable where adate = '2003-11-10' and thirdNum = 3; -alter table testtable drop column aname; -/*c1*/select * from testtable where adate = '2003-11-10' and firstNum = 20; -/*c11*/select * from testtable where adate = '2003-11-10' and thirdNum = 3; -alter table testtable add column aname char(10) default 'a string' not null; -/*c1*/select * from testtable where adate = '2003-11-10' and firstNum = 20; -/*c11*/select * from testtable where adate = '2003-11-10' and thirdNum = 3; -/*e*/update testtable set name=null; - --- bug #722443 -DROP TABLE CONFIGUSER IF EXISTS; -CREATE CACHED TABLE CONFIGUSER(USR_USERID NUMERIC NOT NULL PRIMARY KEY,USR_USERNAME VARCHAR(10) NOT NULL,USR_PASSWORD VARCHAR(10)); -INSERT INTO CONFIGUSER VALUES(-5,'guest','guest'); -INSERT INTO CONFIGUSER VALUES(-4,'user','user'); -INSERT INTO CONFIGUSER VALUES(-3,'owner','owner'); -INSERT INTO CONFIGUSER VALUES(-2,'admin','xxx'); -INSERT INTO CONFIGUSER VALUES(-1,'sadmin','xxx'); -INSERT INTO CONFIGUSER VALUES(0,'nobody',null); --- select all users with their username as password -/*c3*/select * from configuser where usr_username = usr_password; --- create a unique index on one column -CREATE UNIQUE INDEX IDX_USERNAME ON CONFIGUSER(USR_USERNAME); --- select all users with their username as password -/*c3*/select * from configuser where usr_username = usr_password; -/*c3*/select * from configuser where usr_username in (select usr_password from configuser) -/*c3*/select * from configuser where usr_password in (select usr_username from configuser) -/*c3*/select * from configuser where usr_password in (usr_username); -/*c2*/select * from configuser where usr_password in ('guest', 'user', 'wrong') -DROP INDEX IDX_USERNAME --- select all users with their username as password -/*c3*/select * from configuser where usr_username = usr_password; -/*c3*/select * from configuser where usr_username in (select usr_password from configuser) -/*c3*/select * from configuser where usr_password in (select usr_username from configuser) -/*c3*/select * from configuser where usr_password in (usr_username); -/*c2*/select * from configuser where usr_password in ('guest', 'user', 'wrong') -CREATE INDEX IDX_USERNAME ON CONFIGUSER(USR_USERNAME); --- select all users with their username as password -/*c3*/select * from configuser where usr_username = usr_password; -/*c3*/select * from configuser where usr_username in (select usr_password from configuser) -/*c3*/select * from configuser where usr_password in (select usr_username from configuser) -/*c3*/select * from configuser where usr_password in (usr_username); -/*c2*/select * from configuser where usr_password in ('guest', 'user', 'wrong') --- --- COUNT(DISTINCT ) when there are no records --- bug #718866 -CREATE TABLE IBANX_PERMIT(ID INT, A1 VARCHAR(10)); -/*r0*/SELECT count(distinct A0.ID) FROM IBANX_PERMIT A0; --- --- use of column aliases in the where clause ---bug #696595 -CREATE TABLE "liste"("kosten" INT, "preis" INT); -insert into "liste" values(100, 10); -/*r100*/SELECT "kosten" AS "total" FROM "liste" WHERE "kosten" > 0 ORDER BY "total" DESC; -/*r110*/SELECT ("kosten"+"preis") AS "total" FROM "liste" WHERE "kosten"+"preis" > 0 ORDER BY "total" DESC; -drop table t1 if exists; -drop table t2 if exists; -create table t1(t1c1 int, t1c2 int); -create table t2(t2c1 int, t2c2 int); -insert into t1 values 1, 2; -insert into t2 values 2, 3; -/*r1,2,2,3*/select * from t1, t2; -/*r1,2,2,3*/select * from t1, t2 where t1c2 = t2c1; -/*r1,2,2,3*/select * from t1 join t2 on t1c2 = t2c1; -/*r1,2,2,3*/select * from t1 left outer join t2 on t1c2 = t2c1; -/*r1,2,2,3*/select * from t1 right outer join t2 on t1c2 = t2c1; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfRightCaching.txt b/database/hsqldb/testrun/hsqldb/TestSelfRightCaching.txt deleted file mode 100644 index 1a0bb5f6..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfRightCaching.txt +++ /dev/null @@ -1,192 +0,0 @@ --- Rights Map and Adminstrative Right Caching tests - -DROP TABLE m IF EXISTS; -CREATE TABLE m(i int); -INSERT INTO m VALUES(11); -CREATE USER cani PASSWORD cani; -/*u0*/GRANT CHANGE_AUTHORIZATION TO cani; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Sanity check of individual grants for user and for public -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO PUBLIC; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM PUBLIC RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Dual grants, but with SELECTs in between (which will rebuild the caches) -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO cani; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO PUBLIC; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM PUBLIC RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Dual grants. No cache build until both GRANTS added. -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO PUBLIC; -GRANT SELECT ON m TO cani; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM PUBLIC RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Ditto, in different sequence. -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO cani; -GRANT SELECT ON m TO PUBLIC; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM PUBLIC RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- ... different sequence -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO PUBLIC; -GRANT SELECT ON m TO cani; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM PUBLIC RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Ditto, in different sequence. -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO cani; -GRANT SELECT ON m TO PUBLIC; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM PUBLIC RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - - --- REPEAT SAME WITH A NAMED ROLE INSTEAD OF PUBLIC -CONNECT USER sa PASSWORD ""; -CREATE ROLE sesamerole; -GRANT sesamerole TO cani; - --- Sanity check of individual grants for user and for sesamerole -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO sesamerole; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM sesamerole RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Dual grants, but with SELECTs in between (which will rebuild the caches) -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO cani; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO sesamerole; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM sesamerole RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Dual grants. No cache build until both GRANTS added. -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO sesamerole; -GRANT SELECT ON m TO cani; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM sesamerole RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Ditto, in different sequence. -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO cani; -GRANT SELECT ON m TO sesamerole; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM sesamerole RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- ... different sequence -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO sesamerole; -GRANT SELECT ON m TO cani; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM sesamerole RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; - --- Ditto, in different sequence. -CONNECT USER sa PASSWORD ""; -GRANT SELECT ON m TO cani; -GRANT SELECT ON m TO sesamerole; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM cani RESTRICT; -CONNECT USER cani PASSWORD cani; -/*c1*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; -REVOKE SELECT ON m FROM sesamerole RESTRICT; -CONNECT USER cani PASSWORD cani; -/*e*/SELECT * FROM m; -CONNECT USER sa PASSWORD ""; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfRoleNesting.txt b/database/hsqldb/testrun/hsqldb/TestSelfRoleNesting.txt deleted file mode 100644 index f9a744d1..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfRoleNesting.txt +++ /dev/null @@ -1,234 +0,0 @@ --- First with a table grant -SET SESSION AUTHORIZATION 'SA' -/*s*/DROP USER peon1; -/*s*/DROP USER peon2; -/*s*/DROP USER peon3; -/*s*/DROP ROLE r1; -/*s*/DROP ROLE r2; -/*s*/DROP ROLE r3; -/*s*/DROP ROLE r12; -DROP TABLE t1 IF exists; -DROP TABLE t2 IF exists; -DROP TABLE t3 IF exists; -DROP TABLE t4 IF exists; -CREATE TABLE t1(i int); -CREATE TABLE t2(i int); -CREATE TABLE t3(i int); -CREATE TABLE t4(i int); -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(2); -INSERT INTO t3 VALUES(3); -INSERT INTO t4 VALUES(4); -COMMIT; -CREATE USER peon1 PASSWORD password; -CREATE USER peon2 PASSWORD password; -CREATE USER peon3 PASSWORD password; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon1; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon2; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon3; -/*u0*/CREATE ROLE r1; -/*u0*/CREATE ROLE r2; -/*u0*/CREATE ROLE r3; -/*u0*/GRANT r3 TO r2; -/*u0*/GRANT r2 TO r1; --- Same role may be nested under the same user/role multiple times. -/*u0*/GRANT r3 TO r1; -/*u0*/REVOKE r3 FROM r1 RESTRICT; -/*u0*/GRANT r1 TO peon1; --- Circular nesting not allowed. -/*e*/GRANT r1 TO r3; - -CONNECT USER peon1 PASSWORD password; -/*e*/SELECT * FROM t1; -CONNECT USER SA PASSWORD ""; -/*u0*/GRANT SELECT on t1 TO r3; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -CONNECT USER SA PASSWORD ""; -/*u0*/REVOKE ALL ON t1 FROM r3 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*e*/SELECT * FROM t1; -CONNECT USER SA PASSWORD ""; -/*u0*/GRANT SELECT ON t1 TO r3; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -CONNECT USER SA PASSWORD ""; -/*u0*/DROP ROLE r3; -CONNECT USER peon1 PASSWORD password; -/*e*/SELECT * FROM t1; - --- Now with Admin priv -CONNECT USER SA PASSWORD ""; -/*s*/DROP USER peon1; -/*s*/DROP USER peon2; -/*s*/DROP USER peon3; -/*s*/DROP ROLE r1; -/*s*/DROP ROLE r2; -/*s*/DROP ROLE r3; -/*s*/DROP ROLE r12; -DROP TABLE t1 IF exists; -CREATE TABLE t1(i int); -INSERT INTO t1 VALUES(1); -COMMIT; -CREATE USER peon1 PASSWORD password; -CREATE USER peon2 PASSWORD password; -CREATE USER peon3 PASSWORD password; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon1; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon2; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon3; -/*u0*/CREATE ROLE r1; -/*u0*/CREATE ROLE r2; -/*u0*/CREATE ROLE r3; -/*u0*/GRANT r3 TO r2; -/*u0*/GRANT r2 TO r1; -/*u0*/GRANT r1 TO peon1; - -CONNECT USER peon1 PASSWORD password; -/*e*/SET TABLE t1 READONLY false; -CONNECT USER SA PASSWORD ""; -/*u0*/GRANT dba TO r3; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; -CONNECT USER SA PASSWORD ""; -/*e*/REVOKE dba FROM r1 RESTRICT; -/*e*/REVOKE dba FROM r2 RESTRICT; -/*u0*/REVOKE dba FROM r3 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*e*/SET TABLE t1 READONLY false; -CONNECT USER SA PASSWORD ""; -/*u0*/GRANT dba TO r3; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; -CONNECT USER SA PASSWORD ""; -/*e*/DROP ROLE dba; - - --- Massively redundant privileges -CONNECT USER SA PASSWORD ""; -DROP TABLE t1 IF exists; -CREATE TABLE t1(i int); -/*s*/DROP USER peon1; -/*s*/DROP ROLE r1; -/*s*/DROP ROLE r2; -/*s*/DROP ROLE r3; -/*s*/DROP ROLE r31; -/*s*/DROP ROLE r311; -/*u0*/CREATE ROLE r1; -/*u0*/CREATE ROLE r2; -/*u0*/CREATE ROLE r3; -/*u0*/CREATE ROLE r31; -/*u0*/CREATE ROLE r311; -/*u0*/GRANT r31 to r3; -/*u0*/GRANT dba TO r1; -/*u0*/GRANT dba TO r2; -/*u0*/GRANT dba TO r3; -/*u0*/GRANT dba TO r31; -/*u0*/GRANT dba TO r311; -/*u0*/GRANT r311 TO r31; -CREATE USER peon1 PASSWORD password ADMIN; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon1; -CONNECT USER sa PASSWORD ""; -/*u0*/GRANT r1 TO peon1; -/*u0*/GRANT r2 TO peon1; -/*u0*/GRANT r3 TO peon1; -/*u0*/GRANT r31 TO peon1; -/*u0*/GRANT r311 TO peon1; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; --- Start revoking, piecemeal -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE dba FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r1 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; -CONNECT USER sa PASSWORD ""; -/*u0*/DROP ROLE r2; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r311 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r3 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*u0*/SET TABLE t1 READONLY false; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r31 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*e*/SET TABLE t1 READONLY false; - --- Ditto for table privilege -CONNECT USER SA PASSWORD ""; -DROP TABLE t1 IF exists; -CREATE TABLE t1(i int); -/*u1*/INSERT INTO t1 VALUES(1); -COMMIT; -/*s*/DROP USER peon1; -/*s*/DROP ROLE r1; -/*s*/DROP ROLE r2; -/*s*/DROP ROLE r3; -/*s*/DROP ROLE r31; -/*s*/DROP ROLE r311; -/*u0*/CREATE ROLE r1; -/*u0*/CREATE ROLE r2; -/*u0*/CREATE ROLE r3; -/*u0*/CREATE ROLE r31; -/*u0*/CREATE ROLE r311; -/*u0*/GRANT r31 to r3; -/*u0*/GRANT SELECT ON t1 TO r1; -/*u0*/GRANT SELECT ON t1 TO r2; -/*u0*/GRANT SELECT ON t1 TO r3; -/*u0*/GRANT SELECT ON t1 TO r31; -/*u0*/GRANT SELECT ON t1 TO r311; -/*u0*/GRANT r311 TO r31; -CREATE USER peon1 PASSWORD password; -/*u0*/GRANT CHANGE_AUTHORIZATION TO peon1; -CONNECT USER peon1 PASSWORD password; -/*e*/SELECT * FROM t1; -CONNECT USER sa PASSWORD ""; -/*u0*/GRANT SELECT ON t1 TO peon1; -/*u0*/GRANT r1 TO peon1; -/*u0*/GRANT r2 TO peon1; -/*u0*/GRANT r3 TO peon1; -/*u0*/GRANT r31 TO peon1; -/*u0*/GRANT r311 TO peon1; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; --- Start revoking, piecemeal -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE SELECT ON t1 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r1 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -CONNECT USER sa PASSWORD ""; -/*u0*/DROP ROLE r2; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r311 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r3 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*c1*/SELECT * FROM t1; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE r31 FROM peon1 RESTRICT; -CONNECT USER peon1 PASSWORD password; -/*e*/SELECT * FROM t1; - -CONNECT USER sa PASSWORD ""; -/*s*/DROP ROLE r1 CASCADE; -/*s*/DROP ROLE r2 CASCADE; -/*s*/DROP ROLE r3 CASCADE; -/*d*/ Workaround for bug where DDL will not Commit -/*s*/CREATE TABLE bug_workaround (i int); -/*s*/INSERT INTO bug_workaround VALUES(1); -/*u0*/SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaCasc.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaCasc.txt deleted file mode 100644 index 5e744801..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaCasc.txt +++ /dev/null @@ -1,79 +0,0 @@ --- schema TESTS WRT cascading - -/*u0*/SET SCHEMA information_schema; - -/*u0*/create user sa1 password "sa1" admin; -/*u0*/create user sa2 password "sa2" admin; -/*u0*/create user sa3 password "sa3" admin; - -/*u0*/create role r1; -/*u0*/create role r2; -/*u0*/create role r3; - -/*u0*/create schema s1 authorization sa1; -/*u0*/create schema s2 authorization dba; -/*u0*/create schema s3 authorization r1; - --- These should have no effect on direct or indirect schema drops, since --- only DIRECT schema owners incur dependencies that prevent deletions. -/*u0*/grant r1 to r2; -/*u0*/grant r2 to sa2; - -/*e*/drop role r1; -/*e*/drop user sa1; - -/*u0*/CREATE TABLE s1.t1(i int); -/*u0*/CREATE TABLE s2.t2(i int); -/*u0*/CREATE TABLE s3.t3(i int); - --- Can't drop schemas which contain objects without CASCADE option -/*e*/drop schema s1; -/*e*/drop schema s2; -/*e*/drop schema s3; -/*e*/drop user sa1; - -/*c1*/SELECT * FROM schemata WHERE schema_name = 'S1'; -/*c1*/SELECT * FROM schemata WHERE schema_name = 'S2'; -/*c1*/SELECT * FROM schemata WHERE schema_name = 'S3'; -/*c1*/SELECT * FROM system_tables - WHERE table_schem = 'S1' AND table_name = 'T1'; -/*c1*/SELECT * FROM system_tables - WHERE table_schem = 'S2' AND table_name = 'T2'; -/*c1*/SELECT * FROM system_tables - WHERE table_schem = 'S3' AND table_name = 'T3'; - --- DROP USER... CASCADEs invoke DROP SCHEMA... CASCADEs. -/*u0*/DROP USER sa3; -/*u0*/DROP USER sa2; -/*u0*/DROP USER sa1 CASCADE; -/*e*/drop role r1; - -/*c0*/SELECT * FROM schemata WHERE schema_name = 'S1'; -/*c1*/SELECT * FROM schemata WHERE schema_name = 'S2'; -/*c1*/SELECT * FROM schemata WHERE schema_name = 'S3'; -/*c0*/SELECT * FROM system_tables - WHERE table_schem = 'S1' AND table_name = 'T1'; -/*c1*/SELECT * FROM system_tables - WHERE table_schem = 'S2' AND table_name = 'T2'; -/*c1*/SELECT * FROM system_tables - WHERE table_schem = 'S3' AND table_name = 'T3'; - -/*u0*/drop role r1 CASCADE; -/*c0*/SELECT * FROM schemata WHERE schema_name = 'S1'; -/*c1*/SELECT * FROM schemata WHERE schema_name = 'S2'; -/*c0*/SELECT * FROM schemata WHERE schema_name = 'S3'; -/*c0*/SELECT * FROM system_tables - WHERE table_schem = 'S1' AND table_name = 'T1'; -/*c1*/SELECT * FROM system_tables - WHERE table_schem = 'S2' AND table_name = 'T2'; -/*c0*/SELECT * FROM system_tables - WHERE table_schem = 'S3' AND table_name = 'T3'; - -/*s*/DROP role r2 CASCADE; -/*s*/DROP user sa2 CASCADE; -/*s*/DROP user sa3 CASCADE; - --- Workaround for bug where DDL will not Commit -/*s*/CREATE TABLE bug_workaround (i int); -/*s*/INSERT INTO bug_workaround VALUES(1); -/*u0*/SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaMisc.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaMisc.txt deleted file mode 100644 index 0ca13383..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaMisc.txt +++ /dev/null @@ -1,18 +0,0 @@ -drop schema schemafk1 if exists -drop schema schemafk2 if exists -create schema schemafk1 authorization dba; -create table schemafk1.table1 ( table1_id integer primary key); -create schema schemafk2 authorization dba; -create table schemafk2.table2 (table2_id integer primary key, table1_id - integer, foreign key (table1_id) references schemafk1.table1); -create table schemafk2.table3 (table3_id integer primary key, table1_id integer); -alter table schemafk2.table3 add constraint fktbl3 foreign key (table1_id) - references schemafk1.table1; -create table schemafk2.table4 (table4_id integer primary key, table1_id integer); -alter table schemafk2.table4 add constraint fktbl4 foreign key (table1_id) - references schemafk1.table1 (table1_id); - -comment on table schemafk1.table1 is 'a short table comment'; -comment on column schemafk1.table1.table1_id is 'a short column comment'; - -/*c2*/select * from information_schema.system_comments where object_schema='SCHEMAFK1' diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPerCachTbl1.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPerCachTbl1.txt deleted file mode 100644 index b6a54071..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPerCachTbl1.txt +++ /dev/null @@ -1,40 +0,0 @@ --- CREATE AND INITIALIZE CACHED TABLE OBJECTS - --- This CREATES the schema-specific objects to be used for --- schema-specific persistence tests. - - --- ****************************** CACH Tables ---DROP TABLE nosuch; -DROP TABLE ctblt1 IF exists; -DROP TABLE ctblt2 IF exists; -DROP TABLE ctblt3 IF exists; -DROP TABLE ctblt4 IF exists; -DROP TABLE ctblt101 IF exists; -DROP TABLE tblj1 IF exists; -/*u0*/CREATE CACHED TABLE ctblt1 (i int); -/*u0*/CREATE CACHED TABLE public.ctblt2 (i int); -/*u0*/CREATE CACHED TABLE ctblt3 (i int); -/*u0*/CREATE CACHED TABLE tblj1 (i int, vc varchar(10)); -- For testing Joins -/*e*/CREATE CACHED TABLE information_schema.ctblt101 (i int); -/*e*/CREATE CACHED TABLE ctblt1 (i int); -- Create existing object -/*e*/CREATE CACHED TABLE public.ctblt1 (i int); -- Create existing object -/*e*/CREATE CACHED TABLE information_schema.system_users (i int); -- Existing object -/*e*/INSERT INTO other.ctblt1 values(0); -/*e*/INSERT INTO information_schema.ctblt1 values(1); -/*u1*/INSERT INTO ctblt1 values(0); -/*u1*/INSERT INTO public.ctblt1 values(100); --- Test one update that will be persisted (most update tests won't be) -/*u1*/UPDATE public.ctblt1 set i = 1 WHERE i = 100; -/*u1*/INSERT INTO tblj1 values(1, 'one'); -CREATE TABLE public.ctblt4 AS (SELECT * FROM public.ctblt1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM public.ctblt4; --- Work-around -ALTER TABLE ctblt1 ADD CONSTRAINT cpk_workaround PRIMARY KEY(i); - --- ****************************** ALTERs --- Add tests when time permits. - - --- This to test recovery from .log files. -SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPerCachTbl2.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPerCachTbl2.txt deleted file mode 100644 index 2b0d0efd..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPerCachTbl2.txt +++ /dev/null @@ -1,138 +0,0 @@ --- TEST CACHED TABLE OBJECTS - --- This TESTS the schema-specific objects created in a previous script. - -CREATE USER otheruser PASSWORD otheruser; - - --- ****************************** CACH Tables -/*c2*/SELECT * FROM ctblt1; -/*c1*/SELECT * FROM ctblt1 WHERE i = 0; -/*c2*/SELECT * FROM ctblt1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM ctblt1 WHERE i < 1; -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i in (SELECT i FROM tblj1); -/*c0*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM public.ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.ctblt1 WHERE ctblt1.i in (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i in (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM public.tblj1 WHERE i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT tblj1.i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i in (SELECT tblj1.i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT tblj1.i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM public.tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT tblj1.i FROM tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i in (SELECT i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM public.ctblt1 WHERE i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.ctblt1 WHERE i in (SELECT i FROM tblj1); -/*c0*/SELECT * FROM public.ctblt1 WHERE i = (SELECT i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i in (SELECT i FROM public.tblj1); -/*c0*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM public.tblj1 WHERE i = 0); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT tblj1.i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i in (SELECT tblj1.i FROM tblj1); -/*c0*/SELECT * FROM ctblt1 WHERE i = (SELECT tblj1.i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM public.tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT tblj1.i FROM tblj1 WHERE tblj1.i = 1); -/*e*/SELECT * FROM system_users WHERE user_name = 'SA'; -/*e*/SELECT * FROM other.ctblt1; -/*e*/SELECT * FROM other.system_users; -/*e*/SELECT * FROM information_schema.ctblt1; -/*e*/SELECT * FROM public.system_users; -/*c2*/SELECT * FROM public.ctblt1; -/*c1*/SELECT * FROM information_schema.system_users WHERE user_name = 'SA'; -/*c1*/SELECT * FROM public.ctblt1 WHERE i = 0; -/*e*/SELECT * FROM other.ctblt1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.ctblt1 WHERE i = 0; -/*c1*/SELECT * FROM public.ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT * FROM ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT * FROM public.ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT * FROM ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM public.ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM public.ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM public.ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM public.ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM ctblt1, tblj1 lbla WHERE ctblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM ctblt1 lblb, tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM ctblt1 lblb, tblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM public.ctblt1, tblj1 lbla WHERE ctblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM public.ctblt1 lblb, tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM public.ctblt1 lblb, tblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM ctblt1, public.tblj1 lbla WHERE ctblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM ctblt1 lblb, public.tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM ctblt1 lblb, public.tblj1 lbla WHERE lblb.i = lbla.i; -/*u0*/SET TABLE ctblt1 READONLY true; -/*e*/UPDATE ctblt1 set i = 11 WHERE i = 1; -/*u0*/SET TABLE public.ctblt1 READONLY true; -/*e*/SET TABLE information_schema.ctblt1 READONLY true; -/*e*/SET TABLE other.ctblt1 READONLY true; -/*u0*/SET TABLE ctblt1 READONLY false; -/*u0*/SET TABLE public.ctblt1 READONLY false; -/*c2*/SELECT i FROM ctblt1; --- N.b.: Do not commit DML changes so that this whole block may be repeated. -COMMIT; -SET AUTOCOMMIT false; -/*u1*/UPDATE ctblt1 set i = 11 WHERE i = 1; -/*u1*/UPDATE ctblt1 set ctblt1.i = 12 WHERE i = 11; -/*u1*/UPDATE ctblt1 set ctblt1.i = 13 WHERE ctblt1.i = 12; -/*u1*/UPDATE public.ctblt1 set i = 14 WHERE i = 13; -/*u1*/UPDATE public.ctblt1 set ctblt1.i = 15 WHERE i = 14; -/*u1*/UPDATE public.ctblt1 set ctblt1.i = 16 WHERE ctblt1.i = 15; -/*e*/UPDATE other.ctblt1 set ctblt1.i = 17 WHERE ctblt1.i = 16; -/*e*/UPDATE information_schema.ctblt1 set ctblt1.i = 17 WHERE ctblt1.i = 16; -/*u1*/UPDATE ctblt1 ali set i = 17 WHERE i = 16; -/*u1*/UPDATE ctblt1 ali set ali.i = 18 WHERE i = 17; -/*u1*/UPDATE ctblt1 ali set ali.i = 19 WHERE ali.i = 18; -/*u1*/UPDATE ctblt1 ali set i = 20 WHERE ali.i = 19; -/*u1*/UPDATE public.ctblt1 ali set i = 21 WHERE i = 20; -/*u1*/UPDATE public.ctblt1 ali set ali.i = 22 WHERE i = 21; -/*u1*/UPDATE public.ctblt1 ali set ali.i = 23 WHERE ali.i = 22; -/*u1*/UPDATE public.ctblt1 ali set i = 24 WHERE ali.i = 23; -/*e*/UPDATE other.ctblt1 ali set i = 25 WHERE ali.i = 24; -/*e*/UPDATE other.ctblt1 ali set i = 25 WHERE .i = 24; -/*e*/UPDATE other.ctblt1 set i = 25 WHERE i = 24; -/*e*/DELETE FROM other.ctblt1 ali WHERE ali.i = 24; -/*e*/DELETE FROM other.ctblt1 ali; -/*e*/DELETE FROM other.ctblt1 set WHERE i = 24; -/*e*/DELETE FROM other.ctblt1 WHERE i = 24; -/*e*/DELETE FROM system_information.tblj1 WHERE tblj1.i = 1; -/*u1*/DELETE FROM ctblt1 WHERE i = 0; -/*u1*/DELETE FROM public.ctblt1 WHERE i = 24; -/*u1*/DELETE FROM public.tblj1 WHERE tblj1.i = 1; -ROLLBACK; -/*c2*/SELECT i FROM ctblt1; -/*u0*/GRANT ALL ON ctblt1 TO otheruser; -/*u0*/GRANT ALL ON public.ctblt2 TO otheruser; -/*e*/GRANT ALL ON other.ctblt3 TO otheruser; -/*e*/GRANT ALL ON information_schema.ctblt3 TO otheruser; -/*u0*/REVOKE ALL ON ctblt1 FROM otheruser RESTRICT; -/*u0*/REVOKE ALL ON public.ctblt2 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON other.ctblt3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.ctblt3 FROM otheruser RESTRICT; -/*e*/DROP TABLE other.ctblt3; -/*e*/DROP TABLE information_schema.ctblt4; -/*e*/DROP TABLE ctblt101; -/*e*/DROP TABLE public.ctblt101; -/*u0*/DROP TABLE ctblt101 IF EXISTS; -/*u0*/DROP TABLE public.ctblt101 IF EXISTS; --- Should "DROP TABLE nonexistentschema.notable IF EXISTS" work? -/*u0*/DROP TABLE other.system_users IF exists; -/*u0*/DROP TABLE system_users IF exists; - --- ****************************** ALTERs --- Add tests when time permits. - -DROP USER otheruser; - - --- This to test .script persistence. -SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistA1.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistA1.txt deleted file mode 100644 index 54f820d7..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistA1.txt +++ /dev/null @@ -1,439 +0,0 @@ --- CREATE AND INITIALIZE OBJECTS - --- This CREATES the schema-specific objects to be used for --- schema-specific persistence tests. --- (See the *C[12].txt scripts for similar tests of ALTER comands (which --- this script purposefully omits). - - --- ****************************** MEM Tables ---DROP TABLE nosuch; -DROP TABLE tblt1 IF exists; -DROP TABLE tblt2 IF exists; -DROP TABLE tblt3 IF exists; -DROP TABLE tblt4 IF exists; -DROP TABLE tblt101 IF exists; -DROP TABLE tblj1 IF exists; -/*u0*/CREATE TABLE tblt1 (i int); -/*u0*/CREATE TABLE public.tblt2 (i int); -/*u0*/CREATE TABLE tblt3 (i int); -/*u0*/CREATE TABLE tblj1 (i int, vc varchar(10)); -- For testing Joins -/*e*/CREATE TABLE information_schema.tblt101 (i int); -/*e*/CREATE TABLE tblt1 (i int); -- Create existing object -/*e*/CREATE TABLE public.tblt1 (i int); -- Create existing object -/*e*/CREATE TABLE information_schema.system_users (i int); -- Existing object -/*e*/INSERT INTO other.tblt1 values(0); -/*e*/INSERT INTO information_schema.tblt1 values(1); -/*u1*/INSERT INTO tblt1 values(0); -/*u1*/INSERT INTO public.tblt1 values(100); --- Test one update that will be persisted (most update tests won't be) -/*u1*/UPDATE public.tblt1 set i = 1 WHERE i = 100; -/*u1*/INSERT INTO tblj1 values(1, 'one'); -CREATE TABLE public.tblt4 AS (SELECT * FROM public.tblt1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM public.tblt4; - --- ****************************** CACH Tables ---DROP TABLE nosuch; -DROP TABLE ctblt1 IF exists; -DROP TABLE ctblt2 IF exists; -DROP TABLE ctblt3 IF exists; -DROP TABLE ctblt4 IF exists; -DROP TABLE ctblt101 IF exists; -DROP TABLE tblj1 IF exists; -/*u0*/CREATE CACHED TABLE ctblt1 (i int); -/*u0*/CREATE CACHED TABLE public.ctblt2 (i int); -/*u0*/CREATE CACHED TABLE ctblt3 (i int); -/*u0*/CREATE CACHED TABLE tblj1 (i int, vc varchar(10)); -- For testing Joins -/*e*/CREATE CACHED TABLE information_schema.ctblt101 (i int); -/*e*/CREATE CACHED TABLE ctblt1 (i int); -- Create existing object -/*e*/CREATE CACHED TABLE public.ctblt1 (i int); -- Create existing object -/*e*/CREATE CACHED TABLE information_schema.system_users (i int); -- Existing object -/*e*/INSERT INTO other.ctblt1 values(0); -/*e*/INSERT INTO information_schema.ctblt1 values(1); -/*u1*/INSERT INTO ctblt1 values(0); -/*u1*/INSERT INTO public.ctblt1 values(100); --- Test one update that will be persisted (most update tests won't be) -/*u1*/UPDATE public.ctblt1 set i = 1 WHERE i = 100; -/*u1*/INSERT INTO tblj1 values(1, 'one'); -CREATE TABLE public.ctblt4 AS (SELECT * FROM public.ctblt1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM public.ctblt4; - --- ****************************** Views -DROP VIEW vwv1 IF exists; -DROP VIEW vwv2 IF exists; -DROP VIEW vwv3 IF exists; -DROP VIEW vwv4 IF exists; -DROP VIEW vwv5 IF exists; -DROP VIEW vwv6 IF exists; -DROP VIEW vwv7 IF exists; -DROP VIEW vwv8 IF exists; -DROP VIEW vwv9 IF exists; -DROP VIEW vwv10 IF exists; -DROP VIEW vwv11 IF exists; -DROP VIEW vwv12 IF exists; -DROP VIEW vwv13 IF exists; -DROP VIEW vwv14 IF exists; -DROP VIEW vwv15 IF exists; -DROP VIEW vwv16 IF exists; -DROP VIEW vwv17 IF exists; -DROP VIEW vwv18 IF exists; -DROP VIEW vwv19 IF exists; -DROP VIEW vwv20 IF exists; -DROP VIEW vwv21 IF exists; -DROP VIEW vwv22 IF exists; -DROP VIEW vwv23 IF exists; -DROP VIEW vwv24 IF exists; -DROP VIEW vwv25 IF exists; -DROP VIEW vwv26 IF exists; -DROP VIEW vwv101 IF exists; -DROP TABLE vwt1 IF exists; -DROP TABLE vwt2 IF exists; -DROP TABLE vwj1 IF exists; -CREATE TABLE vwt1 (i int); -CREATE TABLE vwj1 (i int, vc varchar(10)); -INSERT INTO vwt1 values(0); -INSERT INTO vwt1 values(1); -INSERT INTO vwj1 values(1, 'one'); -/*e*/CREATE VIEW information_schema.vwv101 AS - SELECT * FROM information_schema.system_users; -/*e*/CREATE VIEW information_schema.vwv101 AS - SELECT * FROM vwt1; --- I think we prohibit ANY manual creation of objects in information_schema. -/*e*/CREATE VIEW information_schema.vwv4 AS - SELECT * FROM public.vwt1; -/*e*/CREATE VIEW vwv101 AS SELECT * FROM other.vwt1; -/*e*/CREATE VIEW public.vwv101 AS SELECT * FROM other.vwt1; -/*e*/CREATE VIEW other.vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE user_name = vc; -/*e*/CREATE VIEW other.vwv101 AS SELECT * - FROM information_schema.system_users, public.vwj1 WHERE user_name = vc; -/*e*/CREATE VIEW other.vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE information_schema.user_name = vc; -/*e*/CREATE VIEW other.vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE information_schema.user_name = public.vc; -/*e*/CREATE VIEW information_schema.vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE user_name = vc; -/*e*/CREATE VIEW information_schema.vwv101 AS SELECT * - FROM information_schema.system_users, public.vwj1 WHERE user_name = vc; -/*e*/CREATE VIEW information_schema.vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE information_schema.user_name = vc; -/*e*/CREATE VIEW information_schema.vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE information_schema.user_name = public.vc; -/*e*/CREATE VIEW vwv101 AS SELECT * FROM system_users, vwj1 WHERE user_name = vc; -/*e*/CREATE VIEW vwv101 AS SELECT * - FROM information_schema.system_users, information_schema.vwj1 - WHERE user_name = vc; -/*e*/CREATE VIEW vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE other.user_name = vc; -/*e*/CREATE VIEW vwv101 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE public.user_name = public.vc; -/*u0*/CREATE VIEW vwv1 AS SELECT * FROM vwt1; -/*e*/CREATE VIEW public.vwv1 AS SELECT * FROM vwt1; -- Create existing object -/*e*/CREATE VIEW public.vwv1 AS SELECT * FROM public.vwt1; -- Existing object -/*u0*/CREATE VIEW public.vwv2 AS SELECT * FROM vwt1; -/*u0*/CREATE VIEW public.vwv3 AS SELECT * FROM public.vwt1; -/*u0*/CREATE VIEW public.vwv4 AS SELECT * FROM vwt1 WHERE i = 0; -/*u0*/CREATE VIEW public.vwv5 AS SELECT * FROM vwt1 WHERE i < 1; -/*u0*/CREATE VIEW public.vwv6 AS SELECT * FROM information_schema.system_users - WHERE user_name = 'SA'; -/*u0*/CREATE VIEW vwv7 AS SELECT * FROM information_schema.system_users; -/*u0*/CREATE VIEW vwv8 AS SELECT * FROM information_schema.system_users - WHERE user_name = 'SA'; -/*u0*/CREATE VIEW vwv9 AS SELECT * FROM information_schema.system_users, vwj1 - WHERE user_name = vc; -/*u0*/CREATE VIEW vwv10 AS SELECT * - FROM information_schema.system_users, public.vwj1 WHERE user_name = vc; -/*u0*/CREATE VIEW vwv11 AS SELECT * FROM information_schema.system_users, vwj1 - WHERE system_users.user_name = vc; -/*u0*/CREATE VIEW vwv12 AS SELECT * FROM information_schema.system_users, vwj1 - WHERE system_users.user_name = vwj1.vc; -/*u0*/CREATE VIEW public.vwv13 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE user_name = vc; -/*u0*/CREATE VIEW public.vwv14 AS SELECT * - FROM information_schema.system_users, public.vwj1 WHERE user_name = vc; -/*u0*/CREATE VIEW public.vwv15 AS SELECT * - FROM information_schema.system_users, vwj1 - WHERE system_users.user_name = vc; -/*u0*/CREATE VIEW public.vwv16 AS SELECT * - FROM information_schema.system_users, public.vwj1 - WHERE system_users.user_name = vwj1.vc; -/*u0*/CREATE VIEW vwv17 AS SELECT * FROM information_schema.system_users, vwj1 - WHERE user_name = vc; -/*u0*/CREATE VIEW vwv18 AS SELECT * - FROM information_schema.system_users, public.vwj1 WHERE user_name = vc; -/*u0*/CREATE VIEW vwv19 (v1, v2, v3) AS SELECT * FROM vwt1, vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW vwv20 (v1, v2, v3) AS SELECT * FROM public.vwt1, public.vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW vwv21 (v1, v2, v3) AS SELECT * FROM public.vwt1, vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW vwv22 (v1, v2, v3) AS SELECT * FROM vwt1, public.vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW public.vwv23 (v1, v2, v3) AS - SELECT * FROM vwt1, vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW public.vwv24 (v1, v2, v3) AS - SELECT * FROM public.vwt1, public.vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW public.vwv25 (v1, v2, v3) AS SELECT * FROM public.vwt1, vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW public.vwv26 (v1, v2, v3) AS SELECT * FROM vwt1, public.vwj1 WHERE vwt1.i = vwj1.i; -/*u0*/CREATE VIEW vwv28 AS - SELECT * FROM vwt1 WHERE i in (0, 1, 11, 12); -/*u0*/CREATE VIEW public.vwv29 AS - SELECT * FROM vwt1 WHERE i < 1; -/*u0*/CREATE VIEW vwv30 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT i FROM vwj1); -/*u0*/CREATE VIEW vwv31 AS - SELECT * FROM vwt1 WHERE vwt1.i in (SELECT i FROM vwj1); -/*u0*/CREATE VIEW vwv32 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT i FROM vwj1 WHERE i = 0); -/*u0*/CREATE VIEW vwv33 AS - SELECT * FROM public.vwt1 WHERE vwt1.i = (SELECT i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv34 AS - SELECT * FROM public.vwt1 WHERE vwt1.i in (SELECT i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv35 AS - SELECT * FROM public.vwt1 WHERE vwt1.i = (SELECT i FROM vwj1 WHERE i = 0); -/*u0*/CREATE VIEW PUBLIC.vwv36 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT i FROM public.vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv37 AS - SELECT * FROM vwt1 WHERE vwt1.i in (SELECT i FROM public.vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv38 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT i FROM public.vwj1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv39 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT vwj1.i FROM public.vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv40 AS - SELECT * FROM vwt1 WHERE vwt1.i in (SELECT vwj1.i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv41 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT vwj1.i FROM vwj1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv42 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT i FROM public.vwj1 WHERE vwj1.i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv43 AS - SELECT * FROM vwt1 WHERE vwt1.i = (SELECT vwj1.i FROM vwj1 WHERE vwj1.i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv44 AS - SELECT * FROM vwt1 WHERE i = (SELECT i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv45 AS - SELECT * FROM vwt1 WHERE i in (SELECT i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv46 AS - SELECT * FROM vwt1 WHERE i = (SELECT i FROM vwj1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv47 AS - SELECT * FROM public.vwt1 WHERE i = (SELECT i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv48 AS - SELECT * FROM public.vwt1 WHERE i in (SELECT i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv49 AS - SELECT * FROM public.vwt1 WHERE i = (SELECT i FROM vwj1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv50 AS - SELECT * FROM vwt1 WHERE i = (SELECT i FROM public.vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv51 AS - SELECT * FROM vwt1 WHERE i in (SELECT i FROM public.vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv52 AS - SELECT * FROM vwt1 WHERE i = (SELECT i FROM public.vwj1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv53 AS - SELECT * FROM vwt1 WHERE i = (SELECT vwj1.i FROM public.vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv54 AS - SELECT * FROM vwt1 WHERE i in (SELECT vwj1.i FROM vwj1); -/*u0*/CREATE VIEW PUBLIC.vwv55 AS - SELECT * FROM vwt1 WHERE i = (SELECT vwj1.i FROM vwj1 WHERE i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv56 AS - SELECT * FROM vwt1 WHERE i = (SELECT i FROM public.vwj1 WHERE vwj1.i = 1); -/*u0*/CREATE VIEW PUBLIC.vwv57 AS - SELECT * FROM vwt1 WHERE i = (SELECT vwj1.i FROM vwj1 WHERE vwj1.i = 1); -/*e*/DROP VIEW other.vwv1; -/*e*/DROP VIEW information_schema.vwv2; - --- ****************************** MEM Indexes -DROP INDEX indi1 IF exists; -DROP INDEX indi2 IF exists; -DROP INDEX indi3 IF exists; -DROP INDEX indi4 IF exists; -DROP INDEX indi5 IF exists; -DROP TABLE indt1 IF exists; -DROP TABLE indt2 IF exists; -DROP TABLE indt3 IF exists; -DROP TABLE indt4 IF exists; -DROP TABLE indt101 IF exists; -CREATE TABLE indt1 (i int); -INSERT INTO indt1 values(0); -INSERT INTO indt1 values(1); -CREATE TABLE indt2 (i int); -INSERT INTO indt2 values(0); -INSERT INTO indt2 values(1); -CREATE TABLE indt3 (i int); -INSERT INTO indt3 values(0); -INSERT INTO indt3 values(1); -CREATE TABLE indt4 (i int); -INSERT INTO indt4 values(0); -INSERT INTO indt4 values(1); -/*e*/CREATE UNIQUE INDEX other.indi101 on indt101(i); -/*e*/CREATE INDEX other.indi101 on indt101(i); -CREATE TABLE indt101 (i int); -INSERT INTO indt101 values(0); -INSERT INTO indt101 values(1); -/*e*/CREATE UNIQUE INDEX information_schema.indi101 on indt101(i int); -/*u0*/CREATE UNIQUE INDEX indi1 ON indt1(i); -/*e*/CREATE UNIQUE INDEX indi1 ON indt1(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX public.indi2 ON indt2(i); -/*e*/CREATE UNIQUE INDEX public.indi2 ON indt2(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX indi3 ON indt3(i); -/*u0*/CREATE UNIQUE INDEX indi4 ON indt4(i); --- The error message says that the schema name is invalid. Problem here --- is creating an index in a different schema than the target table. -/*e*/CREATE UNIQUE INDEX indi5 ON information_schema.system_users(user_name); -/*e*/DROP INDEX other.indi1; -/*e*/DROP INDEX information_schema.indi2; - --- ****************************** CACH Indexes -DROP INDEX cindi1 IF exists; -DROP INDEX cindi2 IF exists; -DROP INDEX cindi3 IF exists; -DROP INDEX cindi4 IF exists; -DROP INDEX cindi5 IF exists; -DROP TABLE cindt1 IF exists; -DROP TABLE cindt2 IF exists; -DROP TABLE cindt3 IF exists; -DROP TABLE cindt4 IF exists; -DROP TABLE cindt101 IF exists; -CREATE TABLE cindt1 (i int); -INSERT INTO cindt1 values(0); -INSERT INTO cindt1 values(1); -CREATE TABLE cindt2 (i int); -INSERT INTO cindt2 values(0); -INSERT INTO cindt2 values(1); -CREATE TABLE cindt3 (i int); -INSERT INTO cindt3 values(0); -INSERT INTO cindt3 values(1); -CREATE TABLE cindt4 (i int); -INSERT INTO cindt4 values(0); -INSERT INTO cindt4 values(1); -/*e*/CREATE UNIQUE INDEX other.cindi101 on cindt101(i); -CREATE TABLE cindt101 (i int); -INSERT INTO cindt101 values(0); -INSERT INTO cindt101 values(1); -/*e*/CREATE UNIQUE INDEX information_schema.cindi101 on cindt101(i int); -/*u0*/CREATE UNIQUE INDEX cindi1 ON cindt1(i); -/*e*/CREATE UNIQUE INDEX cindi1 ON cindt1(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX public.cindi2 ON cindt2(i); -/*e*/CREATE UNIQUE INDEX public.cindi2 ON cindt2(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX cindi3 ON cindt3(i); -/*u0*/CREATE UNIQUE INDEX cindi4 ON cindt4(i); --- The error message says that the schema name is invalid. Problem here --- is creating an index in a different schema than the target table. -/*e*/CREATE UNIQUE INDEX cindi5 ON information_schema.system_users(user_name); -/*e*/DROP INDEX other.cindi1; -/*e*/DROP INDEX information_schema.cindi2; - --- ****************************** Sequences -DROP TABLE seqt1 IF EXISTS; -CREATE TABLE seqt1 (i int); -INSERT INTO seqt1 VALUES(10); --- No "IF EXISTS" allowed with sequences, so can't verify they don't exists. -/*e*/CREATE SEQUENCE other.s101; -/*e*/CREATE SEQUENCE information_schema.s101; -/*u0*/CREATE SEQUENCE s1; -/*e*/CREATE SEQUENCE s1; -- Create existing object -/*u0*/CREATE SEQUENCE public.s2; -/*e*/CREATE SEQUENCE public.s2; -- Create existing object --- To test persisting of incremented value -/*r0*/SELECT next value FOR s2 FROM seqt1; -/*r1*/SELECT next value FOR s2 FROM seqt1; - --- ****************************** Triggers -DROP TABLE trgt1 IF EXISTS; -DROP TABLE trgt2 IF EXISTS; -DROP TABLE trgt3 IF EXISTS; -DROP TABLE trgt4 IF EXISTS; -DROP TABLE trgt101 IF EXISTS; --- No "IF EXISTS" allowed with triggers, so can't verify they don't exists. -CREATE TABLE trgt1 (i int); -CREATE TABLE trgt2 (i int); -CREATE TABLE trgt3 (i int); -CREATE TABLE trgt4 (i int); -/*e*/CREATE TRIGGER other.trgtrig101 - AFTER INSERT ON trgt1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER trgtrig101 - AFTER INSERT ON other.trgt1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER trgtrig101 - AFTER INSERT ON information_schema.trgt1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER trgtrig101 - AFTER INSERT ON trgt101 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER trgtrig1 - AFTER INSERT ON trgt1 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER public.trgtrig2 - AFTER INSERT ON trgt2 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER trgtrig3 - AFTER INSERT ON public.trgt3 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER public.trgtrig4 - AFTER INSERT ON public.trgt4 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/DROP TRIGGER information_schema.trgtrig1; -/*e*/DROP TRIGGER other.trgtrig1; - --- ****************************** Constraints -DROP TABLE cont1 IF EXISTS; -DROP TABLE cont2 IF EXISTS; -DROP TABLE cont3 IF EXISTS; -DROP TABLE cont4 IF EXISTS; -DROP TABLE cont5 IF EXISTS; -DROP TABLE cont6 IF EXISTS; -DROP TABLE cont7 IF EXISTS; -DROP TABLE cont8 IF EXISTS; -DROP TABLE cont9 IF EXISTS; -DROP TABLE cont10 IF EXISTS; -DROP TABLE cont11 IF EXISTS; -DROP TABLE cont12 IF EXISTS; -DROP TABLE cont13 IF EXISTS; -DROP TABLE cont14 IF EXISTS; -DROP TABLE cont15 IF EXISTS; -DROP TABLE cont16 IF EXISTS; -DROP TABLE cont17 IF EXISTS; -DROP TABLE cont18 IF EXISTS; -DROP TABLE cont19 IF EXISTS; -DROP TABLE cont20 IF EXISTS; -DROP TABLE cont101 IF EXISTS; -CREATE TABLE conj1(i int, vc varchar(10), PRIMARY KEY (i)); -INSERT INTO conj1 values(1, 'one'); --- No "IF EXISTS" allowed with constrs., so can't verify they don't exists. -/*e*/CREATE TABLE other.cont101 (i int, CONSTRAINT conuc1 UNIQUE(i)); -/*e*/CREATE TABLE system_information.cont1 (i int, CONSTRAINT conuc1 UNIQUE(i)); -/*u0*/CREATE TABLE cont1 (i int, CONSTRAINT conuc1 UNIQUE(i)); -/*e*/CREATE TABLE cont1 (i int, CONSTRAINT conuc1 UNIQUE(i)); -/*e*/CREATE TABLE cont101 (i int, CONSTRAINT conuc1 UNIQUE(i)); -- conuc1 already exists -/*e*/CREATE TABLE cont101 (i int, CONSTRAINT public.conuc1 UNIQUE(i)); -- ditto -/*u0*/CREATE TABLE public.cont2 (i int, CONSTRAINT conuc2 UNIQUE(i)); -/*e*/CREATE TABLE public.cont101 (i int, CONSTRAINT conuc2 UNIQUE(i)); -- conuc2 already -/*e*/CREATE TABLE public.cont101 (i int, CONSTRAINT public.conuc2 UNIQUE(i)); -- dit -/*u0*/CREATE TABLE cont3 (i int, CONSTRAINT public.conuc3 UNIQUE(i)); -/*u0*/CREATE TABLE public.cont4 (i int, CONSTRAINT public.conuc4 UNIQUE(i)); -/*u0*/CREATE TABLE cont5 (i int, CONSTRAINT conpk5 PRIMARY KEY(i)); -/*u0*/CREATE TABLE public.cont6 (i int, CONSTRAINT conpk6 PRIMARY KEY(i)); -/*u0*/CREATE TABLE cont7 (i int, CONSTRAINT public.conpk7 PRIMARY KEY(i)); -/*u0*/CREATE TABLE public.cont8 (i int, CONSTRAINT public.conpk8 PRIMARY KEY(i)); -/*u0*/CREATE TABLE cont9 (i int, CONSTRAINT confk9 FOREIGN KEY(i) REFERENCES conj1(i)); -/*e*/CREATE TABLE cont101 (i int, CONSTRAINT confk9 FOREIGN KEY(i) - REFERENCES other.conj1(i)); -/*e*/CREATE TABLE cont101 (i int, CONSTRAINT confk9 FOREIGN KEY(i) - REFERENCES information_schema.conj1(i)); -/*u0*/CREATE TABLE public.cont10 (i int, CONSTRAINT confk10 - FOREIGN KEY(i) REFERENCES conj1(i)); -/*u0*/CREATE TABLE cont11 (i int, CONSTRAINT public.confk11 - FOREIGN KEY(i) REFERENCES conj1(i)); -/*u0*/CREATE TABLE public.cont12 (i int, CONSTRAINT public.confk12 - FOREIGN KEY(i) REFERENCES conj1(i)); -/*u0*/CREATE TABLE cont13 (i int, CONSTRAINT confk13 FOREIGN KEY(i) - REFERENCES public.conj1(i)); -/*u0*/CREATE TABLE public.cont14 (i int, CONSTRAINT confk14 - FOREIGN KEY(i) REFERENCES public.conj1(i)); -/*u0*/CREATE TABLE cont15 (i int, CONSTRAINT public.confk15 - FOREIGN KEY(i) REFERENCES public.conj1(i)); -/*u0*/CREATE TABLE public.cont16 (i int, CONSTRAINT public.confk16 - FOREIGN KEY(i) REFERENCES public.conj1(i)); -/*u0*/CREATE TABLE cont17 (i int, CONSTRAINT conc17 CHECK (i < 1)); -/*u0*/CREATE TABLE public.cont18 (i int, CONSTRAINT conc18 CHECK (i in (0, 2))); -/*u0*/CREATE TABLE cont19 (i int, CONSTRAINT public.conc19 CHECK (i = 0)); -/*u0*/CREATE TABLE public.cont20 (i int, CONSTRAINT public.conc20 CHECK (i != 1)); - - --- This to test recovery from .log files. -COMMIT; -SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistA2.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistA2.txt deleted file mode 100644 index fd316443..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistA2.txt +++ /dev/null @@ -1,525 +0,0 @@ --- TEST OBJECTS - --- This TESTS the schema-specific objects created in a previous script. --- (See the *C[12].txt scripts for similar tests of ALTER comands (which --- this script purposefully omits). - - -CREATE USER otheruser PASSWORD otheruser; - --- ****************************** MEM Tables -/*c2*/SELECT * FROM tblt1; -/*c1*/SELECT * FROM tblt1 WHERE i = 0; -/*c2*/SELECT * FROM tblt1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM tblt1 WHERE i < 1; -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT i FROM tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i in (SELECT i FROM tblj1); -/*c0*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM public.tblt1 WHERE tblt1.i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.tblt1 WHERE tblt1.i in (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.tblt1 WHERE tblt1.i = (SELECT i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i in (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT i FROM public.tblj1 WHERE i = 1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT tblj1.i FROM public.tblj1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i in (SELECT tblj1.i FROM tblj1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT tblj1.i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT i FROM public.tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM tblt1 WHERE tblt1.i = (SELECT tblj1.i FROM tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM tblt1 WHERE i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM tblt1 WHERE i in (SELECT i FROM tblj1); -/*c1*/SELECT * FROM tblt1 WHERE i = (SELECT i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM public.tblt1 WHERE i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.tblt1 WHERE i in (SELECT i FROM tblj1); -/*c0*/SELECT * FROM public.tblt1 WHERE i = (SELECT i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM tblt1 WHERE i = (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM tblt1 WHERE i in (SELECT i FROM public.tblj1); -/*c0*/SELECT * FROM tblt1 WHERE i = (SELECT i FROM public.tblj1 WHERE i = 0); -/*c1*/SELECT * FROM tblt1 WHERE i = (SELECT tblj1.i FROM public.tblj1); -/*c1*/SELECT * FROM tblt1 WHERE i in (SELECT tblj1.i FROM tblj1); -/*c0*/SELECT * FROM tblt1 WHERE i = (SELECT tblj1.i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM tblt1 WHERE i = (SELECT i FROM public.tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM tblt1 WHERE i = (SELECT tblj1.i FROM tblj1 WHERE tblj1.i = 1); -/*e*/SELECT * FROM system_users WHERE user_name = 'SA'; -/*e*/SELECT * FROM other.tblt1; -/*e*/SELECT * FROM other.system_users; -/*e*/SELECT * FROM information_schema.tblt1; -/*e*/SELECT * FROM public.system_users; -/*c2*/SELECT * FROM public.tblt1; -/*c1*/SELECT * FROM information_schema.system_users WHERE user_name = 'SA'; -/*c1*/SELECT * FROM public.tblt1 WHERE i = 0; -/*e*/SELECT * FROM other.tblt1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.tblt1 WHERE i = 0; -/*c1*/SELECT * FROM public.tblt1, public.tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT * FROM tblt1, public.tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT * FROM public.tblt1, tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT * FROM tblt1, tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT vc FROM public.tblt1, public.tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT vc FROM tblt1, public.tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT vc FROM public.tblt1, tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT vc FROM tblt1, tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM public.tblt1, public.tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM tblt1, public.tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM public.tblt1, tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM tblt1, tblj1 WHERE tblt1.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM tblt1, tblj1 lbla WHERE tblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM tblt1 lblb, tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM tblt1 lblb, tblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM public.tblt1, tblj1 lbla WHERE tblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM public.tblt1 lblb, tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM public.tblt1 lblb, tblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM tblt1, public.tblj1 lbla WHERE tblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM tblt1 lblb, public.tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM tblt1 lblb, public.tblj1 lbla WHERE lblb.i = lbla.i; -/*u0*/SET TABLE tblt1 READONLY true; -/*e*/UPDATE tblt1 set i = 11 WHERE i = 1; -/*u0*/SET TABLE public.tblt1 READONLY true; -/*e*/SET TABLE information_schema.tblt1 READONLY true; -/*e*/SET TABLE other.tblt1 READONLY true; -/*u0*/SET TABLE tblt1 READONLY false; -/*u0*/SET TABLE public.tblt1 READONLY false; -/*c2*/SELECT i FROM tblt1; --- N.b.: Do not commit DML changes so that this whole block may be repeated. -COMMIT; -SET AUTOCOMMIT false; -/*u1*/UPDATE tblt1 set i = 11 WHERE i = 1; -/*u1*/UPDATE tblt1 set tblt1.i = 12 WHERE i = 11; -/*u1*/UPDATE tblt1 set tblt1.i = 13 WHERE tblt1.i = 12; -/*u1*/UPDATE public.tblt1 set i = 14 WHERE i = 13; -/*u1*/UPDATE public.tblt1 set tblt1.i = 15 WHERE i = 14; -/*u1*/UPDATE public.tblt1 set tblt1.i = 16 WHERE tblt1.i = 15; -/*e*/UPDATE other.tblt1 set tblt1.i = 17 WHERE tblt1.i = 16; -/*e*/UPDATE information_schema.tblt1 set tblt1.i = 17 WHERE tblt1.i = 16; -/*u1*/UPDATE tblt1 ali set i = 17 WHERE i = 16; -/*u1*/UPDATE tblt1 ali set ali.i = 18 WHERE i = 17; -/*u1*/UPDATE tblt1 ali set ali.i = 19 WHERE ali.i = 18; -/*u1*/UPDATE tblt1 ali set i = 20 WHERE ali.i = 19; -/*u1*/UPDATE public.tblt1 ali set i = 21 WHERE i = 20; -/*u1*/UPDATE public.tblt1 ali set ali.i = 22 WHERE i = 21; -/*u1*/UPDATE public.tblt1 ali set ali.i = 23 WHERE ali.i = 22; -/*u1*/UPDATE public.tblt1 ali set i = 24 WHERE ali.i = 23; -/*e*/UPDATE other.tblt1 ali set i = 25 WHERE ali.i = 24; -/*e*/UPDATE other.tblt1 ali set i = 25 WHERE .i = 24; -/*e*/UPDATE other.tblt1 set i = 25 WHERE i = 24; -/*e*/DELETE FROM other.tblt1 ali WHERE ali.i = 24; -/*e*/DELETE FROM other.tblt1 ali; -/*e*/DELETE FROM other.tblt1 set WHERE i = 24; -/*e*/DELETE FROM other.tblt1 WHERE i = 24; -/*e*/DELETE FROM system_information.tblj1 WHERE tblj1.i = 1; -/*u1*/DELETE FROM tblt1 WHERE i = 0; -/*u1*/DELETE FROM public.tblt1 WHERE i = 24; -/*u1*/DELETE FROM public.tblj1 WHERE tblj1.i = 1; -ROLLBACK; -/*c2*/SELECT i FROM tblt1; -/*u0*/GRANT ALL ON tblt1 TO otheruser; -/*u0*/GRANT ALL ON public.tblt2 TO otheruser; -/*e*/GRANT ALL ON other.tblt3 TO otheruser; -/*e*/GRANT ALL ON information_schema.tblt3 TO otheruser; -/*u0*/REVOKE ALL ON tblt1 FROM otheruser RESTRICT; -/*u0*/REVOKE ALL ON public.tblt2 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON other.tblt3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.tblt3 FROM otheruser RESTRICT; -/*e*/DROP TABLE other.tblt3; -/*e*/DROP TABLE information_schema.tblt4; -/*e*/DROP TABLE tblt101; -/*e*/DROP TABLE public.tblt101; -/*u0*/DROP TABLE tblt101 IF EXISTS; -/*u0*/DROP TABLE public.tblt101 IF EXISTS; --- Should "DROP TABLE nonexistentschema.notable IF EXISTS" work? -/*u0*/DROP TABLE other.system_users IF exists; -/*u0*/DROP TABLE system_users IF exists; - --- ****************************** CACH Tables -/*c2*/SELECT * FROM ctblt1; -/*c1*/SELECT * FROM ctblt1 WHERE i = 0; -/*c2*/SELECT * FROM ctblt1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM ctblt1 WHERE i < 1; -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i in (SELECT i FROM tblj1); -/*c0*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM public.ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.ctblt1 WHERE ctblt1.i in (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.ctblt1 WHERE ctblt1.i = (SELECT i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i in (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM public.tblj1 WHERE i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT tblj1.i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i in (SELECT tblj1.i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT tblj1.i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT i FROM public.tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE ctblt1.i = (SELECT tblj1.i FROM tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i in (SELECT i FROM tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM tblj1 WHERE i = 1); -/*c1*/SELECT * FROM public.ctblt1 WHERE i = (SELECT i FROM tblj1); -/*c1*/SELECT * FROM public.ctblt1 WHERE i in (SELECT i FROM tblj1); -/*c0*/SELECT * FROM public.ctblt1 WHERE i = (SELECT i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i in (SELECT i FROM public.tblj1); -/*c0*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM public.tblj1 WHERE i = 0); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT tblj1.i FROM public.tblj1); -/*c1*/SELECT * FROM ctblt1 WHERE i in (SELECT tblj1.i FROM tblj1); -/*c0*/SELECT * FROM ctblt1 WHERE i = (SELECT tblj1.i FROM tblj1 WHERE i = 0); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT i FROM public.tblj1 WHERE tblj1.i = 1); -/*c1*/SELECT * FROM ctblt1 WHERE i = (SELECT tblj1.i FROM tblj1 WHERE tblj1.i = 1); -/*e*/SELECT * FROM system_users WHERE user_name = 'SA'; -/*e*/SELECT * FROM other.ctblt1; -/*e*/SELECT * FROM other.system_users; -/*e*/SELECT * FROM information_schema.ctblt1; -/*e*/SELECT * FROM public.system_users; -/*c2*/SELECT * FROM public.ctblt1; -/*c1*/SELECT * FROM information_schema.system_users WHERE user_name = 'SA'; -/*c1*/SELECT * FROM public.ctblt1 WHERE i = 0; -/*e*/SELECT * FROM other.ctblt1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.ctblt1 WHERE i = 0; -/*c1*/SELECT * FROM public.ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT * FROM ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT * FROM public.ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT * FROM ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM public.ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM public.ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT vc FROM ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM public.ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM ctblt1, public.tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM public.ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT tblj1.vc FROM ctblt1, tblj1 WHERE ctblt1.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM ctblt1, tblj1 lbla WHERE ctblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM ctblt1 lblb, tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM ctblt1 lblb, tblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM public.ctblt1, tblj1 lbla WHERE ctblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM public.ctblt1 lblb, tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM public.ctblt1 lblb, tblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM ctblt1, public.tblj1 lbla WHERE ctblt1.i = lbla.i; -/*c1*/SELECT tblj1.vc FROM ctblt1 lblb, public.tblj1 WHERE lblb.i = tblj1.i; -/*c1*/SELECT lbla.vc FROM ctblt1 lblb, public.tblj1 lbla WHERE lblb.i = lbla.i; -/*u0*/SET TABLE ctblt1 READONLY true; -/*e*/UPDATE ctblt1 set i = 11 WHERE i = 1; -/*u0*/SET TABLE public.ctblt1 READONLY true; -/*e*/SET TABLE information_schema.ctblt1 READONLY true; -/*e*/SET TABLE other.ctblt1 READONLY true; -/*u0*/SET TABLE ctblt1 READONLY false; -/*u0*/SET TABLE public.ctblt1 READONLY false; -/*c2*/SELECT i FROM ctblt1; --- N.b.: Do not commit DML changes so that this whole block may be repeated. -COMMIT; -SET AUTOCOMMIT false; -/*u1*/UPDATE ctblt1 set i = 11 WHERE i = 1; -/*u1*/UPDATE ctblt1 set ctblt1.i = 12 WHERE i = 11; -/*u1*/UPDATE ctblt1 set ctblt1.i = 13 WHERE ctblt1.i = 12; -/*u1*/UPDATE public.ctblt1 set i = 14 WHERE i = 13; -/*u1*/UPDATE public.ctblt1 set ctblt1.i = 15 WHERE i = 14; -/*u1*/UPDATE public.ctblt1 set ctblt1.i = 16 WHERE ctblt1.i = 15; -/*e*/UPDATE other.ctblt1 set ctblt1.i = 17 WHERE ctblt1.i = 16; -/*e*/UPDATE information_schema.ctblt1 set ctblt1.i = 17 WHERE ctblt1.i = 16; -/*u1*/UPDATE ctblt1 ali set i = 17 WHERE i = 16; -/*u1*/UPDATE ctblt1 ali set ali.i = 18 WHERE i = 17; -/*u1*/UPDATE ctblt1 ali set ali.i = 19 WHERE ali.i = 18; -/*u1*/UPDATE ctblt1 ali set i = 20 WHERE ali.i = 19; -/*u1*/UPDATE public.ctblt1 ali set i = 21 WHERE i = 20; -/*u1*/UPDATE public.ctblt1 ali set ali.i = 22 WHERE i = 21; -/*u1*/UPDATE public.ctblt1 ali set ali.i = 23 WHERE ali.i = 22; -/*u1*/UPDATE public.ctblt1 ali set i = 24 WHERE ali.i = 23; -/*e*/UPDATE other.ctblt1 ali set i = 25 WHERE ali.i = 24; -/*e*/UPDATE other.ctblt1 ali set i = 25 WHERE .i = 24; -/*e*/UPDATE other.ctblt1 set i = 25 WHERE i = 24; -/*e*/DELETE FROM other.ctblt1 ali WHERE ali.i = 24; -/*e*/DELETE FROM other.ctblt1 ali; -/*e*/DELETE FROM other.ctblt1 set WHERE i = 24; -/*e*/DELETE FROM other.ctblt1 WHERE i = 24; -/*e*/DELETE FROM system_information.tblj1 WHERE tblj1.i = 1; -/*u1*/DELETE FROM ctblt1 WHERE i = 0; -/*u1*/DELETE FROM public.ctblt1 WHERE i = 24; -/*u1*/DELETE FROM public.tblj1 WHERE tblj1.i = 1; -ROLLBACK; -/*c2*/SELECT i FROM ctblt1; -/*u0*/GRANT ALL ON ctblt1 TO otheruser; -/*u0*/GRANT ALL ON public.ctblt2 TO otheruser; -/*e*/GRANT ALL ON other.ctblt3 TO otheruser; -/*e*/GRANT ALL ON information_schema.ctblt3 TO otheruser; -/*u0*/REVOKE ALL ON ctblt1 FROM otheruser RESTRICT; -/*u0*/REVOKE ALL ON public.ctblt2 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON other.ctblt3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.ctblt3 FROM otheruser RESTRICT; -/*e*/DROP TABLE other.ctblt3; -/*e*/DROP TABLE information_schema.ctblt4; -/*e*/DROP TABLE ctblt101; -/*e*/DROP TABLE public.ctblt101; -/*u0*/DROP TABLE ctblt101 IF EXISTS; -/*u0*/DROP TABLE public.ctblt101 IF EXISTS; --- Should "DROP TABLE nonexistentschema.notable IF EXISTS" work? -/*u0*/DROP TABLE other.system_users IF exists; -/*u0*/DROP TABLE system_users IF exists; - --- ****************************** Views -/*c2*/SELECT * FROM vwv1; -/*c2*/SELECT * FROM public.vwv1; -/*c2*/SELECT * FROM vwv2; -/*c2*/SELECT * FROM vwv3; -/*c1*/SELECT * FROM vwv4; -/*c1*/SELECT * FROM vwv5; -/*c1*/SELECT * FROM vwv8; -/*c0*/SELECT * FROM vwv9; -/*c0*/SELECT * FROM vwv10; -/*c0*/SELECT * FROM vwv11; -/*c0*/SELECT * FROM vwv12; -/*c0*/SELECT * FROM vwv13; -/*c0*/SELECT * FROM vwv14; -/*c0*/SELECT * FROM vwv15; -/*c0*/SELECT * FROM vwv16; -/*c0*/SELECT * FROM vwv17; -/*c0*/SELECT * FROM vwv18; -/*c1*/SELECT * FROM vwv19; -/*c1*/SELECT * FROM vwv20; -/*c1*/SELECT * FROM vwv21; -/*c1*/SELECT * FROM vwv22; -/*c1*/SELECT * FROM vwv23; -/*c1*/SELECT * FROM vwv24; -/*c1*/SELECT * FROM vwv25; -/*c1*/SELECT * FROM vwv26; -/*c2*/SELECT * FROM vwv28; -/*c1*/SELECT * FROM vwv29; -/*c1*/SELECT * FROM vwv30; -/*c1*/SELECT * FROM vwv31; -/*c0*/SELECT * FROM vwv32; -/*c1*/SELECT * FROM vwv33; -/*c1*/SELECT * FROM vwv34; -/*c0*/SELECT * FROM vwv35; -/*c1*/SELECT * FROM vwv36; -/*c1*/SELECT * FROM vwv37; -/*c1*/SELECT * FROM vwv38; -/*c1*/SELECT * FROM vwv39; -/*c1*/SELECT * FROM vwv40; -/*c1*/SELECT * FROM vwv41; -/*c1*/SELECT * FROM vwv42; -/*c1*/SELECT * FROM vwv43; -/*c1*/SELECT * FROM vwv44; -/*c1*/SELECT * FROM vwv45; -/*c1*/SELECT * FROM vwv46; -/*c1*/SELECT * FROM vwv47; -/*c1*/SELECT * FROM vwv48; -/*c1*/SELECT * FROM vwv49; -/*c1*/SELECT * FROM vwv50; -/*c1*/SELECT * FROM vwv51; -/*c1*/SELECT * FROM vwv52; -/*c1*/SELECT * FROM vwv53; -/*c1*/SELECT * FROM vwv54; -/*c1*/SELECT * FROM vwv55; -/*c1*/SELECT * FROM vwv56; -/*c1*/SELECT * FROM vwv57; -/*c1*/SELECT * FROM vwv1, vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT * FROM public.vwv1, public.vwj1 WHERE vwv1.i = vwj1.i; -/*c2*/SELECT * FROM vwv1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM vwv1 WHERE i < 1; -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM public.vwv1 WHERE vwv1.i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM public.vwv1 WHERE vwv1.i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i in (SELECT i FROM public.vwj1); -/*c0*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM public.vwj1 WHERE i = 0); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT vwj1.i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i in (SELECT vwj1.i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT vwj1.i FROM vwj1 WHERE i = 1); -/*c0*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM public.vwj1 WHERE vwj1.i = 0); -/*c0*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT vwj1.i FROM vwj1 WHERE vwj1.i = 0); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM public.vwv1 WHERE i = (SELECT i FROM vwj1); -/*c1*/SELECT * FROM public.vwv1 WHERE i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM public.vwv1 WHERE i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i in (SELECT i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM public.vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT vwj1.i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i in (SELECT vwj1.i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT vwj1.i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM public.vwj1 WHERE vwj1.i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT vwj1.i FROM vwj1 WHERE vwj1.i = 1); -/*c2*/SELECT * FROM vwv1; -/*c1*/SELECT * FROM vwv1 WHERE i = 0; -/*c2*/SELECT * FROM vwv1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM vwv1 WHERE i < 1; -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM public.vwv1 WHERE vwv1.i = (SELECT i FROM vwj1); -/*c1*/SELECT * FROM public.vwv1 WHERE vwv1.i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM public.vwv1 WHERE vwv1.i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i in (SELECT i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM public.vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT vwj1.i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i in (SELECT vwj1.i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT vwj1.i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT i FROM public.vwj1 WHERE vwj1.i = 1); -/*c1*/SELECT * FROM vwv1 WHERE vwv1.i = (SELECT vwj1.i FROM vwj1 WHERE vwj1.i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM public.vwv1 WHERE i = (SELECT i FROM vwj1); -/*c1*/SELECT * FROM public.vwv1 WHERE i in (SELECT i FROM vwj1); -/*c1*/SELECT * FROM public.vwv1 WHERE i = (SELECT i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i in (SELECT i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM public.vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT vwj1.i FROM public.vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i in (SELECT vwj1.i FROM vwj1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT vwj1.i FROM vwj1 WHERE i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT i FROM public.vwj1 WHERE vwj1.i = 1); -/*c1*/SELECT * FROM vwv1 WHERE i = (SELECT vwj1.i FROM vwj1 WHERE vwj1.i = 1); -/*e*/SELECT * FROM other.vwv1; -/*e*/SELECT * FROM information_schema.vwv1; -/*c2*/SELECT * FROM public.vwv1; -/*c1*/SELECT * FROM public.vwv1 WHERE i = 0; -/*e*/SELECT * FROM other.vwv1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.vwv1 WHERE i = 0; -/*c1*/SELECT * FROM public.vwv1 WHERE i = 0; -CREATE TABLE public.vwt2 AS (SELECT * FROM public.vwv1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM public.vwt2; -DROP TABLE vwt2; -/*c1*/SELECT * FROM public.vwv1, public.vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT * FROM vwv1, public.vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT * FROM public.vwv1, vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT * FROM vwv1, vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vc FROM public.vwv1, public.vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vc FROM vwv1, public.vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vc FROM public.vwv1, vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vc FROM vwv1, vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vwj1.vc FROM public.vwv1, public.vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vwj1.vc FROM vwv1, public.vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vwj1.vc FROM public.vwv1, vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT vwj1.vc FROM vwv1, vwj1 WHERE vwv1.i = vwj1.i; -/*c1*/SELECT lbla.vc FROM vwv1, vwj1 lbla WHERE vwv1.i = lbla.i; -/*c1*/SELECT vwj1.vc FROM vwv1 lblb, vwj1 WHERE lblb.i = vwj1.i; -/*c1*/SELECT lbla.vc FROM vwv1 lblb, vwj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM public.vwv1, vwj1 lbla WHERE vwv1.i = lbla.i; -/*c1*/SELECT vwj1.vc FROM public.vwv1 lblb, vwj1 WHERE lblb.i = vwj1.i; -/*c1*/SELECT lbla.vc FROM public.vwv1 lblb, vwj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM vwv1, public.vwj1 lbla WHERE vwv1.i = lbla.i; -/*c1*/SELECT vwj1.vc FROM vwv1 lblb, public.vwj1 WHERE lblb.i = vwj1.i; -/*c1*/SELECT lbla.vc FROM vwv1 lblb, public.vwj1 lbla WHERE lblb.i = lbla.i; -/*u0*/GRANT ALL ON vwv1 TO otheruser; -/*u0*/GRANT ALL ON public.vwv2 TO otheruser; -/*e*/GRANT ALL ON other.vwv3 TO otheruser; -/*e*/GRANT ALL ON information_schema.vwv3 TO otheruser; -/*u0*/REVOKE ALL ON vwv1 FROM otheruser RESTRICT; -/*u0*/REVOKE ALL ON public.vwv2 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON other.vwv3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.vwv3 FROM otheruser RESTRICT; - --- ****************************** Indexes -/*c2*/SELECT * from indt1; -/*c2*/SELECT * from public.indt2; -/*c2*/SELECT * from public.indt3; -/*c2*/SELECT * from indt4; - --- ****************************** CACH Indexes -/*c2*/SELECT * from cindt1; -/*c2*/SELECT * from public.cindt2; -/*c2*/SELECT * from public.cindt3; -/*c2*/SELECT * from cindt4; - --- ****************************** Sequences --- N.b.: Do not commit DML changes so that this whole block may be repeated. -/*r0*/SELECT next value FOR s1 FROM seqt1; -/*r2*/SELECT next value FOR public.s2 FROM seqt1; -/*r1*/SELECT next value FOR s1 FROM public.seqt1; -/*r3*/SELECT next value FOR public.s2 FROM public.seqt1; -/*r2*/SELECT next value FOR public.s1 FROM seqt1; -/*r4*/SELECT next value FOR s2 FROM seqt1; -/*r3*/SELECT next value FOR public.s1 FROM seqt1; -/*r5*/SELECT next value FOR s2 FROM seqt1; --- Just to reset orig. value before persisting (can't roll back seq.s). -ALTER SEQUENCE s1 RESTART WITH 0; -ALTER SEQUENCE s2 RESTART WITH 2; -/*e*/DROP SEQUENCE s101; -/*e*/DROP SEQUENCE public.s101; -/*e*/DROP SEQUENCE information_schema.s1; -/*e*/DROP SEQUENCE other.s1; - --- ****************************** Triggers -/*e*/CREATE TRIGGER trgtrig1 - AFTER INSERT ON trgt1 CALL 'org.hsqldb.test.BlaineTrig'; -- Create existing -/*e*/CREATE TRIGGER public.trgtrig2 - AFTER INSERT ON trgt2 CALL 'org.hsqldb.test.BlaineTrig'; -- Create existing - --- ****************************** Constraints --- N.b.: Do not commit DML changes so that this whole block may be repeated. -COMMIT; -SET AUTOCOMMIT false; -/*u1*/INSERT INTO cont1 VALUES (0); -/*u1*/INSERT INTO public.cont2 VALUES (0); -/*u1*/INSERT INTO cont3 VALUES (0); -/*u1*/INSERT INTO cont4 VALUES (0); -/*u1*/INSERT INTO cont5 VALUES (0); -/*u1*/INSERT INTO cont6 VALUES (0); -/*u1*/INSERT INTO cont7 VALUES (0); -/*u1*/INSERT INTO cont8 VALUES (0); --- Note that error message implies that problem is due to table conj1, not data: -/*u1*/INSERT INTO cont9 VALUES (1); -/*u1*/INSERT INTO cont10 VALUES (1); -/*u1*/INSERT INTO cont11 VALUES (1); -/*u1*/INSERT INTO cont12 VALUES (1); -/*u1*/INSERT INTO cont13 VALUES (1); -/*u1*/INSERT INTO cont14 VALUES (1); -/*u1*/INSERT INTO cont15 VALUES (1); -/*u1*/INSERT INTO cont16 VALUES (1); -/*u1*/INSERT INTO cont17 VALUES (0); -/*u1*/INSERT INTO cont18 VALUES (0); -/*u1*/INSERT INTO cont19 VALUES (0); -/*u1*/INSERT INTO cont20 VALUES (0); -/*e*/INSERT INTO cont1 VALUES (0); -/*e*/INSERT INTO cont2 VALUES (0); -/*e*/INSERT INTO cont3 VALUES (0); -/*e*/INSERT INTO cont4 VALUES (0); -/*e*/INSERT INTO cont5 VALUES (0); -/*e*/INSERT INTO cont6 VALUES (0); -/*e*/INSERT INTO cont7 VALUES (0); -/*e*/INSERT INTO cont8 VALUES (0); -/*e*/INSERT INTO cont9 VALUES (0); -/*e*/INSERT INTO cont10 VALUES (0); -/*e*/INSERT INTO cont11 VALUES (0); -/*e*/INSERT INTO cont12 VALUES (0); -/*e*/INSERT INTO cont13 VALUES (0); -/*e*/INSERT INTO cont14 VALUES (0); -/*e*/INSERT INTO cont15 VALUES (0); -/*e*/INSERT INTO cont16 VALUES (0); -/*e*/INSERT INTO cont17 VALUES (1); -/*e*/INSERT INTO cont18 VALUES (1); -/*e*/INSERT INTO cont19 VALUES (1); -/*e*/INSERT INTO cont20 VALUES (1); -/*c1*/SELECT * FROM cont1; -/*c1*/SELECT * FROM cont2; -/*c1*/SELECT * FROM cont3; -/*c1*/SELECT * FROM cont4; -/*c1*/SELECT * FROM cont5; -/*c1*/SELECT * FROM cont6; -/*c1*/SELECT * FROM cont7; -/*c1*/SELECT * FROM cont8; -/*c1*/SELECT * FROM cont9; -/*c1*/SELECT * FROM cont10; -/*c1*/SELECT * FROM cont11; -/*c1*/SELECT * FROM cont12; -/*c1*/SELECT * FROM cont13; -/*c1*/SELECT * FROM cont14; -/*c1*/SELECT * FROM cont15; -/*c1*/SELECT * FROM cont16; -/*c1*/SELECT * FROM cont17; -/*c1*/SELECT * FROM cont18; -/*c1*/SELECT * FROM cont19; -/*c1*/SELECT * FROM cont20; -ROLLBACK; - --- ****************************** ALTERs --- Add tests when time permits. - -DROP USER otheruser; - - --- This to test .script persistence. -SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistB1.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistB1.txt deleted file mode 100644 index 3b550b71..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistB1.txt +++ /dev/null @@ -1,728 +0,0 @@ --- CREATE AND INITIALIZE OBJECTS - --- This CREATES the schema-specific objects to be used for --- schema-specific persistence tests. --- (See the *C[12].txt scripts for similar tests of ALTER comands (which --- this script purposefully omits). - --- This *1.txt script tests whether objects can/do get CREATED in the correct --- schemas, since there is no reason why that would change in consequent --- connections to the same database (*[23].txt scripts). --- This script must, of course, persist objects in different specific --- schemas so that scripts *[23] may verify that they continue to reside --- and be accessible only in the correct schema. - --- In the main (object-type-specific) test blocks, for every command that --- has ALL SCHEMA OBJECTS explicitly specified, --- I always do a SET SCHEMA so that an accidental --- fallback to Session schema will always lead to a test failure. - - --- ****************************** Schemas --- Non-persistence Schema testing. --- Test the _INITIAL_ Session default schema (currently "PUBLIC"). --- After the objects are created in the correct schema, it makes no difference --- whether the "INITIAL" schema was used or not. Therefore, no need to test --- this stuff in scripts *[23].txt. -DROP TABLE public.pschct1 IF exists; -DROP TABLE public.pschct2 IF exists; -DROP TABLE public.pschct3 IF exists; -DROP VIEW public.pschv1 IF exists; -DROP VIEW public.pschv2 IF exists; -DROP INDEX public.pschi1 IF exists; -DROP TABLE public.pscht1 IF exists; -DROP TABLE public.pscht2 IF exists; --- Verify all SELECTs fail before we start -/*e*/SELECT * FROM public.pscht1; -/*e*/SELECT * FROM public.pscht2; -/*e*/SELECT * FROM public.pschv1; -/*e*/SELECT * FROM public.pschv2; -/*e*/SELECT * FROM public.pschct1; -/*e*/SELECT * FROM public.pschct2; -/*e*/SELECT * FROM public.pschct3; -/*e*/SELECT * FROM blaine.pscht1; -/*e*/SELECT * FROM blaine.pscht2; -/*e*/SELECT * FROM blaine.pschv1; -/*e*/SELECT * FROM blaine.pschv2; -/*e*/SELECT * FROM blaine.pschct1; -/*e*/SELECT * FROM blaine.pschct2; -/*e*/SELECT * FROM blaine.pschct3; -/*e*/SELECT * FROM pscht1; -/*e*/SELECT * FROM pscht2; -/*e*/SELECT * FROM pschv1; -/*e*/SELECT * FROM pschv2; -/*e*/SELECT * FROM pschct1; -/*e*/SELECT * FROM pschct2; -/*e*/SELECT * FROM pschct3; -/*u0*/CREATE TABLE pscht1 (i int); -/*u1*/INSERT INTO pscht1 values(0); -/*u1*/INSERT INTO pscht1 values(1); -/*u0*/CREATE UNIQUE INDEX pschi1 ON pscht1(i); -/*e*/INSERT INTO pscht1 values(1); -/*u0*/CREATE TABLE pscht2 (i int); -/*u1*/INSERT INTO pscht2 values(0); -/*u1*/INSERT INTO pscht2 values(1); -/*u0*/CREATE VIEW pschv1 AS SELECT * FROM pscht1; -/*u0*/CREATE VIEW pschv2 AS SELECT * FROM public.pscht1; --- Create then remove using explicit schema. This is a workaround for no --- DROP TRIGGER... IF EXISTS; -/*u0*/CREATE TRIGGER public.ptrig1 - AFTER INSERT ON pscht1 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -DROP TRIGGER public.ptrig1; -/*u0*/CREATE TRIGGER ptrig1 - AFTER INSERT ON pscht1 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER public.ptrig2 - AFTER INSERT ON public.pscht2 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -DROP TRIGGER public.ptrig2; -/*u0*/CREATE TRIGGER ptrig2 - AFTER INSERT ON public.pscht2 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TABLE pschct1 (i int, CONSTRAINT pschuc1 UNIQUE(i)); -/*u0*/CREATE TABLE public.pschct2 (i int, CONSTRAINT pschuc2 UNIQUE(i)); -/*u0*/CREATE TABLE pschct3 (i int, CONSTRAINT public.pschuc3 UNIQUE(i)); -/*u1*/INSERT INTO pschct1 values(0); -/*u1*/INSERT INTO pschct2 values(0); -/*u1*/INSERT INTO pschct3 values(0); -/*e*/INSERT INTO pschct1 values(0); -/*e*/INSERT INTO pschct2 values(0); -/*e*/INSERT INTO pschct3 values(0); --- Verify created in correct schemas -/*c2*/SELECT * FROM public.pscht1; -/*c2*/SELECT * FROM public.pscht2; -/*c2*/SELECT * FROM public.pschv1; -/*c2*/SELECT * FROM public.pschv2; -/*c1*/SELECT * FROM public.pschct1; -/*c1*/SELECT * FROM public.pschct2; -/*c1*/SELECT * FROM public.pschct3; -/*e*/CREATE TRIGGER public.ptrig1 - AFTER INSERT ON pscht1 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER public.ptrig2 - AFTER INSERT ON public.pscht1 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/SELECT * FROM blaine.pscht1; -/*e*/SELECT * FROM blaine.pscht2; -/*e*/SELECT * FROM blaine.pschv1; -/*e*/SELECT * FROM blaine.pschv2; -/*e*/SELECT * FROM blaine.pschct1; -/*e*/SELECT * FROM blaine.pschct2; -/*e*/SELECT * FROM blaine.pschct3; --- Verify SELECTs using default schema -/*c2*/SELECT * FROM pscht1; -/*c2*/SELECT * FROM pscht2; -/*c2*/SELECT * FROM pschv1; -/*c2*/SELECT * FROM pschv2; -/*c1*/SELECT * FROM pschct1; -/*c1*/SELECT * FROM pschct2; -/*c1*/SELECT * FROM pschct3; --- Following 2 just to confirm that TRIGGERs created. -/*e*/CREATE TRIGGER ptrig1 - AFTER INSERT ON pscht1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER public.ptrig2 - AFTER INSERT ON public.pscht1 CALL "org.hsqldb.test.BlaineTrig"; - -/*u0*/CREATE SCHEMA blaine AUTHORIZATION dba; -/*e*/CREATE SCHEMA blaine AUTHORIZATION dba; -/*u0*/SET SCHEMA blaine; --- Verify created in correct schemas -/*c2*/SELECT * FROM public.pscht1; -/*c2*/SELECT * FROM public.pscht2; -/*c2*/SELECT * FROM public.pschv1; -/*c2*/SELECT * FROM public.pschv2; -/*c1*/SELECT * FROM public.pschct1; -/*c1*/SELECT * FROM public.pschct2; -/*c1*/SELECT * FROM public.pschct3; --- Following 2 just to confirm that TRIGGERs created. -/*e*/CREATE TRIGGER public.ptrig1 - AFTER INSERT ON pscht1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER public.ptrig2 - AFTER INSERT ON public.pscht1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/SELECT * FROM blaine.pscht1; -/*e*/SELECT * FROM blaine.pscht2; -/*e*/SELECT * FROM blaine.pschv1; -/*e*/SELECT * FROM blaine.pschv2; -/*e*/SELECT * FROM blaine.pschct1; -/*e*/SELECT * FROM blaine.pschct2; -/*e*/SELECT * FROM blaine.pschct3; --- Verify SELECTs using default schema -/*e*/SELECT * FROM pscht1; -/*e*/SELECT * FROM pscht2; -/*e*/SELECT * FROM pschv1; -/*e*/SELECT * FROM pschv2; -/*e*/SELECT * FROM pschct1; -/*e*/SELECT * FROM pschct2; -/*e*/SELECT * FROM pschct3; --- Test of SET SCHEMA -/*u0*/SET SCHEMA public; -/*c2*/SELECT * FROM public.pscht1; -/*c2*/SELECT * FROM public.pscht2; -/*c2*/SELECT * FROM public.pschv1; -/*c2*/SELECT * FROM public.pschv2; -/*c1*/SELECT * FROM public.pschct1; -/*c1*/SELECT * FROM public.pschct2; -/*c1*/SELECT * FROM public.pschct3; --- Following 2 just to confirm that TRIGGERs created. -/*e*/CREATE TRIGGER public.ptrig1 - AFTER INSERT ON pscht1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER public.ptrig2 - AFTER INSERT ON public.pscht1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/SELECT * FROM blaine.pscht1; -/*e*/SELECT * FROM blaine.pscht2; -/*e*/SELECT * FROM blaine.pschv1; -/*e*/SELECT * FROM blaine.pschv2; -/*e*/SELECT * FROM blaine.pschct1; -/*e*/SELECT * FROM blaine.pschct2; -/*e*/SELECT * FROM blaine.pschct3; --- Verify SELECTs using default schema -/*c2*/SELECT * FROM public.pscht1; -- Sanity check DEBUG -/*u0*/SET SCHEMA public; -- Sanity check DEBUG -/*c2*/SELECT * FROM pscht1; -/*c2*/SELECT * FROM pscht2; -/*c2*/SELECT * FROM pschv1; -/*c2*/SELECT * FROM pschv2; -/*c1*/SELECT * FROM pschct1; -/*c1*/SELECT * FROM pschct2; -/*c1*/SELECT * FROM pschct3; --- Following 2 just to confirm that TRIGGERs created. -/*e*/CREATE TRIGGER ptrig1 - AFTER INSERT ON pscht1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER public.ptrig2 - AFTER INSERT ON public.pscht1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/SET SCHEMA nosuch; - -/*u0*/SET SCHEMA blaine; - --- ****************************** MEM Tables -/*e*/DROP TABLE nosuch; -DROP TABLE xtblt1 IF exists; -DROP TABLE xtblt2 IF exists; -DROP TABLE xtblt3 IF exists; -DROP TABLE xtblt4 IF exists; -DROP TABLE xtblt101 IF exists; -DROP TABLE xtblj1 IF exists; -/*u0*/CREATE TABLE xtblt1 (i int); -SET SCHEMA public; -/*u0*/CREATE TABLE blaine.xtblt2 (i int); -SET SCHEMA blaine; -/*u0*/CREATE TABLE xtblt3 (i int); -/*u0*/CREATE TABLE xtblj1 (i int, vc varchar(10)); -- For testing Joins -/*e*/CREATE TABLE information_schema.xtblt101 (i int); -/*e*/CREATE TABLE xtblt1 (i int); -- Create existing object -SET SCHEMA public; -/*e*/CREATE TABLE blaine.xtblt1 (i int); -- Create existing object -SET SCHEMA blaine; -/*e*/CREATE TABLE information_schema.system_users (i int); -- Existing object -/*e*/INSERT INTO other.xtblt1 values(0); -/*e*/INSERT INTO information_schema.xtblt1 values(1); -/*u1*/INSERT INTO xtblt1 values(0); -SET SCHEMA public; -/*u1*/INSERT INTO blaine.xtblt1 values(100); -SET SCHEMA blaine; --- Test one update that will be persisted (most update tests won't be) -SET SCHEMA public; -/*u1*/UPDATE blaine.xtblt1 set i = 1 WHERE i = 100; -SET SCHEMA blaine; -/*u1*/INSERT INTO xtblj1 values(1, 'one'); -SET SCHEMA public; -CREATE TABLE blaine.xtblt4 AS (SELECT * FROM blaine.xtblt1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM blaine.xtblt4; -SET SCHEMA blaine; - --- ****************************** CACH Tables -/*e*/DROP TABLE nosuch; -DROP TABLE xctblt1 IF exists; -DROP TABLE xctblt2 IF exists; -DROP TABLE xctblt3 IF exists; -DROP TABLE xctblt4 IF exists; -DROP TABLE xctblt101 IF exists; -DROP TABLE xtblj1 IF exists; -/*u0*/CREATE CACHED TABLE xctblt1 (i int); -SET SCHEMA public; -/*u0*/CREATE CACHED TABLE blaine.xctblt2 (i int); -SET SCHEMA blaine; -/*u0*/CREATE CACHED TABLE xctblt3 (i int); -/*u0*/CREATE CACHED TABLE xtblj1 (i int, vc varchar(10)); -- For testing Joins -/*e*/CREATE CACHED TABLE information_schema.xctblt101 (i int); -/*e*/CREATE CACHED TABLE xctblt1 (i int); -- Create existing object -SET SCHEMA public; -/*e*/CREATE CACHED TABLE blaine.xctblt1 (i int); -- Create existing object -SET SCHEMA blaine; -/*e*/CREATE CACHED TABLE information_schema.system_users (i int); -- Existing object -/*e*/INSERT INTO other.xctblt1 values(0); -/*e*/INSERT INTO information_schema.xctblt1 values(1); -/*u1*/INSERT INTO xctblt1 values(0); -SET SCHEMA public; -/*u1*/INSERT INTO blaine.xctblt1 values(100); --- Test one update that will be persisted (most update tests won't be) -/*u1*/UPDATE blaine.xctblt1 set i = 1 WHERE i = 100; -SET SCHEMA blaine; -/*u1*/INSERT INTO xtblj1 values(1, 'one'); -SET SCHEMA public; -CREATE TABLE blaine.xctblt4 AS (SELECT * FROM blaine.xctblt1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM blaine.xctblt4; -SET SCHEMA blaine; - --- ****************************** Views -DROP VIEW xvwv1 IF exists; -DROP VIEW xvwv2 IF exists; -DROP VIEW xvwv3 IF exists; -DROP VIEW xvwv4 IF exists; -DROP VIEW xvwv5 IF exists; -DROP VIEW xvwv6 IF exists; -DROP VIEW xvwv7 IF exists; -DROP VIEW xvwv8 IF exists; -DROP VIEW xvwv9 IF exists; -DROP VIEW xvwv10 IF exists; -DROP VIEW xvwv11 IF exists; -DROP VIEW xvwv12 IF exists; -DROP VIEW xvwv13 IF exists; -DROP VIEW xvwv14 IF exists; -DROP VIEW xvwv15 IF exists; -DROP VIEW xvwv16 IF exists; -DROP VIEW xvwv17 IF exists; -DROP VIEW xvwv18 IF exists; -DROP VIEW xvwv19 IF exists; -DROP VIEW xvwv20 IF exists; -DROP VIEW xvwv21 IF exists; -DROP VIEW xvwv22 IF exists; -DROP VIEW xvwv23 IF exists; -DROP VIEW xvwv24 IF exists; -DROP VIEW xvwv25 IF exists; -DROP VIEW xvwv26 IF exists; -DROP VIEW xvwv27 IF exists; -DROP VIEW xvwv101 IF exists; -DROP TABLE xvwt1 IF exists; -DROP TABLE xvwt2 IF exists; -DROP TABLE xvwj1 IF exists; -DROP TABLE public.pubtbl IF exists; -CREATE TABLE xvwt1 (i int); -CREATE TABLE xvwj1 (i int, vc varchar(10)); -CREATE TABLE public.pubtbl (i int); -INSERT INTO public.pubtbl values(0); -INSERT INTO xvwt1 values(0); -INSERT INTO xvwt1 values(1); -INSERT INTO xvwj1 values(1, 'one'); -/*e*/CREATE VIEW information_schema.xvwv101 AS - SELECT * FROM information_schema.system_users; -/*e*/CREATE VIEW information_schema.xvwv101 AS - SELECT * FROM xvwt1; -SET SCHEMA public; -/*e*/CREATE VIEW information_schema.xvwv4 AS - SELECT * FROM blaine.xvwt1; -SET SCHEMA blaine; -/*e*/CREATE VIEW xvwv101 AS SELECT * FROM other.xvwt1; -SET SCHEMA public; -/*e*/CREATE VIEW blaine.xvwv101 AS SELECT * FROM other.xvwt1; -SET SCHEMA blaine; -/*e*/CREATE VIEW other.xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE user_name = vc; -SET SCHEMA public; -/*e*/CREATE VIEW other.xvwv101 AS SELECT * - FROM information_schema.system_users, blaine.xvwj1 WHERE user_name = vc; -SET SCHEMA blaine; -/*e*/CREATE VIEW other.xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE information_schema.user_name = vc; -/*e*/CREATE VIEW other.xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE information_schema.user_name = blaine.vc; -/*e*/CREATE VIEW information_schema.xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE user_name = vc; -SET SCHEMA public; -/*e*/CREATE VIEW information_schema.xvwv101 AS SELECT * - FROM information_schema.system_users, blaine.xvwj1 WHERE user_name = vc; -SET SCHEMA blaine; -/*e*/CREATE VIEW information_schema.xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE information_schema.user_name = vc; -/*e*/CREATE VIEW information_schema.xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE information_schema.user_name = blaine.vc; -/*e*/CREATE VIEW xvwv101 AS SELECT * - FROM system_users, xvwj1 - WHERE user_name = vc; -/*e*/CREATE VIEW xvwv101 AS SELECT * - FROM information_schema.system_users, information_schema.xvwj1 - WHERE user_name = vc; -/*e*/CREATE VIEW xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE other.user_name = vc; -/*e*/CREATE VIEW xvwv101 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE blaine.user_name = blaine.vc; -/*c2*/SELECT * FROM xvwt1; -- Sanity check -/*u0*/CREATE VIEW xvwv1 AS SELECT * FROM xvwt1; -/*e*/CREATE VIEW blaine.xvwv1 AS SELECT * FROM xvwt1; -- Create existing object -SET SCHEMA public; -/*e*/CREATE VIEW blaine.xvwv1 AS SELECT * FROM blaine.xvwt1; -- Existing object -SET SCHEMA blaine; -/*u0*/CREATE VIEW blaine.xvwv2 AS SELECT * FROM xvwt1; -SET SCHEMA public; -/*u0*/CREATE VIEW blaine.xvwv3 AS SELECT * FROM blaine.xvwt1; -SET SCHEMA blaine; -/*u0*/CREATE VIEW blaine.xvwv4 AS SELECT * FROM xvwt1 WHERE i = 0; -/*u0*/CREATE VIEW blaine.xvwv5 AS SELECT * FROM xvwt1 WHERE i < 1; -SET SCHEMA public; -/*u0*/CREATE VIEW blaine.xvwv6 AS SELECT * FROM information_schema.system_users - WHERE user_name = 'SA'; -SET SCHEMA blaine; -/*u0*/CREATE VIEW xvwv7 AS SELECT * FROM information_schema.system_users; -/*u0*/CREATE VIEW xvwv8 AS SELECT * FROM information_schema.system_users - WHERE user_name = 'SA'; -/*u0*/CREATE VIEW xvwv9 AS SELECT * FROM information_schema.system_users, xvwj1 - WHERE user_name = vc; -/*u0*/CREATE VIEW xvwv10 AS SELECT * - FROM information_schema.system_users, blaine.xvwj1 WHERE user_name = vc; -/*u0*/CREATE VIEW xvwv11 AS SELECT * FROM information_schema.system_users, xvwj1 - WHERE system_users.user_name = vc; -/*u0*/CREATE VIEW xvwv12 AS SELECT * FROM information_schema.system_users, xvwj1 - WHERE system_users.user_name = xvwj1.vc; -SET SCHEMA public; --- Should FAIL because SEL sub-q gets default schema from Session default. -/*e*/CREATE VIEW blaine.xvwv13 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE user_name = vc; -/*u0*/CREATE VIEW blaine.xvwv14 AS SELECT * - FROM information_schema.system_users, blaine.xvwj1 WHERE user_name = vc; -SET SCHEMA blaine; -/*u0*/CREATE VIEW blaine.xvwv15 AS SELECT * - FROM information_schema.system_users, xvwj1 - WHERE system_users.user_name = vc; -/*u0*/CREATE VIEW blaine.xvwv16 AS SELECT * - FROM information_schema.system_users, blaine.xvwj1 - WHERE system_users.user_name = xvwj1.vc; -/*u0*/CREATE VIEW xvwv17 AS SELECT * FROM information_schema.system_users, xvwj1 - WHERE user_name = vc; -/*u0*/CREATE VIEW xvwv18 AS SELECT * - FROM information_schema.system_users, blaine.xvwj1 WHERE user_name = vc; -/*u0*/CREATE VIEW xvwv19 (v1, v2, v3) AS SELECT * FROM xvwt1, xvwj1 WHERE xvwt1.i = xvwj1.i; -/*u0*/CREATE VIEW xvwv20 (v1, v2, v3) AS SELECT * FROM blaine.xvwt1, blaine.xvwj1 WHERE xvwt1.i = xvwj1.i; -/*u0*/CREATE VIEW xvwv21 (v1, v2, v3) AS SELECT * FROM blaine.xvwt1, xvwj1 WHERE xvwt1.i = xvwj1.i; -/*u0*/CREATE VIEW xvwv22 (v1, v2, v3) AS SELECT * FROM xvwt1, blaine.xvwj1 WHERE xvwt1.i = xvwj1.i; -/*u0*/CREATE VIEW blaine.xvwv23 (v1, v2, v3) AS - SELECT * FROM xvwt1, xvwj1 WHERE xvwt1.i = xvwj1.i; -SET SCHEMA public; -/*u0*/CREATE VIEW blaine.xvwv24 (v1, v2, v3) AS - SELECT * FROM blaine.xvwt1, blaine.xvwj1 WHERE xvwt1.i = xvwj1.i; --- Sub-SEL (2nd) should default to public schema!: (don't know 'bout 1st SEL) -/*e*/CREATE VIEW blaine.xvwv101 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT i FROM xvwj1); -/*e*/CREATE VIEW blaine.xvwv101 AS - SELECT * FROM blaine.xvwt1 WHERE xvwt1.i = (SELECT i FROM xvwj1); -SET SCHEMA blaine; -/*u0*/CREATE VIEW blaine.xvwv25 (v1, v2, v3) AS SELECT * FROM blaine.xvwt1, xvwj1 WHERE xvwt1.i = xvwj1.i; -/*u0*/CREATE VIEW blaine.xvwv26 (v1, v2, v3) AS SELECT * FROM xvwt1, blaine.xvwj1 WHERE xvwt1.i = xvwj1.i; --- We do not permit views to reference tables in another schema, except --- for information_schema. -/*u0*/CREATE VIEW blaine.xvwv27 AS SELECT * FROM public.pubtbl; -/*u0*/CREATE VIEW xvwv28 AS - SELECT * FROM xvwt1 WHERE i in (0, 1, 11, 12); -/*u0*/CREATE VIEW blaine.xvwv29 AS - SELECT * FROM xvwt1 WHERE i < 1; -/*u0*/CREATE VIEW xvwv30 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT i FROM xvwj1); -/*u0*/CREATE VIEW xvwv31 AS - SELECT * FROM xvwt1 WHERE xvwt1.i in (SELECT i FROM xvwj1); -/*u0*/CREATE VIEW xvwv32 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT i FROM xvwj1 WHERE i = 0); -/*u0*/CREATE VIEW xvwv33 AS - SELECT * FROM blaine.xvwt1 WHERE xvwt1.i = (SELECT i FROM xvwj1); -SET SCHEMA public; --- (2nd SEL sub-query) should use Session default schema -/*e*/CREATE VIEW blaine.xvwv101 AS - SELECT * FROM blaine.xvwt1 WHERE xvwt1.i in (SELECT i FROM xvwj1); -SET SCHEMA blaine; -/*u0*/CREATE VIEW blaine.xvwv34 AS - SELECT * FROM blaine.xvwt1 WHERE xvwt1.i in (SELECT i FROM xvwj1); -/*u0*/CREATE VIEW blaine.xvwv35 AS - SELECT * FROM blaine.xvwt1 WHERE xvwt1.i = (SELECT i FROM xvwj1 WHERE i = 0); -/*u0*/CREATE VIEW blaine.xvwv36 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT i FROM blaine.xvwj1); -/*u0*/CREATE VIEW blaine.xvwv37 AS - SELECT * FROM xvwt1 WHERE xvwt1.i in (SELECT i FROM blaine.xvwj1); -/*u0*/CREATE VIEW blaine.xvwv38 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT i FROM blaine.xvwj1 WHERE i = 1); -/*u0*/CREATE VIEW blaine.xvwv39 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT xvwj1.i FROM blaine.xvwj1); -/*u0*/CREATE VIEW blaine.xvwv40 AS - SELECT * FROM xvwt1 WHERE xvwt1.i in (SELECT xvwj1.i FROM xvwj1); -/*u0*/CREATE VIEW blaine.xvwv41 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT xvwj1.i FROM xvwj1 WHERE i = 1); -/*u0*/CREATE VIEW blaine.xvwv42 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT i FROM blaine.xvwj1 WHERE xvwj1.i = 1); -/*u0*/CREATE VIEW blaine.xvwv43 AS - SELECT * FROM xvwt1 WHERE xvwt1.i = (SELECT xvwj1.i FROM xvwj1 WHERE xvwj1.i = 1); -/*u0*/CREATE VIEW blaine.xvwv44 AS - SELECT * FROM xvwt1 WHERE i = (SELECT i FROM xvwj1); -/*u0*/CREATE VIEW blaine.xvwv45 AS - SELECT * FROM xvwt1 WHERE i in (SELECT i FROM xvwj1); -/*u0*/CREATE VIEW blaine.xvwv46 AS - SELECT * FROM xvwt1 WHERE i = (SELECT i FROM xvwj1 WHERE i = 1); -/*u0*/CREATE VIEW blaine.xvwv47 AS - SELECT * FROM blaine.xvwt1 WHERE i = (SELECT i FROM xvwj1); -/*u0*/CREATE VIEW blaine.xvwv48 AS - SELECT * FROM blaine.xvwt1 WHERE i in (SELECT i FROM xvwj1); -/*u0*/CREATE VIEW blaine.xvwv49 AS - SELECT * FROM blaine.xvwt1 WHERE i = (SELECT i FROM xvwj1 WHERE i = 1); -/*u0*/CREATE VIEW blaine.xvwv50 AS - SELECT * FROM xvwt1 WHERE i = (SELECT i FROM blaine.xvwj1); -/*u0*/CREATE VIEW blaine.xvwv51 AS - SELECT * FROM xvwt1 WHERE i in (SELECT i FROM blaine.xvwj1); -/*u0*/CREATE VIEW blaine.xvwv52 AS - SELECT * FROM xvwt1 WHERE i = (SELECT i FROM blaine.xvwj1 WHERE i = 1); -/*u0*/CREATE VIEW blaine.xvwv53 AS - SELECT * FROM xvwt1 WHERE i = (SELECT xvwj1.i FROM blaine.xvwj1); -/*u0*/CREATE VIEW blaine.xvwv54 AS - SELECT * FROM xvwt1 WHERE i in (SELECT xvwj1.i FROM xvwj1); -/*u0*/CREATE VIEW blaine.xvwv55 AS - SELECT * FROM xvwt1 WHERE i = (SELECT xvwj1.i FROM xvwj1 WHERE i = 1); -/*u0*/CREATE VIEW blaine.xvwv56 AS - SELECT * FROM xvwt1 WHERE i = (SELECT i FROM blaine.xvwj1 WHERE xvwj1.i = 1); -/*u0*/CREATE VIEW blaine.xvwv57 AS - SELECT * FROM xvwt1 WHERE i = (SELECT xvwj1.i FROM xvwj1 WHERE xvwj1.i = 1); -/*e*/DROP VIEW other.xvwv1; -/*e*/DROP VIEW information_schema.xvwv2; - --- ****************************** MEM Indexes -DROP INDEX xindi1 IF exists; -DROP INDEX xindi2 IF exists; -DROP INDEX xindi3 IF exists; -DROP INDEX xindi4 IF exists; -DROP INDEX xindi5 IF exists; -DROP TABLE xindt1 IF exists; -DROP TABLE xindt2 IF exists; -DROP TABLE xindt3 IF exists; -DROP TABLE xindt4 IF exists; -DROP TABLE xindt101 IF exists; -CREATE TABLE xindt1 (i int); -INSERT INTO xindt1 values(0); -INSERT INTO xindt1 values(1); -CREATE TABLE xindt2 (i int); -INSERT INTO xindt2 values(0); -INSERT INTO xindt2 values(1); -CREATE TABLE xindt3 (i int); -INSERT INTO xindt3 values(0); -INSERT INTO xindt3 values(1); -CREATE TABLE xindt4 (i int); -INSERT INTO xindt4 values(0); -INSERT INTO xindt4 values(1); -/*e*/CREATE UNIQUE INDEX other.xindi101 ON xindt4(i); -/*e*/CREATE UNIQUE INDEX xindi101 ON xindt101(i); -/*e*/CREATE UNIQUE INDEX blaine.xindi101 ON public.pscht2(i); -/*e*/CREATE UNIQUE INDEX public.xindi101 ON xindt1(i); -CREATE TABLE xindt101 (i int); -INSERT INTO xindt101 values(0); -INSERT INTO xindt101 values(1); -/*e*/CREATE UNIQUE INDEX information_schema.xindi101 on xindt101(i int); -/*u0*/CREATE UNIQUE INDEX xindi1 ON xindt1(i); -/*e*/CREATE UNIQUE INDEX xindi1 ON xindt1(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX blaine.xindi2 ON xindt2(i); -/*e*/CREATE UNIQUE INDEX blaine.xindi2 ON xindt2(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX xindi3 ON xindt3(i); -SET SCHEMA public; -/*u0*/CREATE UNIQUE INDEX xindi4 ON blaine.xindt4(i); -SET SCHEMA blaine; --- The error message says that the schema name is invalid. --- Can only create indexes in same schema as target table. -/*e*/CREATE UNIQUE INDEX xindi5 ON information_schema.system_users(user_name); -/*e*/DROP INDEX other.xindi1; -/*e*/DROP INDEX information_schema.xindi2; - --- ****************************** CACH Indexes -DROP INDEX xcindi1 IF exists; -DROP INDEX xcindi2 IF exists; -DROP INDEX xcindi3 IF exists; -DROP INDEX xcindi4 IF exists; -DROP INDEX xcindi5 IF exists; -DROP TABLE xcindt1 IF exists; -DROP TABLE xcindt2 IF exists; -DROP TABLE xcindt3 IF exists; -DROP TABLE xcindt4 IF exists; -DROP TABLE xcindt101 IF exists; -CREATE TABLE xcindt1 (i int); -INSERT INTO xcindt1 values(0); -INSERT INTO xcindt1 values(1); -CREATE TABLE xcindt2 (i int); -INSERT INTO xcindt2 values(0); -INSERT INTO xcindt2 values(1); -CREATE TABLE xcindt3 (i int); -INSERT INTO xcindt3 values(0); -INSERT INTO xcindt3 values(1); -CREATE TABLE xcindt4 (i int); -INSERT INTO xcindt4 values(0); -INSERT INTO xcindt4 values(1); -/*e*/CREATE UNIQUE INDEX other.xcindi101 on xcindt101(i); -CREATE TABLE xcindt101 (i int); -INSERT INTO xcindt101 values(0); -INSERT INTO xcindt101 values(1); -/*e*/CREATE UNIQUE INDEX information_schema.xcindi101 on xcindt101(i int); -/*u0*/CREATE UNIQUE INDEX xcindi1 ON xcindt1(i); -/*e*/CREATE UNIQUE INDEX xcindi1 ON xcindt1(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX blaine.xcindi2 ON xcindt2(i); -/*e*/CREATE UNIQUE INDEX blaine.xcindi2 ON xcindt2(i); -- Create existing object -/*u0*/CREATE UNIQUE INDEX xcindi3 ON xcindt3(i); -/*u0*/CREATE UNIQUE INDEX xcindi4 ON xcindt4(i); --- The error message says that the schema name is invalid. --- Can only create indexes in same schema as target table. -/*e*/CREATE UNIQUE INDEX xcindi5 ON information_schema.system_users(user_name); -/*e*/DROP INDEX other.xcindi1; -/*e*/DROP INDEX information_schema.xcindi2; - --- ****************************** Sequences -DROP TABLE xseqt1 IF EXISTS; -CREATE TABLE xseqt1 (i int); -INSERT INTO xseqt1 VALUES(10); --- No "IF EXISTS" allowed with xsequences, so can't verify they don't exists. -/*e*/CREATE SEQUENCE other.xs101; -/*e*/CREATE SEQUENCE information_schema.xs101; -/*u0*/CREATE SEQUENCE xs1; -/*e*/CREATE SEQUENCE xs1; -- Create existing object -SET SCHEMA public; -/*u0*/CREATE SEQUENCE blaine.xs2; -/*e*/CREATE SEQUENCE blaine.xs2; -- Create existing object --- To test persistence of incremented value: -/*r0*/SELECT next value FOR blaine.xs2 - FROM information_schema.system_users where user_name = 'SA'; -SET SCHEMA blaine; -/*r1*/SELECT next value FOR xs2 - FROM information_schema.system_users where user_name = 'SA'; - --- ****************************** Triggers -DROP TABLE xtrgt1 IF EXISTS; -DROP TABLE xtrgt2 IF EXISTS; -DROP TABLE xtrgt3 IF EXISTS; -DROP TABLE xtrgt4 IF EXISTS; -DROP TABLE xtrgt101 IF EXISTS; --- No "IF EXISTS" allowed with triggers, so can't verify they don't exists. -CREATE TABLE xtrgt1 (i int); -CREATE TABLE xtrgt2 (i int); -CREATE TABLE xtrgt3 (i int); -CREATE TABLE xtrgt4 (i int); -/*e*/CREATE TRIGGER other.xtrgtrig101 - AFTER INSERT ON xtrgt1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER xtrgtrig101 - AFTER INSERT ON other.xtrgt1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER xtrgtrig101 - AFTER INSERT ON information_schema.xtrgt1 CALL "org.hsqldb.test.BlaineTrig"; -/*e*/CREATE TRIGGER xtrgtrig101 - AFTER INSERT ON xtrgt101 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER xtrgtrig1 - AFTER INSERT ON xtrgt1 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER blaine.xtrgtrig2 - AFTER INSERT ON xtrgt2 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -/*u0*/CREATE TRIGGER xtrgtrig3 - AFTER INSERT ON blaine.xtrgt3 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -SET SCHEMA public; -/*u0*/CREATE TRIGGER blaine.xtrgtrig4 - AFTER INSERT ON blaine.xtrgt4 QUEUE 0 CALL "org.hsqldb.test.BlaineTrig"; -SET SCHEMA blaine; -/*e*/DROP TRIGGER information_schema.xtrgtrig1; -/*e*/DROP TRIGGER other.xtrgtrig1; - --- ****************************** Constraints -DROP TABLE xcont1 IF EXISTS; -DROP TABLE xcont2 IF EXISTS; -DROP TABLE xcont3 IF EXISTS; -DROP TABLE xcont4 IF EXISTS; -DROP TABLE xcont5 IF EXISTS; -DROP TABLE xcont6 IF EXISTS; -DROP TABLE xcont7 IF EXISTS; -DROP TABLE xcont8 IF EXISTS; -DROP TABLE xcont9 IF EXISTS; -DROP TABLE xcont10 IF EXISTS; -DROP TABLE xcont11 IF EXISTS; -DROP TABLE xcont12 IF EXISTS; -DROP TABLE xcont13 IF EXISTS; -DROP TABLE xcont14 IF EXISTS; -DROP TABLE xcont15 IF EXISTS; -DROP TABLE xcont16 IF EXISTS; -DROP TABLE xcont17 IF EXISTS; -DROP TABLE xcont18 IF EXISTS; -DROP TABLE xcont19 IF EXISTS; -DROP TABLE xcont20 IF EXISTS; -DROP TABLE xcont101 IF EXISTS; -CREATE TABLE xconj1(i int, vc varchar(10), PRIMARY KEY (i)); -INSERT INTO xconj1 values(1, 'one'); --- No "IF EXISTS" allowed with xconstrs., so can't verify they don't exists. -/*e*/CREATE TABLE other.xcont101 (i int, CONSTRAINT xconuc1 UNIQUE(i)); -/*e*/CREATE TABLE system_information.xcont1 (i int, CONSTRAINT xconuc1 UNIQUE(i)); -/*u0*/CREATE TABLE xcont1 (i int, CONSTRAINT xconuc1 UNIQUE(i)); -/*e*/CREATE TABLE xcont1 (i int, CONSTRAINT xconuc1 UNIQUE(i)); -/*e*/CREATE TABLE xcont101 (i int, CONSTRAINT xconuc1 UNIQUE(i)); -- xconuc1 already exists -/*e*/CREATE TABLE xcont101 (i int, CONSTRAINT blaine.xconuc1 UNIQUE(i)); -- ditto -/*u0*/CREATE TABLE blaine.xcont2 (i int, CONSTRAINT xconuc2 UNIQUE(i)); -/*e*/CREATE TABLE blaine.xcont101 (i int, CONSTRAINT xconuc2 UNIQUE(i)); -- xconuc2 already -SET SCHEMA public; -/*e*/CREATE TABLE blaine.xcont101 (i int, CONSTRAINT blaine.xconuc2 UNIQUE(i)); -- dit -SET SCHEMA blaine; -/*u0*/CREATE TABLE xcont3 (i int, CONSTRAINT blaine.xconuc3 UNIQUE(i)); -SET SCHEMA public; -/*u0*/CREATE TABLE blaine.xcont4 (i int, CONSTRAINT blaine.xconuc4 UNIQUE(i)); -SET SCHEMA blaine; -/*u0*/CREATE TABLE xcont5 (i int, CONSTRAINT xconpk5 PRIMARY KEY(i)); -/*u0*/CREATE TABLE blaine.xcont6 (i int, CONSTRAINT xconpk6 PRIMARY KEY(i)); -/*u0*/CREATE TABLE xcont7 (i int, CONSTRAINT blaine.xconpk7 PRIMARY KEY(i)); -/*u0*/CREATE TABLE blaine.xcont8 (i int, CONSTRAINT blaine.xconpk8 PRIMARY KEY(i)); -/*u0*/CREATE TABLE xcont9 (i int, CONSTRAINT xconfk9 FOREIGN KEY(i) REFERENCES xconj1(i)); -/*e*/CREATE TABLE xcont101 (i int, CONSTRAINT xconfk9 FOREIGN KEY(i) - REFERENCES other.xconj1(i)); -/*e*/CREATE TABLE xcont101 (i int, CONSTRAINT xconfk9 FOREIGN KEY(i) - REFERENCES information_schema.xconj1(i)); -/*u0*/CREATE TABLE blaine.xcont10 (i int, CONSTRAINT xconfk10 - FOREIGN KEY(i) REFERENCES xconj1(i)); -/*u0*/CREATE TABLE xcont11 (i int, CONSTRAINT blaine.xconfk11 - FOREIGN KEY(i) REFERENCES xconj1(i)); -/*u0*/CREATE TABLE blaine.xcont12 (i int, CONSTRAINT blaine.xconfk12 - FOREIGN KEY(i) REFERENCES xconj1(i)); --- Test prohibit create fk -> another-schema with every thing else ok. -CREATE TABLE public.badtarget(i int, unique (i)); -/*u0*/CREATE TABLE xcont13 (i int, CONSTRAINT xconfk13 FOREIGN KEY(i) - REFERENCES public.badtarget(i)); -/*e*/CREATE TABLE xcont13 (i int, CONSTRAINT xconfk13 FOREIGN KEY(i) - REFERENCES blaine.xconj1(i)); -/*u0*/CREATE TABLE blaine.xcont14 (i int, CONSTRAINT xconfk14 - FOREIGN KEY(i) REFERENCES blaine.xconj1(i)); -/*u0*/CREATE TABLE xcont15 (i int, CONSTRAINT blaine.xconfk15 - FOREIGN KEY(i) REFERENCES blaine.xconj1(i)); -SET SCHEMA public; -/*u0*/CREATE TABLE blaine.xcont16 (i int, CONSTRAINT blaine.xconfk16 - FOREIGN KEY(i) REFERENCES blaine.xconj1(i)); -SET SCHEMA blaine; -/*u0*/CREATE TABLE xcont17 (i int, CONSTRAINT xconc17 CHECK (i < 1)); -/*u0*/CREATE TABLE blaine.xcont18 (i int, CONSTRAINT xconc18 CHECK (i in (0, 2))); -/*u0*/CREATE TABLE xcont19 (i int, CONSTRAINT blaine.xconc19 CHECK (i = 0)); -SET SCHEMA public; -/*u0*/CREATE TABLE blaine.xcont20 (i int, CONSTRAINT blaine.xconc20 CHECK (i != 1)); - --- schema definition with table, view and sequenence - --- schema definition containing illegal DDL statement -/*e*/CREATE SCHEMA FELIX AUTHORIZATION DBA - CREATE TABLE FELIXT1 (AV1 VARCHAR(10), BV VARCHAR(10)) - CREATE TABLE FELIXT2 (AV2 VARCHAR(10), BI INTEGER) - CREATE SEQUENCE FELIXS1 - CREATE VIEW FELIXV1 AS SELECT * FROM FELIXT1 JOIN FELIXT2 ON AV1 = AV2 - CREATE VIEW FELIXV2 AS SELECT AV1 AS C1, NEXT VALUE FOR FELIXS1 AS C2 FROM FELIXT1 - ALTER TABLE FELIXT1 ADD PRIMARY KEY; -/*e*/SET SCHEMA FELIX -/*e*/SELECT * FROM FELIX.FELIXT1 - --- schema definition -CREATE SCHEMA FELIX AUTHORIZATION DBA - CREATE TABLE FELIXT1 (AV1 VARCHAR(10), BV VARCHAR(10)) - CREATE TABLE FELIXT2 (AV2 VARCHAR(10), BI INTEGER) - CREATE SEQUENCE FELIXS1 - CREATE VIEW FELIXV1 AS SELECT * FROM FELIXT1 JOIN FELIXT2 ON AV1 = AV2 - CREATE VIEW FELIXV2 AS SELECT AV1 AS C1, NEXT VALUE FOR FELIXS1 AS C2 FROM FELIXT1; -/*e*/SELECT * FROM FELIXV1 -SET SCHEMA FELIX -/*c0*/SELECT * FROM FELIXV1 - --- ****************************** ALTERs --- Add tests when time permits. - - -/*u0*/SET SCHEMA blaine; -- Sanity. Cf. 1st 2 lines of B2 script. -/*c2*/SELECT * FROM xtblt1; -- Sanity. Cf. 1st 2 lines of B2 script. --- This to test recovery from .log files. -COMMIT; -SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistB2.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistB2.txt deleted file mode 100644 index b76db3c0..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistB2.txt +++ /dev/null @@ -1,600 +0,0 @@ --- TEST OBJECTS - --- This TESTS the schema-specific objects created in a previous script. --- (See the *C[12].txt scripts for similar tests of ALTER comands (which --- this script purposefully omits). - - -/*u0*/SET SCHEMA blaine; -CREATE USER otheruser PASSWORD otheruser; - --- ****************************** MEM Tables -/*c2*/SELECT * FROM xtblt1; -/*c1*/SELECT * FROM xtblt1 WHERE i = 0; -/*c2*/SELECT * FROM xtblt1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM xtblt1 WHERE i < 1; -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT i FROM xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i in (SELECT i FROM xtblj1); -/*c0*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT i FROM xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM blaine.xtblt1 WHERE xtblt1.i = (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM blaine.xtblt1 WHERE xtblt1.i in (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM blaine.xtblt1 WHERE xtblt1.i = (SELECT i FROM xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i in (SELECT i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT i FROM blaine.xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT xtblj1.i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i in (SELECT xtblj1.i FROM xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT xtblj1.i FROM xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT i FROM blaine.xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xtblt1 WHERE xtblt1.i = (SELECT xtblj1.i FROM xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xtblt1 WHERE i = (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE i in (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE i = (SELECT i FROM xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM blaine.xtblt1 WHERE i = (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM blaine.xtblt1 WHERE i in (SELECT i FROM xtblj1); -/*c0*/SELECT * FROM blaine.xtblt1 WHERE i = (SELECT i FROM xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM xtblt1 WHERE i = (SELECT i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE i in (SELECT i FROM blaine.xtblj1); -/*c0*/SELECT * FROM xtblt1 WHERE i = (SELECT i FROM blaine.xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM xtblt1 WHERE i = (SELECT xtblj1.i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xtblt1 WHERE i in (SELECT xtblj1.i FROM xtblj1); -/*c0*/SELECT * FROM xtblt1 WHERE i = (SELECT xtblj1.i FROM xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM xtblt1 WHERE i = (SELECT i FROM blaine.xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xtblt1 WHERE i = (SELECT xtblj1.i FROM xtblj1 WHERE xtblj1.i = 1); -/*e*/SELECT * FROM system_users WHERE user_name = 'SA'; -/*e*/SELECT * FROM other.xtblt1; -/*e*/SELECT * FROM other.system_users; -/*e*/SELECT * FROM information_schema.xtblt1; -SET SCHEMA public; -/*e*/SELECT * FROM blaine.system_users; -/*c2*/SELECT * FROM blaine.xtblt1; -SET SCHEMA blaine; -/*c1*/SELECT * FROM information_schema.system_users WHERE user_name = 'SA'; -SET SCHEMA public; -/*c1*/SELECT * FROM blaine.xtblt1 WHERE i = 0; -SET SCHEMA blaine; -/*e*/SELECT * FROM other.xtblt1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.xtblt1 WHERE i = 0; -SET SCHEMA public; -/*c1*/SELECT * FROM blaine.xtblt1, blaine.xtblj1 WHERE xtblt1.i = xtblj1.i; -SET SCHEMA blaine; -/*c1*/SELECT * FROM xtblt1, blaine.xtblj1 WHERE xtblt1.i = xtblj1.i; -/*c1*/SELECT * FROM blaine.xtblt1, xtblj1 WHERE xtblt1.i = xtblj1.i; -/*c1*/SELECT * FROM xtblt1, xtblj1 WHERE xtblt1.i = xtblj1.i; -SET SCHEMA public; -/*c1*/SELECT vc FROM blaine.xtblt1, blaine.xtblj1 WHERE xtblt1.i = xtblj1.i; -SET SCHEMA blaine; -/*c1*/SELECT vc FROM xtblt1, blaine.xtblj1 WHERE xtblt1.i = xtblj1.i; -/*c1*/SELECT vc FROM blaine.xtblt1, xtblj1 WHERE xtblt1.i = xtblj1.i; -/*c1*/SELECT vc FROM xtblt1, xtblj1 WHERE xtblt1.i = xtblj1.i; -SET SCHEMA public; -/*c1*/SELECT xtblj1.vc FROM blaine.xtblt1, blaine.xtblj1 WHERE xtblt1.i = xtblj1.i; -SET SCHEMA blaine; -/*c1*/SELECT xtblj1.vc FROM xtblt1, blaine.xtblj1 WHERE xtblt1.i = xtblj1.i; -/*c1*/SELECT xtblj1.vc FROM blaine.xtblt1, xtblj1 WHERE xtblt1.i = xtblj1.i; -/*c1*/SELECT xtblj1.vc FROM xtblt1, xtblj1 WHERE xtblt1.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM xtblt1, xtblj1 lbla WHERE xtblt1.i = lbla.i; -/*c1*/SELECT xtblj1.vc FROM xtblt1 lblb, xtblj1 WHERE lblb.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM xtblt1 lblb, xtblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM blaine.xtblt1, xtblj1 lbla WHERE xtblt1.i = lbla.i; -/*c1*/SELECT xtblj1.vc FROM blaine.xtblt1 lblb, xtblj1 WHERE lblb.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM blaine.xtblt1 lblb, xtblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM xtblt1, blaine.xtblj1 lbla WHERE xtblt1.i = lbla.i; -/*c1*/SELECT xtblj1.vc FROM xtblt1 lblb, blaine.xtblj1 WHERE lblb.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM xtblt1 lblb, blaine.xtblj1 lbla WHERE lblb.i = lbla.i; -/*u0*/SET TABLE xtblt1 READONLY true; -/*e*/UPDATE xtblt1 set i = 11 WHERE i = 1; -SET SCHEMA public; -/*u0*/SET TABLE blaine.xtblt1 READONLY true; -/*e*/SET TABLE information_schema.xtblt1 READONLY true; -/*e*/SET TABLE other.xtblt1 READONLY true; -SET SCHEMA blaine; -/*u0*/SET TABLE xtblt1 READONLY false; -SET SCHEMA public; -/*u0*/SET TABLE blaine.xtblt1 READONLY false; -SET SCHEMA blaine; -/*c2*/SELECT i FROM xtblt1; --- N.b.: Do not commit DML changes so that this whole block may be repeated. -COMMIT; -SET AUTOCOMMIT false; -/*u1*/UPDATE xtblt1 set i = 11 WHERE i = 1; -/*u1*/UPDATE xtblt1 set xtblt1.i = 12 WHERE i = 11; -/*u1*/UPDATE xtblt1 set xtblt1.i = 13 WHERE xtblt1.i = 12; -SET SCHEMA public; -/*u1*/UPDATE blaine.xtblt1 set i = 14 WHERE i = 13; -/*u1*/UPDATE blaine.xtblt1 set xtblt1.i = 15 WHERE i = 14; -/*u1*/UPDATE blaine.xtblt1 set xtblt1.i = 16 WHERE xtblt1.i = 15; -SET SCHEMA blaine; -/*e*/UPDATE other.xtblt1 set xtblt1.i = 17 WHERE xtblt1.i = 16; -/*e*/UPDATE information_schema.xtblt1 set xtblt1.i = 17 WHERE xtblt1.i = 16; -/*u1*/UPDATE xtblt1 ali set i = 17 WHERE i = 16; -/*u1*/UPDATE xtblt1 ali set ali.i = 18 WHERE i = 17; -/*u1*/UPDATE xtblt1 ali set ali.i = 19 WHERE ali.i = 18; -/*u1*/UPDATE xtblt1 ali set i = 20 WHERE ali.i = 19; -SET SCHEMA public; -/*u1*/UPDATE blaine.xtblt1 ali set i = 21 WHERE i = 20; -/*u1*/UPDATE blaine.xtblt1 ali set ali.i = 22 WHERE i = 21; -/*u1*/UPDATE blaine.xtblt1 ali set ali.i = 23 WHERE ali.i = 22; -/*u1*/UPDATE blaine.xtblt1 ali set i = 24 WHERE ali.i = 23; -SET SCHEMA blaine; -/*e*/UPDATE other.xtblt1 ali set i = 25 WHERE ali.i = 24; -/*e*/UPDATE other.xtblt1 ali set i = 25 WHERE .i = 24; -/*e*/UPDATE other.xtblt1 set i = 25 WHERE i = 24; -/*e*/DELETE FROM other.xtblt1 ali WHERE ali.i = 24; -/*e*/DELETE FROM other.xtblt1 ali; -/*e*/DELETE FROM other.xtblt1 set WHERE i = 24; -/*e*/DELETE FROM other.xtblt1 WHERE i = 24; -/*e*/DELETE FROM system_information.xtblj1 WHERE xtblj1.i = 1; -/*u1*/DELETE FROM xtblt1 WHERE i = 0; -SET SCHEMA public; -/*u1*/DELETE FROM blaine.xtblt1 WHERE i = 24; -/*u1*/DELETE FROM blaine.xtblj1 WHERE xtblj1.i = 1; -SET SCHEMA blaine; -ROLLBACK; -/*c2*/SELECT i FROM xtblt1; -/*u0*/GRANT ALL ON xtblt1 TO otheruser; -SET SCHEMA public; -/*u0*/GRANT ALL ON blaine.xtblt2 TO otheruser; -SET SCHEMA blaine; -/*e*/GRANT ALL ON other.xtblt3 TO otheruser; -/*e*/GRANT ALL ON information_schema.xtblt3 TO otheruser; -/*u0*/REVOKE ALL ON xtblt1 FROM otheruser RESTRICT; -SET SCHEMA public; -/*u0*/REVOKE ALL ON blaine.xtblt2 FROM otheruser RESTRICT; -SET SCHEMA blaine; -/*e*/REVOKE ALL ON other.xtblt3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.xtblt3 FROM otheruser RESTRICT; -/*e*/DROP TABLE other.xtblt3; -/*e*/DROP TABLE information_schema.xtblt4; -/*e*/DROP TABLE xtblt101; -/*e*/DROP TABLE blaine.xtblt101; -/*u0*/DROP TABLE xtblt101 IF EXISTS; -SET SCHEMA public; -/*u0*/DROP TABLE blaine.xtblt101 IF EXISTS; -SET SCHEMA blaine; --- Should "DROP TABLE nonexistentschema.notable IF EXISTS" work? -/*u0*/DROP TABLE other.system_users IF exists; -/*u0*/DROP TABLE system_users IF exists; - --- ****************************** CACH Tables -/*c2*/SELECT * FROM xctblt1; -/*c1*/SELECT * FROM xctblt1 WHERE i = 0; -/*c2*/SELECT * FROM xctblt1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM xctblt1 WHERE i < 1; -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT i FROM xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i in (SELECT i FROM xtblj1); -/*c0*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT i FROM xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM blaine.xctblt1 WHERE xctblt1.i = (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM blaine.xctblt1 WHERE xctblt1.i in (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM blaine.xctblt1 WHERE xctblt1.i = (SELECT i FROM xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i in (SELECT i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT i FROM blaine.xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT xtblj1.i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i in (SELECT xtblj1.i FROM xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT xtblj1.i FROM xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT i FROM blaine.xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xctblt1 WHERE xctblt1.i = (SELECT xtblj1.i FROM xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xctblt1 WHERE i = (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE i in (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE i = (SELECT i FROM xtblj1 WHERE i = 1); -/*c1*/SELECT * FROM blaine.xctblt1 WHERE i = (SELECT i FROM xtblj1); -/*c1*/SELECT * FROM blaine.xctblt1 WHERE i in (SELECT i FROM xtblj1); -/*c0*/SELECT * FROM blaine.xctblt1 WHERE i = (SELECT i FROM xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM xctblt1 WHERE i = (SELECT i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE i in (SELECT i FROM blaine.xtblj1); -/*c0*/SELECT * FROM xctblt1 WHERE i = (SELECT i FROM blaine.xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM xctblt1 WHERE i = (SELECT xtblj1.i FROM blaine.xtblj1); -/*c1*/SELECT * FROM xctblt1 WHERE i in (SELECT xtblj1.i FROM xtblj1); -/*c0*/SELECT * FROM xctblt1 WHERE i = (SELECT xtblj1.i FROM xtblj1 WHERE i = 0); -/*c1*/SELECT * FROM xctblt1 WHERE i = (SELECT i FROM blaine.xtblj1 WHERE xtblj1.i = 1); -/*c1*/SELECT * FROM xctblt1 WHERE i = (SELECT xtblj1.i FROM xtblj1 WHERE xtblj1.i = 1); -/*e*/SELECT * FROM system_users WHERE user_name = 'SA'; -/*e*/SELECT * FROM other.xctblt1; -/*e*/SELECT * FROM other.system_users; -/*e*/SELECT * FROM information_schema.xctblt1; -/*e*/SELECT * FROM blaine.system_users; -SET SCHEMA public; -/*c2*/SELECT * FROM blaine.xctblt1; -/*c1*/SELECT * FROM information_schema.system_users WHERE user_name = 'SA'; -/*c1*/SELECT * FROM blaine.xctblt1 WHERE i = 0; -/*e*/SELECT * FROM other.xctblt1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.xctblt1 WHERE i = 0; -/*c1*/SELECT * FROM blaine.xctblt1, blaine.xtblj1 WHERE xctblt1.i = xtblj1.i; -SET SCHEMA blaine; -/*c1*/SELECT * FROM xctblt1, blaine.xtblj1 WHERE xctblt1.i = xtblj1.i; -/*c1*/SELECT * FROM blaine.xctblt1, xtblj1 WHERE xctblt1.i = xtblj1.i; -/*c1*/SELECT * FROM xctblt1, xtblj1 WHERE xctblt1.i = xtblj1.i; -SET SCHEMA public; -/*c1*/SELECT vc FROM blaine.xctblt1, blaine.xtblj1 WHERE xctblt1.i = xtblj1.i; -SET SCHEMA blaine; -/*c1*/SELECT vc FROM xctblt1, blaine.xtblj1 WHERE xctblt1.i = xtblj1.i; -/*c1*/SELECT vc FROM blaine.xctblt1, xtblj1 WHERE xctblt1.i = xtblj1.i; -/*c1*/SELECT vc FROM xctblt1, xtblj1 WHERE xctblt1.i = xtblj1.i; -SET SCHEMA public; -/*c1*/SELECT xtblj1.vc FROM blaine.xctblt1, blaine.xtblj1 WHERE xctblt1.i = xtblj1.i; -SET SCHEMA blaine; -/*c1*/SELECT xtblj1.vc FROM xctblt1, blaine.xtblj1 WHERE xctblt1.i = xtblj1.i; -/*c1*/SELECT xtblj1.vc FROM blaine.xctblt1, xtblj1 WHERE xctblt1.i = xtblj1.i; -/*c1*/SELECT xtblj1.vc FROM xctblt1, xtblj1 WHERE xctblt1.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM xctblt1, xtblj1 lbla WHERE xctblt1.i = lbla.i; -/*c1*/SELECT xtblj1.vc FROM xctblt1 lblb, xtblj1 WHERE lblb.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM xctblt1 lblb, xtblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM blaine.xctblt1, xtblj1 lbla WHERE xctblt1.i = lbla.i; -/*c1*/SELECT xtblj1.vc FROM blaine.xctblt1 lblb, xtblj1 WHERE lblb.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM blaine.xctblt1 lblb, xtblj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM xctblt1, blaine.xtblj1 lbla WHERE xctblt1.i = lbla.i; -/*c1*/SELECT xtblj1.vc FROM xctblt1 lblb, blaine.xtblj1 WHERE lblb.i = xtblj1.i; -/*c1*/SELECT lbla.vc FROM xctblt1 lblb, blaine.xtblj1 lbla WHERE lblb.i = lbla.i; -/*u0*/SET TABLE xctblt1 READONLY true; -/*e*/UPDATE xctblt1 set i = 11 WHERE i = 1; -SET SCHEMA public; -/*u0*/SET TABLE blaine.xctblt1 READONLY true; -SET SCHEMA blaine; -/*e*/SET TABLE information_schema.xctblt1 READONLY true; -/*e*/SET TABLE other.xctblt1 READONLY true; -/*u0*/SET TABLE xctblt1 READONLY false; -SET SCHEMA public; -/*u0*/SET TABLE blaine.xctblt1 READONLY false; -SET SCHEMA blaine; -/*c2*/SELECT i FROM xctblt1; --- N.b.: Do not commit DML changes so that this whole block may be repeated. -COMMIT; -SET AUTOCOMMIT false; -/*u1*/UPDATE xctblt1 set i = 11 WHERE i = 1; -/*u1*/UPDATE xctblt1 set xctblt1.i = 12 WHERE i = 11; -/*u1*/UPDATE xctblt1 set xctblt1.i = 13 WHERE xctblt1.i = 12; -SET SCHEMA public; -/*u1*/UPDATE blaine.xctblt1 set i = 14 WHERE i = 13; -/*u1*/UPDATE blaine.xctblt1 set xctblt1.i = 15 WHERE i = 14; -/*u1*/UPDATE blaine.xctblt1 set xctblt1.i = 16 WHERE xctblt1.i = 15; -SET SCHEMA blaine; -/*e*/UPDATE other.xctblt1 set xctblt1.i = 17 WHERE xctblt1.i = 16; -/*e*/UPDATE information_schema.xctblt1 set xctblt1.i = 17 WHERE xctblt1.i = 16; -/*u1*/UPDATE xctblt1 ali set i = 17 WHERE i = 16; -/*u1*/UPDATE xctblt1 ali set ali.i = 18 WHERE i = 17; -/*u1*/UPDATE xctblt1 ali set ali.i = 19 WHERE ali.i = 18; -/*u1*/UPDATE xctblt1 ali set i = 20 WHERE ali.i = 19; -SET SCHEMA public; -/*u1*/UPDATE blaine.xctblt1 ali set i = 21 WHERE i = 20; -/*u1*/UPDATE blaine.xctblt1 ali set ali.i = 22 WHERE i = 21; -/*u1*/UPDATE blaine.xctblt1 ali set ali.i = 23 WHERE ali.i = 22; -/*u1*/UPDATE blaine.xctblt1 ali set i = 24 WHERE ali.i = 23; -SET SCHEMA blaine; -/*e*/UPDATE other.xctblt1 ali set i = 25 WHERE ali.i = 24; -/*e*/UPDATE other.xctblt1 ali set i = 25 WHERE .i = 24; -/*e*/UPDATE other.xctblt1 set i = 25 WHERE i = 24; -/*e*/DELETE FROM other.xctblt1 ali WHERE ali.i = 24; -/*e*/DELETE FROM other.xctblt1 ali; -/*e*/DELETE FROM other.xctblt1 set WHERE i = 24; -/*e*/DELETE FROM other.xctblt1 WHERE i = 24; -/*e*/DELETE FROM system_information.xtblj1 WHERE xtblj1.i = 1; -/*u1*/DELETE FROM xctblt1 WHERE i = 0; -SET SCHEMA public; -/*u1*/DELETE FROM blaine.xctblt1 WHERE i = 24; -/*u1*/DELETE FROM blaine.xtblj1 WHERE xtblj1.i = 1; -SET SCHEMA blaine; -ROLLBACK; -/*c2*/SELECT i FROM xctblt1; -/*u0*/GRANT ALL ON xctblt1 TO otheruser; -SET SCHEMA public; -/*u0*/GRANT ALL ON blaine.xctblt2 TO otheruser; -SET SCHEMA blaine; -/*e*/GRANT ALL ON other.xctblt3 TO otheruser; -/*e*/GRANT ALL ON information_schema.xctblt3 TO otheruser; -/*u0*/REVOKE ALL ON xctblt1 FROM otheruser RESTRICT; -SET SCHEMA public; -/*u0*/REVOKE ALL ON blaine.xctblt2 FROM otheruser RESTRICT; -SET SCHEMA blaine; -/*e*/REVOKE ALL ON other.xctblt3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.xctblt3 FROM otheruser RESTRICT; -/*e*/DROP TABLE other.xctblt3; -/*e*/DROP TABLE information_schema.xctblt4; -/*e*/DROP TABLE xctblt101; -/*e*/DROP TABLE blaine.xctblt101; -/*u0*/DROP TABLE xctblt101 IF EXISTS; -SET SCHEMA public; -/*u0*/DROP TABLE blaine.xctblt101 IF EXISTS; -SET SCHEMA blaine; --- Should "DROP TABLE nonexistentschema.notable IF EXISTS" work? -/*u0*/DROP TABLE other.system_users IF exists; -/*u0*/DROP TABLE system_users IF exists; - --- ****************************** Views -/*c2*/SELECT * FROM xvwv1; -SET SCHEMA public; -/*c2*/SELECT * FROM blaine.xvwv1; -SET SCHEMA blaine; -/*c2*/SELECT * FROM xvwv2; -/*c2*/SELECT * FROM xvwv3; -/*c1*/SELECT * FROM xvwv4; -/*c1*/SELECT * FROM xvwv5; -/*c1*/SELECT * FROM xvwv8; -/*c0*/SELECT * FROM xvwv9; -/*c0*/SELECT * FROM xvwv10; -/*c0*/SELECT * FROM xvwv11; -/*c0*/SELECT * FROM xvwv12; -/*e*/SELECT * FROM xvwv13; -/*c0*/SELECT * FROM xvwv14; -/*c0*/SELECT * FROM xvwv15; -/*c0*/SELECT * FROM xvwv16; -/*c0*/SELECT * FROM xvwv17; -/*c0*/SELECT * FROM xvwv18; -/*c1*/SELECT * FROM xvwv19; -/*c1*/SELECT * FROM xvwv20; -/*c1*/SELECT * FROM xvwv21; -/*c1*/SELECT * FROM xvwv22; -/*c1*/SELECT * FROM xvwv23; -/*c1*/SELECT * FROM xvwv24; -/*c1*/SELECT * FROM xvwv25; -/*c1*/SELECT * FROM xvwv26; -/*c2*/SELECT * FROM xvwv28; -/*c1*/SELECT * FROM xvwv29; -/*c1*/SELECT * FROM xvwv30; -/*c1*/SELECT * FROM xvwv31; -/*c0*/SELECT * FROM xvwv32; -/*c1*/SELECT * FROM xvwv33; -/*c1*/SELECT * FROM xvwv34; -/*c0*/SELECT * FROM xvwv35; -/*c1*/SELECT * FROM xvwv36; -/*c1*/SELECT * FROM xvwv37; -/*c1*/SELECT * FROM xvwv38; -/*c1*/SELECT * FROM xvwv39; -/*c1*/SELECT * FROM xvwv40; -/*c1*/SELECT * FROM xvwv41; -/*c1*/SELECT * FROM xvwv42; -/*c1*/SELECT * FROM xvwv43; -/*c1*/SELECT * FROM xvwv44; -/*c1*/SELECT * FROM xvwv45; -/*c1*/SELECT * FROM xvwv46; -/*c1*/SELECT * FROM xvwv47; -/*c1*/SELECT * FROM xvwv48; -/*c1*/SELECT * FROM xvwv49; -/*c1*/SELECT * FROM xvwv50; -/*c1*/SELECT * FROM xvwv51; -/*c1*/SELECT * FROM xvwv52; -/*c1*/SELECT * FROM xvwv53; -/*c1*/SELECT * FROM xvwv54; -/*c1*/SELECT * FROM xvwv55; -/*c1*/SELECT * FROM xvwv56; -/*c1*/SELECT * FROM xvwv57; -/*c1*/SELECT * FROM xvwv1, xvwj1 WHERE xvwv1.i = xvwj1.i; -SET SCHEMA public; -/*c1*/SELECT * FROM blaine.xvwv1, blaine.xvwj1 WHERE xvwv1.i = xvwj1.i; -SET SCHEMA blaine; -/*c2*/SELECT * FROM xvwv1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM xvwv1 WHERE i < 1; -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE xvwv1.i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE xvwv1.i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i in (SELECT i FROM blaine.xvwj1); -/*c0*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM blaine.xvwj1 WHERE i = 0); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT xvwj1.i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i in (SELECT xvwj1.i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT xvwj1.i FROM xvwj1 WHERE i = 1); -/*c0*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM blaine.xvwj1 WHERE xvwj1.i = 0); -/*c0*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT xvwj1.i FROM xvwj1 WHERE xvwj1.i = 0); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE i = (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i in (SELECT i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM blaine.xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT xvwj1.i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i in (SELECT xvwj1.i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT xvwj1.i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM blaine.xvwj1 WHERE xvwj1.i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT xvwj1.i FROM xvwj1 WHERE xvwj1.i = 1); -/*c2*/SELECT * FROM xvwv1; -/*c1*/SELECT * FROM xvwv1 WHERE i = 0; -/*c2*/SELECT * FROM xvwv1 WHERE i in (0, 1, 11, 12); -/*c1*/SELECT * FROM xvwv1 WHERE i < 1; -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE xvwv1.i = (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE xvwv1.i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE xvwv1.i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i in (SELECT i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM blaine.xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT xvwj1.i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i in (SELECT xvwj1.i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT xvwj1.i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT i FROM blaine.xvwj1 WHERE xvwj1.i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE xvwv1.i = (SELECT xvwj1.i FROM xvwj1 WHERE xvwj1.i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE i = (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE i in (SELECT i FROM xvwj1); -/*c1*/SELECT * FROM blaine.xvwv1 WHERE i = (SELECT i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i in (SELECT i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM blaine.xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT xvwj1.i FROM blaine.xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i in (SELECT xvwj1.i FROM xvwj1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT xvwj1.i FROM xvwj1 WHERE i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT i FROM blaine.xvwj1 WHERE xvwj1.i = 1); -/*c1*/SELECT * FROM xvwv1 WHERE i = (SELECT xvwj1.i FROM xvwj1 WHERE xvwj1.i = 1); -/*e*/SELECT * FROM other.xvwv1; -/*e*/SELECT * FROM information_schema.xvwv1; -SET SCHEMA public; -/*c2*/SELECT * FROM blaine.xvwv1; -/*c1*/SELECT * FROM blaine.xvwv1 WHERE i = 0; -SET SCHEMA blaine; -/*e*/SELECT * FROM other.xvwv1 WHERE i = 0; -/*e*/SELECT * FROM information_schema.xvwv1 WHERE i = 0; -SET SCHEMA public; -CREATE TABLE blaine.vwt2 AS (SELECT * FROM blaine.xvwv1 WHERE i = 0) WITH DATA; -/*c1*/SELECT * FROM blaine.vwt2; -SET SCHEMA blaine; -DROP TABLE vwt2; -SET SCHEMA public; -/*c1*/SELECT * FROM blaine.xvwv1, blaine.xvwj1 WHERE xvwv1.i = xvwj1.i; -SET SCHEMA blaine; -/*c1*/SELECT * FROM xvwv1, blaine.xvwj1 WHERE xvwv1.i = xvwj1.i; -/*c1*/SELECT * FROM blaine.xvwv1, xvwj1 WHERE xvwv1.i = xvwj1.i; -/*c1*/SELECT * FROM xvwv1, xvwj1 WHERE xvwv1.i = xvwj1.i; -SET SCHEMA public; -/*c1*/SELECT vc FROM blaine.xvwv1, blaine.xvwj1 WHERE xvwv1.i = xvwj1.i; -SET SCHEMA blaine; -/*c1*/SELECT vc FROM xvwv1, blaine.xvwj1 WHERE xvwv1.i = xvwj1.i; -/*c1*/SELECT vc FROM blaine.xvwv1, xvwj1 WHERE xvwv1.i = xvwj1.i; -/*c1*/SELECT vc FROM xvwv1, xvwj1 WHERE xvwv1.i = xvwj1.i; -SET SCHEMA public; -/*c1*/SELECT xvwj1.vc FROM blaine.xvwv1, blaine.xvwj1 WHERE xvwv1.i = xvwj1.i; -SET SCHEMA blaine; -/*c1*/SELECT xvwj1.vc FROM xvwv1, blaine.xvwj1 WHERE xvwv1.i = xvwj1.i; -/*c1*/SELECT xvwj1.vc FROM blaine.xvwv1, xvwj1 WHERE xvwv1.i = xvwj1.i; -/*c1*/SELECT xvwj1.vc FROM xvwv1, xvwj1 WHERE xvwv1.i = xvwj1.i; -/*c1*/SELECT lbla.vc FROM xvwv1, xvwj1 lbla WHERE xvwv1.i = lbla.i; -/*c1*/SELECT xvwj1.vc FROM xvwv1 lblb, xvwj1 WHERE lblb.i = xvwj1.i; -/*c1*/SELECT lbla.vc FROM xvwv1 lblb, xvwj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM blaine.xvwv1, xvwj1 lbla WHERE xvwv1.i = lbla.i; -/*c1*/SELECT xvwj1.vc FROM blaine.xvwv1 lblb, xvwj1 WHERE lblb.i = xvwj1.i; -/*c1*/SELECT lbla.vc FROM blaine.xvwv1 lblb, xvwj1 lbla WHERE lblb.i = lbla.i; -/*c1*/SELECT lbla.vc FROM xvwv1, blaine.xvwj1 lbla WHERE xvwv1.i = lbla.i; -/*c1*/SELECT xvwj1.vc FROM xvwv1 lblb, blaine.xvwj1 WHERE lblb.i = xvwj1.i; -/*c1*/SELECT lbla.vc FROM xvwv1 lblb, blaine.xvwj1 lbla WHERE lblb.i = lbla.i; -/*u0*/GRANT ALL ON xvwv1 TO otheruser; -SET SCHEMA public; -/*u0*/GRANT ALL ON blaine.xvwv2 TO otheruser; -SET SCHEMA blaine; -/*e*/GRANT ALL ON other.xvwv3 TO otheruser; -/*e*/GRANT ALL ON information_schema.xvwv3 TO otheruser; -/*u0*/REVOKE ALL ON xvwv1 FROM otheruser RESTRICT; -SET SCHEMA public; -/*u0*/REVOKE ALL ON blaine.xvwv2 FROM otheruser RESTRICT; -SET SCHEMA blaine; -/*e*/REVOKE ALL ON other.xvwv3 FROM otheruser RESTRICT; -/*e*/REVOKE ALL ON information_schema.xvwv3 FROM otheruser RESTRICT; - --- ****************************** Indexes -/*c2*/SELECT * from xindt1; -SET SCHEMA public; -/*c2*/SELECT * from blaine.xindt2; -/*c2*/SELECT * from blaine.xindt3; -SET SCHEMA blaine; -/*c2*/SELECT * from xindt4; - --- ****************************** CACH Indexes -/*c2*/SELECT * from xcindt1; -SET SCHEMA public; -/*c2*/SELECT * from blaine.xcindt2; -/*c2*/SELECT * from blaine.xcindt3; -SET SCHEMA blaine; -/*c2*/SELECT * from xcindt4; - --- ****************************** Sequences --- N.b.: Do not commit DML changes so that this whole block may be repeated. -/*r0*/SELECT next value FOR xs1 FROM xseqt1; -SET SCHEMA public; --- Sequence dflt schema should come from Session (set schema), not table. -/*e*/SELECT next value FOR xs2 FROM blaine.xseqt1; -/*e*/SELECT next value FOR blaine.xs1 FROM xseqt1; -/*r2*/SELECT next value FOR blaine.xs2 FROM blaine.xseqt1; -SET SCHEMA blaine; --- Just to reset orig. value before persisting (can't roll back seq.s). -ALTER SEQUENCE xs1 RESTART WITH 0; -ALTER SEQUENCE xs2 RESTART WITH 2; -/*e*/DROP SEQUENCE xs101; -/*e*/DROP SEQUENCE blaine.xs101; -/*e*/DROP SEQUENCE information_schema.xs1; -/*e*/DROP SEQUENCE other.xs1; - --- ****************************** Triggers -/*e*/CREATE TRIGGER xtrgtrig1 - AFTER INSERT ON xtrgt1 CALL 'org.hsqldb.test.BlaineTrig'; -- Create existing -/*e*/CREATE TRIGGER blaine.xtrgtrig2 - AFTER INSERT ON xtrgt2 CALL 'org.hsqldb.test.BlaineTrig'; -- Create existing -SET SCHEMA public; -/*e*/CREATE TRIGGER blaine.xtrgtrig2 - AFTER INSERT ON blaine.xtrgt2 CALL 'org.hsqldb.test.BlaineTrig'; -- Create existing -SET SCHEMA blaine; - --- ****************************** Constraints --- N.b.: Do not commit DML changes so that this whole block may be repeated. -COMMIT; -SET AUTOCOMMIT false; -/*u1*/INSERT INTO xcont1 VALUES (0); -SET SCHEMA public; -/*u1*/INSERT INTO blaine.xcont2 VALUES (0); -SET SCHEMA blaine; -/*u1*/INSERT INTO xcont3 VALUES (0); -/*u1*/INSERT INTO xcont4 VALUES (0); -/*u1*/INSERT INTO xcont5 VALUES (0); -/*u1*/INSERT INTO xcont6 VALUES (0); -/*u1*/INSERT INTO xcont7 VALUES (0); -/*u1*/INSERT INTO xcont8 VALUES (0); --- Note that error message implies that problem is due to table xconj1, not data: -/*u1*/INSERT INTO xcont9 VALUES (1); -/*u1*/INSERT INTO xcont10 VALUES (1); -/*u1*/INSERT INTO xcont11 VALUES (1); -/*u1*/INSERT INTO xcont12 VALUES (1); -/*e*/INSERT INTO xcont13 VALUES (1); -/*u1*/INSERT INTO xcont14 VALUES (1); -/*u1*/INSERT INTO xcont15 VALUES (1); -/*u1*/INSERT INTO xcont16 VALUES (1); -/*u1*/INSERT INTO xcont17 VALUES (0); -/*u1*/INSERT INTO xcont18 VALUES (0); -/*u1*/INSERT INTO xcont19 VALUES (0); -/*u1*/INSERT INTO xcont20 VALUES (0); -/*e*/INSERT INTO xcont1 VALUES (0); -/*e*/INSERT INTO xcont2 VALUES (0); -/*e*/INSERT INTO xcont3 VALUES (0); -/*e*/INSERT INTO xcont4 VALUES (0); -/*e*/INSERT INTO xcont5 VALUES (0); -/*e*/INSERT INTO xcont6 VALUES (0); -/*e*/INSERT INTO xcont7 VALUES (0); -/*e*/INSERT INTO xcont8 VALUES (0); -/*e*/INSERT INTO xcont9 VALUES (0); -/*e*/INSERT INTO xcont10 VALUES (0); -/*e*/INSERT INTO xcont11 VALUES (0); -/*e*/INSERT INTO xcont12 VALUES (0); -/*e*/INSERT INTO xcont13 VALUES (0); -/*e*/INSERT INTO xcont14 VALUES (0); -/*e*/INSERT INTO xcont15 VALUES (0); -/*e*/INSERT INTO xcont16 VALUES (0); -/*e*/INSERT INTO xcont17 VALUES (1); -/*e*/INSERT INTO xcont18 VALUES (1); -/*e*/INSERT INTO xcont19 VALUES (1); -/*e*/INSERT INTO xcont20 VALUES (1); -/*c1*/SELECT * FROM xcont1; -/*c1*/SELECT * FROM xcont2; -/*c1*/SELECT * FROM xcont3; -/*c1*/SELECT * FROM xcont4; -/*c1*/SELECT * FROM xcont5; -/*c1*/SELECT * FROM xcont6; -/*c1*/SELECT * FROM xcont7; -/*c1*/SELECT * FROM xcont8; -/*c1*/SELECT * FROM xcont9; -/*c1*/SELECT * FROM xcont10; -/*c1*/SELECT * FROM xcont11; -/*c1*/SELECT * FROM xcont12; -/*c0*/SELECT * FROM xcont13; -/*c1*/SELECT * FROM xcont14; -/*c1*/SELECT * FROM xcont15; -/*c1*/SELECT * FROM xcont16; -/*c1*/SELECT * FROM xcont17; -/*c1*/SELECT * FROM xcont18; -/*c1*/SELECT * FROM xcont19; -/*c1*/SELECT * FROM xcont20; -ROLLBACK; - --- ****************************** ALTERs --- Add tests when time permits. - -DROP USER otheruser; - - --- This to test .script persistence. -SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistC1.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistC1.txt deleted file mode 100644 index 91ec8849..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistC1.txt +++ /dev/null @@ -1,612 +0,0 @@ --- This script series tests ALT commands on schema objects, including --- persistence. ALTER USER involves no schemas. --- Commands tested: ALTER INDEX, ALTER SEQUENCE, ALTER TABLE - --- The blaine schema will exist if a previous script created it already. -/*s*/DROP SCHEMA blaine CASCADE; -/*u0*/CREATE SCHEMA blaine authorization dba; - --- PREP --- Create a zillion simple objects to play with -/*u0*/SET SCHEMA public; -DROP TABLE public.mt00 IF EXISTS; -DROP TABLE public.mt01 IF EXISTS; -DROP TABLE public.mt02 IF EXISTS; -DROP TABLE public.mt03 IF EXISTS; -DROP TABLE mt04 IF EXISTS; -DROP TABLE mt05 IF EXISTS; -DROP TABLE mt06 IF EXISTS; -DROP TABLE mt07 IF EXISTS; -DROP TABLE public.mt08 IF EXISTS; -DROP TABLE public.mt09 IF EXISTS; -DROP TABLE public.mt10 IF EXISTS; -DROP TABLE public.mt11 IF EXISTS; -DROP TABLE public.mt12 IF EXISTS; -DROP TABLE public.mt13 IF EXISTS; -DROP TABLE mt14 IF EXISTS; -DROP TABLE mt15 IF EXISTS; -DROP TABLE mt16 IF EXISTS; -DROP TABLE mt17 IF EXISTS; -DROP TABLE public.mt18 IF EXISTS; -DROP TABLE public.mt19 IF EXISTS; -DROP TABLE public.mt20 IF EXISTS; -DROP TABLE public.mt21 IF EXISTS; -DROP TABLE public.mt22 IF EXISTS; -DROP TABLE public.mt23 IF EXISTS; -DROP TABLE public.mt24 IF EXISTS; -DROP TABLE public.mt25 IF EXISTS; -DROP TABLE public.mt26 IF EXISTS; -DROP TABLE public.mt27 IF EXISTS; -DROP TABLE public.mt28 IF EXISTS; -DROP TABLE public.mt29 IF EXISTS; -DROP TABLE ct00 IF EXISTS; -DROP TABLE ct01 IF EXISTS; -DROP TABLE ct02 IF EXISTS; -DROP TABLE ct03 IF EXISTS; -DROP TABLE ct04 IF EXISTS; -DROP TABLE ct05 IF EXISTS; -DROP TABLE ct06 IF EXISTS; -DROP TABLE ct07 IF EXISTS; -DROP TABLE ct08 IF EXISTS; -DROP TABLE ct09 IF EXISTS; -DROP TABLE ct10 IF EXISTS; -DROP TABLE ct11 IF EXISTS; -DROP TABLE ct12 IF EXISTS; -DROP TABLE ct13 IF EXISTS; -DROP TABLE ct14 IF EXISTS; -DROP TABLE ct15 IF EXISTS; -DROP TABLE ct16 IF EXISTS; -DROP TABLE ct17 IF EXISTS; -DROP TABLE ct18 IF EXISTS; -DROP TABLE ct19 IF EXISTS; -DROP TABLE t101 IF EXISTS; -CREATE TABLE mt00 (i int); -CREATE TABLE mt01 (i int); -CREATE TABLE mt02 (i int); -/*u0*/SET SCHEMA blaine; -CREATE TABLE public.mt03 (i int); -CREATE TABLE public.mt04 (i int); -CREATE TABLE public.mt05 (i int); -CREATE TABLE public.mt06 (i int); -CREATE TABLE public.mt07 (i int); -/*u0*/SET SCHEMA public; -CREATE TABLE mt08 (i int); -CREATE TABLE mt09 (i int); -CREATE TABLE mt10 (i int); -CREATE TABLE mt11 (i int); -CREATE TABLE mt12 (i int); -/*u0*/SET SCHEMA blaine; -CREATE TABLE public.mt13 (i int); -CREATE TABLE public.mt14 (i int); -CREATE TABLE public.mt15 (i int); -CREATE TABLE public.mt16 (i int); -CREATE TABLE public.mt17 (i int); -/*u0*/SET SCHEMA public; -CREATE TABLE mt18 (i int); -CREATE TABLE mt19 (i int); -CREATE TABLE mt20 (i int); -CREATE TABLE mt21 (i int); -CREATE TABLE mt22 (i int); -CREATE TABLE mt23 (i int); -CREATE TABLE mt24 (i int); -CREATE TABLE mt25 (i int); -CREATE TABLE mt26 (i int); -CREATE TABLE mt27 (i int); -CREATE TABLE mt28 (i int); -CREATE TABLE mt29 (i int); -CREATE CACHED TABLE ct00 (i int); -CREATE CACHED TABLE ct01 (i int); -CREATE CACHED TABLE ct02 (i int); -/*u0*/SET SCHEMA blaine; -CREATE CACHED TABLE public.ct03 (i int); -CREATE CACHED TABLE public.ct04 (i int); -CREATE CACHED TABLE public.ct05 (i int); -CREATE CACHED TABLE public.ct06 (i int); -CREATE CACHED TABLE public.ct07 (i int); -/*u0*/SET SCHEMA public; -CREATE CACHED TABLE ct08 (i int); -CREATE CACHED TABLE ct09 (i int); -CREATE CACHED TABLE ct10 (i int); -CREATE CACHED TABLE ct11 (i int); -CREATE CACHED TABLE ct12 (i int); -/*u0*/SET SCHEMA blaine; -CREATE CACHED TABLE public.ct13 (i int); -CREATE CACHED TABLE public.ct14 (i int); -CREATE CACHED TABLE public.ct15 (i int); -CREATE CACHED TABLE public.ct16 (i int); -CREATE CACHED TABLE public.ct17 (i int); -/*u0*/SET SCHEMA public; -CREATE CACHED TABLE ct18 (i int); -CREATE CACHED TABLE ct19 (i int); -DROP INDEX mi00 IF EXISTS; -DROP INDEX mi01 IF EXISTS; -DROP INDEX mi02 IF EXISTS; -DROP INDEX mi03 IF EXISTS; -DROP INDEX mi04 IF EXISTS; -DROP INDEX mui05 IF EXISTS; -DROP INDEX mui06 IF EXISTS; -DROP INDEX mui07 IF EXISTS; -DROP INDEX mui08 IF EXISTS; -DROP INDEX mui09 IF EXISTS; -DROP INDEX ci00 IF EXISTS; -DROP INDEX ci01 IF EXISTS; -DROP INDEX ci02 IF EXISTS; -DROP INDEX ci03 IF EXISTS; -DROP INDEX ci04 IF EXISTS; -DROP INDEX cui05 IF EXISTS; -DROP INDEX cui06 IF EXISTS; -DROP INDEX cui07 IF EXISTS; -DROP INDEX cui08 IF EXISTS; -DROP INDEX cui09 IF EXISTS; -DROP INDEX i101 IF EXISTS; -CREATE INDEX mi00 ON mt00 (i); -CREATE INDEX mi01 ON mt01 (i); -CREATE INDEX mi02 ON mt02 (i); -CREATE INDEX mi03 ON mt03 (i); -CREATE INDEX mi04 ON mt04 (i); -/*u0*/SET SCHEMA blaine; -CREATE INDEX public.mui05 ON public.mt05 (i); -CREATE INDEX public.mui06 ON public.mt06 (i); -CREATE INDEX public.mui07 ON public.mt07 (i); -CREATE INDEX public.mui08 ON public.mt08 (i); -CREATE INDEX public.mui09 ON public.mt09 (i); -CREATE INDEX public.ci00 ON public.ct00 (i); -CREATE INDEX public.ci01 ON public.ct01 (i); -CREATE INDEX public.ci02 ON public.ct02 (i); -CREATE INDEX public.ci03 ON public.ct03 (i); -CREATE INDEX public.ci04 ON public.ct04 (i); -CREATE INDEX public.cui05 ON public.ct05 (i); -/*u0*/SET SCHEMA public; -CREATE INDEX cui06 ON ct06 (i); -CREATE INDEX cui07 ON ct07 (i); -CREATE INDEX cui08 ON ct08 (i); -CREATE INDEX cui09 ON ct09 (i); -CREATE SEQUENCE s00; -CREATE SEQUENCE s01; -CREATE SEQUENCE s02; -/*u0*/SET SCHEMA blaine; -CREATE SEQUENCE public.s03; -CREATE SEQUENCE public.s04; -CREATE SEQUENCE public.s05; -CREATE SEQUENCE public.s06; -CREATE SEQUENCE public.s07; -/*u0*/SET SCHEMA public; -CREATE SEQUENCE s08; -CREATE SEQUENCE s09; -CREATE SEQUENCE s10; -CREATE SEQUENCE s11; -/*u0*/SET SCHEMA blaine; -CREATE SEQUENCE public.s12; -CREATE SEQUENCE public.s13; -CREATE SEQUENCE public.s14; -CREATE SEQUENCE public.s15; -CREATE SEQUENCE public.s16; -/*u0*/SET SCHEMA public; -CREATE SEQUENCE s17; -CREATE SEQUENCE s18; -CREATE SEQUENCE s19; --- blaine schema -/*u0*/ SET SCHEMA blaine; -DROP TABLE bmt00 IF EXISTS; -DROP TABLE bmt01 IF EXISTS; -DROP TABLE bmt02 IF EXISTS; -DROP TABLE bmt03 IF EXISTS; -DROP TABLE bmt04 IF EXISTS; -DROP TABLE bmt05 IF EXISTS; -DROP TABLE bmt06 IF EXISTS; -DROP TABLE bmt07 IF EXISTS; -DROP TABLE bmt08 IF EXISTS; -DROP TABLE bmt09 IF EXISTS; -DROP TABLE bmt10 IF EXISTS; -DROP TABLE bmt11 IF EXISTS; -DROP TABLE bmt12 IF EXISTS; -DROP TABLE bmt13 IF EXISTS; -DROP TABLE bmt14 IF EXISTS; -DROP TABLE bmt15 IF EXISTS; -DROP TABLE bmt16 IF EXISTS; -DROP TABLE bmt17 IF EXISTS; -DROP TABLE bmt18 IF EXISTS; -DROP TABLE bmt19 IF EXISTS; -DROP TABLE bmt20 IF EXISTS; -DROP TABLE bmt21 IF EXISTS; -DROP TABLE bmt22 IF EXISTS; -DROP TABLE bmt23 IF EXISTS; -DROP TABLE bmt24 IF EXISTS; -DROP TABLE bmt25 IF EXISTS; -DROP TABLE bmt26 IF EXISTS; -DROP TABLE bmt27 IF EXISTS; -DROP TABLE bmt28 IF EXISTS; -DROP TABLE bmt29 IF EXISTS; -DROP TABLE bct00 IF EXISTS; -DROP TABLE bct01 IF EXISTS; -DROP TABLE bct02 IF EXISTS; -DROP TABLE bct03 IF EXISTS; -DROP TABLE bct04 IF EXISTS; -DROP TABLE bct05 IF EXISTS; -DROP TABLE bct06 IF EXISTS; -DROP TABLE bct07 IF EXISTS; -DROP TABLE bct08 IF EXISTS; -DROP TABLE bct09 IF EXISTS; -DROP TABLE bct10 IF EXISTS; -DROP TABLE bct11 IF EXISTS; -DROP TABLE bct12 IF EXISTS; -DROP TABLE bct13 IF EXISTS; -DROP TABLE bct14 IF EXISTS; -DROP TABLE bct15 IF EXISTS; -DROP TABLE bct16 IF EXISTS; -DROP TABLE bct17 IF EXISTS; -DROP TABLE bct18 IF EXISTS; -DROP TABLE bct19 IF EXISTS; -DROP TABLE bt101 IF EXISTS; -CREATE TABLE bmt00 (i int); -CREATE TABLE bmt01 (i int); -CREATE TABLE bmt02 (i int); -/*u0*/SET SCHEMA public; -CREATE TABLE blaine.bmt03 (i int); -CREATE TABLE blaine.bmt04 (i int); -CREATE TABLE blaine.bmt05 (i int); -CREATE TABLE blaine.bmt06 (i int); -CREATE TABLE blaine.bmt07 (i int); -/*u0*/SET SCHEMA blaine; -CREATE TABLE bmt08 (i int); -CREATE TABLE bmt09 (i int); -CREATE TABLE bmt10 (i int); -CREATE TABLE bmt11 (i int); -CREATE TABLE bmt12 (i int); -/*u0*/SET SCHEMA public; -CREATE TABLE blaine.bmt13 (i int); -CREATE TABLE blaine.bmt14 (i int); -CREATE TABLE blaine.bmt15 (i int); -CREATE TABLE blaine.bmt16 (i int); -CREATE TABLE blaine.bmt17 (i int); -/*u0*/SET SCHEMA blaine; -CREATE TABLE bmt18 (i int); -CREATE TABLE bmt19 (i int); -CREATE TABLE bmt20 (i int); -CREATE TABLE bmt21 (i int); -CREATE TABLE bmt22 (i int); -CREATE TABLE bmt23 (i int); -CREATE TABLE bmt24 (i int); -CREATE TABLE bmt25 (i int); -CREATE TABLE bmt26 (i int); -CREATE TABLE bmt27 (i int); -CREATE TABLE bmt28 (i int); -CREATE TABLE bmt29 (i int); -CREATE CACHED TABLE bct00 (i int); -CREATE CACHED TABLE bct01 (i int); -CREATE CACHED TABLE bct02 (i int); -/*u0*/SET SCHEMA public; -CREATE CACHED TABLE blaine.bct03 (i int); -CREATE CACHED TABLE blaine.bct04 (i int); -CREATE CACHED TABLE blaine.bct05 (i int); -CREATE CACHED TABLE blaine.bct06 (i int); -CREATE CACHED TABLE blaine.bct07 (i int); -/*u0*/SET SCHEMA blaine; -CREATE CACHED TABLE bct08 (i int); -CREATE CACHED TABLE bct09 (i int); -CREATE CACHED TABLE bct10 (i int); -CREATE CACHED TABLE bct11 (i int); -CREATE CACHED TABLE bct12 (i int); -/*u0*/SET SCHEMA public; -CREATE CACHED TABLE blaine.bct13 (i int); -CREATE CACHED TABLE blaine.bct14 (i int); -CREATE CACHED TABLE blaine.bct15 (i int); -CREATE CACHED TABLE blaine.bct16 (i int); -CREATE CACHED TABLE blaine.bct17 (i int); -/*u0*/SET SCHEMA blaine; -CREATE CACHED TABLE bct18 (i int); -CREATE CACHED TABLE bct19 (i int); -DROP INDEX bmi00 IF EXISTS; -DROP INDEX bmi01 IF EXISTS; -DROP INDEX bmi02 IF EXISTS; -DROP INDEX bmi03 IF EXISTS; -DROP INDEX bmi04 IF EXISTS; -DROP INDEX bmui05 IF EXISTS; -DROP INDEX bmui06 IF EXISTS; -DROP INDEX bmui07 IF EXISTS; -DROP INDEX bmui08 IF EXISTS; -DROP INDEX bmui09 IF EXISTS; -DROP INDEX bci00 IF EXISTS; -DROP INDEX bci01 IF EXISTS; -DROP INDEX bci02 IF EXISTS; -DROP INDEX bci03 IF EXISTS; -DROP INDEX bci04 IF EXISTS; -DROP INDEX bcui05 IF EXISTS; -DROP INDEX bcui06 IF EXISTS; -DROP INDEX bcui07 IF EXISTS; -DROP INDEX bcui08 IF EXISTS; -DROP INDEX bcui09 IF EXISTS; -DROP INDEX bi101 IF EXISTS; -CREATE INDEX bmi00 ON bmt00 (i); -CREATE INDEX bmi01 ON bmt01 (i); -CREATE INDEX bmi02 ON bmt02 (i); -CREATE INDEX bmi03 ON bmt03 (i); -CREATE INDEX bmi04 ON bmt04 (i); -/*u0*/SET SCHEMA public; -CREATE INDEX blaine.bmui05 ON blaine.bmt05 (i); -CREATE INDEX blaine.bmui06 ON blaine.bmt06 (i); -CREATE INDEX blaine.bmui07 ON blaine.bmt07 (i); -CREATE INDEX blaine.bmui08 ON blaine.bmt08 (i); -CREATE INDEX blaine.bmui09 ON blaine.bmt09 (i); -/*u0*/SET SCHEMA blaine; -CREATE INDEX bci00 ON bct00 (i); -CREATE INDEX bci01 ON bct01 (i); -CREATE INDEX bci02 ON bct02 (i); -CREATE INDEX bci03 ON bct03 (i); -CREATE INDEX bci04 ON bct04 (i); -/*u0*/SET SCHEMA public; -CREATE INDEX blaine.bcui05 ON blaine.bct05 (i); -CREATE INDEX blaine.bcui06 ON blaine.bct06 (i); -CREATE INDEX blaine.bcui07 ON blaine.bct07 (i); -CREATE INDEX blaine.bcui08 ON blaine.bct08 (i); -CREATE INDEX blaine.bcui09 ON blaine.bct09 (i); -CREATE SEQUENCE blaine.bs00; -CREATE SEQUENCE blaine.bs01; -CREATE SEQUENCE blaine.bs02; -CREATE SEQUENCE blaine.bs03; -/*u0*/SET SCHEMA blaine; -CREATE SEQUENCE bs04; -CREATE SEQUENCE bs05; -CREATE SEQUENCE bs06; -CREATE SEQUENCE bs07; -CREATE SEQUENCE bs08; -/*u0*/SET SCHEMA public; -CREATE SEQUENCE blaine.bs09; -CREATE SEQUENCE blaine.bs10; -CREATE SEQUENCE blaine.bs11; -CREATE SEQUENCE blaine.bs12; -/*u0*/SET SCHEMA blaine; -CREATE SEQUENCE bs13; -CREATE SEQUENCE bs14; -CREATE SEQUENCE bs15; -CREATE SEQUENCE bs16; -CREATE SEQUENCE bs17; -/*u0*/SET SCHEMA public; -CREATE SEQUENCE blaine.bs18; -CREATE SEQUENCE blaine.bs19; - --- These are the only tests for SEQUENCEs in this script. SEQUENCES --- The only ALTER command for sequences is here. -INSERT INTO public.mt01 VALUES(0); -INSERT INTO blaine.bmt01 VALUES(0); -/*u0*/SET SCHEMA blaine; -/*r0*/SELECT next value FOR public.s00 FROM public.mt01; -/*r1*/SELECT next value FOR public.s00 FROM public.mt01; -/*r0*/SELECT next value FOR public.s04 FROM blaine.bmt01; -/*r1*/SELECT next value FOR public.s04 FROM blaine.bmt01; -/*u0*/SET SCHEMA public; -/*r0*/SELECT next value FOR public.s01 FROM mt01; -/*r1*/SELECT next value FOR public.s01 FROM mt01; -/*r0*/SELECT next value FOR s02 FROM public.mt01; -/*r1*/SELECT next value FOR s02 FROM public.mt01; -/*r0*/SELECT next value FOR s03 FROM mt01; -/*r1*/SELECT next value FOR s03 FROM mt01; -/*r0*/SELECT next value FOR blaine.bs00 FROM blaine.bmt01; --- Sequence inherits default schema from Session, not table. -/*e*/SELECT next value FOR bs00 FROM blaine.bmt01; -/*r0*/SELECT next value FOR blaine.bs04 FROM public.mt01; -/*r1*/SELECT next value FOR blaine.bs04 FROM public.mt01; -/*u0*/SET SCHEMA blaine; -/*r0*/SELECT next value FOR blaine.bs01 FROM bmt01; -/*r1*/SELECT next value FOR blaine.bs01 FROM bmt01; -/*r0*/SELECT next value FOR bs02 FROM blaine.bmt01; -/*r1*/SELECT next value FOR bs02 FROM blaine.bmt01; -/*r0*/SELECT next value FOR bs03 FROM bmt01; -/*r1*/SELECT next value FOR bs03 FROM bmt01; -/*u0*/ALTER SEQUENCE public.s00 RESTART WITH 21; -/*u0*/ALTER SEQUENCE bs00 RESTART WITH 22; -/*u0*/SET SCHEMA public; -/*u0*/ALTER SEQUENCE blaine.bs01 RESTART WITH 23; -/*u0*/ALTER SEQUENCE s01 RESTART WITH 24; -/*r21*/SELECT next value FOR public.s00 FROM public.mt01; -/*r22*/SELECT next value FOR blaine.bs00 FROM public.mt01; -/*r23*/SELECT next value FOR blaine.bs01 FROM public.mt01; -/*r24*/SELECT next value FOR s01 FROM public.mt01; - --- May only rename: Indexes, Tables, Columns RENAMES --- (Will only test Column renames if I have time) --- Can't change schemas for existing objects. --- 1st all permutations of PUBLICs -> blaines -/*e*/SELECT * FROM blaine.rbmt00; -/*e*/SELECT * FROM blaine.rbct00; -/*e*/SELECT * FROM public.rmt00; -/*e*/SELECT * FROM public.cmt00; -/*u0*/SET SCHEMA public; -/*e*/ALTER INDEX mi00 RENAME TO blaine.bi101; -/*e*/ALTER INDEX mui05 RENAME TO blaine.bi101; -/*e*/ALTER TABLE mt10 RENAME TO blaine.bt101; -/*e*/ALTER TABLE ct10 RENAME TO blaine.bt101; -/*e*/ALTER INDEX public.mi00 RENAME TO blaine.bi101; -/*e*/ALTER INDEX public.mui05 RENAME TO blaine.bi101; -/*e*/ALTER TABLE public.mt10 RENAME TO blaine.bt101; -/*e*/ALTER TABLE public.ct10 RENAME TO blaine.bt101; -/*e*/ALTER INDEX blaine.mi00 RENAME TO public.bi101; -/*e*/ALTER INDEX blaine.mui05 RENAME TO public.bi101; -/*u0*/SET SCHEMA blaine; -/*e*/ALTER TABLE mt10 RENAME TO public.bt101; -/*e*/ALTER TABLE ct10 RENAME TO public.bt101; -/*u0*/SET SCHEMA public; -/*u0*/ALTER TABLE blaine.bmt00 RENAME TO rbmt00; -/*u0*/ALTER TABLE blaine.bct00 RENAME TO blaine.rbct00; -/*u0*/ALTER INDEX blaine.bmi00 RENAME TO rbmi00; -/*u0*/SET SCHEMA blaine; -/*u0*/ALTER INDEX bci00 RENAME TO rbci00; -/*u0*/ALTER INDEX public.mi00 RENAME TO public.rmi00; -/*u0*/ALTER INDEX public.ci00 RENAME TO rci00; -/*u0*/SET SCHEMA public; -/*u0*/ALTER TABLE public.mt00 RENAME TO public.rmt00; -/*u0*/ALTER TABLE ct00 RENAME TO rct00; -/*u0*/SET SCHEMA public; -/*u0*/ALTER INDEX blaine.bmui05 RENAME TO rbmui05; -/*u0*/SET SCHEMA blaine; -/*u0*/ALTER INDEX bcui05 RENAME TO rbcui05; -/*u0*/ALTER INDEX public.mui05 RENAME TO public.rmui05; -/*u0*/ALTER INDEX public.cui05 RENAME TO rcui05; -/*u0*/SET SCHEMA public; -/*e*/ALTER INDEX public.mui05 RENAME TO blaine.bi101; -/*e*/ALTER TABLE public.mt10 RENAME TO blaine.bt101; -/*e*/ALTER TABLE public.ct10 RENAME TO blaine.bt101; -/*e*/ALTER INDEX public.mi00 RENAME TO blaine.bi101; -/*e*/ALTER INDEX public.mui05 RENAME TO blaine.bi101; -/*e*/ALTER TABLE public.mt10 RENAME TO blaine.bt101; -/*e*/ALTER TABLE public.ct10 RENAME TO blaine.bt101; -/*c0*/SELECT * FROM blaine.rbmt00; -/*c0*/SELECT * FROM blaine.rbct00; -/*c0*/SELECT * FROM public.rmt00; -/*c0*/SELECT * FROM public.rct00; - --- The only schema-specific ALTERs left are ALTER TABLE ADD/DROP CONS --- ADD NAMED Check/Unique CONSTRAINTS --- First, CHECK constraints on MEM tables -/*e*/ALTER TABLE public.mt11 ADD CONSTRAINT blaine.mt11ck1 CHECK (i > 0); -/*e*/ALTER TABLE blaine.bmt11 ADD CONSTRAINT public.bmt11ck1 CHECK (i > 0); -/*e*/ALTER TABLE mt11 ADD CONSTRAINT blaine.mt11ck1 CHECK (i > 0); -/*u0*/ALTER TABLE mt11 ADD CONSTRAINT mt11ck1 CHECK (i > 0); -/*u0*/ALTER TABLE mt12 ADD CONSTRAINT public.mt12ck1 CHECK (i = 1); -SET SCHEMA blaine; -/*u0*/ALTER TABLE public.mt13 ADD CONSTRAINT mt13ck1 CHECK (i in (1, 2, 3)); -/*u0*/ALTER TABLE public.mt14 ADD CONSTRAINT public.mt14ck1 CHECK (i != 0); -/*e*/ALTER TABLE blaine.bmt11 ADD CONSTRAINT public.bmt11ck1 CHECK (i > 0); -/*e*/ALTER TABLE public.mt11 ADD CONSTRAINT blaine.mt11ck1 CHECK (i > 0); -/*e*/ALTER TABLE bmt11 ADD CONSTRAINT public.bmt11ck1 CHECK (i > 0); -/*u0*/ALTER TABLE bmt11 ADD CONSTRAINT bmt11ck1 CHECK (i > 0); -/*u0*/ALTER TABLE bmt12 ADD CONSTRAINT blaine.bmt12ck1 CHECK (i = 1); -SET SCHEMA public; -/*u0*/ALTER TABLE blaine.bmt13 ADD CONSTRAINT bmt13ck1 CHECK (i in (1, 2, 3)); -/*u0*/ALTER TABLE blaine.bmt14 ADD CONSTRAINT blaine.bmt14ck1 CHECK (i != 0); -/*e*/INSERT INTO public.mt11 values(0); -/*e*/INSERT INTO public.mt12 values(0); -/*e*/INSERT INTO public.mt13 values(0); -/*e*/INSERT INTO public.mt14 values(0); -/*e*/INSERT INTO blaine.bmt11 values(0); -/*e*/INSERT INTO blaine.bmt12 values(0); -/*e*/INSERT INTO blaine.bmt13 values(0); -/*e*/INSERT INTO blaine.bmt14 values(0); -/*u1*/INSERT INTO public.mt11 values(1); -/*u1*/INSERT INTO public.mt12 values(1); -/*u1*/INSERT INTO public.mt13 values(1); -/*u1*/INSERT INTO public.mt14 values(1); -/*u1*/INSERT INTO blaine.bmt11 values(1); -/*u1*/INSERT INTO blaine.bmt12 values(1); -/*u1*/INSERT INTO blaine.bmt13 values(1); -/*u1*/INSERT INTO blaine.bmt14 values(1); --- Now, UNIQUE constraints on CACHED tables -/*e*/ALTER TABLE public.ct11 ADD CONSTRAINT blaine.ct11ck1 UNIQUE (i); -/*e*/ALTER TABLE blaine.bct11 ADD CONSTRAINT public.bct11ck1 UNIQUE (i); -/*e*/ALTER TABLE ct11 ADD CONSTRAINT blaine.ct11ck1 UNIQUE (i); -/*u0*/ALTER TABLE ct11 ADD CONSTRAINT ct11ck1 UNIQUE (i); -/*u0*/ALTER TABLE ct12 ADD CONSTRAINT public.ct12ck1 UNIQUE (i); -SET SCHEMA blaine; -/*u0*/ALTER TABLE public.ct13 ADD CONSTRAINT ct13ck1 UNIQUE (i); -/*u0*/ALTER TABLE public.ct14 ADD CONSTRAINT public.ct14ck1 UNIQUE (i); -/*e*/ALTER TABLE blaine.bct11 ADD CONSTRAINT public.bct11ck1 UNIQUE (i); -/*e*/ALTER TABLE public.ct11 ADD CONSTRAINT blaine.ct11ck1 UNIQUE (i); -/*e*/ALTER TABLE bct11 ADD CONSTRAINT public.bct11ck1 UNIQUE (i); -/*u0*/ALTER TABLE bct11 ADD CONSTRAINT bct11ck1 UNIQUE (i); -/*u0*/ALTER TABLE bct12 ADD CONSTRAINT blaine.bct12ck1 UNIQUE (i); -SET SCHEMA public; -/*u0*/ALTER TABLE blaine.bct13 ADD CONSTRAINT bct13ck1 UNIQUE (i); -/*u0*/ALTER TABLE blaine.bct14 ADD CONSTRAINT blaine.bct14ck1 UNIQUE (i); -/*u1*/INSERT INTO public.ct11 values(1); -/*u1*/INSERT INTO public.ct12 values(1); -/*u1*/INSERT INTO public.ct13 values(1); -/*u1*/INSERT INTO public.ct14 values(1); -/*u1*/INSERT INTO blaine.bct11 values(1); -/*u1*/INSERT INTO blaine.bct12 values(1); -/*u1*/INSERT INTO blaine.bct13 values(1); -/*u1*/INSERT INTO blaine.bct14 values(1); -/*e*/INSERT INTO public.ct11 values(1); -/*e*/INSERT INTO public.ct12 values(1); -/*e*/INSERT INTO public.ct13 values(1); -/*e*/INSERT INTO public.ct14 values(1); -/*e*/INSERT INTO blaine.bct11 values(1); -/*e*/INSERT INTO blaine.bct12 values(1); -/*e*/INSERT INTO blaine.bct13 values(1); -/*e*/INSERT INTO blaine.bct14 values(1); --- ADD UNNAMED FK CONSTRAINTS --- Index some MEM tables to reference. (table ct1[1-4],bct1[1-4] already set). -ALTER TABLE public.mt15 ADD unique(i); -ALTER TABLE public.mt16 ADD unique(i); -ALTER TABLE public.mt17 ADD unique(i); -ALTER TABLE public.mt18 ADD unique(i); -ALTER TABLE blaine.bmt15 ADD unique(i); -ALTER TABLE blaine.bmt16 ADD unique(i); -ALTER TABLE blaine.bmt17 ADD unique(i); -ALTER TABLE blaine.bmt18 ADD unique(i); -INSERT INTO public.mt15 VALUES(10); -INSERT INTO public.mt16 VALUES(10); -INSERT INTO public.mt17 VALUES(10); -INSERT INTO public.mt18 VALUES(10); -INSERT INTO blaine.bmt15 VALUES(10); -INSERT INTO blaine.bmt16 VALUES(10); -INSERT INTO blaine.bmt17 VALUES(10); -INSERT INTO blaine.bmt18 VALUES(10); -/*u0*/ALTER TABLE ct15 ADD FOREIGN KEY (i) REFERENCES mt15 (i); -/*u0*/ALTER TABLE ct16 ADD FOREIGN KEY (i) REFERENCES blaine.bct11 (i); -/*e*/ALTER TABLE public.ct16 ADD FOREIGN KEY (i) REFERENCES blaine.bct11 (i); -/*u0*/ALTER TABLE ct16 ADD FOREIGN KEY (i) REFERENCES public.mt16 (i); -SET SCHEMA blaine; -/*u0*/ALTER TABLE public.ct17 ADD FOREIGN KEY (i) REFERENCES public.mt17 (i); -/*e*/ALTER TABLE public.ct17 ADD FOREIGN KEY (i) REFERENCES public.mt17 (i); -/*u0*/ALTER TABLE public.ct18 ADD FOREIGN KEY (i) REFERENCES mt18 (i); --- fks can't reference tables in other schemas. -/*u0*/ALTER TABLE bct15 ADD FOREIGN KEY (i) REFERENCES public.mt15 (i); -SET SCHEMA public; -/*u0*/ALTER TABLE blaine.bct17 ADD FOREIGN KEY (i) REFERENCES blaine.bmt17 (i); -/*u0*/ALTER TABLE blaine.bct18 ADD FOREIGN KEY (i) REFERENCES bmt18 (i); -/*u1*/INSERT INTO public.ct15 values(10); -/*e*/INSERT INTO public.ct16 values(10); -/*u1*/INSERT INTO public.ct17 values(10); -/*u1*/INSERT INTO blaine.bct18 values(10); -/*u1*/INSERT INTO blaine.bct17 values(10); -/*e*/INSERT INTO public.ct15 values(9); -/*e*/INSERT INTO public.ct16 values(9); -/*e*/INSERT INTO public.ct17 values(9); -/*e*/INSERT INTO public.bct18 values(9); -/*e*/INSERT INTO blaine.bct17 values(9); --- Finally, ADD NAMED FK CONSTRAINTS --- (TARGETS ct1[1-4],bct1[1-4] already set). -SET SCHEMA blaine; -/*e*/ALTER TABLE bmt21 ADD CONSTRAINT public.bmt21fk - FOREIGN KEY (i) REFERENCES blaine.bct11 (i); -/*e*/ALTER TABLE bmt20 ADD CONSTRAINT public.bmt20fk - FOREIGN KEY (i) REFERENCES bct12 (i); -/*u0*/ALTER TABLE bmt21 ADD CONSTRAINT bmt21fk - FOREIGN KEY (i) REFERENCES blaine.bct11 (i); -/*e*/ALTER TABLE bmt21 ADD CONSTRAINT bmt21fk - FOREIGN KEY (i) REFERENCES blaine.bct11 (i); -- Already exists -/*u0*/ALTER TABLE bmt20 ADD CONSTRAINT blaine.cmt20fk - FOREIGN KEY (i) REFERENCES bct12 (i); -/*e*/ALTER TABLE bmt20 ADD CONSTRAINT blaine.cmt20fk - FOREIGN KEY (i) REFERENCES bct12 (i); -- Already exists -SET SCHEMA public; -/*e*/ALTER TABLE blaine.bmt22 ADD CONSTRAINT public.bmt22fk - FOREIGN KEY (i) REFERENCES blaine.bct13 (i); -/*e*/ALTER TABLE blaine.bmt23 ADD CONSTRAINT public.bmt23fk - FOREIGN KEY (i) REFERENCES bct14 (i); -/*u0*/ALTER TABLE blaine.bmt22 ADD CONSTRAINT bmt2fk - FOREIGN KEY (i) REFERENCES blaine.bct13 (i); -/*u0*/ALTER TABLE blaine.bmt23 ADD CONSTRAINT blaine.bmt23fk - FOREIGN KEY (i) REFERENCES bct14 (i); -SET SCHEMA blaine; -/*e*/ALTER TABLE bmt24 ADD CONSTRAINT public.bmt24fk - FOREIGN KEY (i) REFERENCES public.ct11 (i); -/*u0*/ALTER TABLE bmt24 ADD CONSTRAINT blaine.bmt24fk - FOREIGN KEY (i) REFERENCES public.ct11 (i); -SET SCHEMA public; -/*e*/ALTER TABLE blaine.bmt22 ADD CONSTRAINT public.bmt22fk - FOREIGN KEY (i) REFERENCES blaine.bct13 (i); -/*u0*/ALTER TABLE blaine.bmt25 ADD CONSTRAINT bmt25fk - FOREIGN KEY (i) REFERENCES bct14 (i); -/*e*/INSERT INTO blaine.bmt21 VALUES (0); -/*u1*/INSERT INTO blaine.bmt21 VALUES (1); -/*e*/INSERT INTO blaine.bmt20 VALUES (0); -/*u1*/INSERT INTO blaine.bmt20 VALUES (1); -/*e*/INSERT INTO blaine.bmt22 VALUES (0); -/*u1*/INSERT INTO blaine.bmt22 VALUES (1); -/*e*/INSERT INTO blaine.bmt23 VALUES (0); -/*u1*/INSERT INTO blaine.bmt23 VALUES (1); -/*e*/INSERT INTO blaine.bmt25 VALUES (0); -/*u1*/INSERT INTO blaine.bmt25 VALUES (1); - -SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistC2.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistC2.txt deleted file mode 100644 index 724bf7f2..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaPersistC2.txt +++ /dev/null @@ -1,127 +0,0 @@ --- Test ALTER commands on objects set up by other script - --- SEQUENCES -/*r22*/SELECT next value FOR public.s00 FROM public.mt01; -/*r23*/SELECT next value FOR blaine.bs00 FROM public.mt01; -/*r24*/SELECT next value FOR blaine.bs01 FROM public.mt01; -/*r25*/SELECT next value FOR public.s01 FROM public.mt01; --- Resetting all sequence vals so next script can retest them. -/*u0*/ALTER SEQUENCE public.s00 RESTART WITH 22; -/*u0*/ALTER SEQUENCE blaine.bs00 RESTART WITH 23; -/*u0*/ALTER SEQUENCE blaine.bs01 RESTART WITH 24; -/*u0*/ALTER SEQUENCE public.s01 RESTART WITH 25; - - --- RENAMES -/*c0*/SELECT * FROM blaine.rbmt00; -/*c0*/SELECT * FROM blaine.rbct00; -/*c0*/SELECT * FROM public.rmt00; -/*c0*/SELECT * FROM public.rct00; -/*u0*/SET SCHEMA public; -/*u0*/ALTER TABLE blaine.rbmt00 RENAME TO bmt00; -/*u0*/ALTER TABLE blaine.bmt00 RENAME TO blaine.rbmt00 -/*u0*/ALTER TABLE blaine.rbct00 RENAME TO blaine.bct00 -/*u0*/ALTER TABLE rct00 RENAME TO ct00; -/*u0*/ALTER TABLE ct00 RENAME TO public.rct00; -/*u0*/SET SCHEMA blaine; -/*u0*/ALTER TABLE bct00 RENAME TO rbct00 -/*u0*/ALTER TABLE public.rmt00 RENAME TO public.mt00; -/*u0*/ALTER TABLE public.mt00 RENAME TO rmt00; -/*c0*/SELECT * FROM blaine.rbmt00; -/*c0*/SELECT * FROM blaine.rbct00; -/*c0*/SELECT * FROM public.rmt00; -/*c0*/SELECT * FROM public.rct00; - -/*u0*/SET SCHEMA public; -/*u0*/ALTER INDEX blaine.rbmi00 RENAME TO bmi00; -/*u0*/SET SCHEMA blaine; -/*u0*/ALTER INDEX rbci00 RENAME TO bci00; -/*u0*/ALTER INDEX public.rmi00 RENAME TO public.mi00; -/*u0*/ALTER INDEX public.rci00 RENAME TO ci00; -/*u0*/SET SCHEMA public; -/*u0*/ALTER INDEX blaine.bmi00 RENAME TO rbmi00; -/*u0*/SET SCHEMA blaine; -/*u0*/ALTER INDEX bci00 RENAME TO rbci00; -/*u0*/ALTER INDEX public.mi00 RENAME TO public.rmi00; -/*u0*/ALTER INDEX public.ci00 RENAME TO rci00; -/*u0*/SET SCHEMA public; -/*u0*/ALTER INDEX blaine.rbmui05 RENAME TO bmui05; -/*u0*/SET SCHEMA blaine; -/*u0*/ALTER INDEX rbcui05 RENAME TO bcui05; -/*u0*/ALTER INDEX public.rmui05 RENAME TO public.mui05; -/*u0*/ALTER INDEX public.rcui05 RENAME TO cui05; -/*u0*/SET SCHEMA public; -/*u0*/ALTER INDEX blaine.bmui05 RENAME TO rbmui05; -/*u0*/SET SCHEMA blaine; -/*u0*/ALTER INDEX bcui05 RENAME TO rbcui05; -/*u0*/ALTER INDEX public.mui05 RENAME TO public.rmui05; -/*u0*/ALTER INDEX public.cui05 RENAME TO rcui05; - - --- ALTER TABLE ADD/DROP CONS --- We'll roll all this work back so we can repeat it. --- Check constraints but no unique constraints, so cam commit duplicate vals. -/*e*/INSERT INTO public.mt11 values(0); -/*e*/INSERT INTO public.mt12 values(0); -/*e*/INSERT INTO public.mt13 values(0); -/*e*/INSERT INTO public.mt14 values(0); -/*e*/INSERT INTO blaine.bmt11 values(0); -/*e*/INSERT INTO blaine.bmt12 values(0); -/*e*/INSERT INTO blaine.bmt13 values(0); -/*e*/INSERT INTO blaine.bmt14 values(0); -/*u1*/INSERT INTO public.mt11 values(1); -/*u1*/INSERT INTO public.mt12 values(1); -/*u1*/INSERT INTO public.mt13 values(1); -/*u1*/INSERT INTO public.mt14 values(1); -/*u1*/INSERT INTO blaine.bmt11 values(1); -/*u1*/INSERT INTO blaine.bmt12 values(1); -/*u1*/INSERT INTO blaine.bmt13 values(1); -/*u1*/INSERT INTO blaine.bmt14 values(1); - -COMMIT; -SET AUTOCOMMIT FALSE; --- Test vs. some values entered in previous sessoin, and some that we'll add. -/*e*/INSERT INTO public.ct11 values(1); -/*e*/INSERT INTO public.ct12 values(1); -/*e*/INSERT INTO public.ct13 values(1); -/*e*/INSERT INTO public.ct14 values(1); -/*u1*/INSERT INTO public.ct11 values(2); -/*u1*/INSERT INTO public.ct12 values(2); -/*u1*/INSERT INTO public.ct13 values(2); -/*u1*/INSERT INTO public.ct14 values(2); -/*u1*/INSERT INTO blaine.bct11 values(2); -/*u1*/INSERT INTO blaine.bct12 values(2); -/*u1*/INSERT INTO blaine.bct13 values(2); -/*u1*/INSERT INTO blaine.bct14 values(2); -/*e*/INSERT INTO blaine.bct11 values(2); -/*e*/INSERT INTO blaine.bct12 values(2); -/*e*/INSERT INTO blaine.bct13 values(2); -/*e*/INSERT INTO blaine.bct14 values(2); -ROLLBACK; - --- Unique constraints on the PK tables, but not on our FK tables here, --- so cam commit duplicate vals. -/*u1*/INSERT INTO public.ct15 values(10); -/*e*/INSERT INTO public.ct16 values(10); -/*u1*/INSERT INTO public.ct17 values(10); -/*u1*/INSERT INTO blaine.bct18 values(10); -/*u1*/INSERT INTO blaine.bct17 values(10); -/*e*/INSERT INTO public.ct15 values(8); -/*e*/INSERT INTO public.ct16 values(8); -/*e*/INSERT INTO public.ct17 values(8); -/*e*/INSERT INTO public.ct18 values(8); -/*e*/INSERT INTO blaine.bct17 values(8); - -/*e*/INSERT INTO blaine.bmt21 VALUES (2); -/*u1*/INSERT INTO blaine.bmt21 VALUES (1); -/*e*/INSERT INTO blaine.bmt20 VALUES (2); -/*u1*/INSERT INTO blaine.bmt20 VALUES (1); -/*e*/INSERT INTO blaine.bmt22 VALUES (2); -/*u1*/INSERT INTO blaine.bmt22 VALUES (1); -/*e*/INSERT INTO blaine.bmt23 VALUES (2); -/*u1*/INSERT INTO blaine.bmt23 VALUES (1); -/*e*/INSERT INTO blaine.bmt25 VALUES (2); -/*u1*/INSERT INTO blaine.bmt25 VALUES (1); - - -SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSchemaQuoting.txt b/database/hsqldb/testrun/hsqldb/TestSelfSchemaQuoting.txt deleted file mode 100644 index f746d314..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSchemaQuoting.txt +++ /dev/null @@ -1,41 +0,0 @@ --- Tests quoted schema names - -/*u0*/SET SCHEMA information_schema; -/*u0*/CREATE SCHEMA sChEmA1 authorization sa; -/*c1*/select * from schemata - where schema_owner = 'SA' AND schema_name = 'SCHEMA1'; - -/*u0*/CREATE SCHEMA dEfAuLt1 authorization sa; -/*c1*/select * from schemata - where schema_name = 'DEFAULT1'; - -/*u0*/SET INITIAL SCHEMA "DEFAULT1"; -/*c1*/SELECT * FROM system_users - WHERE user_name = 'SA' AND initial_schema = 'DEFAULT1'; - -/*u0*/SET INITIAL SCHEMA DEFAULT; -/*c1*/SELECT * FROM system_users - WHERE user_name = 'SA' AND initial_schema IS NULL; - -/*u0*/CREATE SCHEMA "mIxEdCaSe" AUTHORIZATION sa; -/*c1*/select * from schemata where schema_name = 'mIxEdCaSe'; -/*u0*/CREATE TABLE "mIxEdCaSe".t1(i int); -/*e*/DROP TABLE mIxEdCaSe.t1; -/*u0*/DROP TABLE "mIxEdCaSe".t1; -/*e*/DROP SCHEMA mIxEdCaSe; -/*u0*/DROP SCHEMA "mIxEdCaSe"; - -/*u0*/CREATE USER u1 PASSWORD "u1"; -/*u0*/CREATE SCHEMA "oThErMiXeD" authorization u1; -/*u0*/CREATE TABLE "oThErMiXeD".t2(i int); -/*e*/DROP SCHEMA oThErMiXeD CASCADE; -/*u0*/DROP SCHEMA "oThErMiXeD" CASCADE; - -/*s*/DROP USER u1 CASCADE; -/*s*/DROP USER u1; -/*s*/DROP SCHEMA schema1 CASCADE; - -/*d*/ the following lines are workaround for old bug where DDL will not Commit -/*s*/CREATE TABLE bug_workaround (i int); -/*s*/INSERT INTO bug_workaround VALUES(1); -/*u0*/SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsA.txt b/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsA.txt deleted file mode 100644 index c4d0dc42..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsA.txt +++ /dev/null @@ -1,105 +0,0 @@ --- $Id: TestSelfSeqRightsA.txt 6419 2022-02-16 12:30:15Z fredt $ --- Test Grants/Revokes for Sequences (not ALTER/CREATE/DROP rights, as --- tested in the general schema object test scripts). --- We are not testing TABLE rights here. We know that if the table of the --- query is not accessible for any reason, the "next value" won't succeed, --- so the test setup just grants ALL on the tables used. --- Also not testing the numerical values of the sequences. --- We're just testing if a "next value for" returns a row successfully. --- (some other test file should test the values returned). - --- Remember that unlike 1-to-1-dependent objects like table indexes, --- schemas of indexes do not default to that of the table. --- (One reason being, in future we may permit a single query of a table in --- one schema and sequence(s) in other schema(s)). - --- Setup -SET WRITE_DELAY 0; -/*s*/DROP user blaine; -CREATE user blaine password "b"; -/*u0*/GRANT CHANGE_AUTHORIZATION TO blaine; -/*s*/DROP SCHEMA bsch CASCADE; --- Remove public schema objects. The CASCADE above takes care of the rest. -DROP TABLE pt IF EXISTS; -/*s*/DROP SEQUENCE bs1; -/*s*/DROP SEQUENCE bs2; -/*s*/DROP SEQUENCE bs3; -/*s*/DROP SEQUENCE bs4; -/*s*/DROP SEQUENCE bs5; - --- We create objects using default schemas and explicit schemas, just to --- exercise schema resolution. -CREATE SCHEMA bsch AUTHORIZATION blaine; -CREATE TABLE public.pt(i int); -CREATE TABLE bsch.bt(i int); -INSERT INTO pt VALUES(1); -INSERT INTO bsch.bt VALUES(1); - -SET SCHEMA bsch; -CREATE SEQUENCE public.ps1; -CREATE SEQUENCE public.ps3; -SET SCHEMA public; -CREATE SEQUENCE ps2; -CREATE SEQUENCE ps4; -CREATE SEQUENCE ps5; -CREATE SEQUENCE ps6; -CREATE SEQUENCE ps7; -CREATE SEQUENCE ps8; -CREATE SEQUENCE ps9; -CREATE SEQUENCE bsch.bs1; -CREATE SEQUENCE bsch.bs3; -SET SCHEMA bsch; -CREATE SEQUENCE bs2; -CREATE SEQUENCE bs4; -CREATE SEQUENCE bs5; -GRANT ALL ON public.pt TO blaine; -GRANT ALL ON bsch.bt TO blaine; - --- Set perms with various permutations of conditions --- bs* have enough permissions for blaine by virtue of schema ownerhip. --- ps1,2,5,6 have enough permissions by virtue of grants to pub or blaine. --- ps3,4,7,8 do not -/*u0*/GRANT ALL ON SEQUENCE public.ps1 TO public; -/*u0*/GRANT USAGE ON SEQUENCE public.ps2 TO public; -/*e*/GRANT SELECT ON SEQUENCE public.ps3 TO public; -/*e*/GRANT INSERT ON SEQUENCE public.ps4 TO public; -/*u0*/GRANT ALL ON SEQUENCE public.ps5 TO public; -/*u0*/GRANT USAGE ON SEQUENCE public.ps6 TO public; -/*e*/GRANT EXECUTE ON SEQUENCE public.ps7 TO public; -/*e*/GRANT UPDATE ON SEQUENCE public.ps8 TO public; -SET SCHEMA public; - -/*d*/following 2 lines are just workarounds for a DELAY 0 BUG: -UPDATE public.pt SET i = 1; -COMMIT; - -CONNECT USER blaine PASSWORD "b"; --- Following is default, but just to eliminate any ambiguity... -SET SCHEMA public; --- By virtue of PUBLIC grants -/*e*/SELECT i, next value for ps9 FROM pt; -/*e*/SELECT i, next value for public.ps9 FROM public.pt; -/*e*/SELECT i, next value for ps9 FROM public.pt; -/*c1*/SELECT i, next value for ps1 FROM pt; -SET SCHEMA bsch; -/*c1*/SELECT i, next value for public.ps2 FROM public.pt; - --- Don't own - previously threw error but now adds a warning -GRANT ALL ON SEQUENCE public.ps2 TO PUBLIC; -/*u0*/GRANT ALL ON SEQUENCE bsch.bs5 TO PUBLIC; --- By virtue of schema ownership -/*c1*/SELECT i, next value for bs2 FROM bt; -SET SCHEMA public; -/*c1*/SELECT i, next value for bsch.bs1 FROM bsch.bt; --- Enough schema specification testing. Just use defauls Session schema for --- here on in -/*c1*/SELECT i FROM pt; -/*e*/SELECT i, next value for ps3 FROM pt; -/*e*/SELECT i, next value for ps4 FROM pt; -/*c1*/SELECT i, next value for ps5 FROM pt; -/*c1*/SELECT i, next value for ps6 FROM pt; -/*e*/SELECT i, next value for ps7 FROM pt; -/*e*/SELECT i, next value for ps8 FROM pt; - -CONNECT USER sa PASSWORD ""; -SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsB.txt b/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsB.txt deleted file mode 100644 index 3e32e2a4..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsB.txt +++ /dev/null @@ -1,35 +0,0 @@ --- $Id: TestSelfSeqRightsB.txt 6419 2022-02-16 12:30:15Z fredt $ --- Test .log persistence of Sequence rights - -CONNECT USER blaine PASSWORD "b"; --- Following is default, but just to eliminate any ambiguity... -SET SCHEMA public; --- By virtue of PUBLIC grants -/*c1*/SELECT * FROM pt; -/*e*/SELECT i, next value for ps9 FROM pt; -/*e*/SELECT i, next value for public.ps9 FROM public.pt; -/*e*/SELECT i, next value for ps9 FROM public.pt; -/*c1*/SELECT i, next value for ps1 FROM pt; -SET SCHEMA bsch; -/*c1*/SELECT i, next value for public.ps2 FROM public.pt; - --- Don't own - previously threw error but now adds a warning -GRANT ALL ON SEQUENCE public.ps2 TO PUBLIC; -/*u0*/GRANT ALL ON SEQUENCE bsch.bs5 TO PUBLIC; --- By virtue of schema ownership -/*c1*/SELECT i, next value for bs2 FROM bt; -SET SCHEMA public; -/*c1*/SELECT i, next value for bsch.bs1 FROM bsch.bt; - --- Enough schema specification testing. Just use defauls Session schema for --- here on in -/*c1*/SELECT i FROM pt; -/*e*/SELECT i, next value for ps3 FROM pt; -/*e*/SELECT i, next value for ps4 FROM pt; -/*c1*/SELECT i, next value for ps5 FROM pt; -/*c1*/SELECT i, next value for ps6 FROM pt; -/*e*/SELECT i, next value for ps7 FROM pt; -/*e*/SELECT i, next value for ps8 FROM pt; - -CONNECT USER sa PASSWORD ""; -SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsC.txt b/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsC.txt deleted file mode 100644 index 831fda9c..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSeqRightsC.txt +++ /dev/null @@ -1,39 +0,0 @@ --- $Id: TestSelfSeqRightsC.txt 6419 2022-02-16 12:30:15Z fredt $ --- Test .script persistence of Sequence rights - -CONNECT USER blaine PASSWORD "b"; --- Following is default, but just to eliminate any ambiguity... -SET SCHEMA public; --- By virtue of PUBLIC grants -/*e*/SELECT i, next value for ps9 FROM pt; -/*e*/SELECT i, next value for public.ps9 FROM public.pt; -/*e*/SELECT i, next value for ps9 FROM public.pt; -/*c1*/SELECT i, next value for ps1 FROM pt; -SET SCHEMA bsch; -/*c1*/SELECT i, next value for public.ps2 FROM public.pt; - --- Don't own - previously threw error but now adds a warning -GRANT ALL ON SEQUENCE public.ps2 TO PUBLIC; -/*u0*/GRANT ALL ON SEQUENCE bsch.bs5 TO PUBLIC; - --- By virtue of schema ownership -/*c1*/SELECT i, next value for bs2 FROM bt; -SET SCHEMA public; -/*c1*/SELECT i, next value for bsch.bs1 FROM bsch.bt; - --- Enough schema specification testing. Just use defauls Session schema for --- here on in -/*c1*/SELECT i FROM pt; -/*e*/SELECT i, next value for ps3 FROM pt; -/*e*/SELECT i, next value for ps4 FROM pt; -/*c1*/SELECT i, next value for ps5 FROM pt; -/*c1*/SELECT i, next value for ps6 FROM pt; -/*e*/SELECT i, next value for ps7 FROM pt; -/*e*/SELECT i, next value for ps8 FROM pt; - --- Test REVOKES --- Can't revoke on objects you don't own -/*e*/REVOKE ALL ON SEQUENCE public.ps6 FROM public RESTRICT; -/*u0*/REVOKE ALL ON SEQUENCE bsch.bs1 FROM public RESTRICT; -CONNECT USER sa PASSWORD ""; -/*u0*/REVOKE USAGE ON SEQUENCE public.ps6 FROM BLAINE RESTRICT; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfStoredProcedure.txt b/database/hsqldb/testrun/hsqldb/TestSelfStoredProcedure.txt deleted file mode 100644 index 0469deb5..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfStoredProcedure.txt +++ /dev/null @@ -1,459 +0,0 @@ --- AUXILIAR TABLES + DECLARES -DROP TABLE tt1 IF EXISTS; -DROP TABLE tt2 IF EXISTS; -DECLARE test_retval INT DEFAULT NULL; -CREATE Cached TABLE tt1( - ID INTEGER NOT NULL PRIMARY KEY, - tt2ref INTEGER - ); - -CREATE Cached TABLE tt2( - ID INTEGER NOT NULL PRIMARY KEY - ); -ALTER TABLE tt1 ADD CONSTRAINT fk2 FOREIGN KEY (tt2ref) REFERENCES tt2(ID); - --- CREATE SIMPLE PROCEDURES - INVALID - -DROP PROCEDURE procedure_test IF EXISTS; - --- Exception no body -/*e*/CREATE PROCEDURE procedure_test() MODIFIES SQL DATA - BEGIN ATOMIC - END - --- Exception no exists - in call + in drop -/*e*/CREATE PROCEDURE procedure_test() MODIFIES SQL DATA - BEGIN ATOMIC - END --- Exception no body -/*e*/DROP PROCEDURE procedure_test -/*e*/call procedure_test() - --- Exception invalid parameter - reserved word -/*e*/CREATE PROCEDURE procedure_test(IN value INTEGER) MODIFIES SQL DATA - BEGIN ATOMIC - SET val = val + 1; - END --- Exception no body -/*e*/DROP PROCEDURE procedure_test -/*e*/call procedure_test() - --- CREATE SIMPLE PROCEDURES - --- Empty procedure -CREATE PROCEDURE procedure_test() MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE temp INT; - SET temp = 10; - END -call procedure_test() -DROP PROCEDURE procedure_test - --- Empty procedure - IN parameter -CREATE PROCEDURE procedure_test(IN val INTEGER) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu INT DEFAULT 1; - SET valu = val + 1; - END -call procedure_test(20) -DROP PROCEDURE procedure_test - --- Empty procedure - INT parameter + OUT parameter -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SET retval = val + 1; - END -CALL procedure_test(20, test_retval); -/*r21*/CALL test_retval; -DROP PROCEDURE procedure_test - --- Empty procedure - INTOUT parameter -CREATE PROCEDURE procedure_test(INOUT val INTEGER) MODIFIES SQL DATA - BEGIN ATOMIC - SET val = val + 1; - END -SET test_retval=20; -CALL procedure_test(test_retval); -/*r21*/CALL test_retval; -DROP PROCEDURE procedure_test - --- PROCEDURES - BASIC SQL OPERATIONS - --- simple procedure return select -CREATE PROCEDURE procedure_test(OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SELECT id INTO retval FROM tt2; - END -INSERT INTO tt2(ID) VALUES(1); -call procedure_test(test_retval) -/*r1*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple procedure test insert -CREATE PROCEDURE procedure_test(OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DELETE FROM tt2; - INSERT INTO tt2(ID) VALUES(1); - INSERT INTO tt2(ID) VALUES(2); - SELECT COUNT(id) INTO retval FROM tt2; - END -call procedure_test(test_retval) -/*r2*/CALL test_retval; -/*r2*/SELECT COUNT(*) FROM tt2; - -CREATE USER PUSER PASSWORD 'ab' -GRANT CHANGE_AUTHORIZATION TO PUSER -GRANT EXECUTE ON ROUTINE procedure_test TO puser -SET SESSION AUTHORIZATION 'PUSER' - -CALL procedure_test(test_retval) -/*r2*/CALL test_retval; - -CONNECT USER SA PASSWORD '' -/*r2*/SELECT COUNT(*) FROM tt2; -REVOKE EXECUTE ON ROUTINE procedure_test FROM puser CASCADE -SET SESSION AUTHORIZATION 'PUSER' -/*e*/CALL procedure_test(test_retval) -CONNECT USER SA PASSWORD '' -DROP PROCEDURE procedure_test - --- PROCEDURES - VARIABLES - --- simple procedure asignment -CREATE PROCEDURE procedure_test(OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE temp INT; - SET temp = 10; - SET retval = temp; - END -call procedure_test(test_retval) -/*r10*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple add -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE temp INT; - SET temp = 10; - SET retval = val + temp; - END -call procedure_test(5, test_retval) -/*r15*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple substract -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE temp INT; - SET temp = 1; - SET retval = val - temp; - END -call procedure_test(5, test_retval) -/*r4*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple multiply -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE temp INT; - SET temp = 25; - SET retval = val * temp; - END -call procedure_test(5, test_retval) -/*r125*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple division -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE temp INT; - SET temp = 5; - SET retval = val / temp; - END -call procedure_test(22, test_retval) -/*r4*/CALL test_retval; -DROP PROCEDURE procedure_test - --- PROCEDURES - CONDITIONS - --- simple IF -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SET retval = 0; - IF val = 1 THEN SET retval = 21; END IF; - END -call procedure_test(0, test_retval) -/*r0*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r0*/CALL test_retval; -call procedure_test(200, test_retval) -/*r0*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r0*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple IF/ELSE -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SET retval = 0; - IF val = 1 THEN SET retval = 21; - ELSE SET retval = 55; - END IF; - END -call procedure_test(0, test_retval) -/*r55*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r55*/CALL test_retval; -call procedure_test(200, test_retval) -/*r55*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r55*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple IF/ELSEIF/ELSE -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE temp INT; - IF val = 1 THEN SET retval = 21; - ELSEIF val = 2 THEN SET retval = 55; - ELSE SET retval = 100; - END IF; - END -call procedure_test(0, test_retval) -/*r100*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r55*/CALL test_retval; -call procedure_test(3, test_retval) -/*r100*/CALL test_retval; -call procedure_test(200, test_retval) -/*r100*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r100*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple CASE -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SET retval = 0; - CASE val - WHEN 1 THEN SET retval = 21; - END CASE; - END -call procedure_test(0, test_retval) -/*r0*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r0*/CALL test_retval; -call procedure_test(200, test_retval) -/*r0*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r0*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple CASE - multivalue -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SET retval = 0; - CASE val - WHEN 1,2 THEN SET retval = 21; - END CASE; - END -call procedure_test(0, test_retval) -/*r0*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r21*/CALL test_retval; -call procedure_test(3, test_retval) -/*r0*/CALL test_retval; -call procedure_test(200, test_retval) -/*r0*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r0*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple CASE - multivalue -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SET retval = 0; - CASE val - WHEN 1,2 THEN SET retval = 21; - WHEN IN (3, 4, 5) THEN SET retval = 55; - END CASE; - END -call procedure_test(0, test_retval) -/*r0*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r21*/CALL test_retval; -call procedure_test(3, test_retval) -/*r55*/CALL test_retval; -call procedure_test(4, test_retval) -/*r55*/CALL test_retval; -call procedure_test(5, test_retval) -/*r55*/CALL test_retval; -call procedure_test(6, test_retval) -/*r0*/CALL test_retval; -call procedure_test(200, test_retval) -/*r0*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r0*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple CASE - multivalue (repeated) -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - SET retval = 0; - CASE val - WHEN 1,2 THEN SET retval = 21; - WHEN IN (2, 3, 5) THEN SET retval = 55; - END CASE; - END -call procedure_test(0, test_retval) -/*r0*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r21*/CALL test_retval; -call procedure_test(3, test_retval) -/*r55*/CALL test_retval; -call procedure_test(4, test_retval) -/*r0*/CALL test_retval; -call procedure_test(5, test_retval) -/*r55*/CALL test_retval; -call procedure_test(6, test_retval) -/*r0*/CALL test_retval; -call procedure_test(200, test_retval) -/*r0*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r0*/CALL test_retval; -DROP PROCEDURE procedure_test - --- simple CASE - multivalue & else -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - CASE val - WHEN 1,2 THEN SET retval = 21; - WHEN IN (2, 3, 5) THEN SET retval = 55; - ELSE SET retval = 101; - END CASE; - END -call procedure_test(0, test_retval) -/*r101*/CALL test_retval; -call procedure_test(1, test_retval) -/*r21*/CALL test_retval; -call procedure_test(2, test_retval) -/*r21*/CALL test_retval; -call procedure_test(3, test_retval) -/*r55*/CALL test_retval; -call procedure_test(4, test_retval) -/*r101*/CALL test_retval; -call procedure_test(5, test_retval) -/*r55*/CALL test_retval; -call procedure_test(6, test_retval) -/*r101*/CALL test_retval; -call procedure_test(200, test_retval) -/*r101*/CALL test_retval; -call procedure_test(-23, test_retval) -/*r101*/CALL test_retval; -DROP PROCEDURE procedure_test; - --- PROCEDURES -- BUCLES - --- simple WHILE -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE counter INT; - DECLARE temp INT; - SET counter = val; - SET temp = 0; - WHILE counter < 10 DO - SET temp = temp + counter; - SET counter = counter + 1; - END WHILE; - SET retval = temp; - END -call procedure_test(0, test_retval) -/*r45*/CALL test_retval; -call procedure_test(5, test_retval) -/*r35*/CALL test_retval; -call procedure_test(10, test_retval) -/*r0*/CALL test_retval; -call procedure_test(100, test_retval) -/*r0*/CALL test_retval; -DROP PROCEDURE procedure_test; - --- simple REPEAT -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE counter INT; - DECLARE temp INT; - SET counter = val; - SET temp = 0; - REPEAT - SET temp = temp + counter; - SET counter = counter + 1; - UNTIL counter >= 10 - END REPEAT; - SET retval = temp; - END -call procedure_test(0, test_retval) -/*r45*/CALL test_retval; -call procedure_test(5, test_retval) -/*r35*/CALL test_retval; -call procedure_test(10, test_retval) -/*r10*/CALL test_retval; -call procedure_test(100, test_retval) -/*r100*/CALL test_retval; -DROP PROCEDURE procedure_test; - --- simple REPEAT with infinite loop -CREATE PROCEDURE procedure_test(IN val INT, OUT retval INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE counter INT; - DECLARE temp INT; - SET counter = val; - SET temp = 0; - REPEAT - SET temp = temp + counter; - SET counter = counter + 1; - UNTIL counter < 10 - END REPEAT; - SET retval = temp; - END -call procedure_test(0, test_retval) -/*r0*/CALL test_retval; -call procedure_test(5, test_retval) -/*r5*/CALL test_retval; --- infinite loop ---/*e*/call procedure_test(10, test_retval) -DROP PROCEDURE procedure_test; - --- -CREATE PROCEDURE procedure_test(INOUT val INT) READS SQL DATA - DYNAMIC RESULT SETS 1 - BEGIN ATOMIC - declare curs cursor for select table_schema, table_name from information_schema.tables where table_name='LOB_IDS' and table_schema='SYSTEM_LOBS'; - select count(*) into val from information_schema.columns where table_name='LOB_IDS' and table_schema='SYSTEM_LOBS'; - open curs; - END - -CREATE PROCEDURE test_proc(INOUT val_p INT, IN lastname_p VARCHAR(20)) - MODIFIES SQL DATA - BEGIN ATOMIC - SET val_p = 0; - for_label: FOR SELECT * FROM customer WHERE lastname = lastname_p DO - IF val_p > 0 THEN - DELETE FROM customer WHERE customer.id = id; - END IF; - SET val_p = val_p + 1; - END FOR for_label; - END diff --git a/database/hsqldb/testrun/hsqldb/TestSelfStoredProcedureTypes.txt b/database/hsqldb/testrun/hsqldb/TestSelfStoredProcedureTypes.txt deleted file mode 100644 index 9b4f4cf7..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfStoredProcedureTypes.txt +++ /dev/null @@ -1,253 +0,0 @@ --- PARAMETERS IN - --- Type SMALLINT -DROP PROCEDURE procedure_test IF EXISTS; -CREATE PROCEDURE procedure_test(IN val SMALLINT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu INT; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -/*e*/call procedure_test(40000); -/*e*/call procedure_test(-40000); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type INT -CREATE PROCEDURE procedure_test(IN val INT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu INT; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -call procedure_test(40000); -call procedure_test(-40000); -/*e*/call procedure_test(123456789012345); -/*e*/call procedure_test(-123456789012345); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - -CREATE PROCEDURE procedure_test(IN val INTEGER) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu INT; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -call procedure_test(40000); -call procedure_test(-40000); -/*e*/call procedure_test(123456789012345); -/*e*/call procedure_test(-123456789012345); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type BIGINT -CREATE PROCEDURE procedure_test(IN val BIGINT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu BIGINT; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -call procedure_test(40000); -call procedure_test(-40000); -call procedure_test(123456789012345); -call procedure_test(-123456789012345); -/*e*/call procedure_test(12345678901234567890123456789012345678790); -/*e*/call procedure_test(-12345678901234567890123456789012345678790); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type DECIMAL -CREATE PROCEDURE procedure_test(IN val DECIMAL) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu DECIMAL; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -call procedure_test(40000); -call procedure_test(-40000); -call procedure_test(123456789012345); -call procedure_test(-123456789012345); -call procedure_test(1.034); -call procedure_test(-1.3E24); -/*e*/call procedure_test(1.04324324423E352); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - -CREATE PROCEDURE procedure_test(IN val NUMERIC) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu DECIMAL; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -call procedure_test(40000); -call procedure_test(-40000); -call procedure_test(123456789012345); -call procedure_test(-123456789012345); -call procedure_test(1.034); -call procedure_test(-1.3E24); -call procedure_test(1.0E35); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type DOUBLE -CREATE PROCEDURE procedure_test(IN val FLOAT) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu DECIMAL; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -call procedure_test(40000); -call procedure_test(-40000); -call procedure_test(123456789012345); -call procedure_test(-123456789012345); -call procedure_test(1.034); -call procedure_test(-1.3E24); -call procedure_test(1.04324324423E42); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - -CREATE PROCEDURE procedure_test(IN val DOUBLE) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu DECIMAL; - SET valu = val; - END -call procedure_test(0); -call procedure_test(5); -call procedure_test(-5); -call procedure_test(40000); -call procedure_test(-40000); -call procedure_test(123456789012345); -call procedure_test(-123456789012345); -call procedure_test(1.034); -call procedure_test(-1.3E24); -call procedure_test(1.04324324423E11); -/*e*/call procedure_test('a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type CHAR -CREATE PROCEDURE procedure_test(IN val CHAR(1)) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu VARCHAR(10); - SET valu = val; - END -call procedure_test('a'); -/*e*/call procedure_test(5); -/*e*/call procedure_test(-5); -call procedure_test(''); -/*e*/call procedure_test('ab'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type CHAR -CREATE PROCEDURE procedure_test(IN val CHAR(10)) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu VARCHAR(10); - SET valu = val; - END -call procedure_test('0123456789'); -/*e*/call procedure_test(5); -/*e*/call procedure_test(-5); -call procedure_test(''); -call procedure_test('ab'); -/*e*/call procedure_test('0123456789a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type VARCHAR -CREATE PROCEDURE procedure_test(IN val VARCHAR(1)) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu VARCHAR(10); - SET valu = val; - END -call procedure_test('a'); -/*e*/call procedure_test(5); -/*e*/call procedure_test(-5); -call procedure_test(''); -/*e*/call procedure_test('ab'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - -CREATE PROCEDURE procedure_test(IN val VARCHAR(10)) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu VARCHAR(10); - SET valu = val; - END -call procedure_test('a'); -call procedure_test('0123456789'); -/*e*/call procedure_test(5); -/*e*/call procedure_test(-5); -call procedure_test(''); -call procedure_test('ab'); -/*e*/call procedure_test('0123456789a'); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type DATE -CREATE PROCEDURE procedure_test(IN val DATE) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu DATE; - SET valu = val; - END -call procedure_test({d '2010-01-01'}); -/*e*/call procedure_test('a'); -/*e*/call procedure_test(5); -/*e*/call procedure_test(-5); -/*e*/call procedure_test(''); -/*e*/call procedure_test('ab'); -/*e*/call procedure_test({t '10:00:00'}); -call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type TIME -CREATE PROCEDURE procedure_test(IN val TIME) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu TIME; - SET valu = val; - END -call procedure_test({t '10:00:00'}); -/*e*/call procedure_test('a'); -/*e*/call procedure_test(5); -/*e*/call procedure_test(-5); -/*e*/call procedure_test(''); -/*e*/call procedure_test('ab'); -/*e*/call procedure_test({d '2010-01-01'}); -/*e*/call procedure_test({ts '2010-01-01 10:00:00'}); -DROP PROCEDURE procedure_test; - --- Type TIMESTAMP -CREATE PROCEDURE procedure_test(IN val TIMESTAMP) MODIFIES SQL DATA - BEGIN ATOMIC - DECLARE valu TIMESTAMP; - SET valu = val; - END -call procedure_test({ts '2010-01-01 10:00:00'}); -/*e*/call procedure_test('a'); -/*e*/call procedure_test(5); -/*e*/call procedure_test(-5); -/*e*/call procedure_test(''); -/*e*/call procedure_test('ab'); -call procedure_test({d '2010-01-01'}); -/*e*/call procedure_test({t '10:00:00'}); -DROP PROCEDURE procedure_test; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSubselects.txt b/database/hsqldb/testrun/hsqldb/TestSelfSubselects.txt deleted file mode 100644 index 60baa22f..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSubselects.txt +++ /dev/null @@ -1,177 +0,0 @@ -drop table colors if exists; -drop table sizes if exists; -drop table fruits if exists; -drop table trees if exists; -create table colors(id int, val char(20)); -insert into colors values(1,'red'); -insert into colors values(2,'green'); -insert into colors values(3,'orange'); -insert into colors values(4,'indigo'); -create table sizes(id int, val char(20)); -insert into sizes values(1,'small'); -insert into sizes values(2,'medium'); -insert into sizes values(3,'large'); -insert into sizes values(4,'odd'); -create table fruits(id int, name char(30), color_id int); -insert into fruits values(1, 'golden delicious',2); -insert into fruits values(2, 'macintosh',1); -insert into fruits values(3, 'red delicious',1); -insert into fruits values(4, 'granny smith',2); -insert into fruits values(5, 'tangerine',4); -create table trees(id int, name char(30), fruit_id int, size_id int); -insert into trees values(1, 'small golden delicious tree',1,1); -insert into trees values(2, 'large macintosh tree',2,3); -insert into trees values(3, 'large red delicious tree',3,3); -insert into trees values(4, 'small red delicious tree',3,1); -insert into trees values(5, 'medium granny smith tree',4,2); -select a.val, b.name from sizes a, trees b where a.id = b.size_id and b.id in (select a.id from trees a, fruits b where a.fruit_id = b.id and b.name='red delicious') order by a.val; --- --- bug #547764 --- name in subquery must resolve to the subquery first -drop table trees if exists; -drop table fruits if exists; -create table trees(id integer primary key,name varchar(30) not null); -create table fruits(id integer primary key,name varchar(30) not null, - tree_id integer not null,foreign key (tree_id) references trees(id)); -insert into trees (id, name) values (1, 'apple'); -insert into fruits (id, name, tree_id) values(1, 'pippin', 1); -insert into fruits (id, name, tree_id) values(2, 'granny smith', 1); -/*c2*/select id from fruits where tree_id in(select id from trees where name = 'apple'); - -drop table table1 if exists; -drop table table2 if exists; -CREATE TABLE TABLE1 (COL1 INTEGER, COL2 CHAR(1)) -CREATE TABLE TABLE2 (COL1 INTEGER) -insert into table1 values 1, 'X' -insert into table2 values 1 -/*r1*/SELECT T1.COL1 FROM TABLE1 T1 INNER JOIN - (SELECT COL1 FROM TABLE2) T2 ON T1.COL1 = T2.COL1 - WHERE T1.COL2 = 'X' - -/*r - null,4 - 5,6 -*/select * from ( - select null as aaaaaaa, 4 as b from table2 - union select 5 as aaaaaaa, 6 as b from table2 - ) baz - -drop table table1 -drop table table2 - --- mixed aggregate and subquery with aggregate with group by -CREATE CACHED TABLE PUBLIC.VC_CORE_TERMINALPROFILE_TAG(TERMINALPROFILE_ID - BIGINT NOT NULL, - TAG_ID BIGINT NOT NULL, - PRIMARY KEY(TERMINALPROFILE_ID, - TAG_ID)); -CREATE CACHED TABLE PUBLIC.VC_DEVICE_TERMINAL(ID BIGINT NOT NULL PRIMARY KEY, - VERSION INTEGER NOT NULL, - NAME VARCHAR(64), - NOTES VARCHAR(1024), - ACTIVE BIT, - STATE INTEGER NOT NULL, - TERMINALPROFILE_ID BIGINT ); -CREATE CACHED TABLE PUBLIC.VC_DEVICE_TERMINALPROFILE(ID BIGINT GENERATED BY - DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY, - NAME VARCHAR(128), - DATECREATED TIMESTAMP, - DATECREATEDTIMEZONEID VARCHAR(50), - FAKEDOUTFFISIZE BIGINT, - FAKEDOUTFFIMD5 VARCHAR(255), - TEMPORARYPROFILE BIT, - NETWORKCONFIGURATION_ID BIGINT, - FFIFILE_ID BIGINT, - BBIFILE_ID BIGINT, - RRIFILE_ID BIGINT, - FIRMWARE_ID BIGINT); -CREATE CACHED TABLE PUBLIC.VOC_SITE(SITEID BIGINT GENERATED BY DEFAULT AS - IDENTITY(START WITH 1) NOT NULL PRIMARY KEY, - VERSION INTEGER NOT NULL, - NAME VARCHAR(255) NOT NULL, - DESCRIPTION VARCHAR(2000), - NOTES VARCHAR(2000), - TIMEZONE VARCHAR(255), - EAPTYPE INTEGER, - CREDENTIALASSOCIATION INTEGER, - CREDENTIALTYPE INTEGER, - USEPINS BIT, - CHARGERDISCONNECT BIT, - RESTRICTEDSSID VARCHAR(128), - RESTRICTEDEAPTYPE INTEGER, - SITEPIN VARCHAR(32), - SERVERCREDENTIALS_ID BIGINT, - SITEWIDEUSER_ID BIGINT, - RESTRICTEDUSER_ID BIGINT, - LDAPCONFIG_ID BIGINT, - UNIQUE(NAME)) ; -CREATE CACHED TABLE PUBLIC.VOC_TAG(ID BIGINT GENERATED BY DEFAULT AS - IDENTITY(START WITH 1) NOT NULL PRIMARY KEY, - TAG_TYPE BIGINT, - TAGGABLE_ID BIGINT); -CREATE INDEX IDX_TERMINAL_TERMINALPROFILE - ON PUBLIC.VC_DEVICE_TERMINAL(TERMINALPROFILE_ID); -ALTER TABLE PUBLIC.VOC_SITE ALTER COLUMN SITEID RESTART WITH 1; -ALTER TABLE PUBLIC.VOC_TAG ALTER COLUMN ID RESTART WITH 1; -ALTER TABLE PUBLIC.VC_CORE_TERMINALPROFILE_TAG ADD CONSTRAINT - FKEC676CBA9924AE56 FOREIGN KEY(TERMINALPROFILE_ID) REFERENCES - PUBLIC.VC_DEVICE_TERMINALPROFILE(ID); -ALTER TABLE PUBLIC.VC_CORE_TERMINALPROFILE_TAG ADD CONSTRAINT - FKEC676CBA3EF30942 FOREIGN KEY(TAG_ID) REFERENCES PUBLIC.VOC_TAG(ID); -ALTER TABLE PUBLIC.VC_DEVICE_TERMINAL ADD CONSTRAINT - FK_TERMINAL_TERMINALPROFILE FOREIGN KEY(TERMINALPROFILE_ID) REFERENCES - PUBLIC.VC_DEVICE_TERMINALPROFILE(ID); - -INSERT INTO VC_DEVICE_TERMINALPROFILE (id, temporaryProfile, name) - VALUES (1, 0, 'tp1'); -INSERT INTO VC_DEVICE_TERMINALPROFILE (id, temporaryProfile, name) - VALUES (2, 0, 'tp2'); -INSERT INTO voc_tag (id, tag_type, taggable_id) - VALUES (-463, 1, -463); -INSERT INTO voc_tag (id, tag_type, taggable_id) - VALUES (-25, 1, -24); -INSERT INTO voc_tag (id, tag_type, taggable_id) - VALUES (-1, 1, -1); -INSERT INTO vc_core_terminalprofile_tag (terminalprofile_id, tag_id) - VALUES (1, -1); -INSERT INTO vc_core_terminalprofile_tag (terminalprofile_id, tag_id) - VALUES (2, -1); -INSERT INTO voc_site (siteid, version, name, description) - VALUES (-24, 0, 'two', 'second'); -INSERT INTO voc_site (siteid, version, name, description) - VALUES (-1, 0, 'one', 'first'); -SELECT terminalpr1_.id as termid, terminalpr1_.name, min(terminalpr1_.name) as name, - count(terminals2_.id) as terminals, - (SELECT count(*) FROM vc_device_terminal terminal5_ - WHERE terminal5_.terminalprofile_id=terminalpr1_.id AND terminal5_.state=0) as col_3_0_, - (SELECT count(*) FROM vc_device_terminal terminal6_ - WHERE terminal6_.terminalprofile_id=terminalpr1_.id AND (terminal6_.state IN (1 , 6))) as col_4_0_, - (SELECT count(*) FROM vc_device_terminal terminal7_ WHERE - terminal7_.terminalprofile_id=terminalpr1_.id AND terminal7_.state=3) as col_5_0_, - (SELECT count(*) FROM vc_device_terminal terminal8_ WHERE - terminal8_.terminalprofile_id=terminalpr1_.id AND terminal8_.state=4) as col_6_0_, - (SELECT count(*) FROM vc_device_terminal terminal9_ - WHERE terminal9_.terminalprofile_id=terminalpr1_.id AND terminal9_.state=5) as col_7_0_, - (SELECT count(*) FROM vc_device_terminal terminal10_ - WHERE terminal10_.terminalprofile_id=terminalpr1_.id AND terminal10_.state=7) as col_8_0_, - (SELECT count(*) - FROM vc_device_terminal terminal11_ - WHERE terminal11_.terminalprofile_id=terminalpr1_.id AND terminal11_.state=8) as col_9_0_, - (SELECT count(*) FROM vc_device_terminal terminal12_ - WHERE terminal12_.terminalprofile_id=terminalpr1_.id AND terminal12_.state=-1) as col_10_0_, - max(site0_.name) as col_11_0_, - max(site0_.siteId) as col_12_0_ - FROM voc_site site0_, - vc_core_terminalprofile_tag tags3_, - voc_tag tag4_, - vc_device_terminalprofile terminalpr1_ - LEFT OUTER JOIN vc_device_terminal terminals2_ - ON terminalpr1_.id=terminals2_.terminalprofile_id - AND (terminals2_.active=1) - WHERE terminalpr1_.temporaryProfile=0 - AND terminalpr1_.id=tags3_.terminalprofile_id - AND tags3_.tag_id=tag4_.id - AND tag4_.taggable_id=site0_.siteId - AND (tag4_.id IN (-1)) - GROUP BY terminalpr1_.id; - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfSysTables.txt b/database/hsqldb/testrun/hsqldb/TestSelfSysTables.txt deleted file mode 100644 index ef0897e3..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfSysTables.txt +++ /dev/null @@ -1,176 +0,0 @@ -SET SCHEMA information_schema; -SELECT DISTINCT * FROM SYSTEM_BESTROWIDENTIFIER -SELECT DISTINCT * FROM SYSTEM_CACHEINFO -SELECT DISTINCT * FROM SYSTEM_COLUMNS -SELECT DISTINCT * FROM SYSTEM_COMMENTS -SELECT DISTINCT * FROM SYSTEM_CROSSREFERENCE -SELECT DISTINCT * FROM SYSTEM_INDEXINFO -SELECT DISTINCT * FROM SYSTEM_PRIMARYKEYS -SELECT DISTINCT * FROM SYSTEM_PROCEDURECOLUMNS -SELECT DISTINCT * FROM SYSTEM_PROCEDURES -SELECT DISTINCT * FROM SYSTEM_PROPERTIES -SELECT DISTINCT * FROM SYSTEM_SCHEMAS -SELECT DISTINCT * FROM SYSTEM_SESSIONINFO -SELECT DISTINCT * FROM SYSTEM_SESSIONS -SELECT DISTINCT * FROM SYSTEM_TABLES -SELECT DISTINCT * FROM SYSTEM_TABLETYPES -SELECT DISTINCT * FROM SYSTEM_TEXTTABLES -SELECT DISTINCT * FROM SYSTEM_TYPEINFO -SELECT DISTINCT * FROM SYSTEM_UDTS -SELECT DISTINCT * FROM SYSTEM_USERS -SELECT DISTINCT * FROM SYSTEM_VERSIONCOLUMNS - --- select a second time - -SELECT DISTINCT * FROM SYSTEM_BESTROWIDENTIFIER -SELECT DISTINCT * FROM SYSTEM_CACHEINFO -SELECT DISTINCT * FROM SYSTEM_COLUMNS -SELECT DISTINCT * FROM SYSTEM_COMMENTS -SELECT DISTINCT * FROM SYSTEM_CROSSREFERENCE -SELECT DISTINCT * FROM SYSTEM_INDEXINFO -SELECT DISTINCT * FROM SYSTEM_PRIMARYKEYS -SELECT DISTINCT * FROM SYSTEM_PROCEDURECOLUMNS -SELECT DISTINCT * FROM SYSTEM_PROCEDURES -SELECT DISTINCT * FROM SYSTEM_PROPERTIES -SELECT DISTINCT * FROM SYSTEM_SCHEMAS -SELECT DISTINCT * FROM SYSTEM_SESSIONINFO -SELECT DISTINCT * FROM SYSTEM_SESSIONS -SELECT DISTINCT * FROM SYSTEM_TABLES -SELECT DISTINCT * FROM SYSTEM_TABLETYPES -SELECT DISTINCT * FROM SYSTEM_TEXTTABLES -SELECT DISTINCT * FROM SYSTEM_TYPEINFO -SELECT DISTINCT * FROM SYSTEM_UDTS -SELECT DISTINCT * FROM SYSTEM_USERS -SELECT DISTINCT * FROM SYSTEM_VERSIONCOLUMNS - --- - -SELECT DISTINCT * FROM ADMINISTRABLE_ROLE_AUTHORIZATIONS -SELECT DISTINCT * FROM APPLICABLE_ROLES -SELECT DISTINCT * FROM ASSERTIONS -SELECT DISTINCT * FROM AUTHORIZATIONS -SELECT DISTINCT * FROM CHARACTER_SETS -SELECT DISTINCT * FROM CHECK_CONSTRAINT_ROUTINE_USAGE -SELECT DISTINCT * FROM CHECK_CONSTRAINTS -SELECT DISTINCT * FROM COLLATIONS -SELECT DISTINCT * FROM COLUMN_COLUMN_USAGE -SELECT DISTINCT * FROM COLUMN_DOMAIN_USAGE -SELECT DISTINCT * FROM COLUMN_PRIVILEGES -SELECT DISTINCT * FROM COLUMN_UDT_USAGE -SELECT DISTINCT * FROM COLUMNS -SELECT DISTINCT * FROM CONSTRAINT_COLUMN_USAGE -SELECT DISTINCT * FROM CONSTRAINT_TABLE_USAGE -SELECT DISTINCT * FROM DATA_TYPE_PRIVILEGES -SELECT DISTINCT * FROM DOMAIN_CONSTRAINTS -SELECT DISTINCT * FROM DOMAINS -SELECT DISTINCT * FROM ENABLED_ROLES -SELECT DISTINCT * FROM INFORMATION_SCHEMA_CATALOG_NAME -SELECT DISTINCT * FROM JAR_JAR_USAGE -SELECT DISTINCT * FROM JARS -SELECT DISTINCT * FROM KEY_COLUMN_USAGE -SELECT DISTINCT * FROM PARAMETERS -SELECT DISTINCT * FROM REFERENTIAL_CONSTRAINTS -SELECT DISTINCT * FROM ROLE_AUTHORIZATION_DESCRIPTORS -SELECT DISTINCT * FROM ROLE_COLUMN_GRANTS -SELECT DISTINCT * FROM ROLE_ROUTINE_GRANTS -SELECT DISTINCT * FROM ROLE_TABLE_GRANTS -SELECT DISTINCT * FROM ROLE_UDT_GRANTS -SELECT DISTINCT * FROM ROLE_USAGE_GRANTS -SELECT DISTINCT * FROM ROUTINE_COLUMN_USAGE -SELECT DISTINCT * FROM ROUTINE_JAR_USAGE -SELECT DISTINCT * FROM ROUTINE_PRIVILEGES -SELECT DISTINCT * FROM ROUTINE_ROUTINE_USAGE -SELECT DISTINCT * FROM ROUTINE_SEQUENCE_USAGE -SELECT DISTINCT * FROM ROUTINE_TABLE_USAGE -SELECT DISTINCT * FROM ROUTINES -SELECT DISTINCT * FROM SCHEMATA -SELECT DISTINCT * FROM SEQUENCES -SELECT DISTINCT * FROM SQL_FEATURES -SELECT DISTINCT * FROM SQL_IMPLEMENTATION_INFO -SELECT DISTINCT * FROM SQL_PACKAGES -SELECT DISTINCT * FROM SQL_PARTS -SELECT DISTINCT * FROM SQL_SIZING -SELECT DISTINCT * FROM SQL_SIZING_PROFILES -SELECT DISTINCT * FROM TABLE_CONSTRAINTS -SELECT DISTINCT * FROM TABLE_PRIVILEGES -SELECT DISTINCT * FROM TABLES -SELECT DISTINCT * FROM TRANSLATIONS -SELECT DISTINCT * FROM TRIGGER_COLUMN_USAGE -SELECT DISTINCT * FROM TRIGGER_ROUTINE_USAGE -SELECT DISTINCT * FROM TRIGGER_SEQUENCE_USAGE -SELECT DISTINCT * FROM TRIGGER_TABLE_USAGE -SELECT DISTINCT * FROM TRIGGERED_UPDATE_COLUMNS -SELECT DISTINCT * FROM TRIGGERS -SELECT DISTINCT * FROM UDT_PRIVILEGES -SELECT DISTINCT * FROM USAGE_PRIVILEGES -SELECT DISTINCT * FROM USER_DEFINED_TYPES -SELECT DISTINCT * FROM VIEW_COLUMN_USAGE -SELECT DISTINCT * FROM VIEW_ROUTINE_USAGE -SELECT DISTINCT * FROM VIEW_TABLE_USAGE -SELECT DISTINCT * FROM VIEWS - --- select a second time - -SELECT DISTINCT * FROM ADMINISTRABLE_ROLE_AUTHORIZATIONS -SELECT DISTINCT * FROM APPLICABLE_ROLES -SELECT DISTINCT * FROM ASSERTIONS -SELECT DISTINCT * FROM AUTHORIZATIONS -SELECT DISTINCT * FROM CHARACTER_SETS -SELECT DISTINCT * FROM CHECK_CONSTRAINT_ROUTINE_USAGE -SELECT DISTINCT * FROM CHECK_CONSTRAINTS -SELECT DISTINCT * FROM COLLATIONS -SELECT DISTINCT * FROM COLUMN_COLUMN_USAGE -SELECT DISTINCT * FROM COLUMN_DOMAIN_USAGE -SELECT DISTINCT * FROM COLUMN_PRIVILEGES -SELECT DISTINCT * FROM COLUMN_UDT_USAGE -SELECT DISTINCT * FROM COLUMNS -SELECT DISTINCT * FROM CONSTRAINT_COLUMN_USAGE -SELECT DISTINCT * FROM CONSTRAINT_TABLE_USAGE -SELECT DISTINCT * FROM DATA_TYPE_PRIVILEGES -SELECT DISTINCT * FROM DOMAIN_CONSTRAINTS -SELECT DISTINCT * FROM DOMAINS -SELECT DISTINCT * FROM ENABLED_ROLES -SELECT DISTINCT * FROM INFORMATION_SCHEMA_CATALOG_NAME -SELECT DISTINCT * FROM JAR_JAR_USAGE -SELECT DISTINCT * FROM JARS -SELECT DISTINCT * FROM KEY_COLUMN_USAGE -SELECT DISTINCT * FROM PARAMETERS -SELECT DISTINCT * FROM REFERENTIAL_CONSTRAINTS -SELECT DISTINCT * FROM ROLE_AUTHORIZATION_DESCRIPTORS -SELECT DISTINCT * FROM ROLE_COLUMN_GRANTS -SELECT DISTINCT * FROM ROLE_ROUTINE_GRANTS -SELECT DISTINCT * FROM ROLE_TABLE_GRANTS -SELECT DISTINCT * FROM ROLE_UDT_GRANTS -SELECT DISTINCT * FROM ROLE_USAGE_GRANTS -SELECT DISTINCT * FROM ROUTINE_COLUMN_USAGE -SELECT DISTINCT * FROM ROUTINE_JAR_USAGE -SELECT DISTINCT * FROM ROUTINE_PRIVILEGES -SELECT DISTINCT * FROM ROUTINE_ROUTINE_USAGE -SELECT DISTINCT * FROM ROUTINE_SEQUENCE_USAGE -SELECT DISTINCT * FROM ROUTINE_TABLE_USAGE -SELECT DISTINCT * FROM ROUTINES -SELECT DISTINCT * FROM SCHEMATA -SELECT DISTINCT * FROM SEQUENCES -SELECT DISTINCT * FROM SQL_FEATURES -SELECT DISTINCT * FROM SQL_IMPLEMENTATION_INFO -SELECT DISTINCT * FROM SQL_PACKAGES -SELECT DISTINCT * FROM SQL_PARTS -SELECT DISTINCT * FROM SQL_SIZING -SELECT DISTINCT * FROM SQL_SIZING_PROFILES -SELECT DISTINCT * FROM TABLE_CONSTRAINTS -SELECT DISTINCT * FROM TABLE_PRIVILEGES -SELECT DISTINCT * FROM TABLES -SELECT DISTINCT * FROM TRANSLATIONS -SELECT DISTINCT * FROM TRIGGER_COLUMN_USAGE -SELECT DISTINCT * FROM TRIGGER_ROUTINE_USAGE -SELECT DISTINCT * FROM TRIGGER_SEQUENCE_USAGE -SELECT DISTINCT * FROM TRIGGER_TABLE_USAGE -SELECT DISTINCT * FROM TRIGGERED_UPDATE_COLUMNS -SELECT DISTINCT * FROM TRIGGERS -SELECT DISTINCT * FROM UDT_PRIVILEGES -SELECT DISTINCT * FROM USAGE_PRIVILEGES -SELECT DISTINCT * FROM USER_DEFINED_TYPES -SELECT DISTINCT * FROM VIEW_COLUMN_USAGE -SELECT DISTINCT * FROM VIEW_ROUTINE_USAGE -SELECT DISTINCT * FROM VIEW_TABLE_USAGE -SELECT DISTINCT * FROM VIEWS diff --git a/database/hsqldb/testrun/hsqldb/TestSelfTempTable1.txt b/database/hsqldb/testrun/hsqldb/TestSelfTempTable1.txt deleted file mode 100644 index 47d3e483..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfTempTable1.txt +++ /dev/null @@ -1,34 +0,0 @@ -/*s*/DROP tmptbl1 IF EXISTS; -/*s*/DROP tmptbl2 IF EXISTS; -/*s*/DROP user altuser1; -/*s*/DROP user altuser2; - -CREATE USER altuser1 PASSWORD password; -CREATE USER altuser2 PASSWORD password; -/*u0*/GRANT CHANGE_AUTHORIZATION TO altuser1; -/*u0*/GRANT CHANGE_AUTHORIZATION TO altuser2; -/*u0*/CREATE TEMP TABLE tmptbl1 (i int); -/*u0*/CREATE TEMP TABLE tmptbl2 (i int); -/*u0*/GRANT ALL ON tmptbl1 TO altuser1; -/*u0*/GRANT ALL ON tmptbl2 TO altuser1; -SET AUTOCOMMIT false; -/*u1*/INSERT INTO tmptbl1 VALUES(1); -/*u1*/INSERT INTO tmptbl1 VALUES(2); -/*c2*/SELECT * FROM tmptbl1; -COMMIT; -/*u1*/INSERT INTO tmptbl2 VALUES(1); -/*u1*/INSERT INTO tmptbl2 VALUES(2); -/*c0*/SELECT * FROM tmptbl1; -/*c2*/SELECT * FROM tmptbl2; -COMMIT; - -CONNECT USER altuser1 PASSWORD password; -/*c0*/SELECT * FROM tmptbl1; -/*c0*/SELECT * FROM tmptbl2; -COMMIT; - -CONNECT USER altuser2 PASSWORD password; -/*e*/SELECT * FROM tmptbl1; -/*e*/SELECT * FROM tmptbl2; -CONNECT USER SA password ""; -SHUTDOWN IMMEDIATELY; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfTempTable2.txt b/database/hsqldb/testrun/hsqldb/TestSelfTempTable2.txt deleted file mode 100644 index 95a8f3fa..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfTempTable2.txt +++ /dev/null @@ -1,24 +0,0 @@ --- This script depends on TestSelfTempTable1.txt to set up the objects tested. - -SET AUTOCOMMIT false; -/*c0*/SELECT * FROM tmptbl1; -/*c0*/SELECT * FROM tmptbl2; -COMMIT; -CONNECT USER altuser2 PASSWORD password; -/*e*/SELECT * FROM tmptbl1; -/*e*/SELECT * FROM tmptbl2; -CONNECT USER altuser1 PASSWORD password; -/*c0*/SELECT * FROM tmptbl1; -/*c0*/SELECT * FROM tmptbl2; -/*u1*/INSERT INTO tmptbl1 VALUES(1); -/*u1*/INSERT INTO tmptbl1 VALUES(2); -/*c2*/SELECT * FROM tmptbl1; -COMMIT; --- Purposefully not committing these inserts -/*c0*/SELECT * FROM tmptbl1; -/*u1*/INSERT INTO tmptbl2 VALUES(1); -/*u1*/INSERT INTO tmptbl2 VALUES(2); -/*c2*/SELECT * FROM tmptbl2; -ROLLBACK; -CONNECT USER SA password ""; -SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfTransaction.txt b/database/hsqldb/testrun/hsqldb/TestSelfTransaction.txt deleted file mode 100644 index 124e34cb..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfTransaction.txt +++ /dev/null @@ -1,68 +0,0 @@ --- ON DELETE SET NULL -set property "hsqldb.nio_data_file" false -set write_delay false; -set autocommit false; -drop table testB if exists; -create cached table testB(id integer, parent integer, ref integer, - data varchar(200), unique (id), foreign key (parent) - references testB(id) on delete set null); -/*u1*/insert into testB values(100,100,1,'xxxx'); -/*u1*/insert into testB values(101,100,1,'xxxx'); -/*u1*/insert into testB values(102,100,1,'xxxx'); -/*u1*/insert into testB values(200,200,1,'xxxx'); -commit; -/*u1*/delete from testB where id=100; -/*r - 101,NULL,1,xxxx - 102,NULL,1,xxxx - 200,200,1,xxxx -*/select * from testB order by id -/*c2*/select * from testB where parent is null -rollback; -/*c4*/select * from testB; --- ON DELETE SET DEFAULT -drop table testB if exists; -create cached table testB(id integer, parent integer default 20, ref integer, - data varchar(200), unique (id),foreign key (parent) - references testB(id) on delete set default); -/*u1*/insert into testB values(20,20,1,'xxxx'); -/*u1*/insert into testB values(100,100,1,'xxxx'); -/*u1*/insert into testB values(101,100,1,'xxxx'); -/*u1*/insert into testB values(200,200,1,'xxxx'); -commit; -/*u1*/delete from testB where id=100; -/*r - 20,20,1,xxxx - 101,20,1,xxxx - 200,200,1,xxxx -*/select * from testB order by id -/*c2*/select * from testB where parent=20 -rollback; -/*c4*/select * from testB; --- CHAINED SELF REFERENCING FK --- ON DELETE CASCADE -drop table testA if exists; -create cached table testA(a int primary key,b int, - foreign key(b) references testA(a) on update cascade on delete cascade); -insert into testA(a,b) values(1,1); -insert into testA(a,b) values(2,1); -insert into testA(a,b) values(3,1); -insert into testA(a,b) values(4,2); -insert into testA(a,b) values(5,2); -insert into testA(a,b) values(6,2); -insert into testA(a,b) values(7,3); -insert into testA(a,b) values(8,3); -insert into testA(a,b) values(9,3); -commit; -/*u9*/update testA set a = a+1; -/*r9*/select count(*) from testA; -/*r3*/select count(*) from testA where b=4; -/*u9*/update testA set a = a-1; -/*r9*/select count(*) from testA; -/*r0*/select count(*) from testA where b=4; -/*r3*/select count(*) from testA where b=3; -/*u1*/delete from testA where a=1; -/*r0*/select count(*) from testA; -rollback; -/*r9*/select count(*) from testA; - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfTriggers.txt b/database/hsqldb/testrun/hsqldb/TestSelfTriggers.txt deleted file mode 100644 index 17436653..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfTriggers.txt +++ /dev/null @@ -1,78 +0,0 @@ -drop table testtrig if exists; -drop table triglog if exists; -create cached table testtrig(id integer, data varchar(20), updated date); -create cached table triglog(id integer generated by default as identity, data varchar(20), op varchar(10)); -create trigger trigone after insert on testtrig referencing new row as newrow - for each row when (newrow.id >1) - insert into triglog values (newrow.id, newrow.data, 'inserted') -create trigger trigtwo before update on testtrig referencing old row as oldrow new row as newrow - for each row when (oldrow.updated is null) - set newrow.updated = date'2009-11-01' -insert into testtrig values(1,'one', null); -insert into testtrig values(2,'two', date'1999-11-01'); -/*r2,two,inserted*/select * from triglog -update testtrig set data = data || ' ' || data -/*r - 1,one one,2009-11-01 - 2,two two,1999-11-01 -*/select * from testtrig - - -create trigger trigthree after delete on testtrig referencing old row as oldrow - for each row - insert into triglog values oldrow.id, oldrow.data, 'deleted' - -delete from testtrig -/*c2*/select * from triglog where op = 'deleted' - -create procedure proc_trig(in in_arg_one varchar(10)) - language sql parameter style sql deterministic modifies sql data - label_one: begin atomic - insert into triglog values default, in_arg_one, null; - end label_one; - -create cached table testtrig2(id integer, data varchar(20), updated date); -create trigger trigfour after insert on testtrig2 referencing new row as newrow - for each row - call proc_trig(newrow.data) - -insert into testtrig2 values 10, 'felix', current_date -/*c1*/select * from triglog where data='felix' - -drop trigger trigone; -drop trigger trigtwo; -drop trigger trigthree; -drop trigger trigfour; - -drop table testtrig; -drop table testtrig2; - -create cached table testtrig(id integer, data varchar(20), updated date); -create cached table testtrig2(id integer, data varchar(20), updated date); - -CREATE PROCEDURE test_proc_three(pCount INT) - NO SQL LANGUAGE JAVA - EXTERNAL NAME 'CLASSPATH:org.hsqldb.test.TestStoredProcedure.procTest3' - -CREATE TRIGGER trigfive AFTER INSERT ON testtrig - referencing NEW ROW AS newrow - FOR EACH ROW WHEN (newrow.data IS NOT NULL) - BEGIN ATOMIC - DECLARE cwExists int DEFAULT 0; - SET cwExists = 0; - select count(*) into cwExists from testtrig2 where data = 'action1'; - call test_proc_three(cwExists); - insert into testtrig2 values cwExists, newrow.data, current_date; - END - -delete from testtrig; -create view vtrig as select id, data, updated, 'fixed string' fixed from testtrig; - -create trigger triginstead instead of insert on vtrig - referencing new row as newrow - for each row - insert into testtrig values newrow.id, newrow.data || ' added', newrow.updated - 1 day - -insert into vtrig values 10, 'string', current_date, null -/*c1*/select * from vtrig where data = 'string added'; -/*c1*/select * from testtrig; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfTriggers2.txt b/database/hsqldb/testrun/hsqldb/TestSelfTriggers2.txt deleted file mode 100644 index 3429c180..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfTriggers2.txt +++ /dev/null @@ -1,66 +0,0 @@ --- Testing some advanced trigger functionality - -CREATE TABLE log_table ( - stamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - message VARCHAR(80) NOT NULL - ) -CREATE PROCEDURE record(msg VARCHAR(60)) - MODIFIES SQL DATA - BEGIN ATOMIC - INSERT INTO log_table(message) VALUES (msg); - END -CREATE TABLE base_table ( - id BIGINT generated ALWAYS AS IDENTITY PRIMARY KEY, - i INTEGER NOT NULL, - vc VARCHAR(600) NOT NULL - ) - -/*r0*/ SELECT COUNT(*) FROM log_table - -CALL record('test record') - -/*r1*/ SELECT COUNT(*) FROM log_table - -CREATE TRIGGER manual_log_trigger AFTER INSERT ON base_table - INSERT INTO log_table(message) VALUES ('totally manual trigger event') - -INSERT INTO base_table(i, vc) VALUES(1, 'one') - -/*r2*/ SELECT COUNT(*) FROM log_table - -CREATE TRIGGER call_log_trigger AFTER INSERT ON base_table - CALL record('trigger routine CALL event') - -INSERT INTO base_table(i, vc) VALUES(2, 'two') - -/*r4*/ SELECT COUNT(*) FROM log_table -/*r2*/ SELECT COUNT(*) FROM base_table - --- this trigger is called recursively -- WHEN clause avoids infinite recursion -CREATE TRIGGER extra_ins_trigger_ AFTER INSERT ON base_table - REFERENCING NEW as new_row - FOR EACH ROW - WHEN (MOD(new_row.i,2) = 1) - INSERT INTO base_table(i, vc) - VALUES(1 + new_row.i, 'TRIG_ADDITION' || new_row.vc) - --- Sanity check to verify that the Trigger creaion didn't change anything -/*r4*/ SELECT COUNT(*) FROM log_table -/*r2*/ SELECT COUNT(*) FROM base_table - -INSERT INTO base_table(i, vc) VALUES(3, 'x') --- Should write 2 base_table entries, hence 4 log records -/*r8*/ SELECT COUNT(*) FROM log_table -/*r4*/ SELECT COUNT(*) FROM base_table - -CREATE TABLE KD (KDVER INT, KDID INT); -CREATE TABLE K (KVER INT, KID INT CHECK (KID > 0)); -INSERT INTO KD VALUES 79, 1 -INSERT INTO KD VALUES 70, 2 -INSERT INTO K VALUES 79, 1 -INSERT INTO K VALUES 70, 2 - -CREATE TRIGGER TD AFTER DELETE ON KD REFERENCING OLD ROW AS OLDROW FOR EACH ROW - BEGIN ATOMIC - UPDATE K SET KVER = NULL WHERE KID = OLDROW.KDID AND KVER = OLDROW.KDVER; - END; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfTrimSimplified.txt b/database/hsqldb/testrun/hsqldb/TestSelfTrimSimplified.txt deleted file mode 100644 index 384055de..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfTrimSimplified.txt +++ /dev/null @@ -1,20 +0,0 @@ --- TestSelfTrimSimplified.txt --- --- trim looks different - - -drop table testtable if exists cascade; -create cached table testtable ( - aString varchar(256) not null, - firstNum integer not null, - aDate date not null, - secondNum integer not null, - thirdNum integer not null, - aName varchar(32) not null - ); - -insert into TESTTABLE(aString, firstNum, aDate, secondNum, thirdNum, aName) - values (' XYZ ', 22, '2003-11-10', 18, 3, 'my name goes here'); - -/*rXYZ*/select trim(aString) from testtable; -drop table testtable; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfUnions.txt b/database/hsqldb/testrun/hsqldb/TestSelfUnions.txt deleted file mode 100644 index ebec0e98..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfUnions.txt +++ /dev/null @@ -1,142 +0,0 @@ -drop table a if exists; -drop table b if exists; -drop table c if exists; -CREATE TABLE A(ID INTEGER NOT NULL) -CREATE TABLE B(ID INTEGER NOT NULL) -CREATE TABLE C(ID INTEGER NOT NULL) -INSERT INTO A VALUES(1) -INSERT INTO A VALUES(2) -INSERT INTO A VALUES(3) -INSERT INTO B VALUES(1) -INSERT INTO B VALUES(2) -INSERT INTO C VALUES(3) -INSERT INTO C VALUES(4) -INSERT INTO C VALUES(5) -/*e*/SELECT * FROM A UNION (SELECT * FROM C -/*e*/SELECT * FROM A UNION SELECT * FROM C) -/*e*/(SELECT * FROM A UNION (SELECT * FROM C -/*e*/(SELECT * FROM A -/*c5*/SELECT * FROM A UNION SELECT * FROM C -/*c5*/(SELECT * FROM A) UNION SELECT * FROM C -/*c5*/SELECT * FROM A UNION (SELECT * FROM C) -/*c5*/(SELECT * FROM A UNION SELECT * FROM C) --- limits -/*c5*/SELECT * FROM A UNION SELECT * FROM C ORDER BY ID -/*c4*/(SELECT * FROM A ORDER BY ID LIMIT 1 OFFSET 0) UNION SELECT * FROM C -/*c4*/(SELECT * FROM A ORDER BY ID LIMIT 1 OFFSET 0) UNION ALL SELECT * FROM C -/*c4*/SELECT * FROM A UNION (SELECT * FROM C ORDER BY ID LIMIT 2 OFFSET 0) LIMIT 4 OFFSET 0 -/*r - 2 - 3 - 4 -*/SELECT * FROM A UNION (SELECT * FROM C ORDER BY ID LIMIT 2 OFFSET 0) ORDER BY ID LIMIT 0 OFFSET 1 -/*r - 4 - 3 - 2 - 1 -*/SELECT * FROM A UNION (SELECT * FROM C ORDER BY ID LIMIT 2 OFFSET 0) ORDER BY ID DESC --- -/*r - 4 - 5 -*/SELECT * FROM A UNION SELECT * FROM C ORDER BY ID LIMIT 2 OFFSET 3 -/*r - 3 -*/(SELECT * FROM A UNION SELECT * FROM B) INTERSECT SELECT * FROM C; -/*r - 1 - 2 - 3 - 4 - 5 -*/SELECT * FROM A UNION (SELECT * FROM B ORDER BY ID DESC LIMIT 10 OFFSET 0) UNION SELECT * FROM C ORDER BY ID; --- -/*c3*/SELECT * FROM A UNION SELECT * FROM B -/*c5*/SELECT * FROM B UNION SELECT * FROM C -/*c2*/SELECT * FROM A EXCEPT SELECT * FROM C -/*c2*/(SELECT * FROM A) EXCEPT SELECT * FROM C -/*c2*/SELECT * FROM A EXCEPT (SELECT * FROM C) -/*c1*/(SELECT * FROM A INTERSECT SELECT * FROM C) -/*c2*/SELECT * FROM A INTERSECT (SELECT * FROM B) -/*c0*/(SELECT * FROM B) INTERSECT SELECT * FROM C -/*r - 1 - 2 - 3 -*/SELECT * FROM A UNION SELECT * FROM C INTERSECT SELECT * FROM B -/*r - 1 - 2 -*/(SELECT * FROM A UNION SELECT * FROM C) INTERSECT SELECT * FROM B -/*r -*/SELECT * FROM A EXCEPT SELECT * FROM C EXCEPT SELECT * FROM B -/*r - 3 -*/SELECT * FROM A UNION SELECT * FROM C INTERSECT SELECT * FROM B EXCEPT SELECT * FROM B -/*r - 1 - 2 - 3 -*/SELECT * FROM A UNION SELECT * FROM C INTERSECT (SELECT * FROM B EXCEPT SELECT * FROM B) -CREATE VIEW V1 AS (SELECT * FROM A UNION SELECT * FROM C) INTERSECT SELECT * FROM B -/*r - 1 - 2 -*/SELECT * FROM V1 -CREATE VIEW V3 AS SELECT * FROM A UNION SELECT * FROM C INTERSECT (SELECT * FROM B EXCEPT SELECT * FROM B) -/*r - 1 - 2 - 3 -*/SELECT * FROM V3; -/*c3*/SELECT * FROM A WHERE ID IN (SELECT * FROM A UNION SELECT * FROM C INTERSECT (SELECT * FROM B EXCEPT SELECT * FROM B)) -/*c3*/SELECT * FROM A WHERE EXISTS (SELECT * FROM A UNION SELECT * FROM C INTERSECT (SELECT * FROM B EXCEPT SELECT * FROM B)) -/*c0*/SELECT * FROM A WHERE EXISTS (SELECT * FROM A EXCEPT SELECT * FROM C EXCEPT SELECT * FROM B) - ---- correlated union -create table bt1 ( id varchar(10) ); -create table bt2 ( id varchar(10) ); -create table bt3 ( id varchar(10) ); -insert into bt1( id ) values ( 'aaa' ); -insert into bt1( id ) values ( 'bbb' ); -insert into bt1( id ) values ( 'ccc' ); -insert into bt2( id ) values ( 'aaa' ); -insert into bt3( id ) values ( 'bbb' ); - --- the t1.id reference in the next test is not resolved in some runs - only after code changes result in failure -/*c1*/select * from bt1 as t1 - where not exists( - select id from bt2 as t2 where t2.id = t1.id - union all - select id from bt3 as t3 where t3.id = t1.id ); - ---- null as column in first select -create table au (id int, b1 boolean); -create table bu (id int); -insert into au values(1,true); -insert into bu values(2); -select id, null as b1 from bu union select id, b1 from au; - --- -drop table test if exists; -create table test(my_col numeric(10)); -insert into test (my_col) values (100); - -select my_col, 0 mycol from test - union - select 0 mycol2, my_col from test - -SET DATABASE SQL SYNTAX ORA TRUE - -/*r - 0.0E0 - 0.0E0 -*/SELECT val FROM (SELECT 0 val FROM dual) UNION ALL SELECT cast(0 AS double) FROM dual; - -/*r - 0.0E0 - 0.0E0 -*/SELECT val FROM (SELECT 0 val FROM dual) UNION ALL SELECT 0E0 FROM dual; - -SET DATABASE SQL SYNTAX ORA FALSE diff --git a/database/hsqldb/testrun/hsqldb/TestSelfUserFunction.txt b/database/hsqldb/testrun/hsqldb/TestSelfUserFunction.txt deleted file mode 100644 index 76d18eef..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfUserFunction.txt +++ /dev/null @@ -1,29 +0,0 @@ --- --- TestSelfUserFunction.txt --- --- This test checks if the USER() function works correctly when used within --- prepared statements such as VIEW's and constraints in TABLE's - --- Setup tables and views -DROP TABLE USER_PROFILE IF EXISTS -CREATE TABLE USER_PROFILE(NAME VARCHAR(10), PROFILE INT) -DROP VIEW USER_SECURITY_PROFILE_VIEW IF EXISTS -CREATE VIEW USER_SECURITY_PROFILE_VIEW AS SELECT * FROM USER_PROFILE WHERE Name = USER() - --- Create user for test -CREATE USER MATT PASSWORD MATT ADMIN - --- This checks that you are allowed to insert a row as long as your username matches the NAME field -/*u1*/ INSERT INTO USER_PROFILE(NAME, PROFILE) VALUES('SA',10) - --- Connect as MATT -CONNECT USER MATT PASSWORD MATT - --- Insert a row as the connected user -/*u1*/ INSERT INTO USER_PROFILE(NAME, PROFILE) VALUES('MATT',20) - --- There are two rows in the table but the select should only return the row --- associated with the connected user i.e. one row -/*c1*/ SELECT COUNT(*) FROM USER_SECURITY_PROFILE_VIEW -SHUTDOWN - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfVerify.txt b/database/hsqldb/testrun/hsqldb/TestSelfVerify.txt deleted file mode 100644 index 0c5575ad..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfVerify.txt +++ /dev/null @@ -1,51 +0,0 @@ --- --- TestSelfVerify.txt --- --- This is part of a three part suite of scripts to test persistence in the same DB - --- Correct handling of index creation for foreign keys --- check the consistency of foreign keys and primary keys -/*e*/create table VEREIN(VCODE CHAR(10) not null); -/*e*/create table BEWERB(VCODE CHAR(10) not null, ID SMALLINT not null); -/*e*/create unique index BEWERB_FK1 on BEWERB(VCODE); -/*e*/alter table BEWERB add constraint bv foreign key (VCODE) references VEREIN (VCODE); - --- fails as a uique indexes on verein and bewerb exist -/*e*/create unique index VEREIN_PK on VEREIN (VCODE); -/*e*/create unique index BEWERB_FK2 on BEWERB(ID); - --- null value in not null column -/*e*/insert into verein values (null); --- referential no matching row -/*e*/insert into bewerb values ('aaaaaaa',18); --- duplicate row -/*e*/insert into bewerb values ('hijklmn',7); --- referential integrity row has reference -/*e*/delete from verein where vcode='opqrstu' - ---test identity increment -INSERT INTO APP2 (VALUE) VALUES(13); -INSERT INTO APP2 (VALUE) VALUES(14); - -/*r5,14*/ SELECT COUNT(ID), MAX(VALUE) FROM APP2 - ---test persistence of insert into operations -/*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Eran'; -/*c2*/SELECT * FROM NEWAPP WHERE APP_NAME = 'Shelly'; -/*c4*/SELECT * FROM NEWAPP; - ---test correct persistent of view defined in TestSelfCreate.txt -/*r - 14,newdir,NULL -*/select * from "View" - -/*r - 14,newdir,NULL -*/select * from "View2" - ---test INSERT .. INTO and indexes -create cached table bewerb_copy as (select * from bewerb) with data; -create index idx_bewerb_copy on bewerb_copy(VCODE,ID); - -/*u0*/SHUTDOWN; - diff --git a/database/hsqldb/testrun/hsqldb/TestSelfViewGrants.txt b/database/hsqldb/testrun/hsqldb/TestSelfViewGrants.txt deleted file mode 100644 index 7cf5d7cf..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfViewGrants.txt +++ /dev/null @@ -1,59 +0,0 @@ --- $Id: TestSelfViewGrants.txt 610 2008-12-22 15:54:18Z unsaved $ --- Tests viw grants - --- These two users are for sanity tests -/*u0*/CREATE USER privd PASSWORD "privd"; -/*u0*/CREATE USER unprivd PASSWORD "unprivd"; -/*u0*/CREATE USER u1 PASSWORD "u1"; -/*u0*/GRANT CHANGE_AUTHORIZATION TO privd; -/*u0*/GRANT CHANGE_AUTHORIZATION TO unprivd; -/*u0*/GRANT CHANGE_AUTHORIZATION TO u1; --- rtable = restricted table -/*u0*/CREATE TABLE rtable (c1 int, c2 int, c3 int); -/*u1*/INSERT INTO rtable values (1, 2, 3); -/*c1*/SELECT * from rtable; -/*u0*/CREATE VIEW v as SELECT c1, c2 FROM rtable; -/*c1*/SELECT * from v; -/*u0*/GRANT ALL ON v TO privd; -/*u0*/GRANT SELECT ON v TO privd; -/*u0*/GRANT SELECT(c1) ON v TO u1; - - --- Test col-specific SELECTs -/*u0*/CONNECT USER u1 PASSWORD "u1"; -/*e*/SELECT c1 from rtable; -/*e*/SELECT c2 from rtable; -/*e*/SELECT c3 from rtable; -/*e*/SELECT c2 from v; -/*c1*/SELECT c1 from v; -COMMIT; -/*u0*/CONNECT USER privd PASSWORD "privd"; -/*e*/SELECT c1 from rtable; -/*e*/SELECT c2 from rtable; -/*e*/SELECT c3 from rtable; --- The following tests that View grants supercede restrictions on underlying --- tables. (For grants on entire View, not View columns). -/*c1*/SELECT c2 from v; -/*c1*/SELECT c1 from v; -COMMIT; -/*u0*/CONNECT USER unprivd PASSWORD "unprivd"; -/*e*/SELECT c1 from rtable; -/*e*/SELECT c2 from rtable; -/*e*/SELECT c3 from rtable; -/*e*/SELECT c2 from v; -/*e*/SELECT c1 from v; -COMMIT; -/*u0*/CONNECT USER SA PASSWORD ""; --- Exactly according to "SQL 1999" section 14.3.7: -/*u0*/GRANT SELECT ON v TO PUBLIC; -/*u0*/CONNECT USER unprivd PASSWORD "unprivd"; -/*c1*/SELECT c2 from v; -/*c1*/SELECT c1 from v; -COMMIT; -/*u0*/CONNECT USER SA PASSWORD ""; -/*u0*/DROP USER u1; -/*u0*/DROP USER privd; -/*u0*/DROP USER unprivd; -/*u0*/DROP VIEW v; -/*u0*/DROP TABLE rtable; -/*u0*/SHUTDOWN; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfViewSchemaResolve.txt b/database/hsqldb/testrun/hsqldb/TestSelfViewSchemaResolve.txt deleted file mode 100644 index 2a4f4f5f..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfViewSchemaResolve.txt +++ /dev/null @@ -1,96 +0,0 @@ -/*s*/DROP SCHEMA alts CASCADE; -CREATE SCHEMA alts AUTHORIZATION dba; -DROP VIEW v1 IF EXISTS; -DROP VIEW v2 IF EXISTS; -DROP VIEW v3 IF EXISTS; -DROP VIEW v4 IF EXISTS; -DROP VIEW v5 IF EXISTS; -DROP VIEW v6 IF EXISTS; -DROP VIEW v7 IF EXISTS; -DROP VIEW v8 IF EXISTS; -DROP TABLE t1 IF EXISTS; -DROP TABLE t2 IF EXISTS; -DROP TABLE t3 IF EXISTS; -DROP TABLE t4 IF EXISTS; -CREATE TABLE t1(t1c1 int, t1c2 int); -CREATE TABLE t2(t2c1 int, t2c2 int); -CREATE TABLE t3(c1 int, c2 int); -CREATE TABLE t4(c1 int, c2 int); -/*u1*/INSERT INTO t1 VALUES(1, 11); -/*u1*/INSERT INTO t2 VALUES(2, 12); -/*u1*/INSERT INTO t3 VALUES(3, 13); -/*u1*/INSERT INTO t4 VALUES(4, 14); - -/*u0*/CREATE VIEW public.v1 AS SELECT * FROM t1; -/*u0*/CREATE VIEW public.v2 AS SELECT * FROM t2; -/*u0*/CREATE VIEW public.v3 AS SELECT * FROM t3; -/*u0*/CREATE VIEW public.v4 AS SELECT * FROM t4; -/*u0*/CREATE VIEW public.v5 (vc1, vc2) AS SELECT * FROM t1; -/*u0*/CREATE VIEW public.v6 (vc1, vc2) AS SELECT * FROM t2; -/*u0*/CREATE VIEW public.v7 (vc1, vc2) AS SELECT * FROM t3; -/*u0*/CREATE VIEW public.v8 (vc1, vc2) AS SELECT * FROM t4; - -/*r1,11*/SELECT t1c1, t1c2 FROM v1; -/*r2,12*/SELECT t2c1, t2c2 FROM v2; -/*r3,13*/SELECT c1, c2 FROM v3; -/*r4,14*/SELECT c1, c2 FROM v4; -/*r1,11*/SELECT vc1, vc2 FROM v5; -/*r2,12*/SELECT vc1, vc2 FROM v6; -/*r3,13*/SELECT vc1, vc2 FROM v7; -/*r4,14*/SELECT vc1, vc2 FROM v8; - -SET SCHEMA alts; -/*e*/SELECT t1c1, t1c2 FROM v1; -/*e*/SELECT t2c1, t2c2 FROM v2; -/*e*/SELECT c1, c2 FROM v3; -/*e*/SELECT c1, c2 FROM v4; -/*e*/SELECT vc1, vc2 FROM v5; -/*e*/SELECT vc1, vc2 FROM v6; -/*e*/SELECT vc1, vc2 FROM v7; -/*e*/SELECT vc1, vc2 FROM v8; -/*r1,11*/SELECT t1c1, t1c2 FROM public.v1; -/*r2,12*/SELECT t2c1, t2c2 FROM public.v2; -/*r3,13*/SELECT c1, c2 FROM public.v3; -/*r4,14*/SELECT c1, c2 FROM public.v4; -/*r1,11*/SELECT vc1, vc2 FROM public.v5; -/*r2,12*/SELECT vc1, vc2 FROM public.v6; -/*r3,13*/SELECT vc1, vc2 FROM public.v7; -/*r4,14*/SELECT vc1, vc2 FROM public.v8; -CREATE INDEX i1 ON public.t1(t1c1); -CREATE INDEX i2 ON public.t2(t2c1); -CREATE INDEX i3 ON public.t3(c1); -CREATE INDEX i4 ON public.t4(c1); -/*e*/SELECT t1c1, t1c2 FROM v1; -/*e*/SELECT t2c1, t2c2 FROM v2; -/*e*/SELECT c1, c2 FROM v3; -/*e*/SELECT c1, c2 FROM v4; -/*e*/SELECT vc1, vc2 FROM v5; -/*e*/SELECT vc1, vc2 FROM v6; -/*e*/SELECT vc1, vc2 FROM v7; -/*e*/SELECT vc1, vc2 FROM v8; -/*r1,11*/SELECT t1c1, t1c2 FROM public.v1; -/*r2,12*/SELECT t2c1, t2c2 FROM public.v2; -/*r3,13*/SELECT c1, c2 FROM public.v3; -/*r4,14*/SELECT c1, c2 FROM public.v4; -/*r1,11*/SELECT vc1, vc2 FROM public.v5; -/*r2,12*/SELECT vc1, vc2 FROM public.v6; -/*r3,13*/SELECT vc1, vc2 FROM public.v7; -/*r4,14*/SELECT vc1, vc2 FROM public.v8; - -SET SCHEMA alts; -/*e*/SELECT t1c1, t1c2 FROM v1; -/*e*/SELECT t2c1, t2c2 FROM v2; -/*e*/SELECT c1, c2 FROM v3; -/*e*/SELECT c1, c2 FROM v4; -/*e*/SELECT vc1, vc2 FROM v5; -/*e*/SELECT vc1, vc2 FROM v6; -/*e*/SELECT vc1, vc2 FROM v7; -/*e*/SELECT vc1, vc2 FROM v8; -/*r1,11*/SELECT t1c1, t1c2 FROM public.v1; -/*r2,12*/SELECT t2c1, t2c2 FROM public.v2; -/*r3,13*/SELECT c1, c2 FROM public.v3; -/*r4,14*/SELECT c1, c2 FROM public.v4; -/*r1,11*/SELECT vc1, vc2 FROM public.v5; -/*r2,12*/SELECT vc1, vc2 FROM public.v6; -/*r3,13*/SELECT vc1, vc2 FROM public.v7; -/*r4,14*/SELECT vc1, vc2 FROM public.v8; diff --git a/database/hsqldb/testrun/hsqldb/TestSelfViews.txt b/database/hsqldb/testrun/hsqldb/TestSelfViews.txt deleted file mode 100644 index 1ea4f235..00000000 --- a/database/hsqldb/testrun/hsqldb/TestSelfViews.txt +++ /dev/null @@ -1,46 +0,0 @@ -drop view v_my_server if exists; -drop table my_group if exists; -drop table dual if exists; -drop table my_server if exists; --- test subselect in view -create cached table my_group (id integer, group_id integer); -insert into my_group values (1, 1); -insert into my_group values (2, 1); -insert into my_group values (3, 1); -insert into my_group values (4, 1); -create cached table dual (a integer); -insert into dual values (0); -create cached table my_server (group_id integer, server_id integer, weight integer); -insert into my_server values (-1, 1, 1); -insert into my_server values (-1, 2, 0); -insert into my_server values (100, 11, 1); --- -CREATE VIEW v_my_server AS SELECT DISTINCT mg.id, ms.server_id, ms.weight - FROM (SELECT id, group_id FROM my_group - UNION SELECT -1, -1 FROM DUAL) mg, my_server ms - WHERE mg.group_id = ms.group_id; --- -/*c2*/select * from v_my_server; -/*c2*/select * from (select * from v_my_server); --- test view in view -drop view v_test_view if exists; -CREATE VIEW v_test_view AS SELECT a.id, b.server_id, b.weight FROM v_my_server a JOIN v_my_server b ON a.id = b.id; -/*c4*/select * from v_test_view; -/*c4*/select * from (select * from v_test_view); --- -drop table colors if exists; -create table colors(id int, val char(10)); -insert into colors values(1,'red'); -insert into colors values(2,'green'); -insert into colors values(3,'orange'); -insert into colors values(4,'indigo'); --- -drop view v_colors if exists; -create view v_colors(vid, vval) as select id, val from colors; -create view v_colors_o(vid, vval) as select id, val from colors order by id desc; -create view v_colors_o_l(vid, vval) as select id, val from colors order by id desc limit 1 offset 0; -create view v_colors_o_l_x(vid, vval) as select id, val from colors limit 1 offset 0; -/*e*/create view v_colors_o_l_x(vid, vval) as select id, val into newtable from colors; --- -/*c4*/select * from v_colors join v_test_view on server_id=vid; -/*c2*/select distinct * from v_test_view join v_colors on server_id=vid; diff --git a/database/hsqldb/testrun/hsqldb/TestText01.txt b/database/hsqldb/testrun/hsqldb/TestText01.txt deleted file mode 100644 index cfaff0c5..00000000 --- a/database/hsqldb/testrun/hsqldb/TestText01.txt +++ /dev/null @@ -1,35 +0,0 @@ --- all_quoted -drop table tmain if exists; -create table tmain(c1 varchar(10),i1 integer, c2 varchar(10)); -insert into tmain values(null, null, null); -insert into tmain values('aval1', null, 'aval2'); -drop table t if exists; -create text table t(c1 varchar(10),i1 integer, c2 varchar(10)); -set table t source "t.txt; all_quoted=true;ignore_first=true"; -set table t source header """charcol_1"",""intcol"",""charcol_2"""; -insert into t select * from tmain; --- unquoted -create table ttmain(doublequote char(10), singlequote char(10)); -insert into ttmain values('noquoteA', 'noquoteB'); -insert into ttmain values('"inch','''foot'); -insert into ttmain values('_""_','_''''_' ); -insert into ttmain values('"quoted"','''quoted'''); -insert into ttmain values('inch"','foot'''); -insert into ttmain values('"inch"','''foot'''); -create text table tt(doubquote char(10), singquote char(10)); -set table tt source "tt.txt;quoted=false;fs=\t;ignore_first=true"; -set table tt source header "DOUBQUOTE,SINGQUOTE"; -insert into tt select * from ttmain; --- identity test -drop table tident if exists; -create text table tident(c1 int generated by default as identity, c2 varchar(20)); -set table tident source "tident.txt; all_quoted=true;ignore_first=true"; -set table tident source header """IDENT"",""VAL"""; --- single column test -drop table tsingle if exists; -create text table tsingle(c1 int); -set table tsingle source "tsingle.txt;ignore_first=true"; -set table tsingle source header 'full history'; - - - diff --git a/database/hsqldb/testrun/hsqldb/TestText02.txt b/database/hsqldb/testrun/hsqldb/TestText02.txt deleted file mode 100644 index 8bff5c2e..00000000 --- a/database/hsqldb/testrun/hsqldb/TestText02.txt +++ /dev/null @@ -1,6 +0,0 @@ -/*c2*/SELECT * FROM TMAIN; -/*c0*/SELECT * FROM TMAIN EXCEPT SELECT * FROM T; -/*c0*/SELECT * FROM T EXCEPT SELECT * FROM TMAIN; -/*c6*/SELECT * FROM TTMAIN; -/*c0*/SELECT * FROM TT EXCEPT SELECT * FROM TTMAIN; -/*c0*/SELECT * FROM TTMAIN EXCEPT SELECT * FROM TT; diff --git a/database/hsqldb/testrun/hsqldb/TestTriggers.txt b/database/hsqldb/testrun/hsqldb/TestTriggers.txt deleted file mode 100644 index ffece2ad..00000000 --- a/database/hsqldb/testrun/hsqldb/TestTriggers.txt +++ /dev/null @@ -1,29 +0,0 @@ -drop table testtrig if exists cascade; -create cached table testtrig(c1 integer generated by default as identity, c2 varchar(40), c3 integer); -create trigger tbir before insert on testtrig referencing new row as newrow - for each row when (newrow.c2 is not null) - call "org.hsqldb.test.TriggerClass"; -create trigger tair after insert on testtrig referencing new row as newrow - for each row when (newrow.c2 is not null) - call "org.hsqldb.test.TriggerClass"; -create trigger tais after insert on testtrig - for each statement - call "org.hsqldb.test.TriggerClass"; -create trigger tbur before update of c1, c2, c3 on testtrig referencing new row as newrow - for each row when (newrow.c2 is not null) - call "org.hsqldb.test.TriggerClass"; -create trigger taur after update on testtrig referencing new row as newrow - for each row when (newrow.c2 is not null) - call "org.hsqldb.test.TriggerClass"; -create trigger taus after update on testtrig - for each statement - call "org.hsqldb.test.TriggerClass"; -create trigger tbdr before delete on testtrig referencing old row as oldrow - for each row when (oldrow.c2 is not null) - call "org.hsqldb.test.TriggerClass"; -create trigger tadr after delete on testtrig referencing old row as oldrow - for each row when (oldrow.c2 is not null) - call "org.hsqldb.test.TriggerClass"; -create trigger tads after delete on testtrig - for each statement - call "org.hsqldb.test.TriggerClass"; diff --git a/database/hsqldb/testrun/hsqlodbc/blobtest.py b/database/hsqldb/testrun/hsqlodbc/blobtest.py deleted file mode 100644 index 0b118ece..00000000 --- a/database/hsqldb/testrun/hsqlodbc/blobtest.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python -t - -# $Id: blobtest.py 2895 2009-03-07 19:34:26Z unsaved $ - -# Test BLOB transactions through the ODBC driver. -# Can't perform these tests with our Java unit tests, since Sun's jdbc:odbc -# driver does not support BLOB or CLOB type. - -# N.b. there is some dependency or bug which requires pyodbc to use the -# ANSI variant of the HyperSQL ODBC Driver. Using the normal Unicode -# variant will generate the following error message when you try to connect: -# pyodbc.Error: ('0', '[0] [unixODBC]c (202) (SQLDriverConnectW)') -# It is quite possible that this issue will be taken care of when we fix a -# high-priority bug to do with switching between SQLDriverConnect and -# SQLDriverConnectW on UNIX. - -# Author: Blaine Simpson (blaine dot simpson at admc dot com) - -import pyodbc - -conn = pyodbc.connect("DSN=tstdsn-a") -try: - conn.autocommit = 0 - - cursor = conn.cursor(); - - cursor.execute("DROP TABLE tsttbl IF EXISTS"); - - cursor.execute( - "CREATE TABLE tsttbl(\n" - + " id BIGINT generated BY DEFAULT AS IDENTITY,\n" - + " vc BLOB(20),\n" - + " entrytime TIMESTAMP DEFAULT current_timestamp NOT NULL\n" - + ")"); - - # First a simple/non-parameterized Insertion - #retval = cursor.execute("INSERT INTO tsttbl (id, vc) values (1, 'one')"); - #if retval != 1: - #raise Exception(('1st insertion inserted ' + repr(retval) - #+ ' rows instead of 1')) - # Now parameterized. Unfortunately, the Python DB API and pyodbc API do - # not allow re-use of a parsed statement. Cursor must be reparsed for - # each usage. - retval = cursor.execute("INSERT INTO tsttbl (id, vc) values (?, ?)", - 2, 'two'); - if retval != 1: - raise Exception(('2nd insertion inserted ' + repr(retval) - + ' rows instead of 2')) - retval = cursor.execute("INSERT INTO tsttbl (id, vc) values (?, ?)", - 3, 'three'); - if retval != 1: - raise Exception(('3rd insertion inserted ' + repr(retval) - + ' rows instead of 3')) - retval = cursor.execute("INSERT INTO tsttbl (id, vc) values (?, ?)", - 4, 'four'); - if retval != 1: - raise Exception(('4th insertion inserted ' + repr(retval) - + ' rows instead of 4')) - retval = cursor.execute("INSERT INTO tsttbl (id, vc) values (?, ?)", - 5, 'five'); - if retval != 1: - raise Exception(('5th insertion inserted ' + repr(retval) - + ' rows instead of 5')) - conn.commit(); - - # Non-parameterized query - for row in cursor.execute( - "SELECT * FROM tsttbl WHERE id < 3"): - print row - - # Non-parameterized query. As noted above, can't re-use parsed cursor. - for row in cursor.execute( - "SELECT * FROM tsttbl WHERE id > ?", 3): - # For variety, we format the files ourselves this time - print repr(row.ID) + '|' + row.VC + '|' + repr(row.ENTRYTIME) - -except Exception as e: - conn.rollback(); - raise e - -finally: - conn.close(); diff --git a/database/hsqldb/testrun/sql2nnn/00_title.sql b/database/hsqldb/testrun/sql2nnn/00_title.sql deleted file mode 100644 index 43fbe6af..00000000 --- a/database/hsqldb/testrun/sql2nnn/00_title.sql +++ /dev/null @@ -1 +0,0 @@ -select title from (values('ISO IEC 9075 feature compliance test suite')) v(title) diff --git a/database/hsqldb/testrun/sql2nnn/00_title.sql.out b/database/hsqldb/testrun/sql2nnn/00_title.sql.out deleted file mode 100644 index 7c88c7d4..00000000 --- a/database/hsqldb/testrun/sql2nnn/00_title.sql.out +++ /dev/null @@ -1,2 +0,0 @@ - TITLE -ISO IEC 9075 feature compliance test suite diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J001_Embedded_Java/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J001_Embedded_Java/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J001_Embedded_Java/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J001_Embedded_Java/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J001_Embedded_Java/package-info.java deleted file mode 100644 index 1cae76a1..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J001_Embedded_Java/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J001_Embedded_Java; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J002_ResultSetIterator_access_to_JDBC_ResultSet/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J002_ResultSetIterator_access_to_JDBC_ResultSet/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J002_ResultSetIterator_access_to_JDBC_ResultSet/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J002_ResultSetIterator_access_to_JDBC_ResultSet/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J002_ResultSetIterator_access_to_JDBC_ResultSet/package-info.java deleted file mode 100644 index e309e34c..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J002_ResultSetIterator_access_to_JDBC_ResultSet/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J002_ResultSetIterator_access_to_JDBC_ResultSet; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J003_Execution_control/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J003_Execution_control/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J003_Execution_control/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J003_Execution_control/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J003_Execution_control/package-info.java deleted file mode 100644 index b366eb11..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J003_Execution_control/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J003_Execution_control; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J004_Batch_update/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J004_Batch_update/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J004_Batch_update/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J004_Batch_update/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J004_Batch_update/package-info.java deleted file mode 100644 index 48a71e99..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J004_Batch_update/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J004_Batch_update; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J005_Call_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J005_Call_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J005_Call_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J005_Call_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J005_Call_statement/package-info.java deleted file mode 100644 index c0d6253f..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J005_Call_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J005_Call_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J006_Assignment_Function_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J006_Assignment_Function_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J006_Assignment_Function_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J006_Assignment_Function_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J006_Assignment_Function_statement/package-info.java deleted file mode 100644 index 38392b2f..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J006_Assignment_Function_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J006_Assignment_Function_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J007_Compound_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J007_Compound_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J007_Compound_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J007_Compound_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J007_Compound_statement/package-info.java deleted file mode 100644 index 98f14c54..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J007_Compound_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J007_Compound_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J008_Datalinks_via_SQL_language/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J008_Datalinks_via_SQL_language/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J008_Datalinks_via_SQL_language/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J008_Datalinks_via_SQL_language/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J008_Datalinks_via_SQL_language/package-info.java deleted file mode 100644 index a0486d39..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J008_Datalinks_via_SQL_language/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J008_Datalinks_via_SQL_language; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J009_Multiple_Open_ResultSets/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J009_Multiple_Open_ResultSets/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J009_Multiple_Open_ResultSets/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J009_Multiple_Open_ResultSets/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J009_Multiple_Open_ResultSets/package-info.java deleted file mode 100644 index 36672547..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J009_Multiple_Open_ResultSets/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J009_Multiple_Open_ResultSets; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J010_XML_via_SQL_language/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J010_XML_via_SQL_language/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J010_XML_via_SQL_language/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J010_XML_via_SQL_language/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J010_XML_via_SQL_language/package-info.java deleted file mode 100644 index 66658ce3..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/J010_XML_via_SQL_language/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings.J010_XML_via_SQL_language; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/package-info.java deleted file mode 100644 index 8caca4f1..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_10_SQLOLB_Object_Language_Bindings; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F021_Basic_information_schema/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F021_Basic_information_schema/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F021_Basic_information_schema/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F021_Basic_information_schema/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F021_Basic_information_schema/package-info.java deleted file mode 100644 index 2833b6b2..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F021_Basic_information_schema/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.F021_Basic_information_schema; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F231_Privilege_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F231_Privilege_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F231_Privilege_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F231_Privilege_tables/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F231_Privilege_tables/package-info.java deleted file mode 100644 index 9558f0fe..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F231_Privilege_tables/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.F231_Privilege_tables; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F341_Usage_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F341_Usage_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F341_Usage_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F341_Usage_tables/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F341_Usage_tables/package-info.java deleted file mode 100644 index cd613a89..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F341_Usage_tables/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.F341_Usage_tables; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F501_Features_and_conformance_views/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F501_Features_and_conformance_views/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F501_Features_and_conformance_views/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F501_Features_and_conformance_views/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F501_Features_and_conformance_views/package-info.java deleted file mode 100644 index bb6d8e0e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F501_Features_and_conformance_views/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.F501_Features_and_conformance_views; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F502_Enhanced_documentation_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F502_Enhanced_documentation_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F502_Enhanced_documentation_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F502_Enhanced_documentation_tables/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F502_Enhanced_documentation_tables/package-info.java deleted file mode 100644 index 7abfcf25..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F502_Enhanced_documentation_tables/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.F502_Enhanced_documentation_tables; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F696_Additional_translation_documentation/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F696_Additional_translation_documentation/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F696_Additional_translation_documentation/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F696_Additional_translation_documentation/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F696_Additional_translation_documentation/package-info.java deleted file mode 100644 index b055ca4a..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/F696_Additional_translation_documentation/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.F696_Additional_translation_documentation; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/S011_Distinct_data_types/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/S011_Distinct_data_types/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/S011_Distinct_data_types/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/S011_Distinct_data_types/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/S011_Distinct_data_types/package-info.java deleted file mode 100644 index 97ee4bcc..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/S011_Distinct_data_types/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.S011_Distinct_data_types; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T011_Timestamp_in_Information_Schema/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T011_Timestamp_in_Information_Schema/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T011_Timestamp_in_Information_Schema/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T011_Timestamp_in_Information_Schema/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T011_Timestamp_in_Information_Schema/package-info.java deleted file mode 100644 index 427cd4d3..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T011_Timestamp_in_Information_Schema/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.T011_Timestamp_in_Information_Schema; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T321_Basic_SQL_invoked_routines/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T321_Basic_SQL_invoked_routines/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T321_Basic_SQL_invoked_routines/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T321_Basic_SQL_invoked_routines/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T321_Basic_SQL_invoked_routines/package-info.java deleted file mode 100644 index dfdca95e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T321_Basic_SQL_invoked_routines/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.T321_Basic_SQL_invoked_routines; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T322_Declared_data_type_attributes/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T322_Declared_data_type_attributes/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T322_Declared_data_type_attributes/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T322_Declared_data_type_attributes/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T322_Declared_data_type_attributes/package-info.java deleted file mode 100644 index 445f669c..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/T322_Declared_data_type_attributes/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas.T322_Declared_data_type_attributes; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/package-info.java deleted file mode 100644 index 612d37c8..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_11_SQLSchemata_Information_and_Definition_Schemas; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J511_Commands/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J511_Commands/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J511_Commands/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J511_Commands/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J511_Commands/package-info.java deleted file mode 100644 index a0daaaa7..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J511_Commands/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J511_Commands; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J521_JDBC_data_types/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J521_JDBC_data_types/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J521_JDBC_data_types/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J521_JDBC_data_types/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J521_JDBC_data_types/package-info.java deleted file mode 100644 index db799bf2..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J521_JDBC_data_types/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J521_JDBC_data_types; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J531_Deployment/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J531_Deployment/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J531_Deployment/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J531_Deployment/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J531_Deployment/package-info.java deleted file mode 100644 index 72a7a4c4..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J531_Deployment/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J531_Deployment; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J541_SERIALIZABLE/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J541_SERIALIZABLE/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J541_SERIALIZABLE/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J541_SERIALIZABLE/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J541_SERIALIZABLE/package-info.java deleted file mode 100644 index cd5fc5da..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J541_SERIALIZABLE/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J541_SERIALIZABLE; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J551_SQLDATA/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J551_SQLDATA/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J551_SQLDATA/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J551_SQLDATA/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J551_SQLDATA/package-info.java deleted file mode 100644 index 89027e6f..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J551_SQLDATA/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J551_SQLDATA; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J561_JAR_privileges/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J561_JAR_privileges/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J561_JAR_privileges/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J561_JAR_privileges/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J561_JAR_privileges/package-info.java deleted file mode 100644 index d8a9b622..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J561_JAR_privileges/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J561_JAR_privileges; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J571_NEW_operator/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J571_NEW_operator/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J571_NEW_operator/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J571_NEW_operator/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J571_NEW_operator/package-info.java deleted file mode 100644 index 9f1adf79..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J571_NEW_operator/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J571_NEW_operator; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J581_Output_parameters/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J581_Output_parameters/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J581_Output_parameters/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J581_Output_parameters/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J581_Output_parameters/package-info.java deleted file mode 100644 index 919a462e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J581_Output_parameters/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J581_Output_parameters; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J591_Overloading/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J591_Overloading/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J591_Overloading/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J591_Overloading/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J591_Overloading/package-info.java deleted file mode 100644 index 1af92c22..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J591_Overloading/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J591_Overloading; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J601_SQL_Java_paths/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J601_SQL_Java_paths/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J601_SQL_Java_paths/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J601_SQL_Java_paths/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J601_SQL_Java_paths/package-info.java deleted file mode 100644 index 51fe8972..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J601_SQL_Java_paths/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J601_SQL_Java_paths; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J611_References/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J611_References/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J611_References/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J611_References/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J611_References/package-info.java deleted file mode 100644 index 95b32322..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J611_References/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J611_References; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J621_external_Java_routines/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J621_external_Java_routines/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J621_external_Java_routines/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J621_external_Java_routines/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J621_external_Java_routines/package-info.java deleted file mode 100644 index 6a493302..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J621_external_Java_routines/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J621_external_Java_routines; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J622_external_Java_types/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J622_external_Java_types/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J622_external_Java_types/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J622_external_Java_types/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J622_external_Java_types/package-info.java deleted file mode 100644 index de005015..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J622_external_Java_types/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J622_external_Java_types; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J631_Java_signatures/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J631_Java_signatures/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J631_Java_signatures/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J631_Java_signatures/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J631_Java_signatures/package-info.java deleted file mode 100644 index 462976f0..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J631_Java_signatures/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J631_Java_signatures; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J641_Static_fields/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J641_Static_fields/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J641_Static_fields/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J641_Static_fields/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J641_Static_fields/package-info.java deleted file mode 100644 index 49495611..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J641_Static_fields/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J641_Static_fields; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J651_SQLJRT_Information_Schema/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J651_SQLJRT_Information_Schema/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J651_SQLJRT_Information_Schema/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J651_SQLJRT_Information_Schema/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J651_SQLJRT_Information_Schema/package-info.java deleted file mode 100644 index bbad5fdc..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J651_SQLJRT_Information_Schema/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language.J651_SQLJRT_Information_Schema; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J652_SQLJRT_Usage_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J652_SQLJRT_Usage_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/J652_SQLJRT_Usage_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/package-info.java deleted file mode 100644 index 955384c2..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_13_SQLJRT_SQL_Routines_and_Types_Using_the_Java_Programming_Language; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_14_SQLXML_Extensible_Markup_Language_Related_Specifications/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_14_SQLXML_Extensible_Markup_Language_Related_Specifications/README.md deleted file mode 100644 index bdd7f2dd..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_14_SQLXML_Extensible_Markup_Language_Related_Specifications/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# SQL2NNN 9075-14 — Part 14: XML-Related Specifications (SQL/XML) -## Annex F (informative) Feature taxonomy -#### Table 16 — Feature taxonomy for optional features - -| Feature ID | Feature Name | -|------------|-----------------------------------------------------------------------------| -| X010 | XML type | -| X011 | Arrays of XML type | -| X012 | Multisets of XML type | -| X013 | Distinct types of XML type | -| X014 | Attributes of XML type | -| X015 | Fields of XML type | -| X016 | Persistent XML values | -| X020 | XMLConcat | | -| X025 | XMLCast | -| X030 | XMLDocument | -| X031 | XMLElement | -| X032 | XMLForest | -| X034 | XMLAgg | -| X035 | XMLAgg: ORDER BY option | -| X036 | XMLComment | -| X037 | XMLPI | -| X038 | XMLText | -| X040 | Basic table mapping | -| X041 | Basic table mapping: null absent | -| X042 | Basic table mapping: null as nil | -| X043 | Basic table mapping: table as forest | -| X044 | Basic table mapping: table as element | -| X045 | Basic table mapping: with target namespace | -| X046 | Basic table mapping: data mapping | -| X047 | Basic table mapping: metadata mapping | -| X048 | Basic table mapping: base64 encoding of binary strings | -| X049 | Basic table mapping: hex encoding of binary strings | -| X050 | Advanced table mapping | -| X051 | Advanced table mapping: null absent | -| X052 | Advanced table mapping: null as nil | -| X053 | Advanced table mapping: table as forest | -| X054 | Advanced table mapping: table as element | -| X055 | Advanced table mapping: with target namespace | -| X056 | Advanced table mapping: data mapping | -| X057 | Advanced table mapping: metadata mapping | -| X058 | Advanced table mapping: base64 encoding of binary strings | -| X059 | Advanced table mapping: hex encoding of binary strings | -| X060 | XMLParse: Character string input and CONTENT option | -| X061 | XMLParse: Character string input and DOCUMENT option | -| X065 | XMLParse: BLOB input and CONTENT option | -| X066 | XMLParse: BLOB input and DOCUMENT option | -| X068 | XMLSerialize: BOM | -| X069 | XMLSerialize: INDENT | -| X070 | XMLSerialize: Character string serialization and CONTENT option | -| X071 | XMLSerialize: Character string serialization and DOCUMENT option | -| X072 | XMLSerialize: Character string serialization | -| X073 | XMLSerialize: BLOB serialization and CONTENT option | -| X074 | XMLSerialize: BLOB serialization and DOCUMENT option | -| X075 | XMLSerialize: BLOB serialization | -| X076 | XMLSerialize: VERSION | -| X077 | XMLSerialize: explicit ENCODING option | -| X078 | XMLSerialize: explicit XML declaration | -| X080 | Namespaces in XML publishing | -| X081 | Query-level XML namespace declarations | -| X082 | XML namespace declarations in DML | -| X083 | XML namespace declarations in DDL | -| X084 | XML namespace declarations in compound statements | -| X085 | Predefined namespace prefixes59 X086 XML namespace declarations in XMLTable | -| X090 | XML document predicate | -| X091 | XML content predicate | -| X096 | XMLExists | -| X100 | Host language support for XML: CONTENT option | -| X101 | Host language support for XML: DOCUMENT option | -| X110 | Host language support for XML: VARCHAR mapping | -| X111 | Host language support for XML: CLOB mapping | -| X112 | Host language support for XML: BLOB mapping | -| X113 | Host language support for XML: STRIP WHITESPACE option | -| X114 | Host language support for XML: PRESERVE WHITESPACE option | -| X120 | XML parameters in SQL routines | -| X121 | XML parameters in external routines | -| X131 | Query-level XMLBINARY clause | -| X132 | XMLBINARY clause in DML | -| X133 | XMLBINARY clause in DDL | -| X134 | XMLBINARY clause in compound statements | -| X135 | XMLBINARY clause in subqueries | -| X141 | IS VALID predicate: data-driven case | -| X142 | IS VALID predicate: ACCORDING TO clause | -| X143 | IS VALID predicate: ELEMENT clause | -| X144 | IS VALID predicate: schema location | -| X145 | IS VALID predicate outside check constraints | -| X151 | IS VALID predicate with DOCUMENT option | -| X152 | IS VALID predicate with CONTENT option | -| X153 | IS VALID predicate with SEQUENCE option | -| X155 | IS VALID predicate: NAMESPACE without ELEMENT clause | -| X157 | IS VALID predicate: NO NAMESPACE with ELEMENT clause | -| X160 | Basic Information Schema for registered XML Schemas | -| X161 | Advanced Information Schema for registered XML Schemas | -| X170 | XML null handling options | -| X171 | NIL ON NO CONTENT option | -| X181 | XML(DOCUMENT(UNTYPED)) type | -| X182 | XML(DOCUMENT(ANY)) type | -| X190 | XML(SEQUENCE) type | -| X191 | XML(DOCUMENT(XMLSCHEMA)) type | -| X192 | XML(CONTENT(XMLSCHEMA)) type | -| X200 | XMLQuery | -| X201 | XMLQuery: RETURNING CONTENT | -| X202 | XMLQuery: RETURNING SEQUENCE | -| X203 | XMLQuery: passing a context item | -| X204 | XMLQuery: initializing an XQuery variable | -| X205 | XMLQuery: EMPTY ON EMPTY option | -| X206 | XMLQuery: NULL ON EMPTY option | -| X211 | XML 1.1 support | -| X221 | XML passing mechanism BY VALUE | -| X222 | XML passing mechanism BY REF | -| X231 | XML(CONTENT(UNTYPED)) type | -| X232 | XML(CONTENT(ANY)) type | -| X241 | RETURNING CONTENT in XML publishing | -| X242 | RETURNING SEQUENCE in XML publishing | -| X251 | Persistent XML values of XML(DOCUMENT(UNTYPED)) type | -| X252 | Persistent XML values of XML(DOCUMENT(ANY)) type | -| X253 | Persistent XML values of XML(CONTENT(UNTYPED)) type | -| X254 | Persistent XML values of XML(CONTENT(ANY)) type | -| X255 | Persistent XML values of XML(SEQUENCE) type | -| X256 | Persistent XML values of XML(DOCUMENT(XMLSCHEMA)) type | -| X257 | Persistent XML values of XML(CONTENT(XMLSCHEMA)) type | -| X260 | XML type: ELEMENT clause | -| X261 | XML type: NAMESPACE without ELEMENT clause | -| X263 | XML type: NO NAMESPACE with ELEMENT clause | -| X264 | XML type: schema location | -| X271 | XMLValidate: data-driven case | -| X272 | XMLValidate: ACCORDING TO clause | -| X273 | XMLValidate: ELEMENT clause | -| X274 | XMLValidate: schema location | -| X281 | XMLValidate: with DOCUMENT option | -| X282 | XMLValidate with CONTENT option | -| X283 | XMLValidate with SEQUENCE option | -| X284 | XMLValidate NAMESPACE without ELEMENT clause | -| X286 | XMLValidate: NO NAMESPACE with ELEMENT clause | -| X300 | XMLTable | -| X301 | XMLTable: derived column list option | -| X302 | XMLTable: ordinality column option | -| X303 | XMLTable: column default option | -| X304 | XMLTable: passing a context item | -| X305 | XMLTable: initializing an XQuery variable | -| X400 | Name and identifier mapping | -| X410 | Alter column data type: XML type | diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_14_SQLXML_Extensible_Markup_Language_Related_Specifications/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_14_SQLXML_Extensible_Markup_Language_Related_Specifications/package-info.java deleted file mode 100644 index 488b74ca..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_14_SQLXML_Extensible_Markup_Language_Related_Specifications/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_14_SQLXML_Extensible_Markup_Language_Related_Specifications; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B021_Direct_SQL/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B021_Direct_SQL/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B021_Direct_SQL/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B021_Direct_SQL/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B021_Direct_SQL/package-info.java deleted file mode 100644 index 669a62b7..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B021_Direct_SQL/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.B021_Direct_SQL; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B128_Routine_language_SQL/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B128_Routine_language_SQL/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B128_Routine_language_SQL/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B128_Routine_language_SQL/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B128_Routine_language_SQL/package-info.java deleted file mode 100644 index 89077c1f..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/B128_Routine_language_SQL/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.B128_Routine_language_SQL; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/C011_Call_Level_Interface/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/C011_Call_Level_Interface/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/C011_Call_Level_Interface/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/C011_Call_Level_Interface/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/C011_Call_Level_Interface/package-info.java deleted file mode 100644 index 869b03d7..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/C011_Call_Level_Interface/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.C011_Call_Level_Interface; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E011_Numeric_data_types/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E011_Numeric_data_types/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E011_Numeric_data_types/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E011_Numeric_data_types/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E011_Numeric_data_types/package-info.java deleted file mode 100644 index 42165817..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E011_Numeric_data_types/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E011_Numeric_data_types; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_data_types/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_data_types/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_data_types/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_data_types/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_data_types/package-info.java deleted file mode 100644 index 100a42a6..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_data_types/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E021_Character_data_types; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_string_types/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_string_types/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_string_types/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_string_types/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_string_types/package-info.java deleted file mode 100644 index 8b8a13e1..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E021_Character_string_types/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E021_Character_string_types; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/E031_Identifiers_03_Trailing_underscore.sql b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/E031_Identifiers_03_Trailing_underscore.sql deleted file mode 100644 index a8e09111..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/E031_Identifiers_03_Trailing_underscore.sql +++ /dev/null @@ -1,11 +0,0 @@ --- E031_Identifiers_03_Trailing_underscore.sql -DROP TABLE IF EXISTS TEST_; -CREATE TABLE TEST_(ID_ INT); -SELECT COUNT(*) AS TABLE_COUNT FROM INFORMATION_SCHEMA.TABLES T WHERE T.TABLE_SCHEMA = 'PUBLIC' AND T.TABLE_NAME = 'TEST_'; -ALTER TABLE TEST_ ADD COLUMN VALUE_ VARCHAR(255) NOT NULL; -SELECT COUNT(*) AS COLUMN_COUNT FROM INFORMATION_SCHEMA.COLUMNS T WHERE T.TABLE_SCHEMA = 'PUBLIC' AND T.TABLE_NAME = 'TEST_' AND T.COLUMN_NAME = 'VALUE_'; -ALTER TABLE TEST_ DROP COLUMN VALUE_; -SELECT COUNT(*) AS COLUMN_COUNT FROM INFORMATION_SCHEMA.COLUMNS T WHERE T.TABLE_SCHEMA = 'PUBLIC' AND T.TABLE_NAME = 'TEST_' AND T.COLUMN_NAME = 'VALUE_'; -DROP TABLE TEST_; -SELECT COUNT(*) AS TABLE_COUNT FROM INFORMATION_SCHEMA.TABLES T WHERE T.TABLE_SCHEMA = 'PUBLIC' AND T.TABLE_NAME = 'TEST_'; - diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/E031_Identifiers_03_Trailing_underscore.sql.out b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/E031_Identifiers_03_Trailing_underscore.sql.out deleted file mode 100644 index 0b5a304f..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/E031_Identifiers_03_Trailing_underscore.sql.out +++ /dev/null @@ -1,13 +0,0 @@ -update count: 0 -update count: 0 - TABLE_COUNT - 1 -update count: 0 - COLUMN_COUNT - 1 -update count: 0 - COLUMN_COUNT - 0 -update count: 0 - TABLE_COUNT - 0 diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/package-info.java deleted file mode 100644 index c738eff5..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E031_identifiers/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E031_identifiers; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E051_Basic_query_specification/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E051_Basic_query_specification/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E051_Basic_query_specification/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E051_Basic_query_specification/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E051_Basic_query_specification/package-info.java deleted file mode 100644 index e8fa2f62..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E051_Basic_query_specification/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E051_Basic_query_specification; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E061_Basic_predicates_and_search_conditions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E061_Basic_predicates_and_search_conditions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E061_Basic_predicates_and_search_conditions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E061_Basic_predicates_and_search_conditions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E061_Basic_predicates_and_search_conditions/package-info.java deleted file mode 100644 index 94d841f3..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E061_Basic_predicates_and_search_conditions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E061_Basic_predicates_and_search_conditions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E071_Basic_query_expressions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E071_Basic_query_expressions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E071_Basic_query_expressions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E071_Basic_query_expressions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E071_Basic_query_expressions/package-info.java deleted file mode 100644 index d5fde3d6..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E071_Basic_query_expressions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E071_Basic_query_expressions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E081_Basic_Privileges/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E081_Basic_Privileges/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E081_Basic_Privileges/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E081_Basic_Privileges/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E081_Basic_Privileges/package-info.java deleted file mode 100644 index 606a6fa3..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E081_Basic_Privileges/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E081_Basic_Privileges; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E091_Set_functions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E091_Set_functions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E091_Set_functions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E091_Set_functions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E091_Set_functions/package-info.java deleted file mode 100644 index bdc13c00..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E091_Set_functions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E091_Set_functions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E101_Basic_data_manipulation/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E101_Basic_data_manipulation/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E101_Basic_data_manipulation/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E101_Basic_data_manipulation/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E101_Basic_data_manipulation/package-info.java deleted file mode 100644 index 40bbd71b..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E101_Basic_data_manipulation/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E101_Basic_data_manipulation; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E111_Single_row_SELECT_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E111_Single_row_SELECT_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E111_Single_row_SELECT_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E111_Single_row_SELECT_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E111_Single_row_SELECT_statement/package-info.java deleted file mode 100644 index 1b566b88..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E111_Single_row_SELECT_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E111_Single_row_SELECT_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E121_Basic_cursor_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E121_Basic_cursor_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E121_Basic_cursor_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E121_Basic_cursor_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E121_Basic_cursor_support/package-info.java deleted file mode 100644 index 41a94b2b..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E121_Basic_cursor_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E121_Basic_cursor_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E131_Null_value_support_nulls_in_lieu_of_values/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E131_Null_value_support_nulls_in_lieu_of_values/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E131_Null_value_support_nulls_in_lieu_of_values/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E131_Null_value_support_nulls_in_lieu_of_values/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E131_Null_value_support_nulls_in_lieu_of_values/package-info.java deleted file mode 100644 index 0ea771dc..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E131_Null_value_support_nulls_in_lieu_of_values/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E131_Null_value_support_nulls_in_lieu_of_values; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E141_Basic_integrity_constraints/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E141_Basic_integrity_constraints/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E141_Basic_integrity_constraints/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E141_Basic_integrity_constraints/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E141_Basic_integrity_constraints/package-info.java deleted file mode 100644 index 4aafb074..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E141_Basic_integrity_constraints/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E141_Basic_integrity_constraints; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E151_Transaction_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E151_Transaction_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E151_Transaction_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E151_Transaction_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E151_Transaction_support/package-info.java deleted file mode 100644 index c3c904f2..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E151_Transaction_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E151_Transaction_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E152_Basic_SET_TRANSACTION_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E152_Basic_SET_TRANSACTION_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E152_Basic_SET_TRANSACTION_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E152_Basic_SET_TRANSACTION_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E152_Basic_SET_TRANSACTION_statement/package-info.java deleted file mode 100644 index 81c0c427..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E152_Basic_SET_TRANSACTION_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E152_Basic_SET_TRANSACTION_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E153_Updatable_queries_with_subqueries/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E153_Updatable_queries_with_subqueries/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E153_Updatable_queries_with_subqueries/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E153_Updatable_queries_with_subqueries/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E153_Updatable_queries_with_subqueries/package-info.java deleted file mode 100644 index b25c70f7..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E153_Updatable_queries_with_subqueries/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E153_Updatable_queries_with_subqueries; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E161_SQL_comments_using_leading_double_minus/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E161_SQL_comments_using_leading_double_minus/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E161_SQL_comments_using_leading_double_minus/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E161_SQL_comments_using_leading_double_minus/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E161_SQL_comments_using_leading_double_minus/package-info.java deleted file mode 100644 index 430c2ccb..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E161_SQL_comments_using_leading_double_minus/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E161_SQL_comments_using_leading_double_minus; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E171_SQLSTATE_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E171_SQLSTATE_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E171_SQLSTATE_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E171_SQLSTATE_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E171_SQLSTATE_support/package-info.java deleted file mode 100644 index d6877cf3..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E171_SQLSTATE_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E171_SQLSTATE_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E182_Host_language_binding/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E182_Host_language_binding/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E182_Host_language_binding/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E182_Host_language_binding/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E182_Host_language_binding/package-info.java deleted file mode 100644 index a85e3ae4..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/E182_Host_language_binding/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.E182_Host_language_binding; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F031_Basic_schema_manipulation/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F031_Basic_schema_manipulation/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F031_Basic_schema_manipulation/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F031_Basic_schema_manipulation/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F031_Basic_schema_manipulation/package-info.java deleted file mode 100644 index 3496eb8c..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F031_Basic_schema_manipulation/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F031_Basic_schema_manipulation; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F032_CASCADE_drop_behavior/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F032_CASCADE_drop_behavior/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F032_CASCADE_drop_behavior/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F032_CASCADE_drop_behavior/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F032_CASCADE_drop_behavior/package-info.java deleted file mode 100644 index 07aadba3..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F032_CASCADE_drop_behavior/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F032_CASCADE_drop_behavior; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F033_ALTER_TABLE_statement_DROP_COLUMN_clause/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F033_ALTER_TABLE_statement_DROP_COLUMN_clause/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F033_ALTER_TABLE_statement_DROP_COLUMN_clause/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F033_ALTER_TABLE_statement_DROP_COLUMN_clause/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F033_ALTER_TABLE_statement_DROP_COLUMN_clause/package-info.java deleted file mode 100644 index 25dc3117..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F033_ALTER_TABLE_statement_DROP_COLUMN_clause/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F033_ALTER_TABLE_statement_DROP_COLUMN_clause; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F034_Extended_REVOKE_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F034_Extended_REVOKE_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F034_Extended_REVOKE_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F034_Extended_REVOKE_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F034_Extended_REVOKE_statement/package-info.java deleted file mode 100644 index 3c4d9c69..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F034_Extended_REVOKE_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F034_Extended_REVOKE_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F041_Basic_joined_table/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F041_Basic_joined_table/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F041_Basic_joined_table/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F041_Basic_joined_table/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F041_Basic_joined_table/package-info.java deleted file mode 100644 index 4cdbf10e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F041_Basic_joined_table/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F041_Basic_joined_table; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F051_Basic_date_and_time/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F051_Basic_date_and_time/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F051_Basic_date_and_time/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F051_Basic_date_and_time/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F051_Basic_date_and_time/package-info.java deleted file mode 100644 index 3c6d40ad..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F051_Basic_date_and_time/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F051_Basic_date_and_time; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F052_Intervals_and_datetime_arithmetic/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F052_Intervals_and_datetime_arithmetic/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F052_Intervals_and_datetime_arithmetic/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F052_Intervals_and_datetime_arithmetic/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F052_Intervals_and_datetime_arithmetic/package-info.java deleted file mode 100644 index f84c2938..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F052_Intervals_and_datetime_arithmetic/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F052_Intervals_and_datetime_arithmetic; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F053_OVERLAPS_predicate/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F053_OVERLAPS_predicate/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F053_OVERLAPS_predicate/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F053_OVERLAPS_predicate/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F053_OVERLAPS_predicate/package-info.java deleted file mode 100644 index e6cab3ef..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F053_OVERLAPS_predicate/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F053_OVERLAPS_predicate; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F081_UNION_and_EXCEPT_in_views/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F081_UNION_and_EXCEPT_in_views/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F081_UNION_and_EXCEPT_in_views/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F081_UNION_and_EXCEPT_in_views/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F081_UNION_and_EXCEPT_in_views/package-info.java deleted file mode 100644 index 6357d02e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F081_UNION_and_EXCEPT_in_views/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F081_UNION_and_EXCEPT_in_views; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F111_Isolation_levels_other_than_SERIALIZABLE/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F111_Isolation_levels_other_than_SERIALIZABLE/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F111_Isolation_levels_other_than_SERIALIZABLE/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F111_Isolation_levels_other_than_SERIALIZABLE/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F111_Isolation_levels_other_than_SERIALIZABLE/package-info.java deleted file mode 100644 index 81883f3e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F111_Isolation_levels_other_than_SERIALIZABLE/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F111_Isolation_levels_other_than_SERIALIZABLE; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F121_Basic_diagnostics_management/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F121_Basic_diagnostics_management/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F121_Basic_diagnostics_management/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F121_Basic_diagnostics_management/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F121_Basic_diagnostics_management/package-info.java deleted file mode 100644 index bcedd411..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F121_Basic_diagnostics_management/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F121_Basic_diagnostics_management; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F131_Grouped_operations/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F131_Grouped_operations/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F131_Grouped_operations/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F131_Grouped_operations/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F131_Grouped_operations/package-info.java deleted file mode 100644 index a8230c75..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F131_Grouped_operations/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F131_Grouped_operations; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F171_Multiple_schemas_per_user/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F171_Multiple_schemas_per_user/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F171_Multiple_schemas_per_user/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F171_Multiple_schemas_per_user/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F171_Multiple_schemas_per_user/package-info.java deleted file mode 100644 index 7b651404..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F171_Multiple_schemas_per_user/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F171_Multiple_schemas_per_user; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F191_Referential_delete_actions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F191_Referential_delete_actions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F191_Referential_delete_actions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F191_Referential_delete_actions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F191_Referential_delete_actions/package-info.java deleted file mode 100644 index 7c50e836..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F191_Referential_delete_actions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F191_Referential_delete_actions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F201_CAST_function/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F201_CAST_function/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F201_CAST_function/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F201_CAST_function/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F201_CAST_function/package-info.java deleted file mode 100644 index 5fea284c..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F201_CAST_function/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F201_CAST_function; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F221_Explicit_defaults/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F221_Explicit_defaults/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F221_Explicit_defaults/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F221_Explicit_defaults/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F221_Explicit_defaults/package-info.java deleted file mode 100644 index 6000758e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F221_Explicit_defaults/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F221_Explicit_defaults; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F222_INSERT_statement_DEFAULT_VALUES_clause/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F222_INSERT_statement_DEFAULT_VALUES_clause/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F222_INSERT_statement_DEFAULT_VALUES_clause/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F222_INSERT_statement_DEFAULT_VALUES_clause/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F222_INSERT_statement_DEFAULT_VALUES_clause/package-info.java deleted file mode 100644 index 3c68b27d..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F222_INSERT_statement_DEFAULT_VALUES_clause/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F222_INSERT_statement_DEFAULT_VALUES_clause; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F231_Privilege_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F231_Privilege_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F231_Privilege_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F231_Privilege_tables/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F231_Privilege_tables/package-info.java deleted file mode 100644 index f185f6a8..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F231_Privilege_tables/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F231_Privilege_tables; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F251_Domain_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F251_Domain_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F251_Domain_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F251_Domain_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F251_Domain_support/package-info.java deleted file mode 100644 index e7748132..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F251_Domain_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F251_Domain_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F261_CASE_expression/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F261_CASE_expression/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F261_CASE_expression/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F261_CASE_expression/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F261_CASE_expression/package-info.java deleted file mode 100644 index 4a581863..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F261_CASE_expression/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F261_CASE_expression; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F262_Extended_CASE_expression/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F262_Extended_CASE_expression/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F262_Extended_CASE_expression/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F262_Extended_CASE_expression/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F262_Extended_CASE_expression/package-info.java deleted file mode 100644 index 8c8e6e94..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F262_Extended_CASE_expression/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F262_Extended_CASE_expression; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F263_Comma_separated_predicates_in_simple_CASE_expression/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F263_Comma_separated_predicates_in_simple_CASE_expression/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F263_Comma_separated_predicates_in_simple_CASE_expression/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F263_Comma_separated_predicates_in_simple_CASE_expression/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F263_Comma_separated_predicates_in_simple_CASE_expression/package-info.java deleted file mode 100644 index fcefa905..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F263_Comma_separated_predicates_in_simple_CASE_expression/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F263_Comma_separated_predicates_in_simple_CASE_expression; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F271_Compound_character_literals/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F271_Compound_character_literals/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F271_Compound_character_literals/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F271_Compound_character_literals/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F271_Compound_character_literals/package-info.java deleted file mode 100644 index e77d4545..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F271_Compound_character_literals/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F271_Compound_character_literals; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F281_LIKE_enhancements/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F281_LIKE_enhancements/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F281_LIKE_enhancements/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F281_LIKE_enhancements/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F281_LIKE_enhancements/package-info.java deleted file mode 100644 index 1d4e02da..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F281_LIKE_enhancements/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F281_LIKE_enhancements; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F291_UNIQUE_predicate/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F291_UNIQUE_predicate/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F291_UNIQUE_predicate/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F291_UNIQUE_predicate/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F291_UNIQUE_predicate/package-info.java deleted file mode 100644 index fd11546b..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F291_UNIQUE_predicate/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F291_UNIQUE_predicate; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F301_CORRESPONDING_in_query_expressions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F301_CORRESPONDING_in_query_expressions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F301_CORRESPONDING_in_query_expressions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F301_CORRESPONDING_in_query_expressions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F301_CORRESPONDING_in_query_expressions/package-info.java deleted file mode 100644 index 483d324e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F301_CORRESPONDING_in_query_expressions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F301_CORRESPONDING_in_query_expressions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F302_INTERSECT_table_operator/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F302_INTERSECT_table_operator/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F302_INTERSECT_table_operator/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F302_INTERSECT_table_operator/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F302_INTERSECT_table_operator/package-info.java deleted file mode 100644 index f8b541c3..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F302_INTERSECT_table_operator/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F302_INTERSECT_table_operator; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F304_EXCEPT_ALL_table_operator/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F304_EXCEPT_ALL_table_operator/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F304_EXCEPT_ALL_table_operator/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F304_EXCEPT_ALL_table_operator/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F304_EXCEPT_ALL_table_operator/package-info.java deleted file mode 100644 index f10f88e7..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F304_EXCEPT_ALL_table_operator/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F304_EXCEPT_ALL_table_operator; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F311_Schema_definition_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F311_Schema_definition_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F311_Schema_definition_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F311_Schema_definition_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F311_Schema_definition_statement/package-info.java deleted file mode 100644 index 491f5580..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F311_Schema_definition_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F311_Schema_definition_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F312_MERGE_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F312_MERGE_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F312_MERGE_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F312_MERGE_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F312_MERGE_statement/package-info.java deleted file mode 100644 index 4424aa9d..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F312_MERGE_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F312_MERGE_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F321_User_authorization/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F321_User_authorization/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F321_User_authorization/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F321_User_authorization/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F321_User_authorization/package-info.java deleted file mode 100644 index 01174ed0..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F321_User_authorization/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F321_User_authorization; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F361_Subprogram_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F361_Subprogram_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F361_Subprogram_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F361_Subprogram_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F361_Subprogram_support/package-info.java deleted file mode 100644 index 15da3c2b..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F361_Subprogram_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F361_Subprogram_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F381_Extended_schema_manipulation/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F381_Extended_schema_manipulation/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F381_Extended_schema_manipulation/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F381_Extended_schema_manipulation/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F381_Extended_schema_manipulation/package-info.java deleted file mode 100644 index 206d233a..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F381_Extended_schema_manipulation/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F381_Extended_schema_manipulation; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F391_Long_identifiers/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F391_Long_identifiers/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F391_Long_identifiers/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F391_Long_identifiers/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F391_Long_identifiers/package-info.java deleted file mode 100644 index a8637c20..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F391_Long_identifiers/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F391_Long_identifiers; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F392_Unicode_escapes_in_identifiers/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F392_Unicode_escapes_in_identifiers/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F392_Unicode_escapes_in_identifiers/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F392_Unicode_escapes_in_identifiers/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F392_Unicode_escapes_in_identifiers/package-info.java deleted file mode 100644 index 06837472..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F392_Unicode_escapes_in_identifiers/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F392_Unicode_escapes_in_identifiers; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F393_Unicode_escapes_in_literals/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F393_Unicode_escapes_in_literals/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F393_Unicode_escapes_in_literals/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F393_Unicode_escapes_in_literals/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F393_Unicode_escapes_in_literals/package-info.java deleted file mode 100644 index 57178095..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F393_Unicode_escapes_in_literals/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F393_Unicode_escapes_in_literals; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F401_Extended_joined_table/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F401_Extended_joined_table/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F401_Extended_joined_table/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F401_Extended_joined_table/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F401_Extended_joined_table/package-info.java deleted file mode 100644 index 0c332659..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F401_Extended_joined_table/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F401_Extended_joined_table; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F402_Named_column_joins_for_LOBs_arrays_and_multisets/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F402_Named_column_joins_for_LOBs_arrays_and_multisets/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F402_Named_column_joins_for_LOBs_arrays_and_multisets/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F402_Named_column_joins_for_LOBs_arrays_and_multisets/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F402_Named_column_joins_for_LOBs_arrays_and_multisets/package-info.java deleted file mode 100644 index d49e7fde..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F402_Named_column_joins_for_LOBs_arrays_and_multisets/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F402_Named_column_joins_for_LOBs_arrays_and_multisets; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F411_Time_zone_specification/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F411_Time_zone_specification/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F411_Time_zone_specification/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F411_Time_zone_specification/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F411_Time_zone_specification/package-info.java deleted file mode 100644 index 0188da38..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F411_Time_zone_specification/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F411_Time_zone_specification; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F421_National_character/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F421_National_character/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F421_National_character/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F421_National_character/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F421_National_character/package-info.java deleted file mode 100644 index 22b68188..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F421_National_character/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F421_National_character; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F441_Extended_set_function_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F441_Extended_set_function_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F441_Extended_set_function_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F441_Extended_set_function_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F441_Extended_set_function_support/package-info.java deleted file mode 100644 index 6903d350..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F441_Extended_set_function_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F441_Extended_set_function_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F442_Mixed_column_references_in_set_functions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F442_Mixed_column_references_in_set_functions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F442_Mixed_column_references_in_set_functions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F442_Mixed_column_references_in_set_functions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F442_Mixed_column_references_in_set_functions/package-info.java deleted file mode 100644 index dabbbadf..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F442_Mixed_column_references_in_set_functions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F442_Mixed_column_references_in_set_functions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F451_Character_set_definition/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F451_Character_set_definition/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F451_Character_set_definition/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F451_Character_set_definition/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F451_Character_set_definition/package-info.java deleted file mode 100644 index 61cb1947..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F451_Character_set_definition/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F451_Character_set_definition; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F461_Named_character_sets/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F461_Named_character_sets/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F461_Named_character_sets/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F461_Named_character_sets/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F461_Named_character_sets/package-info.java deleted file mode 100644 index 0524c739..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F461_Named_character_sets/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F461_Named_character_sets; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F471_Scalar_subquery_values/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F471_Scalar_subquery_values/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F471_Scalar_subquery_values/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F471_Scalar_subquery_values/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F471_Scalar_subquery_values/package-info.java deleted file mode 100644 index f5d1c7ce..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F471_Scalar_subquery_values/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F471_Scalar_subquery_values; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F481_Expanded_NULL_predicate/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F481_Expanded_NULL_predicate/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F481_Expanded_NULL_predicate/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F481_Expanded_NULL_predicate/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F481_Expanded_NULL_predicate/package-info.java deleted file mode 100644 index 1e62131a..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F481_Expanded_NULL_predicate/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F481_Expanded_NULL_predicate; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F491_Constraint_management/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F491_Constraint_management/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F491_Constraint_management/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F491_Constraint_management/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F491_Constraint_management/package-info.java deleted file mode 100644 index 5dcee3c8..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F491_Constraint_management/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F491_Constraint_management; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F531_Temporary_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F531_Temporary_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F531_Temporary_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F531_Temporary_tables/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F531_Temporary_tables/package-info.java deleted file mode 100644 index 7c459932..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F531_Temporary_tables/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F531_Temporary_tables; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F555_Enhanced_seconds_precision/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F555_Enhanced_seconds_precision/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F555_Enhanced_seconds_precision/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F555_Enhanced_seconds_precision/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F555_Enhanced_seconds_precision/package-info.java deleted file mode 100644 index 2544bea1..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F555_Enhanced_seconds_precision/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F555_Enhanced_seconds_precision; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F561_Full_value_expressions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F561_Full_value_expressions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F561_Full_value_expressions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F561_Full_value_expressions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F561_Full_value_expressions/package-info.java deleted file mode 100644 index e0e40e13..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F561_Full_value_expressions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F561_Full_value_expressions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F571_Truth_value_tests/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F571_Truth_value_tests/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F571_Truth_value_tests/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F571_Truth_value_tests/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F571_Truth_value_tests/package-info.java deleted file mode 100644 index d57029fd..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F571_Truth_value_tests/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F571_Truth_value_tests; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F591_Derived_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F591_Derived_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F591_Derived_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F591_Derived_tables/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F591_Derived_tables/package-info.java deleted file mode 100644 index ceb7a6c2..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F591_Derived_tables/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F591_Derived_tables; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F641_Row_and_table_constructors/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F641_Row_and_table_constructors/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F641_Row_and_table_constructors/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F641_Row_and_table_constructors/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F641_Row_and_table_constructors/package-info.java deleted file mode 100644 index b6ee9cb5..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F641_Row_and_table_constructors/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F641_Row_and_table_constructors; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F651_Catalog_name_qualifiers/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F651_Catalog_name_qualifiers/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F651_Catalog_name_qualifiers/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F651_Catalog_name_qualifiers/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F651_Catalog_name_qualifiers/package-info.java deleted file mode 100644 index c37ce06e..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F651_Catalog_name_qualifiers/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F651_Catalog_name_qualifiers; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F661_Simple_tables/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F661_Simple_tables/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F661_Simple_tables/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F661_Simple_tables/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F661_Simple_tables/package-info.java deleted file mode 100644 index 19cb8a01..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F661_Simple_tables/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F661_Simple_tables; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F672_Retrospective_check_constraints/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F672_Retrospective_check_constraints/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F672_Retrospective_check_constraints/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F672_Retrospective_check_constraints/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F672_Retrospective_check_constraints/package-info.java deleted file mode 100644 index 6699fc93..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F672_Retrospective_check_constraints/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F672_Retrospective_check_constraints; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F690_Collation_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F690_Collation_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F690_Collation_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F690_Collation_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F690_Collation_support/package-info.java deleted file mode 100644 index 1325cacf..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F690_Collation_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F690_Collation_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F692_Enhanced_collation_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F692_Enhanced_collation_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F692_Enhanced_collation_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F692_Enhanced_collation_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F692_Enhanced_collation_support/package-info.java deleted file mode 100644 index 03ee152f..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F692_Enhanced_collation_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F692_Enhanced_collation_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F701_Referential_update_actions/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F701_Referential_update_actions/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F701_Referential_update_actions/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F701_Referential_update_actions/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F701_Referential_update_actions/package-info.java deleted file mode 100644 index 6cdc8cb4..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F701_Referential_update_actions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F701_Referential_update_actions; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F711_ALTER_domain/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F711_ALTER_domain/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F711_ALTER_domain/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F711_ALTER_domain/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F711_ALTER_domain/package-info.java deleted file mode 100644 index ffdc7061..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F711_ALTER_domain/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F711_ALTER_domain; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F731_INSERT_column_privileges/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F731_INSERT_column_privileges/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F731_INSERT_column_privileges/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F731_INSERT_column_privileges/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F731_INSERT_column_privileges/package-info.java deleted file mode 100644 index 65ad2718..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F731_INSERT_column_privileges/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F731_INSERT_column_privileges; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F741_Referential_MATCH_types/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F741_Referential_MATCH_types/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F741_Referential_MATCH_types/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F741_Referential_MATCH_types/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F741_Referential_MATCH_types/package-info.java deleted file mode 100644 index 58403a0f..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F741_Referential_MATCH_types/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F741_Referential_MATCH_types; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F751_View_CHECK_enhancements/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F751_View_CHECK_enhancements/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F751_View_CHECK_enhancements/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F751_View_CHECK_enhancements/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F751_View_CHECK_enhancements/package-info.java deleted file mode 100644 index 3a6286ca..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F751_View_CHECK_enhancements/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F751_View_CHECK_enhancements; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F762_CURRENT_CATALOG/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F762_CURRENT_CATALOG/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F762_CURRENT_CATALOG/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F762_CURRENT_CATALOG/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F762_CURRENT_CATALOG/package-info.java deleted file mode 100644 index 08e7a54d..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F762_CURRENT_CATALOG/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F762_CURRENT_CATALOG; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F763_CURRENT_SCHEMA/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F763_CURRENT_SCHEMA/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F763_CURRENT_SCHEMA/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F763_CURRENT_SCHEMA/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F763_CURRENT_SCHEMA/package-info.java deleted file mode 100644 index d421c207..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F763_CURRENT_SCHEMA/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F763_CURRENT_SCHEMA; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F801_Full_set_function/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F801_Full_set_function/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F801_Full_set_function/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F801_Full_set_function/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F801_Full_set_function/package-info.java deleted file mode 100644 index 51be8daf..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F801_Full_set_function/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F801_Full_set_function; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F821_Local_table_references/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F821_Local_table_references/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F821_Local_table_references/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F821_Local_table_references/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F821_Local_table_references/package-info.java deleted file mode 100644 index 51d34406..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F821_Local_table_references/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F821_Local_table_references; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F850_Top_level_order_by_clause_in_query_expression/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F850_Top_level_order_by_clause_in_query_expression/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F850_Top_level_order_by_clause_in_query_expression/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F850_Top_level_order_by_clause_in_query_expression/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F850_Top_level_order_by_clause_in_query_expression/package-info.java deleted file mode 100644 index 3fc95d89..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F850_Top_level_order_by_clause_in_query_expression/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F850_Top_level_order_by_clause_in_query_expression; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F851_order_by_clause_in_subqueries/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F851_order_by_clause_in_subqueries/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F851_order_by_clause_in_subqueries/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F851_order_by_clause_in_subqueries/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F851_order_by_clause_in_subqueries/package-info.java deleted file mode 100644 index 259d5c37..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F851_order_by_clause_in_subqueries/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F851_order_by_clause_in_subqueries; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F852_Top_level_order_by_clause_in_views/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F852_Top_level_order_by_clause_in_views/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F852_Top_level_order_by_clause_in_views/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F852_Top_level_order_by_clause_in_views/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F852_Top_level_order_by_clause_in_views/package-info.java deleted file mode 100644 index 399fcef0..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F852_Top_level_order_by_clause_in_views/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F852_Top_level_order_by_clause_in_views; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F855_Nested_order_by_clause_in_query_expression/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F855_Nested_order_by_clause_in_query_expression/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F855_Nested_order_by_clause_in_query_expression/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F855_Nested_order_by_clause_in_query_expression/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F855_Nested_order_by_clause_in_query_expression/package-info.java deleted file mode 100644 index b7a3d3be..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F855_Nested_order_by_clause_in_query_expression/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F855_Nested_order_by_clause_in_query_expression; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F856_Nested_fetch_first_clause_in_query_expression/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F856_Nested_fetch_first_clause_in_query_expression/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F856_Nested_fetch_first_clause_in_query_expression/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F856_Nested_fetch_first_clause_in_query_expression/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F856_Nested_fetch_first_clause_in_query_expression/package-info.java deleted file mode 100644 index de705539..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F856_Nested_fetch_first_clause_in_query_expression/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F856_Nested_fetch_first_clause_in_query_expression; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F857_Top_level_fetch_first_clause_in_query_expression/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F857_Top_level_fetch_first_clause_in_query_expression/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F857_Top_level_fetch_first_clause_in_query_expression/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F857_Top_level_fetch_first_clause_in_query_expression/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F857_Top_level_fetch_first_clause_in_query_expression/package-info.java deleted file mode 100644 index 3b6fb209..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/F857_Top_level_fetch_first_clause_in_query_expression/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation.F857_Top_level_fetch_first_clause_in_query_expression; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/package-info.java deleted file mode 100644 index 0e1049d8..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_2_SQL_Foundation/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_2_SQL_Foundation; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/C011_All_facilities_defined_by this_part_of_9075/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/C011_All_facilities_defined_by this_part_of_9075/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/C011_All_facilities_defined_by this_part_of_9075/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/package-info.java deleted file mode 100644 index bffc5dcd..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_3_SQLCLI_Call_Level_Interface/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_3_SQLCLI_Call_Level_Interface; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P001_Stored_modules/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P001_Stored_modules/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P001_Stored_modules/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P001_Stored_modules/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P001_Stored_modules/package-info.java deleted file mode 100644 index 23365973..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P001_Stored_modules/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P001_Stored_modules; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P002_Computational_completeness/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P002_Computational_completeness/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P002_Computational_completeness/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P002_Computational_completeness/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P002_Computational_completeness/package-info.java deleted file mode 100644 index c1ca871c..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P002_Computational_completeness/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P002_Computational_completeness; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P003_Information_Schema_views/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P003_Information_Schema_views/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P003_Information_Schema_views/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P003_Information_Schema_views/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P003_Information_Schema_views/package-info.java deleted file mode 100644 index 97d0cb12..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P003_Information_Schema_views/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P003_Information_Schema_views; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P004_Extended_CASE_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P004_Extended_CASE_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P004_Extended_CASE_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P004_Extended_CASE_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P004_Extended_CASE_statement/package-info.java deleted file mode 100644 index bbe17f12..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P004_Extended_CASE_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P004_Extended_CASE_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P005_Qualified_SQL_variable_references/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P005_Qualified_SQL_variable_references/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P005_Qualified_SQL_variable_references/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P005_Qualified_SQL_variable_references/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P005_Qualified_SQL_variable_references/package-info.java deleted file mode 100644 index 4a28dc22..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P005_Qualified_SQL_variable_references/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P005_Qualified_SQL_variable_references; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P006_Multiple_assignment/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P006_Multiple_assignment/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P006_Multiple_assignment/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P006_Multiple_assignment/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P006_Multiple_assignment/package-info.java deleted file mode 100644 index 3adf5847..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P006_Multiple_assignment/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P006_Multiple_assignment; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P007_Enhanced_diagnostics_management/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P007_Enhanced_diagnostics_management/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P007_Enhanced_diagnostics_management/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P007_Enhanced_diagnostics_management/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P007_Enhanced_diagnostics_management/package-info.java deleted file mode 100644 index fe7e7996..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P007_Enhanced_diagnostics_management/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P007_Enhanced_diagnostics_management; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P008_Commas_separated_predicates_in_a_CASE_statement/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P008_Commas_separated_predicates_in_a_CASE_statement/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P008_Commas_separated_predicates_in_a_CASE_statement/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P008_Commas_separated_predicates_in_a_CASE_statement/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P008_Commas_separated_predicates_in_a_CASE_statement/package-info.java deleted file mode 100644 index 990fb1c4..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/P008_Commas_separated_predicates_in_a_CASE_statement/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules.P008_Commas_separated_predicates_in_a_CASE_statement; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/package-info.java deleted file mode 100644 index 5d4af0bf..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_4_SQLPSM_Persistent_Stored_Modules; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M001_Datalinks/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M001_Datalinks/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M001_Datalinks/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M001_Datalinks/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M001_Datalinks/package-info.java deleted file mode 100644 index 35f4f421..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M001_Datalinks/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M001_Datalinks; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M002_Datalinks_via_SQLCLI/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M002_Datalinks_via_SQLCLI/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M002_Datalinks_via_SQLCLI/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M002_Datalinks_via_SQLCLI/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M002_Datalinks_via_SQLCLI/package-info.java deleted file mode 100644 index af4800c9..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M002_Datalinks_via_SQLCLI/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M002_Datalinks_via_SQLCLI; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M003_Datalinks_via_Embedded_SQL/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M003_Datalinks_via_Embedded_SQL/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M003_Datalinks_via_Embedded_SQL/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M003_Datalinks_via_Embedded_SQL/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M003_Datalinks_via_Embedded_SQL/package-info.java deleted file mode 100644 index 7bf0eab9..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M003_Datalinks_via_Embedded_SQL/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M003_Datalinks_via_Embedded_SQL; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M004_Foreign_data_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M004_Foreign_data_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M004_Foreign_data_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M004_Foreign_data_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M004_Foreign_data_support/package-info.java deleted file mode 100644 index 67577087..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M004_Foreign_data_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M004_Foreign_data_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M005_Foreign_schema_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M005_Foreign_schema_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M005_Foreign_schema_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M005_Foreign_schema_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M005_Foreign_schema_support/package-info.java deleted file mode 100644 index c186fdc2..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M005_Foreign_schema_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M005_Foreign_schema_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M006_GetSQLString_routine/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M006_GetSQLString_routine/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M006_GetSQLString_routine/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M006_GetSQLString_routine/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M006_GetSQLString_routine/package-info.java deleted file mode 100644 index 5216f455..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M006_GetSQLString_routine/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M006_GetSQLString_routine; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M007_TransmitRequest/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M007_TransmitRequest/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M007_TransmitRequest/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M007_TransmitRequest/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M007_TransmitRequest/package-info.java deleted file mode 100644 index 1bcc3d49..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M007_TransmitRequest/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M007_TransmitRequest; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M009_GetOpts_and_GetStatistics_routines/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M009_GetOpts_and_GetStatistics_routines/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M009_GetOpts_and_GetStatistics_routines/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M009_GetOpts_and_GetStatistics_routines/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M009_GetOpts_and_GetStatistics_routines/package-info.java deleted file mode 100644 index 7feb5a89..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M009_GetOpts_and_GetStatistics_routines/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M009_GetOpts_and_GetStatistics_routines; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M010_Foreign_data_wrapper_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M010_Foreign_data_wrapper_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M010_Foreign_data_wrapper_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M010_Foreign_data_wrapper_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M010_Foreign_data_wrapper_support/package-info.java deleted file mode 100644 index 6e694c4c..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M010_Foreign_data_wrapper_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M010_Foreign_data_wrapper_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M030_SQL_server_foreign_data_support/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M030_SQL_server_foreign_data_support/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M030_SQL_server_foreign_data_support/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M030_SQL_server_foreign_data_support/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M030_SQL_server_foreign_data_support/package-info.java deleted file mode 100644 index 4a0f2e4b..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M030_SQL_server_foreign_data_support/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M030_SQL_server_foreign_data_support; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M031_Foreign_data_wrapper_general_routines/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M031_Foreign_data_wrapper_general_routines/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M031_Foreign_data_wrapper_general_routines/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M031_Foreign_data_wrapper_general_routines/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M031_Foreign_data_wrapper_general_routines/package-info.java deleted file mode 100644 index 64946bf5..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/M031_Foreign_data_wrapper_general_routines/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data.M031_Foreign_data_wrapper_general_routines; diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/README.md b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/README.md deleted file mode 100644 index b89e44de..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/README.md +++ /dev/null @@ -1 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance diff --git a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/package-info.java b/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/package-info.java deleted file mode 100644 index 9dfe1ff6..00000000 --- a/database/hsqldb/testrun/sql2nnn/ISO_IEC_9075_9_SQLMED_Management_of_External_Data/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn.ISO_IEC_9075_9_SQLMED_Management_of_External_Data; diff --git a/database/hsqldb/testrun/sql2nnn/README.md b/database/hsqldb/testrun/sql2nnn/README.md deleted file mode 100644 index ecdd3863..00000000 --- a/database/hsqldb/testrun/sql2nnn/README.md +++ /dev/null @@ -1,3 +0,0 @@ -@todo - title, description, sql and / or groovy scripts for 9075 feature compliance - -+ Contrubutions Welcome diff --git a/database/hsqldb/testrun/sql2nnn/package-info.java b/database/hsqldb/testrun/sql2nnn/package-info.java deleted file mode 100644 index 30812c52..00000000 --- a/database/hsqldb/testrun/sql2nnn/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package sql2nnn; diff --git a/database/hsqldb/testrun/sqltool/README.txt b/database/hsqldb/testrun/sqltool/README.txt deleted file mode 100644 index b5e1a12d..00000000 --- a/database/hsqldb/testrun/sqltool/README.txt +++ /dev/null @@ -1,192 +0,0 @@ -$Id: README.txt 5304 2013-10-20 19:34:25Z unsaved $ - -SqlTool Unit Tests -since: HSQLDB 1.8.0.8 -author: Blaine Simpson (unsaved@users.sourceforge.net) - -************************************************************ -Sun Jan 18 21:52:58 EST 2009 -The dsv-constcols.sql and dsv-trimming.sql unit tests are failing -now, due to known issues with the inability to apply DST (Daylight -Savings Time) offsets to JDBC DATE objects. -************************************************************ - -The test runners depend on the hsqldb.jar and sqltool.jar being in place in the ../../lib directory. - - -HOW TO RUN - - Typical usage (executes all tests). - From UNIX shell - - cd .../testrun/sqltool - ../../build/gradlew - - or - - cd .../testrun/sqltool - ./runtests.bash - - From Windows shell - - cd ...\testrun\sqltool - ..\..\build\gradlew - - or - - cd ...\testrun\sqltool - runtests - - Run tests on any subset of SQL files: - - cd .../testrun/sqltool - .../testrun/sqltool/runtests.bash file1.sql file2.nsql... - or - cd .../testrun/sqltool - .../testrun/sqltool/runtests file1.sql file2.nsql... - - If you have Grooy installed, you can run tests on SQL files that reside - anywhere: - - groovy .../testrun/sqltool/runtests.groovy file1.sql file2.nsql... - - If there are any test failures, the failed SQL scripts will be listed - at the end of the results. To get details about the failure, re-run the - same command with just one of the failed SQL scripts at a time, and - with the Verbose option, like - - ../../build/gradlew -Pverbose=true -Pscripts=failedscript.sql - (to execute multiple files, delimit the scripts with just commas). - - or - - ./runtests.bash -v failedscript.sql... - or - runtests -v failedscript.sql... - or - groovy .../testrun/sqltool/runtests.groovy -v failedscript.sql... - - To see all available invocation methods: - - ./runtests.bash -h - or - runtests -h - - -FILE NAMING AND ASCII/BINARY CONVENTIONS - - You can name SQL scripts anything that you want, except that the - filename suffixes ".nsql" and ".inter" are reserved for negative - and interactive SQL scripts, correspondingly (see the next section - about that). - - If you plan to run runtests.bash with no filename arguments, it - will execute all *.sql, *.nsql, an d*.inter scripts in the current - directory. - So, if you plan to run runtests.bash this way, you must take care - to name only scripts **which you want executed at the top level** - with extensions sql, nsql, inter. By "at the top level", I mean - that if you are nesting SQL scripts with the \i command, you can't - name the nested script with suffix .sql, .nsql, or .inter or the - script will accidentally be executed directly when you run - runtests.bash without script arguments. It's a simple concept, but, - as you can see, it's a little difficult to explain, so here's an - example. - - You have a script name "top.sql" which contains - - \i nested.sql - - You can run "./runtests.bash top.sql" and everything will work - fine-- runtests.bash will execute "top.sql" which will nest - "nested.sql". But if you run just "./runtests.bash", - runtests.bash will run "top.bash", which will nest "nested.bash" - just like before, but runtests.bash will also execute - "nested.bash" directly, since it executes all files with extensions - sql and nsql (and inter). Just use any filename suffix other than - .sql, .nsql, and .inter for your nested SQL scripts and everything - will work fine. - - If you are a HSQLDB developer and will be committing test scripts, - then please use the following filename and type conventions: - - purpose suffix filetype - -------------------- ------ ---------------------------- - top-level SQL script .sql ASCII (mime-type text/plain) - top-level neg. SQL .nsql ASCII (mime-type text/plain) - interactive SQL script .inter ASCII (mime-type text/plain) - nested \i SQL script* .isql ASCII (mime-type text/plain)* - delimiter-sep-values* .dsv Binary (no mime-type)* - - * If you run any 'runtests' command without specifying any script files, - all of the *.sql, *.nsql, and *.inter scripts will be executed directly. - Any other files, including *.isql and *.dsv, will only be used if - pulled in from the directly executed scripts. - Therefore, if you add a script named say 'alpha.isql' or 'beta.custom', - they will not be used unless you specify the filename to your 'testrun' - command explicitly, or if you reference them from a file that is - executed directly. - - If you will be adding new files to HSQLDB, please configure these - extensions in for CVS or Subversion client accordingly. - - - FINE POINT JUSTIFYING Binary TYPE FOR DSV FILES - - (Only read if you give a damned). - The reason we're storing DSV files as binaries is because if - CVS or Subversion saved them as ASCII, the line delimiters would - be determined by the platform performing the check-out, and - imports would fail if the computer executing nested.bash happened - to be of different EOL type from the computer that checked out. - (This would be the case any time that somebody built a - distributable of any type which includes the .dsv files). - - -NEGATIVE TESTS - - runtests.bash determines if a test script succeeds by checking if - the exit status of SqlTool is zero. But we also need to test that - scripts fail out when they should. I.e., we need to verify that if - \c (continue-on-error) is false, and there is a syntax error, or - a runtime SQL failure, that SqlTool exits with non-zero exit status, - as it should. For this, I have invented the convention that SQL - scripts named with suffix ".nsql" are just like normal SQL files, - except that they are expected to fail. - - Here's an example to confirm that you understand. - - ./runtests.bash 1.sql 2.sql 3.nsql 4.nsql 5.sql - or runtests 1.sql 2.sql 3.nsql 4.nsql 5.sql (on Windows) - - This test run will report test failures for 1.sql, 2.sql, and 5.sql - only if SqlTool fails when executing them. It will report test - failures for 3.nsql and 4.nsql only if SqlTool succeeds when - executing them. I.e., runtests.bash _expects_ SqlTool to fail - when executing *.nsql files. - - Negative test scripts should be small and should fail out as - early as possible. The reason for this is that if there is an - accidental error before the point of your test, the script will - fail out early providing a false negative SqlTool exit code, - thereby silently missing your test completely. - - -INTERACTIVE TESTS - - Interactive test are invoked like - - java... SqlTool... mem < scriptname.inter - - in order to test interactive ":" commands. The : commands are - disabled if an SQL script path(s) is given directly as an SqlTool - parameter. I.e., SqlTool runs non-interactively if an SQL script - path is given as a pareter; therefore, to test interactive - commands, we invoke SqlTool without a script name, and instead - pipe the script into SqlTool as stdin. (Using script name of - "-" would do the reverse, it would run in interactive mode even - though getting input from stdin). - - Remember to put "\c false" at the top of your interacive scripts, - or errors will be ignored. Account for this command when counting - command numbers in the command history. diff --git a/database/hsqldb/testrun/sqltool/adv-comments.sql b/database/hsqldb/testrun/sqltool/adv-comments.sql deleted file mode 100644 index 35d37b61..00000000 --- a/database/hsqldb/testrun/sqltool/adv-comments.sql +++ /dev/null @@ -1,21 +0,0 @@ -/* The tests in this file don't succeed with SqlTool as it is now due to: - * Improper handling of traditional-comments inside single-line comment. - * Improper handling of single-line comments inside traditional comment. - * Inability to recognize SQL commands on lines which don't end with ;\s*$. - */ - -/* Repeat with text right up to edges/* /*on one*/ /*line*/ - /*Same thing/* /*with leading*/ /*+ trailing white space*/ - - -CREATE TABLE t(i int); -INSERT INTO t VALUES(1); -INSERT INTO t VALUES(2); - -SELECT * FROM t; -- single-line SQL-trailing comment -* if (*? != 2) \q Hyphen-hyphen trailing SQL failed -SELECT * FROM t; /* traditional SQL-trailing comment */ -* if (*? != 2) \q Traditional trailing SQL failed - -SELECT * FROM t; /* Something -- single-line SQL-trailing comment */ -* if (*? != 2) \q Hyphen-hyphen trailing SQL failed diff --git a/database/hsqldb/testrun/sqltool/altspace.targtbl.dsv b/database/hsqldb/testrun/sqltool/altspace.targtbl.dsv deleted file mode 100644 index 689a47ee..00000000 --- a/database/hsqldb/testrun/sqltool/altspace.targtbl.dsv +++ /dev/null @@ -1,3 +0,0 @@ -i|vc -11|eleven -12|twelve diff --git a/database/hsqldb/testrun/sqltool/append.inter b/database/hsqldb/testrun/sqltool/append.inter deleted file mode 100644 index 9a20a763..00000000 --- a/database/hsqldb/testrun/sqltool/append.inter +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: append.inter 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests interactive commands :a*. - */ - -\c false -/* Since running interactively, need to either invoke with --abortOnErr switch, - * or use "\c false" Special command, to detect failures. */ - -CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR(80)); -INSERT INTO t (vc) VALUES('a'); -INSERT INTO t (vc) VALUES('b'); -INSERT INTO t (vc) VALUES('c'); -INSERT INTO t (vc) VALUES('b'); - -SELECT count(*) FROM t -*if (*? != 4) \q Sanity check failed / 1 - -SELECT count(*) FROM t WHERE vc = 'b'; -*if (*? != 2) \q Sanity check failed / 2 - -INSERT INTO t(vc) VALUES - -:a ('prefpost'); - -SELECT count(*) FROM t -*if (*? != 5) \q Append + repl failed / 1 - -SELECT vc FROM t; -SELECT count(*) FROM t WHERE vc = 'prefpost'; -*if (*? != 1) \q Append + repl failed / 2 - -SELECT count(*) FROM t; - -\p Intervening command making previous become command # -2. -:h -:-2a WHERE vc = 'b'; - -*if (*? != 2) \q Recall + Append + exec failed / 1 - -:-1 -:a AND - id -= 1 - -:; -*if (*? != 1) \q Recall + multi-line Append failed / 1 diff --git a/database/hsqldb/testrun/sqltool/at-chainer.sql b/database/hsqldb/testrun/sqltool/at-chainer.sql deleted file mode 100644 index 758154b6..00000000 --- a/database/hsqldb/testrun/sqltool/at-chainer.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - * $Id: at-chainer.sql 3714 2010-07-22 02:28:38Z unsaved $ - * - * This script invokes the script subdir/atuser.sql, in normal fashion, to - * test that @ works when used by a sub-script. - */ - -\i subdir/atuser.sql diff --git a/database/hsqldb/testrun/sqltool/badsqlonly.nsql b/database/hsqldb/testrun/sqltool/badsqlonly.nsql deleted file mode 100644 index 4a66c49b..00000000 --- a/database/hsqldb/testrun/sqltool/badsqlonly.nsql +++ /dev/null @@ -1,10 +0,0 @@ -/* - * $Id: badsqlonly.nsql 610 2008-12-22 15:54:18Z unsaved $ - * - * Simplest test possible. Does absolutely nothing. - */ - -/** Intentional SQL syntax error here */ -CREATE FABLE t(i INTEGER); - -\p Should never reach here. diff --git a/database/hsqldb/testrun/sqltool/buffer-vars.sql b/database/hsqldb/testrun/sqltool/buffer-vars.sql deleted file mode 100644 index 17754ea1..00000000 --- a/database/hsqldb/testrun/sqltool/buffer-vars.sql +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id: buffer-vars.sql 5406 2014-10-13 20:53:18Z unsaved $ - */ - -CREATE TABLE t (i INT, a INT, d DATE); - -INSERT INTO t(i, a, d) VALUES (1, 149, null); - --- 1-liner sanity check: -* qpart1 = i FROM -SELECT *{qpart1} t; -* if (*? != 1) \q 1-line query with internal PL variable failed - --- Multi-line PL var: -\. -a - FROM -. -* qpart2 : -SELECT *{qpart2} t; -* if (*? != 149) \q 1-line query with multi-line internal PL variable failed - -* res1 ~ -SELECT - *{qpart2} - t; -* if (*res1 != 149) - \q multi-line query with multi-line internal PL variable failed -* end if - --- Multi-line Macro: -\. - SELECT -a -. -/= m1 : FROM -* res2 ~ -/m1 t; -* if (*res2 != 149) - \q Legacy multi-line query with multi-line internal PL variable failed -* end if - --- Newer syntax of same: -\. - SELECT -a -. --- Note the critical 2 spaces before FROM to delimite it from preceding token: -/: m1 FROM -* res3 ~ -/m1 t; -* if (*res3 != 149) - \q multi-line query with multi-line internal PL variable failed. Ws by appendage. -* end if - --- With separating white space in in middle appendage -\. -a - FROM -. -* qpart3 : -SELECT *{qpart3}t; -* if (*? != 149) \q White space inserted with middle appendage - --- With separating white space in the base -\. -a - FROM -. -* qpart3 : -SELECT *{qpart3}t; -* if (*? != 149) \q White space inserted with middle appendage diff --git a/database/hsqldb/testrun/sqltool/comments.sql b/database/hsqldb/testrun/sqltool/comments.sql deleted file mode 100644 index 5f45743a..00000000 --- a/database/hsqldb/testrun/sqltool/comments.sql +++ /dev/null @@ -1,99 +0,0 @@ -/* - * $Id: comments.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests comments. This comment itself is a multi-line comment - */ - -/* Just to have a work table */ -CREATE TABLE t(i int); - - /* A multi-line - comment with - leading + trailing white space. */ - -/*Repeat with text right up to edges. - * - * Tests comments. This comment itself is a multi-line comment*/ - - /*Repeat with text right up to edges. - comment with - leading + trailing white space. */ - -/* Following line contains spaces */ - - -/* Simple hyphen-hyphen comments */ --- blah - -- blah - -/* Empty and white space comments: */ -/**/ -/*****/ -/*** Extra stars ***/ - /*** Extra stars ***/ - /**************/ ----- Extra slashes - ---- Extra slashes - ---------------------- -/* */ - /**/ - /* */ -/* The second of each of the following pairs have trailing white space. --- --- - -- - -- - -/* Comments trailing SQL */ -INSERT INTO t VALUES (9); - -/* Simple SQL-embedded traditional comments */ -SELECT * FROM /* A simple traditional comment */ t; -* if (*? != 9) \q Hyphen-hyphen trailing SQL failed -SELECT * FROM /* A simple traditional -comment */ t; -* if (*? != 9) \q Hyphen-hyphen trailing SQL failed -SELECT * FROM -- A simple single-line comment -t; -* if (*? != 9) \q Hyphen-hyphen trailing SQL failed -SELECT * FROM -- Two simple single-line --- comments -t; -* if (*? != 9) \q Hyphen-hyphen trailing SQL failed -SELECT * FROM -- Two simple single-line - -- comments. With leading white space - t; -* if (*? != 9) \q Hyphen-hyphen trailing SQL failed - -/* Nesting different comments inside one another */ -/* -- The traditional comment should still close. */ -SELECT * FROM /* Something -- single-line SQL-trailing comment */ t; -* if (*? != 9) \q Hyphen-hyphen trailing SQL failed - -/* Sanity check */ -* V1 = one -* if (*V1 != one) \q Failed sanity check for simple variable test - -/* Test single-line within PL command */ -* V2 = alpha--some crap -* if (*V2 != alpha) \q Failed single-line within PL command - -/* Test traditional within PL command */ -* V3 = gamma/*some crap*/ -* if (*V3 != gamma) \q Failed traditional within PL command - -/* Test multiple traditionals within PL command */ -* V4 = de/*some crap*/l/*more*/ta -* if (*V4 != delta) \q Failed multiple traditional within PL command - -/* Test single-line within PL command */ -* V5 = alpha--some crap /* with nested traditional */ there -* if (*V5 != alpha) \q Failed single-line within PL w/ nesting+trailing failed - -/* Test single-line within PL command */ -* V6 = alpha--some crap /* with nested traditional */ -* if (*V6 != alpha) \q Failed single-line within PL w/ nesting failed - -/* Test single-line within PL command */ -* V7 = alpha--some crap /* with nested traditional -* if (*V6 != alpha) \q Failed single-line within PL w/ unclosed nesting failed diff --git a/database/hsqldb/testrun/sqltool/csv-1charquoted.csv b/database/hsqldb/testrun/sqltool/csv-1charquoted.csv deleted file mode 100644 index d67e0d80..00000000 --- a/database/hsqldb/testrun/sqltool/csv-1charquoted.csv +++ /dev/null @@ -1,4 +0,0 @@ -ID,A,B -1,"A1","B1" -2,"A2","B2" -3,"A3","B3" diff --git a/database/hsqldb/testrun/sqltool/csv-1charquoted.sql b/database/hsqldb/testrun/sqltool/csv-1charquoted.sql deleted file mode 100644 index 6f469138..00000000 --- a/database/hsqldb/testrun/sqltool/csv-1charquoted.sql +++ /dev/null @@ -1,13 +0,0 @@ --- Tests HSQLDB bug 3615035 - -* *DSV_COL_DELIM = , -* *DSV_COL_SPLITTER = , --- * *DSV_REJECT_REPORT = import.html -* *NULL_REP_TOKEN = -* *DSV_TARGET_TABLE=t - -CREATE TABLE T (ID INTEGER PRIMARY KEY NOT NULL, A VARCHAR(2), B VARCHAR(2)); -COMMIT; - -\mq csv-1charquoted.csv -COMMIT; diff --git a/database/hsqldb/testrun/sqltool/csv-quotedcolheaders.csv b/database/hsqldb/testrun/sqltool/csv-quotedcolheaders.csv deleted file mode 100644 index d1fbe89f..00000000 --- a/database/hsqldb/testrun/sqltool/csv-quotedcolheaders.csv +++ /dev/null @@ -1,9 +0,0 @@ -"field1","field2","field3","field4" -"skiing","climbing","swimming","playing" -"skiing","climbing","swimming","playing" -"skiing","climbing","swimming","playing" -"skiing","climbing","swimming","playing" -"skiing","climbing","swimming","playing" -"skiing","climbing","swimming","playing" -"skiing","climbing","swimming","playing" -"skiing","climbing","swimming","playing" diff --git a/database/hsqldb/testrun/sqltool/csv-quotedcolheaders.sql b/database/hsqldb/testrun/sqltool/csv-quotedcolheaders.sql deleted file mode 100644 index c210892a..00000000 --- a/database/hsqldb/testrun/sqltool/csv-quotedcolheaders.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Simplification of test case submitted by tokajac - -CREATE TABLE IF NOT EXISTS tmp_tbl(imports_pk NUMERIC NOT NULL IDENTITY,field1 VARCHAR(255),field2 VARCHAR(255),field3 VARCHAR(255),field4 VARCHAR(255)); -* *DSV_TARGET_TABLE = tmp_tbl -* *DSV_COL_SPLITTER=, -\mq csv-quotedcolheaders.csv -commit; diff --git a/database/hsqldb/testrun/sqltool/csv-roundtrip.sql b/database/hsqldb/testrun/sqltool/csv-roundtrip.sql deleted file mode 100644 index 89771ee2..00000000 --- a/database/hsqldb/testrun/sqltool/csv-roundtrip.sql +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $Id: csv-roundtrip.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests a DSV "round trip". - * Create a table, export the data, import it back, cf. imported and original. - */ - -* *DSV_TARGET_FILE = ${java.io.tmpdir}/test-roundtrip-${user.name}.csv -* *DSV_TARGET_TABLE = t -* *DSV_COL_DELIM = \t -* *DSV_COL_SPLITTER = \t --- * *ALL_QUOTED = true -CREATE TABLE t (i INT, v VARCHAR(25), d DATE); - -INSERT INTO t(i, v, d) VALUES (1, 'one two three', null); -INSERT INTO t(i, v, d) VALUES (2, null, '2007-06-24'); -INSERT INTO t(i, v, d) VALUES (3, 'one,two,,three', '2007-06-24'); -INSERT INTO t(i, v, d) VALUES (4, '"one"two""three', '2007-06-24'); -INSERT INTO t(i, v, d) VALUES (5, '"one,two"three,', '2007-06-24'); - -/* Export */ -\xq t - -SELECT count(*) FROM t WHERE i = 1 AND v = 'one two three' AND d IS null; -*if (*? != 1) \q Pre-check of inserted data failed (1) -SELECT count(*) FROM t WHERE i = 2 AND v IS NULL AND d = '2007-06-24'; -*if (*? != 1) \q Pre-check of inserted data failed (2) -SELECT count(*) FROM t WHERE i = 3 AND v = 'one,two,,three' AND d = '2007-06-24'; -*if (*? != 1) \q Pre-check of inserted data failed (3) -SELECT count(*) FROM t WHERE i = 4 AND v = '"one"two""three' AND d = '2007-06-24'; -*if (*? != 1) \q Pre-check of inserted data failed (4) -SELECT count(*) FROM t WHERE i = 5 AND v = '"one,two"three,' AND d = '2007-06-24'; -*if (*? != 1) \q Pre-check of inserted data failed (5) - - -/* Import */ -\mq *{*DSV_TARGET_FILE} - -SELECT count(*) FROM t WHERE i = 1 AND v = 'one two three' AND d IS null; -*if (*? != 2) \q Post-check of inserted data failed (1) -SELECT count(*) FROM t WHERE i = 2 AND v IS NULL AND d = '2007-06-24'; -*if (*? != 2) \q Post-check of inserted data failed (2) -SELECT count(*) FROM t WHERE i = 3 AND v = 'one,two,,three' AND d = '2007-06-24'; -*if (*? != 2) \q Post-check of inserted data failed (3) -SELECT count(*) FROM t WHERE i = 4 AND v = '"one"two""three' AND d = '2007-06-24'; -*if (*? != 2) \q Post-check of inserted data failed (4) -SELECT count(*) FROM t WHERE i = 5 AND v = '"one,two"three,' AND d = '2007-06-24'; -*if (*? != 2) \q Post-check of inserted data failed (5) diff --git a/database/hsqldb/testrun/sqltool/dsv-abortcommits.sql b/database/hsqldb/testrun/sqltool/dsv-abortcommits.sql deleted file mode 100644 index f8d018c7..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-abortcommits.sql +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: dsv-abortcommits.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests proper commit behavior upon DSV abortion - */ - -CREATE TABLE t (i INT, r REAL, d DATE, t TIMESTAMP, v VARCHAR(80), b BOOLEAN); - -\c true - -\a true -\m dsv-rejects.dsv -SELECT COUNT(*) FROM t; -*if (*? != 1) \q Should have imported 1 good DSV records, but imported *{?} (1) -ROLLBACK; -SELECT COUNT(*) FROM t; -*if (*? != 1) - \q Should have retained 1 DSV record after ROLLBACK w/autocommit, but retained *{?} -*end if - --- Now with auto-commit off -\a false -DELETE FROM t; -COMMIT; -\m dsv-rejects.dsv -SELECT COUNT(*) FROM t; -*if (*? != 1) \q Should have imported 1 good DSV records, but imported *{?} (2) -ROLLBACK; -SELECT COUNT(*) FROM t; -*if (*? != 0) - \q Should have retained 0 DSV record after ROLLBACK, but retained *{?} -*end if - -DELETE FROM t; -COMMIT; -* *DSV_RECORDS_PER_COMMIT = 10 -\m dsv-rejects.dsv -SELECT COUNT(*) FROM t; -*if (*? != 1) \q Should have imported 1 good DSV records, but imported *{?} (3) -ROLLBACK; -SELECT COUNT(*) FROM t; -*if (*? != 1) - \q Should have retained 1 DSV record after ROLLBACK w/RPC, but retained *{?} -*end if diff --git a/database/hsqldb/testrun/sqltool/dsv-altspace.sql b/database/hsqldb/testrun/sqltool/dsv-altspace.sql deleted file mode 100644 index cb1b55d1..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-altspace.sql +++ /dev/null @@ -1,13 +0,0 @@ -/* - * $Id: dsv-altspace.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests importing to table in non-default tablespace - */ - -CREATE SCHEMA altspace authorization dba; -CREATE TABLE altspace.targtbl (i INT, vc VARCHAR(80)); - -\m altspace.targtbl.dsv -SELECT COUNT(*) FROM altspace.targtbl; - -*if (*? != 2) \q Import to alternate tablespace failed diff --git a/database/hsqldb/testrun/sqltool/dsv-constcols.dsv b/database/hsqldb/testrun/sqltool/dsv-constcols.dsv deleted file mode 100644 index f665ec44..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-constcols.dsv +++ /dev/null @@ -1,8 +0,0 @@ -targettable=t - -# Following (header) line has intentional trailing whitespace. - i | - | d - -# Following line has intentional trailing whitespace (and mixed case). - 1 | 1 | 2006-12-11 - 2 | 2 | diff --git a/database/hsqldb/testrun/sqltool/dsv-constcols.sql b/database/hsqldb/testrun/sqltool/dsv-constcols.sql deleted file mode 100644 index 3b60a451..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-constcols.sql +++ /dev/null @@ -1,25 +0,0 @@ -/* - * $Id: dsv-constcols.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests setting column values with *DSV_CONST_COLS - */ - -* *DSV_CONST_COLS= d = 2007-05-14 0:00:00 | a = 139 - -CREATE TABLE t (i INT, a INT, d DATE); - -\m dsv-constcols.dsv -SELECT COUNT(*) FROM t WHERE a = 139 AND d = '2007-05-14'; - -/* The d const value will override the .dsv-specified values. */ -*if (*? != 2) \q Import using constants for int and date columns failed - -DELETE from t; -* *DSV_CONST_COLS= -\m dsv-constcols.dsv - -SELECT COUNT(*) FROM t WHERE a IS null AND d IS null; -*if (*? != 1) \q Failed to reset CONST_COLS behavior (1) - -SELECT COUNT(*) FROM t WHERE a IS null AND d = '2006-12-11'; -*if (*? != 1) \q Failed to reset CONST_COLS behavior (2) diff --git a/database/hsqldb/testrun/sqltool/dsv-multiline.sql b/database/hsqldb/testrun/sqltool/dsv-multiline.sql deleted file mode 100644 index 556de79f..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-multiline.sql +++ /dev/null @@ -1,37 +0,0 @@ -/* - * $Id: dsv-multiline.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Does a DSV export using a multi-line custom query instead of just - * specifying the table name. - * Imports it back to validate the output. - */ - -* *DSV_TARGET_FILE = ${java.io.tmpdir}/test-roundtrip-${user.name}.dsv -* *DSV_TARGET_TABLE = t -CREATE TABLE t (i INT, a INT, d DATE); - -INSERT INTO t(i, a, d) VALUES (1, 149, null); -INSERT INTO t(i, a, d) VALUES (2, null, '2007-06-24'); - -\. -SELECT - * FROM - t -. - -/* Export */ -\x : WHERE i = 1 - -SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; -*if (*? != 1) \q Pre-check of inserted data failed (1) -SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; -*if (*? != 1) \q Pre-check of inserted data failed (2) - - -/* Import */ -\m *{*DSV_TARGET_FILE} - -SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; -*if (*? != 2) \q Post-check of imported data failed (1) -SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; -*if (*? != 1) \q Post-check of imported data failed (2) diff --git a/database/hsqldb/testrun/sqltool/dsv-omits.dsv b/database/hsqldb/testrun/sqltool/dsv-omits.dsv deleted file mode 100644 index 6b9edfc7..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-omits.dsv +++ /dev/null @@ -1,8 +0,0 @@ -targettable=t - -# Following (header) line has intentional trailing whitespace. - - | i | - | a | - | b | - | c - -# Following line has intentional trailing whitespace (and mixed case). - 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 - 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 diff --git a/database/hsqldb/testrun/sqltool/dsv-omits.sql b/database/hsqldb/testrun/sqltool/dsv-omits.sql deleted file mode 100644 index 06aa2a5e..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-omits.sql +++ /dev/null @@ -1,41 +0,0 @@ -/* - * $Id: dsv-omits.sql$ - * - * Tests omitting columns via header line and *DSV_SKIP_COLS - */ - -CREATE TABLE t (i INT, a INT, b INT, c INT); - -\m dsv-omits.dsv -SELECT COUNT(*) FROM t -WHERE i IS NOT null AND a IS NOT null AND b IS NOT null AND c IS NOT null; - -*if (*? != 2) \q Import using header line - column-skips failed - -/** Repeat test with some non-default DSV settings */ -* *DSV_SKIP_COLS = c| a - -DELETE FROM t; -\m dsv-omits.dsv - -SELECT COUNT(*) FROM t -WHERE i IS NOT null AND b IS NOT null AND a IS null AND c IS null; - -*if (*? != 2) - \q Import using header line - AND *DSV_SKIP_COLS column-skips failed -*end if - -/* Now test that behavior reverts when PL variable is cleared */ -* *DSV_SKIP_COLS = -* listvalues - -DELETE FROM t; -\m dsv-omits.dsv -SELECT COUNT(*) FROM t -WHERE i IS NOT null AND a IS NOT null AND b IS NOT null AND c IS NOT null; -\p Post everything - -*if (*? != 2) - SELECT * FROM t; - \q *DSV_SKIP_COLS behavior failed to revert when variable was cleared -*end if diff --git a/database/hsqldb/testrun/sqltool/dsv-prepare.sql b/database/hsqldb/testrun/sqltool/dsv-prepare.sql deleted file mode 100644 index b7284ed9..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-prepare.sql +++ /dev/null @@ -1,16 +0,0 @@ -/* - * $Id: dsv-prepare.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests PL 'prepare' command - */ - -CREATE TABLE t (i INT, a INT, b INT, c INT); - -* N = 4567 -* prepare N - -INSERT INTO t(i, a, b, c) VALUES (1, ?, 8, 9); - -SELECT count(*) FROM t WHERE i = 1 AND a = 4567 AND b= 8 AND c = 9; - -*if (*? != 1) \q PL prepare command failed diff --git a/database/hsqldb/testrun/sqltool/dsv-rejects.dsv b/database/hsqldb/testrun/sqltool/dsv-rejects.dsv deleted file mode 100644 index d7395c66..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-rejects.dsv +++ /dev/null @@ -1,14 +0,0 @@ -targettable=t - - i | r | d | t | v | b - - 31 | 3.124 | 2007-06-07 | 2006-05-06 12:30:04 | a B | true -42 | 1.5 | 2007-07-08 | 2006-05-07 10:20 | a string | false - -# Letter in int field: -5 | a | 2007-07-08 | 2006-05-07 10:20 | a string | false - -# No seconds in time field -42 | 1.5 | 2007-07-08 | 2006-05-07 10:20 | a string | false - -42 | 1.5 | 2007-07-08 | 2006-05-07 10:20:0 | a string | false diff --git a/database/hsqldb/testrun/sqltool/dsv-rejects.sql b/database/hsqldb/testrun/sqltool/dsv-rejects.sql deleted file mode 100644 index 7065447a..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-rejects.sql +++ /dev/null @@ -1,14 +0,0 @@ -/* - * $Id: dsv-rejects.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests proper rejection of bad DSV input records - */ - -CREATE TABLE t (i INT, r REAL, d DATE, t TIMESTAMP, v VARCHAR(80), b BOOLEAN); - -* *DSV_REJECT_REPORT = ${java.io.tmpdir}/sqltoolutst-${user.name}.html -\m dsv-rejects.dsv - -SELECT COUNT(*) FROM t; - -*if (*? != 2) \q Should have imported 2 good DSV records, but imported *{?} diff --git a/database/hsqldb/testrun/sqltool/dsv-roundtrip.sql b/database/hsqldb/testrun/sqltool/dsv-roundtrip.sql deleted file mode 100644 index 69cc1bfd..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-roundtrip.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - * $Id: dsv-roundtrip.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests a DSV "round trip". - * Create a table, export the data, import it back, cf. imported and original. - */ - -* *DSV_TARGET_FILE = ${java.io.tmpdir}/test-roundtrip-${user.name}.dsv -* *DSV_TARGET_TABLE = t -CREATE TABLE t (i INT, a INT, d DATE); - -INSERT INTO t(i, a, d) VALUES (1, 149, null); -INSERT INTO t(i, a, d) VALUES (2, null, '2007-06-24'); - -/* Export */ -\x t - -SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; -*if (*? != 1) \q Pre-check of inserted data failed (1) -SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; -*if (*? != 1) \q Pre-check of inserted data failed (2) - - -/* Import */ -\m *{*DSV_TARGET_FILE} - -SELECT count(*) FROM t WHERE i = 1 AND a = 149 AND d IS null; -*if (*? != 2) \q Post-check of imported data failed (1) -SELECT count(*) FROM t WHERE i = 2 AND a IS NULL AND d = '2007-06-24'; -*if (*? != 2) \q Post-check of imported data failed (2) diff --git a/database/hsqldb/testrun/sqltool/dsv-rpcommit.dsv b/database/hsqldb/testrun/sqltool/dsv-rpcommit.dsv deleted file mode 100644 index 9a53cf51..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-rpcommit.dsv +++ /dev/null @@ -1,25 +0,0 @@ -targettable=t - -i -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -x -15 -16 -17 -18 -19 -20 -21 -22 diff --git a/database/hsqldb/testrun/sqltool/dsv-rpcommit.sql b/database/hsqldb/testrun/sqltool/dsv-rpcommit.sql deleted file mode 100644 index 048c39d0..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-rpcommit.sql +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id: dsv-rpcommit.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests *DSV_RECORDS_PER_COMMIT setting - */ - -/* Unfortunately, can't test how many commits are performed and where. - * That would * require adding significant complexity to SqlFile itself, or - * complex interception of commits. - * I have, however, manually tested the commits by echoing the commits in - * the source code, and removing observing what remains uncommitted after - * removing the straggler-catching commit after the insertion loop in - * SqlFile.importDsv(). - * All that we are testing here is that all records which should be committed - * do get committed. - */ - -CREATE TABLE t (i INT); - -\c true -* *DSV_RECORDS_PER_COMMIT=5 -\m dsv-rpcommit.dsv - -ROLLBACK; - -SELECT COUNT(*) FROM t; -*if (*? != 13) \q *DSV_RECORDS_PER_COMMIT committed only *{?} records instead 13 - -DELETE FROM t; -* *DSV_REJECT_REPORT = ${java.io.tmpdir}/test-rpcommit-${user.name}.dsv -\m dsv-rpcommit.dsv - -SELECT COUNT(*) FROM t; -*if (*? != 21) \q *DSV_RECORDS_PER_COMMIT committed only *{?} records instead 21 diff --git a/database/hsqldb/testrun/sqltool/dsv-sqlarray.sql b/database/hsqldb/testrun/sqltool/dsv-sqlarray.sql deleted file mode 100644 index 3cb06ede..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-sqlarray.sql +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $Id: dsv-sqlarray.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests a DSV "round trip". - * Create a table, export the data, import it back, cf. imported and original. - */ - -* *DSV_TARGET_FILE = ${java.io.tmpdir}/test-sqlarray-${user.name}.dsv -* *DSV_TARGET_TABLE = t - -CREATE TABLE t (i BIGINT PRIMARY KEY, ar INTEGER ARRAY); - -INSERT INTO t VALUES (1, array [11, null, 13]); -INSERT INTO t VALUES (2, null); -INSERT INTO t VALUES (3, array [21, 22]); -COMMIT; - -/* Export */ -\x t - -SELECT count(*) FROM t WHERE ar IS NULL AND i = 2; -*if (*? != 1) \q Pre-check of inserted Array array data failed (1) -SELECT count(*) FROM t WHERE i in (1, 3) AND ar IS NOT null; -*if (*? != 2) \q Pre-check of inserted Array data failed (2) - -DELETE FROM t; - -SELECT count(*) FROM t; -*if (*? != 0) \q Failed to clear table data - -/* Import */ -\m *{*DSV_TARGET_FILE} -SELECT count(*) FROM t WHERE ar IS NULL AND i = 2; -*if (*? != 1) \q Post-check of inserted Array array data failed (1) -SELECT count(*) FROM t WHERE i in (1, 3) AND ar IS NOT null; -*if (*? != 2) \q Post-check of inserted Array data failed (2) diff --git a/database/hsqldb/testrun/sqltool/dsv-trimall.dsv b/database/hsqldb/testrun/sqltool/dsv-trimall.dsv deleted file mode 100644 index 3c12510a..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-trimall.dsv +++ /dev/null @@ -1,5 +0,0 @@ -targettable=t - i | vc | d - 1 | o n e | 2006-12-11 - 2 | two | 2008-02-28 -3|three| diff --git a/database/hsqldb/testrun/sqltool/dsv-trimall.sql b/database/hsqldb/testrun/sqltool/dsv-trimall.sql deleted file mode 100644 index 952c7cbc..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-trimall.sql +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $Id: dsv-trimall.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests *DSV_TRIM_ALL option. - */ - -CREATE TABLE t (i INT, vc VARCHAR(80), d DATE); - -\m dsv-trimall.dsv - -SELECT COUNT(*) FROM t WHERE vc = 'three'; -*if (*? != 1) \q Sanity check failed -SELECT COUNT(*) FROM t WHERE vc = ' o n e '; -*if (*? != 1) \q Default mode messed with VARCHAR-embedded whitespace -SELECT COUNT(*) FROM t WHERE vc = ' two '; -*if (*? != 1) - \q Default mode messed with leading or trailing whitespace in VARCHAR -*end if - -DELETE from t; -COMMIT; - -* *DSV_TRIM_ALL = true - -\m dsv-trimall.dsv - -SELECT COUNT(*) FROM t WHERE vc = 'three'; -*if (*? != 1) \q 2nd Sanity check failed -SELECT COUNT(*) FROM t WHERE vc = 'o n e'; -*if (*? != 1) - \q *DSV_TRIM_ALL didn't trim with VARCHAR-embedded whitespace properly -*end if -SELECT COUNT(*) FROM t WHERE vc = 'two'; -*if (*? != 1) - \q *DSV_TRIM_ALL didn't trim leading or trailing whitespace properly -*end if diff --git a/database/hsqldb/testrun/sqltool/dsv-trimming-alt.dsv b/database/hsqldb/testrun/sqltool/dsv-trimming-alt.dsv deleted file mode 100644 index 7b5ec747..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-trimming-alt.dsv +++ /dev/null @@ -1,7 +0,0 @@ -targettable=t} -} -# Following (header) line has intentional trailing whitespace.} - i \ r \ d \ t \ v \ b } -} -# Following line has intentional trailing whitespace (and mixed case).} - 31 \ 3.124 \ 2007-06-07 \ 2006-05-06 12:30:04 \ a B \ tRUe } diff --git a/database/hsqldb/testrun/sqltool/dsv-trimming.dsv b/database/hsqldb/testrun/sqltool/dsv-trimming.dsv deleted file mode 100644 index be40ba41..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-trimming.dsv +++ /dev/null @@ -1,7 +0,0 @@ -targettable=t - -# Following (header) line has intentional trailing whitespace. - i | r | d | t | v | b - -# Following line has intentional trailing whitespace (and mixed case). - 31 | 3.124 | 2007-06-07 | 2006-05-06 12:30:04 | a B | tRUe diff --git a/database/hsqldb/testrun/sqltool/dsv-trimming.sql b/database/hsqldb/testrun/sqltool/dsv-trimming.sql deleted file mode 100644 index f390b77c..00000000 --- a/database/hsqldb/testrun/sqltool/dsv-trimming.sql +++ /dev/null @@ -1,58 +0,0 @@ -/* - * $Id: dsv-trimming.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests trimming in DSV imports - */ - -CREATE TABLE t (i INT, r REAL, d DATE, t TIMESTAMP, v VARCHAR(80), b BOOLEAN); - -\m dsv-trimming.dsv - -SELECT count(*) FROM t WHERE i = 31; -*if (*? != 1) \q Import of space-embedded INT failed - -SELECT count(*) FROM t WHERE r = 3.124; -*if (*? != 1) \q Import of space-embedded REAL failed - -SELECT count(*) FROM t WHERE d = '2007-06-07'; -*if (*? != 1) \q Import of space-embedded DATE failed (1) - -SELECT count(*) FROM t WHERE t = '2006-05-06 12:30:04'; -*if (*? != 1) \q Import of space-embedded TIMESTAMP failed - -SELECT count(*) FROM t WHERE v = ' a B '; -*if (*? != 1) \q Import of space-embedded VARCHAR failed - -/** I dont' know if "IS true" or "= true" is preferred, but the former - * doesn't work with HSQLDB 1.7.0.7 */ -SELECT count(*) FROM t WHERE b = true; -*if (*? != 1) \q Import of space-embedded BOOLEAN failed - - -/** Repeat test with some non-default DSV settings */ -* *DSV_COL_SPLITTER = \\ -* *DSV_ROW_SPLITTER = \}(?:\r\n|\r|\n) - -DELETE FROM t; - -\m dsv-trimming-alt.dsv - -SELECT count(*) FROM t WHERE i = 31; -*if (*? != 1) \q Import of space-embedded INT failed - -SELECT count(*) FROM t WHERE r = 3.124; -*if (*? != 1) \q Import of space-embedded REAL failed - -SELECT count(*) FROM t WHERE d = '2007-06-07'; -*if (*? != 1) \q Import of space-embedded DATE failed (2) - -SELECT count(*) FROM t WHERE t = '2006-05-06 12:30:04'; -*if (*? != 1) \q Import of space-embedded TIMESTAMP failed - -SELECT count(*) FROM t WHERE v = ' a B '; -*if (*? != 1) \q Import of space-embedded VARCHAR failed - -/** I dont' know if "IS true" or "= true" is preferred, but the former - * doesn't work with HSQLDB 1.7.0.7 */ -SELECT count(*) FROM t WHERE b = true; -*if (*? != 1) \q Import of space-embedded BOOLEAN failed diff --git a/database/hsqldb/testrun/sqltool/else.sql b/database/hsqldb/testrun/sqltool/else.sql deleted file mode 100644 index 56c54191..00000000 --- a/database/hsqldb/testrun/sqltool/else.sql +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Tests else statement - */ - -* RES={ -* EXPECTED={ c c23 A c24 A c c23 B c24 B d } -* if (0) - \q a - \q b -* else - * foreach x (A B) - * RES=*{RES} c - * if (0) \q c1 - * if (0) - \q c21 *{x} - \q c22 *{x} - * else - * RES=*{RES} c23 *{x} - * RES=*{RES} c24 *{x} - * end if - * end foreach - * RES=*{RES} d -* end if -* RES=*{RES} } - -* if (*RES != *EXPECTED) \q (*{RES}) vs. (*{EXPECTED}) diff --git a/database/hsqldb/testrun/sqltool/errhandling.isql b/database/hsqldb/testrun/sqltool/errhandling.isql deleted file mode 100644 index 8fa5e689..00000000 --- a/database/hsqldb/testrun/sqltool/errhandling.isql +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: errhandling.isql 610 2008-12-22 15:54:18Z unsaved $ - * - * Tests error handling inside of blocks and in subscripts. - */ - -\c true -bad; -\p Made it past first ignored error. - -/* At root level, can even ignore fatal syntax errors */ -* foreach bad -* ifff - -* V = changethis -* if (1) - bad; - * ifff - * end nosuch - * V = ok -* end if - -* if (*V != ok) - \q Seems to have aborted inside if block in Continue-on-error mode -* end if - -* W = changethis -* if (1) - bad; - *if (2) - * ifff - * end nosuch - * W = ok - *end if - worse; -* end if - -* if (*W != ok) - \q Seems to have aborted inside nested if block in Continue-on-error mode -* end if diff --git a/database/hsqldb/testrun/sqltool/errhandling.nsql b/database/hsqldb/testrun/sqltool/errhandling.nsql deleted file mode 100644 index c8a0648f..00000000 --- a/database/hsqldb/testrun/sqltool/errhandling.nsql +++ /dev/null @@ -1,13 +0,0 @@ -/* - * $Id: errhandling.nsql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Negative tests error handling inside of blocks and in subscripts. - */ - -* if (1) - *if (2) \i errhandlingn.isql - worse; -* end if - -\p Returned from bad script errhandlingn.isql. Should not have. -\q diff --git a/database/hsqldb/testrun/sqltool/errhandling.sql b/database/hsqldb/testrun/sqltool/errhandling.sql deleted file mode 100644 index f1b27f03..00000000 --- a/database/hsqldb/testrun/sqltool/errhandling.sql +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $Id: errhandling.sql 610 2008-12-22 15:54:18Z unsaved $ - * - * Tests error handling inside of blocks and in subscripts. - */ - -\c true -bad; -\p Made it past first ignored error. - -/* At root level, can even ignore fatal syntax errors */ -* foreach bad -* ifff - -* V = changethis -* if (1) - bad; - * ifff - * end nosuch - * V = ok -* end if - -* if (*V != ok) - \q Seems to have aborted inside if block in Continue-on-error mode -* end if - -* W = changethis -* if (1) - bad; - *if (2) - * ifff - * end nosuch - * W = ok - *end if - worse; -* end if - -* if (*W != ok) - \q Seems to have aborted inside nested if block in Continue-on-error mode -* end if - -\i errhandling.isql diff --git a/database/hsqldb/testrun/sqltool/errhandlingn.isql b/database/hsqldb/testrun/sqltool/errhandlingn.isql deleted file mode 100644 index 048cc072..00000000 --- a/database/hsqldb/testrun/sqltool/errhandlingn.isql +++ /dev/null @@ -1,13 +0,0 @@ -/* - * $Id: errhandlingn.isql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Errors out in a nested block - */ - -* if (1) - *if (2) \q Forced error - worse; -* end if - -\p Returned from bad block. Should not have. -\q diff --git a/database/hsqldb/testrun/sqltool/for.sql b/database/hsqldb/testrun/sqltool/for.sql deleted file mode 100644 index 6ae67239..00000000 --- a/database/hsqldb/testrun/sqltool/for.sql +++ /dev/null @@ -1,25 +0,0 @@ -* RES= { -* EXPECTED = { outerA 0 innerA 0 1 innerA 0 2 outerA 1 innerA 1 1 innerA 1 2 outerA 2 innerA 2 1 innerA 2 2 outerB 1 innerB 1 0 outerB 2 innerB 2 0 innerB 2 1 } -* x = 0 -* for (*x < 3) ((x += 1)) - * RES = *{RES} outerA *{x} - * for ((y =1)) (*y < 3) ((y += 1)) - * RES = *{RES} innerA *{x} *{y} - * end for -* end for - -* for ((x =1)) (*x < 3) ((x += 1)) - * RES = *{RES} outerB *{x} - * for ((y = 0)) (*y < *x) ((y += 1)) - * RES = *{RES} innerB *{x} *{y} - * end for -* end for -* RES = *{RES} } - -* if (*RES != *EXPECTED) \q (*{RES}) != (*{EXPECTED}) - -* ((summer = 0)) -* for ((i = 0)) (*i < 10) ((i += 1)) - * ((summer += i)) -* end for -* if (*summer != 45) \q Summation failed. *{summer} != 45 diff --git a/database/hsqldb/testrun/sqltool/forrows.sql b/database/hsqldb/testrun/sqltool/forrows.sql deleted file mode 100644 index bd418a61..00000000 --- a/database/hsqldb/testrun/sqltool/forrows.sql +++ /dev/null @@ -1,49 +0,0 @@ -/* - * $Id: forrows.sql 5896 2018-12-30 18:36:47Z unsaved $ - * - * Tests forrows iterator - */ - -create table t(i int, vc varchar(25)); -insert into t values(1, 'one'); -insert into t values(2, 'two'); -insert into t values(null, 'three'); -insert into t values(4, null); - -* *DSV_ROW_DELIM = @ -* if (**ROWS != **NULL) \q **ROWS not null before any forrows -* RES={ -* EXPECTED={ Q1 1|one 1,(one) Q1 2|two 2,(two) Q1 [null]|three ,(three) Q1 4|[null] 4,() } -*forrows INT VCHAR -SELECT * FROM t; - * RES=*{RES} Q1 *{*ROW} - * RES=*{RES} *{:INT},(*{:VCHAR}) - * if (**ROWS != **NULL) \q **ROWS not null inside first forrows -*end forrows -* RES=*{RES} } -* if (*RES != *EXPECTED) \q [*{RES}] != [*{EXPECTED}] - -* if (**ROWS == **NULL) \q **ROWS was not populated by first forrows -* EXPECTED=1|one@2|two@[null]|three@4|[null] -* if (**ROWS != *EXPECTED) \q *ROWS: [*{*ROWS}] != [*{EXPECTED}] - -* RES={ -* EXPECTED={ Q2 1|one Q2 2|two Q2 [null]|three Q2 4|[null] } -*forrows -SELECT * FROM t; - * if (**ROWS != **NULL) \q **ROWS not null inside second forrows - * RES=*{RES} Q2 *{*ROW} -*end forrows -* RES=*{RES} } -* if (*RES != *EXPECTED) \q [*{RES}] != [*{EXPECTED}] - --- Test that case of 0 rows handled gracefully -DELETE FROM t; -*forrows INT VCHAR -SELECT * FROM t; - \q Executing forrow body when table is empty -*end forrows -*forrows -SELECT * FROM t; - \q Executing forrow body when table is empty -*end forrows diff --git a/database/hsqldb/testrun/sqltool/function.sql b/database/hsqldb/testrun/sqltool/function.sql deleted file mode 100644 index 66ba1f35..00000000 --- a/database/hsqldb/testrun/sqltool/function.sql +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $Id: function.sql 4847 2011-12-27 15:23:12Z unsaved $ - * - * Tests SqlTool functions. - */ - --- Special command function -/= f() \p one *{:2} *{1} four -/f(alpha, beta)five; -/f(alpha) six; ---/f(); -/f(alpha, beta)seven -:; -\p uno *{:2} *{:1} quatro -/: g() sinco -/g(alpha, beta); - - -CREATE TABLE t(i integer, vc varchar(20)); -INSERT INTO t VALUES(1, 'one'); -INSERT INTO t VALUES(2, 'two'); -COMMIT; - --- SQL functions -\. -INSERT INTO t VALUES(3, 'three'); -SELECT -- Trailing whitespace on next line - * *{1} -. -/: h() t --- Trailing whitespace on previous line -* quieter ~ -/h(FROM)WHERE i = 3; -* if (*? != three) - \q SqlTool function for multi-line chunked SQL command with appendages failed -*end if - --- Same but without any appendages -\. -INSERT INTO t VALUES(4, 'four'); -SELECT vc FROM *{1} WHERE i = 4 -. -/: f1() -* quieter ~ -/f1(t); -* if (*? != four) - \q SqlTool function for multi-line chunked SQL command (no appendages) failed -*end if - --- Test function invocation with no params but appendage -\. -INSERT INTO t VALUES(5, 'four'); -SELECT vc FROM t -. -/: f2() -* quieter ~ -/f2() WHERE i = 4; -* if (*? != four) - \q SqlTool function for multi-line chunked SQL command (no params) failed -*end if diff --git a/database/hsqldb/testrun/sqltool/goodsqlonly.sql b/database/hsqldb/testrun/sqltool/goodsqlonly.sql deleted file mode 100644 index 1df8f821..00000000 --- a/database/hsqldb/testrun/sqltool/goodsqlonly.sql +++ /dev/null @@ -1,7 +0,0 @@ -/* - * $Id: goodsqlonly.sql 610 2008-12-22 15:54:18Z unsaved $ - * - * Just runs some successful SQL. - */ - -CREATE TABLE t(i INTEGER); diff --git a/database/hsqldb/testrun/sqltool/history.inter b/database/hsqldb/testrun/sqltool/history.inter deleted file mode 100644 index 30be85af..00000000 --- a/database/hsqldb/testrun/sqltool/history.inter +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $Id: history.inter 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests simple recalls and executes : and :;. - */ - -\c false -/* Since running interactively, need to either invoke with --abortOnErr switch, - * or use "\c false" Special command, to detect failures. */ - -CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR(80)); - -/* Just verify that an error is not thrown by the two following commands. - And that they don't effect the command history. */ -:b -:h - -INSERT INTO t(vc) VALUES('one'); -INSERT INTO t(vc) VALUES('two'); -INSERT INTO t(vc) VALUES('three'); - -/* Test simple recall and execution */ -:4 -:; -:4; -:; - -SELECT count(*) FROM t -*if (*? != 6) \q Recall and execs failed / 1 - -/* SELECT vc FROM t; */ -SELECT count(*) FROM t WHERE vc = 'two'; -*if (*? != 4) \q Recall and execs failed / 2 - -:/ee/; - -SELECT count(*) FROM t; -*if (*? != 7) \q Regex Recall and execs failed / 1 - -/* SELECT vc FROM t; */ -SELECT count(*) FROM t WHERE vc = 'three'; -*if (*? != 2) \q Regex Recall and execs failed / 2 diff --git a/database/hsqldb/testrun/sqltool/inlineif.sql b/database/hsqldb/testrun/sqltool/inlineif.sql deleted file mode 100644 index bac0db31..00000000 --- a/database/hsqldb/testrun/sqltool/inlineif.sql +++ /dev/null @@ -1,132 +0,0 @@ -/* - * $Id: inlineif.sql 4706 2011-11-05 01:21:45Z unsaved $ - * - * Tests PL control flow. if, foreach statements, etc. - */ - -*if (*UNSET) \q Failed boolean test of an unset variable -*if (astring) * y = something -*if (*X) \q Failed boolean test of a simple string constant -*if (0) \q Failed boolean test of zero constant -*if (!x) \q Failed boolean test of a plain constant - -/* Nested if tests */ -* if (1) - * L1 = true - * if (2) * L2 = true - * L11 = true -* end if -*if (! *L1) \q Pre-nest failure -*if (! *L2) \q Inside-nest failure -*if (! *L11) \q Post-nest failure -* L1 = -* L2 = -* L11 = -* if (1) - * L1 = true - * if (2) * L2 = true - * L11 = true -* end if -*if (! *L1) \q Pre-nest failure -*if (! *L2) \q Inside-nest failure -*if (! *L11) \q Post-nest failure -/* Test deep nesting of IFs, including negatives. */ -* if (1) - * L1 = true - * if (0) * N2 = true - * if (2) - * L2 = true - * if (3) - * L3 = true - * if (4) - * L4 = true - * if (0) * N5 = true - * if (5) - * L5 = true - * if (0) * N6 = true - * if (6) - * L6 = true - * if (0) * N7 = true - * end if - * L51 = true - * end if - * end if - * if (0) * N4 = true - * L31 = true - * end if - * if (0) * N3 = true - * end if - * L11 = true -* end if -*if (! *L1) \q Pre-deep-nest failure 1 -*if (! *L2) \q Inside-deep-nest failure 2 -*if (! *L11) \q Post-deep-nest failure 11 -*if (! *L3) \q Pre-deep-nest failure 3 -*if (! *L4) \q Inside-deep-nest failure 4 -*if (! *L31) \q Post-deep-nest failure 31 -*if (! *L5) \q Pre-deep-nest failure 5 -*if (! *L6) \q Inside-deep-nest failure 6 -*if (! *L51) \q Post-deep-nest failure 51 -*if (*N2) \q Negative deep-nest failure 2 -*if (*N3) \q Negative deep-nest failure 3 -*if (*N4) \q Negative deep-nest failure 4 -*if (*N5) \q Negative deep-nest failure 5 -*if (*N6) \q Negative deep-nest failure 6 -*if (*N7) \q Negative deep-nest failure 7 - -/* Nested foreach tests */ -/* Initialize Results to I */ -* R = I -*foreach L1 (A B C) - *foreach L2 (1 2 3 4) - *foreach L3 (a b) - * R = *{R}:*{L1}*{L2}*{L3} - *end foreach - *end foreach -*end foreach -*if (*R != I:A1a:A1b:A2a:A2b:A3a:A3b:A4a:A4b:B1a:B1b:B2a:B2b:B3a:B3b:B4a:B4b:C1a:C1b:C2a:C2b:C3a:C3b:C4a:C4b) \q nested foreach result unexpected: *{R} -/* Initialize Results to I */ -* R = I -\p before R=(*{R}) -*foreach L1 (A B C) -\p BEFORE R=(*{R}) - *if (*L1 != A) -\p bEFORE R=(*{R}) - *foreach L2 (1 2 3 4) - *if (*L2 != 3) - *foreach L3 (a b c) - *if (*L3 != b) * R = *{R}:*{L1}*{L2}*{L3} - *end foreach - *end if - *end foreach - *end if -*end foreach -*if (*R != I:B1a:B1c:B2a:B2c:B4a:B4c:C1a:C1c:C2a:C2c:C4a:C4c) \q nested conditional foreach result unexpected: *{R} - -/* Test break and continue */ -/* Initialize Results to I */ -* R = I -*foreach L1 (A B C) - *foreach L2 (1 2 3 4) - *foreach L3 (a b) - *if (*L3 == a) *continue - * R = *{R}:*{L1}*{L2}*{L3} - *end foreach - *if (*L2 == 3) *break foreach - *end foreach -*end foreach -*if (*R != I:A1b:A2b:A3b:B1b:B2b:B3b:C1b:C2b:C3b) \q nested foreach result unexpected: *{R} - -/* If something doesn't work right, could get into infinite loop below. */ -* accum=L -*while (1) - * accum = *{accum}P - * subcum = M - *while (*subcum < MQQ) - * subcum = *{subcum}Q - *end while - * accum = *{accum}*{subcum} - *if (*accum == LPMQQPMQQ) *break while -*end while - -*if (*accum != LPMQQPMQQ) \q Wrong value accumulated by nested while loops (*{accum}) diff --git a/database/hsqldb/testrun/sqltool/j.sql b/database/hsqldb/testrun/sqltool/j.sql deleted file mode 100644 index 01015264..00000000 --- a/database/hsqldb/testrun/sqltool/j.sql +++ /dev/null @@ -1,23 +0,0 @@ -/* - * $Id: j.sql 4816 2011-11-24 23:15:42Z unsaved $ - * - * Tests \j command - */ - -CREATE TABLE t1(i int); -INSERT INTO t1 VALUES(11); -COMMIT; - -\j SA jdbc:hsqldb:mem:dataSource2 -SET PASSWORD 'sapwd'; -CREATE TABLE t2(i int); -INSERT INTO t2 VALUES(22); -COMMIT; - -\j SA jdbc:hsqldb:mem:utst -SELECT * FROM t1; -* if (*? != 11) \q \j failed - -\j SA sapwd jdbc:hsqldb:mem:dataSource2 -SELECT * FROM t2; -* if (*? != 22) \q \j failed diff --git a/database/hsqldb/testrun/sqltool/lastval.sql b/database/hsqldb/testrun/sqltool/lastval.sql deleted file mode 100644 index 04ef18cc..00000000 --- a/database/hsqldb/testrun/sqltool/lastval.sql +++ /dev/null @@ -1,28 +0,0 @@ -/* - * $Id: lastval.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests auto-variable ? - */ - -CREATE TABLE t (i INT); - -* if (*? != 0) \q ? variable not capturing CREATE TABLE return value - -INSERT INTO t values (21); -* if (*? != 1) \q ? variable not capturing INSERT return value - -INSERT INTO t values (10); -* if (*? != 1) \q ? variable not capturing INSERT return value - -INSERT INTO t values (43); -* if (*? != 1) \q ? variable not capturing INSERT return value - -SELECT * FROM t ORDER BY i DESC; -* if (*? != 10) \q ? variable not capturing last fetched value - -\p echo some stuff -\p to verify that ? variable value is preserved -* list - -* if (*? != 10) \q ? value not retained after special commands -* if (*{?} != 10) \q ? value not dereferenced with {} usage diff --git a/database/hsqldb/testrun/sqltool/logic.sql b/database/hsqldb/testrun/sqltool/logic.sql deleted file mode 100644 index 6cd8bc98..00000000 --- a/database/hsqldb/testrun/sqltool/logic.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - * $Id: logic.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Logic tests - */ - -*if (1) * T1 = true -*if (! *T1) \q Test of (1) failed -*if (0) \q Test of (0) failed - -*if (! 1) \q Test of (! 1) failed -*if (! 0) * T2 = true -*if (! *T2) \q Test of (! 0) failed - -*if (!1) \q Test of (!1) failed -*if (!0) * T3 = true -*if (!*T3) \q Test of (!0) failed - -* SETVAR=3 -*if (*SETVAR) * T4 = true -*if (! *T4) \q Test of (*SETVAR) failed -*if (*UNSETVAR) \q Test of (*UNSETVAR) failed - -*if (! *SETVAR) \q Test of (! *SETVAR) failed -*if (! *UNSETVAR) * T5 = true -*if (! *T5) \q Test of (! *UNSETVAR) failed - -*if (!*SETVAR) \q Test of (!*SETVAR) failed -*if (!*UNSETVAR) * T6 = true -*if (!*T6) \q Test of (!*UNSETVAR) failed diff --git a/database/hsqldb/testrun/sqltool/logical-ops.sql b/database/hsqldb/testrun/sqltool/logical-ops.sql deleted file mode 100644 index 2a90dae1..00000000 --- a/database/hsqldb/testrun/sqltool/logical-ops.sql +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id: logical-ops.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Test logical operations. - */ - -* three = 3 -* four = 4 - -*if (3 != 3) \q 3 != 3 - -*if (3 == 4) \q 3 == 4 - -*if (3 > 4) \q 3 > 4 - -*if (!4 > 3) \q !4 > 3 - -*if (3 >= 4) \q 3 >= 4 - -*if (4 =< 3) \q 4 =< 3 - -*if (*unset1 != *unset2) \q *unset1 != *unset2 - -*if (3 == three) \q 3 == three - -*if (3 == four) \q 3 == four - -* blankVar1 = -* blankVar2 = -*if (*blankVar1 != *blankVar2) \q *blankVar1 != *blankVar2 - -*if (*blankVar1 == *unset1) \q *blankVar1 == *unset1 - -*if (*{blankVar1} != *{blankVar2}) \q *{blankVar1} != *{blankVar2} diff --git a/database/hsqldb/testrun/sqltool/macro.inter b/database/hsqldb/testrun/sqltool/macro.inter deleted file mode 100644 index c9d09a10..00000000 --- a/database/hsqldb/testrun/sqltool/macro.inter +++ /dev/null @@ -1,37 +0,0 @@ -/* - * $Id: macro.inter 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests interactive macro commands /... - * - * This only tests the buffer macro commands /=:..., so that we can - * manipulate the buffer. - * The other macro commands don't need interactive mode. - */ - - -\c false - -\p hello -/=greet: world -/= -/greet now; - -CREATE TABLE t(i int); -INSERT INTO t VALUES(1); -INSERT INTO t VALUES(2); -INSERT INTO t VALUES(3); -INSERT INTO t VALUES(4); -INSERT INTO t VALUES(5); -COMMIT; - -SELECT count(*) FROM t - -/=q: where - -/q i > 3; - -* if (*? != 2) \q Query returned *{?} rows, should have returned 2. - -/q i > 2 -:; -* if (*? != 3) \q Query returned *{?} rows, should have returned 3. diff --git a/database/hsqldb/testrun/sqltool/macro.sql b/database/hsqldb/testrun/sqltool/macro.sql deleted file mode 100644 index bed798c2..00000000 --- a/database/hsqldb/testrun/sqltool/macro.sql +++ /dev/null @@ -1,37 +0,0 @@ -/* - * $Id: macro.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests interactive macro commands /... - * - * See macro.inter script also. - */ - - -\c false - -/=q SELECT count(*) FROM t - -CREATE TABLE t(i int); -INSERT INTO t VALUES(1); -INSERT INTO t VALUES(2); -INSERT INTO t VALUES(3); -INSERT INTO t VALUES(4); -INSERT INTO t VALUES(5); -COMMIT; - -/q WHERE i > 3; - -* if (*? != 2) \q Query returned *{?} rows, should have returned 2. - -/* Now test with lots of intervening white space */ - / = q SELECT count(*) FROM t WHERE i > *{LIMIT} - - / = setlim * LIMIT = - -* LIMIT = 4 -/q; -* if (*? != 1) \q Query returned *{?} rows, should have returned 1. - -/setlim 3; -/q; -* if (*? != 2) \q Query returned *{?} rows, should have returned 2. diff --git a/database/hsqldb/testrun/sqltool/math.sql b/database/hsqldb/testrun/sqltool/math.sql deleted file mode 100644 index ac81d740..00000000 --- a/database/hsqldb/testrun/sqltool/math.sql +++ /dev/null @@ -1,56 +0,0 @@ -/* - * $Id: math.sql 5406 2014-10-13 20:53:18Z unsaved $ - */ - -*((x=1+2+3)) -* if (*x != 6) \q Tight (non-whitespace) math expression failed - -*z = notanum - * (( z = 1 + 2 + 3 )) -* if (*z != 6) \q Loose (much-whitespace) math expression failed - --- Force an error with a non-integral variable --- *x=werd - -* ((y =(x*2)/3 -(2 + 2))) -* if (*y != 0) \q Math expression with parenthetical nesting failed - -CREATE TABLE t(i INTEGER); - -* ((i = 0)) -* while (*i < 5) - -- \p Next is *{i} - INSERT INTO t VALUES(*{i}); - * ((i = i + 1)) -* end while - -* c _ -SELECT COUNT(*) FROM t; -* if (*c != 5) \q Loop failed to insert right number of records - -* r _ -SELECT COUNT(*) FROM t WHERE i = 4; -* if (*r != 1) \q Loop failed to insert record with i == 4 - -*a = 3 -*((z=a*2)) -*(( z *= 1 + 1 )) -* if (*z != 12) \q Math op #1 failed - --- Series of squares -* sum = 0 -* i = 0 -* while (*i < 5) - * ((sum += i*i)) - * ((i++)) -* end while -* if (*sum != 30) \q Math summation failed --- Count back down -* while (*i > 0) - * ((i-=1)) -- We do not support '--' - * ((sum -= i*i)) -* end while -* if (*sum != 0) \q Reversion of summation failed. *{sum} left over. - -* (( v1 = (3 + 4) ^ (1 + 2) * 3 )) -* if (*v1 != 1029) \q Power operation failed diff --git a/database/hsqldb/testrun/sqltool/nestingschema.sql b/database/hsqldb/testrun/sqltool/nestingschema.sql deleted file mode 100644 index 03d5f404..00000000 --- a/database/hsqldb/testrun/sqltool/nestingschema.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - * $Id: nestingschema.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests a schema creation statement that nests some objects. - */ - -/** - * Besides testing nesting of commands without ; delimiters, this also - * regression tests that the CREATE SCHEMA... command itself does not require - * the closing ; to be sent to the DB engine. - */ -CREATE SCHEMA FELIX AUTHORIZATION DBA - CREATE TABLE FELIXT1 (AV1 VARCHAR(10), BV VARCHAR(10)) - CREATE TABLE FELIXT2 (AV2 VARCHAR(10), BI INTEGER) - CREATE SEQUENCE FELIXS1 - CREATE VIEW FELIXV1 AS SELECT * FROM FELIXT1 JOIN FELIXT2 ON AV1 = AV2 - CREATE VIEW FELIXV2 AS SELECT AV1 AS C1, NEXT VALUE FOR FELIXS1 AS C2 FROM FELIXT1; - -SELECT count(*) FROM felix.felixv2; -*if (*? != 0) \q Nesting CREATE SCHEMA failed diff --git a/database/hsqldb/testrun/sqltool/noop.sql b/database/hsqldb/testrun/sqltool/noop.sql deleted file mode 100644 index b513ae24..00000000 --- a/database/hsqldb/testrun/sqltool/noop.sql +++ /dev/null @@ -1,5 +0,0 @@ -/* - * $Id: noop.sql 610 2008-12-22 15:54:18Z unsaved $ - * - * Simplest test possible. Does absolutely nothing. - */ diff --git a/database/hsqldb/testrun/sqltool/nq-arg1.isql b/database/hsqldb/testrun/sqltool/nq-arg1.isql deleted file mode 100644 index 1579f2f4..00000000 --- a/database/hsqldb/testrun/sqltool/nq-arg1.isql +++ /dev/null @@ -1,10 +0,0 @@ -/* - * $Id: nq-arg1.isql 610 2008-12-22 15:54:18Z unsaved $ - * - * Simplest test of \q from nested script with args - */ - -\q This should cause SqlTool to exit immediately with non-zero exit value. - -/* Following line causes the unit test to fail if the \q above didn't work. -\q diff --git a/database/hsqldb/testrun/sqltool/nq-arg1.nsql b/database/hsqldb/testrun/sqltool/nq-arg1.nsql deleted file mode 100644 index 42da0f42..00000000 --- a/database/hsqldb/testrun/sqltool/nq-arg1.nsql +++ /dev/null @@ -1,10 +0,0 @@ -/* - * $Id: nq-arg1.nsql 610 2008-12-22 15:54:18Z unsaved $ - * - * Test of \q with arg from nested script. - */ - -\i nq-arg1.isql -\p Should not have returned from nested script which ran \q. -/* Following line exits with success status to fail the .nsql unit test. -\q diff --git a/database/hsqldb/testrun/sqltool/nq-noarg1.isql b/database/hsqldb/testrun/sqltool/nq-noarg1.isql deleted file mode 100644 index 1602313a..00000000 --- a/database/hsqldb/testrun/sqltool/nq-noarg1.isql +++ /dev/null @@ -1,10 +0,0 @@ -/* - * $Id: nq-noarg1.isql 610 2008-12-22 15:54:18Z unsaved $ - * - * Simplest test of \q from nested script with no args - */ - -\p Following statement should exit SqlTool immediately with success exit status. -\q - -\q This causes the unit test to fail if the \q above didn't work. diff --git a/database/hsqldb/testrun/sqltool/nq-noarg1.sql b/database/hsqldb/testrun/sqltool/nq-noarg1.sql deleted file mode 100644 index aef31e11..00000000 --- a/database/hsqldb/testrun/sqltool/nq-noarg1.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - * $Id: nq-noarg1.sql 610 2008-12-22 15:54:18Z unsaved $ - * - * Test of \q with arg from nested script. - */ - -\i nq-noarg1.isql -\q Should not have returned from nested script! diff --git a/database/hsqldb/testrun/sqltool/nullempty.sql b/database/hsqldb/testrun/sqltool/nullempty.sql deleted file mode 100644 index f06371c1..00000000 --- a/database/hsqldb/testrun/sqltool/nullempty.sql +++ /dev/null @@ -1,32 +0,0 @@ -/* - * $Id: nullempty.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * This test written verbosely to make it easier to partially share it with - * script sample/nullempty.sql. - * This tests differences between null and empty strings, - * and ? var vs. _/~ variables. - */ - -\p At startup ? is equal to empty string. See between A and B: A*{?}B -* if (A*{?}B != AB) \q ? is not the empty string: *{?} - -CREATE TABLE t(i INTEGER, vc VARCHAR(20)); -INSERT INTO t VALUES(1, 'one'); -INSERT INTO t VALUES(2, 'two'); -* res ~ -SELECT * FROM t; -* if (*? != two) \q ? did not get last cell value -* if (*res != 1) \q res did not get first cell value - -INSERT INTO t VALUES (3, null); -*res ~ -SELECT vc FROM t WHERE i = 3; -* if (*res != **NULL) \q res did not get assigned the SQL Null -* if (*? != [null]) \q ? did not get assigned the *NULL_REP_TOKEN: *{?} - --- This will prevent SqlTool from aborting when we run a bad SQL statement: -\c true -*res ~ -SELECT hocus FROM pocus; -* if (*? != **NULL) \q ? did not get assigned null upon SQL failure: *{?} -* if (*res != **NULL) \q res did not get assigned null upon SQL failure: *{res} diff --git a/database/hsqldb/testrun/sqltool/nullrep-alt.dsv b/database/hsqldb/testrun/sqltool/nullrep-alt.dsv deleted file mode 100644 index f5f618e2..00000000 --- a/database/hsqldb/testrun/sqltool/nullrep-alt.dsv +++ /dev/null @@ -1,8 +0,0 @@ -targettable=t} -} -# Following (header) line has intentional trailing whitespace.} -id: i : r : d : t : v : b } -} -# Following line has intentional trailing whitespace (and mixed case).} -wspaces: %% : %% : %% : %% : %% : %% } -nospaces:%%:%%:%%:%%:%%:%%} diff --git a/database/hsqldb/testrun/sqltool/nullrep.dsv b/database/hsqldb/testrun/sqltool/nullrep.dsv deleted file mode 100644 index 91af7479..00000000 --- a/database/hsqldb/testrun/sqltool/nullrep.dsv +++ /dev/null @@ -1,8 +0,0 @@ -targettable=t - -# Following (header) line has intentional trailing whitespace. -id| i | r | d | t | v | b - -# Following line has intentional trailing whitespace (and mixed case). -wspaces| [null] | [null] | [null] | [null] | [null] | [null] -nospaces|[null]|[null]|[null]|[null]|[null]|[null] diff --git a/database/hsqldb/testrun/sqltool/nullrep.sql b/database/hsqldb/testrun/sqltool/nullrep.sql deleted file mode 100644 index 0812f77b..00000000 --- a/database/hsqldb/testrun/sqltool/nullrep.sql +++ /dev/null @@ -1,85 +0,0 @@ -/* - * $Id: nullrep.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests enforcement of null-representation token - */ - -CREATE TABLE t (i INT, vc VARCHAR(80)); - -INSERT INTO t VALUES(1, 'one'); -/** For INPUT, the NULLREP is only used for DSV imports, since unquoted - * null works perfectly for other forms of input. - * Therefore, following should enter "[null]" literally. - */ -INSERT INTO t VALUES(2, '[null]'); -INSERT INTO t VALUES(3, null); - -* COUNT _ -SELECT count(*) FROM t WHERE i = 2 AND vc IS NULL; -* if (*COUNT != 0) - \q Seems that non-DSV insertion of '[null]' inserted a real NULL -* end if - -* COUNT _ -SELECT count(*) FROM t WHERE i = 3 AND vc IS null; -* if (*COUNT != 1) - \q Seems that non-DSV insertion of plain null did not insert a SQL NULL -* end if -DROP TABLE t; - - -/* Now test nullrep tokens with DSV imports */ -CREATE TABLE t ( - id VARCHAR(80) PRIMARY KEY, - i INTEGER, - r REAL, - d DATE, - t TIMESTAMP, - v VARCHAR(80), - b BOOLEAN -); - -\m nullrep.dsv -SELECT count(*) FROM t WHERE id = 'wspaces' AND i IS null; -*if (*? != 1) \q Insertion of INTEGER space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND r IS null; -*if (*? != 1) \q Insertion of REAL space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND d IS null; -*if (*? != 1) \q Insertion of DATE space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND t IS null; -*if (*? != 1) \q Insertion of TIMESTAMP space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND v = ' [null] '; -*if (*? != 1) \q Insertion of VARCHAR w/ space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND b IS null; -*if (*? != 1) \q Insertion of BOOLEAN space-embedded null-rep-token failed - -DELETE FROM t; - -/** Repeat test with some non-default DSV settings */ -* *NULL_REP_TOKEN = %% -* *DSV_COL_SPLITTER = : -* *DSV_ROW_SPLITTER = \}(?:\r\n|\r|\n) - -\m nullrep-alt.dsv -SELECT count(*) FROM t WHERE id = 'wspaces' AND i IS null; -*if (*? != 1) \q Insertion of INTEGER space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND r IS null; -*if (*? != 1) \q Insertion of REAL space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND d IS null; -*if (*? != 1) \q Insertion of DATE space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND t IS null; -*if (*? != 1) \q Insertion of TIMESTAMP space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND v = ' %% '; -*if (*? != 1) \q Insertion of VARCHAR w/ space-embedded null-rep-token failed - -SELECT count(*) FROM t WHERE id = 'wspaces' AND b IS null; -*if (*? != 1) \q Insertion of BOOLEAN space-embedded null-rep-token failed diff --git a/database/hsqldb/testrun/sqltool/plcontrolflow.sql b/database/hsqldb/testrun/sqltool/plcontrolflow.sql deleted file mode 100644 index 5c39ad30..00000000 --- a/database/hsqldb/testrun/sqltool/plcontrolflow.sql +++ /dev/null @@ -1,150 +0,0 @@ -/* - * $Id: plcontrolflow.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests PL control flow. if, foreach statements, etc. - */ - -*if (*UNSET) \q Failed boolean test of an unset variable -*if (astring) * y = something -*if (*X) \q Failed boolean test of a simple string constant -*if (0) \q Failed boolean test of zero constant -*if (!x) \q Failed boolean test of a plain constant - - -/* Nested if tests */ -* if (1) - * L1 = true - * if (2) * L2 = true - * L11 = true -* end if -*if (! *L1) \q Pre-nest failure -*if (! *L2) \q Inside-nest failure -*if (! *L11) \q Post-nest failure -* L1 = -* L2 = -* L11 = -* if (1) - * L1 = true - * if (2) * L2 = true - * L11 = true -* end if -*if (! *L1) \q Pre-nest failure -*if (! *L2) \q Inside-nest failure -*if (! *L11) \q Post-nest failure -/* Test deep nesting of IFs, including negatives. No inlines. */ -* if (1) - * L1 = true - * if (0) - * N2 = true - * end if - * if (2) - * L2 = true - * if (3) - * L3 = true - * if (4) - * L4 = true - * if (0) - * N5 = true - * end if - * if (5) - * L5 = true - * if (0) - * N6 = true - * end if - * if (6) - * L6 = true - * if (0) - * N7 = true - * end if - * end if - * L51 = true - * end if - * end if - * if (0) - * N4 = true - * end if - * L31 = true - * end if - * if (0) - * N3 = true - * end if - * end if - * L11 = true -* end if -*if (! *L1) \q Pre-deep-nest failure 1 -*if (! *L2) \q Inside-deep-nest failure 2 -*if (! *L11) \q Post-deep-nest failure 11 -*if (! *L3) \q Pre-deep-nest failure 3 -*if (! *L4) \q Inside-deep-nest failure 4 -*if (! *L31) \q Post-deep-nest failure 31 -*if (! *L5) \q Pre-deep-nest failure 5 -*if (! *L6) \q Inside-deep-nest failure 6 -*if (! *L51) \q Post-deep-nest failure 51 -*if (*N2) \q Negative deep-nest failure 2 -*if (*N3) \q Negative deep-nest failure 3 -*if (*N4) \q Negative deep-nest failure 4 -*if (*N5) \q Negative deep-nest failure 5 -*if (*N6) \q Negative deep-nest failure 6 -*if (*N7) \q Negative deep-nest failure 7 - -/* Nested foreach tests */ -/* Initialize Results to I */ -* R = I -*foreach L1 (A B C) - *foreach L2 (1 2 3 4) - *foreach L3 (a b) - * R = *{R}:*{L1}*{L2}*{L3} - *end foreach - *end foreach -*end foreach -*if (*R != I:A1a:A1b:A2a:A2b:A3a:A3b:A4a:A4b:B1a:B1b:B2a:B2b:B3a:B3b:B4a:B4b:C1a:C1b:C2a:C2b:C3a:C3b:C4a:C4b) - \q nested foreach result unexpected: *{R} -*end if -/* Initialize Results to I */ -* R = I -*foreach L1 (A B C) - *if (*L1 != A) - *foreach L2 (1 2 3 4) - *if (*L2 != 3) - *foreach L3 (a b c) - *if (*L3 != b) * R = *{R}:*{L1}*{L2}*{L3} - *end foreach - *end if - *end foreach - *end if -*end foreach -*if (*R != I:B1a:B1c:B2a:B2c:B4a:B4c:C1a:C1c:C2a:C2c:C4a:C4c) - \q nested conditional foreach result unexpected: *{R} -*end if - -/* Test break and continue */ -/* Initialize Results to I */ -* R = I -*foreach L1 (A B C) - *foreach L2 (1 2 3 4) - *foreach L3 (a b) - *if (*L3 == a) *continue - * R = *{R}:*{L1}*{L2}*{L3} - *end foreach - *if (*L2 == 3) *break foreach - *end foreach -*end foreach -*if (*R != I:A1b:A2b:A3b:B1b:B2b:B3b:C1b:C2b:C3b) - \q nested foreach result unexpected: *{R} -*end if - -/* If something doesn't work right, could get into infinite loop below. */ -* accum=L -*while (1) - * accum = *{accum}P - * subcum = M - *while (*subcum < MQQ) - * subcum = *{subcum}Q - *end while - * accum = *{accum}*{subcum} - *if (*accum == LPMQQPMQQ) *break while -*end while - -*if (*accum != LPMQQPMQQ) - \q Wrong value accumulated by nested while loops (*{accum}) -*end if diff --git a/database/hsqldb/testrun/sqltool/q-arg1.nsql b/database/hsqldb/testrun/sqltool/q-arg1.nsql deleted file mode 100644 index 207fd9cc..00000000 --- a/database/hsqldb/testrun/sqltool/q-arg1.nsql +++ /dev/null @@ -1,7 +0,0 @@ -/* - * $Id: q-arg1.nsql 610 2008-12-22 15:54:18Z unsaved $ - * - * Simplest test of \q with arg - */ - -\q Quitting with non-zero exit status diff --git a/database/hsqldb/testrun/sqltool/q-noarg1.sql b/database/hsqldb/testrun/sqltool/q-noarg1.sql deleted file mode 100644 index 4fd9d196..00000000 --- a/database/hsqldb/testrun/sqltool/q-noarg1.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - * $Id: q-noarg1.sql 610 2008-12-22 15:54:18Z unsaved $ - * - * Simplest test of \q with no args - */ - -\p Just quitting. Should exit with 0 (success) exit status. -\q diff --git a/database/hsqldb/testrun/sqltool/rawmode.sql b/database/hsqldb/testrun/sqltool/rawmode.sql deleted file mode 100644 index 7f7206eb..00000000 --- a/database/hsqldb/testrun/sqltool/rawmode.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - * $Id: rawmode.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests raw mode - */ - -CREATE TABLE t (i INTEGER); -INSERT INTO t values (42); - -/** Adding a few blank lines in what is sent to server on purpose. */ -\. - - -SELECT i FROM t - - -.; - -*if (*? != 42) \q Raw command failed - --- To change results so we can be confident of getting 1 later on. -INSERT INTO t values (43); -SELECT * FROM t; - -\. -SELECT count(*) FROM t -. -:a WHERE i = 42 -; -*if (*? != 1) \q Raw command failed diff --git a/database/hsqldb/testrun/sqltool/re.inter b/database/hsqldb/testrun/sqltool/re.inter deleted file mode 100644 index 1cc4ef37..00000000 --- a/database/hsqldb/testrun/sqltool/re.inter +++ /dev/null @@ -1,4 +0,0 @@ -CALL 'token'; -CALL 'other'; -:/tok/; -*if (*? != token) \q Token is not 'token' but: *{?} diff --git a/database/hsqldb/testrun/sqltool/return.isql b/database/hsqldb/testrun/sqltool/return.isql deleted file mode 100644 index e2f5dd4f..00000000 --- a/database/hsqldb/testrun/sqltool/return.isql +++ /dev/null @@ -1,11 +0,0 @@ -/** - * The return statement below should abort this script immediately without - * triggering any error handling. - */ - -* VAR=*{VAR} two - -* return - -\q return did not cause nested script ireturn.sql to return -* VAR=*{VAR} three diff --git a/database/hsqldb/testrun/sqltool/return.sql b/database/hsqldb/testrun/sqltool/return.sql deleted file mode 100644 index eb0ff2a4..00000000 --- a/database/hsqldb/testrun/sqltool/return.sql +++ /dev/null @@ -1,17 +0,0 @@ -/* - * $Id: return.sql 4717 2011-11-07 00:28:07Z unsaved $ - * - * Tests the new "return" statement, which is equivalent to a "break" statement - * with no parameter. - */ - -* VAR=one -\i return.isql -* VAR=*{VAR} three - -* EXPECTED = one two three -* if (*VAR != *EXPECTED) \q return statement failed: (*{VAR}) vs. (*{EXPECTED}) - -* return - -\q return.sql ran past the return statement diff --git a/database/hsqldb/testrun/sqltool/rowcount.sql b/database/hsqldb/testrun/sqltool/rowcount.sql deleted file mode 100644 index 31702d3e..00000000 --- a/database/hsqldb/testrun/sqltool/rowcount.sql +++ /dev/null @@ -1,30 +0,0 @@ -/* - * $Id: rowcount.sql 5446 2015-03-22 18:06:56Z unsaved $ - * - * Tests automatic variable # - */ - -create table t(i int, vc varchar(25)); -insert into t values(1, 'one'); -insert into t values(2, 'two'); -insert into t values(null, 'three'); -insert into t values(4, null); -* var = x - -*if (*# != 0) \q Initial value of # != 0: *{#} - -*forrows INT VCHAR -SELECT * FROM t WHERE i IS NOT null; - *if (*# != 3) \q # inside forrows != 3: *{#} -*end forrows -*if (*# != 3) \q # after forrows != 3: *{#} - -SELECT * FROM t WHERE i = 2; -*if (*# != 1) \q # after single-row SELECT: *{#} --- Test with nesting -*if (1 == 1) - *if (*# != 1) \q # nexted after single-row SELECT: *{#} - SELECT * FROM t WHERE i > 1; - *if (*# != 2) \q # after SELECT != 2: *{#} -*end if -*if (*# != 2) \q # after nested SELECT != 2: *{#} diff --git a/database/hsqldb/testrun/sqltool/runtests.cmd b/database/hsqldb/testrun/sqltool/runtests.cmd deleted file mode 100644 index ad542826..00000000 --- a/database/hsqldb/testrun/sqltool/runtests.cmd +++ /dev/null @@ -1,66 +0,0 @@ - -:: $Id: runtests.cmd 4697 2011-11-04 13:32:05Z unsaved $ -:: Distribution is permitted under the terms of the HSQLDB license. -:: (c) 2011 The HSQL Development Group -:: -:: Wrapper that serves two purposes: -:: (1) Takes traditional parameters in format: command -switches... filenames... -:: and converts to a Gradle command of format: Gradle -P x=y... taskname -:: (2) Invokes the 'gradlew' wrapper script supplied by the HyperSQL -:: distribution. -:: This script automatically 'cd's to directory .../testrun/sqltool in which -:: it resides, so that it may be safely executed from desktop managers, etc. -:: The main work script, "runtests.groovy" does not have this limitation. -:: -:: author: Blaine Simpson, unsaved@users.sourceforge.net -:: since: HSQLDB 1.8.0.8 / 1.9.x -:: see: README.txt in this same directory. -:: In November 2011 this script converted from the sole test runner script, to -:: one wrapper for Gradle (w/ "build.gradle") + runtests.groovy. - -@echo off - -if "%OS%"=="Windows_NT" setlocal -set ERRORLEVEL= -ver > nul - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -cd "%DIRNAME%" - -if "%1" == "-h" ( - set VERBOSE=-Phelp=true - shift -) else if "%1" == "-v" ( - set VERBOSE=-Pverbose=true - shift -) else if "%1" == "-n" ( - set NORUN=-Pnorun=true - shift -) else if "%1" == "-nv" ( - set VERBOSE=-Pverbose=true - set NORUN=-Pnorun=true - shift -) else if "%1" == "-vn" ( - set VERBOSE=-Pverbose=true - set NORUN=-Pnorun=true - shift -) - -set SCRIPTLIST= -:moreArgs - if "%1" == "" goto noMoreArgs - if not "%SCRIPTLIST%" == "" ( - set SCRIPTLIST=%SCRIPTLIST%,%1 - ) else ( - set SCRIPTLIST=-Pscripts=%1 - ) - shift -goto moreArgs - -:noMoreArgs - -if "%VERBOSE%" == "true" echo ..\..\build\gradlew %HELP% %VERBOSE% %NORUN% %SCRIPTLIST% -..\..\build\gradlew %HELP% %VERBOSE% %NORUN% %SCRIPTLIST% -:: People who have a real, local Gradl installation can use the following: -::gradle %HELP% %VERBOSE% %NORUN% %SCRIPTLIST% diff --git a/database/hsqldb/testrun/sqltool/runtests.groovy b/database/hsqldb/testrun/sqltool/runtests.groovy deleted file mode 100644 index 0444399a..00000000 --- a/database/hsqldb/testrun/sqltool/runtests.groovy +++ /dev/null @@ -1,170 +0,0 @@ -#!/usr/bin/env groovy -/* - * $Id: runtests.groovy 6377 2021-11-18 14:51:35Z unsaved $ - * Distribution is permitted under the terms of the HSQLDB license. - * (c) 2011 The HSQL Development Group - */ - -/** - * The I/O in this class could be simplified it were not necessary to support - * Gradle. - * Gradle intercedes with stdout (and stderr), requiring the flushes and usage - * of System.console(). The latter makes this script require Java 6 or later. - * - * @author: Blaine Simpson, unsaved@users.sourceforge.net - * @since HyperSQL 2.2.6 - */ - -import java.util.logging.Logger - -class SqlToolTester { - private static Logger logger = Logger.getLogger(SqlToolTester.class.name) - private static boolean doJvmExit = true - private static String helpMessage = '''groovy runtests.groovy [-h] [-nv] [testscript.sql...] --h displays this message. -With -v, output from SqlTool will be shown. Otherwise, only tests and results -will be shown. -With -n, SqlTool will not actually be invoked. -If no script names are supplied, *.sql and *.nsql from the current directory -will be executed. -Exit value is number of test failures, or 1 for other errors or if number of -test failures exceeds 255 (shell scripts can't handle exit values > 255). - -Non-verbose Result Key: - T = Testing - + = test Succeeded - - = test Failed''' - - public static void runTests(def params) { - boolean noRun, verbose - while (params.size() > 0 - && params[0].length() > 0 && params[0].charAt(0) == '-') { - if (params[0].indexOf('n') > 0) noRun = true - if (params[0].indexOf('v') > 0) verbose = true - if (params[0].indexOf('h') > 0) { - println helpMessage - return - } - params.remove(0) - } - File javaBinDir = new File(System.properties['java.home'], 'bin') - assert ([javaBinDir.absolutePath + System.properties['file.separator'] - + 'java', '-version'].execute().waitFor() == 0) : - "Executable Java not found under Java home '$javaBinDir.absolutePath'" - String sqlToolPath = '../../lib/sqltool.jar' - File sqlToolFile = new File(sqlToolPath) - String sqlToolClassName = 'org.hsqldb.cmdline.SqlTool' - boolean useJar = true - if (!sqlToolFile.canRead()) { - try { - Class.forName(sqlToolClassName) - } catch (Exception e) { - throw new IOException("SqlTool is available neither at '$sqlToolPath' nor via CLASSPATH") - } - useJar = false - logger.warning("SqlTool jar file not available at '$sqlToolPath', therefore using it from CLASSPATH") - } else if (!sqlToolFile.isFile()) - throw new IOException("Not a read file: $sqlToolFile.absolutePath") - def pbParams = [ - 'java', - '-ea', - // either '-jar path.jar' or 'class.Name' will be inserted here - '--noAutoFile', - '-Ptestvar=plval', - '--inlineRc=user=sa,url=jdbc:hsqldb:mem:utst,password=,transiso=TRANSACTION_READ_COMMITTED', - null // Sometimes we'll specify script, sometimes not - ] - if (useJar) { - pbParams.add(2, sqlToolPath) - pbParams.add(2, '-jar') - } else { - pbParams.add(2, sqlToolClassName) - } - def scripts = [] - if (params.size() > 0) { - for (p in params) scripts << new File(p) - } else { - AntBuilder ant = new AntBuilder() - for (suffix in ['.sql', '.nsql', '.inter']) - for (f in (ant.fileScanner { - fileset(dir: '.') { include(name: "*$suffix") } - })) scripts << f - } - if (scripts.size() < 1) - throw new IllegalStateException( - 'No *.sql, *.ndsql, or *.inter scripts in current directory') - for (f in scripts) { - //println f.name - if (!f.canRead()) - throw new IOException("Can't read file: $f.absolutePath") - if (!f.isFile()) - throw new IOException("Not a read file: $f.absolutePath") - } - - println scripts.size() + ' test(s) to run...' - boolean isInter - def runParams - boolean succeeded - def failedScriptNames = [] - PrintWriter cPrinter = System.console().writer() - StringWriter sWriter -StringWriter eWriter - for (f in scripts) { - isInter = f.name.endsWith('.inter') - if (!isInter) pbParams[pbParams.size()-1] = f.name - runParams = isInter ? pbParams[0..pbParams.size()-2] : pbParams - if (verbose) { - logger.info(runParams.join(' ')) - } else { - cPrinter.print('T') - cPrinter.flush() - } - if (noRun) continue - sWriter = new StringWriter() // Unfortunately, can't re-use - // To process stderr separately, remove the redirectErrorStream - // call below, and add a p.consumeProcessErrorStream(eWriter) - Process p = new ProcessBuilder(runParams) - .redirectErrorStream(true).start() - if (isInter) - p.withWriter { it.write(f.getText('UTF-8')) } - else - p.out.close() - if (verbose) - p.consumeProcessOutputStream(sWriter) - else - p.consumeProcessOutput() - succeeded = (p.waitFor() == 0) ^ f.name.endsWith('.nsql') - if (!succeeded) failedScriptNames << f.name - if (verbose) { - print sWriter.toString() - println succeeded ? 'SUCCESS' : 'FAIL' - } else { - cPrinter.print('\b') - cPrinter.print(succeeded ? '+' : '-') - cPrinter.flush() - } - } - if (!verbose) cPrinter.println() - if (failedScriptNames.size() < 1) { - if (doJvmExit) System.exit(0) - return - } - - println """For details, run again against each failed script individually with -v -switch, like 'groovy runtests.groovy -v failedscript.sql'. -${failedScriptNames.size()} tests failed out of ${scripts.size()}:""" - println failedScriptNames.join(System.properties['line.separator']) - if (doJvmExit) - System.exit((failedScriptNames.size() > 255) - ? 1 : failedScriptNames.size()) - assert false: - Integer.toString(failedScriptNames.size()) + ' test(s) failed' - } -} - -def ps = Arrays.asList(args) as ArrayList -if (ps.size() > 0 && ps[0] == 'NO_JVM_EXIT') { - SqlToolTester.doJvmExit = false - ps.remove(0) -} -SqlToolTester.runTests(ps) diff --git a/database/hsqldb/testrun/sqltool/sqlarray.sql b/database/hsqldb/testrun/sqltool/sqlarray.sql deleted file mode 100644 index 3f706e01..00000000 --- a/database/hsqldb/testrun/sqltool/sqlarray.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - * $Id: sqlarray.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests basic usage of SQL Arrays - */ - -CREATE TABLE a (i BIGINT PRIMARY KEY, ar INTEGER ARRAY); - -INSERT INTO a VALUES (1, array [11, null, 13]); -INSERT INTO a VALUES (2, null); -INSERT INTO a VALUES (3, array [21, 22]); - -* ROWCOUNT _ -SELECT count(*) FROM a; - -* if (*ROWCOUNT != 3) \q Failed to insert 3 rows with SQL Values - -* ROWCOUNT _ - SELECT count(*) FROM a WHERE i = 1 AND ar[3] = 13; -* if (*ROWCOUNT != 1) \q Failed to read imported SQL Array Element diff --git a/database/hsqldb/testrun/sqltool/sqljrt.sql b/database/hsqldb/testrun/sqltool/sqljrt.sql deleted file mode 100644 index 0def56d6..00000000 --- a/database/hsqldb/testrun/sqltool/sqljrt.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - * $Id: sqljrt.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests SQL/JRT - */ - -create function dehex(VARCHAR(80), INTEGER) - returns INTEGER - no sql - language java - external name 'CLASSPATH:java.lang.Integer.valueOf' -.; - -CALL dehex('12', 16); -*if (*? != 18) \q SQL/JRT function failed diff --git a/database/hsqldb/testrun/sqltool/sqlpsm.sql b/database/hsqldb/testrun/sqltool/sqlpsm.sql deleted file mode 100644 index 7c2ce079..00000000 --- a/database/hsqldb/testrun/sqltool/sqlpsm.sql +++ /dev/null @@ -1,23 +0,0 @@ -/* - * $Id: sqlpsm.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests SQL/JRT - */ - -create table customers( - id INTEGER default 0, firstname VARCHAR(50), lastname VARCHAR(50), - entrytime TIMESTAMP); - -create procedure new_customer(firstname varchar(50), lastname varchar(50)) - modifies sql data - insert into customers values ( - default, firstname, lastname, current_timestamp) -.; - -SELECT count(*) FROM customers; -*if (*? != 0) \q SQL/PSM preparation failed - -CALL new_customer('blaine', 'simpson'); - -SELECT count(*) FROM customers; -*if (*? != 1) \q SQL/PSM procedure failed diff --git a/database/hsqldb/testrun/sqltool/subdir/atuser.sql b/database/hsqldb/testrun/sqltool/subdir/atuser.sql deleted file mode 100644 index c1381797..00000000 --- a/database/hsqldb/testrun/sqltool/subdir/atuser.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - * $Id: atuser.sql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Test loading other files with @ - */ - -\i @/tblx.sql - -\m @/tblx.dsv - -SELECT COUNT(*) FROM tblx; -*if (*? != 2) \q Failed to load table deta from @ directory diff --git a/database/hsqldb/testrun/sqltool/subdir/tblx.dsv b/database/hsqldb/testrun/sqltool/subdir/tblx.dsv deleted file mode 100644 index 7a27a62f..00000000 --- a/database/hsqldb/testrun/sqltool/subdir/tblx.dsv +++ /dev/null @@ -1,3 +0,0 @@ -id|vc -1|one -2|two diff --git a/database/hsqldb/testrun/sqltool/subdir/tblx.sql b/database/hsqldb/testrun/sqltool/subdir/tblx.sql deleted file mode 100644 index 59f8b3bb..00000000 --- a/database/hsqldb/testrun/sqltool/subdir/tblx.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - * $Id: tblx.sql 3714 2010-07-22 02:28:38Z unsaved $ - * - * Test loading other files with @ - */ - -CREATE TABLE tblx ( - id INTEGER, - vc VARCHAR(10) -); diff --git a/database/hsqldb/testrun/sqltool/subst.inter b/database/hsqldb/testrun/sqltool/subst.inter deleted file mode 100644 index c6ac1c18..00000000 --- a/database/hsqldb/testrun/sqltool/subst.inter +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $Id: subst.inter 5406 2014-10-13 20:53:18Z unsaved $ - * - * Tests interactive commands :s*. - */ - -\c false -/* Since running interactively, need to either invoke with --abortOnErr switch, - * or use "\c false" Special command, to detect failures. */ - -CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR(80)); - -INSERT INTO t(vc) VALUES('one') - -/* In interactive mode, the blank line above will move the command to the - * edit buffer without executing it. */ - -:s/n/MM/; -/*Since this executes, command #3 in history will become "INSERT... 'oMMe'".*/ - -SELECT count(*) FROM t; -*if (*? != 1) \q Blank lines not behaving right in Interactive mode - -SELECT count(*) FROM t WHERE vc = 'oMMe'; -*if (*? != 1) \q Simple substitution of edit buffer failed. - -/* Tailing white space in line below, on purpose. */ -:3 s@M@.@g; - -SELECT count(*) FROM t; -*if (*? != 2) \q Recall + subst. + exec failed / 1 - -SELECT count(*) FROM t WHERE vc = 'o..e'; -*if (*? != 1) \q Recall + subst. + exec failed / 2 - -:3 -/* Purposeful trailing white space in following line */ -:s:MM:x:g -:; - -SELECT count(*) FROM t; -*if (*? != 3) \q Recall + subst., then exec failed / 1 - -SELECT count(*) FROM t WHERE vc = 'oxe'; -*if (*? != 1) \q Recall + subst., then exec failed / 2 - -:/INSERT.*MM/ -:s/Me/End/; -\q -:/INSERT.*MM/s/(?-i)o/Begin/; - -SELECT count(*) FROM t; -*if (*? != 5) \q Regex Recall + subst., then exec failed / 1 - -SELECT count(*) FROM t WHERE vc = 'oMEnd'; -*if (*? != 1) \q Regex Recall + subst., then exec failed / 2 - -SELECT count(*) FROM t WHERE vc = 'Begin..e'; -*if (*? != 1) \q Regex Recall + subst., then exec failed / 3 diff --git a/database/hsqldb/testrun/sqltool/testcases.txt b/database/hsqldb/testrun/sqltool/testcases.txt deleted file mode 100644 index 2f75f940..00000000 --- a/database/hsqldb/testrun/sqltool/testcases.txt +++ /dev/null @@ -1,38 +0,0 @@ -$Id: testcases.txt 4713 2011-11-06 23:41:51Z unsaved $ - -This list is incomplete. -It just takes more time than I am willing to dedicate to keep documenting ever -new test script. -If you want to know what a script for and it's not listed here, you'll have to -open the script file and look at it. - -file items/features tested ------------ ---------------------------- -dsv-trimming.sql DSV import tests, including trimming of whitespace. -lastval.sql Test automatic ? variable. -nullrep.sql Test the null-representation token (default and custom). -q-noarg*.sql Test for success status \q exits. -q-arg*.nsql Tests for failure status "\q arg..." exits. -noop.sql Does nothing (exit status should be success). -goodsqlonly.sql Executes some successful SQL. -badsqlonly.nsql Executes some bad SQL. -logic.sql Conditional expression tests. -nq-noarg*.sql Test for success status \q exits, in nested script. -nq-arg*.nsql Tests for failure status "\q arg..." exits, in nested script. -plcontrolflow.sql Test of PL control flow commands like if, foreach, etc. -rawmode.sql Test of raw input mode. -dsv-constcols.sql *DSV_CONST_COLS usage. -dsv-omits.sql Test omitting of columns in DSV imports. -dsv-prepare.sql Test "* prepare" command. -dsv-rejects.sql Test import behavior when a reject file/report is in place. -dsv-roundtrip.sql Exports and re-import data, verifying that is hasn't changed. -subst.inter Tests interactive commands :s... -write.inter Tests interactive command :w -append.inter Tests interactive commands :a... -history.inter Tests interactive recall/execute commands (plus :h, :b) -comments.sql Tests -- and /*...*/ comments. -errhandling.sql Handling errors which occur within blocks and nested scripts -errhandling.nsql Handling errors which occur within blocks and nested scripts -adv-comments.sql Advanced comments -macro.inter Macors (interactive buffer manipulation) -macro.sql Macros, main diff --git a/database/hsqldb/testrun/sqltool/unseteval.nsql b/database/hsqldb/testrun/sqltool/unseteval.nsql deleted file mode 100644 index d95c4e35..00000000 --- a/database/hsqldb/testrun/sqltool/unseteval.nsql +++ /dev/null @@ -1,8 +0,0 @@ -/* - * $Id: unseteval.nsql 5406 2014-10-13 20:53:18Z unsaved $ - * - * Invokes another script that defines variables. - * Then we test that we have access to the variables. - */ - -*if (*{unset} == 3) \p Should not succeed diff --git a/database/hsqldb/testrun/sqltool/unsetvar.nsql b/database/hsqldb/testrun/sqltool/unsetvar.nsql deleted file mode 100644 index b61c2478..00000000 --- a/database/hsqldb/testrun/sqltool/unsetvar.nsql +++ /dev/null @@ -1,8 +0,0 @@ -/* - * $Id: unsetvar.nsql 4428 2011-10-01 01:04:34Z unsaved $ - * - * Invokes another script that defines variables. - * Then we test that we have access to the variables. - */ - -\p *{unsetvar} diff --git a/database/hsqldb/testrun/sqltool/unsetvar.sql b/database/hsqldb/testrun/sqltool/unsetvar.sql deleted file mode 100644 index 8b0bc178..00000000 --- a/database/hsqldb/testrun/sqltool/unsetvar.sql +++ /dev/null @@ -1,13 +0,0 @@ -/* - * $Id: unsetvar.sql 5406 2014-10-13 20:53:18Z unsaved $ - */ - -\p *{:unsetvar} - -*if (*x != *y) \q Two unset variables are not equal - -*x = -*if (*x == *y) \q A variable set to '' is equal to an unset variable - -*z = -*if (*x != *z) \q Two variables set to '' are not equal diff --git a/database/hsqldb/testrun/sqltool/urlnester.sql b/database/hsqldb/testrun/sqltool/urlnester.sql deleted file mode 100644 index 1cc23c2d..00000000 --- a/database/hsqldb/testrun/sqltool/urlnester.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - * $Id: urlnester.sql 5863 2018-12-17 22:27:19Z unsaved $ - * - * Invokes another script that defines variables. - * Then we test that we have access to the variables. - */ - -/* Want to test with no user variables set like this, but unfortunately the - test script invoker always sets one user variable: -\p *{testvar} -- Should not expand the variable but should not abort -*/ - -\i file:varnestee.isql - -\p *{x} diff --git a/database/hsqldb/testrun/sqltool/varnestee.isql b/database/hsqldb/testrun/sqltool/varnestee.isql deleted file mode 100644 index f698e908..00000000 --- a/database/hsqldb/testrun/sqltool/varnestee.isql +++ /dev/null @@ -1 +0,0 @@ -* x = eks diff --git a/database/hsqldb/testrun/sqltool/varnester.sql b/database/hsqldb/testrun/sqltool/varnester.sql deleted file mode 100644 index aec02ab2..00000000 --- a/database/hsqldb/testrun/sqltool/varnester.sql +++ /dev/null @@ -1,15 +0,0 @@ -/* - * $Id: varnester.sql 4428 2011-10-01 01:04:34Z unsaved $ - * - * Invokes another script that defines variables. - * Then we test that we have access to the variables. - */ - -/* Want to test with no user variables set like this, but unfortunately the - test script invoker always sets one user variable: -\p *{testvar} -- Should not expand the variable but should not abort -*/ - -\i varnestee.isql - -\p *{x} diff --git a/database/hsqldb/testrun/sqltool/vars.sql b/database/hsqldb/testrun/sqltool/vars.sql deleted file mode 100644 index 80198042..00000000 --- a/database/hsqldb/testrun/sqltool/vars.sql +++ /dev/null @@ -1,44 +0,0 @@ -/* - * $Id: vars.sql 5406 2014-10-13 20:53:18Z unsaved $ - */ - -* mt1 = -* mt2 = --- Following line has trailing white space, but that should have no effect. -* mt3 = -* - un1 -* - un2 - -* if (*unsetA != **NULL) \q Never used variable is not **NULL -* if (*un1 != **NULL) \q Explicitly unset variable is not **NULL -* if (*unsetA != *unsetB) \q Two never-set vars differ -* if (*un1 != *un2) \q Two explicitly unset variables differ -* if (*un1 != *unsetA) \q Explicitly unset vs. neverset vars differ - -* if (*mt1 != *mt2) \q Two legacy-unset vars differ - -* if (*mt1 != *mt3) \q Two legacy-unset vars differ, one set to blanks - -* if (*mt1 == *unset) \q Legacy-unset var != never-set var - -* if (alpha != alpha) \q Sanity constant comparison failed - -* a = alpha -* anotherA = alpha -* if (*a != *anotherA) \q To equivalant variable values differ - --- Following two have 2 trailing spaces: -* wsTrailed1 = alpha -* wsTrailed2 = alpha -* if (*wsTrailed1 == a) - \q Trailing white-space not honored in logical evaluation -* end if -* if (*wsTrailed1 != *wsTrailed2) - \q Trailing white-space not valued equally for logical evaluation -* end if - -* wsEmbed1 = alpha beta -* wsEmbed2 = alpha beta -* if (*wsEmbed1 != *wsEmbed2) - \q Embedded white-space not valued equally for logical evaluation -* end if diff --git a/database/hsqldb/testrun/sqltool/varswithspaces.sql b/database/hsqldb/testrun/sqltool/varswithspaces.sql deleted file mode 100644 index 1ce7aea6..00000000 --- a/database/hsqldb/testrun/sqltool/varswithspaces.sql +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Logical expressions where elements contain spaces. - */ - -* str1 = one two -* expected = one two -* wrong1 = one two -* wrong2 = one -* wrong3 = two - -*if (*str1 == *wrong1) \q 'one two' == 'one two' -*if (*str1 == *wrong2) \q 'one two' == 'one' -*if (*str1 == *wrong3) \q 'one two' == 'two' -*if (*str1 != *expected) \q (*{str1}) vs. (*{expected}) diff --git a/database/hsqldb/testrun/sqltool/write.inter b/database/hsqldb/testrun/sqltool/write.inter deleted file mode 100644 index cf16a925..00000000 --- a/database/hsqldb/testrun/sqltool/write.inter +++ /dev/null @@ -1,79 +0,0 @@ -/* - * $Id: write.inter 3340 2009-12-14 00:00:49Z unsaved $ - * - * Tests interactive command :w*. - * - * This script has some serious portability concerns, as detailed here. - * - * Can't think of a portable way to prepare/purge the output file. - * Depending on existence of "rm" program until a better solution found. - */ - -\c false -/* Since running interactively, need to either invoke with --abortOnErr switch, - * or use "\c false" Special command, to detect failures. */ - -* TARGETSCRIPT = ${java.io.tmpdir}${file.separator}sqltool-wtest-${user.name}.sql - -CREATE TABLE t(id INTEGER GENERATED BY DEFAULT AS IDENTITY, vc VARCHAR(80)); - -\p Testing write of non-sql, #1 -:w *{TARGETSCRIPT} -INSERT INTO t (vc) VALUES ('a'); -:w *{TARGETSCRIPT} -:; -INSERT INTO t (vc) VALUES ('b'); -INSERT INTO t (vc) VALUES ('c'); -:w *{TARGETSCRIPT} -\p Testing write of non-sql, #2 -:w *{TARGETSCRIPT} -INSERT INTO t (vc) VALUES ('d'); -INSERT INTO t (vc) VALUES ('e'); -INSERT INTO t (vc) VALUES ('f'); -:-2w *{TARGETSCRIPT} -:w *{TARGETSCRIPT} -/* Following line has trailing white space */ -:w *{TARGETSCRIPT} -:; -/* The :; commands will do non-effectual INSERTs, not :w's, since : - commands may not be recalled (since they don't make it into the buffer). */ - -/* Clean up the temp file if at all possible! */ -\p deleting -DELETE FROM t; -\p selecting -SELECT * FROM t; -\p executing -\i *{TARGETSCRIPT} -\p executed - -SELECT * FROM t; -\q - -SELECT COUNT(*) FROM t; -*if (*? != 5) - \! rm -f *{TARGETSCRIPT} - \q :w test failed / 1 -*end if -SELECT COUNT(*) FROM t WHERE vc = 'a'; -*if (*? != 1) - \! rm -f *{TARGETSCRIPT} - \q :w test failed / 2 -*end if -SELECT COUNT(*) FROM t WHERE vc = 'c'; -*if (*? != 1) - \! rm -f *{TARGETSCRIPT} - \q :w test failed / 3 -*end if -SELECT COUNT(*) FROM t WHERE vc = 'e'; -*if (*? != 1) - \! rm -f *{TARGETSCRIPT} - \q :w test failed / 4 -*end if -SELECT COUNT(*) FROM t WHERE vc = 'f'; -*if (*? != 2) - \! rm -f *{TARGETSCRIPT} - \q :w test failed / 5 -*end if - -\! rm -f *{TARGETSCRIPT} diff --git a/pom.xml b/pom.xml index 2d9dc444..4b07011b 100644 --- a/pom.xml +++ b/pom.xml @@ -21,14 +21,6 @@ org.springframework.boot spring-boot-starter-data-jpa - - org.springframework.boot - spring-boot-starter-data-rest - - - org.springframework.boot - spring-boot-starter-jdbc - org.springframework.boot spring-boot-starter-thymeleaf @@ -37,7 +29,6 @@ org.springframework.boot spring-boot-starter-web - org.springframework.boot spring-boot-starter-test @@ -49,15 +40,28 @@ 1.18.30 provided - - org.springframework.data - spring-data-jpa - org.hsqldb hsqldb runtime + + org.wikidata.wdtk + wdtk-dumpfiles + 0.14.4 + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-validation + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity6 + diff --git a/src/main/java/com/uniovi/WiqEs04bApplication.java b/src/main/java/com/uniovi/WiqEs04bApplication.java index 5fb4d165..7cd90279 100644 --- a/src/main/java/com/uniovi/WiqEs04bApplication.java +++ b/src/main/java/com/uniovi/WiqEs04bApplication.java @@ -1,14 +1,16 @@ package com.uniovi; +import jakarta.persistence.Persistence; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(exclude={DataSourceAutoConfiguration.class}) +@SpringBootApplication public class WiqEs04bApplication { - public static void main(String[] args) { SpringApplication.run(WiqEs04bApplication.class, args); } - } diff --git a/src/main/java/com/uniovi/components/CustomAuthenticationFailureHandler.java b/src/main/java/com/uniovi/components/CustomAuthenticationFailureHandler.java new file mode 100644 index 00000000..a95d5e10 --- /dev/null +++ b/src/main/java/com/uniovi/components/CustomAuthenticationFailureHandler.java @@ -0,0 +1,34 @@ +package com.uniovi.components; + +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; +import org.springframework.stereotype.Component; + +import java.io.IOException; + +@Component +public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) + throws ServletException, IOException { + setDefaultFailureUrl("/login?error"); + + super.onAuthenticationFailure(request, response, exception); + + String errorMessage = null; + + if (exception.getMessage().equalsIgnoreCase("User is disabled")) { + errorMessage = "Tu cuenta ha sido deshabilitada."; + } else if (exception.getMessage().equalsIgnoreCase("User account has expired")) { + errorMessage = "Tu cuenta ha expirado"; + } else if (exception.getMessage().equalsIgnoreCase("Bad credentials")) { + errorMessage = "Usuario o contraseña incorrectos"; + } + + request.getSession().setAttribute("loginErrorMessage", errorMessage); + } +} \ No newline at end of file diff --git a/src/main/java/com/uniovi/configuration/CustomConfiguration.java b/src/main/java/com/uniovi/configuration/CustomConfiguration.java new file mode 100644 index 00000000..f0a5bf95 --- /dev/null +++ b/src/main/java/com/uniovi/configuration/CustomConfiguration.java @@ -0,0 +1,11 @@ +package com.uniovi.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +@Configuration +public class CustomConfiguration { + +} diff --git a/src/main/java/com/uniovi/configuration/SecurityConfig.java b/src/main/java/com/uniovi/configuration/SecurityConfig.java new file mode 100644 index 00000000..fd97d7bc --- /dev/null +++ b/src/main/java/com/uniovi/configuration/SecurityConfig.java @@ -0,0 +1,79 @@ +package com.uniovi.configuration; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import com.uniovi.components.CustomAuthenticationFailureHandler; + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + private final UserDetailsService userDetailsService; + private final CustomAuthenticationFailureHandler customAuthenticationFailureHandler; + + @Autowired + public SecurityConfig(UserDetailsService userDetailsService, + CustomAuthenticationFailureHandler customAuthenticationFailureHandler) { + this.userDetailsService = userDetailsService; + this.customAuthenticationFailureHandler = customAuthenticationFailureHandler; + } + + @Bean + public static PasswordEncoder passwordEncoder(){ + return new BCryptPasswordEncoder(); + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.csrf(csrf -> csrf.disable()) + .authorizeHttpRequests((authorize) -> + authorize + .requestMatchers("/css/**", "/img/**", "/script/**").permitAll() + .requestMatchers("/home").authenticated() + .requestMatchers("/signup/**").permitAll() + .requestMatchers("/**").permitAll() + ).formLogin( + form -> form + .loginPage("/login") + .failureHandler(customAuthenticationFailureHandler) + .loginProcessingUrl("/login") + .defaultSuccessUrl("/home") + .permitAll() + ).logout( + logout -> logout + .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) + .permitAll() + ); + return http.build(); + } + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth + .userDetailsService(userDetailsService) + .passwordEncoder(passwordEncoder()); + } + + /** + * Method to check if the user is authenticated + * @param request HttpServletRequest + * @return boolean + */ + public static boolean isAuthenticated() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + return authentication != null && !(authentication instanceof AnonymousAuthenticationToken) + && authentication.isAuthenticated(); + } +} diff --git a/src/main/java/com/uniovi/controllers/CustomErrorController.java b/src/main/java/com/uniovi/controllers/CustomErrorController.java index 8d6016bb..1c3c2ae8 100644 --- a/src/main/java/com/uniovi/controllers/CustomErrorController.java +++ b/src/main/java/com/uniovi/controllers/CustomErrorController.java @@ -1,22 +1,15 @@ package com.uniovi.controllers; -import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; -import org.springframework.boot.autoconfigure.web.ErrorProperties; import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController; import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver; import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.servlet.error.ErrorAttributes; -import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.util.Assert; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.WebRequest; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.ExceptionHandler; -import java.util.Collections; import java.util.List; import java.util.Map; diff --git a/src/main/java/com/uniovi/controllers/HomeController.java b/src/main/java/com/uniovi/controllers/HomeController.java index 048614da..f090b0c2 100644 --- a/src/main/java/com/uniovi/controllers/HomeController.java +++ b/src/main/java/com/uniovi/controllers/HomeController.java @@ -1,11 +1,19 @@ package com.uniovi.controllers; +import com.uniovi.services.PlayerService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; @Controller public class HomeController{ + private final PlayerService playerService; + + @Autowired + public HomeController(PlayerService playerService) { + this.playerService = playerService; + } + @GetMapping("/") public String home(){ return "index"; diff --git a/src/main/java/com/uniovi/controllers/PlayersController.java b/src/main/java/com/uniovi/controllers/PlayersController.java new file mode 100644 index 00000000..87eb3ea7 --- /dev/null +++ b/src/main/java/com/uniovi/controllers/PlayersController.java @@ -0,0 +1,86 @@ +package com.uniovi.controllers; + +import com.uniovi.configuration.SecurityConfig; +import com.uniovi.entities.Player; +import com.uniovi.services.PlayerService; +import jakarta.servlet.http.HttpSession; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import com.uniovi.dto.PlayerDto; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.security.Principal; +import java.util.Optional; + +@Controller +public class PlayersController { + private final PlayerService playerService; + + @Autowired + public PlayersController(PlayerService playerService) { + this.playerService = playerService; + } + + @GetMapping("/signup") + public String showRegistrationForm(Model model){ + if (SecurityConfig.isAuthenticated()) + return "redirect:/home"; + + if (model.containsAttribute("user")) { + model.addAttribute("user", model.getAttribute("user")); + return "/player/signup"; + } + + model.addAttribute("user", new PlayerDto()); + return "/player/signup"; + } + + @PostMapping("/signup") + public String registerUserAccount(@Valid @ModelAttribute("user") PlayerDto user, BindingResult result, Model model){ + if (SecurityConfig.isAuthenticated()) + return "redirect:/home"; + + if(playerService.getUserByEmail(user.getEmail()).isPresent()){ + result.rejectValue("email", null, + "There is already an account registered with the same email"); + } + + if (playerService.getUserByUsername(user.getUsername()).isPresent()) { + result.rejectValue("username", null, + "There is already an account registered with the same username"); + } + + if(result.hasErrors()){ + model.addAttribute("user", user); + return "/player/signup"; + } + + playerService.addNewPlayer(user); + return "redirect:/"; + } + + @GetMapping("/login") + public String showLoginForm(Model model, @RequestParam(value = "error", required = false) String error, + HttpSession session) { + if (error != null) { + model.addAttribute("error", session.getAttribute("loginErrorMessage")); + System.out.println(session.getAttribute("loginErrorMessage")); + } + + if (SecurityConfig.isAuthenticated()) + return "redirect:/home"; + + return "/player/login"; + } + + @GetMapping("/home") + public String home(Model model, Principal principal) { + return "/player/home"; + } +} diff --git a/src/main/java/com/uniovi/dto/PlayerDto.java b/src/main/java/com/uniovi/dto/PlayerDto.java new file mode 100644 index 00000000..3b7a90b8 --- /dev/null +++ b/src/main/java/com/uniovi/dto/PlayerDto.java @@ -0,0 +1,18 @@ +package com.uniovi.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class PlayerDto { + private String username; + private String email; + private String password; + private String passwordConfirm; + private String[] roles; +} diff --git a/src/main/java/com/uniovi/dto/RoleDto.java b/src/main/java/com/uniovi/dto/RoleDto.java new file mode 100644 index 00000000..23565a2d --- /dev/null +++ b/src/main/java/com/uniovi/dto/RoleDto.java @@ -0,0 +1,14 @@ +package com.uniovi.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class RoleDto { + private String name; +} diff --git a/src/main/java/com/uniovi/entities/AppUser.java b/src/main/java/com/uniovi/entities/AppUser.java deleted file mode 100644 index 201df599..00000000 --- a/src/main/java/com/uniovi/entities/AppUser.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.uniovi.entities; - -import jakarta.annotation.Nonnull; -import jakarta.persistence.*; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -@Entity -public class AppUser { - @Id - @GeneratedValue - private Long id; - - @Column(unique = true, nullable = false) - @Getter @Setter @NonNull - private String nickname; - - @Getter @Setter @NonNull - private String name; - - @Getter @Setter @NonNull - private String surname; - - @Column(unique = true, nullable = false) - @Getter @Setter @NonNull - private String email; - - @Getter @Setter @NonNull - private String password; - - @Transient - @Getter @Setter - private String passwordConfirm; - - protected AppUser() {} -} diff --git a/src/main/java/com/uniovi/entities/Player.java b/src/main/java/com/uniovi/entities/Player.java new file mode 100644 index 00000000..eba49c42 --- /dev/null +++ b/src/main/java/com/uniovi/entities/Player.java @@ -0,0 +1,47 @@ +package com.uniovi.entities; + + +import jakarta.persistence.*; +import jakarta.validation.constraints.NotEmpty; +import lombok.*; + +import java.util.HashSet; +import java.util.Set; + +@Getter // getters para todas las propiedades +@Setter // setters para todas las propiedades +@NoArgsConstructor(access = AccessLevel.PROTECTED) // constructor sin argumentos +@Entity +public class Player { + @Id + @GeneratedValue + private Long id; + + @Column(unique = true, nullable = false) + @NotEmpty + private String username; + + @Column(unique = true, nullable = false) + private String email; + + @Column(nullable = false) + @NotEmpty + private String password; + + @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @JoinTable( + name="players_roles", + joinColumns={@JoinColumn(name="PLAYER_ID", referencedColumnName="ID")}, + inverseJoinColumns={@JoinColumn(name="ROLE_ID", referencedColumnName="NAME")}) + private Set roles = new HashSet<>(); + + // Transient: no se almacena en la base de datos + @Transient + private String passwordConfirm; + + public Player(String username, String email, String password) { + this.username = username; + this.email = email; + this.password = password; + } +} diff --git a/src/main/java/com/uniovi/entities/Role.java b/src/main/java/com/uniovi/entities/Role.java new file mode 100644 index 00000000..deaa4b6a --- /dev/null +++ b/src/main/java/com/uniovi/entities/Role.java @@ -0,0 +1,25 @@ +package com.uniovi.entities; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.HashSet; +import java.util.Set; + +@Getter +@Setter +@Entity +@NoArgsConstructor +public class Role { + @Id + private String name; + + @ManyToMany(mappedBy = "roles") + private Set players = new HashSet<>(); + + public Role(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/uniovi/repositories/PlayerRepository.java b/src/main/java/com/uniovi/repositories/PlayerRepository.java new file mode 100644 index 00000000..77c2d9f8 --- /dev/null +++ b/src/main/java/com/uniovi/repositories/PlayerRepository.java @@ -0,0 +1,9 @@ +package com.uniovi.repositories; + +import com.uniovi.entities.Player; +import org.springframework.data.repository.CrudRepository; + +public interface PlayerRepository extends CrudRepository { + Player findByEmail(String email); + Player findByUsername(String nickname); +} diff --git a/src/main/java/com/uniovi/repositories/RoleRepository.java b/src/main/java/com/uniovi/repositories/RoleRepository.java new file mode 100644 index 00000000..f8ab07bc --- /dev/null +++ b/src/main/java/com/uniovi/repositories/RoleRepository.java @@ -0,0 +1,7 @@ +package com.uniovi.repositories; + +import com.uniovi.entities.Role; +import org.springframework.data.repository.CrudRepository; + +public interface RoleRepository extends CrudRepository { +} diff --git a/src/main/java/com/uniovi/services/CustomUserDetailsService.java b/src/main/java/com/uniovi/services/CustomUserDetailsService.java new file mode 100644 index 00000000..2a1535ad --- /dev/null +++ b/src/main/java/com/uniovi/services/CustomUserDetailsService.java @@ -0,0 +1,44 @@ +package com.uniovi.services; + +import com.uniovi.entities.Player; +import com.uniovi.entities.Role; +import com.uniovi.repositories.PlayerRepository; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.stream.Collectors; + +@Service("userDetailsService") +public class CustomUserDetailsService implements UserDetailsService { + + private PlayerRepository playerRepository; + + public CustomUserDetailsService(PlayerRepository playerRepository) { + this.playerRepository = playerRepository; + } + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + Player user = playerRepository.findByUsername(username); + + if (user != null) { + return new org.springframework.security.core.userdetails.User(user.getUsername(), + user.getPassword(), + mapRolesToAuthorities(user.getRoles())); + } else{ + throw new UsernameNotFoundException("Invalid username or password."); + } + } + + private Collection< ? extends GrantedAuthority> mapRolesToAuthorities(Collection roles) { + Collection < ? extends GrantedAuthority> mapRoles = roles.stream() + .map(role -> new SimpleGrantedAuthority(role.getName())) + .collect(Collectors.toList()); + return mapRoles; + } +} diff --git a/src/main/java/com/uniovi/services/InsertSampleDataService.java b/src/main/java/com/uniovi/services/InsertSampleDataService.java new file mode 100644 index 00000000..7dabceda --- /dev/null +++ b/src/main/java/com/uniovi/services/InsertSampleDataService.java @@ -0,0 +1,28 @@ +package com.uniovi.services; + +import com.uniovi.dto.PlayerDto; +import com.uniovi.entities.Player; +import jakarta.annotation.PostConstruct; +import org.springframework.stereotype.Service; + +@Service +public class InsertSampleDataService { + private final PlayerService playerService; + + public InsertSampleDataService(PlayerService playerService) { + this.playerService = playerService; + } + + @PostConstruct + public void init() { + if (playerService.getUserByEmail("test@test.com").isPresent()) + return; + + PlayerDto player = new PlayerDto(); + player.setEmail("test@test.com"); + player.setUsername("test"); + player.setPassword("test"); + player.setRoles(new String[]{"ROLE_USER"}); + playerService.addNewPlayer(player); + } +} diff --git a/src/main/java/com/uniovi/services/PlayerService.java b/src/main/java/com/uniovi/services/PlayerService.java new file mode 100644 index 00000000..6d59e136 --- /dev/null +++ b/src/main/java/com/uniovi/services/PlayerService.java @@ -0,0 +1,49 @@ +package com.uniovi.services; + +import com.uniovi.dto.PlayerDto; +import com.uniovi.entities.Player; +import com.uniovi.repositories.PlayerRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.ArrayList; +import java.util.Optional; + +@Service +public interface PlayerService { + /** + * Add a new player to the database + * @param dto PlayerDto with the information of the new player + * @return The new player + * @throws IllegalArgumentException if the email or nickname are already in use + */ + Player addNewPlayer(PlayerDto dto); + + /** + * Get all the players in the database + * @return A list with all the players + */ + List getUsers(); + + /** + * Get a player by its id + * @param id The id of the player + * @return The player with the given id + */ + Optional getUser(Long id); + + /** + * Get a player by its email + * @param email The email of the player + * @return The player with the given email + */ + Optional getUserByEmail(String email); + + /** + * Get a player by its username + * @param username The nickname of the player + * @return The player with the given nickname + */ + Optional getUserByUsername(String username); +} diff --git a/src/main/java/com/uniovi/services/RoleService.java b/src/main/java/com/uniovi/services/RoleService.java new file mode 100644 index 00000000..ae094f14 --- /dev/null +++ b/src/main/java/com/uniovi/services/RoleService.java @@ -0,0 +1,29 @@ +package com.uniovi.services; + +import com.uniovi.dto.RoleDto; +import com.uniovi.entities.Role; + +import java.util.List; + +public interface RoleService { + /** + * Add a new role to the database + * @param role RoleDto with the information of the new role + * @return The new role + * @throws IllegalArgumentException if the role already exists + */ + Role addRole(RoleDto role); + + /** + * Get a role by its name + * @param name The name of the role + * @return The role with the given name + */ + Role getRole(String name); + + /** + * Get all the roles in the database + * @return A list with all the roles + */ + List getRoles(); +} diff --git a/src/main/java/com/uniovi/services/SecurityService.java b/src/main/java/com/uniovi/services/SecurityService.java new file mode 100644 index 00000000..e313f1d5 --- /dev/null +++ b/src/main/java/com/uniovi/services/SecurityService.java @@ -0,0 +1,5 @@ +package com.uniovi.services; + +public interface SecurityService { + +} \ No newline at end of file diff --git a/src/main/java/com/uniovi/services/impl/PlayerServiceImpl.java b/src/main/java/com/uniovi/services/impl/PlayerServiceImpl.java new file mode 100644 index 00000000..00d15a98 --- /dev/null +++ b/src/main/java/com/uniovi/services/impl/PlayerServiceImpl.java @@ -0,0 +1,72 @@ +package com.uniovi.services.impl; + +import com.uniovi.dto.PlayerDto; +import com.uniovi.dto.RoleDto; +import com.uniovi.entities.Player; +import com.uniovi.repositories.PlayerRepository; +import com.uniovi.repositories.RoleRepository; +import com.uniovi.services.PlayerService; +import com.uniovi.services.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import com.uniovi.entities.Role; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +@Service +public class PlayerServiceImpl implements PlayerService { + private PlayerRepository playerRepository; + private RoleService roleService; + private PasswordEncoder passwordEncoder; + + public PlayerServiceImpl(PlayerRepository playerRepository, RoleService roleService, PasswordEncoder passwordEncoder) { + this.playerRepository = playerRepository; + this.roleService = roleService; + this.passwordEncoder = passwordEncoder; + } + + @Override + public Player addNewPlayer(PlayerDto dto) { + if (playerRepository.findByEmail(dto.getEmail()) != null) { + throw new IllegalArgumentException("Email already in use"); + } + + if (playerRepository.findByUsername(dto.getUsername()) != null) { + throw new IllegalArgumentException("Username already in use"); + } + + Player player = new Player( + dto.getUsername(), + dto.getEmail(), + passwordEncoder.encode(dto.getPassword()) + ); + + playerRepository.save(player); + return player; + } + + @Override + public List getUsers() { + List l = new ArrayList<>(); + playerRepository.findAll().forEach(l::add); + return l; + } + + @Override + public Optional getUser(Long id) { + return playerRepository.findById(id); + } + + @Override + public Optional getUserByEmail(String email) { + return Optional.ofNullable(playerRepository.findByEmail(email)); + } + + @Override + public Optional getUserByUsername(String username) { + return Optional.ofNullable(playerRepository.findByUsername(username)); + } +} diff --git a/src/main/java/com/uniovi/services/impl/RoleServiceImpl.java b/src/main/java/com/uniovi/services/impl/RoleServiceImpl.java new file mode 100644 index 00000000..0fae17ca --- /dev/null +++ b/src/main/java/com/uniovi/services/impl/RoleServiceImpl.java @@ -0,0 +1,45 @@ +package com.uniovi.services.impl; + +import com.uniovi.dto.RoleDto; +import com.uniovi.entities.Role; +import com.uniovi.repositories.RoleRepository; +import com.uniovi.services.RoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class RoleServiceImpl implements RoleService { + private final RoleRepository roleRepository; + + @Autowired + public RoleServiceImpl(RoleRepository roleRepository) { + this.roleRepository = roleRepository; + } + + @Override + public Role addRole(RoleDto role) { + Role foundRole = roleRepository.findById(role.getName()).orElse(null); + if (foundRole != null) { + return foundRole; + } + + Role newRole = new Role(role.getName()); + roleRepository.save(newRole); + return newRole; + } + + @Override + public Role getRole(String name) { + return roleRepository.findById(name).orElse(null); + } + + @Override + public List getRoles() { + List roles = new ArrayList<>(); + roleRepository.findAll().forEach(roles::add); + return roles; + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 6ad07093..9dba37d4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,11 +1,8 @@ server.port=80 # HSQL db +spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver spring.datasource.url=jdbc:hsqldb:hsql://localhost:9001 -spring.datasource.username=SA +spring.datasource.username=sa spring.datasource.password= -spring.datasource.driver-class-name=org.hsqldb.jdbcDriver -# No crear ninguna tabla, solo validar: -#spring.jpa.hibernate.ddl-auto=validate -# Crear la tabla de nuevo -spring.jpa.hibernate.ddl-auto=create +spring.jpa.hibernate.ddl-auto=update \ No newline at end of file diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html index 39b5fd61..b461e3f7 100644 --- a/src/main/resources/templates/error.html +++ b/src/main/resources/templates/error.html @@ -15,10 +15,6 @@

    Error!

    -
    -

    Traza:

    -
    
    -    
    diff --git a/src/main/resources/templates/fragments/footer.html b/src/main/resources/templates/fragments/footer.html index 21c23bbe..d56a7df3 100644 --- a/src/main/resources/templates/fragments/footer.html +++ b/src/main/resources/templates/fragments/footer.html @@ -1,5 +1,5 @@ -